@dmsi/wedgekit-react 0.0.229 → 0.0.230

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.
@@ -62,7 +62,7 @@ __export(Upload_exports, {
62
62
  Upload: () => Upload
63
63
  });
64
64
  module.exports = __toCommonJS(Upload_exports);
65
- var import_clsx5 = __toESM(require("clsx"), 1);
65
+ var import_clsx6 = __toESM(require("clsx"), 1);
66
66
 
67
67
  // src/classNames.ts
68
68
  var import_clsx = __toESM(require("clsx"), 1);
@@ -417,8 +417,288 @@ var Button = (_a) => {
417
417
  };
418
418
  Button.displayName = "Button";
419
419
 
420
- // src/components/Upload.tsx
420
+ // src/components/Stack.tsx
421
+ var import_clsx5 = __toESM(require("clsx"), 1);
421
422
  var import_jsx_runtime4 = require("react/jsx-runtime");
423
+ var getFlexClassNames = ({ items, justify, grow }) => (0, import_clsx5.default)(
424
+ "flex",
425
+ items === "start" && "items-start",
426
+ grow && "grow",
427
+ items === "start" && "items-start",
428
+ items === "center" && "items-center",
429
+ items === "end" && "items-end",
430
+ items === "start-center" && "items-start desktop:items-center",
431
+ justify === "start" && "justify-start",
432
+ justify === "center" && "justify-center",
433
+ justify === "end" && "justify-end",
434
+ justify === "end" && "justify-end",
435
+ justify === "between" && "justify-between",
436
+ justify === "around" && "justify-around"
437
+ );
438
+ var useGapClassNames = (sizing) => {
439
+ return (0, import_clsx5.default)(
440
+ sizing === "layout-group" && "gap-mobile-layout-group-gap desktop:gap-desktop-layout-group-gap compact:gap-compact-layout-group-gap",
441
+ sizing === "layout" && "gap-mobile-layout-gap desktop:gap-desktop-layout-gap compact:gap-compact-layout-gap",
442
+ sizing === "container" && "gap-mobile-container-gap desktop:gap-desktop-container-gap compact:gap-compact-container-gap",
443
+ sizing === "component" && "gap-mobile-component-gap desktop:gap-desktop-component-gap compact:gap-compact-component-gap"
444
+ );
445
+ };
446
+ var Stack = (_a) => {
447
+ var _b = _a, {
448
+ children,
449
+ items,
450
+ justify,
451
+ grow,
452
+ padding,
453
+ paddingX,
454
+ paddingY,
455
+ margin,
456
+ marginX,
457
+ marginY,
458
+ horizontal,
459
+ horizontalMobile,
460
+ elevation = 0,
461
+ rounded,
462
+ centered,
463
+ width,
464
+ minHeight,
465
+ maxWidth,
466
+ minWidth,
467
+ height,
468
+ maxHeight,
469
+ borderColor,
470
+ backgroundColor,
471
+ sizing = "none",
472
+ overflowY = "inherit",
473
+ overflowX = "inherit",
474
+ flexShrink,
475
+ flexGrow,
476
+ position,
477
+ top,
478
+ left,
479
+ id,
480
+ noGap,
481
+ marginTop,
482
+ marginBottom,
483
+ testid
484
+ } = _b, props = __objRest(_b, [
485
+ "children",
486
+ "items",
487
+ "justify",
488
+ "grow",
489
+ "padding",
490
+ "paddingX",
491
+ "paddingY",
492
+ "margin",
493
+ "marginX",
494
+ "marginY",
495
+ "horizontal",
496
+ "horizontalMobile",
497
+ "elevation",
498
+ "rounded",
499
+ "centered",
500
+ "width",
501
+ "minHeight",
502
+ "maxWidth",
503
+ "minWidth",
504
+ "height",
505
+ "maxHeight",
506
+ "borderColor",
507
+ "backgroundColor",
508
+ "sizing",
509
+ "overflowY",
510
+ "overflowX",
511
+ "flexShrink",
512
+ "flexGrow",
513
+ "position",
514
+ "top",
515
+ "left",
516
+ "id",
517
+ "noGap",
518
+ "marginTop",
519
+ "marginBottom",
520
+ "testid"
521
+ ]);
522
+ const flexClassNames = getFlexClassNames({ items, justify, grow });
523
+ const gapClassNames = useGapClassNames(sizing);
524
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
525
+ "div",
526
+ __spreadProps(__spreadValues({
527
+ id,
528
+ "data-testid": testid
529
+ }, props), {
530
+ style: {
531
+ height: height === "full" ? "100%" : height !== void 0 ? `${height}px` : void 0,
532
+ maxHeight: maxHeight !== void 0 ? `${maxHeight}px` : void 0,
533
+ minHeight: minHeight !== void 0 ? `${minHeight}px` : void 0,
534
+ maxWidth: maxWidth !== void 0 ? `${maxWidth}px` : void 0,
535
+ width: width !== void 0 && typeof width === "number" ? `${width}px` : void 0,
536
+ minWidth: minWidth !== void 0 ? `${minWidth}px` : void 0,
537
+ border: borderColor ? `1px solid var(--color-${borderColor})` : void 0,
538
+ backgroundColor: backgroundColor ? `var(--color-${backgroundColor})` : void 0,
539
+ flexGrow: flexGrow !== void 0 ? flexGrow : void 0,
540
+ flexShrink: flexShrink !== void 0 ? flexShrink : void 0,
541
+ position: position !== void 0 ? position : void 0,
542
+ top: top !== void 0 ? `${top}px` : void 0,
543
+ left: left !== void 0 ? `${left}px` : void 0
544
+ },
545
+ className: (0, import_clsx5.default)(
546
+ "scrollbar-thin",
547
+ "max-w-screen",
548
+ width !== "fit" && "w-full",
549
+ width === "full" && "w-full",
550
+ width === "max" && "w-max",
551
+ centered && "mx-auto",
552
+ overflowY == "auto" && "overflow-y-auto",
553
+ overflowY == "hidden" && "overflow-y-hidden",
554
+ overflowY == "scroll" && "overflow-y-scroll",
555
+ overflowX == "auto" && "overflow-x-auto",
556
+ overflowX == "hidden" && "overflow-x-hidden",
557
+ overflowX == "scroll" && "overflow-x-scroll",
558
+ padding && sizing === "container" && "p-mobile-container-padding desktop:p-desktop-container-padding compact:p-desktop-compact-container-padding",
559
+ padding && sizing === "layout" && "p-mobile-layout-padding desktop:p-desktop-layout-padding compact:p-desktop-compact-layout-padding",
560
+ padding && sizing === "layout-group" && "p-mobile-layout-group-padding desktop:p-desktop-layout-group-padding compact:p-desktop-compact-layout-group-padding",
561
+ padding && sizing === "component" && "p-mobile-component-padding desktop:p-desktop-component-padding compact:p-desktop-compact-component-padding",
562
+ paddingX && sizing === "container" && "px-mobile-container-padding desktop:px-desktop-container-padding compact:px-desktop-compact-container-padding",
563
+ paddingX && sizing === "layout" && "px-mobile-layout-padding desktop:px-desktop-layout-padding compact:px-desktop-compact-layout-padding",
564
+ paddingX && sizing === "layout-group" && "px-mobile-layout-group-padding desktop:px-desktop-layout-group-padding compact:px-desktop-compact-layout-group-padding",
565
+ paddingX && sizing === "component" && "px-mobile-component-padding desktop:px-desktop-component-padding compact:px-desktop-compact-component-padding",
566
+ paddingY && sizing === "container" && "py-mobile-container-padding desktop:py-desktop-container-padding compact:py-desktop-compact-container-padding",
567
+ paddingY && sizing === "layout" && "py-mobile-layout-padding desktop:py-desktop-layout-padding compact:py-desktop-compact-layout-padding",
568
+ paddingY && sizing === "layout-group" && paddingYUsingLayoutGroupGap,
569
+ paddingY && sizing === "component" && "py-mobile-component-padding desktop:py-desktop-component-padding compact:py-desktop-compact-component-padding",
570
+ margin && sizing === "container" && "m-mobile-container-padding desktop:m-desktop-container-padding compact:m-compact-container-padding",
571
+ marginX && sizing === "container" && "mx-mobile-container-padding desktop:mx-desktop-container-padding compact:mx-compact-container-padding",
572
+ marginTop && sizing === "container" && "mt-mobile-container-padding desktop:mt-desktop-container-padding compact:mt-compact-container-padding",
573
+ marginBottom && sizing === "container" && "mb-mobile-container-padding desktop:mb-desktop-container-padding compact:mb-compact-container-padding",
574
+ marginY && sizing === "container" && "my-mobile-container-padding desktop:my-desktop-container-padding compact:my-compact-container-padding",
575
+ horizontal ? "desktop:flex-row" : "desktop:flex-col",
576
+ horizontalMobile ? "flex-row" : "flex-col",
577
+ flexClassNames,
578
+ !noGap && gapClassNames,
579
+ elevation === 0 && "shadow-none",
580
+ elevation === 2 && "shadow-2",
581
+ elevation === 4 && "shadow-4",
582
+ elevation === 16 && "shadow-16",
583
+ rounded && "rounded"
584
+ ),
585
+ children
586
+ })
587
+ );
588
+ };
589
+
590
+ // src/components/Spinner.tsx
591
+ var import_jsx_runtime5 = require("react/jsx-runtime");
592
+ var Spinner = ({ size = "small", testid }) => {
593
+ const dimension = size === "large" ? 48 : 24;
594
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
595
+ "svg",
596
+ {
597
+ "data-testid": testid,
598
+ width: dimension,
599
+ height: dimension,
600
+ viewBox: "0 0 24 24",
601
+ xmlns: "http://www.w3.org/2000/svg",
602
+ fill: "#1D1E1E",
603
+ className: "animate-spin",
604
+ "aria-label": "Loading",
605
+ children: [
606
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "12", cy: "4", r: "2", opacity: "1", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
607
+ "animate",
608
+ {
609
+ attributeName: "opacity",
610
+ begin: "0s",
611
+ dur: "1s",
612
+ from: "1",
613
+ to: "0",
614
+ repeatCount: "indefinite"
615
+ }
616
+ ) }),
617
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "17.666", cy: "6.334", r: "2", opacity: "0.125", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
618
+ "animate",
619
+ {
620
+ attributeName: "opacity",
621
+ begin: "-0.875s",
622
+ dur: "1s",
623
+ from: "1",
624
+ to: "0",
625
+ repeatCount: "indefinite"
626
+ }
627
+ ) }),
628
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "20", cy: "12", r: "2", opacity: "0.25", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
629
+ "animate",
630
+ {
631
+ attributeName: "opacity",
632
+ begin: "-0.75s",
633
+ dur: "1s",
634
+ from: "1",
635
+ to: "0",
636
+ repeatCount: "indefinite"
637
+ }
638
+ ) }),
639
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "17.666", cy: "17.666", r: "2", opacity: "0.375", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
640
+ "animate",
641
+ {
642
+ attributeName: "opacity",
643
+ begin: "-0.625s",
644
+ dur: "1s",
645
+ from: "1",
646
+ to: "0",
647
+ repeatCount: "indefinite"
648
+ }
649
+ ) }),
650
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "12", cy: "20", r: "2", opacity: "0.5", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
651
+ "animate",
652
+ {
653
+ attributeName: "opacity",
654
+ begin: "-0.5s",
655
+ dur: "1s",
656
+ from: "1",
657
+ to: "0",
658
+ repeatCount: "indefinite"
659
+ }
660
+ ) }),
661
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "6.334", cy: "17.666", r: "2", opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
662
+ "animate",
663
+ {
664
+ attributeName: "opacity",
665
+ begin: "-0.375s",
666
+ dur: "1s",
667
+ from: "1",
668
+ to: "0",
669
+ repeatCount: "indefinite"
670
+ }
671
+ ) }),
672
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "4", cy: "12", r: "2", opacity: "0.75", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
673
+ "animate",
674
+ {
675
+ attributeName: "opacity",
676
+ begin: "-0.25s",
677
+ dur: "1s",
678
+ from: "1",
679
+ to: "0",
680
+ repeatCount: "indefinite"
681
+ }
682
+ ) }),
683
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "6.334", cy: "6.334", r: "2", opacity: "0.875", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
684
+ "animate",
685
+ {
686
+ attributeName: "opacity",
687
+ begin: "-0.125s",
688
+ dur: "1s",
689
+ from: "1",
690
+ to: "0",
691
+ repeatCount: "indefinite"
692
+ }
693
+ ) })
694
+ ]
695
+ }
696
+ );
697
+ };
698
+ Spinner.displayName = "Spinner";
699
+
700
+ // src/components/Upload.tsx
701
+ var import_jsx_runtime6 = require("react/jsx-runtime");
422
702
  function Upload(props) {
423
703
  const _a = props, {
424
704
  isLoading,
@@ -437,11 +717,11 @@ function Upload(props) {
437
717
  "onRemove",
438
718
  "testid"
439
719
  ]);
440
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
720
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
441
721
  "label",
442
722
  {
443
723
  style: __spreadValues({}, style),
444
- className: (0, import_clsx5.default)(
724
+ className: (0, import_clsx6.default)(
445
725
  "border border-dashed border-border-primary-normal",
446
726
  "flex flex-col items-center justify-center",
447
727
  "p-6",
@@ -452,7 +732,7 @@ function Upload(props) {
452
732
  ),
453
733
  "data-testid": testid,
454
734
  children: [
455
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
735
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
456
736
  "input",
457
737
  __spreadProps(__spreadValues({}, rest), {
458
738
  type: "file",
@@ -460,16 +740,37 @@ function Upload(props) {
460
740
  "data-testid": testid ? `${testid}-file-input` : void 0
461
741
  })
462
742
  ),
463
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
464
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { testid: testid ? `${testid}-loading-icon` : void 0, name: "cached", className: "text-icon-primary-normal animate-spin" }),
465
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Paragraph, { testid: testid ? `${testid}-loading-text` : void 0, color: "text-secondary-normal", children: "Loading..." })
466
- ] }),
467
- !value && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
468
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { testid: testid ? `${testid}-icon` : void 0, name: "cloud_upload", className: "text-icon-primary-normal" }),
469
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Paragraph, { testid: testid ? `${testid}-text` : void 0, color: errorText ? "text-primary-error" : "text-secondary-normal", children: errorText ? errorText : text })
743
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
744
+ Stack,
745
+ {
746
+ centered: true,
747
+ items: "center",
748
+ justify: "center",
749
+ sizing: "container",
750
+ padding: true,
751
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, { size: "large" })
752
+ }
753
+ ),
754
+ !value && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
755
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
756
+ Icon,
757
+ {
758
+ testid: testid ? `${testid}-icon` : void 0,
759
+ name: "cloud_upload",
760
+ className: "text-icon-primary-normal"
761
+ }
762
+ ),
763
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
764
+ Paragraph,
765
+ {
766
+ testid: testid ? `${testid}-text` : void 0,
767
+ color: errorText ? "text-primary-error" : "text-secondary-normal",
768
+ children: errorText ? errorText : text
769
+ }
770
+ )
470
771
  ] }),
471
- value && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
472
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
772
+ value && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
773
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
473
774
  "img",
474
775
  {
475
776
  "data-testid": testid ? `${testid}-uploaded-image` : void 0,
@@ -478,7 +779,7 @@ function Upload(props) {
478
779
  className: "absolute inset-0 object-contain object-center max-h-full max-w-full self-center justify-self-center"
479
780
  }
480
781
  ),
481
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "absolute right-2 top-2", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
782
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "absolute right-2 top-2", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
482
783
  Button,
483
784
  {
484
785
  testid: testid ? `${testid}-remove-image-button` : void 0,
@@ -488,7 +789,7 @@ function Upload(props) {
488
789
  onRemove == null ? void 0 : onRemove();
489
790
  },
490
791
  iconOnly: true,
491
- leftIcon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "delete" })
792
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "delete" })
492
793
  }
493
794
  ) })
494
795
  ] })
@@ -1,3 +1,9 @@
1
+ import {
2
+ Spinner
3
+ } from "../chunk-PLMGI5K5.js";
4
+ import {
5
+ Stack
6
+ } from "../chunk-BOWQUDUU.js";
1
7
  import {
2
8
  Paragraph
3
9
  } from "../chunk-CJELWEO2.js";
@@ -60,13 +66,34 @@ function Upload(props) {
60
66
  "data-testid": testid ? `${testid}-file-input` : void 0
61
67
  })
62
68
  ),
63
- isLoading && /* @__PURE__ */ jsxs(Fragment, { children: [
64
- /* @__PURE__ */ jsx(Icon, { testid: testid ? `${testid}-loading-icon` : void 0, name: "cached", className: "text-icon-primary-normal animate-spin" }),
65
- /* @__PURE__ */ jsx(Paragraph, { testid: testid ? `${testid}-loading-text` : void 0, color: "text-secondary-normal", children: "Loading..." })
66
- ] }),
69
+ isLoading && /* @__PURE__ */ jsx(
70
+ Stack,
71
+ {
72
+ centered: true,
73
+ items: "center",
74
+ justify: "center",
75
+ sizing: "container",
76
+ padding: true,
77
+ children: /* @__PURE__ */ jsx(Spinner, { size: "large" })
78
+ }
79
+ ),
67
80
  !value && !isLoading && /* @__PURE__ */ jsxs(Fragment, { children: [
68
- /* @__PURE__ */ jsx(Icon, { testid: testid ? `${testid}-icon` : void 0, name: "cloud_upload", className: "text-icon-primary-normal" }),
69
- /* @__PURE__ */ jsx(Paragraph, { testid: testid ? `${testid}-text` : void 0, color: errorText ? "text-primary-error" : "text-secondary-normal", children: errorText ? errorText : text })
81
+ /* @__PURE__ */ jsx(
82
+ Icon,
83
+ {
84
+ testid: testid ? `${testid}-icon` : void 0,
85
+ name: "cloud_upload",
86
+ className: "text-icon-primary-normal"
87
+ }
88
+ ),
89
+ /* @__PURE__ */ jsx(
90
+ Paragraph,
91
+ {
92
+ testid: testid ? `${testid}-text` : void 0,
93
+ color: errorText ? "text-primary-error" : "text-secondary-normal",
94
+ children: errorText ? errorText : text
95
+ }
96
+ )
70
97
  ] }),
71
98
  value && /* @__PURE__ */ jsxs(Fragment, { children: [
72
99
  /* @__PURE__ */ jsx(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dmsi/wedgekit-react",
3
3
  "private": false,
4
- "version": "0.0.229",
4
+ "version": "0.0.230",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsup",
@@ -4,88 +4,104 @@ import { componentGap } from "../classNames";
4
4
  import { Icon } from "./Icon";
5
5
  import { Paragraph } from "./Paragraph";
6
6
  import { Button } from "./Button";
7
+ import { Stack } from "./Stack";
8
+ import { Spinner } from "./Spinner";
7
9
 
8
10
  export type UploadProps = {
9
- isLoading?: boolean;
10
- text?: string;
11
- errorText?: string;
12
- onRemove?: () => void;
13
- testid?: string;
11
+ isLoading?: boolean;
12
+ text?: string;
13
+ errorText?: string;
14
+ onRemove?: () => void;
15
+ testid?: string;
14
16
  } & ComponentProps<"input">;
15
17
 
16
18
  export function Upload(props: UploadProps) {
17
- const {
18
- isLoading,
19
- style,
20
- errorText,
21
- text = 'Upload your file',
22
- value,
23
- onRemove,
24
- testid,
25
- ...rest
26
- } = props;
19
+ const {
20
+ isLoading,
21
+ style,
22
+ errorText,
23
+ text = "Upload your file",
24
+ value,
25
+ onRemove,
26
+ testid,
27
+ ...rest
28
+ } = props;
27
29
 
28
- return (
29
- <label
30
- style={{
31
- ...style,
32
- }}
33
- className={clsx(
34
- "border border-dashed border-border-primary-normal",
35
- "flex flex-col items-center justify-center",
36
- "p-6",
37
- "cursor-pointer",
38
- "relative",
39
- "w-full h-[166px] desktop:w-[340px] desktop:h-[190px]",
40
- componentGap,
41
- )}
42
- data-testid={testid}
30
+ return (
31
+ <label
32
+ style={{
33
+ ...style,
34
+ }}
35
+ className={clsx(
36
+ "border border-dashed border-border-primary-normal",
37
+ "flex flex-col items-center justify-center",
38
+ "p-6",
39
+ "cursor-pointer",
40
+ "relative",
41
+ "w-full h-[166px] desktop:w-[340px] desktop:h-[190px]",
42
+ componentGap,
43
+ )}
44
+ data-testid={testid}
45
+ >
46
+ <input
47
+ {...rest}
48
+ type="file"
49
+ className="sr-only"
50
+ data-testid={testid ? `${testid}-file-input` : undefined}
51
+ />
52
+
53
+ {isLoading && (
54
+ <Stack
55
+ centered
56
+ items="center"
57
+ justify="center"
58
+ sizing="container"
59
+ padding
43
60
  >
44
- <input
45
- {...rest}
46
- type="file"
47
- className="sr-only"
48
- data-testid={testid ? `${testid}-file-input` : undefined}
49
- />
61
+ <Spinner size="large" />
62
+ </Stack>
63
+ )}
50
64
 
51
- {isLoading && (
52
- <>
53
- <Icon testid={testid ? `${testid}-loading-icon` : undefined} name="cached" className="text-icon-primary-normal animate-spin" />
54
- <Paragraph testid={testid ? `${testid}-loading-text` : undefined} color="text-secondary-normal">Loading...</Paragraph>
55
- </>
56
- )}
57
-
58
- {!value && !isLoading && (
59
- <>
60
- <Icon testid={testid ? `${testid}-icon` : undefined} name="cloud_upload" className="text-icon-primary-normal" />
61
- <Paragraph testid={testid ? `${testid}-text` : undefined} color={errorText ? 'text-primary-error' : 'text-secondary-normal'}>{errorText ? errorText : text}</Paragraph>
62
- </>
63
- )}
65
+ {!value && !isLoading && (
66
+ <>
67
+ <Icon
68
+ testid={testid ? `${testid}-icon` : undefined}
69
+ name="cloud_upload"
70
+ className="text-icon-primary-normal"
71
+ />
72
+ <Paragraph
73
+ testid={testid ? `${testid}-text` : undefined}
74
+ color={errorText ? "text-primary-error" : "text-secondary-normal"}
75
+ >
76
+ {errorText ? errorText : text}
77
+ </Paragraph>
78
+ </>
79
+ )}
64
80
 
65
- {value && (
66
- <>
67
- <img
68
- data-testid={testid ? `${testid}-uploaded-image` : undefined}
69
- src={value as string}
70
- alt=""
71
- className="absolute inset-0 object-contain object-center max-h-full max-w-full self-center justify-self-center"
72
- />
81
+ {value && (
82
+ <>
83
+ <img
84
+ data-testid={testid ? `${testid}-uploaded-image` : undefined}
85
+ src={value as string}
86
+ alt=""
87
+ className="absolute inset-0 object-contain object-center max-h-full max-w-full self-center justify-self-center"
88
+ />
73
89
 
74
- <div className="absolute right-2 top-2">
75
- <Button
76
- testid={testid ? `${testid}-remove-image-button` : undefined}
77
- onClick={(e: MouseEvent) => {
78
- e.preventDefault();
79
- e.stopPropagation();
90
+ <div className="absolute right-2 top-2">
91
+ <Button
92
+ testid={testid ? `${testid}-remove-image-button` : undefined}
93
+ onClick={(e: MouseEvent) => {
94
+ e.preventDefault();
95
+ e.stopPropagation();
80
96
 
81
- onRemove?.();
82
- }}
83
- iconOnly
84
- leftIcon={<Icon name="delete" />}
85
- />
86
- </div>
87
- </>
88
- )}
89
- </label>
90
- )
91
- }
97
+ onRemove?.();
98
+ }}
99
+ iconOnly
100
+ leftIcon={<Icon name="delete" />}
101
+ />
102
+ </div>
103
+ </>
104
+ )}
105
+ </label>
106
+ );
107
+ }