@xsolla/xui-input-phone 0.199.0 → 0.201.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 +3 -3
package/native/index.js
CHANGED
|
@@ -47,6 +47,38 @@ var import_react3 = __toESM(require("react"));
|
|
|
47
47
|
// ../../foundation/primitives-native/src/Box.tsx
|
|
48
48
|
var import_react_native = require("react-native");
|
|
49
49
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
50
|
+
var roleToAccessibilityRole = {
|
|
51
|
+
button: "button",
|
|
52
|
+
link: "link",
|
|
53
|
+
img: "image",
|
|
54
|
+
image: "image",
|
|
55
|
+
summary: "summary",
|
|
56
|
+
switch: "switch",
|
|
57
|
+
checkbox: "checkbox",
|
|
58
|
+
radio: "radio",
|
|
59
|
+
heading: "header",
|
|
60
|
+
text: "text",
|
|
61
|
+
search: "search",
|
|
62
|
+
alert: "alert",
|
|
63
|
+
none: "none",
|
|
64
|
+
presentation: "none",
|
|
65
|
+
progressbar: "progressbar",
|
|
66
|
+
scrollbar: "scrollbar",
|
|
67
|
+
adjustable: "adjustable",
|
|
68
|
+
tab: "tab",
|
|
69
|
+
menu: "menu",
|
|
70
|
+
menuitem: "menuitem",
|
|
71
|
+
list: "list",
|
|
72
|
+
timer: "timer"
|
|
73
|
+
};
|
|
74
|
+
var toGapValue = (gap) => {
|
|
75
|
+
if (gap === void 0) return void 0;
|
|
76
|
+
if (typeof gap === "number") return gap;
|
|
77
|
+
const pxMatch = /^(\d+(?:\.\d+)?)px$/.exec(gap);
|
|
78
|
+
if (pxMatch) return Number(pxMatch[1]);
|
|
79
|
+
const asNumber = Number(gap);
|
|
80
|
+
return Number.isFinite(asNumber) ? asNumber : void 0;
|
|
81
|
+
};
|
|
50
82
|
var Box = ({
|
|
51
83
|
children,
|
|
52
84
|
onPress,
|
|
@@ -79,8 +111,10 @@ var Box = ({
|
|
|
79
111
|
marginLeft,
|
|
80
112
|
marginRight,
|
|
81
113
|
flexDirection,
|
|
114
|
+
flexWrap,
|
|
82
115
|
alignItems,
|
|
83
116
|
justifyContent,
|
|
117
|
+
alignSelf,
|
|
84
118
|
position,
|
|
85
119
|
top,
|
|
86
120
|
bottom,
|
|
@@ -92,11 +126,14 @@ var Box = ({
|
|
|
92
126
|
maxWidth,
|
|
93
127
|
maxHeight,
|
|
94
128
|
flex,
|
|
129
|
+
flexShrink,
|
|
130
|
+
gap,
|
|
95
131
|
overflow,
|
|
96
132
|
zIndex,
|
|
97
133
|
hoverStyle,
|
|
98
134
|
pressStyle,
|
|
99
135
|
style,
|
|
136
|
+
disabled,
|
|
100
137
|
"data-testid": dataTestId,
|
|
101
138
|
testID,
|
|
102
139
|
as,
|
|
@@ -135,14 +172,18 @@ var Box = ({
|
|
|
135
172
|
marginLeft,
|
|
136
173
|
marginRight,
|
|
137
174
|
flexDirection,
|
|
175
|
+
flexWrap,
|
|
138
176
|
alignItems,
|
|
139
177
|
justifyContent,
|
|
178
|
+
alignSelf,
|
|
140
179
|
position,
|
|
141
180
|
top,
|
|
142
181
|
bottom,
|
|
143
182
|
left,
|
|
144
183
|
right,
|
|
145
184
|
flex,
|
|
185
|
+
flexShrink,
|
|
186
|
+
gap: toGapValue(gap),
|
|
146
187
|
...style
|
|
147
188
|
});
|
|
148
189
|
const finalTestID = dataTestId || testID;
|
|
@@ -151,15 +192,25 @@ var Box = ({
|
|
|
151
192
|
tabIndex,
|
|
152
193
|
onKeyDown,
|
|
153
194
|
onKeyUp,
|
|
154
|
-
"aria-label":
|
|
195
|
+
"aria-label": ariaLabel,
|
|
155
196
|
"aria-labelledby": _ariaLabelledBy,
|
|
156
197
|
"aria-current": _ariaCurrent,
|
|
157
|
-
"aria-disabled":
|
|
158
|
-
"aria-live":
|
|
198
|
+
"aria-disabled": ariaDisabled,
|
|
199
|
+
"aria-live": ariaLive,
|
|
200
|
+
"aria-busy": ariaBusy,
|
|
159
201
|
className,
|
|
160
202
|
"data-testid": _dataTestId,
|
|
203
|
+
cursor: _cursor,
|
|
204
|
+
type: _type,
|
|
161
205
|
...nativeRest
|
|
162
206
|
} = rest;
|
|
207
|
+
const accessibilityRole = typeof role === "string" && roleToAccessibilityRole[role] || (as === "button" ? "button" : void 0);
|
|
208
|
+
const isDisabled = Boolean(disabled || ariaDisabled);
|
|
209
|
+
const accessibilityState = {
|
|
210
|
+
disabled: isDisabled || void 0,
|
|
211
|
+
busy: Boolean(ariaBusy) || void 0
|
|
212
|
+
};
|
|
213
|
+
const accessibilityLiveRegion = ariaLive === "polite" || ariaLive === "assertive" ? ariaLive : void 0;
|
|
163
214
|
if (as === "img" && src) {
|
|
164
215
|
const imageStyle = {
|
|
165
216
|
width,
|
|
@@ -178,16 +229,18 @@ var Box = ({
|
|
|
178
229
|
source: { uri: src },
|
|
179
230
|
style: imageStyle,
|
|
180
231
|
testID: finalTestID,
|
|
232
|
+
accessibilityLabel: typeof ariaLabel === "string" ? ariaLabel : alt,
|
|
181
233
|
resizeMode: "cover",
|
|
182
234
|
...nativeRest
|
|
183
235
|
}
|
|
184
236
|
);
|
|
185
237
|
}
|
|
186
|
-
if (onPress) {
|
|
238
|
+
if (onPress || as === "button") {
|
|
187
239
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
188
240
|
import_react_native.Pressable,
|
|
189
241
|
{
|
|
190
|
-
onPress,
|
|
242
|
+
onPress: !isDisabled && onPress ? onPress : void 0,
|
|
243
|
+
disabled: isDisabled,
|
|
191
244
|
onLayout,
|
|
192
245
|
onMoveShouldSetResponder,
|
|
193
246
|
onResponderGrant,
|
|
@@ -196,6 +249,10 @@ var Box = ({
|
|
|
196
249
|
onResponderTerminate,
|
|
197
250
|
style: ({ pressed }) => getContainerStyle(pressed),
|
|
198
251
|
testID: finalTestID,
|
|
252
|
+
accessibilityRole,
|
|
253
|
+
accessibilityLabel: typeof ariaLabel === "string" ? ariaLabel : void 0,
|
|
254
|
+
accessibilityState,
|
|
255
|
+
accessibilityLiveRegion,
|
|
199
256
|
...nativeRest,
|
|
200
257
|
children
|
|
201
258
|
}
|
|
@@ -212,6 +269,10 @@ var Box = ({
|
|
|
212
269
|
onResponderMove,
|
|
213
270
|
onResponderRelease,
|
|
214
271
|
onResponderTerminate,
|
|
272
|
+
accessibilityRole,
|
|
273
|
+
accessibilityLabel: typeof ariaLabel === "string" ? ariaLabel : void 0,
|
|
274
|
+
accessibilityState,
|
|
275
|
+
accessibilityLiveRegion,
|
|
215
276
|
...nativeRest,
|
|
216
277
|
children
|
|
217
278
|
}
|