contentoh-components-library 21.2.90 → 21.2.91
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/.env.development +3 -0
- package/dist/assets/fonts/Roboto/Roboto-Medium.ttf +0 -0
- package/dist/assets/fonts/Roboto/Roboto-Regular.ttf +0 -0
- package/dist/assets/images/defaultImages/Spinner.gif +0 -0
- package/dist/assets/images/defaultImages/notFound.svg +124 -0
- package/dist/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +72 -0
- package/dist/components/atoms/ButtonFileChooser/index.js +118 -0
- package/dist/components/atoms/ButtonFileChooser/styles.js +20 -0
- package/dist/components/atoms/ButtonV2/ButtonV2.stories.js +66 -0
- package/dist/components/atoms/ButtonV2/index.js +111 -0
- package/dist/components/atoms/ButtonV2/styles.js +53 -0
- package/dist/components/atoms/CustomIcon/CustomIcon.stories.js +50 -0
- package/dist/components/atoms/CustomIcon/index.js +40 -0
- package/dist/components/atoms/CustomIcon/styles.js +33 -0
- package/dist/components/atoms/IconFile/IconFile.stories.js +48 -0
- package/dist/components/atoms/IconFile/index.js +249 -0
- package/dist/components/atoms/IconFile/styles.js +23 -0
- package/dist/components/atoms/Image/Image.stories.js +63 -0
- package/dist/components/atoms/Image/index.js +74 -0
- package/dist/components/atoms/Image/styles.js +40 -0
- package/dist/components/atoms/ImageLink/ImageLink.stories.js +63 -0
- package/dist/components/atoms/ImageLink/index.js +77 -0
- package/dist/components/atoms/ImageLink/styles.js +40 -0
- package/dist/components/atoms/ImagePreview/ImagePreview.stories.js +70 -0
- package/dist/components/atoms/ImagePreview/index.js +222 -0
- package/dist/components/atoms/ImagePreview/styles.js +44 -0
- package/dist/components/atoms/InputText/InputText.stories.js +60 -0
- package/dist/components/atoms/InputText/index.js +66 -0
- package/dist/components/atoms/InputText/styles.js +32 -0
- package/dist/components/atoms/NotFound/NotFound.stories.js +36 -0
- package/dist/components/atoms/NotFound/index.js +75 -0
- package/dist/components/atoms/NotFound/styles.js +20 -0
- package/dist/components/atoms/Tooltip/Tooltip.stories.js +35 -5
- package/dist/components/atoms/Tooltip/index.js +41 -24
- package/dist/components/atoms/Tooltip/styles.js +3 -1
- package/dist/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +66 -0
- package/dist/components/molecules/ButtonDownloadFile/index.js +179 -0
- package/dist/components/molecules/ButtonDownloadFile/styles.js +23 -0
- package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +21 -22
- package/dist/components/molecules/CustomSelect/SelectItem.js +10 -1
- package/dist/components/molecules/HeaderTop/index.js +10 -5
- package/dist/components/molecules/HeaderTop/styles.js +1 -1
- package/dist/components/molecules/ImageTooltip/ImageTooltip.stories.js +72 -0
- package/dist/components/molecules/ImageTooltip/index.js +84 -0
- package/dist/components/molecules/ImageTooltip/styles.js +33 -0
- package/dist/components/organisms/Chat/Chat.stories.js +215 -0
- package/dist/components/organisms/Chat/ChatLists/ChatLists.stories.js +83 -0
- package/dist/components/organisms/Chat/ChatLists/index.js +160 -0
- package/dist/components/organisms/Chat/ChatLists/styles.js +29 -0
- package/dist/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +176 -0
- package/dist/components/organisms/Chat/ContainerItems/index.js +569 -0
- package/dist/components/organisms/Chat/ContainerItems/styles.js +20 -0
- package/dist/components/organisms/Chat/ContentChat/ContentChat.stories.js +142 -0
- package/dist/components/organisms/Chat/ContentChat/index.js +1422 -0
- package/dist/components/organisms/Chat/ContentChat/styles.js +20 -0
- package/dist/components/organisms/Chat/Footer/Footer.stories.js +43 -0
- package/dist/components/organisms/Chat/Footer/index.js +984 -0
- package/dist/components/organisms/Chat/Footer/styles.js +32 -0
- package/dist/components/organisms/Chat/Header/Header.stories.js +96 -0
- package/dist/components/organisms/Chat/Header/index.js +84 -0
- package/dist/components/organisms/Chat/Header/styles.js +20 -0
- package/dist/components/organisms/Chat/index.js +327 -0
- package/dist/components/organisms/Chat/styles.js +29 -0
- package/dist/components/organisms/Modal/Modal.stories.js +66 -0
- package/dist/components/organisms/Modal/index.js +95 -0
- package/dist/components/organisms/Modal/styles.js +20 -0
- package/dist/global-files/fonts.css +18 -0
- package/dist/global-files/handle_http.js +383 -0
- package/dist/global-files/utils.js +472 -0
- package/dist/global-files/variables.js +3 -1
- package/dist/index.js +227 -45
- package/package.json +13 -1
- package/src/assets/fonts/Roboto/Roboto-Medium.ttf +0 -0
- package/src/assets/fonts/Roboto/Roboto-Regular.ttf +0 -0
- package/src/assets/images/customSelect/starIcon.svg +14 -0
- package/src/assets/images/defaultImages/Spinner.gif +0 -0
- package/src/assets/images/defaultImages/notFound.svg +124 -0
- package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +47 -0
- package/src/components/atoms/ButtonFileChooser/index.js +69 -0
- package/src/components/atoms/ButtonFileChooser/styles.js +4 -0
- package/src/components/atoms/ButtonV2/ButtonV2.stories.js +50 -0
- package/src/components/atoms/ButtonV2/index.js +74 -0
- package/src/components/atoms/ButtonV2/styles.js +187 -0
- package/src/components/atoms/CustomIcon/CustomIcon.stories.js +36 -0
- package/src/components/atoms/CustomIcon/index.js +41 -0
- package/src/components/atoms/CustomIcon/styles.js +85 -0
- package/src/components/atoms/IconFile/IconFile.stories.js +35 -0
- package/src/components/atoms/IconFile/index.js +119 -0
- package/src/components/atoms/IconFile/styles.js +67 -0
- package/src/components/atoms/Image/Image.stories.js +43 -0
- package/src/components/atoms/Image/index.js +54 -0
- package/src/components/atoms/Image/styles.js +25 -0
- package/src/components/atoms/ImageLink/ImageLink.stories.js +43 -0
- package/src/components/atoms/ImageLink/index.js +57 -0
- package/src/components/atoms/ImageLink/styles.js +30 -0
- package/src/components/atoms/ImagePreview/ImagePreview.stories.js +52 -0
- package/src/components/atoms/ImagePreview/index.js +191 -0
- package/src/components/atoms/ImagePreview/styles.js +77 -0
- package/src/components/atoms/InputText/InputText.stories.js +39 -0
- package/src/components/atoms/InputText/index.js +61 -0
- package/src/components/atoms/InputText/styles.js +89 -0
- package/src/components/atoms/NotFound/NotFound.stories.js +19 -0
- package/src/components/atoms/NotFound/index.js +52 -0
- package/src/components/atoms/NotFound/styles.js +55 -0
- package/src/components/atoms/Tooltip/Tooltip.stories.js +51 -0
- package/src/components/atoms/Tooltip/index.js +59 -0
- package/src/components/atoms/Tooltip/styles.js +42 -0
- package/src/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +54 -0
- package/src/components/molecules/ButtonDownloadFile/index.js +111 -0
- package/src/components/molecules/ButtonDownloadFile/styles.js +66 -0
- package/src/components/molecules/CustomSelect/CustomSelect.stories.js +20 -12
- package/src/components/molecules/CustomSelect/SelectItem.js +7 -0
- package/src/components/molecules/HeaderTop/index.js +11 -6
- package/src/components/molecules/HeaderTop/styles.js +4 -0
- package/src/components/molecules/ImageTooltip/ImageTooltip.stories.js +46 -0
- package/src/components/molecules/ImageTooltip/index.js +62 -0
- package/src/components/molecules/ImageTooltip/styles.js +18 -0
- package/src/components/organisms/Chat/Chat.stories.js +199 -0
- package/src/components/organisms/Chat/ChatLists/ChatLists.stories.js +65 -0
- package/src/components/organisms/Chat/ChatLists/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chat/ChatLists/THD.png +0 -0
- package/src/components/organisms/Chat/ChatLists/index.js +141 -0
- package/src/components/organisms/Chat/ChatLists/styles.js +162 -0
- package/src/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +142 -0
- package/src/components/organisms/Chat/ContainerItems/index.js +549 -0
- package/src/components/organisms/Chat/ContainerItems/styles.js +328 -0
- package/src/components/organisms/Chat/ContentChat/ContentChat.stories.js +102 -0
- package/src/components/organisms/Chat/ContentChat/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chat/ContentChat/THD.png +0 -0
- package/src/components/organisms/Chat/ContentChat/index.js +900 -0
- package/src/components/organisms/Chat/ContentChat/styles.js +41 -0
- package/src/components/organisms/Chat/Footer/Footer.stories.js +22 -0
- package/src/components/organisms/Chat/Footer/index.js +669 -0
- package/src/components/organisms/Chat/Footer/styles.js +286 -0
- package/src/components/organisms/Chat/Header/Header.stories.js +66 -0
- package/src/components/organisms/Chat/Header/index.js +94 -0
- package/src/components/organisms/Chat/Header/styles.js +49 -0
- package/src/components/organisms/Chat/index.js +294 -0
- package/src/components/organisms/Chat/styles.js +42 -0
- package/src/components/organisms/Modal/Modal.stories.js +55 -0
- package/src/components/organisms/Modal/index.js +97 -0
- package/src/components/organisms/Modal/styles.js +103 -0
- package/src/global-files/fonts.css +18 -0
- package/src/global-files/handle_http.js +231 -0
- package/src/global-files/utils.js +300 -0
- package/src/global-files/variables.js +2 -0
- package/src/index.js +14 -0
- package/dist/components/atoms/ChatPopUp/ChatPopUp.stories.js +0 -28
- package/dist/components/atoms/ChatPopUp/index.js +0 -841
- package/dist/components/atoms/ChatPopUp/styles.js +0 -27
- package/dist/components/atoms/ChatPopUp/utils/handlersChat.js +0 -182
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { Container, ContainerLoading, ContainerModalImg, Img } from "./styles";
|
|
2
|
+
import { FontAwesomeIcon as Icon } from "@fortawesome/react-fontawesome";
|
|
3
|
+
import {
|
|
4
|
+
faSpinner as iconLoading,
|
|
5
|
+
faArrowDown as IconDownload,
|
|
6
|
+
} from "@fortawesome/free-solid-svg-icons";
|
|
7
|
+
import { useState, useEffect } from "react";
|
|
8
|
+
import { Fade, Grow, Modal as ModalMUI, Zoom } from "@mui/material";
|
|
9
|
+
import { Modal } from "../../organisms/Modal";
|
|
10
|
+
import { ButtonV2 } from "../ButtonV2";
|
|
11
|
+
import axios from "axios";
|
|
12
|
+
import { Image } from "../Image";
|
|
13
|
+
|
|
14
|
+
export const ImagePreview = (props) => {
|
|
15
|
+
const {
|
|
16
|
+
className, // string
|
|
17
|
+
width, // string
|
|
18
|
+
sizeLoading, // number
|
|
19
|
+
colorLoading, // string
|
|
20
|
+
downloadImgURL, // URL de la imagen a descargar (string)
|
|
21
|
+
imgURL, // imagen a cargar (string)
|
|
22
|
+
modalImgURL, // imagen a cargar (string) para el modo full
|
|
23
|
+
imageName, // nombre del file
|
|
24
|
+
showButtonDownload, // boolean
|
|
25
|
+
componentDefault, // componente a mostrar en caso de que no cargue src (JSX)
|
|
26
|
+
componentDefaultModal, // componente a mostrar en el modal en caso de que no cargue srcModal (JSX)
|
|
27
|
+
} = props;
|
|
28
|
+
const [imgLoad, setImgLoad] = useState();
|
|
29
|
+
const [imgLoadModal, setImgLoadModal] = useState();
|
|
30
|
+
const [loading, setLoading] = useState(false);
|
|
31
|
+
const [loadingDownload, setLoadingDownload] = useState(false);
|
|
32
|
+
const [showModalImg, setShowModalImg] = useState(false);
|
|
33
|
+
const [modalAlert, setModalAlert] = useState({
|
|
34
|
+
show: false,
|
|
35
|
+
title: "",
|
|
36
|
+
message:
|
|
37
|
+
"Ocurrió un error al descargar la imagen ¿Quieres intentarlo de nuevo?",
|
|
38
|
+
icon: "info",
|
|
39
|
+
buttons: [
|
|
40
|
+
<ButtonV2
|
|
41
|
+
key={"btn-No"}
|
|
42
|
+
type={"white"}
|
|
43
|
+
borderType={"oval"}
|
|
44
|
+
label={"No"}
|
|
45
|
+
size={12}
|
|
46
|
+
onClick={(event) => {
|
|
47
|
+
setModalAlert((prev) => ({
|
|
48
|
+
...prev,
|
|
49
|
+
show: false,
|
|
50
|
+
}));
|
|
51
|
+
}}
|
|
52
|
+
/>,
|
|
53
|
+
<ButtonV2
|
|
54
|
+
key={"btn-Intentar"}
|
|
55
|
+
type={"pink"}
|
|
56
|
+
borderType={"oval"}
|
|
57
|
+
label={"Intentar"}
|
|
58
|
+
size={12}
|
|
59
|
+
onClick={(event) => {
|
|
60
|
+
setModalAlert((prev) => ({
|
|
61
|
+
...prev,
|
|
62
|
+
show: false,
|
|
63
|
+
}));
|
|
64
|
+
getImage();
|
|
65
|
+
}}
|
|
66
|
+
/>,
|
|
67
|
+
],
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const getImage = () => {
|
|
71
|
+
//setLoadingDownload(true);
|
|
72
|
+
const link = document.createElement("a");
|
|
73
|
+
link.href = downloadImgURL;
|
|
74
|
+
link.setAttribute("download", imageName ?? "image");
|
|
75
|
+
link.style.display = "none";
|
|
76
|
+
link.onerror = () => {
|
|
77
|
+
setModalAlert((prev) => ({
|
|
78
|
+
...prev,
|
|
79
|
+
show: true,
|
|
80
|
+
}));
|
|
81
|
+
return;
|
|
82
|
+
};
|
|
83
|
+
document.body.appendChild(link);
|
|
84
|
+
link.click();
|
|
85
|
+
document.body.removeChild(link);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/* solo para hacer pruebas en modo dev
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
setLoading(false);
|
|
92
|
+
}, 5000);
|
|
93
|
+
}, []); */
|
|
94
|
+
/*
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
console.log("imgURL:", imgURL);
|
|
97
|
+
console.log("modalImgURL:", modalImgURL);
|
|
98
|
+
}, []);
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<Container className={className} width={width}>
|
|
103
|
+
{imgURL && (imgLoad === undefined || loading) && (
|
|
104
|
+
<ContainerLoading
|
|
105
|
+
className={"container-loading"}
|
|
106
|
+
sizeLoading={sizeLoading}
|
|
107
|
+
colorLoading={colorLoading}
|
|
108
|
+
>
|
|
109
|
+
<Icon className="icon" pulse icon={iconLoading} />
|
|
110
|
+
</ContainerLoading>
|
|
111
|
+
)}
|
|
112
|
+
|
|
113
|
+
{(!imgURL || (imgLoad === false && !loading)) && componentDefault}
|
|
114
|
+
|
|
115
|
+
<Img
|
|
116
|
+
show={imgLoad && !loading}
|
|
117
|
+
className="img"
|
|
118
|
+
src={imgURL}
|
|
119
|
+
onLoad={(event) => {
|
|
120
|
+
setImgLoad(true);
|
|
121
|
+
}}
|
|
122
|
+
onError={(event) => {
|
|
123
|
+
setImgLoad(false);
|
|
124
|
+
}}
|
|
125
|
+
onClick={(event) => {
|
|
126
|
+
setShowModalImg(true);
|
|
127
|
+
}}
|
|
128
|
+
/>
|
|
129
|
+
|
|
130
|
+
{/* modal que muestra la img en pantalla completa con
|
|
131
|
+
boton de download en caso de ser especificado */}
|
|
132
|
+
<ModalMUI
|
|
133
|
+
open={showModalImg}
|
|
134
|
+
disablePortal={true}
|
|
135
|
+
closeAfterTransition
|
|
136
|
+
componentsProps={{
|
|
137
|
+
root: {
|
|
138
|
+
className: "container-modal",
|
|
139
|
+
},
|
|
140
|
+
backdrop: {
|
|
141
|
+
timeout: 400,
|
|
142
|
+
className: "container-background",
|
|
143
|
+
},
|
|
144
|
+
}}
|
|
145
|
+
onClick={(event) => {
|
|
146
|
+
if (!loadingDownload) setShowModalImg(false);
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
<Fade in={showModalImg} timeout={400}>
|
|
150
|
+
<ContainerModalImg>
|
|
151
|
+
{/* icono download */}
|
|
152
|
+
{showButtonDownload && (
|
|
153
|
+
<div className="container-header">
|
|
154
|
+
<ButtonV2
|
|
155
|
+
className={"container-btnDownload"}
|
|
156
|
+
type={"pink"}
|
|
157
|
+
size={14}
|
|
158
|
+
borderType={"circle"}
|
|
159
|
+
icon={IconDownload}
|
|
160
|
+
isLoading={loadingDownload}
|
|
161
|
+
onClick={(event) => {
|
|
162
|
+
event.stopPropagation();
|
|
163
|
+
getImage();
|
|
164
|
+
}}
|
|
165
|
+
/>
|
|
166
|
+
</div>
|
|
167
|
+
)}
|
|
168
|
+
|
|
169
|
+
<Image
|
|
170
|
+
className="container-imgModal"
|
|
171
|
+
classNameImg="img"
|
|
172
|
+
sizeLoading={100}
|
|
173
|
+
colorLoading={"white"}
|
|
174
|
+
src={modalImgURL}
|
|
175
|
+
componentDefault={componentDefaultModal}
|
|
176
|
+
/>
|
|
177
|
+
</ContainerModalImg>
|
|
178
|
+
</Fade>
|
|
179
|
+
</ModalMUI>
|
|
180
|
+
|
|
181
|
+
{/* modal utilizado para alertar cuando falla la descarga */}
|
|
182
|
+
<Modal
|
|
183
|
+
show={modalAlert.show}
|
|
184
|
+
title={modalAlert.title}
|
|
185
|
+
message={modalAlert.message}
|
|
186
|
+
icon={modalAlert.icon}
|
|
187
|
+
buttons={modalAlert.buttons}
|
|
188
|
+
/>
|
|
189
|
+
</Container>
|
|
190
|
+
);
|
|
191
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { GlobalColors, FontFamily } from "../../../global-files/variables";
|
|
3
|
+
|
|
4
|
+
export const Container = styled.div`
|
|
5
|
+
display: grid;
|
|
6
|
+
place-items: center;
|
|
7
|
+
width: ${({ width }) => (width ? width : "min-content")};
|
|
8
|
+
min-width: min-content;
|
|
9
|
+
|
|
10
|
+
.container-modal {
|
|
11
|
+
.container-background {
|
|
12
|
+
background-color: rgba(0, 0, 0, 0.7);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
export const ContainerModalImg = styled.div`
|
|
18
|
+
width: 100vw;
|
|
19
|
+
height: 100vh;
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
align-items: center;
|
|
24
|
+
position: relative;
|
|
25
|
+
background-color: transparent;
|
|
26
|
+
|
|
27
|
+
.container-header {
|
|
28
|
+
position: absolute;
|
|
29
|
+
left: 0px;
|
|
30
|
+
top: 0px;
|
|
31
|
+
width: 100%;
|
|
32
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: row;
|
|
35
|
+
justify-content: flex-end;
|
|
36
|
+
align-items: center;
|
|
37
|
+
gap: 8px;
|
|
38
|
+
flex-wrap: wrap;
|
|
39
|
+
padding: 8px 10px;
|
|
40
|
+
|
|
41
|
+
.container-btnDownload {
|
|
42
|
+
width: 28px;
|
|
43
|
+
height: 28px;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
display: grid;
|
|
46
|
+
place-items: center;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.container-imgModal {
|
|
51
|
+
width: 100%;
|
|
52
|
+
height: 100%;
|
|
53
|
+
|
|
54
|
+
.img {
|
|
55
|
+
width: 100%;
|
|
56
|
+
max-height: 100vh;
|
|
57
|
+
object-fit: contain;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
|
|
62
|
+
export const ContainerLoading = styled.div`
|
|
63
|
+
width: 100%;
|
|
64
|
+
display: grid;
|
|
65
|
+
place-items: center;
|
|
66
|
+
min-width: min-content;
|
|
67
|
+
font-size: ${({ sizeLoading }) => (sizeLoading ? sizeLoading : "30")}px;
|
|
68
|
+
color: ${({ colorLoading }) => (colorLoading ? colorLoading : "#9e2674")};
|
|
69
|
+
padding: 5px;
|
|
70
|
+
`;
|
|
71
|
+
|
|
72
|
+
export const Img = styled.img`
|
|
73
|
+
display: ${({ show }) => (show ? "grid" : "none")};
|
|
74
|
+
width: 100%;
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
object-fit: contain;
|
|
77
|
+
`;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { InputText } from "./index";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/atoms/InputText",
|
|
5
|
+
component: InputText,
|
|
6
|
+
argTypes: {
|
|
7
|
+
type: {
|
|
8
|
+
options: [undefined, "white", "gray", "black"],
|
|
9
|
+
control: { type: "select" },
|
|
10
|
+
},
|
|
11
|
+
borderType: {
|
|
12
|
+
options: [undefined, "rectangle", "oval"],
|
|
13
|
+
control: { type: "select" },
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const Template = (args) => <InputText {...args} />;
|
|
19
|
+
|
|
20
|
+
export const InputTextTest = Template.bind({});
|
|
21
|
+
InputTextTest.args = {
|
|
22
|
+
type: undefined,
|
|
23
|
+
transparent: true,
|
|
24
|
+
size: "17",
|
|
25
|
+
borderType: undefined,
|
|
26
|
+
placeHolder: "ingresa el texto",
|
|
27
|
+
multiline: true,
|
|
28
|
+
maxRows: "5",
|
|
29
|
+
minRows: "1",
|
|
30
|
+
//label: "titulo",
|
|
31
|
+
disabled: false,
|
|
32
|
+
initialText: "",
|
|
33
|
+
onChangeText: (newText) => {
|
|
34
|
+
console.log(newText);
|
|
35
|
+
},
|
|
36
|
+
onEnter: (event) => {
|
|
37
|
+
console.log("evento enter");
|
|
38
|
+
},
|
|
39
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Container } from "./styles";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { TextField } from "@mui/material";
|
|
4
|
+
|
|
5
|
+
export const InputText = (props) => {
|
|
6
|
+
const {
|
|
7
|
+
id,
|
|
8
|
+
key,
|
|
9
|
+
className,
|
|
10
|
+
type, // gray | black => (default -> black)
|
|
11
|
+
transparent, // boolean
|
|
12
|
+
size, // number ... default (13)
|
|
13
|
+
borderType, // rectangle || circle || (cualquier otro valor -> no borde)
|
|
14
|
+
placeHolder, // (string) texto por defecto
|
|
15
|
+
multiline, // (boolean) true -> textarea false -> 1 linea
|
|
16
|
+
maxRows, // (number) maxima cantidad de rows visibles
|
|
17
|
+
minRows, // (number) cantidad de rows visibles minimos
|
|
18
|
+
//label, // (string) titulo del inputText
|
|
19
|
+
disabled, // (boolean) true -> bloqueado
|
|
20
|
+
text, // (string) texto del input
|
|
21
|
+
onChangeText, // (newText) => {}
|
|
22
|
+
onEnter, // (event) => {}
|
|
23
|
+
refInputText, // useRef()
|
|
24
|
+
} = props;
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
<Container
|
|
29
|
+
id={id}
|
|
30
|
+
key={key}
|
|
31
|
+
className={"container-inputText " + className}
|
|
32
|
+
borderType={borderType}
|
|
33
|
+
size={size}
|
|
34
|
+
>
|
|
35
|
+
<TextField
|
|
36
|
+
className={
|
|
37
|
+
"inputText " +
|
|
38
|
+
(["gray", "white", "black"].includes(type) ? type : "white") +
|
|
39
|
+
(transparent ? " transparent" : " fill")
|
|
40
|
+
}
|
|
41
|
+
multiline={multiline}
|
|
42
|
+
inputRef={refInputText}
|
|
43
|
+
disabled={disabled}
|
|
44
|
+
placeholder={placeHolder}
|
|
45
|
+
label={undefined}
|
|
46
|
+
minRows={minRows}
|
|
47
|
+
maxRows={maxRows}
|
|
48
|
+
variant="outlined"
|
|
49
|
+
value={text}
|
|
50
|
+
onChange={(event) => onChangeText && onChangeText(event.target.value)}
|
|
51
|
+
onKeyDown={(event) => {
|
|
52
|
+
if (event.key == "Enter" && !event.shiftKey) {
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
onEnter && onEnter(event);
|
|
55
|
+
}
|
|
56
|
+
}}
|
|
57
|
+
/>
|
|
58
|
+
</Container>
|
|
59
|
+
</>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { GlobalColors, FontFamily } from "../../../global-files/variables";
|
|
3
|
+
|
|
4
|
+
export const Container = styled.div`
|
|
5
|
+
width: fit-content;
|
|
6
|
+
min-width: min-content;
|
|
7
|
+
//border: 1px solid red;
|
|
8
|
+
|
|
9
|
+
.inputText {
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
|
|
13
|
+
// container interno del input o textarea
|
|
14
|
+
> div {
|
|
15
|
+
min-width: 0px;
|
|
16
|
+
font-family: ${FontFamily.RobotoRegular}, sans-serif;
|
|
17
|
+
font-size: ${({ size }) => (size ? size : "13")}px;
|
|
18
|
+
text-align: left;
|
|
19
|
+
color: #a2a2a2;
|
|
20
|
+
padding: ${({ borderType }) => {
|
|
21
|
+
return ["rectangle", "oval"].includes(borderType?.toLowerCase())
|
|
22
|
+
? "5px 10px"
|
|
23
|
+
: "0px";
|
|
24
|
+
}};
|
|
25
|
+
border-radius: ${({ borderType }) => {
|
|
26
|
+
return borderType?.toLowerCase() === "oval"
|
|
27
|
+
? "17px"
|
|
28
|
+
: borderType?.toLowerCase() === "rectangle"
|
|
29
|
+
? "6px"
|
|
30
|
+
: "0px";
|
|
31
|
+
}};
|
|
32
|
+
|
|
33
|
+
// input 1 linea
|
|
34
|
+
> input {
|
|
35
|
+
padding: 0px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// borde
|
|
39
|
+
> fieldset {
|
|
40
|
+
border: ${({ borderType }) => {
|
|
41
|
+
return ["rectangle", "oval"].includes(borderType?.toLowerCase())
|
|
42
|
+
? "1px solid black"
|
|
43
|
+
: "none";
|
|
44
|
+
}};
|
|
45
|
+
border-color: inherit;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&.Mui-focused {
|
|
49
|
+
> fieldset {
|
|
50
|
+
border-color: inherit;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
&.Mui-disabled {
|
|
54
|
+
cursor: not-allowed;
|
|
55
|
+
* {
|
|
56
|
+
cursor: inherit;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&.fill {
|
|
62
|
+
&.gray > div {
|
|
63
|
+
background-color: #e8e5e5;
|
|
64
|
+
color: #262626;
|
|
65
|
+
border-color: #7b7979;
|
|
66
|
+
}
|
|
67
|
+
&.white > div {
|
|
68
|
+
background-color: white;
|
|
69
|
+
color: #e33aa9;
|
|
70
|
+
border-color: #e33aa9;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&.transparent {
|
|
75
|
+
> div {
|
|
76
|
+
background-color: transparent;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&.gray > div {
|
|
80
|
+
color: #a2a2a2;
|
|
81
|
+
border-color: #7b7979;
|
|
82
|
+
}
|
|
83
|
+
&.black > div {
|
|
84
|
+
color: #262626;
|
|
85
|
+
border-color: #7b7979;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NotFound } from "./index";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/atoms/NotFound",
|
|
5
|
+
component: NotFound,
|
|
6
|
+
argTypes: {},
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const Template = (args) => <NotFound {...args} />;
|
|
10
|
+
|
|
11
|
+
export const NotFoundTest = Template.bind({});
|
|
12
|
+
NotFoundTest.args = {
|
|
13
|
+
code: "501",
|
|
14
|
+
message: "No se pudo obtener los mensajes del chat",
|
|
15
|
+
details: "no se encontro la cadena asociada al producto",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const NotFoundDefault = Template.bind({});
|
|
19
|
+
NotFoundDefault.args = {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Container } from "./styles";
|
|
2
|
+
import { ButtonV2 } from "../ButtonV2";
|
|
3
|
+
import { Modal } from "../../organisms/Modal";
|
|
4
|
+
import { FontAwesomeIcon as Icon } from "@fortawesome/react-fontawesome";
|
|
5
|
+
import { faCircleInfo as iconInfo } from "@fortawesome/free-solid-svg-icons";
|
|
6
|
+
import imgNotFountDefault from "../../../assets/images/defaultImages/notFound.svg";
|
|
7
|
+
import { useState, useEffect } from "react";
|
|
8
|
+
|
|
9
|
+
export const NotFound = (props) => {
|
|
10
|
+
const {
|
|
11
|
+
className, // string
|
|
12
|
+
code, // string
|
|
13
|
+
message, // string
|
|
14
|
+
details, // string
|
|
15
|
+
} = props;
|
|
16
|
+
const [showModal, setShowModal] = useState(false);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<Container className={className}>
|
|
21
|
+
<img src={imgNotFountDefault} alt={"imagen not found"} />
|
|
22
|
+
|
|
23
|
+
<div className="divInfo">
|
|
24
|
+
{/* icono info */}
|
|
25
|
+
<ButtonV2
|
|
26
|
+
className={"btnInfo"}
|
|
27
|
+
type={"pink"}
|
|
28
|
+
transparent
|
|
29
|
+
icon={iconInfo}
|
|
30
|
+
size={16}
|
|
31
|
+
onClick={() => {
|
|
32
|
+
setShowModal(true);
|
|
33
|
+
}}
|
|
34
|
+
/>
|
|
35
|
+
|
|
36
|
+
<label className="label-error">
|
|
37
|
+
Codigo de error
|
|
38
|
+
<label> {code ? code : 404} </label>
|
|
39
|
+
</label>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<Modal
|
|
43
|
+
show={showModal}
|
|
44
|
+
title={message ? message : "Error NO especificado"}
|
|
45
|
+
message={details ? details : "Reporta esto a TI"}
|
|
46
|
+
icon={"info"}
|
|
47
|
+
onClickBtnDefault={(event) => setShowModal(false)}
|
|
48
|
+
/>
|
|
49
|
+
</Container>
|
|
50
|
+
</>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { GlobalColors, FontFamily } from "../../../global-files/variables";
|
|
3
|
+
|
|
4
|
+
export const Container = styled.div`
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
min-width: min-content;
|
|
8
|
+
min-height: min-content;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: 6px;
|
|
14
|
+
padding: 20px 10px;
|
|
15
|
+
overflow: auto;
|
|
16
|
+
//border: 1px solid red;
|
|
17
|
+
|
|
18
|
+
img {
|
|
19
|
+
width: 80%;
|
|
20
|
+
min-width: 35px;
|
|
21
|
+
max-width: 480px;
|
|
22
|
+
max-height: 90%;
|
|
23
|
+
object-fit: contain;
|
|
24
|
+
//border: 1px solid blue;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.divInfo {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: row;
|
|
30
|
+
flex-wrap: wrap;
|
|
31
|
+
gap: 7px;
|
|
32
|
+
align-items: center;
|
|
33
|
+
|
|
34
|
+
.btnInfo {
|
|
35
|
+
padding: 0px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.label-error {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: row;
|
|
41
|
+
flex-wrap: wrap;
|
|
42
|
+
align-items: center;
|
|
43
|
+
gap: 3px;
|
|
44
|
+
font-family: ${FontFamily.RobotoRegular}, sans-serif;
|
|
45
|
+
font-size: 13px;
|
|
46
|
+
color: #262626;
|
|
47
|
+
|
|
48
|
+
label {
|
|
49
|
+
font-family: ${FontFamily.RobotoMedium}, sans-serif;
|
|
50
|
+
font-size: 15px;
|
|
51
|
+
color: #e33aa9;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Tooltip } from "./index";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/atoms/Tooltip",
|
|
5
|
+
component: Tooltip,
|
|
6
|
+
argTypes: {
|
|
7
|
+
position: {
|
|
8
|
+
options: [
|
|
9
|
+
undefined,
|
|
10
|
+
"topStart",
|
|
11
|
+
"topEnd",
|
|
12
|
+
"topCenter",
|
|
13
|
+
"rightStart",
|
|
14
|
+
"rightEnd",
|
|
15
|
+
"rightCenter",
|
|
16
|
+
"bottomStart",
|
|
17
|
+
"bottomEnd",
|
|
18
|
+
"bottomCenter",
|
|
19
|
+
"leftStart",
|
|
20
|
+
"leftEnd",
|
|
21
|
+
"leftCenter",
|
|
22
|
+
],
|
|
23
|
+
control: { type: "select" },
|
|
24
|
+
},
|
|
25
|
+
addArrow: {
|
|
26
|
+
options: [undefined, false, true],
|
|
27
|
+
control: { type: "select" },
|
|
28
|
+
},
|
|
29
|
+
transitionType: {
|
|
30
|
+
options: [undefined, "grow", "fade", "zoom"],
|
|
31
|
+
control: { type: "select" },
|
|
32
|
+
},
|
|
33
|
+
followCursor: {
|
|
34
|
+
options: [undefined, false, true],
|
|
35
|
+
control: { type: "select" },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const Template = (args) => <Tooltip {...args} />;
|
|
41
|
+
|
|
42
|
+
export const TooltipDefault = Template.bind({});
|
|
43
|
+
TooltipDefault.args = {
|
|
44
|
+
componentTooltip: <p> hola soy tooltip de prueba en storybook </p>,
|
|
45
|
+
children: <button> abrir tooltip </button>,
|
|
46
|
+
classNameTooltip: "container-tooltip",
|
|
47
|
+
position: undefined,
|
|
48
|
+
addArrow: undefined,
|
|
49
|
+
transitionType: undefined,
|
|
50
|
+
followCursor: undefined,
|
|
51
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { Fade, Grow, Popper, Tooltip as TooltipMUI, Zoom } from "@mui/material";
|
|
3
|
+
import { Container } from "./styles";
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
export const Tooltip = (props) => {
|
|
7
|
+
const {
|
|
8
|
+
componentTooltip, // (jsx) componente que aparecera en el tooltip
|
|
9
|
+
children, // (jsx) componente interno que va dentro de la etiqueta <Tooltip>
|
|
10
|
+
className, // (string) clase del container trigger
|
|
11
|
+
classNameTooltip, // (string) clase del contenedor tooltip
|
|
12
|
+
position, // (string) posicion del contenedor tooltip (values en object positions)
|
|
13
|
+
addArrow, // (boolean) add flecha en la parte posterior del tooltip?
|
|
14
|
+
transitionType, // (string) -> 'grow' (default) | 'fade' | 'zoom'
|
|
15
|
+
followCursor, // (boolean) true -> el tooltip se movera junto al cursor
|
|
16
|
+
} = props;
|
|
17
|
+
const positions = {
|
|
18
|
+
topStart: "top-start",
|
|
19
|
+
topEnd: "top-end",
|
|
20
|
+
topCenter: "top",
|
|
21
|
+
|
|
22
|
+
rightStart: "right-start",
|
|
23
|
+
rightEnd: "right-end",
|
|
24
|
+
rightCenter: "right",
|
|
25
|
+
|
|
26
|
+
bottomStart: "bottom-start",
|
|
27
|
+
bottomEnd: "bottom-end",
|
|
28
|
+
bottomCenter: "bottom",
|
|
29
|
+
|
|
30
|
+
leftStart: "left-start",
|
|
31
|
+
leftEnd: "left-end",
|
|
32
|
+
leftCenter: "left",
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<TooltipMUI
|
|
37
|
+
{...props}
|
|
38
|
+
placement={positions[position] ?? positions.topCenter}
|
|
39
|
+
arrow={addArrow || addArrow === undefined ? true : false}
|
|
40
|
+
componentsProps={{
|
|
41
|
+
tooltip: { className: classNameTooltip },
|
|
42
|
+
popper: { disablePortal: true },
|
|
43
|
+
transition: { timeout: 300 },
|
|
44
|
+
}}
|
|
45
|
+
TransitionComponent={
|
|
46
|
+
transitionType === "grow"
|
|
47
|
+
? Grow
|
|
48
|
+
: transitionType === "fade"
|
|
49
|
+
? Fade
|
|
50
|
+
: Zoom
|
|
51
|
+
}
|
|
52
|
+
enterDelay={300}
|
|
53
|
+
followCursor={followCursor ?? false}
|
|
54
|
+
title={componentTooltip}
|
|
55
|
+
>
|
|
56
|
+
<Container className={className}> {children} </Container>
|
|
57
|
+
</TooltipMUI>
|
|
58
|
+
);
|
|
59
|
+
};
|