@react-magma/dropzone 16.0.0-next.0 → 16.0.0

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.
@@ -1,12 +1,21 @@
1
1
  import React from 'react';
2
2
 
3
- import { cleanup, render, fireEvent, waitFor } from '@testing-library/react';
3
+ import {
4
+ cleanup,
5
+ render,
6
+ fireEvent,
7
+ waitFor,
8
+ within,
9
+ } from '@testing-library/react';
4
10
  import userEvent from '@testing-library/user-event';
11
+ import { transparentize } from 'polished';
5
12
  import { I18nContext, defaultI18n, magma } from 'react-magma-dom';
6
13
 
7
14
  import { axe } from '../../../axe-helper.js';
8
15
 
9
16
  import { Dropzone } from '.';
17
+ import { FileIcon } from './FileIcon';
18
+ import { Preview } from './Preview';
10
19
 
11
20
  describe('File Uploader', () => {
12
21
  let files;
@@ -113,6 +122,212 @@ describe('File Uploader', () => {
113
122
  expect(input).toHaveAttribute('multiple');
114
123
  });
115
124
 
125
+ it('uses the regular rebrand colors', () => {
126
+ const helperMessage = 'Upload a supported file.';
127
+ const labelText = 'Upload files';
128
+ const { container, getByTestId, getByText } = render(
129
+ <Dropzone
130
+ helperMessage={helperMessage}
131
+ labelText={labelText}
132
+ testId="testId"
133
+ />
134
+ );
135
+
136
+ expect(getByTestId('testId')).toHaveStyle({
137
+ backgroundColor: magma.colors.neutral100,
138
+ border: `2px dashed ${magma.colors.neutral300}`,
139
+ borderRadius: magma.borderRadiusSmall,
140
+ });
141
+ expect(
142
+ within(container).getByText(defaultI18n.dropzone.dragMessage)
143
+ ).toHaveStyle({
144
+ color: magma.colors.brand.navy,
145
+ });
146
+ expect(within(container).getByText(helperMessage)).toHaveStyle({
147
+ color: magma.colors.neutral700,
148
+ });
149
+ expect(within(container).getByText(labelText)).toHaveStyle({
150
+ color: magma.colors.brand.navy,
151
+ });
152
+ expect(container.querySelector('svg[aria-hidden="true"]')).toHaveAttribute(
153
+ 'fill',
154
+ magma.colors.neutral700
155
+ );
156
+ });
157
+
158
+ it('uses the inverse rebrand colors', () => {
159
+ const helperMessage = 'Upload a supported file.';
160
+ const { getByTestId, getByText } = render(
161
+ <Dropzone helperMessage={helperMessage} isInverse testId="testId" />
162
+ );
163
+
164
+ expect(getByTestId('testId')).toHaveStyle({
165
+ backgroundColor: transparentize(0.6, magma.colors.neutral1200),
166
+ border: `2px dashed ${magma.colors.neutral800}`,
167
+ });
168
+ expect(getByText(helperMessage)).toHaveStyle({
169
+ color: magma.colors.neutral500,
170
+ });
171
+ });
172
+
173
+ it('uses the rebrand colors for default file icons', () => {
174
+ const file = createFile('file.bin', 1111, 'application/octet-stream');
175
+ const { container, rerender } = render(<FileIcon file={file} />);
176
+
177
+ expect(container.querySelector('svg')).toHaveStyle({
178
+ color: magma.colors.neutral700,
179
+ });
180
+
181
+ rerender(<FileIcon file={file} isInverse />);
182
+
183
+ expect(container.querySelector('svg')).toHaveStyle({
184
+ color: magma.colors.neutral300,
185
+ });
186
+ });
187
+
188
+ it.each([
189
+ ['word', 'docx', 'application/msword', 'blue500', 'blue500'],
190
+ ['excel', 'xlsx', 'application/vnd.ms-excel', 'green500', 'green500'],
191
+ [
192
+ 'powerpoint',
193
+ 'pptx',
194
+ 'application/vnd.ms-powerpoint',
195
+ 'tangerine600',
196
+ 'tangerine500',
197
+ ],
198
+ ['pdf', 'pdf', 'application/pdf', 'red600', 'red500'],
199
+ ['image', 'png', 'image/png', 'neutral700', 'neutral300'],
200
+ ['video', 'mp4', 'video/mp4', 'neutral700', 'neutral300'],
201
+ ['audio', 'mp3', 'audio/mpeg', 'neutral700', 'neutral300'],
202
+ ['archive', 'zip', 'application/zip', 'neutral700', 'neutral300'],
203
+ ])(
204
+ 'uses the rebrand colors for %s file icons',
205
+ (_name, extension, type, regularColor, inverseColor) => {
206
+ const file = createFile(`file.${extension}`, 1111, type);
207
+ Object.defineProperty(file, 'path', {
208
+ value: `file.${extension}`,
209
+ });
210
+ const { container, rerender } = render(<FileIcon file={file} />);
211
+
212
+ expect(container.querySelector('svg')).toHaveStyle({
213
+ color: magma.colors[regularColor],
214
+ });
215
+
216
+ rerender(<FileIcon file={file} isInverse />);
217
+
218
+ expect(container.querySelector('svg')).toHaveStyle({
219
+ color: magma.colors[inverseColor],
220
+ });
221
+ }
222
+ );
223
+
224
+ it('uses brand navy for regular preview text', () => {
225
+ const { getByText } = render(
226
+ <Preview
227
+ file={files[0]}
228
+ isInverse={false}
229
+ testId="preview"
230
+ thumbnails={false}
231
+ />
232
+ );
233
+
234
+ const previewCard = getByText(files[0].name).parentElement.parentElement;
235
+
236
+ expect(previewCard).toHaveStyle({
237
+ borderColor: magma.colors.neutral200,
238
+ borderRadius: magma.borderRadiusSmall,
239
+ color: magma.colors.brand.navy,
240
+ });
241
+ });
242
+
243
+ it('uses the inverse rebrand colors for the default preview', () => {
244
+ const { getByText } = render(
245
+ <Preview file={files[0]} isInverse thumbnails={false} />
246
+ );
247
+
248
+ const previewCard = getByText(files[0].name).parentElement.parentElement;
249
+
250
+ expect(previewCard).toHaveStyle({
251
+ borderColor: magma.colors.neutral800,
252
+ });
253
+ });
254
+
255
+ it('uses the inverse rebrand colors for pending and successful previews', async () => {
256
+ const pendingFile = files[0];
257
+ pendingFile.processor = { status: 'pending', percent: '25%' };
258
+
259
+ const { container, getByLabelText, rerender } = render(
260
+ <Preview file={pendingFile} isInverse thumbnails={false} />
261
+ );
262
+
263
+ await waitFor(() => {
264
+ expect(getByLabelText('Loading')).toHaveAttribute(
265
+ 'color',
266
+ magma.colors.brand.skyBlue
267
+ );
268
+ });
269
+
270
+ const successfulFile = createFile(
271
+ 'successful-file.pdf',
272
+ 1111,
273
+ 'application/pdf'
274
+ );
275
+ successfulFile.processor = { status: 'success', percent: '100%' };
276
+
277
+ rerender(<Preview file={successfulFile} isInverse thumbnails={false} />);
278
+
279
+ await waitFor(() => {
280
+ expect(
281
+ container.querySelector(`svg[fill="${magma.colors.green500}"]`)
282
+ ).toBeInTheDocument();
283
+ });
284
+ });
285
+
286
+ it('uses the inverse rebrand colors for preview errors', () => {
287
+ const errorFile = files[0];
288
+ errorFile.errors = [
289
+ {
290
+ code: 'file-invalid-type',
291
+ message: 'Invalid file type',
292
+ },
293
+ ];
294
+
295
+ const { container, getByText } = render(
296
+ <Preview
297
+ accept="application/pdf"
298
+ file={errorFile}
299
+ isInverse
300
+ thumbnails={false}
301
+ />
302
+ );
303
+
304
+ const previewCard = getByText(errorFile.name).parentElement.parentElement;
305
+
306
+ expect(previewCard).toHaveStyle({
307
+ borderColor: magma.colors.red500,
308
+ });
309
+ expect(
310
+ container.querySelector(`svg[fill="${magma.colors.red500}"]`)
311
+ ).toBeInTheDocument();
312
+
313
+ const errorHeading = getByText('Invalid File Type');
314
+ expect(errorHeading).toHaveStyle({ color: magma.colors.red500 });
315
+ expect(errorHeading.parentElement).toHaveStyle({
316
+ borderTopColor: magma.colors.neutral500,
317
+ });
318
+ });
319
+
320
+ it('uses a subtle link IconButton for preview actions', () => {
321
+ const { getByLabelText } = render(
322
+ <Preview file={files[0]} isInverse={false} thumbnails={false} />
323
+ );
324
+
325
+ expect(getByLabelText(`Remove file ${files[0].name}`)).toHaveAttribute(
326
+ 'color',
327
+ 'subtle'
328
+ );
329
+ });
330
+
116
331
  it('allows adding files via drop', () => {
117
332
  const { container } = render(<Dropzone />);
118
333
 
@@ -136,7 +351,7 @@ describe('File Uploader', () => {
136
351
  const dropzone = getByTestId(testId);
137
352
 
138
353
  expect(dropzone).toHaveStyle(
139
- `border: 1px dashed ${magma.colors.neutral400}`
354
+ `border: 2px dashed ${magma.colors.neutral300}`
140
355
  );
141
356
 
142
357
  fireDragEnter(dropzone, data);
@@ -145,7 +360,7 @@ describe('File Uploader', () => {
145
360
 
146
361
  await waitFor(() => {
147
362
  expect(dropzone).toHaveStyle(
148
- `border: 1px dashed ${magma.colors.success}`
363
+ `border: 2px dashed ${magma.colors.green500}`
149
364
  );
150
365
  });
151
366
  });
@@ -160,7 +375,7 @@ describe('File Uploader', () => {
160
375
 
161
376
  const dropzone = getByTestId(testId);
162
377
  expect(dropzone).toHaveStyle(
163
- `border: 1px dashed ${magma.colors.neutral400}`
378
+ `border: 2px dashed ${magma.colors.neutral300}`
164
379
  );
165
380
 
166
381
  fireDragEnter(dropzone, data);
@@ -168,7 +383,35 @@ describe('File Uploader', () => {
168
383
  rerender(ui);
169
384
 
170
385
  await waitFor(() => {
171
- expect(dropzone).toHaveStyle(`border: 1px dashed ${magma.colors.danger}`);
386
+ expect(dropzone).toHaveStyle(`border: 2px dashed ${magma.colors.danger}`);
387
+ });
388
+ });
389
+
390
+ it('uses red400 for inverse rejection borders', async () => {
391
+ const data = createDtWithFiles(files);
392
+ const testId = 'testId';
393
+ const ui = <Dropzone accept="image/*" isInverse testId={testId} />;
394
+ const { getByTestId, rerender } = render(ui);
395
+ const dropzone = getByTestId(testId);
396
+
397
+ fireDragEnter(dropzone, data);
398
+ rerender(ui);
399
+
400
+ await waitFor(() => {
401
+ expect(dropzone).toHaveStyle(`border: 2px dashed ${magma.colors.red400}`);
402
+ });
403
+ });
404
+
405
+ it('uses red500 for inverse error borders', async () => {
406
+ const { getByTestId } = render(
407
+ <Dropzone isInverse minFiles={1} testId="testId" />
408
+ );
409
+
410
+ await waitFor(() => {
411
+ expect(getByTestId('testId')).toHaveStyle({
412
+ borderColor: magma.colors.red500,
413
+ borderWidth: '1px',
414
+ });
172
415
  });
173
416
  });
174
417
 
@@ -46,12 +46,13 @@ export interface OnSendFileProps {
46
46
  onProgress?: ({}: { percent: number; file: FilePreview }) => void;
47
47
  }
48
48
 
49
- type DragState =
50
- | 'error'
51
- | 'dragAccept'
52
- | 'dragReject'
53
- | 'dragActive'
54
- | 'default';
49
+ enum DragState {
50
+ error = 'error',
51
+ dragAccept = 'dragAccept',
52
+ dragReject = 'dragReject',
53
+ dragActive = 'dragActive',
54
+ default = 'default',
55
+ }
55
56
 
56
57
  // NOTE: These props are manually copied to dropzone.mdx
57
58
  export interface DropzoneProps
@@ -146,35 +147,44 @@ const Container = styled(Flex)<
146
147
  justify-content: ${({ noDrag }) => (noDrag ? 'left' : 'center')};
147
148
  text-align: ${({ noDrag }) => (noDrag ? 'left' : 'center')};
148
149
  padding: ${({ noDrag }) => (noDrag ? '0px' : '24px')};
149
- border-radius: ${({ noDrag }) => (noDrag ? '0px' : '4px')};
150
- border: ${({ dragState = 'default', noDrag, theme, isInverse }) =>
150
+ border-radius: ${({ noDrag, theme }) =>
151
+ noDrag ? theme.borderRadiusNone : theme.borderRadiusSmall};
152
+ border: ${({ dragState = DragState.default, noDrag, theme, isInverse }) =>
151
153
  noDrag
152
154
  ? `0px`
153
- : dragState === 'dragReject' || dragState === 'error'
155
+ : dragState === DragState.dragReject || dragState === DragState.error
154
156
  ? isInverse
155
- ? `1px dashed ${theme.colors.danger300}`
156
- : `1px dashed ${theme.colors.danger}`
157
- : dragState === 'dragActive'
158
- ? `1px dashed ${theme.colors.primary}`
159
- : dragState === 'dragAccept'
160
- ? `1px dashed ${theme.colors.success}`
161
- : `1px dashed ${theme.colors.neutral400}`};
162
-
163
- border-style: ${({ dragState = 'default' }) =>
164
- dragState === 'error' ? 'solid' : 'dashed'};
157
+ ? `${dragState === DragState.error ? '1px' : '2px'} dashed ${
158
+ dragState === DragState.error
159
+ ? theme.colors.red500
160
+ : theme.colors.red400
161
+ }`
162
+ : `${dragState === DragState.error ? '1px' : '2px'} dashed ${
163
+ theme.colors.danger
164
+ }`
165
+ : dragState === DragState.dragActive
166
+ ? `2px dashed ${theme.colors.blue500}`
167
+ : dragState === DragState.dragAccept
168
+ ? `2px dashed ${theme.colors.green500}`
169
+ : `2px dashed ${
170
+ isInverse ? theme.colors.neutral800 : theme.colors.neutral300
171
+ }`};
172
+
173
+ border-style: ${({ dragState = DragState.default }) =>
174
+ dragState === DragState.error ? 'solid' : 'dashed'};
165
175
  background-color: ${({ theme, noDrag, isInverse }) =>
166
176
  noDrag
167
177
  ? 'transparent'
168
178
  : isInverse
169
- ? transparentize(0.75, theme.colors.neutral900)
170
- : theme.colors.neutral200};
179
+ ? transparentize(0.6, theme.colors.neutral1200)
180
+ : theme.colors.neutral100};
171
181
  outline: none;
172
182
  transition: ${({ noDrag }) => `border ${noDrag ? 0 : '.24s'} ease-in-out`};
173
183
  `;
174
184
 
175
185
  const HelperMessage = styled.span<{ isInverse?: boolean }>`
176
186
  color: ${({ theme, isInverse }) =>
177
- isInverse ? theme.colors.neutral100 : theme.colors.neutral700};
187
+ isInverse ? theme.colors.neutral500 : theme.colors.neutral700};
178
188
  display: block;
179
189
  font-size: 14px;
180
190
  margin: -8px 0 16px 0;
@@ -182,7 +192,7 @@ const HelperMessage = styled.span<{ isInverse?: boolean }>`
182
192
 
183
193
  const Wrapper = styled.div<{ isInverse?: boolean }>`
184
194
  color: ${({ theme, isInverse }) =>
185
- isInverse ? theme.colors.neutral100 : theme.colors.neutral700};
195
+ isInverse ? theme.colors.neutral0 : theme.colors.brand.navy};
186
196
  margin: 0 0 24px 0;
187
197
  font-size: ${({ theme }) => theme.typeScale.size02.fontSize};
188
198
  line-height: ${({ theme }) => theme.typeScale.size02.lineHeight};
@@ -303,16 +313,16 @@ export const Dropzone = React.forwardRef<HTMLInputElement, DropzoneProps>(
303
313
 
304
314
  const inputProps = getInputProps({ id });
305
315
 
306
- let dragState: DragState = 'default';
316
+ let dragState = DragState.default;
307
317
 
308
318
  if (errorMessage) {
309
- dragState = 'error';
319
+ dragState = DragState.error;
310
320
  } else if (isDragAccept) {
311
- dragState = 'dragAccept';
321
+ dragState = DragState.dragAccept;
312
322
  } else if (isDragReject) {
313
- dragState = 'dragReject';
323
+ dragState = DragState.dragReject;
314
324
  } else if (isDragActive) {
315
- dragState = 'dragActive';
325
+ dragState = DragState.dragActive;
316
326
  }
317
327
 
318
328
  const handleRemoveFile = (removedFile: FilePreview) => {
@@ -493,7 +503,10 @@ export const Dropzone = React.forwardRef<HTMLInputElement, DropzoneProps>(
493
503
  inputSize={inputSize}
494
504
  isInverse={isInverse}
495
505
  isLabelVisuallyHidden={isLabelVisuallyHidden}
496
- labelStyle={labelStyle}
506
+ labelStyle={{
507
+ color: isInverse ? theme.colors.neutral0 : theme.colors.brand.navy,
508
+ ...labelStyle,
509
+ }}
497
510
  labelText={labelText}
498
511
  messageStyle={{ minHeight: 0 }}
499
512
  data-testid={testId}
@@ -548,9 +561,7 @@ export const Dropzone = React.forwardRef<HTMLInputElement, DropzoneProps>(
548
561
  <CloudUploadIcon
549
562
  aria-hidden="true"
550
563
  color={
551
- isInverse
552
- ? theme.colors.neutral100
553
- : theme.colors.neutral500
564
+ isInverse ? theme.colors.neutral0 : theme.colors.neutral700
554
565
  }
555
566
  size={48}
556
567
  />
@@ -25,61 +25,92 @@ const icons = {
25
25
  default: {
26
26
  Icon: InsertDriveFileIcon,
27
27
  style: {
28
- color: magma.colors.neutral500,
28
+ color: magma.colors.neutral700,
29
+ },
30
+ inverseStyle: {
31
+ color: magma.colors.neutral300,
29
32
  },
30
33
  },
31
34
  word: {
32
35
  Icon: FileWordIcon,
33
36
  style: {
34
- color: magma.colors.info500,
37
+ color: magma.colors.blue500,
38
+ },
39
+ inverseStyle: {
40
+ color: magma.colors.blue500,
35
41
  },
36
42
  },
37
43
  excel: {
38
44
  Icon: FileExcelIcon,
39
45
  style: {
40
- color: magma.colors.success500,
46
+ color: magma.colors.green500,
47
+ },
48
+ inverseStyle: {
49
+ color: magma.colors.green500,
41
50
  },
42
51
  },
43
52
  powerpoint: {
44
53
  Icon: FilePowerpointIcon,
45
54
  style: {
46
- color: magma.colors.warning500,
55
+ color: magma.colors.tangerine600,
56
+ },
57
+ inverseStyle: {
58
+ color: magma.colors.tangerine500,
47
59
  },
48
60
  },
49
61
  pdf: {
50
62
  Icon: FilePdfIcon,
51
63
  style: {
52
- color: magma.colors.danger500,
64
+ color: magma.colors.red600,
65
+ },
66
+ inverseStyle: {
67
+ color: magma.colors.red500,
53
68
  },
54
69
  },
55
70
  image: {
56
71
  Icon: ImageIcon,
57
72
  style: {
58
- color: magma.colors.neutral500,
73
+ color: magma.colors.neutral700,
74
+ },
75
+ inverseStyle: {
76
+ color: magma.colors.neutral300,
59
77
  },
60
78
  },
61
79
  video: {
62
80
  Icon: VideocamIcon,
63
81
  style: {
64
- color: magma.colors.neutral500,
82
+ color: magma.colors.neutral700,
83
+ },
84
+ inverseStyle: {
85
+ color: magma.colors.neutral300,
65
86
  },
66
87
  },
67
88
  audio: {
68
89
  Icon: AudiotrackIcon,
69
90
  style: {
70
- color: magma.colors.neutral500,
91
+ color: magma.colors.neutral700,
92
+ },
93
+ inverseStyle: {
94
+ color: magma.colors.neutral300,
71
95
  },
72
96
  },
73
97
  archive: {
74
98
  Icon: FileZipIcon,
75
99
  style: {
76
- color: magma.colors.neutral500,
100
+ color: magma.colors.neutral700,
101
+ },
102
+ inverseStyle: {
103
+ color: magma.colors.neutral300,
77
104
  },
78
105
  },
79
106
  };
80
107
 
81
108
  const iconMapping: {
82
- [key: string]: { Icon: any; style: React.CSSProperties };
109
+ [key: string]: {
110
+ Icon: any;
111
+ style: React.CSSProperties;
112
+ inverseStyle: React.CSSProperties;
113
+ };
83
114
  } = {
84
115
  default: icons.default,
85
116
  xlsx: icons.excel,
@@ -110,8 +141,13 @@ export const FileIcon = ({ file, isInverse }: FileIconProps) => {
110
141
  const { path = '', type = '' } = file;
111
142
  const category = type.split('/')[0];
112
143
  const extension = path.split('.').pop() || 'default';
113
- const { Icon, style } =
144
+ const { Icon, style, inverseStyle } =
114
145
  iconMapping[extension] || iconMapping[category] || iconMapping.default;
115
146
 
116
- return <Icon size={magma.iconSizes.medium} style={isInverse ? {} : style} />;
147
+ return (
148
+ <Icon
149
+ size={magma.iconSizes.medium}
150
+ style={isInverse ? inverseStyle : style}
151
+ />
152
+ );
117
153
  };
@@ -4,6 +4,8 @@ import {
4
4
  ButtonColor,
5
5
  ButtonVariant,
6
6
  Card,
7
+ CardBorderRadius,
8
+ CardCornerTreatment,
7
9
  Flex,
8
10
  FlexAlignItems,
9
11
  FlexBehavior,
@@ -74,8 +76,10 @@ const IconStyles = {
74
76
  display: 'flex',
75
77
  };
76
78
 
77
- const Errors = styled.div`
78
- border-top: 1px solid ${({ theme }) => theme.colors.neutral300};
79
+ const Errors = styled.div<{ isInverse: boolean }>`
80
+ border-top: 1px solid
81
+ ${({ theme, isInverse }) =>
82
+ isInverse ? theme.colors.neutral500 : theme.colors.neutral300};
79
83
  padding: 16px;
80
84
  font-size: ${({ theme }) => theme.typeScale.size02.fontSize};
81
85
  line-height: ${({ theme }) => theme.typeScale.size02.lineHeight};
@@ -104,10 +108,18 @@ const StyledCard = styled(Card)<{ file: FilePreview; isInverse: boolean }>`
104
108
  border-color: ${({ file, theme, isInverse }) =>
105
109
  file.errors
106
110
  ? isInverse
107
- ? theme.colors.danger300
111
+ ? theme.colors.red500
108
112
  : theme.colors.danger
109
- : theme.colors.neutral300};
113
+ : isInverse
114
+ ? theme.colors.neutral800
115
+ : theme.colors.neutral200};
110
116
  border-width: 1px;
117
+ color: ${({ file, theme, isInverse }) =>
118
+ isInverse
119
+ ? theme.colors.neutral0
120
+ : file.errors
121
+ ? theme.colors.neutral700
122
+ : theme.colors.brand.navy};
111
123
  margin: 10px 0;
112
124
  `;
113
125
 
@@ -221,7 +233,7 @@ export const Preview = forwardRef<
221
233
  <IconButton
222
234
  onClick={handleRemoveFile}
223
235
  variant={ButtonVariant.link}
224
- color={ButtonColor.secondary}
236
+ color={ButtonColor.subtle}
225
237
  aria-label={`${i18n.dropzone.removeFile} ${file.name}`}
226
238
  icon={<CloseIcon />}
227
239
  />
@@ -233,7 +245,9 @@ export const Preview = forwardRef<
233
245
  return (
234
246
  <StatusIcons>
235
247
  <Spinner
236
- color={isInverse ? theme.colors.neutral100 : theme.colors.primary}
248
+ color={
249
+ isInverse ? theme.colors.brand.skyBlue : theme.colors.primary
250
+ }
237
251
  />
238
252
  </StatusIcons>
239
253
  );
@@ -243,7 +257,7 @@ export const Preview = forwardRef<
243
257
  <StatusIcons>
244
258
  <Transition isOpen={!done} unmountOnExit fade>
245
259
  <CheckCircleIcon
246
- color={isInverse ? theme.colors.success200 : theme.colors.success}
260
+ color={isInverse ? theme.colors.green500 : theme.colors.success}
247
261
  style={{ marginTop: '4px' }}
248
262
  />
249
263
  </Transition>
@@ -251,7 +265,7 @@ export const Preview = forwardRef<
251
265
  <IconButton
252
266
  onClick={handleDeleteFile}
253
267
  variant={ButtonVariant.link}
254
- color={ButtonColor.secondary}
268
+ color={ButtonColor.subtle}
255
269
  aria-label={`${i18n.dropzone.deleteFile} ${file.name}`}
256
270
  icon={<DeleteIcon />}
257
271
  />
@@ -267,6 +281,8 @@ export const Preview = forwardRef<
267
281
  return (
268
282
  <InverseContext.Provider value={{ isInverse }}>
269
283
  <StyledCard
284
+ borderRadius={CardBorderRadius.small}
285
+ cornerTreatment={CardCornerTreatment.all}
270
286
  isInverse={isInverse}
271
287
  theme={theme}
272
288
  file={file}
@@ -287,7 +303,7 @@ export const Preview = forwardRef<
287
303
  >
288
304
  {file.errors ? (
289
305
  <ErrorIcon
290
- color={isInverse ? theme.colors.danger300 : theme.colors.danger}
306
+ color={isInverse ? theme.colors.red500 : theme.colors.danger}
291
307
  size={24}
292
308
  />
293
309
  ) : file.preview &&
@@ -314,7 +330,7 @@ export const Preview = forwardRef<
314
330
  <Flex behavior={FlexBehavior.item}>{actions}</Flex>
315
331
  </StyledFlex>
316
332
  {file.errors && (
317
- <Errors theme={theme}>
333
+ <Errors theme={theme} isInverse={isInverse}>
318
334
  {file.errors.slice(0, 1).map(({ code, ...rest }) => {
319
335
  const { header = '', message } = formatError(
320
336
  { code, ...rest, ...i18n.dropzone.errors[code] },
@@ -327,7 +343,7 @@ export const Preview = forwardRef<
327
343
  <ErrorHeader
328
344
  style={{
329
345
  color: isInverse
330
- ? theme.colors.danger200
346
+ ? theme.colors.red500
331
347
  : theme.colors.danger,
332
348
  }}
333
349
  >