contentoh-components-library 21.3.11 → 21.3.13

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 (125) hide show
  1. package/.env.development +0 -5
  2. package/dist/assets/images/generalButton/closeIcon.svg +2 -2
  3. package/dist/components/atoms/ButtonFileChooser/index.js +25 -33
  4. package/dist/components/atoms/ImagePreview/index.js +0 -14
  5. package/dist/components/atoms/ProgressBar/index.js +6 -36
  6. package/dist/components/atoms/ProgressBar/styles.js +3 -11
  7. package/dist/components/molecules/ButtonDownloadFile/index.js +2 -2
  8. package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +22 -21
  9. package/dist/components/molecules/CustomSelect/SelectItem.js +1 -10
  10. package/dist/components/molecules/HeaderTop/index.js +6 -23
  11. package/dist/components/molecules/HeaderTop/styles.js +1 -1
  12. package/dist/components/molecules/ProductNameHeader/index.js +4 -6
  13. package/dist/components/organisms/Chat/ContainerItems/index.js +15 -49
  14. package/dist/components/organisms/Chat/ContentChat/index.js +81 -131
  15. package/dist/components/organisms/Chat/Footer/index.js +25 -33
  16. package/dist/components/organisms/FullProductNameHeader/index.js +0 -1
  17. package/dist/components/pages/Dashboard/index.js +21 -13
  18. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +50 -65
  19. package/dist/components/pages/ProviderProductEdition/index.js +11 -15
  20. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +86 -60
  21. package/dist/components/pages/RetailerProductEdition/index.js +12 -13
  22. package/dist/global-files/fonts.css +0 -6
  23. package/dist/global-files/handle_http.js +7 -9
  24. package/dist/global-files/utils.js +3 -9
  25. package/dist/global-files/variables.js +0 -2
  26. package/dist/index.js +46 -267
  27. package/package.json +1 -12
  28. package/src/assets/images/generalButton/closeIcon.svg +2 -2
  29. package/src/components/atoms/ProgressBar/index.js +5 -40
  30. package/src/components/atoms/ProgressBar/styles.js +0 -24
  31. package/src/components/molecules/CustomSelect/CustomSelect.stories.js +12 -20
  32. package/src/components/molecules/CustomSelect/SelectItem.js +0 -7
  33. package/src/components/molecules/HeaderTop/index.js +8 -29
  34. package/src/components/molecules/HeaderTop/styles.js +0 -4
  35. package/src/components/molecules/ProductNameHeader/index.js +2 -7
  36. package/src/components/organisms/FullProductNameHeader/index.js +0 -1
  37. package/src/components/pages/Dashboard/index.js +37 -31
  38. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +49 -67
  39. package/src/components/pages/ProviderProductEdition/index.js +7 -16
  40. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +85 -62
  41. package/src/components/pages/RetailerProductEdition/index.js +10 -12
  42. package/src/global-files/fonts.css +0 -6
  43. package/src/global-files/variables.js +0 -2
  44. package/src/index.js +0 -17
  45. package/src/assets/images/customSelect/starIcon.svg +0 -14
  46. package/src/assets/images/defaultImages/Spinner.gif +0 -0
  47. package/src/assets/images/defaultImages/notFound.svg +0 -124
  48. package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +0 -47
  49. package/src/components/atoms/ButtonFileChooser/index.js +0 -69
  50. package/src/components/atoms/ButtonFileChooser/styles.js +0 -4
  51. package/src/components/atoms/ButtonV2/ButtonV2.stories.js +0 -53
  52. package/src/components/atoms/ButtonV2/index.js +0 -85
  53. package/src/components/atoms/ButtonV2/styles.js +0 -217
  54. package/src/components/atoms/CustomIcon/CustomIcon.stories.js +0 -36
  55. package/src/components/atoms/CustomIcon/index.js +0 -41
  56. package/src/components/atoms/CustomIcon/styles.js +0 -85
  57. package/src/components/atoms/IconFile/IconFile.stories.js +0 -35
  58. package/src/components/atoms/IconFile/index.js +0 -119
  59. package/src/components/atoms/IconFile/styles.js +0 -67
  60. package/src/components/atoms/Image/Image.stories.js +0 -51
  61. package/src/components/atoms/Image/index.js +0 -55
  62. package/src/components/atoms/Image/styles.js +0 -34
  63. package/src/components/atoms/ImageLink/ImageLink.stories.js +0 -43
  64. package/src/components/atoms/ImageLink/index.js +0 -57
  65. package/src/components/atoms/ImageLink/styles.js +0 -30
  66. package/src/components/atoms/ImagePreview/ImagePreview.stories.js +0 -52
  67. package/src/components/atoms/ImagePreview/index.js +0 -191
  68. package/src/components/atoms/ImagePreview/styles.js +0 -77
  69. package/src/components/atoms/InputText/InputText.stories.js +0 -39
  70. package/src/components/atoms/InputText/index.js +0 -61
  71. package/src/components/atoms/InputText/styles.js +0 -89
  72. package/src/components/atoms/NotFound/NotFound.stories.js +0 -19
  73. package/src/components/atoms/NotFound/index.js +0 -52
  74. package/src/components/atoms/NotFound/styles.js +0 -55
  75. package/src/components/atoms/SelectItemV2/SelectItemV2.stories.js +0 -26
  76. package/src/components/atoms/SelectItemV2/index.js +0 -61
  77. package/src/components/atoms/SelectItemV2/styles.js +0 -90
  78. package/src/components/atoms/Tooltip/Tooltip.stories.js +0 -51
  79. package/src/components/atoms/Tooltip/index.js +0 -59
  80. package/src/components/atoms/Tooltip/styles.js +0 -42
  81. package/src/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +0 -54
  82. package/src/components/molecules/ButtonDownloadFile/index.js +0 -111
  83. package/src/components/molecules/ButtonDownloadFile/styles.js +0 -66
  84. package/src/components/molecules/Dropdown/Dropdown.stories.js +0 -103
  85. package/src/components/molecules/Dropdown/index.js +0 -150
  86. package/src/components/molecules/Dropdown/styles.js +0 -75
  87. package/src/components/molecules/ImageTooltip/ImageTooltip.stories.js +0 -68
  88. package/src/components/molecules/ImageTooltip/index.js +0 -63
  89. package/src/components/molecules/ImageTooltip/styles.js +0 -18
  90. package/src/components/molecules/SelectV2/SelectV2.stories.js +0 -115
  91. package/src/components/molecules/SelectV2/index.js +0 -357
  92. package/src/components/molecules/SelectV2/styles.js +0 -105
  93. package/src/components/molecules/SelectV2/test.js +0 -61
  94. package/src/components/molecules/SelectV2/test.stories.js +0 -10
  95. package/src/components/organisms/Chat/Chat.stories.js +0 -147
  96. package/src/components/organisms/Chat/ChatLists/ChatLists.stories.js +0 -65
  97. package/src/components/organisms/Chat/ChatLists/Rotoplas.jpeg +0 -0
  98. package/src/components/organisms/Chat/ChatLists/THD.png +0 -0
  99. package/src/components/organisms/Chat/ChatLists/index.js +0 -141
  100. package/src/components/organisms/Chat/ChatLists/styles.js +0 -162
  101. package/src/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +0 -142
  102. package/src/components/organisms/Chat/ContainerItems/index.js +0 -550
  103. package/src/components/organisms/Chat/ContainerItems/styles.js +0 -328
  104. package/src/components/organisms/Chat/ContentChat/ContentChat.stories.js +0 -102
  105. package/src/components/organisms/Chat/ContentChat/Rotoplas.jpeg +0 -0
  106. package/src/components/organisms/Chat/ContentChat/THD.png +0 -0
  107. package/src/components/organisms/Chat/ContentChat/index.js +0 -947
  108. package/src/components/organisms/Chat/ContentChat/styles.js +0 -41
  109. package/src/components/organisms/Chat/Footer/Footer.stories.js +0 -22
  110. package/src/components/organisms/Chat/Footer/index.js +0 -669
  111. package/src/components/organisms/Chat/Footer/styles.js +0 -286
  112. package/src/components/organisms/Chat/Header/Header.stories.js +0 -66
  113. package/src/components/organisms/Chat/Header/index.js +0 -94
  114. package/src/components/organisms/Chat/Header/styles.js +0 -49
  115. package/src/components/organisms/Chat/index.js +0 -235
  116. package/src/components/organisms/Chat/styles.js +0 -42
  117. package/src/components/organisms/Modal/Modal.stories.js +0 -55
  118. package/src/components/organisms/Modal/index.js +0 -97
  119. package/src/components/organisms/Modal/styles.js +0 -103
  120. package/src/components/organisms/RangeCalendar/RangeCalendar.stories.js +0 -16
  121. package/src/components/organisms/RangeCalendar/index.js +0 -121
  122. package/src/components/organisms/RangeCalendar/styles.js +0 -883
  123. package/src/global-files/handle_http.js +0 -231
  124. package/src/global-files/handle_userTech.js +0 -7
  125. package/src/global-files/utils.js +0 -322
@@ -1,67 +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
- min-width: min-content;
7
- min-height: min-content;
8
- overflow: hidden;
9
- cursor: default;
10
- display: grid;
11
- place-items: center;
12
- padding: 0px;
13
- border-radius: ${({ borderType }) => {
14
- return borderType?.toLowerCase() === "rectangle"
15
- ? "6px"
16
- : borderType?.toLowerCase() === "circle"
17
- ? "50%"
18
- : "0px";
19
- }};
20
- border: none;
21
-
22
- // colores de acuerdo al tipo de icono
23
- &.icon-word .icon {
24
- color: #1f3780;
25
- border-color: #1f3780;
26
- }
27
- &.icon-excel .icon {
28
- color: #2d5639;
29
- border-color: #2d5639;
30
- }
31
- &.icon-csv .icon {
32
- color: #6b8e73;
33
- border-color: #6b8e73;
34
- }
35
- &.icon-image .icon {
36
- color: #ca7f4d;
37
- border-color: #ca7f4d;
38
- }
39
- &.icon-pdf .icon {
40
- color: #951a1a;
41
- border-color: #951a1a;
42
- }
43
- &.icon-powerPoint .icon {
44
- color: #ba4f19;
45
- border-color: #ba4f19;
46
- }
47
- &.icon-zip .icon {
48
- color: #b8950c;
49
- border-color: #b8950c;
50
- }
51
- &.icon-code .icon {
52
- color: #1c778e;
53
- border-color: #1c778e;
54
- }
55
- &.icon-video .icon {
56
- color: #a15bb1;
57
- border-color: #a15bb1;
58
- }
59
- &.icon-audio .icon {
60
- color: #3090e9;
61
- border-color: #3090e9;
62
- }
63
- &.icon-default .icon {
64
- color: #5e6265;
65
- border-color: #5e6265;
66
- }
67
- `;
@@ -1,51 +0,0 @@
1
- import { Image } from "./index";
2
-
3
- export default {
4
- title: "Components/atoms/Image",
5
- component: Image,
6
- argTypes: {
7
- borderType: {
8
- options: [undefined, "rectangle", "circle"],
9
- control: { type: "select" },
10
- },
11
- },
12
- };
13
-
14
- const Template = (args) => <Image {...args} />;
15
-
16
- const keyS3_test =
17
- "84300/1/chat/playa-213f791b-d890-48e1-be19-28bf5a95d517.jpeg";
18
- const srcTest = `https://content-management-profile.s3.amazonaws.com/id-59/59.png`;
19
- export const ImageTest = Template.bind({});
20
- ImageTest.args = {
21
- width: "200px",
22
- sizeLoading: "50",
23
- colorLoading: "#bbbbbb",
24
- src: srcTest,
25
- componentDefault: <label> test error </label>,
26
- borderType: undefined,
27
- };
28
-
29
- const keyS3_OK =
30
- "84300/1/chat/f6579ed5-16e5-48d8-ace5-6be8e8e68f53-38896acf-9179-4686-9088-9784df624ab8.png";
31
- const srcOK = `https://content-management-images.s3.amazonaws.com/${keyS3_OK}`;
32
- export const ImageOK = Template.bind({});
33
- ImageOK.args = {
34
- width: "250px",
35
- sizeLoading: "40",
36
- src: srcOK,
37
- componentDefault: <label> img no cargada </label>,
38
- borderType: undefined,
39
- };
40
-
41
- const keyS3_ERROR =
42
- "84300/1/chat/21dba1da-3c60-42c4-97bd-033664808256-fb19ff57-b91c-4ef2-ba2a-d857b55fb33b.svg";
43
- const srcERROR = `https://content-management-images.s3.amazonaws.com/${keyS3_ERROR}`;
44
- export const ImageERROR = Template.bind({});
45
- ImageERROR.args = {
46
- width: "300px",
47
- sizeLoading: "60",
48
- src: srcERROR,
49
- componentDefault: <label> ERROR al cargar </label>,
50
- borderType: undefined,
51
- };
@@ -1,55 +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
-
6
- export const Image = (props) => {
7
- const {
8
- className, // string
9
- width, // string
10
- sizeLoading, // number
11
- colorLoading, // string
12
- classNameLoading, // string
13
- src, // imagen a cargar (string)
14
- componentDefault, // componente a mostrar en caso de que no cargue src (JSX)
15
- classNameImg, // string
16
- borderType, // "rectangle" | "circle" -> por default none
17
- } = props;
18
- const [imgLoad, setImgLoad] = useState();
19
- const [loading, setLoading] = useState(false);
20
-
21
- /* solo para hacer pruebas en modo dev
22
- useEffect(() => {
23
- setTimeout(() => {
24
- setLoading(false);
25
- }, 5000);
26
- }, []); */
27
-
28
- return (
29
- <Container className={className} width={width} borderType={borderType}>
30
- {src && (imgLoad === undefined || loading) && (
31
- <ContainerLoading
32
- className={classNameLoading}
33
- sizeLoading={sizeLoading}
34
- colorLoading={colorLoading}
35
- >
36
- <Icon pulse icon={iconLoading} />
37
- </ContainerLoading>
38
- )}
39
-
40
- {(!src || (imgLoad === false && !loading)) && componentDefault}
41
-
42
- <Img
43
- className={classNameImg}
44
- src={src}
45
- onLoad={(event) => {
46
- setImgLoad(true);
47
- }}
48
- onError={(event) => {
49
- setImgLoad(false);
50
- }}
51
- show={imgLoad === true && !loading}
52
- />
53
- </Container>
54
- );
55
- };
@@ -1,34 +0,0 @@
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
- overflow: hidden;
10
- border-radius: ${({ borderType }) => {
11
- return borderType?.toLowerCase() === "rectangle"
12
- ? "6px"
13
- : borderType?.toLowerCase() === "circle"
14
- ? "50%"
15
- : "0px"; // default none
16
- }};
17
- `;
18
-
19
- export const ContainerLoading = styled.div`
20
- width: 100%;
21
- display: grid;
22
- place-items: center;
23
- min-width: min-content;
24
- font-size: ${({ sizeLoading }) => (sizeLoading ? sizeLoading : "30")}px;
25
- color: ${({ colorLoading }) => (colorLoading ? colorLoading : "#9e2674")};
26
- padding: 5px;
27
- `;
28
-
29
- export const Img = styled.img`
30
- display: ${({ show }) => (show ? "grid" : "none")};
31
- width: 100%;
32
- object-fit: contain;
33
- border-radius: inherit;
34
- `;
@@ -1,43 +0,0 @@
1
- import { ImageLink } from "./index";
2
-
3
- export default {
4
- title: "Components/atoms/ImageLink",
5
- component: ImageLink,
6
- argTypes: {},
7
- };
8
-
9
- const Template = (args) => <ImageLink {...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 ImageTest = Template.bind({});
15
- ImageTest.args = {
16
- width: "200px",
17
- sizeLoading: "50",
18
- colorLoading: "#bbbbbb",
19
- src: srcTest,
20
- componentDefault: <label> test error </label>,
21
- };
22
-
23
- const keyS3_OK =
24
- "84300/1/chat/f6579ed5-16e5-48d8-ace5-6be8e8e68f53-38896acf-9179-4686-9088-9784df624ab8.png";
25
- const srcOK = `https://content-management-images.s3.amazonaws.com/${keyS3_OK}`;
26
- export const ImageOK = Template.bind({});
27
- ImageOK.args = {
28
- width: "250px",
29
- sizeLoading: "40",
30
- src: srcOK,
31
- componentDefault: <label> img no cargada </label>,
32
- };
33
-
34
- const keyS3_ERROR =
35
- "84300/1/chat/21dba1da-3c60-42c4-97bd-033664808256-fb19ff57-b91c-4ef2-ba2a-d857b55fb33b.svg";
36
- const srcERROR = `https://content-management-images.s3.amazonaws.com/${keyS3_ERROR}`;
37
- export const ImageERROR = Template.bind({});
38
- ImageERROR.args = {
39
- width: "300px",
40
- sizeLoading: "60",
41
- src: srcERROR,
42
- componentDefault: <label> ERROR al cargar </label>,
43
- };
@@ -1,57 +0,0 @@
1
- import { Container, ContainerLoading, ContainerLink } 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
-
6
- export const ImageLink = (props) => {
7
- const {
8
- className, // string
9
- width, // string
10
- sizeLoading, // number
11
- colorLoading, // string
12
- src, // imagen a cargar (string)
13
- componentDefault, // componente a mostrar en caso de que no cargue src (JSX)
14
- } = props;
15
- const [imgLoad, setImgLoad] = useState();
16
- const [loading, setLoading] = useState(false);
17
-
18
- /* solo para hacer pruebas en modo dev
19
- useEffect(() => {
20
- setTimeout(() => {
21
- setLoading(false);
22
- }, 5000);
23
- }, []); */
24
-
25
- return (
26
- <Container className={className} width={width}>
27
- {src && (imgLoad === undefined || loading) && (
28
- <ContainerLoading
29
- className={"container-loading"}
30
- sizeLoading={sizeLoading}
31
- colorLoading={colorLoading}
32
- >
33
- <Icon className="icon" pulse icon={iconLoading} />
34
- </ContainerLoading>
35
- )}
36
-
37
- {(!src || (imgLoad === false && !loading)) && componentDefault}
38
-
39
- <ContainerLink
40
- className="container-img"
41
- show={imgLoad === true && !loading}
42
- href={src}
43
- >
44
- <img
45
- className="img"
46
- src={src}
47
- onLoad={(event) => {
48
- setImgLoad(true);
49
- }}
50
- onError={(event) => {
51
- setImgLoad(false);
52
- }}
53
- />
54
- </ContainerLink>
55
- </Container>
56
- );
57
- };
@@ -1,30 +0,0 @@
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
-
11
- export const ContainerLoading = styled.div`
12
- width: 100%;
13
- display: grid;
14
- place-items: center;
15
- min-width: min-content;
16
- font-size: ${({ sizeLoading }) => (sizeLoading ? sizeLoading : "30")}px;
17
- color: ${({ colorLoading }) => (colorLoading ? colorLoading : "#9e2674")};
18
- padding: 5px;
19
- `;
20
-
21
- export const ContainerLink = styled.a`
22
- display: ${({ show }) => (show ? "grid" : "none")};
23
- width: 100%;
24
- cursor: pointer;
25
-
26
- img {
27
- width: 100%;
28
- object-fit: contain;
29
- }
30
- `;
@@ -1,52 +0,0 @@
1
- import { ImagePreview } from "./index";
2
-
3
- export default {
4
- title: "Components/atoms/ImagePreview",
5
- component: ImagePreview,
6
- argTypes: {},
7
- };
8
-
9
- const Template = (args) => <ImagePreview {...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 ImageTest = Template.bind({});
15
- ImageTest.args = {
16
- className: "modal-imagePreview",
17
- width: "200px",
18
- sizeLoading: "50",
19
- colorLoading: "#bbbbbb",
20
- url: srcTest,
21
- imageName: "playa-213f791b-d890-48e1-be19-28bf5a95d517.jpeg",
22
- showButtonDownload: true,
23
- componentDefault: <label> test error </label>,
24
- };
25
-
26
- const keyS3_OK =
27
- "84300/1/chat/f6579ed5-16e5-48d8-ace5-6be8e8e68f53-38896acf-9179-4686-9088-9784df624ab8.png";
28
- const srcOK = `https://content-management-images.s3.amazonaws.com/${keyS3_OK}`;
29
- export const ImageOK = Template.bind({});
30
- ImageOK.args = {
31
- width: "250px",
32
- sizeLoading: "40",
33
- url: srcOK,
34
- imageName:
35
- "f6579ed5-16e5-48d8-ace5-6be8e8e68f53-38896acf-9179-4686-9088-9784df624ab8.png",
36
- showButtonDownload: true,
37
- componentDefault: <label> img no cargada </label>,
38
- };
39
-
40
- const keyS3_ERROR =
41
- "84300/1/chat/21dba1da-3c60-42c4-97bd-033664808256-fb19ff57-b91c-4ef2-ba2a-d857b55fb33b.svg";
42
- const srcERROR = `https://content-management-images.s3.amazonaws.com/${keyS3_ERROR}`;
43
- export const ImageERROR = Template.bind({});
44
- ImageERROR.args = {
45
- width: "300px",
46
- sizeLoading: "60",
47
- url: srcERROR,
48
- imageName:
49
- "21dba1da-3c60-42c4-97bd-033664808256-fb19ff57-b91c-4ef2-ba2a-d857b55fb33b.svg",
50
- showButtonDownload: true,
51
- componentDefault: <label> ERROR al cargar </label>,
52
- };
@@ -1,191 +0,0 @@
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
- };
@@ -1,77 +0,0 @@
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
- `;
@@ -1,39 +0,0 @@
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
- };