@xsolla/xui-image-uploader 0.147.1

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.
@@ -0,0 +1,668 @@
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
+ ImageUploader: () => ImageUploader
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/ImageUploader.tsx
38
+ var import_react = __toESM(require("react"));
39
+
40
+ // ../../foundation/primitives-native/src/Box.tsx
41
+ var import_react_native = require("react-native");
42
+ var import_jsx_runtime = require("react/jsx-runtime");
43
+ var Box = ({
44
+ children,
45
+ onPress,
46
+ onLayout,
47
+ onMoveShouldSetResponder,
48
+ onResponderGrant,
49
+ onResponderMove,
50
+ onResponderRelease,
51
+ onResponderTerminate,
52
+ backgroundColor,
53
+ borderColor,
54
+ borderWidth,
55
+ borderBottomWidth,
56
+ borderBottomColor,
57
+ borderTopWidth,
58
+ borderTopColor,
59
+ borderLeftWidth,
60
+ borderLeftColor,
61
+ borderRightWidth,
62
+ borderRightColor,
63
+ borderRadius,
64
+ borderStyle,
65
+ height,
66
+ padding,
67
+ paddingHorizontal,
68
+ paddingVertical,
69
+ margin,
70
+ marginTop,
71
+ marginBottom,
72
+ marginLeft,
73
+ marginRight,
74
+ flexDirection,
75
+ alignItems,
76
+ justifyContent,
77
+ position,
78
+ top,
79
+ bottom,
80
+ left,
81
+ right,
82
+ width,
83
+ minWidth,
84
+ minHeight,
85
+ maxWidth,
86
+ maxHeight,
87
+ flex,
88
+ overflow,
89
+ zIndex,
90
+ hoverStyle,
91
+ pressStyle,
92
+ style,
93
+ "data-testid": dataTestId,
94
+ testID,
95
+ as,
96
+ src,
97
+ alt,
98
+ ...rest
99
+ }) => {
100
+ const getContainerStyle = (pressed) => ({
101
+ backgroundColor: pressed && pressStyle?.backgroundColor ? pressStyle.backgroundColor : backgroundColor,
102
+ borderColor,
103
+ borderWidth,
104
+ borderBottomWidth,
105
+ borderBottomColor,
106
+ borderTopWidth,
107
+ borderTopColor,
108
+ borderLeftWidth,
109
+ borderLeftColor,
110
+ borderRightWidth,
111
+ borderRightColor,
112
+ borderRadius,
113
+ borderStyle,
114
+ overflow,
115
+ zIndex,
116
+ height,
117
+ width,
118
+ minWidth,
119
+ minHeight,
120
+ maxWidth,
121
+ maxHeight,
122
+ padding,
123
+ paddingHorizontal,
124
+ paddingVertical,
125
+ margin,
126
+ marginTop,
127
+ marginBottom,
128
+ marginLeft,
129
+ marginRight,
130
+ flexDirection,
131
+ alignItems,
132
+ justifyContent,
133
+ position,
134
+ top,
135
+ bottom,
136
+ left,
137
+ right,
138
+ flex,
139
+ ...style
140
+ });
141
+ const finalTestID = dataTestId || testID;
142
+ const {
143
+ role,
144
+ tabIndex,
145
+ onKeyDown,
146
+ onKeyUp,
147
+ "aria-label": _ariaLabel,
148
+ "aria-labelledby": _ariaLabelledBy,
149
+ "aria-current": _ariaCurrent,
150
+ "aria-disabled": _ariaDisabled,
151
+ "aria-live": _ariaLive,
152
+ className,
153
+ "data-testid": _dataTestId,
154
+ ...nativeRest
155
+ } = rest;
156
+ if (as === "img" && src) {
157
+ const imageStyle = {
158
+ width,
159
+ height,
160
+ borderRadius,
161
+ position,
162
+ top,
163
+ bottom,
164
+ left,
165
+ right,
166
+ ...style
167
+ };
168
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
169
+ import_react_native.Image,
170
+ {
171
+ source: { uri: src },
172
+ style: imageStyle,
173
+ testID: finalTestID,
174
+ resizeMode: "cover",
175
+ ...nativeRest
176
+ }
177
+ );
178
+ }
179
+ if (onPress) {
180
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
181
+ import_react_native.Pressable,
182
+ {
183
+ onPress,
184
+ onLayout,
185
+ onMoveShouldSetResponder,
186
+ onResponderGrant,
187
+ onResponderMove,
188
+ onResponderRelease,
189
+ onResponderTerminate,
190
+ style: ({ pressed }) => getContainerStyle(pressed),
191
+ testID: finalTestID,
192
+ ...nativeRest,
193
+ children
194
+ }
195
+ );
196
+ }
197
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
198
+ import_react_native.View,
199
+ {
200
+ style: getContainerStyle(),
201
+ testID: finalTestID,
202
+ onLayout,
203
+ onMoveShouldSetResponder,
204
+ onResponderGrant,
205
+ onResponderMove,
206
+ onResponderRelease,
207
+ onResponderTerminate,
208
+ ...nativeRest,
209
+ children
210
+ }
211
+ );
212
+ };
213
+
214
+ // ../../foundation/primitives-native/src/Text.tsx
215
+ var import_react_native2 = require("react-native");
216
+ var import_jsx_runtime2 = require("react/jsx-runtime");
217
+ var roleMap = {
218
+ alert: "alert",
219
+ heading: "header",
220
+ button: "button",
221
+ link: "link",
222
+ text: "text"
223
+ };
224
+ var parseNumericValue = (value) => {
225
+ if (value === void 0) return void 0;
226
+ if (typeof value === "number") return value;
227
+ const parsed = parseFloat(value);
228
+ return isNaN(parsed) ? void 0 : parsed;
229
+ };
230
+ var Text = ({
231
+ children,
232
+ color,
233
+ fontSize,
234
+ fontWeight,
235
+ fontFamily,
236
+ textAlign,
237
+ lineHeight,
238
+ numberOfLines,
239
+ id,
240
+ role,
241
+ style: styleProp,
242
+ ...props
243
+ }) => {
244
+ let resolvedFontFamily = fontFamily ? fontFamily.split(",")[0].replace(/['"]/g, "").trim() : void 0;
245
+ if (resolvedFontFamily === "Pilat Wide" || resolvedFontFamily === "Pilat Wide Bold" || resolvedFontFamily === "Aktiv Grotesk") {
246
+ resolvedFontFamily = void 0;
247
+ }
248
+ const incomingStyle = import_react_native2.StyleSheet.flatten(styleProp);
249
+ const baseStyle = {
250
+ color: color ?? incomingStyle?.color,
251
+ fontSize: typeof fontSize === "number" ? fontSize : void 0,
252
+ fontWeight,
253
+ fontFamily: resolvedFontFamily,
254
+ textDecorationLine: props.textDecoration,
255
+ textAlign: textAlign ?? incomingStyle?.textAlign,
256
+ lineHeight: parseNumericValue(lineHeight ?? incomingStyle?.lineHeight),
257
+ marginTop: parseNumericValue(
258
+ incomingStyle?.marginTop
259
+ ),
260
+ marginBottom: parseNumericValue(
261
+ incomingStyle?.marginBottom
262
+ )
263
+ };
264
+ const accessibilityRole = role ? roleMap[role] : void 0;
265
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
266
+ import_react_native2.Text,
267
+ {
268
+ style: baseStyle,
269
+ numberOfLines,
270
+ testID: id,
271
+ accessibilityRole,
272
+ children
273
+ }
274
+ );
275
+ };
276
+
277
+ // ../../foundation/primitives-native/src/index.tsx
278
+ var isWeb = false;
279
+
280
+ // src/ImageUploader.tsx
281
+ var import_xui_core = require("@xsolla/xui-core");
282
+ var import_xui_icons_base = require("@xsolla/xui-icons-base");
283
+ var import_xui_spinner = require("@xsolla/xui-spinner");
284
+ var import_jsx_runtime3 = require("react/jsx-runtime");
285
+ var ImageUploader = (0, import_react.forwardRef)(
286
+ ({
287
+ size = "xl",
288
+ placeholder = "Upload",
289
+ uploadingPlaceholder = "Uploading",
290
+ description,
291
+ errorMessage,
292
+ wideView = false,
293
+ accept = "image/*",
294
+ openPicker,
295
+ value,
296
+ onUpload,
297
+ onChange,
298
+ onDelete,
299
+ disabled = false,
300
+ loading = false,
301
+ themeMode,
302
+ themeProductContext
303
+ }, ref) => {
304
+ const { theme } = (0, import_xui_core.useResolvedTheme)({ themeMode, themeProductContext });
305
+ const fileInputRef = (0, import_react.useRef)(null);
306
+ const isControlled = value !== void 0;
307
+ const [internalPreview, setInternalPreview] = (0, import_react.useState)(null);
308
+ const [isHover, setIsHover] = (0, import_react.useState)(false);
309
+ const [isFocus, setIsFocus] = (0, import_react.useState)(false);
310
+ const [isPreviewHover, setIsPreviewHover] = (0, import_react.useState)(false);
311
+ const [isHoverless] = (0, import_react.useState)(
312
+ () => !isWeb || typeof window !== "undefined" && !!window.matchMedia?.("(hover: none)").matches
313
+ );
314
+ const reactId = (0, import_xui_core.useId)();
315
+ const baseId = `image-uploader-${reactId.replace(/[^a-zA-Z0-9-]/g, "")}`;
316
+ const descriptionId = `${baseId}-description`;
317
+ const errorId = `${baseId}-error`;
318
+ const preview = isControlled ? value?.url ?? null : internalPreview;
319
+ (0, import_react.useEffect)(() => {
320
+ if (!isControlled && value === null) setInternalPreview(null);
321
+ }, [isControlled, value]);
322
+ import_react.default.useImperativeHandle(
323
+ ref,
324
+ () => fileInputRef.current,
325
+ []
326
+ );
327
+ const sizeStyles = theme.sizing.imageUploader(size);
328
+ const inputColors = theme.colors.control.input;
329
+ const focusColors = theme.colors.control.focus;
330
+ const alertBorder = theme.colors.control.alert.border;
331
+ const alertText = theme.colors.content.alert.primary;
332
+ const scrim = theme.colors.layer.scrim;
333
+ const hasError = !!errorMessage;
334
+ let state;
335
+ if (disabled) state = "disable";
336
+ else if (loading) state = "uploading";
337
+ else if (hasError) state = "error";
338
+ else if (preview)
339
+ state = isPreviewHover || isHoverless ? "uploadedHover" : "uploaded";
340
+ else if (isFocus) state = "focus";
341
+ else if (isHover) state = "hover";
342
+ else state = "default";
343
+ const emitFile = (img) => {
344
+ if (!isControlled) setInternalPreview(img.uri);
345
+ onUpload?.(img);
346
+ onChange?.({
347
+ filename: img.name,
348
+ url: img.uri
349
+ });
350
+ };
351
+ const handleWebFile = (file) => {
352
+ if (!file.type.startsWith("image/")) return;
353
+ const reader = new FileReader();
354
+ reader.onload = (e) => {
355
+ const uri = e.target?.result;
356
+ emitFile({
357
+ name: file.name,
358
+ size: file.size,
359
+ uri,
360
+ mimeType: file.type,
361
+ file
362
+ });
363
+ };
364
+ reader.readAsDataURL(file);
365
+ };
366
+ const handleClick = async () => {
367
+ if (disabled || loading) return;
368
+ if (preview) {
369
+ removeImage();
370
+ return;
371
+ }
372
+ if (openPicker) {
373
+ const picked = await openPicker();
374
+ if (picked) emitFile(picked);
375
+ return;
376
+ }
377
+ if (isWeb) {
378
+ fileInputRef.current?.click();
379
+ }
380
+ };
381
+ const handleFileChange = (e) => {
382
+ const file = e.target.files?.[0];
383
+ e.target.value = "";
384
+ if (file) handleWebFile(file);
385
+ };
386
+ const handleDragOver = (e) => {
387
+ e.preventDefault();
388
+ e.stopPropagation();
389
+ if (!disabled && !loading && !preview) setIsHover(true);
390
+ };
391
+ const handleDragLeave = (e) => {
392
+ e.preventDefault();
393
+ e.stopPropagation();
394
+ setIsHover(false);
395
+ };
396
+ const handleDrop = (e) => {
397
+ e.preventDefault();
398
+ e.stopPropagation();
399
+ setIsHover(false);
400
+ if (disabled || loading || preview) return;
401
+ const file = e.dataTransfer.files?.[0];
402
+ if (file) handleWebFile(file);
403
+ };
404
+ const removeImage = (e) => {
405
+ e?.stopPropagation?.();
406
+ if (!isControlled) setInternalPreview(null);
407
+ setIsPreviewHover(false);
408
+ onDelete?.();
409
+ onChange?.(null);
410
+ if (isWeb && fileInputRef.current) fileInputRef.current.value = "";
411
+ };
412
+ let backgroundColor = inputColors.bg;
413
+ let borderColor = inputColors.border;
414
+ let borderStyle = "dashed";
415
+ let labelColor = inputColors.text;
416
+ let descriptionColor = inputColors.placeholder;
417
+ let iconColor = inputColors.text;
418
+ switch (state) {
419
+ case "hover":
420
+ backgroundColor = inputColors.bgHover;
421
+ borderColor = inputColors.borderHover;
422
+ break;
423
+ case "focus":
424
+ case "uploading":
425
+ backgroundColor = focusColors.bg;
426
+ borderColor = focusColors.border;
427
+ break;
428
+ case "uploaded":
429
+ case "uploadedHover":
430
+ backgroundColor = "transparent";
431
+ borderColor = "transparent";
432
+ break;
433
+ case "error":
434
+ backgroundColor = inputColors.bg;
435
+ borderColor = alertBorder;
436
+ borderStyle = "solid";
437
+ labelColor = alertText;
438
+ iconColor = alertText;
439
+ break;
440
+ case "disable":
441
+ backgroundColor = inputColors.bgDisable;
442
+ borderColor = inputColors.borderDisable;
443
+ labelColor = inputColors.textDisable;
444
+ descriptionColor = inputColors.textDisable;
445
+ iconColor = inputColors.textDisable;
446
+ break;
447
+ }
448
+ const rootGap = state === "error" ? sizeStyles.errorGap : 0;
449
+ const renderInner = () => {
450
+ if (state === "uploaded" || state === "uploadedHover") {
451
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
452
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
453
+ Box,
454
+ {
455
+ as: "img",
456
+ src: preview || void 0,
457
+ alt: value?.filename ?? "Uploaded image",
458
+ position: "absolute",
459
+ top: 0,
460
+ left: 0,
461
+ right: 0,
462
+ bottom: 0,
463
+ borderRadius: sizeStyles.radius,
464
+ resizeMode: "cover",
465
+ ...isWeb && { width: "100%", height: "100%" },
466
+ style: isWeb ? { objectFit: "cover" } : void 0
467
+ }
468
+ ),
469
+ state === "uploadedHover" && !disabled && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
470
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
471
+ Box,
472
+ {
473
+ position: "absolute",
474
+ top: 0,
475
+ left: 0,
476
+ right: 0,
477
+ bottom: 0,
478
+ backgroundColor: scrim,
479
+ borderRadius: sizeStyles.radius,
480
+ ...isWeb && { "aria-hidden": "true" }
481
+ }
482
+ ),
483
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
484
+ Box,
485
+ {
486
+ position: "relative",
487
+ width: sizeStyles.iconSize,
488
+ height: sizeStyles.iconSize,
489
+ alignItems: "center",
490
+ justifyContent: "center",
491
+ zIndex: 1,
492
+ pointerEvents: "none",
493
+ ...isWeb && { "aria-hidden": "true" },
494
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_xui_icons_base.TrashCan, { size: sizeStyles.iconSize, color: "#ffffff" })
495
+ }
496
+ )
497
+ ] })
498
+ ] });
499
+ }
500
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
501
+ state === "uploading" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
502
+ import_xui_spinner.Spinner,
503
+ {
504
+ size,
505
+ color: theme.colors.content.brand.primary,
506
+ ...isWeb && { "aria-hidden": "true" }
507
+ }
508
+ ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box, { ...isWeb && { "aria-hidden": "true" }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_xui_icons_base.Image, { size: sizeStyles.iconSize, color: iconColor }) }),
509
+ placeholder && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
510
+ Text,
511
+ {
512
+ "data-testid": "image-uploader__placeholder",
513
+ color: labelColor,
514
+ fontSize: sizeStyles.labelFontSize,
515
+ lineHeight: sizeStyles.labelLineHeight,
516
+ fontWeight: "500",
517
+ textAlign: "center",
518
+ numberOfLines: 1,
519
+ style: isWeb ? {
520
+ maxWidth: "100%",
521
+ overflow: "hidden",
522
+ textOverflow: "ellipsis",
523
+ whiteSpace: "nowrap"
524
+ } : void 0,
525
+ children: state === "uploading" ? uploadingPlaceholder : placeholder
526
+ }
527
+ ),
528
+ description && wideView && state !== "uploading" && state !== "error" && (typeof description === "string" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
529
+ Text,
530
+ {
531
+ "data-testid": "image-uploader__description",
532
+ color: descriptionColor,
533
+ fontSize: sizeStyles.descriptionFontSize,
534
+ lineHeight: sizeStyles.descriptionLineHeight,
535
+ textAlign: "center",
536
+ numberOfLines: 1,
537
+ style: isWeb ? {
538
+ maxWidth: "100%",
539
+ overflow: "hidden",
540
+ textOverflow: "ellipsis",
541
+ whiteSpace: "nowrap"
542
+ } : void 0,
543
+ ...isWeb && { id: descriptionId },
544
+ children: description
545
+ }
546
+ ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
547
+ Box,
548
+ {
549
+ "data-testid": "image-uploader__description",
550
+ ...isWeb && { id: descriptionId },
551
+ children: description
552
+ }
553
+ ))
554
+ ] });
555
+ };
556
+ const webOnlyHandlers = isWeb ? {
557
+ onMouseEnter: () => {
558
+ if (disabled || loading) return;
559
+ if (preview) setIsPreviewHover(true);
560
+ else setIsHover(true);
561
+ },
562
+ onMouseLeave: () => {
563
+ if (preview) setIsPreviewHover(false);
564
+ else setIsHover(false);
565
+ },
566
+ onFocus: (e) => {
567
+ if (disabled || loading || preview) return;
568
+ if (typeof e.target?.matches === "function" && !e.target.matches(":focus-visible")) {
569
+ return;
570
+ }
571
+ setIsFocus(true);
572
+ },
573
+ onBlur: () => setIsFocus(false),
574
+ onDragOver: handleDragOver,
575
+ onDragLeave: handleDragLeave,
576
+ onDrop: handleDrop
577
+ } : {};
578
+ const webOnlyStyle = isWeb ? {
579
+ boxSizing: "border-box",
580
+ display: "flex",
581
+ cursor: disabled || loading ? "not-allowed" : "pointer",
582
+ outline: "none",
583
+ transition: "background-color 0.15s ease, border-color 0.15s ease"
584
+ } : {};
585
+ const buttonAriaLabel = preview ? `Remove image${value?.filename ? `: ${value.filename}` : ""}` : state === "uploading" ? uploadingPlaceholder : placeholder;
586
+ const describedBy = [
587
+ state === "error" && errorMessage ? errorId : null,
588
+ description && wideView && state !== "uploading" && state !== "error" ? descriptionId : null
589
+ ].filter(Boolean).join(" ") || void 0;
590
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
591
+ Box,
592
+ {
593
+ "data-testid": "image-uploader",
594
+ flexDirection: "column",
595
+ gap: rootGap,
596
+ alignItems: "flex-start",
597
+ width: wideView ? "100%" : void 0,
598
+ maxWidth: wideView ? sizeStyles.wideWidth : void 0,
599
+ children: [
600
+ isWeb && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
601
+ "input",
602
+ {
603
+ type: "file",
604
+ ref: fileInputRef,
605
+ accept,
606
+ onChange: handleFileChange,
607
+ style: { display: "none" },
608
+ disabled,
609
+ tabIndex: -1,
610
+ "aria-hidden": "true",
611
+ "data-testid": "image-uploader__input"
612
+ }
613
+ ),
614
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
615
+ Box,
616
+ {
617
+ as: isWeb ? "button" : "div",
618
+ disabled: disabled || loading,
619
+ "data-testid": "image-uploader__button",
620
+ onPress: handleClick,
621
+ ...isWeb && {
622
+ "aria-label": buttonAriaLabel,
623
+ "aria-busy": loading || void 0,
624
+ "aria-invalid": state === "error" || void 0,
625
+ "aria-describedby": describedBy
626
+ },
627
+ ...webOnlyHandlers,
628
+ position: "relative",
629
+ width: wideView ? "100%" : sizeStyles.box,
630
+ maxWidth: wideView ? sizeStyles.wideWidth : void 0,
631
+ height: sizeStyles.box,
632
+ flexDirection: "column",
633
+ alignItems: "center",
634
+ justifyContent: "center",
635
+ gap: sizeStyles.gap,
636
+ padding: state === "uploaded" ? 0 : sizeStyles.padding,
637
+ borderWidth: sizeStyles.borderWidth,
638
+ borderStyle,
639
+ borderColor,
640
+ borderRadius: sizeStyles.radius,
641
+ backgroundColor,
642
+ overflow: "hidden",
643
+ style: webOnlyStyle,
644
+ children: renderInner()
645
+ }
646
+ ),
647
+ state === "error" && errorMessage && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
648
+ Text,
649
+ {
650
+ "data-testid": "image-uploader__error",
651
+ color: alertText,
652
+ fontSize: sizeStyles.errorFontSize,
653
+ lineHeight: sizeStyles.errorLineHeight,
654
+ ...isWeb && { id: errorId, role: "alert" },
655
+ children: errorMessage
656
+ }
657
+ )
658
+ ]
659
+ }
660
+ );
661
+ }
662
+ );
663
+ ImageUploader.displayName = "ImageUploader";
664
+ // Annotate the CommonJS export names for ESM import in node:
665
+ 0 && (module.exports = {
666
+ ImageUploader
667
+ });
668
+ //# sourceMappingURL=index.js.map