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