@dmsi/wedgekit-react 0.0.690 → 0.0.692
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/dist/components/Upload.cjs +96 -92
- package/dist/components/Upload.js +96 -92
- package/package.json +1 -1
|
@@ -63,6 +63,7 @@ __export(Upload_exports, {
|
|
|
63
63
|
});
|
|
64
64
|
module.exports = __toCommonJS(Upload_exports);
|
|
65
65
|
var import_clsx6 = __toESM(require("clsx"), 1);
|
|
66
|
+
var import_react = require("react");
|
|
66
67
|
|
|
67
68
|
// src/classNames.ts
|
|
68
69
|
var import_clsx = __toESM(require("clsx"), 1);
|
|
@@ -702,104 +703,107 @@ var Stack = (_a) => {
|
|
|
702
703
|
|
|
703
704
|
// src/components/Upload.tsx
|
|
704
705
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
"data-testid": testid,
|
|
737
|
-
children: [
|
|
738
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
739
|
-
"input",
|
|
740
|
-
__spreadProps(__spreadValues({}, rest), {
|
|
741
|
-
type: "file",
|
|
742
|
-
className: "sr-only",
|
|
743
|
-
"data-testid": testid ? `${testid}-file-input` : void 0
|
|
744
|
-
})
|
|
745
|
-
),
|
|
746
|
-
isLoading && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
747
|
-
Stack,
|
|
748
|
-
{
|
|
749
|
-
centered: true,
|
|
750
|
-
items: "center",
|
|
751
|
-
justify: "center",
|
|
752
|
-
sizing: "container",
|
|
753
|
-
padding: true,
|
|
754
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, { size: "large" })
|
|
755
|
-
}
|
|
706
|
+
var Upload = (0, import_react.forwardRef)(
|
|
707
|
+
function Upload2(props, ref) {
|
|
708
|
+
const _a = props, {
|
|
709
|
+
isLoading,
|
|
710
|
+
style,
|
|
711
|
+
errorText,
|
|
712
|
+
text = "Upload your file",
|
|
713
|
+
value,
|
|
714
|
+
onRemove,
|
|
715
|
+
testid
|
|
716
|
+
} = _a, rest = __objRest(_a, [
|
|
717
|
+
"isLoading",
|
|
718
|
+
"style",
|
|
719
|
+
"errorText",
|
|
720
|
+
"text",
|
|
721
|
+
"value",
|
|
722
|
+
"onRemove",
|
|
723
|
+
"testid"
|
|
724
|
+
]);
|
|
725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
726
|
+
"label",
|
|
727
|
+
{
|
|
728
|
+
style: __spreadValues({}, style),
|
|
729
|
+
className: (0, import_clsx6.default)(
|
|
730
|
+
"border border-dashed border-border-primary-normal",
|
|
731
|
+
"flex flex-col items-center justify-center",
|
|
732
|
+
"p-6",
|
|
733
|
+
"cursor-pointer",
|
|
734
|
+
"relative",
|
|
735
|
+
"w-full h-[166px] desktop:w-[340px] desktop:h-[190px]",
|
|
736
|
+
componentGap
|
|
756
737
|
),
|
|
757
|
-
|
|
738
|
+
"data-testid": testid,
|
|
739
|
+
children: [
|
|
758
740
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
759
|
-
|
|
760
|
-
{
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
className: "
|
|
764
|
-
|
|
741
|
+
"input",
|
|
742
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
743
|
+
ref,
|
|
744
|
+
type: "file",
|
|
745
|
+
className: "sr-only",
|
|
746
|
+
"data-testid": testid ? `${testid}-file-input` : void 0
|
|
747
|
+
})
|
|
765
748
|
),
|
|
766
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
767
|
-
|
|
768
|
-
{
|
|
769
|
-
testid: testid ? `${testid}-text` : void 0,
|
|
770
|
-
color: errorText ? "text-primary-error" : "text-secondary-normal",
|
|
771
|
-
children: errorText ? errorText : text
|
|
772
|
-
}
|
|
773
|
-
)
|
|
774
|
-
] }),
|
|
775
|
-
value && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
776
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
777
|
-
"img",
|
|
749
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
750
|
+
Stack,
|
|
778
751
|
{
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
752
|
+
centered: true,
|
|
753
|
+
items: "center",
|
|
754
|
+
justify: "center",
|
|
755
|
+
sizing: "container",
|
|
756
|
+
padding: true,
|
|
757
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, { size: "large" })
|
|
783
758
|
}
|
|
784
759
|
),
|
|
785
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
}
|
|
760
|
+
!value && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
761
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
762
|
+
Icon,
|
|
763
|
+
{
|
|
764
|
+
testid: testid ? `${testid}-icon` : void 0,
|
|
765
|
+
name: "cloud_upload",
|
|
766
|
+
className: "text-icon-primary-normal"
|
|
767
|
+
}
|
|
768
|
+
),
|
|
769
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
770
|
+
Paragraph,
|
|
771
|
+
{
|
|
772
|
+
testid: testid ? `${testid}-text` : void 0,
|
|
773
|
+
color: errorText ? "text-primary-error" : "text-secondary-normal",
|
|
774
|
+
children: errorText ? errorText : text
|
|
775
|
+
}
|
|
776
|
+
)
|
|
777
|
+
] }),
|
|
778
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
779
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
780
|
+
"img",
|
|
781
|
+
{
|
|
782
|
+
"data-testid": testid ? `${testid}-uploaded-image` : void 0,
|
|
783
|
+
src: value,
|
|
784
|
+
alt: "",
|
|
785
|
+
className: "absolute inset-0 object-contain object-center max-h-full max-w-full self-center justify-self-center"
|
|
786
|
+
}
|
|
787
|
+
),
|
|
788
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "absolute right-2 top-2", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
789
|
+
Button,
|
|
790
|
+
{
|
|
791
|
+
testid: testid ? `${testid}-remove-image-button` : void 0,
|
|
792
|
+
onClick: (e) => {
|
|
793
|
+
e.preventDefault();
|
|
794
|
+
e.stopPropagation();
|
|
795
|
+
onRemove == null ? void 0 : onRemove();
|
|
796
|
+
},
|
|
797
|
+
iconOnly: true,
|
|
798
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "delete" })
|
|
799
|
+
}
|
|
800
|
+
) })
|
|
801
|
+
] })
|
|
802
|
+
]
|
|
803
|
+
}
|
|
804
|
+
);
|
|
805
|
+
}
|
|
806
|
+
);
|
|
803
807
|
// Annotate the CommonJS export names for ESM import in node:
|
|
804
808
|
0 && (module.exports = {
|
|
805
809
|
Upload
|
|
@@ -24,105 +24,109 @@ import {
|
|
|
24
24
|
|
|
25
25
|
// src/components/Upload.tsx
|
|
26
26
|
import clsx from "clsx";
|
|
27
|
+
import { forwardRef } from "react";
|
|
27
28
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"data-testid": testid,
|
|
60
|
-
children: [
|
|
61
|
-
/* @__PURE__ */ jsx(
|
|
62
|
-
"input",
|
|
63
|
-
__spreadProps(__spreadValues({}, rest), {
|
|
64
|
-
type: "file",
|
|
65
|
-
className: "sr-only",
|
|
66
|
-
"data-testid": testid ? `${testid}-file-input` : void 0
|
|
67
|
-
})
|
|
29
|
+
var Upload = forwardRef(
|
|
30
|
+
function Upload2(props, ref) {
|
|
31
|
+
const _a = props, {
|
|
32
|
+
isLoading,
|
|
33
|
+
style,
|
|
34
|
+
errorText,
|
|
35
|
+
text = "Upload your file",
|
|
36
|
+
value,
|
|
37
|
+
onRemove,
|
|
38
|
+
testid
|
|
39
|
+
} = _a, rest = __objRest(_a, [
|
|
40
|
+
"isLoading",
|
|
41
|
+
"style",
|
|
42
|
+
"errorText",
|
|
43
|
+
"text",
|
|
44
|
+
"value",
|
|
45
|
+
"onRemove",
|
|
46
|
+
"testid"
|
|
47
|
+
]);
|
|
48
|
+
return /* @__PURE__ */ jsxs(
|
|
49
|
+
"label",
|
|
50
|
+
{
|
|
51
|
+
style: __spreadValues({}, style),
|
|
52
|
+
className: clsx(
|
|
53
|
+
"border border-dashed border-border-primary-normal",
|
|
54
|
+
"flex flex-col items-center justify-center",
|
|
55
|
+
"p-6",
|
|
56
|
+
"cursor-pointer",
|
|
57
|
+
"relative",
|
|
58
|
+
"w-full h-[166px] desktop:w-[340px] desktop:h-[190px]",
|
|
59
|
+
componentGap
|
|
68
60
|
),
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
),
|
|
80
|
-
!value && !isLoading && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
61
|
+
"data-testid": testid,
|
|
62
|
+
children: [
|
|
81
63
|
/* @__PURE__ */ jsx(
|
|
82
|
-
|
|
83
|
-
{
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
className: "
|
|
87
|
-
|
|
64
|
+
"input",
|
|
65
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
66
|
+
ref,
|
|
67
|
+
type: "file",
|
|
68
|
+
className: "sr-only",
|
|
69
|
+
"data-testid": testid ? `${testid}-file-input` : void 0
|
|
70
|
+
})
|
|
88
71
|
),
|
|
89
|
-
/* @__PURE__ */ jsx(
|
|
90
|
-
|
|
72
|
+
isLoading && /* @__PURE__ */ jsx(
|
|
73
|
+
Stack,
|
|
91
74
|
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
value && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
99
|
-
/* @__PURE__ */ jsx(
|
|
100
|
-
"img",
|
|
101
|
-
{
|
|
102
|
-
"data-testid": testid ? `${testid}-uploaded-image` : void 0,
|
|
103
|
-
src: value,
|
|
104
|
-
alt: "",
|
|
105
|
-
className: "absolute inset-0 object-contain object-center max-h-full max-w-full self-center justify-self-center"
|
|
75
|
+
centered: true,
|
|
76
|
+
items: "center",
|
|
77
|
+
justify: "center",
|
|
78
|
+
sizing: "container",
|
|
79
|
+
padding: true,
|
|
80
|
+
children: /* @__PURE__ */ jsx(Spinner, { size: "large" })
|
|
106
81
|
}
|
|
107
82
|
),
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
83
|
+
!value && !isLoading && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
84
|
+
/* @__PURE__ */ jsx(
|
|
85
|
+
Icon,
|
|
86
|
+
{
|
|
87
|
+
testid: testid ? `${testid}-icon` : void 0,
|
|
88
|
+
name: "cloud_upload",
|
|
89
|
+
className: "text-icon-primary-normal"
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ jsx(
|
|
93
|
+
Paragraph,
|
|
94
|
+
{
|
|
95
|
+
testid: testid ? `${testid}-text` : void 0,
|
|
96
|
+
color: errorText ? "text-primary-error" : "text-secondary-normal",
|
|
97
|
+
children: errorText ? errorText : text
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
] }),
|
|
101
|
+
value && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
102
|
+
/* @__PURE__ */ jsx(
|
|
103
|
+
"img",
|
|
104
|
+
{
|
|
105
|
+
"data-testid": testid ? `${testid}-uploaded-image` : void 0,
|
|
106
|
+
src: value,
|
|
107
|
+
alt: "",
|
|
108
|
+
className: "absolute inset-0 object-contain object-center max-h-full max-w-full self-center justify-self-center"
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ jsx("div", { className: "absolute right-2 top-2", children: /* @__PURE__ */ jsx(
|
|
112
|
+
Button,
|
|
113
|
+
{
|
|
114
|
+
testid: testid ? `${testid}-remove-image-button` : void 0,
|
|
115
|
+
onClick: (e) => {
|
|
116
|
+
e.preventDefault();
|
|
117
|
+
e.stopPropagation();
|
|
118
|
+
onRemove == null ? void 0 : onRemove();
|
|
119
|
+
},
|
|
120
|
+
iconOnly: true,
|
|
121
|
+
leftIcon: /* @__PURE__ */ jsx(Icon, { name: "delete" })
|
|
122
|
+
}
|
|
123
|
+
) })
|
|
124
|
+
] })
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
);
|
|
126
130
|
export {
|
|
127
131
|
Upload
|
|
128
132
|
};
|