contentoh-components-library 21.2.89 → 21.2.90

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 (175) hide show
  1. package/.env.development +1 -6
  2. package/dist/components/atoms/ChatPopUp/ChatPopUp.stories.js +28 -0
  3. package/dist/components/atoms/ChatPopUp/index.js +841 -0
  4. package/dist/components/atoms/ChatPopUp/styles.js +27 -0
  5. package/dist/components/atoms/ChatPopUp/utils/handlersChat.js +182 -0
  6. package/dist/components/atoms/ProgressBar/styles.js +1 -1
  7. package/dist/components/atoms/Tooltip/Tooltip.stories.js +5 -35
  8. package/dist/components/atoms/Tooltip/index.js +24 -41
  9. package/dist/components/atoms/Tooltip/styles.js +1 -3
  10. package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +22 -21
  11. package/dist/components/molecules/CustomSelect/SelectItem.js +1 -10
  12. package/dist/components/molecules/HeaderTop/index.js +5 -10
  13. package/dist/components/molecules/HeaderTop/styles.js +1 -1
  14. package/dist/components/pages/Dashboard/Dashboard.stories.js +44 -16
  15. package/dist/components/pages/Dashboard/index.js +17 -10
  16. package/dist/components/pages/ProviderProductEdition/index.js +2 -3
  17. package/dist/components/pages/RetailerProductEdition/index.js +7 -4
  18. package/dist/global-files/fonts.css +0 -18
  19. package/dist/global-files/variables.js +1 -3
  20. package/dist/index.js +45 -227
  21. package/package.json +1 -13
  22. package/src/components/atoms/ProgressBar/styles.js +4 -3
  23. package/src/components/molecules/CustomSelect/CustomSelect.stories.js +12 -20
  24. package/src/components/molecules/CustomSelect/SelectItem.js +0 -7
  25. package/src/components/molecules/HeaderTop/index.js +6 -11
  26. package/src/components/molecules/HeaderTop/styles.js +0 -4
  27. package/src/components/pages/Dashboard/Dashboard.stories.js +47 -16
  28. package/src/components/pages/Dashboard/index.js +13 -4
  29. package/src/components/pages/ProviderProductEdition/index.js +7 -6
  30. package/src/components/pages/RetailerProductEdition/index.js +4 -5
  31. package/src/global-files/fonts.css +0 -18
  32. package/src/global-files/variables.js +0 -2
  33. package/src/index.js +0 -14
  34. package/dist/assets/fonts/Roboto/Roboto-Medium.ttf +0 -0
  35. package/dist/assets/fonts/Roboto/Roboto-Regular.ttf +0 -0
  36. package/dist/assets/images/defaultImages/Spinner.gif +0 -0
  37. package/dist/assets/images/defaultImages/notFound.svg +0 -124
  38. package/dist/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +0 -72
  39. package/dist/components/atoms/ButtonFileChooser/index.js +0 -118
  40. package/dist/components/atoms/ButtonFileChooser/styles.js +0 -20
  41. package/dist/components/atoms/ButtonV2/ButtonV2.stories.js +0 -66
  42. package/dist/components/atoms/ButtonV2/index.js +0 -111
  43. package/dist/components/atoms/ButtonV2/styles.js +0 -53
  44. package/dist/components/atoms/CustomIcon/CustomIcon.stories.js +0 -50
  45. package/dist/components/atoms/CustomIcon/index.js +0 -40
  46. package/dist/components/atoms/CustomIcon/styles.js +0 -33
  47. package/dist/components/atoms/IconFile/IconFile.stories.js +0 -48
  48. package/dist/components/atoms/IconFile/index.js +0 -249
  49. package/dist/components/atoms/IconFile/styles.js +0 -23
  50. package/dist/components/atoms/Image/Image.stories.js +0 -63
  51. package/dist/components/atoms/Image/index.js +0 -74
  52. package/dist/components/atoms/Image/styles.js +0 -40
  53. package/dist/components/atoms/ImageLink/ImageLink.stories.js +0 -63
  54. package/dist/components/atoms/ImageLink/index.js +0 -77
  55. package/dist/components/atoms/ImageLink/styles.js +0 -40
  56. package/dist/components/atoms/ImagePreview/ImagePreview.stories.js +0 -70
  57. package/dist/components/atoms/ImagePreview/index.js +0 -222
  58. package/dist/components/atoms/ImagePreview/styles.js +0 -44
  59. package/dist/components/atoms/InputText/InputText.stories.js +0 -60
  60. package/dist/components/atoms/InputText/index.js +0 -66
  61. package/dist/components/atoms/InputText/styles.js +0 -32
  62. package/dist/components/atoms/NotFound/NotFound.stories.js +0 -36
  63. package/dist/components/atoms/NotFound/index.js +0 -75
  64. package/dist/components/atoms/NotFound/styles.js +0 -20
  65. package/dist/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +0 -66
  66. package/dist/components/molecules/ButtonDownloadFile/index.js +0 -179
  67. package/dist/components/molecules/ButtonDownloadFile/styles.js +0 -23
  68. package/dist/components/molecules/ImageTooltip/ImageTooltip.stories.js +0 -72
  69. package/dist/components/molecules/ImageTooltip/index.js +0 -84
  70. package/dist/components/molecules/ImageTooltip/styles.js +0 -33
  71. package/dist/components/organisms/Chat/Chat.stories.js +0 -215
  72. package/dist/components/organisms/Chat/ChatLists/ChatLists.stories.js +0 -83
  73. package/dist/components/organisms/Chat/ChatLists/index.js +0 -160
  74. package/dist/components/organisms/Chat/ChatLists/styles.js +0 -29
  75. package/dist/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +0 -176
  76. package/dist/components/organisms/Chat/ContainerItems/index.js +0 -572
  77. package/dist/components/organisms/Chat/ContainerItems/styles.js +0 -20
  78. package/dist/components/organisms/Chat/ContentChat/ContentChat.stories.js +0 -142
  79. package/dist/components/organisms/Chat/ContentChat/index.js +0 -1422
  80. package/dist/components/organisms/Chat/ContentChat/styles.js +0 -20
  81. package/dist/components/organisms/Chat/Footer/Footer.stories.js +0 -43
  82. package/dist/components/organisms/Chat/Footer/index.js +0 -984
  83. package/dist/components/organisms/Chat/Footer/styles.js +0 -32
  84. package/dist/components/organisms/Chat/Header/Header.stories.js +0 -96
  85. package/dist/components/organisms/Chat/Header/index.js +0 -84
  86. package/dist/components/organisms/Chat/Header/styles.js +0 -20
  87. package/dist/components/organisms/Chat/index.js +0 -327
  88. package/dist/components/organisms/Chat/styles.js +0 -29
  89. package/dist/components/organisms/Modal/Modal.stories.js +0 -66
  90. package/dist/components/organisms/Modal/index.js +0 -95
  91. package/dist/components/organisms/Modal/styles.js +0 -20
  92. package/dist/global-files/handle_http.js +0 -383
  93. package/dist/global-files/utils.js +0 -472
  94. package/src/assets/fonts/Roboto/Roboto-Medium.ttf +0 -0
  95. package/src/assets/fonts/Roboto/Roboto-Regular.ttf +0 -0
  96. package/src/assets/images/chatPopup/Spinner.gif +0 -0
  97. package/src/assets/images/chatPopup/close.svg +0 -3
  98. package/src/assets/images/chatPopup/defaultImage.png +0 -0
  99. package/src/assets/images/chatPopup/defaultProfile.png +0 -0
  100. package/src/assets/images/chatPopup/doc.svg +0 -1
  101. package/src/assets/images/chatPopup/document.svg +0 -1
  102. package/src/assets/images/chatPopup/iconChat.svg +0 -19
  103. package/src/assets/images/chatPopup/iconPlus.svg +0 -3
  104. package/src/assets/images/chatPopup/pdf.svg +0 -75
  105. package/src/assets/images/chatPopup/remove.svg +0 -4
  106. package/src/assets/images/chatPopup/send.svg +0 -3
  107. package/src/assets/images/chatPopup/svgIcon.svg +0 -109
  108. package/src/assets/images/chatPopup/upload_file.svg +0 -3
  109. package/src/assets/images/chatPopup/xls.svg +0 -53
  110. package/src/assets/images/customSelect/starIcon.svg +0 -14
  111. package/src/assets/images/defaultImages/Spinner.gif +0 -0
  112. package/src/assets/images/defaultImages/notFound.svg +0 -124
  113. package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +0 -47
  114. package/src/components/atoms/ButtonFileChooser/index.js +0 -69
  115. package/src/components/atoms/ButtonFileChooser/styles.js +0 -4
  116. package/src/components/atoms/ButtonV2/ButtonV2.stories.js +0 -50
  117. package/src/components/atoms/ButtonV2/index.js +0 -74
  118. package/src/components/atoms/ButtonV2/styles.js +0 -187
  119. package/src/components/atoms/CustomIcon/CustomIcon.stories.js +0 -36
  120. package/src/components/atoms/CustomIcon/index.js +0 -41
  121. package/src/components/atoms/CustomIcon/styles.js +0 -85
  122. package/src/components/atoms/IconFile/IconFile.stories.js +0 -35
  123. package/src/components/atoms/IconFile/index.js +0 -119
  124. package/src/components/atoms/IconFile/styles.js +0 -67
  125. package/src/components/atoms/Image/Image.stories.js +0 -43
  126. package/src/components/atoms/Image/index.js +0 -54
  127. package/src/components/atoms/Image/styles.js +0 -25
  128. package/src/components/atoms/ImageLink/ImageLink.stories.js +0 -43
  129. package/src/components/atoms/ImageLink/index.js +0 -57
  130. package/src/components/atoms/ImageLink/styles.js +0 -30
  131. package/src/components/atoms/ImagePreview/ImagePreview.stories.js +0 -52
  132. package/src/components/atoms/ImagePreview/index.js +0 -191
  133. package/src/components/atoms/ImagePreview/styles.js +0 -77
  134. package/src/components/atoms/InputText/InputText.stories.js +0 -39
  135. package/src/components/atoms/InputText/index.js +0 -61
  136. package/src/components/atoms/InputText/styles.js +0 -89
  137. package/src/components/atoms/NotFound/NotFound.stories.js +0 -19
  138. package/src/components/atoms/NotFound/index.js +0 -52
  139. package/src/components/atoms/NotFound/styles.js +0 -55
  140. package/src/components/atoms/Tooltip/Tooltip.stories.js +0 -51
  141. package/src/components/atoms/Tooltip/index.js +0 -59
  142. package/src/components/atoms/Tooltip/styles.js +0 -42
  143. package/src/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +0 -54
  144. package/src/components/molecules/ButtonDownloadFile/index.js +0 -111
  145. package/src/components/molecules/ButtonDownloadFile/styles.js +0 -66
  146. package/src/components/molecules/ImageTooltip/ImageTooltip.stories.js +0 -46
  147. package/src/components/molecules/ImageTooltip/index.js +0 -62
  148. package/src/components/molecules/ImageTooltip/styles.js +0 -18
  149. package/src/components/organisms/Chat/Chat.stories.js +0 -199
  150. package/src/components/organisms/Chat/ChatLists/ChatLists.stories.js +0 -65
  151. package/src/components/organisms/Chat/ChatLists/Rotoplas.jpeg +0 -0
  152. package/src/components/organisms/Chat/ChatLists/THD.png +0 -0
  153. package/src/components/organisms/Chat/ChatLists/index.js +0 -141
  154. package/src/components/organisms/Chat/ChatLists/styles.js +0 -162
  155. package/src/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +0 -142
  156. package/src/components/organisms/Chat/ContainerItems/index.js +0 -551
  157. package/src/components/organisms/Chat/ContainerItems/styles.js +0 -336
  158. package/src/components/organisms/Chat/ContentChat/ContentChat.stories.js +0 -102
  159. package/src/components/organisms/Chat/ContentChat/Rotoplas.jpeg +0 -0
  160. package/src/components/organisms/Chat/ContentChat/THD.png +0 -0
  161. package/src/components/organisms/Chat/ContentChat/index.js +0 -900
  162. package/src/components/organisms/Chat/ContentChat/styles.js +0 -41
  163. package/src/components/organisms/Chat/Footer/Footer.stories.js +0 -22
  164. package/src/components/organisms/Chat/Footer/index.js +0 -669
  165. package/src/components/organisms/Chat/Footer/styles.js +0 -286
  166. package/src/components/organisms/Chat/Header/Header.stories.js +0 -66
  167. package/src/components/organisms/Chat/Header/index.js +0 -94
  168. package/src/components/organisms/Chat/Header/styles.js +0 -49
  169. package/src/components/organisms/Chat/index.js +0 -294
  170. package/src/components/organisms/Chat/styles.js +0 -42
  171. package/src/components/organisms/Modal/Modal.stories.js +0 -55
  172. package/src/components/organisms/Modal/index.js +0 -97
  173. package/src/components/organisms/Modal/styles.js +0 -103
  174. package/src/global-files/handle_http.js +0 -231
  175. package/src/global-files/utils.js +0 -300
@@ -1,52 +0,0 @@
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
- };
@@ -1,55 +0,0 @@
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
- `;
@@ -1,51 +0,0 @@
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
- };
@@ -1,59 +0,0 @@
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
- };
@@ -1,42 +0,0 @@
1
- import { FontFamily } from "../../../global-files/variables";
2
- import styled from "styled-components";
3
-
4
- export const Container = styled.div`
5
- width: fit-content;
6
- //margin: 100px 0px 0px 100px; modo dev
7
- //border: 1px solid red; modo dev
8
-
9
- + .MuiTooltip-popper {
10
- background-color: transparent;
11
-
12
- .MuiTooltip-tooltip {
13
- --background: white;
14
- box-shadow: 0px 0px 10px 1px gray;
15
- background-color: var(--background);
16
- padding: 10px;
17
- border-radius: 7px;
18
- max-width: 60vw;
19
- font-family: ${FontFamily.RobotoMedium}, sans-serif;
20
- font-size: 12px;
21
- text-align: left;
22
- color: #262626;
23
-
24
- .MuiTooltip-arrow {
25
- color: var(--background);
26
- }
27
- }
28
-
29
- &[data-popper-placement*="bottom"] .MuiTooltip-tooltip {
30
- margin-top: 10px;
31
- }
32
- &[data-popper-placement*="top"] .MuiTooltip-tooltip {
33
- margin-bottom: 10px;
34
- }
35
- &[data-popper-placement*="left"] .MuiTooltip-tooltip {
36
- margin-right: 10px;
37
- }
38
- &[data-popper-placement*="right"] .MuiTooltip-tooltip {
39
- margin-left: 10px;
40
- }
41
- }
42
- `;
@@ -1,54 +0,0 @@
1
- import { ButtonDownloadFile } from "./index";
2
- export default {
3
- title: "Components/molecules/ButtonDownloadFile",
4
- component: ButtonDownloadFile,
5
- argTypes: {
6
- type: {
7
- options: [
8
- undefined,
9
- "white",
10
- "whiteS2",
11
- "pink",
12
- "gray",
13
- "purple",
14
- "black",
15
- ],
16
- control: { type: "select" },
17
- },
18
- borderType: {
19
- options: [undefined, "rectangle", "circle"],
20
- control: { type: "select" },
21
- },
22
- },
23
- };
24
-
25
- const Template = (args) => <ButtonDownloadFile {...args} />;
26
-
27
- export const DownloadFileOk = Template.bind({});
28
- DownloadFileOk.args = {
29
- type: undefined,
30
- transparent: false,
31
- borderType: undefined,
32
- size: "70",
33
- onDownload: (error) => {
34
- error &&
35
- alert("mensaje: " + error.message + "\nDetalles: " + error.details);
36
- },
37
- url: `https://content-management-images.s3.amazonaws.com/84300/1/chat/acuse RFC-8b2eb177-5bfc-4266-9b26-4e7297880594-9e2e5853-4697-442a-8ff7-3b7a1ede0856.pdf`,
38
- };
39
-
40
- export const DownloadFileError = Template.bind({});
41
- DownloadFileError.args = {
42
- id: "",
43
- key: "",
44
- color: undefined,
45
- background: undefined,
46
- borderType: "circle",
47
- size: "70",
48
- width: "100px",
49
- onDownload: (error) => {
50
- error &&
51
- alert("mensaje: " + error.message + "\nDetalles: " + error.details);
52
- },
53
- url: `https://content-management-images.s3.amazonaws.com/84300/1/chat/noExiste.pdf`,
54
- };
@@ -1,111 +0,0 @@
1
- import { Container } from "./styles";
2
- import { faArrowDown as IconDownload } from "@fortawesome/free-solid-svg-icons";
3
- import { useState } from "react";
4
- import { ButtonV2 } from "../../atoms/ButtonV2";
5
- import { IconFile } from "../../atoms/IconFile";
6
- import axios from "axios";
7
- import { getFileExtension } from "../../../global-files/utils";
8
-
9
- export const ButtonDownloadFile = (props) => {
10
- const {
11
- id,
12
- key,
13
- className,
14
- type, // white | pink | gray | purple (white -> predeterminado)
15
- transparent, // boolean
16
- size, // number ... default (13)
17
- borderType, // rectangle || circle || (cualquier otro valor -> no borde)
18
- url, // src del file
19
- onDownload, // ( {message , details} ) => {}
20
- } = props;
21
- const [showDownload, setShowDownload] = useState(false);
22
- const [loading, setLoading] = useState(false);
23
-
24
- const getSrc = () => {
25
- const temp = url.split("/");
26
- return temp[temp.length - 1];
27
- };
28
-
29
- const getFile = async () => {
30
- try {
31
- setLoading(true);
32
- const responseFile = await axios({
33
- url: url,
34
- method: "GET",
35
- responseType: "blob",
36
- });
37
- if (responseFile.status != 200) {
38
- setLoading(false);
39
- onDownload &&
40
- onDownload({
41
- message: "No se pudo descargar el archivo",
42
- details: responseFile.statusText,
43
- });
44
- return;
45
- }
46
- const newUrl = window.URL.createObjectURL(new Blob([responseFile.data]));
47
- const link = document.createElement("a");
48
- link.href = newUrl;
49
- link.setAttribute("download", getSrc());
50
- link.style.display = "none";
51
- document.body.appendChild(link);
52
- setLoading(false);
53
- link.click();
54
- document.body.removeChild(link);
55
- } catch (err) {
56
- setLoading(false);
57
- onDownload &&
58
- onDownload({
59
- message: "No se pudo descargar el archivo",
60
- details: err.message,
61
- });
62
- }
63
- };
64
-
65
- return (
66
- <>
67
- <Container
68
- id={id}
69
- key={key}
70
- className={className}
71
- borderType={borderType}
72
- onMouseEnter={(event) => {
73
- if (!showDownload) {
74
- setShowDownload(true);
75
- //console.log("showDownload");
76
- }
77
- }}
78
- onMouseLeave={(event) => {
79
- if (!loading) {
80
- setShowDownload(false);
81
- //console.log("showIconFile");
82
- }
83
- }}
84
- >
85
- {showDownload ? (
86
- <ButtonV2
87
- className={"buttonDownload"}
88
- type={type}
89
- transparent={transparent}
90
- size={size}
91
- borderType={borderType}
92
- icon={IconDownload}
93
- isLoading={loading}
94
- onClick={async (event) => {
95
- getFile();
96
- }}
97
- />
98
- ) : (
99
- <IconFile
100
- className="iconFile"
101
- type={type}
102
- transparent={transparent}
103
- size={size}
104
- borderType={borderType}
105
- ext={getFileExtension(getSrc())}
106
- />
107
- )}
108
- </Container>
109
- </>
110
- );
111
- };
@@ -1,66 +0,0 @@
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
- height: fit-content;
7
- min-width: min-content;
8
- min-height: min-content;
9
- overflow: hidden;
10
- display: grid;
11
- place-items: center;
12
- border-radius: ${({ borderType }) => {
13
- return borderType?.toLowerCase() === "rectangle"
14
- ? "10%"
15
- : borderType?.toLowerCase() === "circle"
16
- ? "50%"
17
- : "none";
18
- }};
19
-
20
- .buttonDownload {
21
- width: 100%;
22
- height: 100%;
23
- .button {
24
- // tipos de botones fill
25
- &.fill {
26
- &.white:hover {
27
- background-color: white;
28
- }
29
- &.whiteS2:hover {
30
- background-color: white;
31
- }
32
- &.pink:hover {
33
- background-color: #e33aa9;
34
- }
35
- &.gray:hover {
36
- background-color: #e8e5e5;
37
- }
38
- &.purple:hover {
39
- background-color: #f7f7fc;
40
- }
41
- }
42
-
43
- // tipos de botones transparent
44
- &.transparent {
45
- &.white:hover {
46
- color: white;
47
- }
48
- &.pink:hover {
49
- color: #e33aa9;
50
- }
51
- &.gray:hover {
52
- .icon,
53
- .iconLoading {
54
- color: #7b7979;
55
- }
56
- }
57
- &.purple:hover {
58
- color: #8a6caa;
59
- }
60
- &.black:hover {
61
- color: #262626;
62
- }
63
- }
64
- }
65
- }
66
- `;
@@ -1,46 +0,0 @@
1
- import { ImageTooltip } from "./index";
2
-
3
- export default {
4
- title: "Components/molecules/ImageTooltip",
5
- component: ImageTooltip,
6
- argTypes: {},
7
- };
8
-
9
- const Template = (args) => <ImageTooltip {...args} />;
10
-
11
- const keyS3_test =
12
- "84300/1/chat/playa-213f791b-d890-48e1-be19-28bf5a95d517.jpeg";
13
- const srcTest = `https://content-management-images.s3.amazonaws.com/${keyS3_test}`;
14
- export const ImageTooltipTest = Template.bind({});
15
- ImageTooltipTest.args = {
16
- width: "200px",
17
- sizeLoading: "50",
18
- colorLoading: "#bbbbbb",
19
- src: "bn",
20
- componentDefault: <label> test error </label>,
21
- componentTooltip: <label> mensaje del tooltip test </label>,
22
- };
23
-
24
- const keyS3_OK =
25
- "84300/1/chat/f6579ed5-16e5-48d8-ace5-6be8e8e68f53-38896acf-9179-4686-9088-9784df624ab8.png";
26
- const srcOK = `https://content-management-images.s3.amazonaws.com/${keyS3_OK}`;
27
- export const ImageTooltipOK = Template.bind({});
28
- ImageTooltipOK.args = {
29
- width: "250px",
30
- sizeLoading: "40",
31
- src: srcOK,
32
- componentDefault: <label> img no cargada </label>,
33
- componentTooltip: <label> mensaje del tooltip OK </label>,
34
- };
35
-
36
- const keyS3_ERROR =
37
- "84300/1/chat/21dba1da-3c60-42c4-97bd-033664808256-fb19ff57-b91c-4ef2-ba2a-d857b55fb33b.svg";
38
- const srcERROR = `https://content-management-images.s3.amazonaws.com/${keyS3_ERROR}`;
39
- export const ImageTooltipERROR = Template.bind({});
40
- ImageTooltipERROR.args = {
41
- width: "300px",
42
- sizeLoading: "60",
43
- src: srcERROR,
44
- componentDefault: <label> ERROR al cargar </label>,
45
- componentTooltip: <label> mensaje del tooltip ERROR </label>,
46
- };
@@ -1,62 +0,0 @@
1
- import { Container, ContainerLoading, Img } from "./styles";
2
- import { FontAwesomeIcon as Icon } from "@fortawesome/react-fontawesome";
3
- import { faSpinner as iconLoading } from "@fortawesome/free-solid-svg-icons";
4
- import { useState, useEffect } from "react";
5
- import { Tooltip } from "../../atoms/Tooltip";
6
-
7
- export const ImageTooltip = (props) => {
8
- const {
9
- className, // string
10
- width, // string
11
- sizeLoading, // number
12
- colorLoading, // string
13
- classNameLoading, // string
14
- src, // imagen a cargar (string)
15
- componentDefault, // componente a mostrar en caso de que no cargue src (JSX)
16
- classNameImg, // string
17
- classNameTooltip,
18
- componentTooltip,
19
- } = props;
20
- const [imgLoad, setImgLoad] = useState();
21
- const [loading, setLoading] = useState(false);
22
-
23
- /* solo para hacer pruebas en modo dev
24
- useEffect(() => {
25
- setTimeout(() => {
26
- setLoading(false);
27
- }, 5000);
28
- }, []);
29
- */
30
-
31
- return (
32
- <Tooltip
33
- position={"topCenter"}
34
- addArrow={false}
35
- transitionType={"zoom"}
36
- followCursor={false}
37
- className={className}
38
- classNameTooltip={classNameTooltip}
39
- componentTooltip={imgLoad !== undefined && !loading && componentTooltip}
40
- >
41
- {src && (imgLoad === undefined || loading) && (
42
- <ContainerLoading
43
- className={classNameLoading}
44
- sizeLoading={sizeLoading}
45
- colorLoading={colorLoading}
46
- >
47
- <Icon pulse icon={iconLoading} />
48
- </ContainerLoading>
49
- )}
50
-
51
- {(!src || (imgLoad === false && !loading)) && componentDefault}
52
-
53
- <Img
54
- className={classNameImg}
55
- src={src}
56
- onLoad={(event) => setImgLoad(true)}
57
- onError={(event) => setImgLoad(false)}
58
- show={imgLoad === true && !loading}
59
- />
60
- </Tooltip>
61
- );
62
- };
@@ -1,18 +0,0 @@
1
- import styled from "styled-components";
2
- import { GlobalColors, FontFamily } from "../../../global-files/variables";
3
-
4
- export const ContainerLoading = styled.div`
5
- width: 100%;
6
- display: grid;
7
- place-items: center;
8
- min-width: min-content;
9
- font-size: ${({ sizeLoading }) => (sizeLoading ? sizeLoading : "30")}px;
10
- color: ${({ colorLoading }) => (colorLoading ? colorLoading : "#9e2674")};
11
- padding: 5px;
12
- `;
13
-
14
- export const Img = styled.img`
15
- display: ${({ show }) => (show ? "grid" : "none")};
16
- width: 100%;
17
- object-fit: contain;
18
- `;