@performant-software/semantic-components 1.0.4-beta.7 → 1.0.4-beta.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@performant-software/semantic-components",
3
- "version": "1.0.4-beta.7",
3
+ "version": "1.0.4-beta.9",
4
4
  "description": "A package of shared components based on the Semantic UI Framework.",
5
5
  "license": "MIT",
6
6
  "main": "./build/index.js",
@@ -12,7 +12,7 @@
12
12
  "build": "webpack --mode production && flow-copy-source -v src types"
13
13
  },
14
14
  "dependencies": {
15
- "@performant-software/shared-components": "^1.0.4-beta.7",
15
+ "@performant-software/shared-components": "^1.0.4-beta.9",
16
16
  "@react-google-maps/api": "^2.8.1",
17
17
  "axios": "^0.26.1",
18
18
  "citeproc": "^2.4.62",
@@ -179,7 +179,7 @@ const FileUploadModal: ComponentType<any> = (props: Props) => {
179
179
  const item = items[i];
180
180
 
181
181
  // Update the status for the item
182
- setStatus(item, Status.processing);
182
+ setStatus(i, Status.processing);
183
183
 
184
184
  let error;
185
185
 
@@ -193,9 +193,9 @@ const FileUploadModal: ComponentType<any> = (props: Props) => {
193
193
 
194
194
  // Update the status for the item
195
195
  if (error) {
196
- setStatus(item, Status.error);
196
+ setStatus(i, Status.error);
197
197
  } else {
198
- setStatus(item, Status.complete);
198
+ setStatus(i, Status.complete);
199
199
  }
200
200
 
201
201
  // Update the upload count
@@ -326,6 +326,23 @@ const FileUploadModal: ComponentType<any> = (props: Props) => {
326
326
  );
327
327
  }, []);
328
328
 
329
+ /**
330
+ * Renders the status component for the passed index.
331
+ *
332
+ * @type {(function(*): (null|*))|*}
333
+ */
334
+ const renderStatus = useCallback((index) => {
335
+ if (props.strategy !== Strategy.single) {
336
+ return null;
337
+ }
338
+
339
+ return (
340
+ <FileUploadStatus
341
+ status={statuses[index]}
342
+ />
343
+ );
344
+ }, [statuses, props.strategy]);
345
+
329
346
  /**
330
347
  * Memoization and case correction for the <code>itemComponent</code> prop.
331
348
  *
@@ -403,13 +420,8 @@ const FileUploadModal: ComponentType<any> = (props: Props) => {
403
420
  onDelete={onDelete.bind(this, item)}
404
421
  onTextInputChange={onTextInputChange.bind(this, item)}
405
422
  onUpdate={onUpdate.bind(this, item)}
406
- >
407
- { props.strategy === Strategy.single && (
408
- <FileUploadStatus
409
- status={statuses[index]}
410
- />
411
- )}
412
- </UploadItem>
423
+ renderStatus={renderStatus.bind(this, index)}
424
+ />
413
425
  ))}
414
426
  </Item.Group>
415
427
  </Modal.Content>
@@ -179,7 +179,7 @@ const FileUploadModal: ComponentType<any> = (props: Props) => {
179
179
  const item = items[i];
180
180
 
181
181
  // Update the status for the item
182
- setStatus(item, Status.processing);
182
+ setStatus(i, Status.processing);
183
183
 
184
184
  let error;
185
185
 
@@ -193,9 +193,9 @@ const FileUploadModal: ComponentType<any> = (props: Props) => {
193
193
 
194
194
  // Update the status for the item
195
195
  if (error) {
196
- setStatus(item, Status.error);
196
+ setStatus(i, Status.error);
197
197
  } else {
198
- setStatus(item, Status.complete);
198
+ setStatus(i, Status.complete);
199
199
  }
200
200
 
201
201
  // Update the upload count
@@ -326,6 +326,23 @@ const FileUploadModal: ComponentType<any> = (props: Props) => {
326
326
  );
327
327
  }, []);
328
328
 
329
+ /**
330
+ * Renders the status component for the passed index.
331
+ *
332
+ * @type {(function(*): (null|*))|*}
333
+ */
334
+ const renderStatus = useCallback((index) => {
335
+ if (props.strategy !== Strategy.single) {
336
+ return null;
337
+ }
338
+
339
+ return (
340
+ <FileUploadStatus
341
+ status={statuses[index]}
342
+ />
343
+ );
344
+ }, [statuses, props.strategy]);
345
+
329
346
  /**
330
347
  * Memoization and case correction for the <code>itemComponent</code> prop.
331
348
  *
@@ -403,13 +420,8 @@ const FileUploadModal: ComponentType<any> = (props: Props) => {
403
420
  onDelete={onDelete.bind(this, item)}
404
421
  onTextInputChange={onTextInputChange.bind(this, item)}
405
422
  onUpdate={onUpdate.bind(this, item)}
406
- >
407
- { props.strategy === Strategy.single && (
408
- <FileUploadStatus
409
- status={statuses[index]}
410
- />
411
- )}
412
- </UploadItem>
423
+ renderStatus={renderStatus.bind(this, index)}
424
+ />
413
425
  ))}
414
426
  </Item.Group>
415
427
  </Modal.Content>