contentoh-components-library 21.2.102 → 21.2.104

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 (192) hide show
  1. package/.env.development +2 -5
  2. package/.env.production +25 -25
  3. package/dist/components/atoms/GeneralButton/index.js +6 -2
  4. package/dist/components/atoms/Select/VersionSelect.js +2 -1
  5. package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +22 -21
  6. package/dist/components/molecules/CustomSelect/SelectItem.js +1 -10
  7. package/dist/components/molecules/HeaderTop/index.js +5 -10
  8. package/dist/components/molecules/HeaderTop/styles.js +1 -1
  9. package/dist/components/organisms/CreateVersion/RenderChilds.js +11 -11
  10. package/dist/components/organisms/CreateVersion/index.js +30 -89
  11. package/dist/components/organisms/OrderDetail/OrderDetail.stories.js +1 -1
  12. package/dist/components/organisms/OrderDetail/index.js +20 -11
  13. package/dist/components/organisms/OrderDetail/styles.js +1 -1
  14. package/dist/components/organisms/OrderDetail/utils/Table/styles.js +1 -1
  15. package/dist/components/organisms/OrderDetail/utils/Table/utils.js +45 -15
  16. package/dist/components/organisms/VersionSelector/index.js +28 -2
  17. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +69 -147
  18. package/dist/components/pages/ProviderProductEdition/index.js +2 -22
  19. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +77 -67
  20. package/dist/components/pages/RetailerProductEdition/index.js +5 -24
  21. package/dist/global-files/fonts.css +0 -12
  22. package/dist/global-files/variables.js +0 -2
  23. package/dist/index.js +46 -254
  24. package/package.json +1 -12
  25. package/src/components/atoms/GeneralButton/index.js +4 -1
  26. package/src/components/atoms/Select/VersionSelect.js +4 -2
  27. package/src/components/molecules/CustomSelect/CustomSelect.stories.js +12 -20
  28. package/src/components/molecules/CustomSelect/SelectItem.js +0 -7
  29. package/src/components/molecules/HeaderTop/index.js +6 -11
  30. package/src/components/molecules/HeaderTop/styles.js +0 -4
  31. package/src/components/organisms/CreateVersion/RenderChilds.js +28 -34
  32. package/src/components/organisms/CreateVersion/index.js +16 -36
  33. package/src/components/organisms/OrderDetail/OrderDetail.stories.js +1 -1
  34. package/src/components/organisms/OrderDetail/index.js +19 -12
  35. package/src/components/organisms/OrderDetail/styles.js +1 -0
  36. package/src/components/organisms/OrderDetail/utils/Table/styles.js +30 -0
  37. package/src/components/organisms/OrderDetail/utils/Table/utils.js +30 -15
  38. package/src/components/organisms/VersionSelector/index.js +18 -3
  39. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +75 -166
  40. package/src/components/pages/ProviderProductEdition/index.js +2 -21
  41. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +79 -67
  42. package/src/components/pages/RetailerProductEdition/index.js +2 -14
  43. package/src/global-files/customHooks.js +2 -2
  44. package/src/global-files/fonts.css +0 -12
  45. package/src/global-files/variables.js +0 -2
  46. package/src/index.js +0 -16
  47. package/dist/assets/images/customSelect/starIcon.svg +0 -14
  48. package/dist/assets/images/defaultImages/Spinner.gif +0 -0
  49. package/dist/assets/images/defaultImages/notFound.svg +0 -124
  50. package/dist/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +0 -72
  51. package/dist/components/atoms/ButtonFileChooser/index.js +0 -118
  52. package/dist/components/atoms/ButtonFileChooser/styles.js +0 -20
  53. package/dist/components/atoms/ButtonV2/ButtonV2.stories.js +0 -66
  54. package/dist/components/atoms/ButtonV2/index.js +0 -111
  55. package/dist/components/atoms/ButtonV2/styles.js +0 -53
  56. package/dist/components/atoms/CustomIcon/CustomIcon.stories.js +0 -50
  57. package/dist/components/atoms/CustomIcon/index.js +0 -40
  58. package/dist/components/atoms/CustomIcon/styles.js +0 -33
  59. package/dist/components/atoms/IconFile/IconFile.stories.js +0 -48
  60. package/dist/components/atoms/IconFile/index.js +0 -249
  61. package/dist/components/atoms/IconFile/styles.js +0 -23
  62. package/dist/components/atoms/Image/Image.stories.js +0 -73
  63. package/dist/components/atoms/Image/index.js +0 -76
  64. package/dist/components/atoms/Image/styles.js +0 -43
  65. package/dist/components/atoms/ImageLink/ImageLink.stories.js +0 -63
  66. package/dist/components/atoms/ImageLink/index.js +0 -77
  67. package/dist/components/atoms/ImageLink/styles.js +0 -40
  68. package/dist/components/atoms/ImagePreview/ImagePreview.stories.js +0 -70
  69. package/dist/components/atoms/ImagePreview/index.js +0 -222
  70. package/dist/components/atoms/ImagePreview/styles.js +0 -44
  71. package/dist/components/atoms/InputText/InputText.stories.js +0 -60
  72. package/dist/components/atoms/InputText/index.js +0 -66
  73. package/dist/components/atoms/InputText/styles.js +0 -32
  74. package/dist/components/atoms/NotFound/NotFound.stories.js +0 -36
  75. package/dist/components/atoms/NotFound/index.js +0 -75
  76. package/dist/components/atoms/NotFound/styles.js +0 -20
  77. package/dist/components/atoms/SelectItemV2/SelectItemV2.stories.js +0 -45
  78. package/dist/components/atoms/SelectItemV2/index.js +0 -46
  79. package/dist/components/atoms/SelectItemV2/styles.js +0 -23
  80. package/dist/components/atoms/Tooltip/Tooltip.stories.js +0 -66
  81. package/dist/components/atoms/Tooltip/index.js +0 -72
  82. package/dist/components/atoms/Tooltip/styles.js +0 -20
  83. package/dist/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +0 -66
  84. package/dist/components/molecules/ButtonDownloadFile/index.js +0 -179
  85. package/dist/components/molecules/ButtonDownloadFile/styles.js +0 -23
  86. package/dist/components/molecules/Dropdown/Dropdown.stories.js +0 -96
  87. package/dist/components/molecules/Dropdown/index.js +0 -148
  88. package/dist/components/molecules/Dropdown/styles.js +0 -26
  89. package/dist/components/molecules/ImageTooltip/ImageTooltip.stories.js +0 -72
  90. package/dist/components/molecules/ImageTooltip/index.js +0 -84
  91. package/dist/components/molecules/ImageTooltip/styles.js +0 -33
  92. package/dist/components/molecules/SelectV2/SelectV2.stories.js +0 -119
  93. package/dist/components/molecules/SelectV2/index.js +0 -298
  94. package/dist/components/molecules/SelectV2/styles.js +0 -42
  95. package/dist/components/organisms/Chat/Chat.stories.js +0 -215
  96. package/dist/components/organisms/Chat/ChatLists/ChatLists.stories.js +0 -83
  97. package/dist/components/organisms/Chat/ChatLists/index.js +0 -160
  98. package/dist/components/organisms/Chat/ChatLists/styles.js +0 -29
  99. package/dist/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +0 -176
  100. package/dist/components/organisms/Chat/ContainerItems/index.js +0 -569
  101. package/dist/components/organisms/Chat/ContainerItems/styles.js +0 -20
  102. package/dist/components/organisms/Chat/ContentChat/ContentChat.stories.js +0 -142
  103. package/dist/components/organisms/Chat/ContentChat/index.js +0 -1422
  104. package/dist/components/organisms/Chat/ContentChat/styles.js +0 -20
  105. package/dist/components/organisms/Chat/Footer/Footer.stories.js +0 -43
  106. package/dist/components/organisms/Chat/Footer/index.js +0 -984
  107. package/dist/components/organisms/Chat/Footer/styles.js +0 -32
  108. package/dist/components/organisms/Chat/Header/Header.stories.js +0 -96
  109. package/dist/components/organisms/Chat/Header/index.js +0 -84
  110. package/dist/components/organisms/Chat/Header/styles.js +0 -20
  111. package/dist/components/organisms/Chat/index.js +0 -327
  112. package/dist/components/organisms/Chat/styles.js +0 -29
  113. package/dist/components/organisms/Modal/Modal.stories.js +0 -66
  114. package/dist/components/organisms/Modal/index.js +0 -95
  115. package/dist/components/organisms/Modal/styles.js +0 -20
  116. package/dist/global-files/handle_http.js +0 -383
  117. package/dist/global-files/utils.js +0 -472
  118. package/src/assets/images/customSelect/starIcon.svg +0 -14
  119. package/src/assets/images/defaultImages/Spinner.gif +0 -0
  120. package/src/assets/images/defaultImages/notFound.svg +0 -124
  121. package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +0 -47
  122. package/src/components/atoms/ButtonFileChooser/index.js +0 -69
  123. package/src/components/atoms/ButtonFileChooser/styles.js +0 -4
  124. package/src/components/atoms/ButtonV2/ButtonV2.stories.js +0 -51
  125. package/src/components/atoms/ButtonV2/index.js +0 -79
  126. package/src/components/atoms/ButtonV2/styles.js +0 -195
  127. package/src/components/atoms/CustomIcon/CustomIcon.stories.js +0 -36
  128. package/src/components/atoms/CustomIcon/index.js +0 -41
  129. package/src/components/atoms/CustomIcon/styles.js +0 -85
  130. package/src/components/atoms/IconFile/IconFile.stories.js +0 -35
  131. package/src/components/atoms/IconFile/index.js +0 -119
  132. package/src/components/atoms/IconFile/styles.js +0 -67
  133. package/src/components/atoms/Image/Image.stories.js +0 -51
  134. package/src/components/atoms/Image/index.js +0 -55
  135. package/src/components/atoms/Image/styles.js +0 -34
  136. package/src/components/atoms/ImageLink/ImageLink.stories.js +0 -43
  137. package/src/components/atoms/ImageLink/index.js +0 -57
  138. package/src/components/atoms/ImageLink/styles.js +0 -30
  139. package/src/components/atoms/ImagePreview/ImagePreview.stories.js +0 -52
  140. package/src/components/atoms/ImagePreview/index.js +0 -191
  141. package/src/components/atoms/ImagePreview/styles.js +0 -77
  142. package/src/components/atoms/InputText/InputText.stories.js +0 -39
  143. package/src/components/atoms/InputText/index.js +0 -61
  144. package/src/components/atoms/InputText/styles.js +0 -89
  145. package/src/components/atoms/NotFound/NotFound.stories.js +0 -19
  146. package/src/components/atoms/NotFound/index.js +0 -52
  147. package/src/components/atoms/NotFound/styles.js +0 -55
  148. package/src/components/atoms/SelectItemV2/SelectItemV2.stories.js +0 -26
  149. package/src/components/atoms/SelectItemV2/index.js +0 -45
  150. package/src/components/atoms/SelectItemV2/styles.js +0 -55
  151. package/src/components/atoms/Tooltip/Tooltip.stories.js +0 -51
  152. package/src/components/atoms/Tooltip/index.js +0 -59
  153. package/src/components/atoms/Tooltip/styles.js +0 -42
  154. package/src/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +0 -54
  155. package/src/components/molecules/ButtonDownloadFile/index.js +0 -111
  156. package/src/components/molecules/ButtonDownloadFile/styles.js +0 -66
  157. package/src/components/molecules/Dropdown/Dropdown.stories.js +0 -101
  158. package/src/components/molecules/Dropdown/index.js +0 -142
  159. package/src/components/molecules/Dropdown/styles.js +0 -75
  160. package/src/components/molecules/ImageTooltip/ImageTooltip.stories.js +0 -46
  161. package/src/components/molecules/ImageTooltip/index.js +0 -62
  162. package/src/components/molecules/ImageTooltip/styles.js +0 -18
  163. package/src/components/molecules/SelectV2/SelectV2.stories.js +0 -114
  164. package/src/components/molecules/SelectV2/index.js +0 -332
  165. package/src/components/molecules/SelectV2/styles.js +0 -100
  166. package/src/components/organisms/Chat/Chat.stories.js +0 -199
  167. package/src/components/organisms/Chat/ChatLists/ChatLists.stories.js +0 -65
  168. package/src/components/organisms/Chat/ChatLists/Rotoplas.jpeg +0 -0
  169. package/src/components/organisms/Chat/ChatLists/THD.png +0 -0
  170. package/src/components/organisms/Chat/ChatLists/index.js +0 -141
  171. package/src/components/organisms/Chat/ChatLists/styles.js +0 -162
  172. package/src/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +0 -142
  173. package/src/components/organisms/Chat/ContainerItems/index.js +0 -549
  174. package/src/components/organisms/Chat/ContainerItems/styles.js +0 -328
  175. package/src/components/organisms/Chat/ContentChat/ContentChat.stories.js +0 -102
  176. package/src/components/organisms/Chat/ContentChat/Rotoplas.jpeg +0 -0
  177. package/src/components/organisms/Chat/ContentChat/THD.png +0 -0
  178. package/src/components/organisms/Chat/ContentChat/index.js +0 -900
  179. package/src/components/organisms/Chat/ContentChat/styles.js +0 -41
  180. package/src/components/organisms/Chat/Footer/Footer.stories.js +0 -22
  181. package/src/components/organisms/Chat/Footer/index.js +0 -669
  182. package/src/components/organisms/Chat/Footer/styles.js +0 -286
  183. package/src/components/organisms/Chat/Header/Header.stories.js +0 -66
  184. package/src/components/organisms/Chat/Header/index.js +0 -94
  185. package/src/components/organisms/Chat/Header/styles.js +0 -49
  186. package/src/components/organisms/Chat/index.js +0 -294
  187. package/src/components/organisms/Chat/styles.js +0 -42
  188. package/src/components/organisms/Modal/Modal.stories.js +0 -55
  189. package/src/components/organisms/Modal/index.js +0 -97
  190. package/src/components/organisms/Modal/styles.js +0 -103
  191. package/src/global-files/handle_http.js +0 -231
  192. package/src/global-files/utils.js +0 -300
@@ -1,294 +0,0 @@
1
- import {
2
- ContainerBtnPopUpChat,
3
- ContainerFixed,
4
- ContainerPopUp,
5
- } from "./styles";
6
- import { useEffect, useState } from "react";
7
- import { ButtonV2 } from "../../atoms/ButtonV2";
8
- import { ContentChat } from "./ContentChat";
9
- import { faComments as IconChat } from "@fortawesome/free-solid-svg-icons";
10
- import { Slide } from "@mui/material";
11
- import {
12
- isStringEmpty,
13
- isValidNaturalNumber,
14
- } from "../../../global-files/utils";
15
-
16
- export const Chat = (props) => {
17
- const {
18
- chatType, // "merchant_product" | "order_product" | "ticket"
19
- chatContainerType, // ("fixed") | ("popUp")
20
- chatData, // {} => aqui poner los datos requeridos segun el tipo de chat
21
- classNameContainerFixed, // clases CSS del envoltoria chat fixed
22
- } = props;
23
- const [showPopUpChat, setShowPopUpChat] = useState(false);
24
- const [data, setData] = useState();
25
-
26
- useEffect(() => {
27
- switch (chatType) {
28
- case "merchant_product":
29
- validateChatMerchantProduct();
30
- break;
31
- case "order_product":
32
- validateChatOrderProduct();
33
- break;
34
- case "ticket":
35
- validateChatTicket();
36
- break;
37
- default:
38
- setData({
39
- code: 404,
40
- message: `El tipo de chat especificado "${chatType}" no es valido`,
41
- errorDetail: "",
42
- });
43
- }
44
- }, [chatType]);
45
-
46
- // validar props que se requieren para el tipo de chat "order_product"
47
- const validateChatOrderProduct = () => {
48
- const {
49
- userToken, // string
50
- id, // number
51
- orderId, // number
52
- retailerId, // number
53
- } = chatData;
54
-
55
- // validar token del user
56
- if (isStringEmpty(userToken)) {
57
- setDataError("El token del usuario no es valido");
58
- return;
59
- }
60
- // validar ID del producto
61
- if (!isValidNaturalNumber(id)) {
62
- setDataError("El ID del producto no es valido");
63
- return;
64
- }
65
- // validar el ID de la OT en donde se encuentra el producto
66
- if (!isValidNaturalNumber(orderId)) {
67
- setDataError("El ID de la orden del producto no es valido");
68
- return;
69
- }
70
- // validar el ID de la cadena asociada al producto en la OT
71
- if (!isValidNaturalNumber(retailerId)) {
72
- setDataError("La cadena relacionada al producto no es valida");
73
- return;
74
- }
75
- setData({
76
- userToken,
77
- id,
78
- orderId,
79
- retailerId,
80
- });
81
- };
82
-
83
- // validar props que se requieren para el tipo de chat "merchants_product"
84
- const validateChatMerchantProduct = () => {
85
- const {
86
- userToken, // string
87
- id, // number
88
- version, // number
89
- } = chatData;
90
-
91
- // validar token del user
92
- if (isStringEmpty(userToken)) {
93
- setDataError("El token del usuario no es valido");
94
- return;
95
- }
96
- // validar ID del producto
97
- if (!isValidNaturalNumber(id)) {
98
- setDataError("El ID del producto no es valido");
99
- return;
100
- }
101
- // validar la version del producto
102
- if (!isValidNaturalNumber(version)) {
103
- setDataError("La version del producto no es valida");
104
- return;
105
- }
106
- setData({
107
- userToken,
108
- id,
109
- version,
110
- });
111
- };
112
-
113
- // validar props que se requieren para el tipo de chat "ticket"
114
- const validateChatTicket = () => {
115
- const {
116
- currentUser /* {
117
- id: number ,
118
- companyId: number ,
119
- isUserTech: boolean ,
120
- } */,
121
- id, // number
122
- statusTicket, // (string) "IN_PROGRESS" | "PENDING" | "COMPLETED"
123
- ticketOwnerUserId, // number
124
- } = chatData;
125
-
126
- // validar si ID del usuario conectado
127
- if (!isValidNaturalNumber(currentUser?.id)) {
128
- setDataError("Tu ID de usuario no fue especificado");
129
- return;
130
- }
131
- // validar si ID de la compañia del usuario conectado
132
- if (!isValidNaturalNumber(currentUser?.companyId)) {
133
- setDataError("El ID de tu compañia no fue especificado");
134
- return;
135
- }
136
- // validar si el usuario conectado es de tecnologia o no
137
- if (
138
- currentUser?.isUserTech === undefined ||
139
- typeof currentUser.isUserTech !== "boolean"
140
- ) {
141
- setDataError("Tu tipo de usuario no fue especificado");
142
- return;
143
- }
144
- // validar ID del ticket
145
- if (!isValidNaturalNumber(id)) {
146
- setDataError("El ID del ticket no es valido");
147
- return;
148
- }
149
- // validar ID del usuario que creó el ticket
150
- if (!isValidNaturalNumber(ticketOwnerUserId)) {
151
- setDataError(
152
- "El ID del usuario al que le pertenece el ticket no es valido"
153
- );
154
- return;
155
- }
156
- // validar el status del chat
157
- if (isStringEmpty(statusTicket)) {
158
- setDataError("El estatus del ticket no es valido");
159
- return;
160
- }
161
- let statusChat = "open";
162
- if (statusTicket === "COMPLETED") statusChat = "closed";
163
-
164
- // convertir user TECH a NORMAL si es el propietario del ticket
165
- let isUserTech = currentUser.isUserTech;
166
- if (isUserTech && currentUser.id == ticketOwnerUserId) {
167
- isUserTech = false;
168
- }
169
- setData({
170
- currentUser: {
171
- ...currentUser,
172
- isUserTech,
173
- },
174
- id,
175
- statusChat,
176
- });
177
- };
178
-
179
- const setDataError = (errorDetail) => {
180
- setData({
181
- code: 404,
182
- message: `No se especificaron algunos datos requeridos para el tipo de chat "${chatType}"`,
183
- errorDetail,
184
- });
185
- };
186
-
187
- /*
188
- const createItem = async (valueType, valueInput) => {
189
- clearTimeout(processUpdateID);
190
- let currentItems = items.slice();
191
- let paramsBody = {};
192
- let paramsHeaders = {};
193
- switch (chatType.toLowerCase()) {
194
- case "order_product": //------------------------------------------
195
- paramsBody = {
196
- articleId: articleId,
197
- valueType: valueType,
198
- value: valueInput,
199
- isOrderProduct: "1",
200
- orderId: orderId,
201
- retailerId: retailerId,
202
- };
203
- paramsHeaders = { Authorization: userToken };
204
- break;
205
-
206
- default:
207
- // merchants_products--------------------------------------
208
- paramsBody = {
209
- articleId: articleId,
210
- articleVersion: articleVersion,
211
- valueType: valueType,
212
- value: valueInput,
213
- isOrderProduct: "0",
214
- };
215
- paramsHeaders = { Authorization: userToken };
216
- }
217
- const response = await fetchPOST(
218
- process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT,
219
- paramsBody,
220
- paramsHeaders
221
- );
222
- if (!response.body) {
223
- let itemType =
224
- valueType === "txt"
225
- ? "el mensaje"
226
- : valueType === "img"
227
- ? "la imagen"
228
- : "el archivo";
229
- showModalAlert(
230
- `No fue posible agregar ${itemType} en el chat`,
231
- response.errorDetail,
232
- "error"
233
- );
234
- setItems(currentItems);
235
- } else {
236
- if (currentItems?.length == 0) {
237
- // console.log("NUEVO ITEM <> NUEVO INITIAL");
238
- await getInitial();
239
- } else {
240
- // console.log("NUEVO ITEM <> NUEVO UPDATE");
241
- await getUpdate();
242
- }
243
- }
244
- };
245
- */
246
-
247
- return (
248
- <>
249
- {chatContainerType?.toLowerCase() === "fixed" ? (
250
- <>
251
- {/* chat tipo fixed */}
252
- <ContainerFixed className={classNameContainerFixed}>
253
- <ContentChat
254
- chatType={chatType?.toLowerCase()}
255
- chatContainerType={"fixed"}
256
- dataChat={data}
257
- showBtnClose={false}
258
- />
259
- </ContainerFixed>
260
- </>
261
- ) : (
262
- <>
263
- {/* chat tipo popUp */}
264
- <ContainerBtnPopUpChat>
265
- <ButtonV2
266
- className={"container-btn-popUpChat"}
267
- type={"whiteS2"}
268
- size={14}
269
- borderType={"circle"}
270
- icon={IconChat}
271
- onClick={async (event) => {
272
- setShowPopUpChat(!showPopUpChat);
273
- }}
274
- />
275
- </ContainerBtnPopUpChat>
276
-
277
- <Slide direction={"left"} in={showPopUpChat} timeout={400}>
278
- <ContainerPopUp>
279
- <ContentChat
280
- chatType={chatType?.toLowerCase()}
281
- chatContainerType={"popUp"}
282
- dataChat={data}
283
- showBtnClose={true}
284
- onClickBtnClose={() => {
285
- setShowPopUpChat(false);
286
- }}
287
- />
288
- </ContainerPopUp>
289
- </Slide>
290
- </>
291
- )}
292
- </>
293
- );
294
- };
@@ -1,42 +0,0 @@
1
- import styled from "styled-components";
2
- import { GlobalColors, FontFamily } from "../../../global-files/variables";
3
-
4
- // Container para chat fixed
5
- export const ContainerFixed = styled.div`
6
- width: auto;
7
- max-width: 550px;
8
- min-width: 325px;
9
- height: 100%;
10
- flex-grow: 2;
11
- background-color: white;
12
- border: 1px solid #f0f0f0;
13
- z-index: 1000;
14
- padding: 0px;
15
- `;
16
-
17
- export const ContainerBtnPopUpChat = styled.div`
18
- border-radius: 50%;
19
- height: 34px;
20
- width: 34px;
21
-
22
- .container-btn-popUpChat {
23
- height: inherit;
24
- width: inherit;
25
- overflow: hidden;
26
- }
27
- `;
28
-
29
- export const ContainerPopUp = styled.div`
30
- position: fixed;
31
- top: 20px;
32
- right: 23px;
33
- bottom: 20px;
34
- box-shadow: 0px 2px 10px 0px #00000073;
35
- z-index: 1000;
36
- width: calc(100% - 50px);
37
- max-width: 550px;
38
- min-width: 325px;
39
- border-radius: 10px;
40
- background: white;
41
- padding: 0px;
42
- `;
@@ -1,55 +0,0 @@
1
- import { Modal } from "./index";
2
- import { ButtonV2 } from "../../atoms/ButtonV2";
3
-
4
- export default {
5
- title: "Components/organisms/Modal",
6
- component: Modal,
7
- argTypes: {
8
- icon: {
9
- options: [undefined, "error", "warning", "success", "info"],
10
- control: { type: "select" },
11
- },
12
- },
13
- };
14
-
15
- const Template = (args) => <Modal {...args} />;
16
-
17
- export const modalDefault = Template.bind({});
18
- modalDefault.args = {
19
- show: false,
20
- title: "Titulo del modal",
21
- icon: undefined,
22
- message: `descripcion amplia sobre el componente
23
- modal white para saber como se ven varias lineas
24
- de codigo`,
25
- };
26
-
27
- export const modalWithButtons = Template.bind({});
28
- modalWithButtons.args = {
29
- show: false,
30
- title: "Titulo del modal",
31
- icon: undefined,
32
- message: `descripcion amplia sobre el componente
33
- modal white para saber como se ven varias lineas
34
- de codigo`,
35
- buttons: [
36
- <ButtonV2
37
- key={"btn-Cancelar"}
38
- type={"white"}
39
- label={"Cancelar"}
40
- size={12}
41
- onClick={(event) => {
42
- alert("cancelar");
43
- }}
44
- />,
45
- <ButtonV2
46
- key={"btn-Aceptar"}
47
- type={"pink"}
48
- label={"Aceptar"}
49
- size={12}
50
- onClick={(event) => {
51
- alert("aceptar");
52
- }}
53
- />,
54
- ],
55
- };
@@ -1,97 +0,0 @@
1
- import React, { useEffect, useState } from "react";
2
- import { ContainerModal } from "./styles";
3
- import {
4
- faClose as xIcon,
5
- faExclamationTriangle as warningIcon,
6
- faCheck as successIcon,
7
- faExclamation as infoIcon,
8
- } from "@fortawesome/free-solid-svg-icons";
9
- import { FontAwesomeIcon as Icon } from "@fortawesome/react-fontawesome";
10
- import { Fade, Grow, Zoom, Modal as ModalMUI, Backdrop } from "@mui/material";
11
- import { ButtonV2 } from "../../atoms/ButtonV2";
12
- import { CustomIcon } from "../../atoms/CustomIcon";
13
-
14
- export const Modal = (props) => {
15
- const {
16
- className, // clases CSS del componente raiz del modal
17
- show, // boolean
18
- title, // string
19
- message, // string
20
- icon, // "error" | "warning" | "success" | "info" | (por default no icon)
21
- customComponent, // JSX
22
- buttons, // array<JSX>
23
- onClickModal, // (event) => {}
24
- onClickBtnDefault, // (event) => {}
25
- } = props;
26
- const icons = {
27
- error: xIcon,
28
- warning: warningIcon,
29
- info: infoIcon,
30
- success: successIcon,
31
- };
32
-
33
- return (
34
- <Backdrop
35
- open={show}
36
- className="container-backgroundModal"
37
- timeout={400}
38
- style={{
39
- backgroundColor: "transparent",
40
- zIndex: 10,
41
- }}
42
- onClick={(event) => onClickModal && onClickModal(event)}
43
- >
44
- <Fade in={show} timeout={400}>
45
- <ContainerModal className={className ? className : ""}>
46
- <div className="contentModal">
47
- <header>
48
- {/* titulo */}
49
- {![null, undefined, ""].includes(title?.trim()) && (
50
- <label className="label-title">{title.trim()}</label>
51
- )}
52
- </header>
53
-
54
- {/* icono modal */}
55
- {icons[icon?.toLowerCase()] && (
56
- <CustomIcon
57
- type={"white"}
58
- className={"iconModal " + "iconModal-" + icon.toLowerCase()}
59
- size={35}
60
- borderType={"circle"}
61
- icon={icons[icon.toLowerCase()]}
62
- />
63
- )}
64
-
65
- {/* label message */}
66
- {![null, undefined, ""].includes(message?.trim()) && (
67
- <label className="label-message"> {message.trim()} </label>
68
- )}
69
-
70
- {/* custom component */}
71
- {customComponent && (
72
- <div className="container-customComponent">{customComponent}</div>
73
- )}
74
-
75
- {/* container buttons */}
76
- <div className="container-buttons">
77
- {buttons?.length ? (
78
- buttons
79
- ) : (
80
- <ButtonV2
81
- key={"btn-Aceptar"}
82
- type={"white"}
83
- borderType={"oval"}
84
- label={"Aceptar"}
85
- size={12}
86
- onClick={(event) =>
87
- onClickBtnDefault && onClickBtnDefault(event)
88
- }
89
- />
90
- )}
91
- </div>
92
- </div>
93
- </ContainerModal>
94
- </Fade>
95
- </Backdrop>
96
- );
97
- };
@@ -1,103 +0,0 @@
1
- import styled from "styled-components";
2
- import { FontFamily } from "../../../global-files/variables";
3
-
4
- export const ContainerModal = styled.div`
5
- width: 100%;
6
- height: 100%;
7
- overflow: auto;
8
- display: grid;
9
- place-items: center;
10
- background-color: rgba(0, 0, 0, 0.4);
11
-
12
- .contentModal {
13
- width: fit-content;
14
- max-width: 80%;
15
- min-width: 80px;
16
- height: fit-content;
17
- max-height: 90%;
18
- min-height: 120px;
19
- display: flex;
20
- flex-direction: column;
21
- align-items: center;
22
- background-color: white;
23
- border-radius: 10px;
24
- padding: 25px 25px 20px 25px;
25
- box-shadow: 0px 2px 4px 0px #00000040;
26
-
27
- header {
28
- width: 100%;
29
- display: flex;
30
- flex-direction: row;
31
- align-items: center;
32
- justify-content: flex-start;
33
- gap: 6px;
34
- margin-bottom: 20px;
35
-
36
- .label-title {
37
- width: 100%;
38
- text-align: center;
39
- font-family: ${FontFamily.RobotoMedium}, sans-serif;
40
- font-size: 17px;
41
- line-height: 1.2;
42
- color: #262626;
43
- white-space: pre-wrap;
44
- }
45
- }
46
-
47
- .iconModal {
48
- width: 50px;
49
- height: 50px;
50
- font-size: 30px;
51
- border-width: 4px;
52
- margin-bottom: 20px;
53
- overflow: hidden;
54
-
55
- &.iconModal-error {
56
- background-color: #953737;
57
- border-color: #953737;
58
- color: white;
59
- }
60
- &.iconModal-warning {
61
- font-size: 27px;
62
- padding-bottom: 8px;
63
- color: #af9647;
64
- border-color: #af9647;
65
- }
66
- &.iconModal-info {
67
- border-color: #9e3e26;
68
- color: #9e3e26;
69
- }
70
- &.iconModal-success {
71
- }
72
- }
73
-
74
- .label-message {
75
- width: 100%;
76
- text-align: center;
77
- font-family: ${FontFamily.RobotoRegular}, sans-serif;
78
- font-size: 13px;
79
- color: #707070;
80
- white-space: pre-wrap;
81
- }
82
-
83
- .container-customComponent {
84
- width: 100%;
85
- max-height: 50vh;
86
- display: flex;
87
- flex-direction: column;
88
- margin-top: 20px;
89
- padding: 0px 0px;
90
- //border: 1px solid red;
91
- }
92
-
93
- .container-buttons {
94
- width: 100%;
95
- display: flex;
96
- flex-direction: row;
97
- justify-content: center;
98
- gap: 12px;
99
- margin-top: 20px;
100
- //border: 1px solid red;
101
- }
102
- }
103
- `;