@omniumretail/component-library 1.1.52 → 1.1.54
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/dist/bundle.js +1 -1
- package/dist/main.css +3 -2
- package/dist/types/components/CategoryResponse/index.d.ts +3 -1
- package/dist/types/components/Questions/SingleQuestion/index.d.ts +1 -1
- package/dist/types/components/Questions/index.d.ts +1 -0
- package/dist/types/components/Upload/index.d.ts +3 -0
- package/package.json +1 -1
- package/src/components/Category/Category.stories.tsx +13 -0
- package/src/components/Category/CategoryContent/index.tsx +19 -27
- package/src/components/Category/CategoryContent/styles.module.scss +1 -0
- package/src/components/CategoryResponse/CategoryResponse.stories.tsx +8 -4
- package/src/components/CategoryResponse/index.tsx +121 -24
- package/src/components/CategoryResponse/styles.module.scss +85 -0
- package/src/components/Navigation/Navigation.stories.tsx +1 -2
- package/src/components/Questions/SingleQuestion/index.tsx +19 -2
- package/src/components/Questions/SingleQuestion/styles.module.scss +8 -0
- package/src/components/Questions/index.tsx +5 -2
- package/src/components/Upload/index.tsx +23 -5
- package/src/components/Upload/styles.module.scss +29 -0
- package/src/locales/en.json +13 -3
- package/src/locales/es.json +13 -3
- package/src/locales/pt.json +12 -2
|
@@ -11,13 +11,15 @@ export interface QuestionsProps {
|
|
|
11
11
|
showGrade?: boolean;
|
|
12
12
|
showCheckbox?: boolean;
|
|
13
13
|
handleChanges: any;
|
|
14
|
+
responseTypeOptions: any;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export const Questions = (props: QuestionsProps) => {
|
|
17
18
|
const {
|
|
18
19
|
showGrade = true,
|
|
19
20
|
showCheckbox,
|
|
20
|
-
handleChanges
|
|
21
|
+
handleChanges,
|
|
22
|
+
responseTypeOptions
|
|
21
23
|
} = props;
|
|
22
24
|
|
|
23
25
|
const formContext = useContext(FieldContext);
|
|
@@ -57,7 +59,8 @@ export const Questions = (props: QuestionsProps) => {
|
|
|
57
59
|
name={name}
|
|
58
60
|
showGrade={showGrade}
|
|
59
61
|
showCheckbox={showCheckbox}
|
|
60
|
-
handleChanges={handleChanges}
|
|
62
|
+
handleChanges={handleChanges}
|
|
63
|
+
responseTypeOptions={responseTypeOptions}
|
|
61
64
|
/>
|
|
62
65
|
</>
|
|
63
66
|
)}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import styles from './styles.module.scss';
|
|
1
2
|
import { Upload as UploadAntd } from 'antd';
|
|
2
3
|
import ImgCrop from 'antd-img-crop';
|
|
3
4
|
import type { RcFile, UploadFile, UploadProps } from 'antd/es/upload/interface';
|
|
4
|
-
import {
|
|
5
|
+
import { Button } from '../Button';
|
|
6
|
+
import { Dispatch, SetStateAction, useEffect, useState } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
5
8
|
|
|
6
9
|
interface UploadPropsExtended extends UploadProps {
|
|
7
10
|
onImageChange?: (file: UploadFile | null) => void;
|
|
8
11
|
initialFileList?: UploadFile[];
|
|
9
12
|
initialImageUrl?: string;
|
|
10
13
|
disable?: boolean;
|
|
14
|
+
file?: boolean;
|
|
15
|
+
setFiles?: Dispatch<SetStateAction<UploadFile<any>[]>> | any;
|
|
11
16
|
}
|
|
12
17
|
|
|
13
18
|
function generateRandomString() {
|
|
@@ -19,8 +24,11 @@ export const Upload = (props: UploadPropsExtended) => {
|
|
|
19
24
|
onImageChange,
|
|
20
25
|
initialFileList,
|
|
21
26
|
initialImageUrl,
|
|
22
|
-
disable
|
|
27
|
+
disable,
|
|
28
|
+
setFiles
|
|
23
29
|
} = props;
|
|
30
|
+
|
|
31
|
+
const { t } = useTranslation();
|
|
24
32
|
const [fileList, setFileList] = useState<UploadFile[]>(initialFileList || []);
|
|
25
33
|
|
|
26
34
|
// when component mounts or initialImageUrl changes, update fileList
|
|
@@ -36,6 +44,12 @@ export const Upload = (props: UploadPropsExtended) => {
|
|
|
36
44
|
}
|
|
37
45
|
}, [initialImageUrl]);
|
|
38
46
|
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (setFiles) {
|
|
49
|
+
setFiles(fileList);
|
|
50
|
+
}
|
|
51
|
+
}, [fileList, setFiles]);
|
|
52
|
+
|
|
39
53
|
const beforeUpload: UploadProps['beforeUpload'] = async (file: RcFile) => {
|
|
40
54
|
const newFile: UploadFile = {
|
|
41
55
|
uid: file.uid,
|
|
@@ -45,7 +59,7 @@ export const Upload = (props: UploadPropsExtended) => {
|
|
|
45
59
|
originFileObj: file,
|
|
46
60
|
status: 'done',
|
|
47
61
|
};
|
|
48
|
-
|
|
62
|
+
|
|
49
63
|
setFileList((prevFileList) => [...prevFileList, newFile]);
|
|
50
64
|
if (onImageChange) {
|
|
51
65
|
onImageChange(newFile);
|
|
@@ -80,14 +94,18 @@ export const Upload = (props: UploadPropsExtended) => {
|
|
|
80
94
|
return (
|
|
81
95
|
<ImgCrop rotationSlider>
|
|
82
96
|
<UploadAntd
|
|
83
|
-
listType="picture-card"
|
|
97
|
+
listType={props.file ? "text" : "picture-card"}
|
|
84
98
|
fileList={fileList}
|
|
85
99
|
beforeUpload={beforeUpload}
|
|
86
100
|
onChange={onChange}
|
|
87
101
|
onPreview={onPreview}
|
|
88
102
|
disabled={disable}
|
|
89
103
|
>
|
|
90
|
-
{
|
|
104
|
+
{props.file
|
|
105
|
+
? <Button customClass={styles.loadFile}>{t('components.upload.loadFile')}</Button>
|
|
106
|
+
|
|
107
|
+
: fileList.length < 1 && '+ Upload'
|
|
108
|
+
}
|
|
91
109
|
</UploadAntd>
|
|
92
110
|
</ImgCrop>
|
|
93
111
|
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.loadFile {
|
|
2
|
+
color: var(--color-black);
|
|
3
|
+
background-color: var(--color-white);
|
|
4
|
+
border: 1px var(--color-black) solid;
|
|
5
|
+
min-width: 100px;
|
|
6
|
+
height: 20px;
|
|
7
|
+
font-size: 10px;
|
|
8
|
+
padding: unset;
|
|
9
|
+
|
|
10
|
+
@media(max-width: 767px) {
|
|
11
|
+
min-width: 0px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&:hover {
|
|
15
|
+
background-color: var(--color-grey-light);
|
|
16
|
+
color: var(--color-black) !important;
|
|
17
|
+
border: 1px var(--color-black) solid !important;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:global {
|
|
22
|
+
.ant-upload-wrapper {
|
|
23
|
+
line-height: 12px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ant-upload-wrapper .ant-upload-list .ant-upload-list-item {
|
|
27
|
+
max-width: 100px;
|
|
28
|
+
}
|
|
29
|
+
}
|
package/src/locales/en.json
CHANGED
|
@@ -46,7 +46,9 @@
|
|
|
46
46
|
"errorGrade": "Error/Missing Grade",
|
|
47
47
|
"newCategory": "New Category",
|
|
48
48
|
"mandatoryAnswer": "Mandatory answer",
|
|
49
|
-
"emphasisAnswer": "Highlight"
|
|
49
|
+
"emphasisAnswer": "Highlight",
|
|
50
|
+
"responseType": "Response Type",
|
|
51
|
+
"errorResponseType": "Response type missing"
|
|
50
52
|
},
|
|
51
53
|
"categorySidBar": {
|
|
52
54
|
"addCategory": "Add Category",
|
|
@@ -67,7 +69,12 @@
|
|
|
67
69
|
"notApplicable": "Not Applicable",
|
|
68
70
|
"answer": "Answer",
|
|
69
71
|
"yes": "Yes",
|
|
70
|
-
"no": "No"
|
|
72
|
+
"no": "No",
|
|
73
|
+
"note": "Note",
|
|
74
|
+
"actions": "Actions",
|
|
75
|
+
"editNote": "Edit Note",
|
|
76
|
+
"addNote": "Add Note",
|
|
77
|
+
"createAction": "Create Action"
|
|
71
78
|
},
|
|
72
79
|
"categoryReadOnly": {
|
|
73
80
|
"categories": "Categories",
|
|
@@ -95,6 +102,9 @@
|
|
|
95
102
|
"takePhoto": "Take Photo",
|
|
96
103
|
"confirm": "Confirm",
|
|
97
104
|
"takeAgain": "Take Again"
|
|
98
|
-
}
|
|
105
|
+
},
|
|
106
|
+
"upload": {
|
|
107
|
+
"loadFile": "Upload file"
|
|
108
|
+
}
|
|
99
109
|
}
|
|
100
110
|
}
|
package/src/locales/es.json
CHANGED
|
@@ -46,7 +46,9 @@
|
|
|
46
46
|
"errorGrade": "Error/Calificación Faltante",
|
|
47
47
|
"newCategory": "Nueva Categoría",
|
|
48
48
|
"mandatoryAnswer": "Respuesta obligatoria",
|
|
49
|
-
"emphasisAnswer": "Resaltar"
|
|
49
|
+
"emphasisAnswer": "Resaltar",
|
|
50
|
+
"responseType": "Tipo de respuesta",
|
|
51
|
+
"errorResponseType": "Tipo de respuesta faltante"
|
|
50
52
|
},
|
|
51
53
|
"categorySidBar": {
|
|
52
54
|
"addCategory": "Agregar Categoría",
|
|
@@ -67,7 +69,12 @@
|
|
|
67
69
|
"notApplicable": "No Aplicable",
|
|
68
70
|
"answer": "Respuesta",
|
|
69
71
|
"yes": "Si",
|
|
70
|
-
"no": "No"
|
|
72
|
+
"no": "No",
|
|
73
|
+
"note": "Nota",
|
|
74
|
+
"actions": "Acciones",
|
|
75
|
+
"editNote": "Editar Nota",
|
|
76
|
+
"addNote": "Agregar Nota",
|
|
77
|
+
"createAction": "Crear Acción"
|
|
71
78
|
},
|
|
72
79
|
"categoryReadOnly": {
|
|
73
80
|
"categories": "Categorías",
|
|
@@ -95,6 +102,9 @@
|
|
|
95
102
|
"takePhoto": "Tomar foto",
|
|
96
103
|
"confirm": "Confirme",
|
|
97
104
|
"takeAgain": "Tomar de nuevo"
|
|
98
|
-
}
|
|
105
|
+
},
|
|
106
|
+
"upload": {
|
|
107
|
+
"loadFile": "Cargar archivo"
|
|
108
|
+
}
|
|
99
109
|
}
|
|
100
110
|
}
|
package/src/locales/pt.json
CHANGED
|
@@ -46,7 +46,9 @@
|
|
|
46
46
|
"errorGrade": "Ponderação em falta",
|
|
47
47
|
"newCategory": "Nova categoria",
|
|
48
48
|
"mandatoryAnswer": "Resposta obrigatória",
|
|
49
|
-
"emphasisAnswer": "Destaque"
|
|
49
|
+
"emphasisAnswer": "Destaque",
|
|
50
|
+
"responseType": "Tipo de resposta",
|
|
51
|
+
"errorResponseType": "Tipo de resposta em falta"
|
|
50
52
|
},
|
|
51
53
|
"categorySidBar": {
|
|
52
54
|
"addCategory": "Adicionar categoria",
|
|
@@ -67,7 +69,12 @@
|
|
|
67
69
|
"notApplicable": "Não Aplicável",
|
|
68
70
|
"answer": "Resposta",
|
|
69
71
|
"yes": "Sim",
|
|
70
|
-
"no": "Não"
|
|
72
|
+
"no": "Não",
|
|
73
|
+
"note": "Nota",
|
|
74
|
+
"actions": "Ações",
|
|
75
|
+
"editNote": "Editar Nota",
|
|
76
|
+
"addNote": "Adicionar Nota",
|
|
77
|
+
"createAction": "Criar ação"
|
|
71
78
|
},
|
|
72
79
|
"categoryReadOnly": {
|
|
73
80
|
"categories": "Categorias",
|
|
@@ -95,6 +102,9 @@
|
|
|
95
102
|
"takePhoto": "Tirar Foto",
|
|
96
103
|
"confirm": "Confirmar",
|
|
97
104
|
"takeAgain": "Tirar Novamente"
|
|
105
|
+
},
|
|
106
|
+
"upload": {
|
|
107
|
+
"loadFile": "Carregar ficheiro"
|
|
98
108
|
}
|
|
99
109
|
}
|
|
100
110
|
}
|