contentoh-components-library 21.2.84 → 21.2.86

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 (179) hide show
  1. package/.env.development +6 -1
  2. package/dist/assets/fonts/Roboto/Roboto-Medium.ttf +0 -0
  3. package/dist/assets/fonts/Roboto/Roboto-Regular.ttf +0 -0
  4. package/dist/assets/images/defaultImages/Spinner.gif +0 -0
  5. package/dist/assets/images/defaultImages/notFound.svg +124 -0
  6. package/dist/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +72 -0
  7. package/dist/components/atoms/ButtonFileChooser/index.js +116 -0
  8. package/dist/components/atoms/ButtonFileChooser/styles.js +20 -0
  9. package/dist/components/atoms/ButtonV2/ButtonV2.stories.js +66 -0
  10. package/dist/components/atoms/ButtonV2/index.js +109 -0
  11. package/dist/components/atoms/ButtonV2/styles.js +53 -0
  12. package/dist/components/atoms/CustomIcon/CustomIcon.stories.js +50 -0
  13. package/dist/components/atoms/CustomIcon/index.js +38 -0
  14. package/dist/components/atoms/CustomIcon/styles.js +33 -0
  15. package/dist/components/atoms/IconFile/IconFile.stories.js +48 -0
  16. package/dist/components/atoms/IconFile/index.js +251 -0
  17. package/dist/components/atoms/IconFile/styles.js +23 -0
  18. package/dist/components/atoms/Image/Image.stories.js +63 -0
  19. package/dist/components/atoms/Image/index.js +72 -0
  20. package/dist/components/atoms/Image/styles.js +40 -0
  21. package/dist/components/atoms/ImageLink/ImageLink.stories.js +63 -0
  22. package/dist/components/atoms/ImageLink/index.js +75 -0
  23. package/dist/components/atoms/ImageLink/styles.js +40 -0
  24. package/dist/components/atoms/ImagePreview/ImagePreview.stories.js +70 -0
  25. package/dist/components/atoms/ImagePreview/index.js +220 -0
  26. package/dist/components/atoms/ImagePreview/styles.js +44 -0
  27. package/dist/components/atoms/InputText/InputText.stories.js +62 -0
  28. package/dist/components/atoms/InputText/index.js +64 -0
  29. package/dist/components/atoms/InputText/styles.js +32 -0
  30. package/dist/components/atoms/NotFound/NotFound.stories.js +36 -0
  31. package/dist/components/atoms/NotFound/index.js +73 -0
  32. package/dist/components/atoms/NotFound/styles.js +20 -0
  33. package/dist/components/atoms/Tooltip/Tooltip.stories.js +36 -6
  34. package/dist/components/atoms/Tooltip/index.js +41 -26
  35. package/dist/components/atoms/Tooltip/styles.js +3 -1
  36. package/dist/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +66 -0
  37. package/dist/components/molecules/ButtonDownloadFile/index.js +179 -0
  38. package/dist/components/molecules/ButtonDownloadFile/styles.js +23 -0
  39. package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +21 -22
  40. package/dist/components/molecules/CustomSelect/SelectItem.js +10 -1
  41. package/dist/components/molecules/HeaderTop/index.js +12 -5
  42. package/dist/components/molecules/HeaderTop/styles.js +1 -1
  43. package/dist/components/molecules/ImageTooltip/ImageTooltip.stories.js +72 -0
  44. package/dist/components/molecules/ImageTooltip/index.js +84 -0
  45. package/dist/components/molecules/ImageTooltip/styles.js +33 -0
  46. package/dist/components/organisms/Chat/Chat.stories.js +215 -0
  47. package/dist/components/organisms/Chat/ChatLists/ChatLists.stories.js +83 -0
  48. package/dist/components/organisms/Chat/ChatLists/index.js +158 -0
  49. package/dist/components/organisms/Chat/ChatLists/styles.js +29 -0
  50. package/dist/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +176 -0
  51. package/dist/components/organisms/Chat/ContainerItems/index.js +570 -0
  52. package/dist/components/organisms/Chat/ContainerItems/styles.js +20 -0
  53. package/dist/components/organisms/Chat/ContentChat/ContentChat.stories.js +142 -0
  54. package/dist/components/organisms/Chat/ContentChat/index.js +1422 -0
  55. package/dist/components/organisms/Chat/ContentChat/styles.js +20 -0
  56. package/dist/components/organisms/Chat/Footer/Footer.stories.js +43 -0
  57. package/dist/components/organisms/Chat/Footer/index.js +983 -0
  58. package/dist/components/organisms/Chat/Footer/styles.js +32 -0
  59. package/dist/components/organisms/Chat/Header/Header.stories.js +96 -0
  60. package/dist/components/organisms/Chat/Header/index.js +84 -0
  61. package/dist/components/organisms/Chat/Header/styles.js +20 -0
  62. package/dist/components/organisms/Chat/index.js +325 -0
  63. package/dist/components/organisms/Chat/styles.js +29 -0
  64. package/dist/components/organisms/Modal/Modal.stories.js +66 -0
  65. package/dist/components/organisms/Modal/index.js +95 -0
  66. package/dist/components/organisms/Modal/styles.js +20 -0
  67. package/dist/components/pages/Dashboard/Dashboard.stories.js +16 -44
  68. package/dist/components/pages/Dashboard/index.js +10 -17
  69. package/dist/components/pages/ProviderProductEdition/index.js +3 -2
  70. package/dist/components/pages/RetailerProductEdition/index.js +4 -7
  71. package/dist/global-files/fonts.css +18 -0
  72. package/dist/global-files/handle_http.js +383 -0
  73. package/dist/global-files/utils.js +472 -0
  74. package/dist/global-files/variables.js +3 -1
  75. package/dist/index.js +52 -39
  76. package/package.json +13 -1
  77. package/src/assets/fonts/Roboto/Roboto-Medium.ttf +0 -0
  78. package/src/assets/fonts/Roboto/Roboto-Regular.ttf +0 -0
  79. package/src/assets/images/chatPopup/Spinner.gif +0 -0
  80. package/src/assets/images/chatPopup/close.svg +3 -0
  81. package/src/assets/images/chatPopup/defaultImage.png +0 -0
  82. package/src/assets/images/chatPopup/defaultProfile.png +0 -0
  83. package/src/assets/images/chatPopup/doc.svg +1 -0
  84. package/src/assets/images/chatPopup/document.svg +1 -0
  85. package/src/assets/images/chatPopup/iconChat.svg +19 -0
  86. package/src/assets/images/chatPopup/iconPlus.svg +3 -0
  87. package/src/assets/images/chatPopup/pdf.svg +75 -0
  88. package/src/assets/images/chatPopup/remove.svg +4 -0
  89. package/src/assets/images/chatPopup/send.svg +3 -0
  90. package/src/assets/images/chatPopup/svgIcon.svg +109 -0
  91. package/src/assets/images/chatPopup/upload_file.svg +3 -0
  92. package/src/assets/images/chatPopup/xls.svg +53 -0
  93. package/src/assets/images/customSelect/starIcon.svg +14 -0
  94. package/src/assets/images/defaultImages/Spinner.gif +0 -0
  95. package/src/assets/images/defaultImages/notFound.svg +124 -0
  96. package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +47 -0
  97. package/src/components/atoms/ButtonFileChooser/index.js +70 -0
  98. package/src/components/atoms/ButtonFileChooser/styles.js +4 -0
  99. package/src/components/atoms/ButtonV2/ButtonV2.stories.js +50 -0
  100. package/src/components/atoms/ButtonV2/index.js +74 -0
  101. package/src/components/atoms/ButtonV2/styles.js +187 -0
  102. package/src/components/atoms/CustomIcon/CustomIcon.stories.js +36 -0
  103. package/src/components/atoms/CustomIcon/index.js +41 -0
  104. package/src/components/atoms/CustomIcon/styles.js +85 -0
  105. package/src/components/atoms/IconFile/IconFile.stories.js +35 -0
  106. package/src/components/atoms/IconFile/index.js +120 -0
  107. package/src/components/atoms/IconFile/styles.js +67 -0
  108. package/src/components/atoms/Image/Image.stories.js +43 -0
  109. package/src/components/atoms/Image/index.js +54 -0
  110. package/src/components/atoms/Image/styles.js +25 -0
  111. package/src/components/atoms/ImageLink/ImageLink.stories.js +43 -0
  112. package/src/components/atoms/ImageLink/index.js +58 -0
  113. package/src/components/atoms/ImageLink/styles.js +30 -0
  114. package/src/components/atoms/ImagePreview/ImagePreview.stories.js +52 -0
  115. package/src/components/atoms/ImagePreview/index.js +192 -0
  116. package/src/components/atoms/ImagePreview/styles.js +77 -0
  117. package/src/components/atoms/InputText/InputText.stories.js +40 -0
  118. package/src/components/atoms/InputText/index.js +63 -0
  119. package/src/components/atoms/InputText/styles.js +89 -0
  120. package/src/components/atoms/NotFound/NotFound.stories.js +19 -0
  121. package/src/components/atoms/NotFound/index.js +53 -0
  122. package/src/components/atoms/NotFound/styles.js +55 -0
  123. package/src/components/atoms/Tooltip/Tooltip.stories.js +51 -0
  124. package/src/components/atoms/Tooltip/index.js +59 -0
  125. package/src/components/atoms/Tooltip/styles.js +42 -0
  126. package/src/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +54 -0
  127. package/src/components/molecules/ButtonDownloadFile/index.js +113 -0
  128. package/src/components/molecules/ButtonDownloadFile/styles.js +66 -0
  129. package/src/components/molecules/CustomSelect/CustomSelect.stories.js +20 -12
  130. package/src/components/molecules/CustomSelect/SelectItem.js +7 -0
  131. package/src/components/molecules/HeaderTop/index.js +11 -6
  132. package/src/components/molecules/HeaderTop/styles.js +4 -0
  133. package/src/components/molecules/ImageTooltip/ImageTooltip.stories.js +46 -0
  134. package/src/components/molecules/ImageTooltip/index.js +64 -0
  135. package/src/components/molecules/ImageTooltip/styles.js +18 -0
  136. package/src/components/organisms/Chat/Chat.stories.js +199 -0
  137. package/src/components/organisms/Chat/ChatLists/ChatLists.stories.js +65 -0
  138. package/src/components/organisms/Chat/ChatLists/Rotoplas.jpeg +0 -0
  139. package/src/components/organisms/Chat/ChatLists/THD.png +0 -0
  140. package/src/components/organisms/Chat/ChatLists/index.js +141 -0
  141. package/src/components/organisms/Chat/ChatLists/styles.js +162 -0
  142. package/src/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +142 -0
  143. package/src/components/organisms/Chat/ContainerItems/index.js +551 -0
  144. package/src/components/organisms/Chat/ContainerItems/styles.js +336 -0
  145. package/src/components/organisms/Chat/ContentChat/ContentChat.stories.js +102 -0
  146. package/src/components/organisms/Chat/ContentChat/Rotoplas.jpeg +0 -0
  147. package/src/components/organisms/Chat/ContentChat/THD.png +0 -0
  148. package/src/components/organisms/Chat/ContentChat/index.js +900 -0
  149. package/src/components/organisms/Chat/ContentChat/styles.js +41 -0
  150. package/src/components/organisms/Chat/Footer/Footer.stories.js +22 -0
  151. package/src/components/organisms/Chat/Footer/index.js +669 -0
  152. package/src/components/organisms/Chat/Footer/styles.js +286 -0
  153. package/src/components/organisms/Chat/Header/Header.stories.js +66 -0
  154. package/src/components/organisms/Chat/Header/index.js +94 -0
  155. package/src/components/organisms/Chat/Header/styles.js +49 -0
  156. package/src/components/organisms/Chat/index.js +295 -0
  157. package/src/components/organisms/Chat/styles.js +42 -0
  158. package/src/components/organisms/Modal/Modal.stories.js +55 -0
  159. package/src/components/organisms/Modal/index.js +97 -0
  160. package/src/components/organisms/Modal/styles.js +103 -0
  161. package/src/components/pages/Dashboard/Dashboard.stories.js +16 -47
  162. package/src/components/pages/Dashboard/index.js +4 -13
  163. package/src/components/pages/ProviderProductEdition/index.js +6 -7
  164. package/src/components/pages/RetailerProductEdition/index.js +5 -4
  165. package/src/global-files/fonts.css +18 -0
  166. package/src/global-files/handle_http.js +231 -0
  167. package/src/global-files/utils.js +300 -0
  168. package/src/global-files/variables.js +2 -0
  169. package/src/index.js +1 -0
  170. package/dist/components/atoms/ChatPopUp/ChatPopUp.stories.js +0 -28
  171. package/dist/components/atoms/ChatPopUp/index.js +0 -841
  172. package/dist/components/atoms/ChatPopUp/styles.js +0 -27
  173. package/dist/components/atoms/ChatPopUp/utils/handlersChat.js +0 -182
  174. package/dist/components/atoms/StatusTag/StatusTag.stories.js +0 -48
  175. package/dist/components/atoms/StatusTag/index.js +0 -58
  176. package/dist/components/atoms/StatusTag/styles.js +0 -20
  177. package/dist/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +0 -37
  178. package/dist/components/pages/RegistrationLoginFirstStep/index.js +0 -269
  179. package/dist/components/pages/RegistrationLoginFirstStep/styles.js +0 -20
@@ -0,0 +1,187 @@
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
+ padding: 0px;
7
+ cursor: ${({ disabled, isLoading }) =>
8
+ disabled || isLoading ? "not-allowed" : "pointer"};
9
+ border-radius: ${({ label, borderType, transparent }) => {
10
+ return borderType?.toLowerCase() === "rectangle"
11
+ ? "6px"
12
+ : borderType?.toLowerCase() === "oval"
13
+ ? "17px"
14
+ : borderType?.toLowerCase() === "circle"
15
+ ? "50%"
16
+ : transparent
17
+ ? "6px"
18
+ : label && label?.trim() !== ""
19
+ ? "17px"
20
+ : "6px"; // default rectangle
21
+ }};
22
+ border: none;
23
+
24
+ .button {
25
+ --size: ${({ size }) => (size ? size : "13")}px;
26
+ width: 100%;
27
+ min-width: min-content;
28
+ cursor: inherit;
29
+ display: flex;
30
+ flex-direction: ${({ iconPosition }) =>
31
+ iconPosition === "start" ? "row" : "row-reverse"};
32
+ gap: 7px;
33
+ align-items: center;
34
+ justify-content: center;
35
+ padding: ${({ label, borderType }) => {
36
+ return label && label?.trim() !== ""
37
+ ? "5px 15px" // button con label
38
+ : "5px";
39
+ }};
40
+ border-radius: inherit;
41
+ border: ${({ label, borderType, transparent }) => {
42
+ return ["rectangle", "circle", "oval"].includes(borderType?.toLowerCase())
43
+ ? "1px solid black"
44
+ : transparent
45
+ ? "none"
46
+ : label && label?.trim() !== ""
47
+ ? "1px solid black" // button con label
48
+ : "none"; // button icon sin borde
49
+ }};
50
+ font-family: ${FontFamily.RobotoMedium}, sans-serif;
51
+ font-size: var(--size);
52
+ line-height: 1;
53
+ text-transform: none;
54
+
55
+ // tipos de botones fill
56
+ &.fill {
57
+ &.white {
58
+ background-color: white;
59
+ color: #e33aa9;
60
+ border-color: #e33aa9;
61
+ &:hover {
62
+ background-color: #f4f4f4;
63
+ }
64
+ }
65
+ &.whiteS2 {
66
+ background-color: white;
67
+ color: #7b7979;
68
+ border-color: #f0f0f0;
69
+ &:hover {
70
+ background-color: #f4f4f4;
71
+ }
72
+ }
73
+ &.pink {
74
+ background-color: #e33aa9;
75
+ color: white;
76
+ border-color: #e33aa9;
77
+ &:hover {
78
+ background-color: #b42983;
79
+ }
80
+ }
81
+ &.gray {
82
+ background-color: #e8e5e5;
83
+ color: #262626;
84
+ border-color: #7b7979;
85
+ .icon,
86
+ .iconLoading {
87
+ color: #7b7979;
88
+ }
89
+ &:hover {
90
+ background-color: #d6d3d3;
91
+ }
92
+ }
93
+ &.purple {
94
+ background-color: #f7f7fc;
95
+ color: #8a6caa;
96
+ border-color: #8a6caa;
97
+ &:hover {
98
+ background-color: #e0e0f1;
99
+ }
100
+ }
101
+ }
102
+
103
+ // tipos de botones transparent
104
+ &.transparent {
105
+ &:hover {
106
+ background-color: transparent;
107
+ }
108
+ &.white {
109
+ color: white;
110
+ border-color: #e33aa9;
111
+ &:hover {
112
+ color: #d6d4d4;
113
+ }
114
+ }
115
+ &.pink {
116
+ color: #e33aa9;
117
+ border-color: #e33aa9;
118
+ &:hover {
119
+ color: #b42983;
120
+ }
121
+ }
122
+ &.gray {
123
+ color: #262626;
124
+ border-color: #7b7979;
125
+ .icon,
126
+ .iconLoading {
127
+ color: #7b7979;
128
+ transition: inherit;
129
+ }
130
+ &:hover {
131
+ color: #7b7979;
132
+ .icon,
133
+ .iconLoading {
134
+ color: #bdbbbb;
135
+ }
136
+ }
137
+ }
138
+ &.purple {
139
+ color: #8a6caa;
140
+ border-color: #8a6caa;
141
+ &:hover {
142
+ color: #714f95;
143
+ }
144
+ }
145
+ &.black {
146
+ color: #262626;
147
+ border-color: #262626;
148
+ &:hover {
149
+ color: #7b7979;
150
+ }
151
+ }
152
+ }
153
+
154
+ .icon,
155
+ .iconLoading {
156
+ display: grid;
157
+ place-items: center;
158
+ color: inherit;
159
+ font-size: ${({ label }) => {
160
+ return label && label?.trim() !== ""
161
+ ? "calc(var(--size) + 3px)" // button with label
162
+ : "var(--size)"; // button icon
163
+ }};
164
+ }
165
+ .iconLoading {
166
+ font-size: ${({ icon }) => !icon && "var(--size)"};
167
+ }
168
+
169
+ // mismo estilo desabilitado para cualquier tipo de boton
170
+ &:disabled {
171
+ background-color: #fcebf7 !important;
172
+ color: #7b7979 !important;
173
+ border-color: #7b7979 !important;
174
+
175
+ .icon {
176
+ color: #9e9c9c !important;
177
+ }
178
+ .iconLoading {
179
+ color: #9e2674 !important;
180
+ }
181
+
182
+ &:hover {
183
+ background-color: #fcebf7 !important;
184
+ }
185
+ }
186
+ }
187
+ `;
@@ -0,0 +1,36 @@
1
+ import CustomIcon from "./index";
2
+ import { faCamera as iconCamera } from "@fortawesome/free-solid-svg-icons";
3
+
4
+ export default {
5
+ title: "Components/atoms/CustomIcon",
6
+ component: CustomIcon,
7
+ argTypes: {
8
+ type: {
9
+ options: [
10
+ undefined,
11
+ "white",
12
+ "whiteS2",
13
+ "pink",
14
+ "gray",
15
+ "purple",
16
+ "black",
17
+ ],
18
+ control: { type: "select" },
19
+ },
20
+ borderType: {
21
+ options: [undefined, "rectangle", "circle"],
22
+ control: { type: "select" },
23
+ },
24
+ },
25
+ };
26
+
27
+ const Template = (args) => <CustomIcon {...args} />;
28
+
29
+ export const ButtonTest = Template.bind({});
30
+ ButtonTest.args = {
31
+ type: undefined,
32
+ transparent: false,
33
+ borderType: undefined,
34
+ size: "20",
35
+ icon: iconCamera,
36
+ };
@@ -0,0 +1,41 @@
1
+ import { Container } from "./styles";
2
+ import { FontAwesomeIcon as Icon } from "@fortawesome/react-fontawesome";
3
+ import React from "react";
4
+
5
+ export default function CustomIcon(props) {
6
+ const {
7
+ id,
8
+ key,
9
+ className,
10
+ type, // white | whiteS2 | pink | gray || purple | black => (default white)
11
+ transparent, // boolean
12
+ size, // number ... default (13)
13
+ borderType, // rectangle || circle (default)
14
+ icon, // icon fontawesome
15
+ } = props;
16
+
17
+ return (
18
+ <>
19
+ {icon ? (
20
+ <Container
21
+ id={id}
22
+ key={key}
23
+ className={
24
+ "container-icon " +
25
+ (["white", "whiteS2", "pink", "gray", "purple", "black"].includes(
26
+ type
27
+ )
28
+ ? type
29
+ : "white") +
30
+ (transparent ? " transparent " : " fill ") +
31
+ className
32
+ }
33
+ borderType={borderType}
34
+ size={size}
35
+ >
36
+ <Icon icon={icon} />
37
+ </Container>
38
+ ) : null}
39
+ </>
40
+ );
41
+ }
@@ -0,0 +1,85 @@
1
+ import styled from "styled-components";
2
+ import { GlobalColors, FontFamily } from "../../../global-files/variables";
3
+
4
+ export const Container = styled.i`
5
+ width: fit-content;
6
+ min-width: min-content;
7
+ cursor: default;
8
+ display: grid;
9
+ place-items: center;
10
+ font-size: ${({ size }) => (size ? size : "13")}px;
11
+ border-radius: ${({ borderType }) => {
12
+ return borderType?.toLowerCase() === "rectangle"
13
+ ? "6px"
14
+ : borderType?.toLowerCase() === "circle"
15
+ ? "50%"
16
+ : "0px";
17
+ }};
18
+ padding: ${({ borderType }) => {
19
+ return ["rectangle", "circle"].includes(borderType?.toLowerCase())
20
+ ? "5px"
21
+ : "0px";
22
+ }};
23
+ border: ${({ borderType, transparent }) => {
24
+ return ["rectangle", "circle"].includes(borderType?.toLowerCase())
25
+ ? "1px solid black"
26
+ : "none";
27
+ }};
28
+
29
+ // tipos de iconos fill
30
+ &.fill {
31
+ &.white {
32
+ background-color: white;
33
+ color: #e33aa9;
34
+ border-color: #e33aa9;
35
+ }
36
+ &.whiteS2 {
37
+ background-color: white;
38
+ color: #7b7979;
39
+ border-color: #f0f0f0;
40
+ }
41
+ &.pink {
42
+ background-color: #e33aa9;
43
+ color: white;
44
+ border-color: #e33aa9;
45
+ }
46
+ &.gray {
47
+ background-color: #e8e5e5;
48
+ border-color: #7b7979;
49
+ color: #7b7979;
50
+ }
51
+ &.purple {
52
+ background-color: #f7f7fc;
53
+ color: #8a6caa;
54
+ border-color: #8a6caa;
55
+ }
56
+ }
57
+
58
+ // tipos de iconos transparent
59
+ &.transparent {
60
+ &.white {
61
+ color: white;
62
+ border-color: #e33aa9;
63
+ }
64
+ &.whiteS2 {
65
+ color: #7b7979;
66
+ border-color: #f0f0f0;
67
+ }
68
+ &.pink {
69
+ color: #e33aa9;
70
+ border-color: #e33aa9;
71
+ }
72
+ &.gray {
73
+ color: #7b7979;
74
+ border-color: #7b7979;
75
+ }
76
+ &.purple {
77
+ color: #8a6caa;
78
+ border-color: #8a6caa;
79
+ }
80
+ &.black {
81
+ color: #262626;
82
+ border-color: #262626;
83
+ }
84
+ }
85
+ `;
@@ -0,0 +1,35 @@
1
+ import IconFile from "./index";
2
+
3
+ export default {
4
+ title: "Components/atoms/IconFile",
5
+ component: IconFile,
6
+ argTypes: {
7
+ type: {
8
+ options: [
9
+ undefined,
10
+ "white",
11
+ "whiteS2",
12
+ "pink",
13
+ "gray",
14
+ "purple",
15
+ "black",
16
+ ],
17
+ control: { type: "select" },
18
+ },
19
+ borderType: {
20
+ options: [undefined, "rectangle", "circle"],
21
+ control: { type: "select" },
22
+ },
23
+ },
24
+ };
25
+
26
+ const Template = (args) => <IconFile {...args} />;
27
+
28
+ export const ButtonTest = Template.bind({});
29
+ ButtonTest.args = {
30
+ type: undefined,
31
+ transparent: false,
32
+ borderType: undefined,
33
+ size: "100",
34
+ ext: "doc",
35
+ };
@@ -0,0 +1,120 @@
1
+ import { Container } from "./styles";
2
+ import {
3
+ faFileExcel as IconFileExcel,
4
+ faFileWord as IconFileWord,
5
+ faFilePdf as IconFilePdf,
6
+ faFileCsv as IconFileCsv,
7
+ faFileImage as IconFileImg,
8
+ faFilePowerpoint as IconFilePowerPoint,
9
+ faFileZipper as IconFileZip,
10
+ faFileCode as IconFileCode,
11
+ faFileAudio as IconFileAudio,
12
+ faFileLines as IconFileDefault,
13
+ faFileVideo as IconFileVideo,
14
+ } from "@fortawesome/free-solid-svg-icons";
15
+ import React, { useRef } from "react";
16
+ import CustomIcon from "../CustomIcon";
17
+ import InputText from "../InputText";
18
+
19
+ export default function IconFile(props) {
20
+ const {
21
+ id,
22
+ key,
23
+ className,
24
+ type, // white | whiteS2 | pink | gray | purple | black => (default -> white)
25
+ transparent, // boolean
26
+ size, // number ... default (13)
27
+ borderType, // rectangle || circle || (cualquier otro valor -> no borde)
28
+ ext, // extension del file
29
+ } = props;
30
+ const extensions = {
31
+ // file word
32
+ docx: { icon: IconFileWord, type: "word" },
33
+ docm: { icon: IconFileWord, type: "word" },
34
+ doc: { icon: IconFileWord, type: "word" },
35
+ docs: { icon: IconFileWord, type: "word" },
36
+
37
+ // file excel
38
+ xls: { icon: IconFileExcel, type: "excel" },
39
+ xlsm: { icon: IconFileExcel, type: "excel" },
40
+ xlsx: { icon: IconFileExcel, type: "excel" },
41
+ tsv: { icon: IconFileExcel, type: "excel" },
42
+ // file csv
43
+ csv: { icon: IconFileCsv, type: "csv" },
44
+ // file image
45
+ svg: { icon: IconFileImg, type: "image" },
46
+ gif: { icon: IconFileImg, type: "image" },
47
+ // file pdf
48
+ pdf: { icon: IconFilePdf, type: "pdf" },
49
+ // file power point
50
+ pot: { icon: IconFilePowerPoint, type: "powerPoint" },
51
+ potm: { icon: IconFilePowerPoint, type: "powerPoint" },
52
+ potx: { icon: IconFilePowerPoint, type: "powerPoint" },
53
+ pps: { icon: IconFilePowerPoint, type: "powerPoint" },
54
+ ppsm: { icon: IconFilePowerPoint, type: "powerPoint" },
55
+ ppsx: { icon: IconFilePowerPoint, type: "powerPoint" },
56
+ ppt: { icon: IconFilePowerPoint, type: "powerPoint" },
57
+ pptm: { icon: IconFilePowerPoint, type: "powerPoint" },
58
+ pptx: { icon: IconFilePowerPoint, type: "powerPoint" },
59
+
60
+ // file zip
61
+ rar: { icon: IconFileZip, type: "zip" },
62
+ zip: { icon: IconFileZip, type: "zip" },
63
+ tar: { icon: IconFileZip, type: "zip" },
64
+
65
+ // file code
66
+ xml: { icon: IconFileCode, type: "code" },
67
+ htm: { icon: IconFileCode, type: "code" },
68
+ html: { icon: IconFileCode, type: "code" },
69
+ css: { icon: IconFileCode, type: "code" },
70
+ js: { icon: IconFileCode, type: "code" },
71
+ jsx: { icon: IconFileCode, type: "code" },
72
+ ts: { icon: IconFileCode, type: "code" },
73
+ tsx: { icon: IconFileCode, type: "code" },
74
+ cpp: { icon: IconFileCode, type: "code" },
75
+ c: { icon: IconFileCode, type: "code" },
76
+ java: { icon: IconFileCode, type: "code" },
77
+ php: { icon: IconFileCode, type: "code" },
78
+ json: { icon: IconFileCode, type: "code" },
79
+ sql: { icon: IconFileCode, type: "code" },
80
+
81
+ // file video
82
+ avi: { icon: IconFileVideo, type: "video" },
83
+ mp4: { icon: IconFileVideo, type: "video" },
84
+ mpeg: { icon: IconFileVideo, type: "video" },
85
+ mpg: { icon: IconFileVideo, type: "video" },
86
+ wmv: { icon: IconFileVideo, type: "video" },
87
+
88
+ // file audio
89
+ m4a: { icon: IconFileAudio, type: "audio" },
90
+ mp3: { icon: IconFileAudio, type: "audio" },
91
+ wav: { icon: IconFileAudio, type: "audio" },
92
+ wma: { icon: IconFileAudio, type: "audio" },
93
+ };
94
+ const ref = useRef();
95
+
96
+ return (
97
+ <>
98
+ <Container
99
+ className={
100
+ className +
101
+ (!type && extensions[ext]?.type
102
+ ? " icon-" + extensions[ext].type
103
+ : undefined)
104
+ }
105
+ borderType={borderType}
106
+ >
107
+ <CustomIcon
108
+ id={id}
109
+ key={key}
110
+ className="icon"
111
+ type={type}
112
+ transparent={transparent}
113
+ borderType={borderType}
114
+ size={size}
115
+ icon={extensions[ext]?.icon ?? IconFileDefault}
116
+ />
117
+ </Container>
118
+ </>
119
+ );
120
+ }
@@ -0,0 +1,67 @@
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
+ `;
@@ -0,0 +1,43 @@
1
+ import Image from "./index";
2
+
3
+ export default {
4
+ title: "Components/atoms/Image",
5
+ component: Image,
6
+ argTypes: {},
7
+ };
8
+
9
+ const Template = (args) => <Image {...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
+ };
@@ -0,0 +1,54 @@
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 default function 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
+ } = props;
17
+ const [imgLoad, setImgLoad] = useState();
18
+ const [loading, setLoading] = useState(false);
19
+
20
+ /* solo para hacer pruebas en modo dev
21
+ useEffect(() => {
22
+ setTimeout(() => {
23
+ setLoading(false);
24
+ }, 5000);
25
+ }, []); */
26
+
27
+ return (
28
+ <Container className={className} width={width}>
29
+ {src && (imgLoad === undefined || loading) && (
30
+ <ContainerLoading
31
+ className={classNameLoading}
32
+ sizeLoading={sizeLoading}
33
+ colorLoading={colorLoading}
34
+ >
35
+ <Icon pulse icon={iconLoading} />
36
+ </ContainerLoading>
37
+ )}
38
+
39
+ {(!src || (imgLoad === false && !loading)) && componentDefault}
40
+
41
+ <Img
42
+ className={classNameImg}
43
+ src={src}
44
+ onLoad={(event) => {
45
+ setImgLoad(true);
46
+ }}
47
+ onError={(event) => {
48
+ setImgLoad(false);
49
+ }}
50
+ show={imgLoad === true && !loading}
51
+ />
52
+ </Container>
53
+ );
54
+ }
@@ -0,0 +1,25 @@
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 Img = styled.img`
22
+ display: ${({ show }) => (show ? "grid" : "none")};
23
+ width: 100%;
24
+ object-fit: contain;
25
+ `;