@performant-software/semantic-components 1.0.4-beta.8 → 1.0.4

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.8",
3
+ "version": "1.0.4",
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.8",
15
+ "@performant-software/shared-components": "^1.0.4",
16
16
  "@react-google-maps/api": "^2.8.1",
17
17
  "axios": "^0.26.1",
18
18
  "citeproc": "^2.4.62",
@@ -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>
@@ -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>