@innovaccer/design-system 2.5.0-2 → 2.5.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.
Files changed (123) hide show
  1. package/.all-contributorsrc +170 -0
  2. package/.github/workflows/jira.yml +1 -2
  3. package/.github/workflows/main.yml +1 -6
  4. package/.github/workflows/test.yml +22 -0
  5. package/CHANGELOG.md +21 -54
  6. package/CONTRIBUTING.md +23 -0
  7. package/README.md +124 -75
  8. package/core/components/atoms/button/Button.tsx +56 -55
  9. package/core/components/atoms/button/__tests__/Button.test.tsx +3 -12
  10. package/core/components/atoms/checkbox/Checkbox.tsx +3 -6
  11. package/core/components/atoms/collapsible/__stories__/index.story.tsx +2 -2
  12. package/core/components/atoms/dropdown/DropdownList.tsx +1 -1
  13. package/core/components/atoms/dropdown/__stories__/Options.tsx +15 -0
  14. package/core/components/atoms/dropdown/__tests__/Dropdown.test.tsx +202 -1
  15. package/core/components/atoms/dropdown/__tests__/Option.test.tsx +3 -0
  16. package/core/components/atoms/message/__stories__/CustomDescription.tsx +25 -0
  17. package/core/components/atoms/metaList/Meta.tsx +3 -1
  18. package/core/components/atoms/metaList/__tests__/MetaList.test.tsx +30 -36
  19. package/core/components/atoms/metricInput/MetricInput.tsx +2 -2
  20. package/core/components/atoms/outsideClick/__stories__/index.story.tsx +1 -1
  21. package/core/components/atoms/radio/Radio.tsx +7 -10
  22. package/core/components/atoms/radio/__tests__/Radio.test.tsx +13 -7
  23. package/core/components/css-utilities/Align/Align.story.tsx +1 -1
  24. package/core/components/css-utilities/Background/Background.story.tsx +1 -1
  25. package/core/components/css-utilities/Border/Border.story.tsx +128 -0
  26. package/core/components/css-utilities/Display/Display.story.tsx +1 -1
  27. package/core/components/css-utilities/Flex/Flex.story.tsx +1 -1
  28. package/core/components/css-utilities/Miscellaneous/Miscellaneous.story.tsx +1 -1
  29. package/core/components/css-utilities/Overflow/Overflow.story.tsx +1 -1
  30. package/core/components/css-utilities/Position/Position.story.tsx +1 -1
  31. package/core/components/css-utilities/Sizing/Sizing.story.tsx +1 -1
  32. package/core/components/css-utilities/Spacing/Spacing.story.tsx +1 -1
  33. package/core/components/molecules/chatMessage/__tests__/ChatMessage.test.tsx +20 -46
  34. package/core/components/molecules/dropzone/__tests__/Dropzone.test.tsx +47 -111
  35. package/core/components/molecules/dropzone/__tests__/Utilities.test.tsx +13 -13
  36. package/core/components/molecules/editableChipInput/EditableChipInput.tsx +3 -1
  37. package/core/components/molecules/editableInput/EditableInput.tsx +5 -3
  38. package/core/components/molecules/editableInput/__stories__/variants/Uncontrolled.story.tsx +1 -1
  39. package/core/components/molecules/editableInput/__tests__/EditableInput.test.tsx +1 -3
  40. package/core/components/molecules/emptyState/_tests_/EmptyState.test.tsx +3 -7
  41. package/core/components/molecules/fileUploader/FileUploaderItem.tsx +13 -2
  42. package/core/components/molecules/fileUploader/__stories__/index.story.tsx +156 -21
  43. package/core/components/molecules/fileUploader/__tests__/FileUploader.test.tsx +21 -80
  44. package/core/components/molecules/fileUploader/__tests__/FileUploaderList.test.tsx +9 -40
  45. package/core/components/molecules/fullscreenModal/FullscreenModal.tsx +7 -13
  46. package/core/components/molecules/fullscreenModal/__stories__/Layering.story.tsx +2 -2
  47. package/core/components/molecules/modal/Modal.tsx +18 -17
  48. package/core/components/molecules/modal/ModalBody.tsx +1 -1
  49. package/core/components/molecules/modal/__stories__/Layering.story.tsx +1 -1
  50. package/core/components/molecules/modal/__stories__/NoFooter.story.tsx +0 -1
  51. package/core/components/molecules/modal/__stories__/Scrolling.story.tsx +20 -38
  52. package/core/components/molecules/modal/__tests__/Modal.test.tsx +1 -1
  53. package/core/components/molecules/sidesheet/Sidesheet.tsx +16 -17
  54. package/core/components/organisms/choiceList/ChoiceList.tsx +212 -0
  55. package/core/components/organisms/choiceList/__stories__/Alignment.story.tsx +32 -0
  56. package/core/components/organisms/choiceList/__stories__/AllowMultiple.story.tsx +23 -0
  57. package/core/components/organisms/choiceList/__stories__/Controlled.story.tsx +34 -0
  58. package/core/components/organisms/choiceList/__stories__/index.story.tsx +18 -0
  59. package/core/components/organisms/choiceList/__tests__/ChoiceList.test.tsx +155 -0
  60. package/core/components/organisms/choiceList/__tests__/__snapshots__/ChoiceList.test.tsx.snap +3393 -0
  61. package/core/components/organisms/choiceList/index.tsx +2 -0
  62. package/core/components/organisms/datePicker/__tests__/DatePicker.test.tsx +136 -46
  63. package/core/components/organisms/datePicker/__tests__/__snapshots__/DatePicker.test.tsx.snap +2594 -102
  64. package/core/components/organisms/dateRangePicker/DateRangePicker.tsx +5 -0
  65. package/core/components/organisms/dateRangePicker/__tests__/DateRangePicker.test.tsx +49 -410
  66. package/core/components/organisms/dateRangePicker/__tests__/Utilities.test.tsx +39 -0
  67. package/core/components/organisms/dateRangePicker/__tests__/__snapshots__/DateRangePicker.test.tsx.snap +45390 -2679
  68. package/core/components/organisms/dateRangePicker/utilities.tsx +2 -5
  69. package/core/components/organisms/grid/Cell.tsx +5 -4
  70. package/core/components/organisms/grid/Grid.tsx +1 -1
  71. package/core/components/organisms/grid/GridCell.tsx +18 -7
  72. package/core/components/organisms/grid/GridHead.tsx +1 -1
  73. package/core/components/organisms/grid/GridRow.tsx +5 -12
  74. package/core/components/organisms/grid/__tests__/Grid.test.tsx +179 -1
  75. package/core/components/organisms/grid/__tests__/GridCell.test.tsx +218 -0
  76. package/core/components/organisms/grid/__tests__/__snapshots__/Grid.test.tsx.snap +1024 -0
  77. package/core/components/organisms/grid/__tests__/rowUtility.test.tsx +62 -0
  78. package/core/components/organisms/inlineMessage/InlineMessage.tsx +10 -14
  79. package/core/components/organisms/inlineMessage/__stories__/InlineMessageWithinTable.story.tsx +9 -12
  80. package/core/components/organisms/inlineMessage/__stories__/variants/Default.story.tsx +2 -4
  81. package/core/components/organisms/inlineMessage/__stories__/variants/Error.story.tsx +2 -5
  82. package/core/components/organisms/inlineMessage/__stories__/variants/Info.story.tsx +2 -5
  83. package/core/components/organisms/inlineMessage/__stories__/variants/Success.story.tsx +2 -5
  84. package/core/components/organisms/inlineMessage/__stories__/variants/Warning.story.tsx +2 -5
  85. package/core/components/organisms/inlineMessage/__tests__/InlineMessage.test.tsx +4 -20
  86. package/core/components/organisms/navigation/VerticalNavigation.tsx +14 -3
  87. package/core/components/organisms/navigation/__tests__/Navigation.test.tsx +179 -0
  88. package/core/components/organisms/navigation/__tests__/__snapshots__/Navigation.test.tsx.snap +530 -0
  89. package/core/components/organisms/table/DraggableDropdown.tsx +1 -0
  90. package/core/components/organisms/table/Header.tsx +11 -2
  91. package/core/components/organisms/table/Table.tsx +2 -2
  92. package/core/components/organisms/table/__stories__/NestedTableWithNestedCard.story.tsx +4 -1
  93. package/core/components/organisms/table/__stories__/variants/nestedRows.story.tsx +5 -2
  94. package/core/components/organisms/table/__tests__/Table.test.tsx +292 -0
  95. package/core/components/organisms/table/__tests__/__snapshots__/Table.test.tsx.snap +349041 -0
  96. package/core/components/organisms/timePicker/__tests__/TimePicker.test.tsx +15 -66
  97. package/core/components/patterns/dateRangePicker/withCustomPopover.story.tsx +47 -36
  98. package/core/index.tsx +1 -1
  99. package/core/index.type.tsx +1 -0
  100. package/core/utils/OverlayManager.tsx +1 -3
  101. package/core/utils/__tests__/__snapshots__/TS.test.tsx.snap +4 -0
  102. package/core/utils/types.tsx +3 -4
  103. package/css/dist/index.css +78 -8
  104. package/css/dist/index.css.map +1 -1
  105. package/css/src/components/button.css +8 -4
  106. package/css/src/components/choiceList.css +25 -0
  107. package/css/src/components/modal.css +1 -2
  108. package/css/src/utils/border.css +39 -0
  109. package/dist/core/components/atoms/popperWrapper/PopperWrapper.d.ts +50 -49
  110. package/dist/core/components/css-utilities/Border/Border.story.d.ts +13 -0
  111. package/dist/core/components/organisms/choiceList/ChoiceList.d.ts +33 -0
  112. package/dist/core/components/organisms/choiceList/index.d.ts +2 -0
  113. package/dist/core/components/organisms/dateRangePicker/utilities.d.ts +2 -2
  114. package/dist/core/index.d.ts +1 -0
  115. package/dist/core/index.type.d.ts +1 -0
  116. package/dist/index.esm.js +207 -58
  117. package/dist/index.js +209 -57
  118. package/dist/index.js.map +1 -1
  119. package/dist/index.umd.js +1 -1
  120. package/dist/index.umd.js.br +0 -0
  121. package/dist/index.umd.js.gz +0 -0
  122. package/jest.config.js +2 -1
  123. package/package.json +6 -4
@@ -2,34 +2,101 @@ import * as React from 'react';
2
2
  import { text, boolean } from '@storybook/addon-knobs';
3
3
  import { FileUploader, FileUploaderList, Link } from '@/index';
4
4
  import { FileUploaderComponent, FileUploaderListComponent } from './_common_/types';
5
+ import { FileItem } from '../FileUploaderItem';
5
6
 
6
7
  export const all = () => {
7
- const [fileNames, setFileNames] = React.useState<any>([]);
8
+ const [fileNames, setFileNames] = React.useState<FileItem[]>([]);
9
+ const [errorOccured, setErrorOccured] = React.useState(false);
8
10
 
9
11
  const title = text('title', 'Upload files');
10
- const formatLabel = text('formatLabel', 'Accepted formats: PDF, jpg');
12
+ const formatLabel = text('formatLabel', 'Accepted formats: pdf, jpg, jpeg, png');
11
13
  const sizeLabel = text('sizeLabel', 'Maximum size: 25 MB');
12
14
  const multiple = boolean('multiple', true);
13
15
 
14
- const onChangeHandler = (fileList: File[]) => {
15
- const files = fileList.map((file) => {
16
- return {
16
+ const randomBetween = (value: number) => Math.round(Math.random() * value);
17
+
18
+ const imitateUploading = (fileItem: FileItem) => {
19
+ const randomProgressChunks = [5, 8, 13];
20
+ const randomChunkIndex = randomBetween(randomProgressChunks.length - 1);
21
+ const progressChunk = randomProgressChunks[randomChunkIndex];
22
+ let baseProgress = fileItem.progress || 0;
23
+
24
+ const increment = () => {
25
+ baseProgress += progressChunk;
26
+ setProgressFileName(fileItem, baseProgress);
27
+
28
+ if (baseProgress < 100) {
29
+ setTimeout(() => increment(), 100);
30
+ }
31
+ };
32
+
33
+ increment();
34
+ };
35
+
36
+ const setProgressFileName = (fileName: FileItem, progress = 0) => {
37
+ setFileNames((previousFileNames) => {
38
+ const fileNameIndex = previousFileNames.findIndex((fn) => fn.file === fileName.file);
39
+
40
+ if (fileNameIndex === -1) {
41
+ return [...previousFileNames, fileName];
42
+ }
43
+
44
+ return previousFileNames.map((previousFileName, index) => {
45
+ if (fileNameIndex !== index) return previousFileName;
46
+
47
+ return {
48
+ ...previousFileName,
49
+ progress,
50
+ status: progress >= 100 ? 'completed' : 'uploading',
51
+ };
52
+ });
53
+ });
54
+ };
55
+
56
+ const uploadFiles = (fileList: File[]) => {
57
+ if (!errorOccured && (fileList.length > 1 || fileNames.length > 0)) {
58
+ const randomErrorIndex = randomBetween(fileList.length - 1);
59
+ setFileNames((previousFileNames) => [
60
+ ...previousFileNames,
61
+ { file: fileList[randomErrorIndex], status: 'error' },
62
+ ]);
63
+ setErrorOccured(true);
64
+
65
+ if (fileList.length <= 1) {
66
+ return;
67
+ }
68
+
69
+ fileList.splice(randomErrorIndex, 1);
70
+ }
71
+
72
+ fileList.forEach((file) => {
73
+ const fileItem: FileItem = {
17
74
  file,
18
- status: 'completed',
75
+ status: 'uploading',
76
+ progress: 0,
19
77
  };
78
+
79
+ imitateUploading(fileItem);
20
80
  });
81
+ };
82
+
83
+ const retryUploadFile = (file: File) => {
84
+ uploadFiles([file]);
85
+ };
21
86
 
22
- setFileNames(files);
87
+ const deleteUploadedFile = (file: File) => {
88
+ setFileNames((previousFileNames) => previousFileNames.filter((fileName) => fileName.file !== file));
23
89
  };
24
90
 
25
91
  return (
26
92
  <div>
27
93
  <FileUploader
28
- onChange={onChangeHandler}
94
+ onChange={uploadFiles}
29
95
  multiple={multiple}
30
96
  title={title}
31
97
  formatLabel={formatLabel}
32
98
  sizeLabel={sizeLabel}
99
+ accept={['image/png', 'application/pdf', 'image/jpeg']}
33
100
  sampleFileLink={
34
101
  <Link
35
102
  href="http://www.adobe.com/content/dam/Adobe/en/accessibility/pdfs/accessing-pdf-sr.pdf"
@@ -40,32 +107,100 @@ export const all = () => {
40
107
  </Link>
41
108
  }
42
109
  />
43
- <FileUploaderList fileList={fileNames} className="mt-4" />
110
+ <FileUploaderList onDelete={deleteUploadedFile} onRetry={retryUploadFile} fileList={fileNames} className="mt-4" />
44
111
  </div>
45
112
  );
46
113
  };
47
114
 
48
115
  const customCode = `() => {
49
116
  const [fileNames, setFileNames] = React.useState([]);
117
+ const [errorOccured, setErrorOccured] = React.useState(false);
50
118
 
51
- const onChangeHandler = (fileList) => {
52
- const files = fileList.map(file => {
53
- return {
54
- file,
55
- status: 'completed',
119
+ const randomBetween = (value) => Math.round(Math.random() * value);
120
+
121
+ const imitateUploading = (fileItem) => {
122
+ const randomProgressChunks = [5, 8, 13];
123
+ const randomChunkIndex = randomBetween(randomProgressChunks.length - 1);
124
+ const progressChunk = randomProgressChunks[randomChunkIndex];
125
+ let baseProgress = fileItem.progress || 0;
126
+
127
+ const increment = () => {
128
+ baseProgress += progressChunk;
129
+ setProgressFileName(fileItem, baseProgress);
130
+
131
+ if (baseProgress < 100) {
132
+ setTimeout(() => increment(), 100);
133
+ }
134
+ };
135
+
136
+ increment();
137
+ };
138
+
139
+ const setProgressFileName = (fileName, progress = 0) => {
140
+ setFileNames((previousFileNames) => {
141
+ const fileNameIndex = previousFileNames.findIndex((fn) => fn.file === fileName.file);
142
+
143
+ if (fileNameIndex === -1) {
144
+ return [...previousFileNames, fileName];
145
+ }
146
+
147
+ return previousFileNames.map((previousFileName, index) => {
148
+ if (fileNameIndex !== index) return previousFileName;
149
+
150
+ return {
151
+ ...previousFileName,
152
+ status: progress >= 100 ? 'completed' : 'uploading',
153
+ progress,
154
+ };
155
+ });
156
+ });
157
+ };
158
+
159
+ const uploadFiles = (fileList) => {
160
+ if ((!errorOccured && (fileList.length > 1 || fileNames.length > 0))) {
161
+ const randomErrorIndex = randomBetween(fileList.length - 1);
162
+ setFileNames((previousFileNames) => [
163
+ ...previousFileNames,
164
+ { file: fileList[randomErrorIndex], status: 'error' },
165
+ ]);
166
+ setErrorOccured(true);
167
+
168
+ if (fileList.length <= 1) {
169
+ return;
56
170
  }
171
+
172
+ fileList.splice(randomErrorIndex, 1);
173
+ }
174
+
175
+ fileList.forEach((file) => {
176
+ const fileItem = {
177
+ file,
178
+ status: 'uploading',
179
+ progress: 0,
180
+ };
181
+
182
+ imitateUploading(fileItem);
57
183
  });
184
+ };
185
+
186
+ const retryUploadFile = (file) => {
187
+ uploadFiles([file]);
188
+ };
58
189
 
59
- setFileNames(files);
190
+ const deleteUploadedFile = (file) => {
191
+ setFileNames((previousFileNames) => previousFileNames.filter(fileName => fileName.file !== file));
60
192
  };
61
193
 
62
194
  return (
63
195
  <div>
64
196
  <FileUploader
65
- onChange={onChangeHandler}
66
- multiple={true}
67
- formatLabel='Accepted formats: PDF, jpg'
68
- sampleFileLink={(
197
+ onChange={uploadFiles}
198
+ multiple
199
+ title="Upload files"
200
+ accept={['image/png', 'application/pdf', 'image/jpeg']}
201
+ formatLabel="Accepted formats: pdf, jpg, jpeg, png"
202
+ sizeLabel="Maximum size: 25 MB"
203
+ sampleFileLink={
69
204
  <Link
70
205
  href="http://www.adobe.com/content/dam/Adobe/en/accessibility/pdfs/accessing-pdf-sr.pdf"
71
206
  download="Test.pdf"
@@ -73,9 +208,9 @@ const customCode = `() => {
73
208
  >
74
209
  Download sample file
75
210
  </Link>
76
- )}
211
+ }
77
212
  />
78
- <FileUploaderList fileList={fileNames} className="mt-4" />
213
+ <FileUploaderList onDelete={deleteUploadedFile} onRetry={retryUploadFile} fileList={fileNames} className="mt-4" />
79
214
  </div>
80
215
  );
81
216
  }`;
@@ -23,18 +23,14 @@ describe('FileUploader component', () => {
23
23
  sizeLabel: valueHelper(maxSizeLabel, { required: true }),
24
24
  uploadButtonLabel: valueHelper(uploadButtonLabel, { required: true }),
25
25
  formatLabel: valueHelper(formatLabel, { required: true }),
26
- onChange: valueHelper(FunctionValue, { required: true })
26
+ onChange: valueHelper(FunctionValue, { required: true }),
27
27
  };
28
28
 
29
29
  const testFunc = (props: Record<string, any>): void => {
30
30
  const attr = filterUndefined(props) as Props;
31
31
 
32
32
  it(testMessageHelper(attr), () => {
33
- const { asFragment } = render(
34
- <FileUploader
35
- {...attr}
36
- />
37
- );
33
+ const { asFragment } = render(<FileUploader {...attr} />);
38
34
  expect(asFragment()).toMatchSnapshot();
39
35
  });
40
36
  };
@@ -51,11 +47,7 @@ describe('FileUploader component prop:accept snapshot', () => {
51
47
  const attr = filterUndefined(props) as Props;
52
48
 
53
49
  it(testMessageHelper(attr), () => {
54
- const { asFragment } = render(
55
- <FileUploader
56
- {...attr}
57
- />
58
- );
50
+ const { asFragment } = render(<FileUploader {...attr} />);
59
51
  expect(asFragment()).toMatchSnapshot();
60
52
  });
61
53
  };
@@ -72,11 +64,7 @@ describe('FileUploader component prop:multiple snapshot', () => {
72
64
  const attr = filterUndefined(props) as Props;
73
65
 
74
66
  it(testMessageHelper(attr), () => {
75
- const { asFragment } = render(
76
- <FileUploader
77
- {...attr}
78
- />
79
- );
67
+ const { asFragment } = render(<FileUploader {...attr} />);
80
68
  expect(asFragment()).toMatchSnapshot();
81
69
  });
82
70
  };
@@ -93,11 +81,7 @@ describe('FileUploader component prop:disabled snapshot', () => {
93
81
  const attr = filterUndefined(props) as Props;
94
82
 
95
83
  it(testMessageHelper(attr), () => {
96
- const { asFragment } = render(
97
- <FileUploader
98
- {...attr}
99
- />
100
- );
84
+ const { asFragment } = render(<FileUploader {...attr} />);
101
85
  expect(asFragment()).toMatchSnapshot();
102
86
  });
103
87
  };
@@ -107,55 +91,39 @@ describe('FileUploader component prop:disabled snapshot', () => {
107
91
 
108
92
  describe('FileUploader component prop:title', () => {
109
93
  it('renders title element', () => {
110
- const { getAllByTestId } = render(
111
- <FileUploader
112
- title={title}
113
- />
114
- );
94
+ const { getAllByTestId } = render(<FileUploader title={title} />);
115
95
  expect(getAllByTestId('DesignSystem-Text')[0]).toBeInTheDocument();
116
96
  expect(getAllByTestId('DesignSystem-Text')[0].textContent).toMatch(title);
117
97
  expect(getAllByTestId('DesignSystem-Text')[0]).toHaveClass('Text--default Text--regular');
118
98
  });
119
99
 
120
100
  it('check for default title', () => {
121
- const { getAllByTestId } = render(
122
- <FileUploader />
123
- );
101
+ const { getAllByTestId } = render(<FileUploader />);
124
102
  expect(getAllByTestId('DesignSystem-Text')[0]).toBeInTheDocument();
125
103
  expect(getAllByTestId('DesignSystem-Text')[0].textContent).toMatch('Upload files');
126
104
  expect(getAllByTestId('DesignSystem-Text')[0]).toHaveClass('Text--default Text--regular');
127
- })
105
+ });
128
106
  });
129
107
 
130
108
  describe('FileUploader component prop:sizeLabel', () => {
131
109
  it('renders sizeLabel element', () => {
132
- const { getAllByTestId } = render(
133
- <FileUploader
134
- sizeLabel={maxSizeLabel}
135
- />
136
- );
110
+ const { getAllByTestId } = render(<FileUploader sizeLabel={maxSizeLabel} />);
137
111
  expect(getAllByTestId('DesignSystem-Text')[1]).toBeInTheDocument();
138
112
  expect(getAllByTestId('DesignSystem-Text')[1].textContent).toMatch(maxSizeLabel);
139
113
  expect(getAllByTestId('DesignSystem-Text')[1]).toHaveClass('Text--subtle Text--small');
140
114
  });
141
115
 
142
116
  it('check for default sizeLabel', () => {
143
- const { getAllByTestId } = render(
144
- <FileUploader />
145
- );
117
+ const { getAllByTestId } = render(<FileUploader />);
146
118
  expect(getAllByTestId('DesignSystem-Text')[1]).toBeInTheDocument();
147
119
  expect(getAllByTestId('DesignSystem-Text')[1].textContent).toMatch('Maximum size: 25 MB');
148
120
  expect(getAllByTestId('DesignSystem-Text')[1]).toHaveClass('Text--subtle Text--small');
149
- })
121
+ });
150
122
  });
151
123
 
152
124
  describe('FileUploader component prop:formatLabel', () => {
153
125
  it('renders formatLabel element', () => {
154
- const { getAllByTestId } = render(
155
- <FileUploader
156
- formatLabel={formatLabel}
157
- />
158
- );
126
+ const { getAllByTestId } = render(<FileUploader formatLabel={formatLabel} />);
159
127
  expect(getAllByTestId('DesignSystem-Text')[1]).toBeInTheDocument();
160
128
  expect(getAllByTestId('DesignSystem-Text')[1].textContent).toMatch(formatLabel);
161
129
  expect(getAllByTestId('DesignSystem-Text')[1]).toHaveClass('Text--subtle Text--small');
@@ -164,53 +132,34 @@ describe('FileUploader component prop:formatLabel', () => {
164
132
 
165
133
  describe('FileUploader component with overwrite class', () => {
166
134
  it('overwrite DesignSystem-FileUploader class', () => {
167
- const { getByTestId } = render(
168
- <FileUploader
169
- className="customClass"
170
- />
171
- );
135
+ const { getByTestId } = render(<FileUploader className="customClass" />);
172
136
  expect(getByTestId('DesignSystem-FileUploader')).toHaveClass('customClass');
173
137
  });
174
138
  });
175
139
 
176
140
  describe('FileUploader component prop:uploadButtonLabel', () => {
177
141
  it('renders uploadButtonLabel element', () => {
178
- const { getByTestId } = render(
179
- <FileUploader
180
- uploadButtonLabel={uploadButtonLabel}
181
- />
182
- );
142
+ const { getByTestId } = render(<FileUploader uploadButtonLabel={uploadButtonLabel} />);
183
143
  expect(getByTestId('DesignSystem-Button')).toBeInTheDocument();
184
144
  expect(getByTestId('DesignSystem-Button').textContent).toMatch(uploadButtonLabel);
185
145
  });
186
146
 
187
147
  it('checks for uploadButtonLabel element default values', () => {
188
- const { getByTestId } = render(
189
- <FileUploader />
190
- );
148
+ const { getByTestId } = render(<FileUploader />);
191
149
  expect(getByTestId('DesignSystem-Button')).toBeInTheDocument();
192
150
  expect(getByTestId('DesignSystem-Button').textContent).toMatch('Upload files');
193
-
194
151
  });
195
152
  });
196
153
 
197
154
  describe('FileUploader component prop:onChange', () => {
198
155
  it('check for onChange callback when file input is changed', () => {
199
- const { getByTestId } = render(
200
- <FileUploader
201
- onChange={FunctionValue}
202
- />
203
- );
156
+ const { getByTestId } = render(<FileUploader onChange={FunctionValue} />);
204
157
  fireEvent.change(getByTestId('DesignSystem-FileUploaderButton--Input'), { target: { files: expampleFile } });
205
158
  expect(FunctionValue).toHaveBeenCalled();
206
159
  });
207
160
 
208
161
  it('check for onChange callback when file input is not changed', () => {
209
- const { getByTestId } = render(
210
- <FileUploader
211
- onChange={FunctionValue}
212
- />
213
- );
162
+ const { getByTestId } = render(<FileUploader onChange={FunctionValue} />);
214
163
  fireEvent.change(getByTestId('DesignSystem-FileUploaderButton--Input'));
215
164
  expect(FunctionValue).toHaveBeenCalled();
216
165
  });
@@ -218,20 +167,12 @@ describe('FileUploader component prop:onChange', () => {
218
167
 
219
168
  describe('FileUploader component prop:disabled', () => {
220
169
  it('check for fileUploaderButton if disabled is true', () => {
221
- const { getByTestId } = render(
222
- <FileUploader
223
- disabled={true}
224
- />
225
- );
170
+ const { getByTestId } = render(<FileUploader disabled={true} />);
226
171
  expect(getByTestId('DesignSystem-Button')).toHaveAttribute('disabled');
227
172
  });
228
173
 
229
174
  it('check for fileUploaderButton if disabled is false', () => {
230
- const { getByTestId } = render(
231
- <FileUploader
232
- disabled={false}
233
- />
234
- );
175
+ const { getByTestId } = render(<FileUploader disabled={false} />);
235
176
  expect(getByTestId('DesignSystem-Button')).not.toHaveAttribute('disabled');
236
177
  expect(getByTestId('DesignSystem-Button')).toHaveClass('Button--basic');
237
178
  });
@@ -241,7 +182,7 @@ describe('FileUploader component prop:sampleFileLink', () => {
241
182
  it('check for sampleFileLink element', () => {
242
183
  const { getByTestId } = render(
243
184
  <FileUploader
244
- sampleFileLink={(
185
+ sampleFileLink={
245
186
  <Link
246
187
  href="http://www.adobe.com/content/dam/Adobe/en/accessibility/pdfs/accessing-pdf-sr.pdf"
247
188
  download="Test.pdf"
@@ -249,7 +190,7 @@ describe('FileUploader component prop:sampleFileLink', () => {
249
190
  >
250
191
  Download sample file
251
192
  </Link>
252
- )}
193
+ }
253
194
  />
254
195
  );
255
196
  expect(getByTestId('DesignSystem-Link')).toBeInTheDocument();
@@ -32,7 +32,7 @@ const fileList: Props['fileList'] = [
32
32
  status: 'error',
33
33
  errorMessage: 'Network failure',
34
34
  id: 3,
35
- }
35
+ },
36
36
  ];
37
37
 
38
38
  const FunctionValue = jest.fn();
@@ -42,18 +42,14 @@ describe('FileUploaderList component', () => {
42
42
  fileList: valueHelper(fileList, { required: true }),
43
43
  onClick: valueHelper(FunctionValue, { required: true }),
44
44
  onDelete: valueHelper(FunctionValue, { required: true }),
45
- onRetry: valueHelper(FunctionValue, { required: true })
45
+ onRetry: valueHelper(FunctionValue, { required: true }),
46
46
  };
47
47
 
48
48
  const testFunc = (props: Record<string, any>): void => {
49
49
  const attr = filterUndefined(props) as Props;
50
50
 
51
51
  it(testMessageHelper(attr), () => {
52
- const { asFragment } = render(
53
- <FileUploaderList
54
- {...attr}
55
- />
56
- );
52
+ const { asFragment } = render(<FileUploaderList {...attr} />);
57
53
  expect(asFragment()).toMatchSnapshot();
58
54
  });
59
55
  };
@@ -63,20 +59,13 @@ describe('FileUploaderList component', () => {
63
59
 
64
60
  describe('FileUploaderList component prop:fileList', () => {
65
61
  it('renders component if fileList is empty', () => {
66
- const { queryByTestId } = render(
67
- <FileUploaderList />
68
- );
62
+ const { queryByTestId } = render(<FileUploaderList />);
69
63
  expect(queryByTestId(/DesignSystem-FileUploader--List/i)).toBeNull();
70
64
  });
71
65
 
72
66
  it('renders component if fileList is not empty', () => {
73
67
  const { getByTestId, getAllByTestId } = render(
74
- <FileUploaderList
75
- fileList={fileList}
76
- onDelete={FunctionValue}
77
- onRetry={FunctionValue}
78
- onClick={FunctionValue}
79
- />
68
+ <FileUploaderList fileList={fileList} onDelete={FunctionValue} onRetry={FunctionValue} onClick={FunctionValue} />
80
69
  );
81
70
  expect(getByTestId('DesignSystem-FileUploader--List')).toBeInTheDocument();
82
71
  expect(getAllByTestId('DesignSystem-FileUploader--Item')).toHaveLength(fileList.length);
@@ -85,45 +74,25 @@ describe('FileUploaderList component prop:fileList', () => {
85
74
 
86
75
  describe('FileUploaderList component Event Handler', () => {
87
76
  it('check for onClick Event Handler', () => {
88
- const { getAllByTestId } = render(
89
- <FileUploaderList
90
- fileList={fileList}
91
- onClick={FunctionValue}
92
- />
93
- );
77
+ const { getAllByTestId } = render(<FileUploaderList fileList={fileList} onClick={FunctionValue} />);
94
78
  fireEvent.click(getAllByTestId('DesignSystem-FileUploader--Item')[0]);
95
79
  expect(FunctionValue).toHaveBeenCalled();
96
80
  });
97
81
 
98
82
  it('check for onDelete Event Handler', () => {
99
- const { getAllByTestId } = render(
100
- <FileUploaderList
101
- fileList={fileList}
102
- onDelete={FunctionValue}
103
- />
104
- );
83
+ const { getAllByTestId } = render(<FileUploaderList fileList={fileList} onDelete={FunctionValue} />);
105
84
  fireEvent.click(getAllByTestId('DesignSystem-FileUploader--CancelButton')[0]);
106
85
  expect(FunctionValue).toHaveBeenCalled();
107
86
  });
108
87
 
109
88
  it('check for onRetry Event Handler', () => {
110
- const { getByTestId } = render(
111
- <FileUploaderList
112
- fileList={[fileList[2]]}
113
- onRetry={FunctionValue}
114
- />
115
- );
89
+ const { getByTestId } = render(<FileUploaderList fileList={[fileList[2]]} onRetry={FunctionValue} />);
116
90
  fireEvent.click(getByTestId('DesignSystem-Button'));
117
91
  expect(FunctionValue).toHaveBeenCalled();
118
92
  });
119
93
 
120
94
  it('check for Error Caption', () => {
121
- const { getByTestId } = render(
122
- <FileUploaderList
123
- fileList={[fileList[2]]}
124
- onRetry={FunctionValue}
125
- />
126
- );
95
+ const { getByTestId } = render(<FileUploaderList fileList={[fileList[2]]} onRetry={FunctionValue} />);
127
96
  expect(getByTestId('DesignSystem-Caption')).toBeInTheDocument();
128
97
  expect(getByTestId('DesignSystem-Caption').textContent).toMatch('Network failure');
129
98
  });
@@ -122,50 +122,47 @@ class FullscreenModal extends React.Component<FullscreenModalProps, ModalState>
122
122
  }
123
123
 
124
124
  onOutsideClickHandler = (event: KeyboardEvent) => {
125
-
126
125
  OverlayManager.remove(this.modalRef.current);
127
126
 
128
127
  if (this.props.onClose) {
129
128
  this.props.onClose(event, 'EscapePress');
130
-
131
129
  } else {
132
130
  this.setState(
133
131
  {
134
- animate: false
132
+ animate: false,
135
133
  },
136
134
  () => {
137
135
  window.setTimeout(() => {
138
136
  this.setState({
139
- open: false
137
+ open: false,
140
138
  });
141
139
  }, 120);
142
140
  }
143
141
  );
144
142
  }
145
- }
143
+ };
146
144
 
147
145
  onCloseHandler = (event: KeyboardEvent) => {
148
146
  const isTopOverlay = OverlayManager.isTopOverlay(this.modalRef.current);
149
- closeOnEscapeKeypress(event, isTopOverlay, this.onOutsideClickHandler)
150
- }
147
+ closeOnEscapeKeypress(event, isTopOverlay, this.onOutsideClickHandler);
148
+ };
151
149
 
152
150
  componentDidMount() {
153
151
  if (this.props.closeOnEscape) {
154
152
  if (this.state.open) {
155
153
  OverlayManager.add(this.modalRef.current);
156
154
  }
157
- document.addEventListener('keydown', this.onCloseHandler)
155
+ document.addEventListener('keydown', this.onCloseHandler);
158
156
  }
159
157
  }
160
158
 
161
159
  componentWillUnmount() {
162
- if (this.props.closeOnEscape) document.removeEventListener('keydown', this.onCloseHandler)
160
+ if (this.props.closeOnEscape) document.removeEventListener('keydown', this.onCloseHandler);
163
161
  }
164
162
 
165
163
  componentDidUpdate(prevProps: FullscreenModalProps) {
166
164
  if (prevProps.open !== this.props.open) {
167
165
  if (this.props.open) {
168
-
169
166
  const zIndex = getUpdatedZIndex({
170
167
  element: this.element,
171
168
  containerClassName: '.Overlay-container--open',
@@ -179,9 +176,7 @@ class FullscreenModal extends React.Component<FullscreenModalProps, ModalState>
179
176
  });
180
177
 
181
178
  if (this.props.closeOnEscape) OverlayManager.add(this.modalRef.current);
182
-
183
179
  } else {
184
-
185
180
  this.setState(
186
181
  {
187
182
  animate: false,
@@ -196,7 +191,6 @@ class FullscreenModal extends React.Component<FullscreenModalProps, ModalState>
196
191
  );
197
192
 
198
193
  if (this.props.closeOnEscape) OverlayManager.remove(this.modalRef.current);
199
-
200
194
  }
201
195
  }
202
196
  }
@@ -23,7 +23,7 @@ export const layering = () => {
23
23
  setOpenSecondOverlay(!openSecondOverlay);
24
24
  action('on close triggered')();
25
25
  updateKnob('openSecondOverlay', !openSecondOverlay);
26
- }
26
+ };
27
27
 
28
28
  const openModal = () => {
29
29
  setOpen(true);
@@ -100,7 +100,7 @@ export const layering = () => {
100
100
  children: 'Basic',
101
101
  appearance: 'basic',
102
102
  onClick: action('basic action'),
103
- }
103
+ },
104
104
  ],
105
105
  }}
106
106
  >