@react-magma/dropzone 1.0.0 → 1.0.1

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.
@@ -24,55 +24,55 @@ const icons = {
24
24
  default: {
25
25
  Icon: InsertDriveFileIcon,
26
26
  style: {
27
- color: '#707070',
27
+ color: magma.colors.neutral500,
28
28
  },
29
29
  },
30
30
  word: {
31
31
  Icon: FileWordIcon,
32
32
  style: {
33
- color: '#006298',
33
+ color: magma.colors.info500,
34
34
  },
35
35
  },
36
36
  excel: {
37
37
  Icon: FileExcelIcon,
38
38
  style: {
39
- color: '#3A8200',
39
+ color: magma.colors.success500,
40
40
  },
41
41
  },
42
42
  powerpoint: {
43
43
  Icon: FilePowerpointIcon,
44
44
  style: {
45
- color: '#FC4C02',
45
+ color: magma.colors.warning500,
46
46
  },
47
47
  },
48
48
  pdf: {
49
49
  Icon: FilePdfIcon,
50
50
  style: {
51
- color: '#C61D23',
51
+ color: magma.colors.danger500,
52
52
  },
53
53
  },
54
54
  image: {
55
55
  Icon: ImageIcon,
56
56
  style: {
57
- color: '#707070',
57
+ color: magma.colors.neutral500,
58
58
  },
59
59
  },
60
60
  video: {
61
61
  Icon: VideocamIcon,
62
62
  style: {
63
- color: '#707070',
63
+ color: magma.colors.neutral500,
64
64
  },
65
65
  },
66
66
  audio: {
67
67
  Icon: AudiotrackIcon,
68
68
  style: {
69
- color: '#707070',
69
+ color: magma.colors.neutral500,
70
70
  },
71
71
  },
72
72
  archive: {
73
73
  Icon: FileZipIcon,
74
74
  style: {
75
- color: '#707070',
75
+ color: magma.colors.neutral500,
76
76
  },
77
77
  },
78
78
  };
@@ -1,9 +1,4 @@
1
- import React, {
2
- forwardRef,
3
- useContext,
4
- useEffect,
5
- useState,
6
- } from 'react';
1
+ import React, { forwardRef, useContext, useEffect, useState } from 'react';
7
2
 
8
3
  import {
9
4
  CheckCircleIcon,
@@ -44,6 +39,9 @@ export interface PreviewProps extends Omit<FlexProps, 'behavior'> {
44
39
  minSize?: number;
45
40
  onDeleteFile?: (file: FilePreview) => void;
46
41
  onRemoveFile?: (file: FilePreview) => void;
42
+ /**
43
+ * @internal
44
+ */
47
45
  testId?: string;
48
46
  thumbnails: boolean;
49
47
  }
@@ -78,7 +76,7 @@ const IconStyles = {
78
76
  };
79
77
 
80
78
  const Errors = styled.div`
81
- border-top: 1px solid ${({ theme }) => theme.colors.neutral06};
79
+ border-top: 1px solid ${({ theme }) => theme.colors.neutral300};
82
80
  padding: 16px;
83
81
  font-size: ${({ theme }) => theme.typeScale.size02.fontSize};
84
82
  line-height: ${({ theme }) => theme.typeScale.size02.lineHeight};
@@ -103,15 +101,14 @@ const FileName = styled(Flex)`
103
101
  `;
104
102
 
105
103
  const StyledCard = styled(Card)<{ file: FilePreview; isInverse: boolean }>`
106
- background-color: ${({ isInverse, theme }) =>
107
- isInverse ? theme.colors.foundation02 : theme.colors.neutral08};
104
+ background-color: none;
108
105
  border-color: ${({ file, theme, isInverse }) =>
109
106
  file.errors
110
107
  ? isInverse
111
- ? theme.colors.dangerInverse
108
+ ? theme.colors.danger200
112
109
  : theme.colors.danger
113
- : theme.colors.neutral06};
114
- border-width: ${({ file }) => (file.errors ? '2px' : '1px')};
110
+ : theme.colors.neutral300};
111
+ border-width: 1px;
115
112
  margin: 10px 0;
116
113
  `;
117
114
 
@@ -149,12 +146,20 @@ const formatError = (
149
146
  case 'file-too-large':
150
147
  return {
151
148
  ...error,
152
- message: `${error.message} ${formatFileSize(constraints.maxSize, 2, byteLabel)}.`,
149
+ message: `${error.message} ${formatFileSize(
150
+ constraints.maxSize,
151
+ 2,
152
+ byteLabel
153
+ )}.`,
153
154
  };
154
155
  case 'file-too-small':
155
156
  return {
156
157
  ...error,
157
- message: `${error.message} ${formatFileSize(constraints.minSize, 2, byteLabel)}.`,
158
+ message: `${error.message} ${formatFileSize(
159
+ constraints.minSize,
160
+ 2,
161
+ byteLabel
162
+ )}.`,
158
163
  };
159
164
  case 'file-invalid-type':
160
165
  return { ...error, message: `${error.message}: ${messageSuffix}` };
@@ -197,7 +202,7 @@ export const Preview = forwardRef<HTMLDivElement, PreviewProps>(
197
202
  useEffect(() => {
198
203
  let mounted = true;
199
204
  setTimeout(() => {
200
- if(mounted) {
205
+ if (mounted) {
201
206
  setDone(true);
202
207
  }
203
208
  }, 1000);
@@ -224,9 +229,7 @@ export const Preview = forwardRef<HTMLDivElement, PreviewProps>(
224
229
  return (
225
230
  <StatusIcons>
226
231
  <Spinner
227
- color={
228
- isInverse ? theme.colors.foundation04 : theme.colors.primary
229
- }
232
+ color={isInverse ? theme.colors.neutral100 : theme.colors.primary}
230
233
  />
231
234
  </StatusIcons>
232
235
  );
@@ -236,9 +239,7 @@ export const Preview = forwardRef<HTMLDivElement, PreviewProps>(
236
239
  <StatusIcons>
237
240
  <Transition isOpen={!done} unmountOnExit fade>
238
241
  <CheckCircleIcon
239
- color={
240
- isInverse ? theme.colors.successInverse : theme.colors.success
241
- }
242
+ color={isInverse ? theme.colors.success200 : theme.colors.success}
242
243
  style={{ marginTop: '4px' }}
243
244
  />
244
245
  </Transition>
@@ -283,7 +284,7 @@ export const Preview = forwardRef<HTMLDivElement, PreviewProps>(
283
284
  {file.errors ? (
284
285
  <ErrorIcon
285
286
  color={
286
- isInverse ? theme.colors.dangerInverse : theme.colors.danger
287
+ isInverse ? theme.colors.danger200 : theme.colors.danger
287
288
  }
288
289
  size={24}
289
290
  />
@@ -299,9 +300,15 @@ export const Preview = forwardRef<HTMLDivElement, PreviewProps>(
299
300
  <FileName xs behavior={FlexBehavior.item} theme={theme}>
300
301
  {file.name}
301
302
  </FileName>
302
- {file.processor && file.processor.status === 'pending' && <Flex role="progressbar" style={{ marginLeft: 'auto' }} behavior={FlexBehavior.item}>
303
- {file.processor.percent}
304
- </Flex>}
303
+ {file.processor && file.processor.status === 'pending' && (
304
+ <Flex
305
+ role="progressbar"
306
+ style={{ marginLeft: 'auto' }}
307
+ behavior={FlexBehavior.item}
308
+ >
309
+ {file.processor.percent}
310
+ </Flex>
311
+ )}
305
312
  <Flex behavior={FlexBehavior.item}>{actions}</Flex>
306
313
  </StyledFlex>
307
314
  {file.errors && (
@@ -317,7 +324,7 @@ export const Preview = forwardRef<HTMLDivElement, PreviewProps>(
317
324
  <ErrorHeader
318
325
  style={{
319
326
  color: isInverse
320
- ? theme.colors.dangerInverse
327
+ ? theme.colors.danger200
321
328
  : theme.colors.danger,
322
329
  }}
323
330
  >