contentoh-components-library 21.3.19 → 21.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.development +5 -0
- package/.env.production +2 -2
- package/dist/assets/images/customSelect/starIcon.svg +14 -0
- package/dist/assets/images/defaultImages/Spinner.gif +0 -0
- package/dist/assets/images/defaultImages/notFound.svg +124 -0
- package/dist/assets/images/generalButton/closeIcon.svg +2 -2
- package/dist/assets/sounds/newMessage.mp3 +0 -0
- package/dist/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +72 -0
- package/dist/components/atoms/ButtonFileChooser/index.js +110 -0
- package/dist/components/atoms/ButtonFileChooser/styles.js +20 -0
- package/dist/components/atoms/ButtonV2/ButtonV2.stories.js +66 -0
- package/dist/components/atoms/ButtonV2/index.js +110 -0
- package/dist/components/atoms/ButtonV2/styles.js +53 -0
- package/dist/components/atoms/CustomIcon/CustomIcon.stories.js +50 -0
- package/dist/components/atoms/CustomIcon/index.js +40 -0
- package/dist/components/atoms/CustomIcon/styles.js +33 -0
- package/dist/components/atoms/IconFile/IconFile.stories.js +48 -0
- package/dist/components/atoms/IconFile/index.js +249 -0
- package/dist/components/atoms/IconFile/styles.js +23 -0
- package/dist/components/atoms/Image/Image.stories.js +73 -0
- package/dist/components/atoms/Image/index.js +76 -0
- package/dist/components/atoms/Image/styles.js +43 -0
- package/dist/components/atoms/ImageLink/ImageLink.stories.js +63 -0
- package/dist/components/atoms/ImageLink/index.js +77 -0
- package/dist/components/atoms/ImageLink/styles.js +40 -0
- package/dist/components/atoms/ImagePreview/ImagePreview.stories.js +70 -0
- package/dist/components/atoms/ImagePreview/index.js +208 -0
- package/dist/components/atoms/ImagePreview/styles.js +44 -0
- package/dist/components/atoms/InputText/InputText.stories.js +60 -0
- package/dist/components/atoms/InputText/index.js +66 -0
- package/dist/components/atoms/InputText/styles.js +32 -0
- package/dist/components/atoms/NotFound/NotFound.stories.js +36 -0
- package/dist/components/atoms/NotFound/index.js +75 -0
- package/dist/components/atoms/NotFound/styles.js +20 -0
- package/dist/components/atoms/ProgressBar/index.js +36 -6
- package/dist/components/atoms/ProgressBar/styles.js +11 -3
- package/dist/components/atoms/SelectItemV2/SelectItemV2.stories.js +45 -0
- package/dist/components/atoms/SelectItemV2/index.js +57 -0
- package/dist/components/atoms/SelectItemV2/styles.js +30 -0
- package/dist/components/atoms/Tooltip/Tooltip.stories.js +66 -0
- package/dist/components/atoms/Tooltip/index.js +72 -0
- package/dist/components/atoms/Tooltip/styles.js +20 -0
- package/dist/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +66 -0
- package/dist/components/molecules/ButtonDownloadFile/index.js +179 -0
- package/dist/components/molecules/ButtonDownloadFile/styles.js +23 -0
- package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +21 -22
- package/dist/components/molecules/CustomSelect/SelectItem.js +10 -1
- package/dist/components/molecules/Dropdown/Dropdown.stories.js +98 -0
- package/dist/components/molecules/Dropdown/index.js +150 -0
- package/dist/components/molecules/Dropdown/styles.js +26 -0
- package/dist/components/molecules/HeaderTop/index.js +23 -6
- package/dist/components/molecules/HeaderTop/styles.js +1 -1
- package/dist/components/molecules/ImageTooltip/ImageTooltip.stories.js +82 -0
- package/dist/components/molecules/ImageTooltip/index.js +85 -0
- package/dist/components/molecules/ImageTooltip/styles.js +33 -0
- package/dist/components/molecules/ProductNameHeader/index.js +6 -4
- package/dist/components/molecules/SelectV2/SelectV2.stories.js +120 -0
- package/dist/components/molecules/SelectV2/index.js +306 -0
- package/dist/components/molecules/SelectV2/styles.js +42 -0
- package/dist/components/molecules/SelectV2/test.js +94 -0
- package/dist/components/molecules/SelectV2/test.stories.js +27 -0
- package/dist/components/organisms/Chat/Chat.stories.js +160 -0
- package/dist/components/organisms/Chat/ChatLists/ChatLists.stories.js +83 -0
- package/dist/components/organisms/Chat/ChatLists/index.js +160 -0
- package/dist/components/organisms/Chat/ChatLists/styles.js +29 -0
- package/dist/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +176 -0
- package/dist/components/organisms/Chat/ContainerItems/index.js +537 -0
- package/dist/components/organisms/Chat/ContainerItems/styles.js +20 -0
- package/dist/components/organisms/Chat/ContentChat/ContentChat.stories.js +142 -0
- package/dist/components/organisms/Chat/ContentChat/index.js +1466 -0
- package/dist/components/organisms/Chat/ContentChat/styles.js +20 -0
- package/dist/components/organisms/Chat/Footer/Footer.stories.js +43 -0
- package/dist/components/organisms/Chat/Footer/index.js +976 -0
- package/dist/components/organisms/Chat/Footer/styles.js +32 -0
- package/dist/components/organisms/Chat/Header/Header.stories.js +96 -0
- package/dist/components/organisms/Chat/Header/index.js +83 -0
- package/dist/components/organisms/Chat/Header/styles.js +20 -0
- package/dist/components/organisms/Chat/index.js +253 -0
- package/dist/components/organisms/Chat/styles.js +29 -0
- package/dist/components/organisms/FullProductNameHeader/index.js +1 -0
- package/dist/components/organisms/Modal/Modal.stories.js +66 -0
- package/dist/components/organisms/Modal/index.js +95 -0
- package/dist/components/organisms/Modal/styles.js +20 -0
- package/dist/components/organisms/RangeCalendar/RangeCalendar.stories.js +33 -0
- package/dist/components/organisms/RangeCalendar/index.js +149 -0
- package/dist/components/organisms/RangeCalendar/styles.js +27 -0
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +65 -50
- package/dist/components/pages/ProviderProductEdition/index.js +15 -11
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +36 -44
- package/dist/components/pages/RetailerProductEdition/index.js +13 -12
- package/dist/global-files/data.js +18 -23
- package/dist/global-files/fonts.css +6 -0
- package/dist/global-files/handle_http.js +381 -0
- package/dist/global-files/handle_userTech.js +20 -0
- package/dist/global-files/utils.js +514 -0
- package/dist/global-files/variables.js +2 -0
- package/dist/index.js +267 -46
- package/package.json +13 -1
- package/src/assets/images/customSelect/starIcon.svg +14 -0
- package/src/assets/images/defaultImages/Spinner.gif +0 -0
- package/src/assets/images/defaultImages/notFound.svg +124 -0
- package/src/assets/images/generalButton/closeIcon.svg +2 -2
- package/src/assets/sounds/newMessage.mp3 +0 -0
- package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +47 -0
- package/src/components/atoms/ButtonFileChooser/index.js +68 -0
- package/src/components/atoms/ButtonFileChooser/styles.js +4 -0
- package/src/components/atoms/ButtonV2/ButtonV2.stories.js +53 -0
- package/src/components/atoms/ButtonV2/index.js +85 -0
- package/src/components/atoms/ButtonV2/styles.js +217 -0
- package/src/components/atoms/CustomIcon/CustomIcon.stories.js +36 -0
- package/src/components/atoms/CustomIcon/index.js +41 -0
- package/src/components/atoms/CustomIcon/styles.js +85 -0
- package/src/components/atoms/IconFile/IconFile.stories.js +35 -0
- package/src/components/atoms/IconFile/index.js +119 -0
- package/src/components/atoms/IconFile/styles.js +67 -0
- package/src/components/atoms/Image/Image.stories.js +51 -0
- package/src/components/atoms/Image/index.js +55 -0
- package/src/components/atoms/Image/styles.js +34 -0
- package/src/components/atoms/ImageLink/ImageLink.stories.js +43 -0
- package/src/components/atoms/ImageLink/index.js +57 -0
- package/src/components/atoms/ImageLink/styles.js +30 -0
- package/src/components/atoms/ImagePreview/ImagePreview.stories.js +52 -0
- package/src/components/atoms/ImagePreview/index.js +178 -0
- package/src/components/atoms/ImagePreview/styles.js +77 -0
- package/src/components/atoms/InputText/InputText.stories.js +39 -0
- package/src/components/atoms/InputText/index.js +61 -0
- package/src/components/atoms/InputText/styles.js +89 -0
- package/src/components/atoms/NotFound/NotFound.stories.js +19 -0
- package/src/components/atoms/NotFound/index.js +52 -0
- package/src/components/atoms/NotFound/styles.js +55 -0
- package/src/components/atoms/ProgressBar/index.js +40 -5
- package/src/components/atoms/ProgressBar/styles.js +24 -0
- package/src/components/atoms/SelectItemV2/SelectItemV2.stories.js +26 -0
- package/src/components/atoms/SelectItemV2/index.js +61 -0
- package/src/components/atoms/SelectItemV2/styles.js +90 -0
- package/src/components/atoms/Tooltip/Tooltip.stories.js +51 -0
- package/src/components/atoms/Tooltip/index.js +59 -0
- package/src/components/atoms/Tooltip/styles.js +42 -0
- package/src/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +54 -0
- package/src/components/molecules/ButtonDownloadFile/index.js +109 -0
- package/src/components/molecules/ButtonDownloadFile/styles.js +66 -0
- package/src/components/molecules/CustomSelect/CustomSelect.stories.js +20 -12
- package/src/components/molecules/CustomSelect/SelectItem.js +7 -0
- package/src/components/molecules/Dropdown/Dropdown.stories.js +103 -0
- package/src/components/molecules/Dropdown/index.js +150 -0
- package/src/components/molecules/Dropdown/styles.js +75 -0
- package/src/components/molecules/HeaderTop/index.js +29 -8
- package/src/components/molecules/HeaderTop/styles.js +4 -0
- package/src/components/molecules/ImageTooltip/ImageTooltip.stories.js +68 -0
- package/src/components/molecules/ImageTooltip/index.js +63 -0
- package/src/components/molecules/ImageTooltip/styles.js +18 -0
- package/src/components/molecules/ProductNameHeader/index.js +7 -2
- package/src/components/molecules/SelectV2/SelectV2.stories.js +115 -0
- package/src/components/molecules/SelectV2/index.js +357 -0
- package/src/components/molecules/SelectV2/styles.js +105 -0
- package/src/components/molecules/SelectV2/test.js +60 -0
- package/src/components/molecules/SelectV2/test.stories.js +10 -0
- package/src/components/organisms/Chat/Chat.stories.js +147 -0
- package/src/components/organisms/Chat/ChatLists/ChatLists.stories.js +65 -0
- package/src/components/organisms/Chat/ChatLists/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chat/ChatLists/THD.png +0 -0
- package/src/components/organisms/Chat/ChatLists/index.js +141 -0
- package/src/components/organisms/Chat/ChatLists/styles.js +162 -0
- package/src/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +142 -0
- package/src/components/organisms/Chat/ContainerItems/index.js +512 -0
- package/src/components/organisms/Chat/ContainerItems/styles.js +328 -0
- package/src/components/organisms/Chat/ContentChat/ContentChat.stories.js +102 -0
- package/src/components/organisms/Chat/ContentChat/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chat/ContentChat/THD.png +0 -0
- package/src/components/organisms/Chat/ContentChat/index.js +919 -0
- package/src/components/organisms/Chat/ContentChat/styles.js +41 -0
- package/src/components/organisms/Chat/Footer/Footer.stories.js +22 -0
- package/src/components/organisms/Chat/Footer/index.js +661 -0
- package/src/components/organisms/Chat/Footer/styles.js +286 -0
- package/src/components/organisms/Chat/Header/Header.stories.js +66 -0
- package/src/components/organisms/Chat/Header/index.js +93 -0
- package/src/components/organisms/Chat/Header/styles.js +49 -0
- package/src/components/organisms/Chat/index.js +235 -0
- package/src/components/organisms/Chat/styles.js +42 -0
- package/src/components/organisms/FullProductNameHeader/index.js +1 -0
- package/src/components/organisms/Modal/Modal.stories.js +55 -0
- package/src/components/organisms/Modal/index.js +97 -0
- package/src/components/organisms/Modal/styles.js +103 -0
- package/src/components/organisms/RangeCalendar/RangeCalendar.stories.js +16 -0
- package/src/components/organisms/RangeCalendar/index.js +121 -0
- package/src/components/organisms/RangeCalendar/styles.js +883 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +67 -49
- package/src/components/pages/ProviderProductEdition/index.js +16 -9
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +36 -46
- package/src/components/pages/RetailerProductEdition/index.js +14 -10
- package/src/global-files/data.js +18 -23
- package/src/global-files/fonts.css +6 -0
- package/src/global-files/handle_http.js +225 -0
- package/src/global-files/handle_userTech.js +7 -0
- package/src/global-files/utils.js +330 -0
- package/src/global-files/variables.js +2 -0
- package/src/index.js +17 -0
|
@@ -0,0 +1,66 @@
|
|
|
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,4 +1,5 @@
|
|
|
1
1
|
import { CustomSelect } from "./index";
|
|
2
|
+
import iconStar from "../../../assets/images/customSelect/starIcon.svg";
|
|
2
3
|
|
|
3
4
|
export default {
|
|
4
5
|
title: "Components/molecules/CustomSelect",
|
|
@@ -8,20 +9,27 @@ export default {
|
|
|
8
9
|
const Template = (args) => <CustomSelect {...args} />;
|
|
9
10
|
export const CustomSelectDefault = Template.bind({});
|
|
10
11
|
CustomSelectDefault.args = {
|
|
11
|
-
selectLabel: "Todos los departamentos",
|
|
12
|
+
// selectLabel: "Todos los departamentos",
|
|
12
13
|
defaultOption: "Todos los departamentos",
|
|
13
14
|
options: [
|
|
14
|
-
|
|
15
|
-
id:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
{
|
|
16
|
+
id: 47,
|
|
17
|
+
name: "Enero 2023",
|
|
18
|
+
isSelected: true,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 49,
|
|
22
|
+
name: "Mis Favoritos",
|
|
21
23
|
},
|
|
22
|
-
{ id: 2, value: "Eléctrico" },
|
|
23
|
-
{ id: 3, value: "Ferretería" },
|
|
24
|
-
{ id: 4, value: "Herramientas" },
|
|
25
|
-
{ id: 5, value: "Iluminación" },
|
|
26
24
|
],
|
|
25
|
+
onClickItem: (v, id) => {
|
|
26
|
+
if (v) {
|
|
27
|
+
console.log("Agregar a la lista", id);
|
|
28
|
+
} else {
|
|
29
|
+
console.log("Eliminar a la lista", id);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
icon: iconStar,
|
|
33
|
+
showSearchBar: true,
|
|
34
|
+
customOptions: <p>Esto es un customOptions</p>
|
|
27
35
|
};
|
|
@@ -7,6 +7,7 @@ export const SelecItem = ({
|
|
|
7
7
|
setParameterArray,
|
|
8
8
|
activeFilters,
|
|
9
9
|
setActiveFilters,
|
|
10
|
+
onClickItem,
|
|
10
11
|
}) => {
|
|
11
12
|
const [showSubOptions, setShowSubOptions] = useState(false);
|
|
12
13
|
const [chkGlobal, setChkGlobal] = useState(false);
|
|
@@ -17,6 +18,9 @@ export const SelecItem = ({
|
|
|
17
18
|
id={"main-item-" + option.id}
|
|
18
19
|
label={option.name}
|
|
19
20
|
onChange={(e) => {
|
|
21
|
+
if (onClickItem) {
|
|
22
|
+
onClickItem(e.target.checked, option.id)
|
|
23
|
+
}
|
|
20
24
|
const subOptions = option.subOptions;
|
|
21
25
|
const filtersCopy = { ...activeFilters };
|
|
22
26
|
if (subOptions) {
|
|
@@ -77,6 +81,9 @@ export const SelecItem = ({
|
|
|
77
81
|
activeFilters[option.name][sub.name]
|
|
78
82
|
}
|
|
79
83
|
onChange={(e) => {
|
|
84
|
+
if (onClickItem) {
|
|
85
|
+
onClickItem(e.target.checked, sub.id)
|
|
86
|
+
}
|
|
80
87
|
if (e.target.checked) {
|
|
81
88
|
setParameterArray((current) =>
|
|
82
89
|
[...current, sub.id].sort((a, b) => a - b)
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { ButtonV2 } from "../../atoms/ButtonV2";
|
|
2
|
+
import { Dropdown } from "./index";
|
|
3
|
+
import {
|
|
4
|
+
faHeart as Icon1,
|
|
5
|
+
faHouse as Icon2,
|
|
6
|
+
faUser as Icon3,
|
|
7
|
+
} from "@fortawesome/free-solid-svg-icons";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "Components/molecules/Dropdown",
|
|
11
|
+
component: Dropdown,
|
|
12
|
+
argTypes: {
|
|
13
|
+
positionDropdown: {
|
|
14
|
+
options: [
|
|
15
|
+
undefined,
|
|
16
|
+
"topStart",
|
|
17
|
+
"topEnd",
|
|
18
|
+
"topCenter",
|
|
19
|
+
"rightStart",
|
|
20
|
+
"rightEnd",
|
|
21
|
+
"rightCenter",
|
|
22
|
+
"bottomStart",
|
|
23
|
+
"bottomEnd",
|
|
24
|
+
"bottomCenter",
|
|
25
|
+
"leftStart",
|
|
26
|
+
"leftEnd",
|
|
27
|
+
"leftCenter",
|
|
28
|
+
],
|
|
29
|
+
control: { type: "select" },
|
|
30
|
+
},
|
|
31
|
+
triggerType: {
|
|
32
|
+
options: [undefined, "hover", "click"],
|
|
33
|
+
control: { type: "select" },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const Template = (args) => <Dropdown {...args} />;
|
|
39
|
+
|
|
40
|
+
export const DropdownTest = Template.bind({});
|
|
41
|
+
DropdownTest.args = {
|
|
42
|
+
items: [
|
|
43
|
+
{
|
|
44
|
+
label: "Palomitas de maiz",
|
|
45
|
+
//icon: Icon1,
|
|
46
|
+
disabled: true,
|
|
47
|
+
onClick: (event) => {
|
|
48
|
+
console.log("Palomitaz de maiz");
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: "Sabritas",
|
|
53
|
+
//icon: Icon2,
|
|
54
|
+
onClick: (event) => {
|
|
55
|
+
console.log("Sabritas");
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: "sabritas Doritos",
|
|
60
|
+
isLoading: true,
|
|
61
|
+
onClick: (event) => {
|
|
62
|
+
console.log("Sabritas Doritos");
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
label:
|
|
67
|
+
"Este es un texto muy largo que deberia llegar al limite establecido para el width",
|
|
68
|
+
//icon: Icon2,
|
|
69
|
+
onClick: (event) => {
|
|
70
|
+
console.log("texto largo de prueba");
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
label: "galletas",
|
|
75
|
+
icon: undefined,
|
|
76
|
+
onClick: (event) => {
|
|
77
|
+
console.log("galletas");
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
label: "jugo de uva",
|
|
82
|
+
//icon: Icon3,
|
|
83
|
+
onClick: (event) => {
|
|
84
|
+
console.log("jugo de uva");
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
triggerType: "click",
|
|
89
|
+
maxWidthDropdown: "200px",
|
|
90
|
+
maxHeightDropdown: "200px",
|
|
91
|
+
className: "dropdownPrueba",
|
|
92
|
+
classNameDropdown: "dropdownMenuPrueba",
|
|
93
|
+
positionDropdown: undefined,
|
|
94
|
+
children: (
|
|
95
|
+
<ButtonV2
|
|
96
|
+
className="buttonTrigger"
|
|
97
|
+
type={"white"}
|
|
98
|
+
size={14}
|
|
99
|
+
borderType={"oval"}
|
|
100
|
+
label={"boton trigger"}
|
|
101
|
+
/>
|
|
102
|
+
),
|
|
103
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
ClickAwayListener,
|
|
4
|
+
Fade,
|
|
5
|
+
Grow,
|
|
6
|
+
Popper,
|
|
7
|
+
Tooltip as TooltipMUI,
|
|
8
|
+
Zoom,
|
|
9
|
+
} from "@mui/material";
|
|
10
|
+
import { Container } from "./styles";
|
|
11
|
+
import React from "react";
|
|
12
|
+
import { ButtonV2 } from "../../atoms/ButtonV2";
|
|
13
|
+
import { faCircle as IconDefault } from "@fortawesome/free-solid-svg-icons";
|
|
14
|
+
import { isArrayEmpty, isStringEmpty } from "../../../global-files/utils";
|
|
15
|
+
|
|
16
|
+
/* Este es un menu de opciones tipo select donde cada item
|
|
17
|
+
es un boton con su propio onClick */
|
|
18
|
+
export const Dropdown = (props) => {
|
|
19
|
+
const {
|
|
20
|
+
items /* [
|
|
21
|
+
{
|
|
22
|
+
label: string
|
|
23
|
+
icon: FontAwesomeIcon
|
|
24
|
+
disabled: boolean
|
|
25
|
+
isLoading: boolean
|
|
26
|
+
onClick: (event) => {}
|
|
27
|
+
} ,
|
|
28
|
+
...
|
|
29
|
+
] */,
|
|
30
|
+
triggerType, // (string) "hover" | "click"
|
|
31
|
+
children, // componente hijo activador del dropdown
|
|
32
|
+
maxWidthDropdown, // string
|
|
33
|
+
maxHeightDropdown, // string
|
|
34
|
+
className, // (string) clase del container select
|
|
35
|
+
classNameDropdown, // (string) clase del contenedor tooltip
|
|
36
|
+
positionDropdown, // (string) posicion del contenedor tooltip (values en object positions)
|
|
37
|
+
} = props;
|
|
38
|
+
const positions = {
|
|
39
|
+
topStart: "top-start",
|
|
40
|
+
topEnd: "top-end",
|
|
41
|
+
topCenter: "top",
|
|
42
|
+
|
|
43
|
+
rightStart: "right-start",
|
|
44
|
+
rightEnd: "right-end",
|
|
45
|
+
rightCenter: "right",
|
|
46
|
+
|
|
47
|
+
bottomStart: "bottom-start",
|
|
48
|
+
bottomEnd: "bottom-end",
|
|
49
|
+
bottomCenter: "bottom",
|
|
50
|
+
|
|
51
|
+
leftStart: "left-start",
|
|
52
|
+
leftEnd: "left-end",
|
|
53
|
+
leftCenter: "left",
|
|
54
|
+
};
|
|
55
|
+
const [showDropdown, setShowDropdown] = useState(false);
|
|
56
|
+
|
|
57
|
+
const renderItems = () => {
|
|
58
|
+
const customItems = [];
|
|
59
|
+
if (!isArrayEmpty(items)) {
|
|
60
|
+
const useIconDefault = items.some((item) => {
|
|
61
|
+
return item.icon ? true : false;
|
|
62
|
+
});
|
|
63
|
+
items.forEach((item, index) => {
|
|
64
|
+
customItems.push(
|
|
65
|
+
<ButtonV2
|
|
66
|
+
key={"item-" + index}
|
|
67
|
+
className={
|
|
68
|
+
"dropdownItem" +
|
|
69
|
+
(useIconDefault ? (item.icon ? "" : " iconDefault") : "")
|
|
70
|
+
}
|
|
71
|
+
type={"whiteS3"}
|
|
72
|
+
borderType={undefined}
|
|
73
|
+
size={12}
|
|
74
|
+
disabled={item.disabled}
|
|
75
|
+
isLoading={item.isLoading}
|
|
76
|
+
label={isStringEmpty(item.label) ? undefined : item.label}
|
|
77
|
+
icon={useIconDefault ? item.icon ?? IconDefault : undefined}
|
|
78
|
+
onClick={(event) => {
|
|
79
|
+
event.stopPropagation();
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
setShowDropdown(false);
|
|
82
|
+
item.onClick && item.onClick(event);
|
|
83
|
+
}, 200);
|
|
84
|
+
}}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return customItems;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<ClickAwayListener
|
|
94
|
+
onClickAway={(event) => {
|
|
95
|
+
if (triggerType !== "hover") setShowDropdown(false);
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
98
|
+
<Container
|
|
99
|
+
className={!isStringEmpty(className) ? className : ""}
|
|
100
|
+
maxWidthDropdown={maxWidthDropdown}
|
|
101
|
+
maxHeightDropdown={maxHeightDropdown}
|
|
102
|
+
onMouseEnter={(event) => {
|
|
103
|
+
if (triggerType === "hover") {
|
|
104
|
+
setShowDropdown(true);
|
|
105
|
+
}
|
|
106
|
+
}}
|
|
107
|
+
onMouseLeave={(event) => {
|
|
108
|
+
if (triggerType === "hover") {
|
|
109
|
+
setShowDropdown(false);
|
|
110
|
+
}
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
<TooltipMUI
|
|
114
|
+
placement={positions[positionDropdown] ?? positions.bottomStart}
|
|
115
|
+
open={showDropdown}
|
|
116
|
+
arrow={false}
|
|
117
|
+
componentsProps={{
|
|
118
|
+
tooltip: {
|
|
119
|
+
className:
|
|
120
|
+
"dropdownMenu" +
|
|
121
|
+
(isStringEmpty(classNameDropdown)
|
|
122
|
+
? ""
|
|
123
|
+
: " " + classNameDropdown),
|
|
124
|
+
},
|
|
125
|
+
popper: { disablePortal: true },
|
|
126
|
+
transition: { timeout: 300 },
|
|
127
|
+
}}
|
|
128
|
+
TransitionComponent={Fade}
|
|
129
|
+
enterDelay={100}
|
|
130
|
+
followCursor={false}
|
|
131
|
+
disableFocusListener
|
|
132
|
+
disableTouchListener
|
|
133
|
+
disableHoverListener
|
|
134
|
+
title={<>{renderItems()}</>}
|
|
135
|
+
>
|
|
136
|
+
<div
|
|
137
|
+
className="containerIntern"
|
|
138
|
+
onClick={(event) => {
|
|
139
|
+
if (triggerType !== "hover") {
|
|
140
|
+
setShowDropdown(!showDropdown);
|
|
141
|
+
}
|
|
142
|
+
}}
|
|
143
|
+
>
|
|
144
|
+
{children}
|
|
145
|
+
</div>
|
|
146
|
+
</TooltipMUI>
|
|
147
|
+
</Container>
|
|
148
|
+
</ClickAwayListener>
|
|
149
|
+
);
|
|
150
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
|
|
7
|
+
.containerIntern {
|
|
8
|
+
width: inherit;
|
|
9
|
+
border: inherit;
|
|
10
|
+
border-radius: inherit;
|
|
11
|
+
|
|
12
|
+
> * {
|
|
13
|
+
width: inherit;
|
|
14
|
+
border: inherit;
|
|
15
|
+
border-radius: inherit;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
> .MuiTooltip-popper {
|
|
20
|
+
background-color: transparent;
|
|
21
|
+
|
|
22
|
+
.dropdownMenu {
|
|
23
|
+
--background: white;
|
|
24
|
+
box-shadow: 0px 0px 10px 1px gray;
|
|
25
|
+
background-color: var(--background);
|
|
26
|
+
padding: 0px 0px;
|
|
27
|
+
border-radius: 7px;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
gap: 0px;
|
|
31
|
+
overflow: auto;
|
|
32
|
+
max-width: ${({ maxWidthDropdown }) =>
|
|
33
|
+
maxWidthDropdown ? maxWidthDropdown : "400px"};
|
|
34
|
+
max-height: ${({ maxHeightDropdown }) =>
|
|
35
|
+
maxHeightDropdown ? maxHeightDropdown : "80vh"};
|
|
36
|
+
|
|
37
|
+
.dropdownItem {
|
|
38
|
+
width: 100%;
|
|
39
|
+
border-radius: 0px;
|
|
40
|
+
border: none;
|
|
41
|
+
|
|
42
|
+
.button {
|
|
43
|
+
justify-content: flex-start;
|
|
44
|
+
border: inherit;
|
|
45
|
+
text-align: left;
|
|
46
|
+
font-family: ${FontFamily.RobotoRegular};
|
|
47
|
+
padding: 10px;
|
|
48
|
+
gap: 11px;
|
|
49
|
+
|
|
50
|
+
.icon {
|
|
51
|
+
font-size: calc(var(--size) + 1px);
|
|
52
|
+
opacity: 0.75;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&.iconDefault .button .icon {
|
|
57
|
+
opacity: 0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&[data-popper-placement*="bottom"] .dropdownMenu {
|
|
63
|
+
margin-top: 10px;
|
|
64
|
+
}
|
|
65
|
+
&[data-popper-placement*="top"] .dropdownMenu {
|
|
66
|
+
margin-bottom: 10px;
|
|
67
|
+
}
|
|
68
|
+
&[data-popper-placement*="left"] .dropdownMenu {
|
|
69
|
+
margin-right: 10px;
|
|
70
|
+
}
|
|
71
|
+
&[data-popper-placement*="right"] .dropdownMenu {
|
|
72
|
+
margin-left: 10px;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { Container } from "./styles";
|
|
2
2
|
import { ScreenHeader } from "../../atoms/ScreenHeader/index";
|
|
3
3
|
import { Button } from "../../atoms/GeneralButton/index";
|
|
4
|
-
import { useEffect, useRef } from "react";
|
|
4
|
+
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { Chat } from "../../organisms/Chat";
|
|
5
6
|
|
|
6
|
-
export const HeaderTop = ({
|
|
7
|
+
export const HeaderTop = ({
|
|
8
|
+
setHeaderTop,
|
|
9
|
+
withChat,
|
|
10
|
+
productSelected,
|
|
11
|
+
token,
|
|
12
|
+
}) => {
|
|
7
13
|
const headerTop = useRef();
|
|
8
14
|
|
|
9
15
|
useEffect(() => {
|
|
@@ -13,12 +19,27 @@ export const HeaderTop = ({ setHeaderTop }) => {
|
|
|
13
19
|
return (
|
|
14
20
|
<Container ref={headerTop}>
|
|
15
21
|
<ScreenHeader text="Edición de producto" />
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
<div className="buttons-top">
|
|
23
|
+
{withChat && (
|
|
24
|
+
<Chat
|
|
25
|
+
chatType="merchant_product"
|
|
26
|
+
chatContainerType="popUp"
|
|
27
|
+
chatData={{
|
|
28
|
+
userToken: token,
|
|
29
|
+
id: productSelected.id_article,
|
|
30
|
+
version: productSelected.version,
|
|
31
|
+
}}
|
|
32
|
+
size={18}
|
|
33
|
+
/>
|
|
34
|
+
)}
|
|
35
|
+
|
|
36
|
+
<Button
|
|
37
|
+
buttonType="close-button"
|
|
38
|
+
onClick={() => {
|
|
39
|
+
window.location.href = `/products`;
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
22
43
|
</Container>
|
|
23
44
|
);
|
|
24
45
|
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ImageTooltip } from "./index";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/molecules/ImageTooltip",
|
|
5
|
+
component: ImageTooltip,
|
|
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
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const Template = (args) => <ImageTooltip {...args} />;
|
|
29
|
+
|
|
30
|
+
const keyS3_test =
|
|
31
|
+
"84300/1/chat/playa-213f791b-d890-48e1-be19-28bf5a95d517.jpeg";
|
|
32
|
+
const srcTest = `https://content-management-images.s3.amazonaws.com/${keyS3_test}`;
|
|
33
|
+
export const ImageTooltipTest = Template.bind({});
|
|
34
|
+
ImageTooltipTest.args = {
|
|
35
|
+
width: "200px",
|
|
36
|
+
sizeLoading: "50",
|
|
37
|
+
colorLoading: "#bbbbbb",
|
|
38
|
+
src: "bn",
|
|
39
|
+
componentDefault: <label>test error</label>,
|
|
40
|
+
componentTooltip: <label> mensaje del tooltip test </label>,
|
|
41
|
+
position: undefined,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const keyS3_OK =
|
|
45
|
+
"84300/1/chat/f6579ed5-16e5-48d8-ace5-6be8e8e68f53-38896acf-9179-4686-9088-9784df624ab8.png";
|
|
46
|
+
const srcOK = `https://content-management-images.s3.amazonaws.com/${keyS3_OK}`;
|
|
47
|
+
export const ImageTooltipOK = Template.bind({});
|
|
48
|
+
ImageTooltipOK.args = {
|
|
49
|
+
width: "250px",
|
|
50
|
+
sizeLoading: "40",
|
|
51
|
+
src: srcOK,
|
|
52
|
+
componentDefault: <label> img no cargada </label>,
|
|
53
|
+
componentTooltip: <label> mensaje del tooltip OK </label>,
|
|
54
|
+
position: undefined,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const keyS3_ERROR =
|
|
58
|
+
"84300/1/chat/21dba1da-3c60-42c4-97bd-033664808256-fb19ff57-b91c-4ef2-ba2a-d857b55fb33b.svg";
|
|
59
|
+
const srcERROR = `https://content-management-images.s3.amazonaws.com/${keyS3_ERROR}`;
|
|
60
|
+
export const ImageTooltipERROR = Template.bind({});
|
|
61
|
+
ImageTooltipERROR.args = {
|
|
62
|
+
width: "300px",
|
|
63
|
+
sizeLoading: "60",
|
|
64
|
+
src: srcERROR,
|
|
65
|
+
componentDefault: <label> ERROR al cargar </label>,
|
|
66
|
+
componentTooltip: <label> mensaje del tooltip ERROR </label>,
|
|
67
|
+
position: undefined,
|
|
68
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
position, // (string) posicion del contenedor tooltip (values en object positions)
|
|
20
|
+
} = props;
|
|
21
|
+
const [imgLoad, setImgLoad] = useState();
|
|
22
|
+
const [loading, setLoading] = useState(false);
|
|
23
|
+
|
|
24
|
+
/* solo para hacer pruebas en modo dev
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
setLoading(false);
|
|
28
|
+
}, 5000);
|
|
29
|
+
}, []);
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Tooltip
|
|
34
|
+
position={position ?? "topCenter"}
|
|
35
|
+
addArrow={false}
|
|
36
|
+
transitionType={"zoom"}
|
|
37
|
+
followCursor={false}
|
|
38
|
+
className={className}
|
|
39
|
+
classNameTooltip={classNameTooltip}
|
|
40
|
+
componentTooltip={imgLoad !== undefined && !loading && componentTooltip}
|
|
41
|
+
>
|
|
42
|
+
{src && (imgLoad === undefined || loading) && (
|
|
43
|
+
<ContainerLoading
|
|
44
|
+
className={classNameLoading}
|
|
45
|
+
sizeLoading={sizeLoading}
|
|
46
|
+
colorLoading={colorLoading}
|
|
47
|
+
>
|
|
48
|
+
<Icon pulse icon={iconLoading} />
|
|
49
|
+
</ContainerLoading>
|
|
50
|
+
)}
|
|
51
|
+
|
|
52
|
+
{(!src || (imgLoad === false && !loading)) && componentDefault}
|
|
53
|
+
|
|
54
|
+
<Img
|
|
55
|
+
className={classNameImg}
|
|
56
|
+
src={src}
|
|
57
|
+
onLoad={(event) => setImgLoad(true)}
|
|
58
|
+
onError={(event) => setImgLoad(false)}
|
|
59
|
+
show={imgLoad === true && !loading}
|
|
60
|
+
/>
|
|
61
|
+
</Tooltip>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
`;
|