@xsolla/xui-multi-select 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
@@ -40,6 +40,38 @@ var import_react10 = require("react");
40
40
  // ../../foundation/primitives-native/src/Box.tsx
41
41
  var import_react_native = require("react-native");
42
42
  var import_jsx_runtime = require("react/jsx-runtime");
43
+ var roleToAccessibilityRole = {
44
+ button: "button",
45
+ link: "link",
46
+ img: "image",
47
+ image: "image",
48
+ summary: "summary",
49
+ switch: "switch",
50
+ checkbox: "checkbox",
51
+ radio: "radio",
52
+ heading: "header",
53
+ text: "text",
54
+ search: "search",
55
+ alert: "alert",
56
+ none: "none",
57
+ presentation: "none",
58
+ progressbar: "progressbar",
59
+ scrollbar: "scrollbar",
60
+ adjustable: "adjustable",
61
+ tab: "tab",
62
+ menu: "menu",
63
+ menuitem: "menuitem",
64
+ list: "list",
65
+ timer: "timer"
66
+ };
67
+ var toGapValue = (gap) => {
68
+ if (gap === void 0) return void 0;
69
+ if (typeof gap === "number") return gap;
70
+ const pxMatch = /^(\d+(?:\.\d+)?)px$/.exec(gap);
71
+ if (pxMatch) return Number(pxMatch[1]);
72
+ const asNumber = Number(gap);
73
+ return Number.isFinite(asNumber) ? asNumber : void 0;
74
+ };
43
75
  var Box = ({
44
76
  children,
45
77
  onPress,
@@ -72,8 +104,10 @@ var Box = ({
72
104
  marginLeft,
73
105
  marginRight,
74
106
  flexDirection,
107
+ flexWrap,
75
108
  alignItems,
76
109
  justifyContent,
110
+ alignSelf,
77
111
  position,
78
112
  top,
79
113
  bottom,
@@ -85,11 +119,14 @@ var Box = ({
85
119
  maxWidth,
86
120
  maxHeight,
87
121
  flex,
122
+ flexShrink,
123
+ gap,
88
124
  overflow,
89
125
  zIndex,
90
126
  hoverStyle,
91
127
  pressStyle,
92
128
  style,
129
+ disabled,
93
130
  "data-testid": dataTestId,
94
131
  testID,
95
132
  as,
@@ -128,14 +165,18 @@ var Box = ({
128
165
  marginLeft,
129
166
  marginRight,
130
167
  flexDirection,
168
+ flexWrap,
131
169
  alignItems,
132
170
  justifyContent,
171
+ alignSelf,
133
172
  position,
134
173
  top,
135
174
  bottom,
136
175
  left,
137
176
  right,
138
177
  flex,
178
+ flexShrink,
179
+ gap: toGapValue(gap),
139
180
  ...style
140
181
  });
141
182
  const finalTestID = dataTestId || testID;
@@ -144,15 +185,25 @@ var Box = ({
144
185
  tabIndex,
145
186
  onKeyDown,
146
187
  onKeyUp,
147
- "aria-label": _ariaLabel,
188
+ "aria-label": ariaLabel,
148
189
  "aria-labelledby": _ariaLabelledBy,
149
190
  "aria-current": _ariaCurrent,
150
- "aria-disabled": _ariaDisabled,
151
- "aria-live": _ariaLive,
191
+ "aria-disabled": ariaDisabled,
192
+ "aria-live": ariaLive,
193
+ "aria-busy": ariaBusy,
152
194
  className,
153
195
  "data-testid": _dataTestId,
196
+ cursor: _cursor,
197
+ type: _type,
154
198
  ...nativeRest
155
199
  } = rest;
200
+ const accessibilityRole = typeof role === "string" && roleToAccessibilityRole[role] || (as === "button" ? "button" : void 0);
201
+ const isDisabled = Boolean(disabled || ariaDisabled);
202
+ const accessibilityState = {
203
+ disabled: isDisabled || void 0,
204
+ busy: Boolean(ariaBusy) || void 0
205
+ };
206
+ const accessibilityLiveRegion = ariaLive === "polite" || ariaLive === "assertive" ? ariaLive : void 0;
156
207
  if (as === "img" && src) {
157
208
  const imageStyle = {
158
209
  width,
@@ -171,16 +222,18 @@ var Box = ({
171
222
  source: { uri: src },
172
223
  style: imageStyle,
173
224
  testID: finalTestID,
225
+ accessibilityLabel: typeof ariaLabel === "string" ? ariaLabel : alt,
174
226
  resizeMode: "cover",
175
227
  ...nativeRest
176
228
  }
177
229
  );
178
230
  }
179
- if (onPress) {
231
+ if (onPress || as === "button") {
180
232
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
181
233
  import_react_native.Pressable,
182
234
  {
183
- onPress,
235
+ onPress: !isDisabled && onPress ? onPress : void 0,
236
+ disabled: isDisabled,
184
237
  onLayout,
185
238
  onMoveShouldSetResponder,
186
239
  onResponderGrant,
@@ -189,6 +242,10 @@ var Box = ({
189
242
  onResponderTerminate,
190
243
  style: ({ pressed }) => getContainerStyle(pressed),
191
244
  testID: finalTestID,
245
+ accessibilityRole,
246
+ accessibilityLabel: typeof ariaLabel === "string" ? ariaLabel : void 0,
247
+ accessibilityState,
248
+ accessibilityLiveRegion,
192
249
  ...nativeRest,
193
250
  children
194
251
  }
@@ -205,6 +262,10 @@ var Box = ({
205
262
  onResponderMove,
206
263
  onResponderRelease,
207
264
  onResponderTerminate,
265
+ accessibilityRole,
266
+ accessibilityLabel: typeof ariaLabel === "string" ? ariaLabel : void 0,
267
+ accessibilityState,
268
+ accessibilityLiveRegion,
208
269
  ...nativeRest,
209
270
  children
210
271
  }