@oslokommune/punkt-react 16.13.3 → 16.15.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/{dialog-polyfill.esm-1hPr0gl9-EorOF9Wq.js → dialog-polyfill.esm-BmVHGRTX-CuhXqEqJ.js} +1 -1
  3. package/dist/index.d.ts +50 -47
  4. package/dist/punkt-react.es.js +4560 -3038
  5. package/dist/punkt-react.umd.js +670 -274
  6. package/dist/shared-types/fileupload.d.ts +73 -0
  7. package/dist/shared-types/index.d.ts +2 -0
  8. package/dist/shared-utils/fileupload/announcements.d.ts +11 -0
  9. package/dist/shared-utils/fileupload/filename.d.ts +13 -0
  10. package/dist/shared-utils/fileupload/focus-trap.d.ts +12 -0
  11. package/dist/shared-utils/fileupload/formats.d.ts +30 -0
  12. package/dist/shared-utils/fileupload/index.d.ts +15 -0
  13. package/dist/shared-utils/fileupload/navigation.d.ts +5 -0
  14. package/dist/shared-utils/fileupload/size.d.ts +12 -0
  15. package/dist/shared-utils/fileupload/transfers.d.ts +17 -0
  16. package/dist/shared-utils/fileupload/truncate.d.ts +13 -0
  17. package/dist/shared-utils/fileupload/validation.d.ts +24 -0
  18. package/package.json +4 -4
  19. package/src/components/fileupload/DropZone.tsx +35 -22
  20. package/src/components/fileupload/FileUpload.test.tsx +165 -10
  21. package/src/components/fileupload/FileUpload.tsx +116 -184
  22. package/src/components/fileupload/QueueDisplay.test.tsx +51 -8
  23. package/src/components/fileupload/QueueDisplay.tsx +71 -99
  24. package/src/components/fileupload/QueueItemContent.tsx +120 -135
  25. package/src/components/fileupload/Subcomponents.tsx +175 -144
  26. package/src/components/fileupload/Truncate.test.tsx +65 -207
  27. package/src/components/fileupload/Truncate.tsx +24 -120
  28. package/src/components/fileupload/extensions/Comments.tsx +94 -106
  29. package/src/components/fileupload/extensions/Remove.tsx +3 -5
  30. package/src/components/fileupload/extensions/Rename.tsx +45 -42
  31. package/src/components/fileupload/hooks/index.ts +1 -0
  32. package/src/components/fileupload/hooks/useFileAttributes.ts +37 -29
  33. package/src/components/fileupload/hooks/useImagePreview.ts +3 -7
  34. package/src/components/fileupload/hooks/useOperationState.ts +29 -8
  35. package/src/components/fileupload/hooks/useRequiredFormValidation.ts +43 -0
  36. package/src/components/fileupload/hooks.ts +1 -0
  37. package/src/components/fileupload/types.ts +49 -32
  38. package/src/components/fileupload/utils.ts +3 -54
  39. package/src/components/inputwrapper/InputWrapper.tsx +4 -1
  40. package/src/components/modal/Modal.tsx +27 -15
  41. package/src/components/searchinput/SearchInput.tsx +14 -13
  42. package/src/components/types.ts +1 -1
  43. package/src/components/fileupload/texts.ts +0 -20
@@ -1,96 +1,53 @@
1
1
  import classNames from 'classnames'
2
2
  import { FC, useMemo } from 'react'
3
3
 
4
+ import { isImageFileLike, mergeFilesAndTransfers } from 'shared-utils/fileupload'
5
+
4
6
  import { useImagePreview, useOperationState } from './hooks'
5
- import { getProgressState, QueueItemContent } from './QueueItemContent'
7
+ import { buildOperationContext, getProgressState, QueueItemContent } from './QueueItemContent'
6
8
  import { FilenameRenderer, ImagePreviewModal, ThumbnailRenderer } from './Subcomponents'
7
9
  import { TruncateContext } from './Truncate'
8
- import { TFileAndTransfer, FileItem, TFileItemList, TFileTransfer, TItemRenderer, TQueueItemOperation } from './types'
9
-
10
- const isImageFile = (item: TFileAndTransfer): boolean => {
11
- if (item.file.type?.startsWith('image/')) return true
12
- return /\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(item.file.name || '')
13
- }
10
+ import {
11
+ TFileAndTransfer,
12
+ TFileId,
13
+ TFileItemList,
14
+ TFileTransfer,
15
+ TItemRenderer,
16
+ TQueueItemOperation,
17
+ TQueueOperationContext,
18
+ } from './types'
14
19
 
15
- // ============================================
16
- // Helper: Transform files with transfer status
17
- // ============================================
18
-
19
- /**
20
- * Combine `files` with their transfer state (`transfers`) and sort by priority.
21
- *
22
- * Sort order:
23
- * - in-progress first
24
- * - then errors
25
- * - then everything else
26
- */
27
20
  const useFilesAndTransfers = (
28
21
  files: TFileItemList,
29
22
  transfers: TFileTransfer[],
30
23
  uploadStrategy: 'form' | 'custom',
31
- ): TFileAndTransfer[] => {
32
- return useMemo(() => {
33
- const mapped = files.map((fileItem: FileItem) => {
34
- const transfer = transfers.find((t) => t.fileId === fileItem.fileId)
35
- return {
36
- ...fileItem,
37
- progress: transfer?.progress ?? (uploadStrategy === 'form' ? 'done' : 'queued'),
38
- errorMessage: transfer?.errorMessage,
39
- showProgress: transfer?.showProgress,
40
- lastProgress: transfer?.lastProgress,
41
- }
42
- })
43
-
44
- // Sort order: in-progress first, then errors, then the rest
45
- const priority = { 'in-progress': 0, error: 1, idle: 2 } as const
46
- return mapped.sort((a, b) => priority[getProgressState(a.progress)] - priority[getProgressState(b.progress)])
47
- }, [files, transfers, uploadStrategy])
48
- }
49
-
50
- // ============================================
51
- // Helper: Filter previewable images
52
- // ============================================
24
+ ): TFileAndTransfer[] =>
25
+ useMemo(
26
+ () => mergeFilesAndTransfers(files, transfers, uploadStrategy) as TFileAndTransfer[],
27
+ [files, transfers, uploadStrategy],
28
+ )
53
29
 
54
30
  /** Returns only uploaded images (used for the preview modal). */
55
- const usePreviewableImages = (filesAndTransfers: TFileAndTransfer[], enabled: boolean): TFileAndTransfer[] => {
56
- return useMemo(() => {
31
+ const usePreviewableImages = (filesAndTransfers: TFileAndTransfer[], enabled: boolean): TFileAndTransfer[] =>
32
+ useMemo(() => {
57
33
  if (!enabled) return []
58
- return filesAndTransfers.filter((item) => item.progress === 'done' && isImageFile(item))
34
+ return filesAndTransfers.filter((item) => item.progress === 'done' && isImageFileLike(item))
59
35
  }, [filesAndTransfers, enabled])
60
- }
61
36
 
62
- // ============================================
63
- // QueueDisplay Props
64
- // ============================================
65
-
66
- /**
67
- * Queue list renderer for `PktFileUpload`.
68
- *
69
- * This component is UI-only; state changes are handled via callbacks / operations passed in.
70
- */
71
37
  interface IQueueDisplay {
72
- /** Called when the user cancels/removes a file (also used to cancel transfers). */
73
38
  cancelTransfer: (fileItemId: string) => void
74
- /** Transfer states used for `uploadStrategy="custom"`. */
75
39
  transfers?: TFileTransfer[]
76
- /** Current file items. */
77
40
  files: TFileItemList
78
- /** Operations (rename/comment/remove/etc) rendered per queue item. */
79
41
  queueItemOperations?: TQueueItemOperation[]
80
- /** Custom renderer for each queue item (defaults to filename renderer). */
81
42
  ItemRenderer?: TItemRenderer
82
- /** Number of trailing characters to keep when truncating long filenames. */
83
43
  truncateTail?: number
84
- /** Enable image preview modal (only affects thumbnail view). */
85
44
  enableImagePreview?: boolean
86
- /** Upload mode decides default queue state when no transfer exists. */
87
45
  uploadStrategy?: 'form' | 'custom'
46
+ disabled?: boolean
47
+ inputName: string
48
+ buildAttributeAccessors: (fileId: TFileId) => Pick<TQueueOperationContext, 'getAttribute' | 'setAttribute'>
88
49
  }
89
50
 
90
- // ============================================
91
- // QueueDisplay Component
92
- // ============================================
93
-
94
51
  export const QueueDisplay: FC<IQueueDisplay> = ({
95
52
  files,
96
53
  cancelTransfer,
@@ -100,12 +57,13 @@ export const QueueDisplay: FC<IQueueDisplay> = ({
100
57
  truncateTail,
101
58
  enableImagePreview = false,
102
59
  uploadStrategy = 'form',
60
+ disabled = false,
61
+ inputName,
62
+ buildAttributeAccessors,
103
63
  }) => {
104
- // Transform data
105
64
  const filesAndTransfers = useFilesAndTransfers(files, transfers, uploadStrategy)
106
65
  const previewableImages = usePreviewableImages(filesAndTransfers, enableImagePreview)
107
66
 
108
- // State management
109
67
  const operationState = useOperationState(queueItemOperations)
110
68
  const preview = useImagePreview(previewableImages)
111
69
 
@@ -113,39 +71,55 @@ export const QueueDisplay: FC<IQueueDisplay> = ({
113
71
  <>
114
72
  <ul className="pkt-fileupload__queue-display">
115
73
  <TruncateContext.Provider value={{ tail: truncateTail }}>
116
- {filesAndTransfers.map((transferItem) => (
117
- <li
118
- key={transferItem.fileId}
119
- className={classNames('pkt-fileupload__queue-display__item', {
120
- 'pkt-fileupload__queue-display__item--in-progress': typeof transferItem.progress === 'number',
121
- [`pkt-fileupload__queue-display__item--${transferItem.progress}`]:
122
- typeof transferItem.progress === 'string',
123
- })}
124
- >
125
- {/* Hidden inputs for form submission */}
126
- {queueItemOperations.filter((op) => op.renderHidden).map((op) => op.renderHidden!(transferItem))}
127
-
128
- {/* Main content based on state */}
129
- <QueueItemContent
130
- transferItem={transferItem}
131
- activatedOperation={operationState.getActivated(transferItem.fileId)}
132
- operations={queueItemOperations}
133
- ItemRenderer={ItemRenderer}
134
- enableImagePreview={enableImagePreview}
135
- onActivate={operationState.activate}
136
- onClose={operationState.close}
137
- onCancelTransfer={cancelTransfer}
138
- onOpenPreview={preview.open}
139
- />
140
- </li>
141
- ))}
74
+ {filesAndTransfers.map((transferItem) => {
75
+ const activatedOperation = operationState.getActivated(transferItem.fileId)
76
+ const commonContentProps = {
77
+ transferItem,
78
+ operations: queueItemOperations,
79
+ activatedOperation,
80
+ inputName,
81
+ disabled,
82
+ onActivate: operationState.activate,
83
+ onClose: operationState.close,
84
+ buildAttributeAccessors,
85
+ }
86
+
87
+ return (
88
+ <li
89
+ key={transferItem.fileId}
90
+ className={classNames('pkt-fileupload__queue-display__item', {
91
+ 'pkt-fileupload__queue-display__item--in-progress': typeof transferItem.progress === 'number',
92
+ [`pkt-fileupload__queue-display__item--${transferItem.progress}`]:
93
+ typeof transferItem.progress === 'string',
94
+ })}
95
+ >
96
+ {/* Hidden inputs for form submission */}
97
+ {queueItemOperations
98
+ .filter((op) => op.renderHidden)
99
+ .map((operation) => (
100
+ <span key={`${operation.id}-${transferItem.fileId}`}>
101
+ {operation.renderHidden!(
102
+ buildOperationContext({ operation, ...commonContentProps }),
103
+ )}
104
+ </span>
105
+ ))}
106
+
107
+ <QueueItemContent
108
+ {...commonContentProps}
109
+ ItemRenderer={ItemRenderer}
110
+ enableImagePreview={enableImagePreview}
111
+ onCancelTransfer={cancelTransfer}
112
+ onOpenPreview={preview.open}
113
+ />
114
+ </li>
115
+ )
116
+ })}
142
117
  </TruncateContext.Provider>
143
118
  </ul>
144
119
 
145
- {/* Image preview modal */}
146
120
  {enableImagePreview && previewableImages.length > 0 && (
147
121
  <ImagePreviewModal
148
- ref={preview.modalRef}
122
+ modalRef={preview.modalRef}
149
123
  isOpen={preview.isOpen}
150
124
  images={previewableImages}
151
125
  currentIndex={preview.currentIndex}
@@ -157,9 +131,7 @@ export const QueueDisplay: FC<IQueueDisplay> = ({
157
131
  )
158
132
  }
159
133
 
160
- // ============================================
161
- // ItemRenderers Export
162
- // ============================================
134
+ export { getProgressState } // preserved for backwards import compatibility
163
135
 
164
136
  export const ItemRenderers: Record<string, TItemRenderer> = {
165
137
  filename: FilenameRenderer,
@@ -1,109 +1,120 @@
1
- import { FC, ReactNode } from 'react'
1
+ import { FC } from 'react'
2
+
3
+ import {
4
+ getProgressState as sharedGetProgressState,
5
+ isImageFileLike,
6
+ type TProgressState,
7
+ } from 'shared-utils/fileupload'
2
8
 
3
9
  import { PktIcon } from '..'
4
10
  import { OperationButton, TransferError, TransferInProgress } from './Subcomponents'
5
- import { TFileAndTransfer, TFileId, TItemRenderer, TQueueItemOperation, TTransferItemInProgress } from './types'
6
-
7
- const isImageFile = (item: TFileAndTransfer): boolean => {
8
- if (item.file.type?.startsWith('image/')) return true
9
- return /\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(item.file.name || '')
10
- }
11
-
12
- type TProgressState = 'in-progress' | 'error' | 'idle'
13
-
14
- export const getProgressState = (progress: TFileAndTransfer['progress']): TProgressState => {
15
- if (typeof progress === 'number') return 'in-progress'
16
- if (progress === 'error') return 'error'
17
- return 'idle'
18
- }
19
-
20
- // ============================================
21
- // OperationActions - Renders action buttons for a file
22
- // ============================================
23
-
24
- interface IOperationActions {
25
- operations: TQueueItemOperation[]
11
+ import {
12
+ TFileAndTransfer,
13
+ TFileId,
14
+ TItemRenderer,
15
+ TQueueItemOperation,
16
+ TQueueOperationContext,
17
+ TTransferItemInProgress,
18
+ } from './types'
19
+
20
+ /**
21
+ * Re-export so that external consumers who imported `getProgressState` from
22
+ * this module keep working. Internal code should prefer the shared import.
23
+ */
24
+ export const getProgressState = (progress: TFileAndTransfer['progress']): TProgressState =>
25
+ sharedGetProgressState(progress)
26
+
27
+ /** Build a stable `TQueueOperationContext` for the given file + operation pair. */
28
+ export const buildOperationContext = ({
29
+ operation,
30
+ transferItem,
31
+ inputName,
32
+ disabled,
33
+ activatedOperation,
34
+ onActivate,
35
+ onClose,
36
+ buildAttributeAccessors,
37
+ }: {
38
+ operation: TQueueItemOperation
39
+ transferItem: TFileAndTransfer
40
+ inputName: string
41
+ disabled: boolean
26
42
  activatedOperation?: TQueueItemOperation
27
43
  onActivate: (fileId: TFileId, operation: TQueueItemOperation) => void
28
- transferItem: TFileAndTransfer
44
+ onClose: (fileId: TFileId) => void
45
+ buildAttributeAccessors: (fileId: TFileId) => Pick<TQueueOperationContext, 'getAttribute' | 'setAttribute'>
46
+ }): TQueueOperationContext => {
47
+ const accessors = buildAttributeAccessors(transferItem.fileId)
48
+ return {
49
+ file: transferItem,
50
+ inputName,
51
+ disabled,
52
+ isActive: activatedOperation?.id === operation.id,
53
+ activate: () => onActivate(transferItem.fileId, operation),
54
+ close: () => onClose(transferItem.fileId),
55
+ getAttribute: accessors.getAttribute,
56
+ setAttribute: accessors.setAttribute,
57
+ }
29
58
  }
30
59
 
31
- export const OperationActions: FC<IOperationActions> = ({
32
- operations,
33
- activatedOperation,
34
- onActivate,
35
- transferItem,
36
- }) => (
37
- <div className="pkt-fileupload__queue-display__item__actions">
38
- {operations
39
- .filter((op) => !activatedOperation || op.symbol !== activatedOperation.symbol)
40
- .map((operation) => (
41
- <OperationButton
42
- key={operation.symbol.toString()}
43
- operation={operation}
44
- onActivate={onActivate}
45
- transferItem={transferItem}
46
- />
47
- ))}
48
- </div>
49
- )
50
-
51
- // ============================================
52
- // OperationContents - Renders operation content areas
53
- // ============================================
54
-
55
- interface IOperationContents {
60
+ interface ICommonContentProps {
61
+ transferItem: TFileAndTransfer
56
62
  operations: TQueueItemOperation[]
57
63
  activatedOperation?: TQueueItemOperation
64
+ inputName: string
65
+ disabled: boolean
58
66
  onActivate: (fileId: TFileId, operation: TQueueItemOperation) => void
59
- transferItem: TFileAndTransfer
67
+ onClose: (fileId: TFileId) => void
68
+ buildAttributeAccessors: (fileId: TFileId) => Pick<TQueueOperationContext, 'getAttribute' | 'setAttribute'>
60
69
  }
61
70
 
62
- export const OperationContents: FC<IOperationContents> = ({
63
- operations,
64
- activatedOperation,
65
- onActivate,
66
- transferItem,
67
- }) => (
68
- <>
69
- {operations
70
- .filter((op) => op.renderContent)
71
- .map((operation) => (
72
- <div className="pkt-fileupload__queue-display__item__operation-content" key={operation.symbol.toString()}>
73
- {operation.renderContent!(
74
- transferItem,
75
- () => onActivate(transferItem.fileId, operation),
76
- activatedOperation?.symbol === operation.symbol,
77
- )}
78
- </div>
79
- ))}
80
- </>
81
- )
71
+ const buildContextsForOperations = (
72
+ operations: TQueueItemOperation[],
73
+ props: ICommonContentProps,
74
+ ): Array<{ operation: TQueueItemOperation; context: TQueueOperationContext }> =>
75
+ operations.map((operation) => ({
76
+ operation,
77
+ context: buildOperationContext({ operation, ...props }),
78
+ }))
79
+
80
+ export const OperationActions: FC<ICommonContentProps> = (props) => {
81
+ const contexts = buildContextsForOperations(props.operations, props)
82
+ return (
83
+ <div className="pkt-fileupload__queue-display__item__actions">
84
+ {contexts
85
+ .filter(({ operation }) => operation.id !== props.activatedOperation?.id)
86
+ .map(({ operation, context }) => (
87
+ <OperationButton key={operation.id} operation={operation} context={context} />
88
+ ))}
89
+ </div>
90
+ )
91
+ }
82
92
 
83
- // ============================================
84
- // IdleStateContent - Renders content for idle/done state
85
- // ============================================
93
+ export const OperationContents: FC<ICommonContentProps> = (props) => {
94
+ const contexts = buildContextsForOperations(props.operations, props)
95
+ return (
96
+ <>
97
+ {contexts
98
+ .filter(({ operation }) => operation.renderContent)
99
+ .map(({ operation, context }) => (
100
+ <div className="pkt-fileupload__queue-display__item__operation-content" key={operation.id}>
101
+ {operation.renderContent!(context)}
102
+ </div>
103
+ ))}
104
+ </>
105
+ )
106
+ }
86
107
 
87
- interface IIdleStateContent {
88
- transferItem: TFileAndTransfer
89
- activatedOperation?: TQueueItemOperation
90
- operations: TQueueItemOperation[]
108
+ interface IIdleStateContent extends ICommonContentProps {
91
109
  ItemRenderer: TItemRenderer
92
- onActivate: (fileId: TFileId, operation: TQueueItemOperation) => void
93
- onClose: (fileId: TFileId) => void
94
110
  onPreviewClick?: () => void
95
111
  }
96
112
 
97
- export const IdleStateContent: FC<IIdleStateContent> = ({
98
- transferItem,
99
- activatedOperation,
100
- operations,
101
- ItemRenderer,
102
- onActivate,
103
- onClose,
104
- onPreviewClick,
105
- }) => {
106
- const closeUI = () => onClose(transferItem.fileId)
113
+ export const IdleStateContent: FC<IIdleStateContent> = (props) => {
114
+ const { transferItem, activatedOperation, operations, ItemRenderer, onPreviewClick } = props
115
+ const activeContext = activatedOperation
116
+ ? buildOperationContext({ operation: activatedOperation, ...props })
117
+ : undefined
107
118
 
108
119
  // When any operation UI is active (rename inline or comments extended), hide all action buttons.
109
120
  const hasOperationUIActive = activatedOperation?.renderInlineUI || activatedOperation?.renderExtendedUI
@@ -111,11 +122,11 @@ export const IdleStateContent: FC<IIdleStateContent> = ({
111
122
 
112
123
  return (
113
124
  <>
114
- {activatedOperation?.renderInlineUI ? (
125
+ {activatedOperation?.renderInlineUI && activeContext ? (
115
126
  <>
116
127
  <PktIcon name="document-text" className="pkt-fileupload__queue-display__item__icon" />
117
128
  <div className="pkt-fileupload__queue-display__item__inline-ui">
118
- {activatedOperation.renderInlineUI(transferItem, closeUI)}
129
+ {activatedOperation.renderInlineUI(activeContext)}
119
130
  </div>
120
131
  </>
121
132
  ) : (
@@ -123,82 +134,56 @@ export const IdleStateContent: FC<IIdleStateContent> = ({
123
134
  )}
124
135
 
125
136
  {visibleOperations.length > 0 && (
126
- <OperationActions
127
- operations={visibleOperations}
128
- activatedOperation={activatedOperation}
129
- onActivate={onActivate}
130
- transferItem={transferItem}
131
- />
137
+ <OperationActions {...props} operations={visibleOperations} />
132
138
  )}
133
139
 
134
- <OperationContents
135
- operations={operations}
136
- activatedOperation={activatedOperation}
137
- onActivate={onActivate}
138
- transferItem={transferItem}
139
- />
140
+ <OperationContents {...props} />
140
141
 
141
- {activatedOperation?.renderExtendedUI && (
142
+ {activatedOperation?.renderExtendedUI && activeContext && (
142
143
  <div className="pkt-fileupload__queue-display__item__expanded-operation-ui">
143
- {activatedOperation.renderExtendedUI(transferItem, closeUI)}
144
+ {activatedOperation.renderExtendedUI(activeContext)}
144
145
  </div>
145
146
  )}
146
147
  </>
147
148
  )
148
149
  }
149
150
 
150
- // ============================================
151
- // QueueItemContent - Main content renderer based on state
152
- // ============================================
153
-
154
- interface IQueueItemContent {
155
- transferItem: TFileAndTransfer
156
- activatedOperation?: TQueueItemOperation
157
- operations: TQueueItemOperation[]
151
+ interface IQueueItemContent extends ICommonContentProps {
158
152
  ItemRenderer: TItemRenderer
159
153
  enableImagePreview: boolean
160
- onActivate: (fileId: TFileId, operation: TQueueItemOperation) => void
161
- onClose: (fileId: TFileId) => void
162
154
  onCancelTransfer: (fileId: string) => void
163
155
  onOpenPreview: (fileId: TFileId) => void
164
156
  }
165
157
 
166
- export const QueueItemContent: FC<IQueueItemContent> = ({
167
- transferItem,
168
- activatedOperation,
169
- operations,
170
- ItemRenderer,
171
- enableImagePreview,
172
- onActivate,
173
- onClose,
174
- onCancelTransfer,
175
- onOpenPreview,
176
- }) => {
177
- const state = getProgressState(transferItem.progress)
178
- const isPreviewable = enableImagePreview && transferItem.progress === 'done' && isImageFile(transferItem)
158
+ export const QueueItemContent: FC<IQueueItemContent> = (props) => {
159
+ const { transferItem, enableImagePreview, onCancelTransfer, onOpenPreview, disabled } = props
160
+ const state = sharedGetProgressState(transferItem.progress)
161
+ const isPreviewable = enableImagePreview && transferItem.progress === 'done' && isImageFileLike(transferItem)
179
162
 
180
163
  switch (state) {
181
164
  case 'in-progress':
182
165
  return (
183
166
  <TransferInProgress
184
- aria-live="off"
185
167
  transferItem={transferItem as TTransferItemInProgress}
186
168
  cancelTransfer={() => onCancelTransfer(transferItem.fileId)}
169
+ disabled={disabled}
187
170
  />
188
171
  )
189
172
  case 'error':
190
- return <TransferError transferItem={transferItem} onRemove={() => onCancelTransfer(transferItem.fileId)} />
173
+ return (
174
+ <TransferError
175
+ transferItem={transferItem}
176
+ onRemove={() => onCancelTransfer(transferItem.fileId)}
177
+ disabled={disabled}
178
+ />
179
+ )
191
180
  case 'idle':
192
181
  return (
193
182
  <IdleStateContent
194
- transferItem={transferItem}
195
- activatedOperation={activatedOperation}
196
- operations={operations}
197
- ItemRenderer={ItemRenderer}
198
- onActivate={onActivate}
199
- onClose={onClose}
183
+ {...props}
200
184
  onPreviewClick={isPreviewable ? () => onOpenPreview(transferItem.fileId) : undefined}
201
185
  />
202
186
  )
203
187
  }
204
188
  }
189
+