@xsolla/xui-image-thumbnail 0.84.0-pr128.1770078557
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.d.mts +44 -0
- package/native/index.d.ts +44 -0
- package/native/index.js +621 -0
- package/native/index.js.flow +106 -0
- package/native/index.js.map +1 -0
- package/native/index.mjs +588 -0
- package/native/index.mjs.map +1 -0
- package/package.json +58 -0
- package/web/index.d.mts +44 -0
- package/web/index.d.ts +44 -0
- package/web/index.js +628 -0
- package/web/index.js.flow +106 -0
- package/web/index.js.map +1 -0
- package/web/index.mjs +591 -0
- package/web/index.mjs.map +1 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
type ImageThumbnailRatio = "1:1" | "16:9" | "4:3" | "3:2" | "2:3" | "9:16" | "custom";
|
|
4
|
+
type ImageThumbnailOverlay = "none" | "fade" | "dark";
|
|
5
|
+
interface ImageThumbnailProps {
|
|
6
|
+
/** Image source URL */
|
|
7
|
+
src: string;
|
|
8
|
+
/** Alt text for the image */
|
|
9
|
+
alt?: string;
|
|
10
|
+
/** Aspect ratio of the thumbnail */
|
|
11
|
+
ratio?: ImageThumbnailRatio;
|
|
12
|
+
/** Custom aspect ratio (only used when ratio is 'custom') */
|
|
13
|
+
customRatio?: number;
|
|
14
|
+
/** Width of the thumbnail */
|
|
15
|
+
width?: number | string;
|
|
16
|
+
/** Height of the thumbnail (overrides ratio if provided) */
|
|
17
|
+
height?: number | string;
|
|
18
|
+
/** Border radius */
|
|
19
|
+
borderRadius?: number;
|
|
20
|
+
/** Overlay type */
|
|
21
|
+
overlay?: ImageThumbnailOverlay;
|
|
22
|
+
/** Content displayed in the center (e.g., play button) */
|
|
23
|
+
centerContent?: React.ReactNode;
|
|
24
|
+
/** Content displayed in top-left corner */
|
|
25
|
+
tagsTopLeft?: React.ReactNode;
|
|
26
|
+
/** Content displayed in top-right corner */
|
|
27
|
+
tagsTopRight?: React.ReactNode;
|
|
28
|
+
/** Content displayed in bottom-left corner */
|
|
29
|
+
tagsBottomLeft?: React.ReactNode;
|
|
30
|
+
/** Content displayed in bottom-right corner */
|
|
31
|
+
tagsBottomRight?: React.ReactNode;
|
|
32
|
+
/** Click handler */
|
|
33
|
+
onPress?: () => void;
|
|
34
|
+
/** Custom className */
|
|
35
|
+
className?: string;
|
|
36
|
+
/** Padding for tag positions */
|
|
37
|
+
tagPadding?: number;
|
|
38
|
+
/** Gap between tags */
|
|
39
|
+
tagGap?: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare const ImageThumbnail: React.FC<ImageThumbnailProps>;
|
|
43
|
+
|
|
44
|
+
export { ImageThumbnail, type ImageThumbnailOverlay, type ImageThumbnailProps, type ImageThumbnailRatio };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
type ImageThumbnailRatio = "1:1" | "16:9" | "4:3" | "3:2" | "2:3" | "9:16" | "custom";
|
|
4
|
+
type ImageThumbnailOverlay = "none" | "fade" | "dark";
|
|
5
|
+
interface ImageThumbnailProps {
|
|
6
|
+
/** Image source URL */
|
|
7
|
+
src: string;
|
|
8
|
+
/** Alt text for the image */
|
|
9
|
+
alt?: string;
|
|
10
|
+
/** Aspect ratio of the thumbnail */
|
|
11
|
+
ratio?: ImageThumbnailRatio;
|
|
12
|
+
/** Custom aspect ratio (only used when ratio is 'custom') */
|
|
13
|
+
customRatio?: number;
|
|
14
|
+
/** Width of the thumbnail */
|
|
15
|
+
width?: number | string;
|
|
16
|
+
/** Height of the thumbnail (overrides ratio if provided) */
|
|
17
|
+
height?: number | string;
|
|
18
|
+
/** Border radius */
|
|
19
|
+
borderRadius?: number;
|
|
20
|
+
/** Overlay type */
|
|
21
|
+
overlay?: ImageThumbnailOverlay;
|
|
22
|
+
/** Content displayed in the center (e.g., play button) */
|
|
23
|
+
centerContent?: React.ReactNode;
|
|
24
|
+
/** Content displayed in top-left corner */
|
|
25
|
+
tagsTopLeft?: React.ReactNode;
|
|
26
|
+
/** Content displayed in top-right corner */
|
|
27
|
+
tagsTopRight?: React.ReactNode;
|
|
28
|
+
/** Content displayed in bottom-left corner */
|
|
29
|
+
tagsBottomLeft?: React.ReactNode;
|
|
30
|
+
/** Content displayed in bottom-right corner */
|
|
31
|
+
tagsBottomRight?: React.ReactNode;
|
|
32
|
+
/** Click handler */
|
|
33
|
+
onPress?: () => void;
|
|
34
|
+
/** Custom className */
|
|
35
|
+
className?: string;
|
|
36
|
+
/** Padding for tag positions */
|
|
37
|
+
tagPadding?: number;
|
|
38
|
+
/** Gap between tags */
|
|
39
|
+
tagGap?: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare const ImageThumbnail: React.FC<ImageThumbnailProps>;
|
|
43
|
+
|
|
44
|
+
export { ImageThumbnail, type ImageThumbnailOverlay, type ImageThumbnailProps, type ImageThumbnailRatio };
|
package/native/index.js
ADDED
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.tsx
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
ImageThumbnail: () => ImageThumbnail
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(index_exports);
|
|
36
|
+
|
|
37
|
+
// ../primitives-native/src/Box.tsx
|
|
38
|
+
var import_react_native = require("react-native");
|
|
39
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
+
var Box = ({
|
|
41
|
+
children,
|
|
42
|
+
onPress,
|
|
43
|
+
onLayout,
|
|
44
|
+
onMoveShouldSetResponder,
|
|
45
|
+
onResponderGrant,
|
|
46
|
+
onResponderMove,
|
|
47
|
+
onResponderRelease,
|
|
48
|
+
onResponderTerminate,
|
|
49
|
+
backgroundColor,
|
|
50
|
+
borderColor,
|
|
51
|
+
borderWidth,
|
|
52
|
+
borderBottomWidth,
|
|
53
|
+
borderBottomColor,
|
|
54
|
+
borderTopWidth,
|
|
55
|
+
borderTopColor,
|
|
56
|
+
borderLeftWidth,
|
|
57
|
+
borderLeftColor,
|
|
58
|
+
borderRightWidth,
|
|
59
|
+
borderRightColor,
|
|
60
|
+
borderRadius,
|
|
61
|
+
borderStyle,
|
|
62
|
+
height,
|
|
63
|
+
padding,
|
|
64
|
+
paddingHorizontal,
|
|
65
|
+
paddingVertical,
|
|
66
|
+
margin,
|
|
67
|
+
marginTop,
|
|
68
|
+
marginBottom,
|
|
69
|
+
marginLeft,
|
|
70
|
+
marginRight,
|
|
71
|
+
flexDirection,
|
|
72
|
+
alignItems,
|
|
73
|
+
justifyContent,
|
|
74
|
+
position,
|
|
75
|
+
top,
|
|
76
|
+
bottom,
|
|
77
|
+
left,
|
|
78
|
+
right,
|
|
79
|
+
width,
|
|
80
|
+
flex,
|
|
81
|
+
overflow,
|
|
82
|
+
zIndex,
|
|
83
|
+
hoverStyle,
|
|
84
|
+
pressStyle,
|
|
85
|
+
style,
|
|
86
|
+
"data-testid": dataTestId,
|
|
87
|
+
testID,
|
|
88
|
+
as,
|
|
89
|
+
src,
|
|
90
|
+
alt,
|
|
91
|
+
...rest
|
|
92
|
+
}) => {
|
|
93
|
+
const getContainerStyle = (pressed) => ({
|
|
94
|
+
backgroundColor: pressed && pressStyle?.backgroundColor ? pressStyle.backgroundColor : backgroundColor,
|
|
95
|
+
borderColor,
|
|
96
|
+
borderWidth,
|
|
97
|
+
borderBottomWidth,
|
|
98
|
+
borderBottomColor,
|
|
99
|
+
borderTopWidth,
|
|
100
|
+
borderTopColor,
|
|
101
|
+
borderLeftWidth,
|
|
102
|
+
borderLeftColor,
|
|
103
|
+
borderRightWidth,
|
|
104
|
+
borderRightColor,
|
|
105
|
+
borderRadius,
|
|
106
|
+
borderStyle,
|
|
107
|
+
overflow,
|
|
108
|
+
zIndex,
|
|
109
|
+
height,
|
|
110
|
+
width,
|
|
111
|
+
padding,
|
|
112
|
+
paddingHorizontal,
|
|
113
|
+
paddingVertical,
|
|
114
|
+
margin,
|
|
115
|
+
marginTop,
|
|
116
|
+
marginBottom,
|
|
117
|
+
marginLeft,
|
|
118
|
+
marginRight,
|
|
119
|
+
flexDirection,
|
|
120
|
+
alignItems,
|
|
121
|
+
justifyContent,
|
|
122
|
+
position,
|
|
123
|
+
top,
|
|
124
|
+
bottom,
|
|
125
|
+
left,
|
|
126
|
+
right,
|
|
127
|
+
flex,
|
|
128
|
+
...style
|
|
129
|
+
});
|
|
130
|
+
const finalTestID = dataTestId || testID;
|
|
131
|
+
const {
|
|
132
|
+
role,
|
|
133
|
+
tabIndex,
|
|
134
|
+
onKeyDown,
|
|
135
|
+
onKeyUp,
|
|
136
|
+
"aria-label": _ariaLabel,
|
|
137
|
+
"aria-labelledby": _ariaLabelledBy,
|
|
138
|
+
"aria-current": _ariaCurrent,
|
|
139
|
+
"aria-disabled": _ariaDisabled,
|
|
140
|
+
"aria-live": _ariaLive,
|
|
141
|
+
className,
|
|
142
|
+
"data-testid": _dataTestId,
|
|
143
|
+
...nativeRest
|
|
144
|
+
} = rest;
|
|
145
|
+
if (as === "img" && src) {
|
|
146
|
+
const imageStyle = {
|
|
147
|
+
width,
|
|
148
|
+
height,
|
|
149
|
+
borderRadius,
|
|
150
|
+
position,
|
|
151
|
+
top,
|
|
152
|
+
bottom,
|
|
153
|
+
left,
|
|
154
|
+
right,
|
|
155
|
+
...style
|
|
156
|
+
};
|
|
157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
158
|
+
import_react_native.Image,
|
|
159
|
+
{
|
|
160
|
+
source: { uri: src },
|
|
161
|
+
style: imageStyle,
|
|
162
|
+
testID: finalTestID,
|
|
163
|
+
resizeMode: "cover",
|
|
164
|
+
...nativeRest
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
if (onPress) {
|
|
169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
170
|
+
import_react_native.Pressable,
|
|
171
|
+
{
|
|
172
|
+
onPress,
|
|
173
|
+
onLayout,
|
|
174
|
+
onMoveShouldSetResponder,
|
|
175
|
+
onResponderGrant,
|
|
176
|
+
onResponderMove,
|
|
177
|
+
onResponderRelease,
|
|
178
|
+
onResponderTerminate,
|
|
179
|
+
style: ({ pressed }) => getContainerStyle(pressed),
|
|
180
|
+
testID: finalTestID,
|
|
181
|
+
...nativeRest,
|
|
182
|
+
children
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
187
|
+
import_react_native.View,
|
|
188
|
+
{
|
|
189
|
+
style: getContainerStyle(),
|
|
190
|
+
testID: finalTestID,
|
|
191
|
+
onLayout,
|
|
192
|
+
onMoveShouldSetResponder,
|
|
193
|
+
onResponderGrant,
|
|
194
|
+
onResponderMove,
|
|
195
|
+
onResponderRelease,
|
|
196
|
+
onResponderTerminate,
|
|
197
|
+
...nativeRest,
|
|
198
|
+
children
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
// ../primitives-native/src/Text.tsx
|
|
204
|
+
var import_react_native2 = require("react-native");
|
|
205
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
206
|
+
|
|
207
|
+
// ../primitives-native/src/Spinner.tsx
|
|
208
|
+
var import_react_native3 = require("react-native");
|
|
209
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
210
|
+
var Spinner = ({
|
|
211
|
+
color,
|
|
212
|
+
size,
|
|
213
|
+
role,
|
|
214
|
+
"aria-label": ariaLabel,
|
|
215
|
+
"aria-live": ariaLive,
|
|
216
|
+
testID
|
|
217
|
+
}) => {
|
|
218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
219
|
+
import_react_native3.View,
|
|
220
|
+
{
|
|
221
|
+
accessible: true,
|
|
222
|
+
accessibilityRole: role === "status" ? "none" : void 0,
|
|
223
|
+
accessibilityLabel: ariaLabel,
|
|
224
|
+
accessibilityLiveRegion: ariaLive === "polite" ? "polite" : ariaLive === "assertive" ? "assertive" : "none",
|
|
225
|
+
testID,
|
|
226
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
227
|
+
import_react_native3.ActivityIndicator,
|
|
228
|
+
{
|
|
229
|
+
color,
|
|
230
|
+
size: typeof size === "number" ? size : "small"
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
};
|
|
236
|
+
Spinner.displayName = "Spinner";
|
|
237
|
+
|
|
238
|
+
// ../primitives-native/src/Icon.tsx
|
|
239
|
+
var import_react = __toESM(require("react"));
|
|
240
|
+
var import_react_native4 = require("react-native");
|
|
241
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
242
|
+
|
|
243
|
+
// ../primitives-native/src/Divider.tsx
|
|
244
|
+
var import_react_native5 = require("react-native");
|
|
245
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
246
|
+
|
|
247
|
+
// ../primitives-native/src/Input.tsx
|
|
248
|
+
var import_react2 = require("react");
|
|
249
|
+
var import_react_native6 = require("react-native");
|
|
250
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
251
|
+
var keyboardTypeMap = {
|
|
252
|
+
text: "default",
|
|
253
|
+
number: "numeric",
|
|
254
|
+
email: "email-address",
|
|
255
|
+
tel: "phone-pad",
|
|
256
|
+
url: "url",
|
|
257
|
+
decimal: "decimal-pad"
|
|
258
|
+
};
|
|
259
|
+
var inputModeToKeyboardType = {
|
|
260
|
+
none: "default",
|
|
261
|
+
text: "default",
|
|
262
|
+
decimal: "decimal-pad",
|
|
263
|
+
numeric: "number-pad",
|
|
264
|
+
tel: "phone-pad",
|
|
265
|
+
search: "default",
|
|
266
|
+
email: "email-address",
|
|
267
|
+
url: "url"
|
|
268
|
+
};
|
|
269
|
+
var autoCompleteToTextContentType = {
|
|
270
|
+
"one-time-code": "oneTimeCode",
|
|
271
|
+
email: "emailAddress",
|
|
272
|
+
username: "username",
|
|
273
|
+
password: "password",
|
|
274
|
+
"new-password": "newPassword",
|
|
275
|
+
tel: "telephoneNumber",
|
|
276
|
+
"postal-code": "postalCode",
|
|
277
|
+
name: "name"
|
|
278
|
+
};
|
|
279
|
+
var InputPrimitive = (0, import_react2.forwardRef)(
|
|
280
|
+
({
|
|
281
|
+
value,
|
|
282
|
+
placeholder,
|
|
283
|
+
onChange,
|
|
284
|
+
onChangeText,
|
|
285
|
+
onFocus,
|
|
286
|
+
onBlur,
|
|
287
|
+
onKeyDown,
|
|
288
|
+
disabled,
|
|
289
|
+
secureTextEntry,
|
|
290
|
+
style,
|
|
291
|
+
color,
|
|
292
|
+
fontSize,
|
|
293
|
+
placeholderTextColor,
|
|
294
|
+
maxLength,
|
|
295
|
+
type,
|
|
296
|
+
inputMode,
|
|
297
|
+
autoComplete,
|
|
298
|
+
id,
|
|
299
|
+
"aria-describedby": ariaDescribedBy,
|
|
300
|
+
"aria-label": ariaLabel,
|
|
301
|
+
"aria-disabled": ariaDisabled,
|
|
302
|
+
"data-testid": dataTestId
|
|
303
|
+
}, ref) => {
|
|
304
|
+
const handleChangeText = (text) => {
|
|
305
|
+
onChangeText?.(text);
|
|
306
|
+
if (onChange) {
|
|
307
|
+
const syntheticEvent = {
|
|
308
|
+
target: { value: text },
|
|
309
|
+
currentTarget: { value: text },
|
|
310
|
+
type: "change",
|
|
311
|
+
nativeEvent: { text },
|
|
312
|
+
preventDefault: () => {
|
|
313
|
+
},
|
|
314
|
+
stopPropagation: () => {
|
|
315
|
+
},
|
|
316
|
+
isTrusted: false
|
|
317
|
+
};
|
|
318
|
+
onChange(syntheticEvent);
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
const keyboardType = inputMode ? inputModeToKeyboardType[inputMode] || "default" : type ? keyboardTypeMap[type] || "default" : "default";
|
|
322
|
+
const textContentType = autoComplete ? autoCompleteToTextContentType[autoComplete] : void 0;
|
|
323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
324
|
+
import_react_native6.TextInput,
|
|
325
|
+
{
|
|
326
|
+
ref,
|
|
327
|
+
value,
|
|
328
|
+
placeholder,
|
|
329
|
+
onChangeText: handleChangeText,
|
|
330
|
+
onFocus,
|
|
331
|
+
onBlur,
|
|
332
|
+
onKeyPress: (e) => {
|
|
333
|
+
if (onKeyDown) {
|
|
334
|
+
onKeyDown({
|
|
335
|
+
key: e.nativeEvent.key,
|
|
336
|
+
preventDefault: () => {
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
editable: !disabled,
|
|
342
|
+
secureTextEntry: secureTextEntry || type === "password",
|
|
343
|
+
keyboardType,
|
|
344
|
+
textContentType,
|
|
345
|
+
style: [
|
|
346
|
+
{
|
|
347
|
+
color,
|
|
348
|
+
fontSize: typeof fontSize === "number" ? fontSize : void 0,
|
|
349
|
+
flex: 1,
|
|
350
|
+
padding: 0,
|
|
351
|
+
textAlign: style?.textAlign || "left"
|
|
352
|
+
},
|
|
353
|
+
style
|
|
354
|
+
],
|
|
355
|
+
placeholderTextColor,
|
|
356
|
+
maxLength,
|
|
357
|
+
testID: dataTestId || id,
|
|
358
|
+
accessibilityLabel: ariaLabel,
|
|
359
|
+
accessibilityHint: ariaDescribedBy,
|
|
360
|
+
accessibilityState: {
|
|
361
|
+
disabled: disabled || ariaDisabled
|
|
362
|
+
},
|
|
363
|
+
accessible: true
|
|
364
|
+
}
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
);
|
|
368
|
+
InputPrimitive.displayName = "InputPrimitive";
|
|
369
|
+
|
|
370
|
+
// ../primitives-native/src/TextArea.tsx
|
|
371
|
+
var import_react3 = require("react");
|
|
372
|
+
var import_react_native7 = require("react-native");
|
|
373
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
374
|
+
var TextAreaPrimitive = (0, import_react3.forwardRef)(
|
|
375
|
+
({
|
|
376
|
+
value,
|
|
377
|
+
placeholder,
|
|
378
|
+
onChange,
|
|
379
|
+
onChangeText,
|
|
380
|
+
onFocus,
|
|
381
|
+
onBlur,
|
|
382
|
+
onKeyDown,
|
|
383
|
+
disabled,
|
|
384
|
+
style,
|
|
385
|
+
color,
|
|
386
|
+
fontSize,
|
|
387
|
+
placeholderTextColor,
|
|
388
|
+
maxLength,
|
|
389
|
+
rows,
|
|
390
|
+
id,
|
|
391
|
+
"aria-describedby": ariaDescribedBy,
|
|
392
|
+
"aria-label": ariaLabel,
|
|
393
|
+
"aria-disabled": ariaDisabled,
|
|
394
|
+
"data-testid": dataTestId
|
|
395
|
+
}, ref) => {
|
|
396
|
+
const handleChangeText = (text) => {
|
|
397
|
+
onChangeText?.(text);
|
|
398
|
+
if (onChange) {
|
|
399
|
+
const syntheticEvent = {
|
|
400
|
+
target: { value: text },
|
|
401
|
+
currentTarget: { value: text },
|
|
402
|
+
type: "change",
|
|
403
|
+
nativeEvent: { text },
|
|
404
|
+
preventDefault: () => {
|
|
405
|
+
},
|
|
406
|
+
stopPropagation: () => {
|
|
407
|
+
},
|
|
408
|
+
isTrusted: false
|
|
409
|
+
};
|
|
410
|
+
onChange(syntheticEvent);
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
414
|
+
import_react_native7.TextInput,
|
|
415
|
+
{
|
|
416
|
+
ref,
|
|
417
|
+
value,
|
|
418
|
+
placeholder,
|
|
419
|
+
onChangeText: handleChangeText,
|
|
420
|
+
onFocus,
|
|
421
|
+
onBlur,
|
|
422
|
+
onKeyPress: (e) => {
|
|
423
|
+
if (onKeyDown) {
|
|
424
|
+
onKeyDown({
|
|
425
|
+
key: e.nativeEvent.key,
|
|
426
|
+
preventDefault: () => {
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
},
|
|
431
|
+
editable: !disabled,
|
|
432
|
+
multiline: true,
|
|
433
|
+
numberOfLines: rows || 4,
|
|
434
|
+
style: [
|
|
435
|
+
{
|
|
436
|
+
color,
|
|
437
|
+
fontSize: typeof fontSize === "number" ? fontSize : void 0,
|
|
438
|
+
flex: 1,
|
|
439
|
+
padding: 0,
|
|
440
|
+
textAlignVertical: "top",
|
|
441
|
+
textAlign: style?.textAlign || "left"
|
|
442
|
+
},
|
|
443
|
+
style
|
|
444
|
+
],
|
|
445
|
+
placeholderTextColor,
|
|
446
|
+
maxLength,
|
|
447
|
+
testID: dataTestId || id,
|
|
448
|
+
accessibilityLabel: ariaLabel,
|
|
449
|
+
accessibilityHint: ariaDescribedBy,
|
|
450
|
+
accessibilityState: {
|
|
451
|
+
disabled: disabled || ariaDisabled
|
|
452
|
+
},
|
|
453
|
+
accessible: true
|
|
454
|
+
}
|
|
455
|
+
);
|
|
456
|
+
}
|
|
457
|
+
);
|
|
458
|
+
TextAreaPrimitive.displayName = "TextAreaPrimitive";
|
|
459
|
+
|
|
460
|
+
// src/ImageThumbnail.tsx
|
|
461
|
+
var import_xui_core = require("@xsolla/xui-core");
|
|
462
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
463
|
+
var ratioMap = {
|
|
464
|
+
"1:1": 1,
|
|
465
|
+
"16:9": 16 / 9,
|
|
466
|
+
"4:3": 4 / 3,
|
|
467
|
+
"3:2": 3 / 2,
|
|
468
|
+
"2:3": 2 / 3,
|
|
469
|
+
"9:16": 9 / 16
|
|
470
|
+
};
|
|
471
|
+
var ImageThumbnail = ({
|
|
472
|
+
src,
|
|
473
|
+
alt = "",
|
|
474
|
+
ratio = "16:9",
|
|
475
|
+
customRatio,
|
|
476
|
+
width = "100%",
|
|
477
|
+
height,
|
|
478
|
+
borderRadius = 4,
|
|
479
|
+
overlay = "fade",
|
|
480
|
+
centerContent,
|
|
481
|
+
tagsTopLeft,
|
|
482
|
+
tagsTopRight,
|
|
483
|
+
tagsBottomLeft,
|
|
484
|
+
tagsBottomRight,
|
|
485
|
+
onPress,
|
|
486
|
+
className,
|
|
487
|
+
tagPadding = 8,
|
|
488
|
+
tagGap = 4
|
|
489
|
+
}) => {
|
|
490
|
+
const { theme } = (0, import_xui_core.useDesignSystem)();
|
|
491
|
+
const aspectRatio = ratio === "custom" ? customRatio : ratioMap[ratio];
|
|
492
|
+
const hasOverlay = overlay !== "none";
|
|
493
|
+
const wrapperProps = onPress ? { onPress } : {};
|
|
494
|
+
const containerStyle = import_xui_core.isWeb ? {
|
|
495
|
+
aspectRatio: height ? void 0 : aspectRatio,
|
|
496
|
+
borderRadius,
|
|
497
|
+
overflow: "hidden"
|
|
498
|
+
} : {
|
|
499
|
+
aspectRatio: height ? void 0 : aspectRatio,
|
|
500
|
+
borderRadius,
|
|
501
|
+
overflow: "hidden"
|
|
502
|
+
};
|
|
503
|
+
const overlayStyle = import_xui_core.isWeb ? overlay === "fade" ? {
|
|
504
|
+
background: "linear-gradient(to top, rgba(0, 0, 0, 0.48) 0%, transparent 100%)"
|
|
505
|
+
} : overlay === "dark" ? {
|
|
506
|
+
backgroundColor: "rgba(0, 0, 0, 0.48)"
|
|
507
|
+
} : void 0 : overlay === "fade" || overlay === "dark" ? {
|
|
508
|
+
backgroundColor: "rgba(0, 0, 0, 0.24)"
|
|
509
|
+
} : void 0;
|
|
510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
511
|
+
Box,
|
|
512
|
+
{
|
|
513
|
+
className,
|
|
514
|
+
width,
|
|
515
|
+
height,
|
|
516
|
+
position: "relative",
|
|
517
|
+
overflow: "hidden",
|
|
518
|
+
borderRadius,
|
|
519
|
+
style: containerStyle,
|
|
520
|
+
...wrapperProps,
|
|
521
|
+
children: [
|
|
522
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
523
|
+
Box,
|
|
524
|
+
{
|
|
525
|
+
as: "img",
|
|
526
|
+
src,
|
|
527
|
+
alt,
|
|
528
|
+
position: "absolute",
|
|
529
|
+
top: 0,
|
|
530
|
+
left: 0,
|
|
531
|
+
width: "100%",
|
|
532
|
+
height: "100%",
|
|
533
|
+
style: import_xui_core.isWeb ? { objectFit: "cover" } : void 0
|
|
534
|
+
}
|
|
535
|
+
),
|
|
536
|
+
hasOverlay && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
537
|
+
Box,
|
|
538
|
+
{
|
|
539
|
+
position: "absolute",
|
|
540
|
+
top: 0,
|
|
541
|
+
left: 0,
|
|
542
|
+
right: 0,
|
|
543
|
+
bottom: 0,
|
|
544
|
+
style: overlayStyle
|
|
545
|
+
}
|
|
546
|
+
),
|
|
547
|
+
centerContent && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
548
|
+
Box,
|
|
549
|
+
{
|
|
550
|
+
position: "absolute",
|
|
551
|
+
top: 0,
|
|
552
|
+
left: 0,
|
|
553
|
+
right: 0,
|
|
554
|
+
bottom: 0,
|
|
555
|
+
alignItems: "center",
|
|
556
|
+
justifyContent: "center",
|
|
557
|
+
zIndex: 10,
|
|
558
|
+
children: centerContent
|
|
559
|
+
}
|
|
560
|
+
),
|
|
561
|
+
tagsTopLeft && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
562
|
+
Box,
|
|
563
|
+
{
|
|
564
|
+
position: "absolute",
|
|
565
|
+
top: tagPadding,
|
|
566
|
+
left: tagPadding,
|
|
567
|
+
flexDirection: "column",
|
|
568
|
+
gap: tagGap,
|
|
569
|
+
alignItems: "flex-start",
|
|
570
|
+
zIndex: 10,
|
|
571
|
+
children: tagsTopLeft
|
|
572
|
+
}
|
|
573
|
+
),
|
|
574
|
+
tagsTopRight && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
575
|
+
Box,
|
|
576
|
+
{
|
|
577
|
+
position: "absolute",
|
|
578
|
+
top: tagPadding,
|
|
579
|
+
right: tagPadding,
|
|
580
|
+
flexDirection: "column",
|
|
581
|
+
gap: tagGap,
|
|
582
|
+
alignItems: "flex-end",
|
|
583
|
+
zIndex: 10,
|
|
584
|
+
children: tagsTopRight
|
|
585
|
+
}
|
|
586
|
+
),
|
|
587
|
+
tagsBottomLeft && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
588
|
+
Box,
|
|
589
|
+
{
|
|
590
|
+
position: "absolute",
|
|
591
|
+
bottom: tagPadding,
|
|
592
|
+
left: tagPadding,
|
|
593
|
+
flexDirection: "column",
|
|
594
|
+
gap: tagGap,
|
|
595
|
+
alignItems: "flex-start",
|
|
596
|
+
zIndex: 10,
|
|
597
|
+
children: tagsBottomLeft
|
|
598
|
+
}
|
|
599
|
+
),
|
|
600
|
+
tagsBottomRight && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
601
|
+
Box,
|
|
602
|
+
{
|
|
603
|
+
position: "absolute",
|
|
604
|
+
bottom: tagPadding,
|
|
605
|
+
right: tagPadding,
|
|
606
|
+
flexDirection: "column",
|
|
607
|
+
gap: tagGap,
|
|
608
|
+
alignItems: "flex-end",
|
|
609
|
+
zIndex: 10,
|
|
610
|
+
children: tagsBottomRight
|
|
611
|
+
}
|
|
612
|
+
)
|
|
613
|
+
]
|
|
614
|
+
}
|
|
615
|
+
);
|
|
616
|
+
};
|
|
617
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
618
|
+
0 && (module.exports = {
|
|
619
|
+
ImageThumbnail
|
|
620
|
+
});
|
|
621
|
+
//# sourceMappingURL=index.js.map
|