@xsolla/xui-image-uploader 0.216.1 → 0.217.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ImageUploader
2
2
 
3
- A cross-platform React image uploader component supporting click-to-pick, drag-and-drop (web), controlled and uncontrolled usage, image preview with hover-to-remove, automatic loading state from async `onUpload`, error states, and a wide horizontal layout.
3
+ A cross-platform React image uploader component supporting click-to-pick, drag-and-drop (web), controlled and uncontrolled usage, image preview with hover-to-remove (opt-out via `allowDelete`), automatic loading state from async `onUpload`, error states, square / custom-rectangle / wide layouts.
4
4
 
5
5
  <!-- BEGIN:xui-mcp-instructions:image-uploader -->
6
6
  A specialised upload control for images. Renders as a square or landscape rectangle that acts as both the upload trigger and the image preview container. Once an image is uploaded, the zone fills with the image thumbnail; hovering over it reveals controls to replace or remove the image. Supports five sizes, two aspect ratios, and eight states covering the full upload lifecycle.
@@ -120,6 +120,70 @@ export default function WideView() {
120
120
  }
121
121
  ```
122
122
 
123
+ ### Replace-only Slots (No Delete Affordance)
124
+
125
+ Some forms own a permanent image slot: the value can be swapped but never
126
+ cleared. `allowDelete={false}` removes the removal path **without** disabling
127
+ the field — the slot stays clickable, droppable, and replaceable.
128
+
129
+ ```tsx
130
+ import { ImageUploader } from "@xsolla/xui-image-uploader";
131
+
132
+ export default function CompanyLogo() {
133
+ return (
134
+ <ImageUploader
135
+ allowDelete={false}
136
+ value={value}
137
+ onUpload={(file) => uploadFn(file.file)}
138
+ onChange={setValue}
139
+ />
140
+ );
141
+ }
142
+ ```
143
+
144
+ With `allowDelete={false}`:
145
+
146
+ - The hover trash overlay (and its dimming scrim) is never rendered, on pointer
147
+ devices, touch, and React Native alike.
148
+ - Clicking or dropping onto a filled preview re-opens the picker and replaces
149
+ the image instead of clearing it.
150
+ - `onDelete` never fires, and `onChange(null)` is never emitted by the
151
+ component (the consumer can still clear the value itself in controlled mode).
152
+ - The button's `aria-label` reads `"Replace image: <filename>"` rather than
153
+ `"Remove image: <filename>"`.
154
+
155
+ This is deliberately independent of `disabled`. Use `disabled` when the whole
156
+ control should be inert; use `allowDelete={false}` when only the removal path
157
+ should be gone.
158
+
159
+ ### Fixed Non-Square Slots
160
+
161
+ `size` is a square token scale and `wideView` stretches to the parent's full
162
+ width. When a design calls for a fixed rectangle that is neither — a 120 × 32
163
+ logo slot, for instance — pass `customSize`:
164
+
165
+ ```tsx
166
+ import { ImageUploader } from "@xsolla/xui-image-uploader";
167
+
168
+ <ImageUploader
169
+ size="xs"
170
+ customSize={{ width: 120, height: 32 }}
171
+ placeholder={null}
172
+ allowDelete={false}
173
+ />;
174
+ ```
175
+
176
+ `customSize` resizes **only the outer box**. Icon size, padding, border radius,
177
+ gap and font sizes still come from the `size` token, so:
178
+
179
+ - pair a small box with a small `size`, and
180
+ - pass `placeholder={null}` when the box is too short to fit a text label
181
+ (content is clipped, not wrapped — the box sets `overflow: hidden`).
182
+
183
+ `width` and `height` accept a number (rendered as `px`) or any CSS length
184
+ string. When `wideView` is also set it keeps ownership of the width
185
+ (`width: 100%`); `customSize.height` still applies.
186
+
123
187
  ### Async Upload (Recommended)
124
188
 
125
189
  If `onUpload` returns a `Promise`, the component automatically:
@@ -249,6 +313,19 @@ removes the image. On touch and React Native devices — where there is no hover
249
313
  — the trash overlay is shown unconditionally so the delete affordance is
250
314
  always discoverable.
251
315
 
316
+ Pass `allowDelete={false}` to opt out of that affordance entirely: the preview
317
+ never enters the hover state, no scrim or trash is drawn on any platform, and
318
+ interacting with the filled slot replaces the image instead of removing it.
319
+
320
+ ### Disabled with an existing image
321
+
322
+ `disabled` does not clear the preview. When the component is disabled while a
323
+ `value` (or an internal preview) is set, the uploaded thumbnail stays on screen
324
+ behind a dimming scrim instead of reverting to the icon + placeholder empty
325
+ state. The trash affordance is suppressed, so the image cannot be removed while
326
+ the control is disabled. A disabled uploader with no image still renders the
327
+ regular greyed-out empty state.
328
+
252
329
  ## API Reference
253
330
 
254
331
  ### ImageUploader
@@ -256,18 +333,20 @@ always discoverable.
256
333
  | Prop | Type | Default | Description |
257
334
  | :------------------- | :----------------------------------------------------------------------------------- | :------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
258
335
  | `testID` | `string` | — | Test ID for testing frameworks. On web this renders as `data-testid`; on React Native it renders as `testID`. |
259
- | size | `"xl" \| "lg" \| "md" \| "sm" \| "xs"` | `"xl"` | Visual size of the uploader. |
260
- | placeholder | `React.ReactNode` | `"Upload"` | Label shown under the icon (or filename in error state). Accepts a string or a custom React node. |
336
+ | size | `"xl" \| "lg" \| "md" \| "sm" \| "xs"` | `"xl"` | Visual size of the uploader. Drives the square box dimensions and the inner scale (icon, padding, radius, gap, font sizes). |
337
+ | customSize | `{ width: number \| string; height: number \| string }` | - | Explicit box dimensions for a fixed non-square slot, overriding the square `size` box. Only the outer box is resized — the inner scale still comes from `size`. Numbers render as `px`. Ignored for width when `wideView` is set; the height still applies. |
338
+ | placeholder | `React.ReactNode` | `"Upload"` | Label shown under the icon (or filename in error state). Accepts a string or a custom React node. Pass `null` to render the icon alone. |
261
339
  | uploadingPlaceholder | `React.ReactNode` | `"Uploading"` | Label shown while `loading` is true. Accepts a string or a custom React node. |
262
340
  | description | `React.ReactNode` | - | Helper text below the placeholder. Only rendered when `wideView` is true. |
263
341
  | errorMessage | `string` | - | Error message — when provided, the component renders in the error state. |
264
342
  | wideView | `boolean` | `false` | Use the horizontal layout. The box stretches to fill its parent's width. |
265
- | disabled | `boolean` | `false` | Disabled state. |
343
+ | disabled | `boolean` | `false` | Disabled state. Makes the whole control inert — an existing preview stays visible behind a dimming scrim (with the delete affordance suppressed) rather than reverting to the empty upload zone. To keep the field active while hiding only the removal path, use `allowDelete` instead. |
344
+ | allowDelete | `boolean` | `true` | Whether the filled preview exposes a delete affordance. When `false`, the hover trash overlay is never rendered, clicking or dropping onto a filled preview replaces the image instead of removing it, and `onDelete` never fires. |
266
345
  | loading | `boolean` | `false` | Controlled loading state (shows spinner + uploading label). |
267
346
  | value | `ImageUploaderValue \| null` | - | Controlled value. When provided, the component reflects this value. |
268
347
  | onUpload | `(file: ImageUploaderFile) => void \| Promise<ImageUploaderValue \| string \| void>` | - | Fires when the user picks (or drops) a file. If it returns a `Promise`, the component shows the uploading state until it settles, forwards a resolved value (object or bare URL string) to `onChange`, and forwards a rejection to `onChange(null, error)`. |
269
348
  | onChange | `(value: ImageUploaderValue \| null, error?: Error) => void` | - | Fires when the displayed value changes — on file pick (with a local data-URL preview), after `onUpload` resolves (with the server value), or on remove (`null`). The optional `error` arg carries any rejection from `onUpload`. |
270
- | onDelete | `() => void` | - | Fires when the user removes the image (trash click / clear). |
349
+ | onDelete | `() => void` | - | Fires when the user removes the image (trash click / clear). Never fires when `allowDelete` is `false`. |
271
350
  | accept | `string` | `"image/*"` | Accepted MIME types for the file input (web only). |
272
351
  | openPicker | `() => Promise<ImageUploaderFile \| null>` | - | Native file picker hook. Required on native (no DOM `<input type="file">`). On web, omit this and the component falls back to a hidden file input. |
273
352
  | themeMode | `ThemeMode` | - | Override the theme mode for this instance. |
@@ -287,6 +366,17 @@ interface ImageUploaderValue {
287
366
  > Loading and error states are driven by the `loading` and `errorMessage`
288
367
  > props, not by fields on `ImageUploaderValue`.
289
368
 
369
+ ### ImageUploaderCustomSize
370
+
371
+ Explicit box dimensions, as an escape hatch from the square `size` enum.
372
+
373
+ ```ts
374
+ interface ImageUploaderCustomSize {
375
+ width: number | string;
376
+ height: number | string;
377
+ }
378
+ ```
379
+
290
380
  ### ImageUploaderFile
291
381
 
292
382
  Normalized file shape produced by the platform picker / drag-drop pipeline.
@@ -318,20 +408,27 @@ library of choice.
318
408
  On touch web (detected via `matchMedia("(hover: none)")`) and on React Native,
319
409
  the component skips the hover-only delete affordance and always shows the
320
410
  trash overlay over the image preview, ensuring the remove action is reachable
321
- without a pointer.
411
+ without a pointer. With `allowDelete={false}` there is no delete affordance to
412
+ surface, so nothing is drawn over the preview on touch either.
322
413
 
323
414
  ### Layout
324
415
 
325
416
  In `wideView`, the component stretches to fill its parent's full width
326
417
  (`width: 100%`), letting the consumer's layout (form column, grid cell, etc.)
327
418
  control the maximum size. The square (non-wide) variants use fixed pixel
328
- dimensions from the size tokens.
419
+ dimensions from the size tokens. For a fixed rectangle that is neither square
420
+ nor full width, pass `customSize={{ width, height }}` — see
421
+ [Fixed Non-Square Slots](#fixed-non-square-slots).
329
422
 
330
423
  ## Accessibility
331
424
 
332
425
  - The picker surface is rendered as a `<button>` on web with an accessible
333
- label that reflects the current state (`"Upload"`, `"Uploading"`, or
334
- `"Remove image: <filename>"`).
426
+ label that reflects the current state (`"Upload"`, `"Uploading"`,
427
+ `"Remove image: <filename>"`, or `"Replace image: <filename>"` when
428
+ `allowDelete` is `false`).
429
+ - When the component is disabled with an image present, that label becomes
430
+ `"Uploaded image: <filename>"` — neither remove nor replace is available, so
431
+ the label does not advertise them.
335
432
  - `aria-busy` is set while `loading` is true.
336
433
  - `aria-invalid` is set in the error state and the error message is linked
337
434
  via `aria-describedby` (and rendered with `role="alert"`).
@@ -7,6 +7,17 @@ interface ImageUploaderValue {
7
7
  filename?: string;
8
8
  url?: string;
9
9
  }
10
+ /**
11
+ * Explicit box dimensions, as an escape hatch from the square `size` enum.
12
+ *
13
+ * Only the outer box is affected — icon, padding, radius, gap and font sizes
14
+ * still come from the `size` token, so pick the `size` whose inner scale suits
15
+ * the slot you are asking for.
16
+ */
17
+ interface ImageUploaderCustomSize {
18
+ width: number | string;
19
+ height: number | string;
20
+ }
10
21
  /**
11
22
  * Normalized file shape produced by the platform picker / drag-drop pipeline.
12
23
  * - `uri` is a data-URL on web and a file URI on native.
@@ -24,6 +35,18 @@ type ImageUploaderFile = {
24
35
  interface ImageUploaderProps extends ThemeOverrideProps {
25
36
  /** Size of the uploader. Figma default is `xl`. */
26
37
  size?: ImageUploaderSize;
38
+ /**
39
+ * Explicit box dimensions for a non-square / fixed-rectangle slot (e.g.
40
+ * `{ width: 120, height: 32 }`), overriding the square `size` token.
41
+ *
42
+ * Only the outer box is resized — icon size, padding, radius, gap and font
43
+ * sizes still come from `size`, so pair a small box with a small `size` (and
44
+ * `placeholder={null}` when the box is too short for a label).
45
+ *
46
+ * Ignored for width when `wideView` is set, since `wideView` stretches the
47
+ * box to 100% of its parent; `customSize.height` still applies.
48
+ */
49
+ customSize?: ImageUploaderCustomSize;
27
50
  /** Placeholder shown under the icon. Accepts a string or a custom React node. */
28
51
  placeholder?: React.ReactNode;
29
52
  /** Placeholder shown while the file is uploading. Accepts a string or a custom React node. */
@@ -34,8 +57,25 @@ interface ImageUploaderProps extends ThemeOverrideProps {
34
57
  errorMessage?: string;
35
58
  /** Wide view (horizontal layout). When true, the box stretches to its parent's full width. */
36
59
  wideView?: boolean;
37
- /** Disabled state. */
60
+ /**
61
+ * Disabled state. When an image is already present (`value`/preview set),
62
+ * the existing thumbnail stays visible behind a dimming scrim instead of
63
+ * being replaced by the empty-state placeholder — the delete affordance is
64
+ * suppressed so the image cannot be removed while disabled.
65
+ */
38
66
  disabled?: boolean;
67
+ /**
68
+ * Whether the filled preview exposes a delete affordance. Defaults to `true`.
69
+ *
70
+ * When `false`, the hover trash overlay (and its scrim) is never rendered and
71
+ * clicking or dropping onto a filled preview re-opens the picker to REPLACE
72
+ * the image instead of removing it. `onDelete` is therefore never fired.
73
+ *
74
+ * This is independent of `disabled`: the field stays active and replaceable,
75
+ * only the removal path is gone. Use `disabled` when the whole control should
76
+ * be inert.
77
+ */
78
+ allowDelete?: boolean;
39
79
  /** Controlled loading state (shows spinner + "Uploading" label). */
40
80
  loading?: boolean;
41
81
  /** Controlled value. When provided, the component reflects this value. */
@@ -62,7 +102,7 @@ interface ImageUploaderProps extends ThemeOverrideProps {
62
102
  * the consumer's `onUpload`.
63
103
  */
64
104
  onChange?: (value: ImageUploaderValue | null, error?: Error) => void;
65
- /** Fires when the user removes the image (trash click / clear). */
105
+ /** Fires when the user removes the image (trash click / clear). Never fires when `allowDelete` is false. */
66
106
  onDelete?: () => void;
67
107
  /**
68
108
  * Accepted file types — passed through to the hidden `<input accept>` as a
@@ -83,4 +123,4 @@ interface ImageUploaderProps extends ThemeOverrideProps {
83
123
  }
84
124
  declare const ImageUploader: React.ForwardRefExoticComponent<ImageUploaderProps & React.RefAttributes<HTMLInputElement>>;
85
125
 
86
- export { ImageUploader, type ImageUploaderFile, type ImageUploaderProps, type ImageUploaderSize, type ImageUploaderValue };
126
+ export { ImageUploader, type ImageUploaderCustomSize, type ImageUploaderFile, type ImageUploaderProps, type ImageUploaderSize, type ImageUploaderValue };
package/native/index.d.ts CHANGED
@@ -7,6 +7,17 @@ interface ImageUploaderValue {
7
7
  filename?: string;
8
8
  url?: string;
9
9
  }
10
+ /**
11
+ * Explicit box dimensions, as an escape hatch from the square `size` enum.
12
+ *
13
+ * Only the outer box is affected — icon, padding, radius, gap and font sizes
14
+ * still come from the `size` token, so pick the `size` whose inner scale suits
15
+ * the slot you are asking for.
16
+ */
17
+ interface ImageUploaderCustomSize {
18
+ width: number | string;
19
+ height: number | string;
20
+ }
10
21
  /**
11
22
  * Normalized file shape produced by the platform picker / drag-drop pipeline.
12
23
  * - `uri` is a data-URL on web and a file URI on native.
@@ -24,6 +35,18 @@ type ImageUploaderFile = {
24
35
  interface ImageUploaderProps extends ThemeOverrideProps {
25
36
  /** Size of the uploader. Figma default is `xl`. */
26
37
  size?: ImageUploaderSize;
38
+ /**
39
+ * Explicit box dimensions for a non-square / fixed-rectangle slot (e.g.
40
+ * `{ width: 120, height: 32 }`), overriding the square `size` token.
41
+ *
42
+ * Only the outer box is resized — icon size, padding, radius, gap and font
43
+ * sizes still come from `size`, so pair a small box with a small `size` (and
44
+ * `placeholder={null}` when the box is too short for a label).
45
+ *
46
+ * Ignored for width when `wideView` is set, since `wideView` stretches the
47
+ * box to 100% of its parent; `customSize.height` still applies.
48
+ */
49
+ customSize?: ImageUploaderCustomSize;
27
50
  /** Placeholder shown under the icon. Accepts a string or a custom React node. */
28
51
  placeholder?: React.ReactNode;
29
52
  /** Placeholder shown while the file is uploading. Accepts a string or a custom React node. */
@@ -34,8 +57,25 @@ interface ImageUploaderProps extends ThemeOverrideProps {
34
57
  errorMessage?: string;
35
58
  /** Wide view (horizontal layout). When true, the box stretches to its parent's full width. */
36
59
  wideView?: boolean;
37
- /** Disabled state. */
60
+ /**
61
+ * Disabled state. When an image is already present (`value`/preview set),
62
+ * the existing thumbnail stays visible behind a dimming scrim instead of
63
+ * being replaced by the empty-state placeholder — the delete affordance is
64
+ * suppressed so the image cannot be removed while disabled.
65
+ */
38
66
  disabled?: boolean;
67
+ /**
68
+ * Whether the filled preview exposes a delete affordance. Defaults to `true`.
69
+ *
70
+ * When `false`, the hover trash overlay (and its scrim) is never rendered and
71
+ * clicking or dropping onto a filled preview re-opens the picker to REPLACE
72
+ * the image instead of removing it. `onDelete` is therefore never fired.
73
+ *
74
+ * This is independent of `disabled`: the field stays active and replaceable,
75
+ * only the removal path is gone. Use `disabled` when the whole control should
76
+ * be inert.
77
+ */
78
+ allowDelete?: boolean;
39
79
  /** Controlled loading state (shows spinner + "Uploading" label). */
40
80
  loading?: boolean;
41
81
  /** Controlled value. When provided, the component reflects this value. */
@@ -62,7 +102,7 @@ interface ImageUploaderProps extends ThemeOverrideProps {
62
102
  * the consumer's `onUpload`.
63
103
  */
64
104
  onChange?: (value: ImageUploaderValue | null, error?: Error) => void;
65
- /** Fires when the user removes the image (trash click / clear). */
105
+ /** Fires when the user removes the image (trash click / clear). Never fires when `allowDelete` is false. */
66
106
  onDelete?: () => void;
67
107
  /**
68
108
  * Accepted file types — passed through to the hidden `<input accept>` as a
@@ -83,4 +123,4 @@ interface ImageUploaderProps extends ThemeOverrideProps {
83
123
  }
84
124
  declare const ImageUploader: React.ForwardRefExoticComponent<ImageUploaderProps & React.RefAttributes<HTMLInputElement>>;
85
125
 
86
- export { ImageUploader, type ImageUploaderFile, type ImageUploaderProps, type ImageUploaderSize, type ImageUploaderValue };
126
+ export { ImageUploader, type ImageUploaderCustomSize, type ImageUploaderFile, type ImageUploaderProps, type ImageUploaderSize, type ImageUploaderValue };
package/native/index.js CHANGED
@@ -350,6 +350,7 @@ var import_jsx_runtime3 = require("react/jsx-runtime");
350
350
  var ImageUploader = (0, import_react.forwardRef)(
351
351
  ({
352
352
  size = "xl",
353
+ customSize,
353
354
  placeholder = "Upload",
354
355
  uploadingPlaceholder = "Uploading",
355
356
  description,
@@ -362,6 +363,7 @@ var ImageUploader = (0, import_react.forwardRef)(
362
363
  onChange,
363
364
  onDelete,
364
365
  disabled = false,
366
+ allowDelete = true,
365
367
  loading = false,
366
368
  testID,
367
369
  themeMode,
@@ -384,6 +386,7 @@ var ImageUploader = (0, import_react.forwardRef)(
384
386
  const descriptionId = `${baseId}-description`;
385
387
  const errorId = `${baseId}-error`;
386
388
  const preview = isControlled ? value?.url ?? null : internalPreview;
389
+ const previewBlocksUpload = !!preview && allowDelete;
387
390
  (0, import_react.useEffect)(() => {
388
391
  if (!isControlled && value === null) setInternalPreview(null);
389
392
  }, [isControlled, value]);
@@ -398,17 +401,20 @@ var ImageUploader = (0, import_react.forwardRef)(
398
401
  const alertBorder = theme.colors.control.alert.border;
399
402
  const alertText = theme.colors.content.alert.primary;
400
403
  const scrim = theme.colors.layer.scrim;
404
+ const boxWidth = wideView ? "100%" : customSize?.width ?? sizeStyles.box;
405
+ const boxHeight = customSize?.height ?? sizeStyles.box;
401
406
  const resolvedError = errorMessage || autoError;
402
407
  const hasError = !!resolvedError;
403
408
  let state;
404
- if (disabled) state = "disable";
409
+ if (disabled) state = preview ? "disabledUploaded" : "disable";
405
410
  else if (loading || isAutoUploading) state = "uploading";
406
411
  else if (hasError) state = "error";
407
412
  else if (preview)
408
- state = isPreviewHover || isHoverless ? "uploadedHover" : "uploaded";
413
+ state = allowDelete && (isPreviewHover || isHoverless) ? "uploadedHover" : "uploaded";
409
414
  else if (isFocus) state = "focus";
410
415
  else if (isHover) state = "hover";
411
416
  else state = "default";
417
+ const showsPreview = state === "uploaded" || state === "uploadedHover" || state === "disabledUploaded";
412
418
  const emitFile = (img) => {
413
419
  setAutoError(null);
414
420
  if (!isControlled) setInternalPreview(img.uri);
@@ -451,7 +457,7 @@ var ImageUploader = (0, import_react.forwardRef)(
451
457
  };
452
458
  const handleClick = async () => {
453
459
  if (disabled || loading) return;
454
- if (preview) {
460
+ if (previewBlocksUpload) {
455
461
  removeImage();
456
462
  return;
457
463
  }
@@ -472,7 +478,7 @@ var ImageUploader = (0, import_react.forwardRef)(
472
478
  const handleDragOver = (e) => {
473
479
  e.preventDefault();
474
480
  e.stopPropagation();
475
- if (!disabled && !loading && !preview) setIsHover(true);
481
+ if (!disabled && !loading && !previewBlocksUpload) setIsHover(true);
476
482
  };
477
483
  const handleDragLeave = (e) => {
478
484
  e.preventDefault();
@@ -483,7 +489,7 @@ var ImageUploader = (0, import_react.forwardRef)(
483
489
  e.preventDefault();
484
490
  e.stopPropagation();
485
491
  setIsHover(false);
486
- if (disabled || loading || preview) return;
492
+ if (disabled || loading || previewBlocksUpload) return;
487
493
  const file = e.dataTransfer.files?.[0];
488
494
  if (file) handleWebFile(file);
489
495
  };
@@ -512,8 +518,11 @@ var ImageUploader = (0, import_react.forwardRef)(
512
518
  backgroundColor = focusColors.bg;
513
519
  borderColor = focusColors.border;
514
520
  break;
521
+ // `disabledUploaded` is chromeless like the other preview states — the
522
+ // disabled cue is the scrim over the image, not a greyed-out box.
515
523
  case "uploaded":
516
524
  case "uploadedHover":
525
+ case "disabledUploaded":
517
526
  backgroundColor = "transparent";
518
527
  borderColor = "transparent";
519
528
  break;
@@ -535,7 +544,7 @@ var ImageUploader = (0, import_react.forwardRef)(
535
544
  const rootGap = state === "error" ? sizeStyles.errorGap : 0;
536
545
  const placeholderContent = state === "uploading" ? uploadingPlaceholder : placeholder;
537
546
  const renderInner = () => {
538
- if (state === "uploaded" || state === "uploadedHover") {
547
+ if (showsPreview) {
539
548
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
540
549
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
541
550
  Box,
@@ -554,7 +563,21 @@ var ImageUploader = (0, import_react.forwardRef)(
554
563
  style: isWeb ? { objectFit: "cover" } : void 0
555
564
  }
556
565
  ),
557
- state === "uploadedHover" && !disabled && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
566
+ state === "disabledUploaded" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
567
+ Box,
568
+ {
569
+ "data-testid": "image-uploader__disabled-scrim",
570
+ position: "absolute",
571
+ top: 0,
572
+ left: 0,
573
+ right: 0,
574
+ bottom: 0,
575
+ backgroundColor: scrim,
576
+ borderRadius: sizeStyles.radius,
577
+ ...isWeb && { "aria-hidden": "true" }
578
+ }
579
+ ),
580
+ state === "uploadedHover" && !disabled && allowDelete && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
558
581
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
559
582
  Box,
560
583
  {
@@ -658,7 +681,7 @@ var ImageUploader = (0, import_react.forwardRef)(
658
681
  else setIsHover(false);
659
682
  },
660
683
  onFocus: (e) => {
661
- if (disabled || loading || preview) return;
684
+ if (disabled || loading || previewBlocksUpload) return;
662
685
  if (typeof e.target?.matches === "function" && !e.target.matches(":focus-visible")) {
663
686
  return;
664
687
  }
@@ -676,7 +699,9 @@ var ImageUploader = (0, import_react.forwardRef)(
676
699
  outline: "none",
677
700
  transition: "background-color 0.15s ease, border-color 0.15s ease"
678
701
  } : {};
679
- const buttonAriaLabel = preview ? `Remove image${value?.filename ? `: ${value.filename}` : ""}` : state === "uploading" ? typeof uploadingPlaceholder === "string" ? uploadingPlaceholder : "Uploading" : typeof placeholder === "string" ? placeholder : "Upload";
702
+ const filenameSuffix = value?.filename ? `: ${value.filename}` : "";
703
+ const previewAriaLabel = disabled ? `Uploaded image${filenameSuffix}` : allowDelete ? `Remove image${filenameSuffix}` : `Replace image${filenameSuffix}`;
704
+ const buttonAriaLabel = preview ? previewAriaLabel : state === "uploading" ? typeof uploadingPlaceholder === "string" ? uploadingPlaceholder : "Uploading" : typeof placeholder === "string" ? placeholder : "Upload";
680
705
  const describedBy = [
681
706
  state === "error" && resolvedError ? errorId : null,
682
707
  description && wideView && state !== "error" ? descriptionId : null
@@ -719,13 +744,13 @@ var ImageUploader = (0, import_react.forwardRef)(
719
744
  },
720
745
  ...webOnlyHandlers,
721
746
  position: "relative",
722
- width: wideView ? "100%" : sizeStyles.box,
723
- height: sizeStyles.box,
747
+ width: boxWidth,
748
+ height: boxHeight,
724
749
  flexDirection: "column",
725
750
  alignItems: "center",
726
751
  justifyContent: "center",
727
752
  gap: sizeStyles.gap,
728
- padding: state === "uploaded" ? 0 : sizeStyles.padding,
753
+ padding: state === "uploaded" || state === "disabledUploaded" ? 0 : sizeStyles.padding,
729
754
  borderWidth: sizeStyles.borderWidth,
730
755
  borderStyle,
731
756
  borderColor,