@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.
Files changed (33) hide show
  1. package/dist/{chunk-2RUQFWER.js → chunk-2VRZB2A4.js} +1 -1
  2. package/dist/{chunk-7W4I2NK3.js → chunk-5JVMULVC.js} +12 -2
  3. package/dist/{chunk-2WRRRPEB.js → chunk-7BBXPM5C.js} +1 -1
  4. package/dist/{chunk-XOUEHNCC.js → chunk-Q7ETEWBW.js} +1 -1
  5. package/dist/components/DataGridCell.cjs +12 -2
  6. package/dist/components/DataGridCell.js +3 -3
  7. package/dist/components/DateInput.cjs +14 -3
  8. package/dist/components/DateInput.js +3 -2
  9. package/dist/components/DateRangeInput.cjs +14 -3
  10. package/dist/components/DateRangeInput.js +3 -2
  11. package/dist/components/FilterGroup.cjs +12 -2
  12. package/dist/components/FilterGroup.js +2 -2
  13. package/dist/components/Input.cjs +12 -2
  14. package/dist/components/Input.js +1 -1
  15. package/dist/components/Password.cjs +12 -2
  16. package/dist/components/Password.js +1 -1
  17. package/dist/components/Search.cjs +12 -2
  18. package/dist/components/Search.js +2 -2
  19. package/dist/components/Select.cjs +12 -2
  20. package/dist/components/Select.js +2 -2
  21. package/dist/components/Stepper.cjs +12 -2
  22. package/dist/components/Stepper.js +1 -1
  23. package/dist/components/Time.cjs +12 -2
  24. package/dist/components/Time.js +1 -1
  25. package/dist/components/Upload.cjs +317 -16
  26. package/dist/components/Upload.js +33 -6
  27. package/dist/components/index.cjs +12 -2
  28. package/dist/components/index.js +4 -4
  29. package/package.json +1 -1
  30. package/src/components/DateInput.tsx +1 -0
  31. package/src/components/DateRangeInput.tsx +1 -0
  32. package/src/components/Input.tsx +19 -5
  33. 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
- 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
+ }