@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.mjs CHANGED
@@ -13,6 +13,38 @@ import {
13
13
  Image
14
14
  } from "react-native";
15
15
  import { jsx } from "react/jsx-runtime";
16
+ var roleToAccessibilityRole = {
17
+ button: "button",
18
+ link: "link",
19
+ img: "image",
20
+ image: "image",
21
+ summary: "summary",
22
+ switch: "switch",
23
+ checkbox: "checkbox",
24
+ radio: "radio",
25
+ heading: "header",
26
+ text: "text",
27
+ search: "search",
28
+ alert: "alert",
29
+ none: "none",
30
+ presentation: "none",
31
+ progressbar: "progressbar",
32
+ scrollbar: "scrollbar",
33
+ adjustable: "adjustable",
34
+ tab: "tab",
35
+ menu: "menu",
36
+ menuitem: "menuitem",
37
+ list: "list",
38
+ timer: "timer"
39
+ };
40
+ var toGapValue = (gap) => {
41
+ if (gap === void 0) return void 0;
42
+ if (typeof gap === "number") return gap;
43
+ const pxMatch = /^(\d+(?:\.\d+)?)px$/.exec(gap);
44
+ if (pxMatch) return Number(pxMatch[1]);
45
+ const asNumber = Number(gap);
46
+ return Number.isFinite(asNumber) ? asNumber : void 0;
47
+ };
16
48
  var Box = ({
17
49
  children,
18
50
  onPress,
@@ -45,8 +77,10 @@ var Box = ({
45
77
  marginLeft,
46
78
  marginRight,
47
79
  flexDirection,
80
+ flexWrap,
48
81
  alignItems,
49
82
  justifyContent,
83
+ alignSelf,
50
84
  position,
51
85
  top,
52
86
  bottom,
@@ -58,11 +92,14 @@ var Box = ({
58
92
  maxWidth,
59
93
  maxHeight,
60
94
  flex,
95
+ flexShrink,
96
+ gap,
61
97
  overflow,
62
98
  zIndex,
63
99
  hoverStyle,
64
100
  pressStyle,
65
101
  style,
102
+ disabled,
66
103
  "data-testid": dataTestId,
67
104
  testID,
68
105
  as,
@@ -101,14 +138,18 @@ var Box = ({
101
138
  marginLeft,
102
139
  marginRight,
103
140
  flexDirection,
141
+ flexWrap,
104
142
  alignItems,
105
143
  justifyContent,
144
+ alignSelf,
106
145
  position,
107
146
  top,
108
147
  bottom,
109
148
  left,
110
149
  right,
111
150
  flex,
151
+ flexShrink,
152
+ gap: toGapValue(gap),
112
153
  ...style
113
154
  });
114
155
  const finalTestID = dataTestId || testID;
@@ -117,15 +158,25 @@ var Box = ({
117
158
  tabIndex,
118
159
  onKeyDown,
119
160
  onKeyUp,
120
- "aria-label": _ariaLabel,
161
+ "aria-label": ariaLabel,
121
162
  "aria-labelledby": _ariaLabelledBy,
122
163
  "aria-current": _ariaCurrent,
123
- "aria-disabled": _ariaDisabled,
124
- "aria-live": _ariaLive,
164
+ "aria-disabled": ariaDisabled,
165
+ "aria-live": ariaLive,
166
+ "aria-busy": ariaBusy,
125
167
  className,
126
168
  "data-testid": _dataTestId,
169
+ cursor: _cursor,
170
+ type: _type,
127
171
  ...nativeRest
128
172
  } = rest;
173
+ const accessibilityRole = typeof role === "string" && roleToAccessibilityRole[role] || (as === "button" ? "button" : void 0);
174
+ const isDisabled = Boolean(disabled || ariaDisabled);
175
+ const accessibilityState = {
176
+ disabled: isDisabled || void 0,
177
+ busy: Boolean(ariaBusy) || void 0
178
+ };
179
+ const accessibilityLiveRegion = ariaLive === "polite" || ariaLive === "assertive" ? ariaLive : void 0;
129
180
  if (as === "img" && src) {
130
181
  const imageStyle = {
131
182
  width,
@@ -144,16 +195,18 @@ var Box = ({
144
195
  source: { uri: src },
145
196
  style: imageStyle,
146
197
  testID: finalTestID,
198
+ accessibilityLabel: typeof ariaLabel === "string" ? ariaLabel : alt,
147
199
  resizeMode: "cover",
148
200
  ...nativeRest
149
201
  }
150
202
  );
151
203
  }
152
- if (onPress) {
204
+ if (onPress || as === "button") {
153
205
  return /* @__PURE__ */ jsx(
154
206
  Pressable,
155
207
  {
156
- onPress,
208
+ onPress: !isDisabled && onPress ? onPress : void 0,
209
+ disabled: isDisabled,
157
210
  onLayout,
158
211
  onMoveShouldSetResponder,
159
212
  onResponderGrant,
@@ -162,6 +215,10 @@ var Box = ({
162
215
  onResponderTerminate,
163
216
  style: ({ pressed }) => getContainerStyle(pressed),
164
217
  testID: finalTestID,
218
+ accessibilityRole,
219
+ accessibilityLabel: typeof ariaLabel === "string" ? ariaLabel : void 0,
220
+ accessibilityState,
221
+ accessibilityLiveRegion,
165
222
  ...nativeRest,
166
223
  children
167
224
  }
@@ -178,6 +235,10 @@ var Box = ({
178
235
  onResponderMove,
179
236
  onResponderRelease,
180
237
  onResponderTerminate,
238
+ accessibilityRole,
239
+ accessibilityLabel: typeof ariaLabel === "string" ? ariaLabel : void 0,
240
+ accessibilityState,
241
+ accessibilityLiveRegion,
181
242
  ...nativeRest,
182
243
  children
183
244
  }