@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.
@@ -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
- function Upload(props) {
706
- const _a = props, {
707
- isLoading,
708
- style,
709
- errorText,
710
- text = "Upload your file",
711
- value,
712
- onRemove,
713
- testid
714
- } = _a, rest = __objRest(_a, [
715
- "isLoading",
716
- "style",
717
- "errorText",
718
- "text",
719
- "value",
720
- "onRemove",
721
- "testid"
722
- ]);
723
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
724
- "label",
725
- {
726
- style: __spreadValues({}, style),
727
- className: (0, import_clsx6.default)(
728
- "border border-dashed border-border-primary-normal",
729
- "flex flex-col items-center justify-center",
730
- "p-6",
731
- "cursor-pointer",
732
- "relative",
733
- "w-full h-[166px] desktop:w-[340px] desktop:h-[190px]",
734
- componentGap
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
- !value && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
738
+ "data-testid": testid,
739
+ children: [
758
740
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
759
- Icon,
760
- {
761
- testid: testid ? `${testid}-icon` : void 0,
762
- name: "cloud_upload",
763
- className: "text-icon-primary-normal"
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
- Paragraph,
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
- "data-testid": testid ? `${testid}-uploaded-image` : void 0,
780
- src: value,
781
- alt: "",
782
- className: "absolute inset-0 object-contain object-center max-h-full max-w-full self-center justify-self-center"
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.jsx)("div", { className: "absolute right-2 top-2", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
786
- Button,
787
- {
788
- testid: testid ? `${testid}-remove-image-button` : void 0,
789
- onClick: (e) => {
790
- e.preventDefault();
791
- e.stopPropagation();
792
- onRemove == null ? void 0 : onRemove();
793
- },
794
- iconOnly: true,
795
- leftIcon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "delete" })
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
- function Upload(props) {
29
- const _a = props, {
30
- isLoading,
31
- style,
32
- errorText,
33
- text = "Upload your file",
34
- value,
35
- onRemove,
36
- testid
37
- } = _a, rest = __objRest(_a, [
38
- "isLoading",
39
- "style",
40
- "errorText",
41
- "text",
42
- "value",
43
- "onRemove",
44
- "testid"
45
- ]);
46
- return /* @__PURE__ */ jsxs(
47
- "label",
48
- {
49
- style: __spreadValues({}, style),
50
- className: clsx(
51
- "border border-dashed border-border-primary-normal",
52
- "flex flex-col items-center justify-center",
53
- "p-6",
54
- "cursor-pointer",
55
- "relative",
56
- "w-full h-[166px] desktop:w-[340px] desktop:h-[190px]",
57
- componentGap
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
- 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
- ),
80
- !value && !isLoading && /* @__PURE__ */ jsxs(Fragment, { children: [
61
+ "data-testid": testid,
62
+ children: [
81
63
  /* @__PURE__ */ jsx(
82
- Icon,
83
- {
84
- testid: testid ? `${testid}-icon` : void 0,
85
- name: "cloud_upload",
86
- className: "text-icon-primary-normal"
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
- Paragraph,
72
+ isLoading && /* @__PURE__ */ jsx(
73
+ Stack,
91
74
  {
92
- testid: testid ? `${testid}-text` : void 0,
93
- color: errorText ? "text-primary-error" : "text-secondary-normal",
94
- children: errorText ? errorText : text
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__ */ jsx("div", { className: "absolute right-2 top-2", children: /* @__PURE__ */ jsx(
109
- Button,
110
- {
111
- testid: testid ? `${testid}-remove-image-button` : void 0,
112
- onClick: (e) => {
113
- e.preventDefault();
114
- e.stopPropagation();
115
- onRemove == null ? void 0 : onRemove();
116
- },
117
- iconOnly: true,
118
- leftIcon: /* @__PURE__ */ jsx(Icon, { name: "delete" })
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
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dmsi/wedgekit-react",
3
3
  "private": false,
4
- "version": "0.0.690",
4
+ "version": "0.0.692",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsup",