tycho-components 0.15.7 → 0.15.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.
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { forwardRef, useContext, useEffect, useImperativeHandle, useRef, useState, } from 'react';
3
3
  import Dropzone from 'react-dropzone';
4
4
  import { useTranslation } from 'react-i18next';
@@ -61,7 +61,10 @@ function AppDropzoneBodyInner({ folder, onSuccess, onError, accept, onDrop, keep
61
61
  setFile(files[0]);
62
62
  onDrop?.();
63
63
  };
64
- return (_jsxs("div", { className: "dropzone-container", children: [!file && (_jsx(Dropzone, { onDrop: (acceptedFiles) => handleDrop(acceptedFiles), accept: accept, maxFiles: 1, children: ({ getRootProps, getInputProps }) => (_jsxs("div", { ...getRootProps(), className: "dropzone", children: [_jsx("input", { ...getInputProps() }), _jsx("span", { children: t('label.dropzone') })] })) })), file && preview && _jsx("img", { className: "preview", src: preview, alt: "" }), file && !preview && (_jsxs("div", { className: "uploaded-message", children: [_jsx("b", { children: t('label.uploaded.file') }), _jsx("span", { children: file.name }), _jsx("b", { children: t('label.confirm') })] })), file && showConfirmButton && (_jsx(Button, { onClick: upload, text: t('common:button.confirm') }))] }));
64
+ const handleCancel = () => {
65
+ setFile(undefined);
66
+ };
67
+ return (_jsxs("div", { className: "dropzone-container", children: [!file && (_jsx(Dropzone, { onDrop: (acceptedFiles) => handleDrop(acceptedFiles), accept: accept, maxFiles: 1, children: ({ getRootProps, getInputProps }) => (_jsxs("div", { ...getRootProps(), className: "dropzone", children: [_jsx("input", { ...getInputProps() }), _jsx("span", { children: t('label.dropzone') })] })) })), file && (_jsxs("div", { className: "uploaded-file", children: [preview && _jsx("img", { className: "preview", src: preview, alt: "" }), !preview && (_jsxs(_Fragment, { children: [_jsx("b", { children: t('label.uploaded.file') }), _jsx("span", { children: file.name })] })), showConfirmButton && (_jsxs("div", { className: "buttons", children: [_jsx(Button, { onClick: handleCancel, text: t('common:button.cancel'), size: "small", mode: "outlined", color: "danger" }), _jsx(Button, { onClick: upload, text: t('label.confirm'), size: "small", mode: "outlined" })] }))] }))] }));
65
68
  }
66
69
  const AppDropzoneBody = forwardRef(AppDropzoneBodyInner);
67
70
  export default AppDropzoneBody;
@@ -22,14 +22,20 @@
22
22
  height: 400px;
23
23
  }
24
24
 
25
- .uploaded-message {
25
+ .uploaded-file {
26
26
  display: flex;
27
27
  flex-direction: column;
28
+ align-items: center;
28
29
  width: 100%;
29
- gap: 16px;
30
+ gap: 24px;
30
31
  text-align: center;
31
32
  border: 1px solid var(--border-subtle-3);
32
33
  border-radius: var(--radius-100);
33
34
  padding: 16px;
34
35
  }
36
+
37
+ .buttons {
38
+ display: flex;
39
+ gap: 16px;
40
+ }
35
41
  }
@@ -2,21 +2,21 @@ export const UploadTexts = {
2
2
  en: {
3
3
  'label.dropzone': 'Drag and drop or click to upload a file',
4
4
  'label.uploaded.file': 'You are uploading the following file',
5
- 'label.confirm': 'Press confirm to continue',
5
+ 'label.confirm': 'Confirm to upload the file',
6
6
  'modal.title': 'Upload a file',
7
7
  'error.uploading.image': 'An error occurred while uploading a file. Contact the administrator.',
8
8
  },
9
9
  'pt-BR': {
10
10
  'label.dropzone': 'Arraste e solte ou clique para enviar um arquivo.',
11
11
  'label.uploaded.file': 'Você está enviando o seguinte arquivo',
12
- 'label.confirm': 'Pressione confirmar para continuar',
12
+ 'label.confirm': 'Confirme para enviar o arquivo',
13
13
  'modal.title': 'Upload de arquivo',
14
14
  'error.uploading.image': 'Ocorreu um erro ao enviar o arquivo. Entre em contato com o administrador.',
15
15
  },
16
16
  it: {
17
17
  'label.dropzone': 'Trascina e rilascia o clicca per caricare un file',
18
18
  'label.uploaded.file': 'Stai caricando il seguente file',
19
- 'label.confirm': 'Premi conferma per continuare',
19
+ 'label.confirm': 'Conferma per caricare il file',
20
20
  'modal.title': 'Carica un file',
21
21
  'error.uploading.image': "Si è verificato un errore durante il caricamento del file. Contatta l'amministratore.",
22
22
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.15.7",
4
+ "version": "0.15.9",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {