@onehat/ui 0.4.34 → 0.4.37

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.
@@ -45,17 +45,16 @@ function FileCardCustom(props) {
45
45
  uploadStatus,
46
46
  } = props,
47
47
  isDownloading = uploadStatus && inArray(uploadStatus, ['preparing', 'uploading', 'success']);
48
- return (
49
- <Pressable
50
- onPress={() => {
51
- downloadInBackground(downloadUrl);
52
- }}
53
- className="px-3 py-1 items-center flex-row rounded-[5px] border border-primary.700">
54
- {isDownloading && <Spinner className="mr-2" />}
55
- <Text>{filename}</Text>
56
- {onDelete && <IconButton ml={1} icon={Xmark} onPress={() => onDelete(id)} />}
57
- </Pressable>
58
- );
48
+ return <Pressable
49
+ onPress={() => {
50
+ downloadInBackground(downloadUrl);
51
+ }}
52
+ className="px-3 py-1 items-center flex-row rounded-[5px] border border-primary.700"
53
+ >
54
+ {isDownloading && <Spinner className="mr-2" />}
55
+ <Text>{filename}</Text>
56
+ {onDelete && <IconButton ml={1} icon={Xmark} onPress={() => onDelete(id)} />}
57
+ </Pressable>;
59
58
  }
60
59
 
61
60
 
@@ -183,8 +182,9 @@ function AttachmentsElement(props) {
183
182
  }
184
183
  },
185
184
  onFileDelete = (id) => {
185
+ const file = _.find(files, { id });
186
186
  if (confirmBeforeDelete) {
187
- confirm('Are you sure you want to delete the file?', () => doDelete(id));
187
+ confirm('Are you sure you want to delete the file "' + file.name + '"?', () => doDelete(id));
188
188
  } else {
189
189
  doDelete(id);
190
190
  }
@@ -282,12 +282,19 @@ function AttachmentsElement(props) {
282
282
  if (canCrud) {
283
283
  _fileMosaic.onDelete = onFileDelete;
284
284
  }
285
- let className = 'w-full p-1 bg-white rounded-[5px]';
285
+ let className = `
286
+ AttachmentsElement
287
+ w-full
288
+ h-full
289
+ p-1
290
+ rounded-[5px]
291
+ `;
286
292
  if (props.className) {
287
293
  className += ' ' + props.className;
288
294
  }
289
295
  let content = <VStack className={className}>
290
- <HStack className="flex-wrap">
296
+ <HStack className="AttachmentsElement-HStack flex-wrap">
297
+ {files.length === 0 && <Text className="text-grey-600 italic">No files</Text>}
291
298
  {files.map((file) => {
292
299
  return <Box
293
300
  key={file.id}
@@ -312,7 +319,7 @@ function AttachmentsElement(props) {
312
319
  {Repository.total <= collapsedMax ? null :
313
320
  <Button
314
321
  onPress={toggleShowAll}
315
- className="mt-2"
322
+ className="AttachmentsElement-toggleShowAll mt-2"
316
323
  text={'Show ' + (showAll ? ' Less' : ' All ' + Repository.total)}
317
324
  _text={{
318
325
  className: `