@dmsi/wedgekit-react 0.0.229 → 0.0.231
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/{chunk-2RUQFWER.js → chunk-2VRZB2A4.js} +1 -1
- package/dist/{chunk-7W4I2NK3.js → chunk-5JVMULVC.js} +12 -2
- package/dist/{chunk-2WRRRPEB.js → chunk-7BBXPM5C.js} +1 -1
- package/dist/{chunk-XOUEHNCC.js → chunk-Q7ETEWBW.js} +1 -1
- package/dist/components/DataGridCell.cjs +12 -2
- package/dist/components/DataGridCell.js +3 -3
- package/dist/components/DateInput.cjs +14 -3
- package/dist/components/DateInput.js +3 -2
- package/dist/components/DateRangeInput.cjs +14 -3
- package/dist/components/DateRangeInput.js +3 -2
- package/dist/components/FilterGroup.cjs +12 -2
- package/dist/components/FilterGroup.js +2 -2
- package/dist/components/Input.cjs +12 -2
- package/dist/components/Input.js +1 -1
- package/dist/components/Password.cjs +12 -2
- package/dist/components/Password.js +1 -1
- package/dist/components/Search.cjs +12 -2
- package/dist/components/Search.js +2 -2
- package/dist/components/Select.cjs +12 -2
- package/dist/components/Select.js +2 -2
- package/dist/components/Stepper.cjs +12 -2
- package/dist/components/Stepper.js +1 -1
- package/dist/components/Time.cjs +12 -2
- package/dist/components/Time.js +1 -1
- package/dist/components/Upload.cjs +317 -16
- package/dist/components/Upload.js +33 -6
- package/dist/components/index.cjs +12 -2
- package/dist/components/index.js +4 -4
- package/package.json +1 -1
- package/src/components/DateInput.tsx +1 -0
- package/src/components/DateRangeInput.tsx +1 -0
- package/src/components/Input.tsx +19 -5
- package/src/components/Upload.tsx +90 -74
|
@@ -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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
className="sr-only"
|
|
48
|
-
data-testid={testid ? `${testid}-file-input` : undefined}
|
|
49
|
-
/>
|
|
61
|
+
<Spinner size="large" />
|
|
62
|
+
</Stack>
|
|
63
|
+
)}
|
|
50
64
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
97
|
+
onRemove?.();
|
|
98
|
+
}}
|
|
99
|
+
iconOnly
|
|
100
|
+
leftIcon={<Icon name="delete" />}
|
|
101
|
+
/>
|
|
102
|
+
</div>
|
|
103
|
+
</>
|
|
104
|
+
)}
|
|
105
|
+
</label>
|
|
106
|
+
);
|
|
107
|
+
}
|