contentoh-components-library 21.2.105 → 21.2.106
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 -2
- package/.env.production +25 -25
- 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/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +72 -0
- package/dist/components/atoms/ButtonFileChooser/index.js +118 -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/GeneralButton/index.js +2 -6
- 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 +222 -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/Select/VersionSelect.js +1 -2
- 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 +10 -5
- 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/SelectV2/SelectV2.stories.js +119 -0
- package/dist/components/molecules/SelectV2/index.js +298 -0
- package/dist/components/molecules/SelectV2/styles.js +42 -0
- package/dist/components/organisms/Chat/Chat.stories.js +215 -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 +569 -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 +1422 -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 +984 -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 +84 -0
- package/dist/components/organisms/Chat/Header/styles.js +20 -0
- package/dist/components/organisms/Chat/index.js +327 -0
- package/dist/components/organisms/Chat/styles.js +29 -0
- package/dist/components/organisms/CreateVersion/RenderChilds.js +11 -11
- package/dist/components/organisms/CreateVersion/index.js +89 -30
- 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/OrderDetail/OrderDetail.stories.js +1 -1
- package/dist/components/organisms/OrderDetail/index.js +11 -20
- package/dist/components/organisms/OrderDetail/styles.js +1 -1
- package/dist/components/organisms/OrderDetail/utils/Table/styles.js +1 -1
- package/dist/components/organisms/OrderDetail/utils/Table/utils.js +15 -45
- package/dist/components/organisms/VersionSelector/index.js +2 -28
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +147 -69
- package/dist/components/pages/ProviderProductEdition/index.js +22 -2
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +67 -77
- package/dist/components/pages/RetailerProductEdition/index.js +24 -5
- package/dist/global-files/fonts.css +12 -0
- package/dist/global-files/handle_http.js +383 -0
- package/dist/global-files/utils.js +472 -0
- package/dist/global-files/variables.js +2 -0
- package/dist/index.js +254 -46
- package/package.json +12 -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/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +47 -0
- package/src/components/atoms/ButtonFileChooser/index.js +69 -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/GeneralButton/index.js +1 -4
- 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 +191 -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/Select/VersionSelect.js +2 -4
- 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 +111 -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 +11 -6
- 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/SelectV2/SelectV2.stories.js +114 -0
- package/src/components/molecules/SelectV2/index.js +335 -0
- package/src/components/molecules/SelectV2/styles.js +105 -0
- package/src/components/organisms/Chat/Chat.stories.js +199 -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 +549 -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 +900 -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 +669 -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 +94 -0
- package/src/components/organisms/Chat/Header/styles.js +49 -0
- package/src/components/organisms/Chat/index.js +294 -0
- package/src/components/organisms/Chat/styles.js +42 -0
- package/src/components/organisms/CreateVersion/RenderChilds.js +34 -28
- package/src/components/organisms/CreateVersion/index.js +36 -16
- 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/OrderDetail/OrderDetail.stories.js +1 -1
- package/src/components/organisms/OrderDetail/index.js +12 -19
- package/src/components/organisms/OrderDetail/styles.js +0 -1
- package/src/components/organisms/OrderDetail/utils/Table/styles.js +0 -26
- package/src/components/organisms/OrderDetail/utils/Table/utils.js +15 -30
- package/src/components/organisms/VersionSelector/index.js +3 -18
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +166 -75
- package/src/components/pages/ProviderProductEdition/index.js +21 -2
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +67 -79
- package/src/components/pages/RetailerProductEdition/index.js +14 -2
- package/src/global-files/customHooks.js +2 -2
- package/src/global-files/fonts.css +12 -0
- package/src/global-files/handle_http.js +231 -0
- package/src/global-files/utils.js +300 -0
- package/src/global-files/variables.js +2 -0
- package/src/index.js +16 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { Checkbox } from "@mui/material";
|
|
3
|
+
import { Container, ContainerButton } from "./styles";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { isStringEmpty } from "../../../global-files/utils";
|
|
6
|
+
import { faCheck as IconOK } from "@fortawesome/free-solid-svg-icons";
|
|
7
|
+
|
|
8
|
+
export const SelectItemV2 = (props) => {
|
|
9
|
+
const {
|
|
10
|
+
id,
|
|
11
|
+
keyId,
|
|
12
|
+
className, // (string) clase del container
|
|
13
|
+
label, // (string) texto visible del item
|
|
14
|
+
value, // valor del item
|
|
15
|
+
checkbox /* (boolean)
|
|
16
|
+
true -> item con checkbox
|
|
17
|
+
false -> item sin checkbox pero respeta el espacio del checkbox
|
|
18
|
+
undefined -> item sin checkbox
|
|
19
|
+
*/,
|
|
20
|
+
selected, // (boolean) item seleccionado??
|
|
21
|
+
onClick, // (isSelected , value) => {}
|
|
22
|
+
} = props;
|
|
23
|
+
|
|
24
|
+
return checkbox ? (
|
|
25
|
+
<Container
|
|
26
|
+
className={
|
|
27
|
+
"selectItemV2" +
|
|
28
|
+
(isStringEmpty(className) ? "" : " " + className) +
|
|
29
|
+
(!checkbox && selected ? " selectedItem" : "")
|
|
30
|
+
}
|
|
31
|
+
id={id}
|
|
32
|
+
key={keyId}
|
|
33
|
+
checkbox={checkbox}
|
|
34
|
+
onClick={(event) => onClick && onClick(!selected, value)}
|
|
35
|
+
>
|
|
36
|
+
{checkbox !== undefined && (
|
|
37
|
+
<Checkbox
|
|
38
|
+
className={"checkbox" + (checkbox ? "" : " hidden")}
|
|
39
|
+
checked={selected}
|
|
40
|
+
/>
|
|
41
|
+
)}
|
|
42
|
+
|
|
43
|
+
<label className="label">{label}</label>
|
|
44
|
+
</Container>
|
|
45
|
+
) : (
|
|
46
|
+
<ContainerButton
|
|
47
|
+
className={
|
|
48
|
+
"selectItemV2" +
|
|
49
|
+
(isStringEmpty(className) ? "" : " " + className) +
|
|
50
|
+
(selected ? " selectedItem" : "")
|
|
51
|
+
}
|
|
52
|
+
checkbox={checkbox === false}
|
|
53
|
+
type={"whiteS3"}
|
|
54
|
+
label={label}
|
|
55
|
+
icon={checkbox === false || selected ? IconOK : undefined}
|
|
56
|
+
onClick={(event) => {
|
|
57
|
+
onClick && onClick(!selected, value);
|
|
58
|
+
}}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { GlobalColors, FontFamily } from "../../../global-files/variables";
|
|
3
|
+
import { ButtonV2 } from "../ButtonV2";
|
|
4
|
+
|
|
5
|
+
export const Container = styled.div`
|
|
6
|
+
width: fit-content;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
flex-wrap: nowrap;
|
|
10
|
+
gap: 11px;
|
|
11
|
+
justify-content: flex-start;
|
|
12
|
+
align-items: center;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
padding: 8px;
|
|
15
|
+
transition: background 0.25s;
|
|
16
|
+
//border: 1px solid lightgray;
|
|
17
|
+
|
|
18
|
+
&:hover {
|
|
19
|
+
background-color: #f0f0f0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.checkbox {
|
|
23
|
+
padding: 3px;
|
|
24
|
+
|
|
25
|
+
&.hidden {
|
|
26
|
+
visibility: hidden;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.Mui-checked {
|
|
30
|
+
color: #808080;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.MuiSvgIcon-root {
|
|
34
|
+
font-size: 16px;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.label {
|
|
39
|
+
cursor: inherit;
|
|
40
|
+
font-family: ${FontFamily.RobotoRegular}, sans-serif;
|
|
41
|
+
font-size: 12px;
|
|
42
|
+
text-align: left;
|
|
43
|
+
color: #262626;
|
|
44
|
+
line-height: 1.25;
|
|
45
|
+
padding: ${({ checkbox }) => (checkbox === undefined ? "3" : "0")}px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// para item sin checkbox seleccionado
|
|
49
|
+
&.selectedItem {
|
|
50
|
+
background-color: #8e8e8e;
|
|
51
|
+
.label {
|
|
52
|
+
font-family: ${FontFamily.RobotoMedium}, sans-serif;
|
|
53
|
+
color: white;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
export const ContainerButton = styled(ButtonV2)`
|
|
59
|
+
width: fit-content;
|
|
60
|
+
border: none;
|
|
61
|
+
border-radius: 0px;
|
|
62
|
+
|
|
63
|
+
.button {
|
|
64
|
+
font-family: ${FontFamily.RobotoRegular}, sans-serif;
|
|
65
|
+
font-size: 12px;
|
|
66
|
+
text-align: left;
|
|
67
|
+
line-height: 1.25;
|
|
68
|
+
padding: ${({ checkbox }) => (checkbox ? "8px" : "11px 8px")};
|
|
69
|
+
gap: 11px;
|
|
70
|
+
border: none;
|
|
71
|
+
letter-spacing: 0px;
|
|
72
|
+
.icon {
|
|
73
|
+
padding: 3px;
|
|
74
|
+
color: #808080 !important;
|
|
75
|
+
font-size: 16px;
|
|
76
|
+
visibility: hidden;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// para item sin checkbox seleccionado
|
|
81
|
+
&.selectedItem {
|
|
82
|
+
.button {
|
|
83
|
+
font-family: ${FontFamily.RobotoMedium}, sans-serif;
|
|
84
|
+
padding: 8px;
|
|
85
|
+
.icon {
|
|
86
|
+
visibility: visible;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
`;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Tooltip } from "./index";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/atoms/Tooltip",
|
|
5
|
+
component: Tooltip,
|
|
6
|
+
argTypes: {
|
|
7
|
+
position: {
|
|
8
|
+
options: [
|
|
9
|
+
undefined,
|
|
10
|
+
"topStart",
|
|
11
|
+
"topEnd",
|
|
12
|
+
"topCenter",
|
|
13
|
+
"rightStart",
|
|
14
|
+
"rightEnd",
|
|
15
|
+
"rightCenter",
|
|
16
|
+
"bottomStart",
|
|
17
|
+
"bottomEnd",
|
|
18
|
+
"bottomCenter",
|
|
19
|
+
"leftStart",
|
|
20
|
+
"leftEnd",
|
|
21
|
+
"leftCenter",
|
|
22
|
+
],
|
|
23
|
+
control: { type: "select" },
|
|
24
|
+
},
|
|
25
|
+
addArrow: {
|
|
26
|
+
options: [undefined, false, true],
|
|
27
|
+
control: { type: "select" },
|
|
28
|
+
},
|
|
29
|
+
transitionType: {
|
|
30
|
+
options: [undefined, "grow", "fade", "zoom"],
|
|
31
|
+
control: { type: "select" },
|
|
32
|
+
},
|
|
33
|
+
followCursor: {
|
|
34
|
+
options: [undefined, false, true],
|
|
35
|
+
control: { type: "select" },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const Template = (args) => <Tooltip {...args} />;
|
|
41
|
+
|
|
42
|
+
export const TooltipDefault = Template.bind({});
|
|
43
|
+
TooltipDefault.args = {
|
|
44
|
+
componentTooltip: <p> hola soy tooltip de prueba en storybook </p>,
|
|
45
|
+
children: <button> abrir tooltip </button>,
|
|
46
|
+
classNameTooltip: "container-tooltip",
|
|
47
|
+
position: undefined,
|
|
48
|
+
addArrow: undefined,
|
|
49
|
+
transitionType: undefined,
|
|
50
|
+
followCursor: undefined,
|
|
51
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { Fade, Grow, Popper, Tooltip as TooltipMUI, Zoom } from "@mui/material";
|
|
3
|
+
import { Container } from "./styles";
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
export const Tooltip = (props) => {
|
|
7
|
+
const {
|
|
8
|
+
componentTooltip, // (jsx) componente que aparecera en el tooltip
|
|
9
|
+
children, // (jsx) componente interno que va dentro de la etiqueta <Tooltip>
|
|
10
|
+
className, // (string) clase del container trigger
|
|
11
|
+
classNameTooltip, // (string) clase del contenedor tooltip
|
|
12
|
+
position, // (string) posicion del contenedor tooltip (values en object positions)
|
|
13
|
+
addArrow, // (boolean) add flecha en la parte posterior del tooltip?
|
|
14
|
+
transitionType, // (string) -> 'grow' (default) | 'fade' | 'zoom'
|
|
15
|
+
followCursor, // (boolean) true -> el tooltip se movera junto al cursor
|
|
16
|
+
} = props;
|
|
17
|
+
const positions = {
|
|
18
|
+
topStart: "top-start",
|
|
19
|
+
topEnd: "top-end",
|
|
20
|
+
topCenter: "top",
|
|
21
|
+
|
|
22
|
+
rightStart: "right-start",
|
|
23
|
+
rightEnd: "right-end",
|
|
24
|
+
rightCenter: "right",
|
|
25
|
+
|
|
26
|
+
bottomStart: "bottom-start",
|
|
27
|
+
bottomEnd: "bottom-end",
|
|
28
|
+
bottomCenter: "bottom",
|
|
29
|
+
|
|
30
|
+
leftStart: "left-start",
|
|
31
|
+
leftEnd: "left-end",
|
|
32
|
+
leftCenter: "left",
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<TooltipMUI
|
|
37
|
+
{...props}
|
|
38
|
+
placement={positions[position] ?? positions.topCenter}
|
|
39
|
+
arrow={addArrow || addArrow === undefined ? true : false}
|
|
40
|
+
componentsProps={{
|
|
41
|
+
tooltip: { className: classNameTooltip },
|
|
42
|
+
popper: { disablePortal: true },
|
|
43
|
+
transition: { timeout: 300 },
|
|
44
|
+
}}
|
|
45
|
+
TransitionComponent={
|
|
46
|
+
transitionType === "grow"
|
|
47
|
+
? Grow
|
|
48
|
+
: transitionType === "fade"
|
|
49
|
+
? Fade
|
|
50
|
+
: Zoom
|
|
51
|
+
}
|
|
52
|
+
enterDelay={300}
|
|
53
|
+
followCursor={followCursor ?? false}
|
|
54
|
+
title={componentTooltip}
|
|
55
|
+
>
|
|
56
|
+
<Container className={className}> {children} </Container>
|
|
57
|
+
</TooltipMUI>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { FontFamily } from "../../../global-files/variables";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
|
|
4
|
+
export const Container = styled.div`
|
|
5
|
+
width: fit-content;
|
|
6
|
+
//margin: 100px 0px 0px 100px; modo dev
|
|
7
|
+
//border: 1px solid red; modo dev
|
|
8
|
+
|
|
9
|
+
+ .MuiTooltip-popper {
|
|
10
|
+
background-color: transparent;
|
|
11
|
+
|
|
12
|
+
.MuiTooltip-tooltip {
|
|
13
|
+
--background: white;
|
|
14
|
+
box-shadow: 0px 0px 10px 1px gray;
|
|
15
|
+
background-color: var(--background);
|
|
16
|
+
padding: 10px;
|
|
17
|
+
border-radius: 7px;
|
|
18
|
+
max-width: 60vw;
|
|
19
|
+
font-family: ${FontFamily.RobotoMedium}, sans-serif;
|
|
20
|
+
font-size: 12px;
|
|
21
|
+
text-align: left;
|
|
22
|
+
color: #262626;
|
|
23
|
+
|
|
24
|
+
.MuiTooltip-arrow {
|
|
25
|
+
color: var(--background);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&[data-popper-placement*="bottom"] .MuiTooltip-tooltip {
|
|
30
|
+
margin-top: 10px;
|
|
31
|
+
}
|
|
32
|
+
&[data-popper-placement*="top"] .MuiTooltip-tooltip {
|
|
33
|
+
margin-bottom: 10px;
|
|
34
|
+
}
|
|
35
|
+
&[data-popper-placement*="left"] .MuiTooltip-tooltip {
|
|
36
|
+
margin-right: 10px;
|
|
37
|
+
}
|
|
38
|
+
&[data-popper-placement*="right"] .MuiTooltip-tooltip {
|
|
39
|
+
margin-left: 10px;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ButtonDownloadFile } from "./index";
|
|
2
|
+
export default {
|
|
3
|
+
title: "Components/molecules/ButtonDownloadFile",
|
|
4
|
+
component: ButtonDownloadFile,
|
|
5
|
+
argTypes: {
|
|
6
|
+
type: {
|
|
7
|
+
options: [
|
|
8
|
+
undefined,
|
|
9
|
+
"white",
|
|
10
|
+
"whiteS2",
|
|
11
|
+
"pink",
|
|
12
|
+
"gray",
|
|
13
|
+
"purple",
|
|
14
|
+
"black",
|
|
15
|
+
],
|
|
16
|
+
control: { type: "select" },
|
|
17
|
+
},
|
|
18
|
+
borderType: {
|
|
19
|
+
options: [undefined, "rectangle", "circle"],
|
|
20
|
+
control: { type: "select" },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const Template = (args) => <ButtonDownloadFile {...args} />;
|
|
26
|
+
|
|
27
|
+
export const DownloadFileOk = Template.bind({});
|
|
28
|
+
DownloadFileOk.args = {
|
|
29
|
+
type: undefined,
|
|
30
|
+
transparent: false,
|
|
31
|
+
borderType: undefined,
|
|
32
|
+
size: "70",
|
|
33
|
+
onDownload: (error) => {
|
|
34
|
+
error &&
|
|
35
|
+
alert("mensaje: " + error.message + "\nDetalles: " + error.details);
|
|
36
|
+
},
|
|
37
|
+
url: `https://content-management-images.s3.amazonaws.com/84300/1/chat/acuse RFC-8b2eb177-5bfc-4266-9b26-4e7297880594-9e2e5853-4697-442a-8ff7-3b7a1ede0856.pdf`,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const DownloadFileError = Template.bind({});
|
|
41
|
+
DownloadFileError.args = {
|
|
42
|
+
id: "",
|
|
43
|
+
key: "",
|
|
44
|
+
color: undefined,
|
|
45
|
+
background: undefined,
|
|
46
|
+
borderType: "circle",
|
|
47
|
+
size: "70",
|
|
48
|
+
width: "100px",
|
|
49
|
+
onDownload: (error) => {
|
|
50
|
+
error &&
|
|
51
|
+
alert("mensaje: " + error.message + "\nDetalles: " + error.details);
|
|
52
|
+
},
|
|
53
|
+
url: `https://content-management-images.s3.amazonaws.com/84300/1/chat/noExiste.pdf`,
|
|
54
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Container } from "./styles";
|
|
2
|
+
import { faArrowDown as IconDownload } from "@fortawesome/free-solid-svg-icons";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { ButtonV2 } from "../../atoms/ButtonV2";
|
|
5
|
+
import { IconFile } from "../../atoms/IconFile";
|
|
6
|
+
import axios from "axios";
|
|
7
|
+
import { getFileExtension } from "../../../global-files/utils";
|
|
8
|
+
|
|
9
|
+
export const ButtonDownloadFile = (props) => {
|
|
10
|
+
const {
|
|
11
|
+
id,
|
|
12
|
+
key,
|
|
13
|
+
className,
|
|
14
|
+
type, // white | pink | gray | purple (white -> predeterminado)
|
|
15
|
+
transparent, // boolean
|
|
16
|
+
size, // number ... default (13)
|
|
17
|
+
borderType, // rectangle || circle || (cualquier otro valor -> no borde)
|
|
18
|
+
url, // src del file
|
|
19
|
+
onDownload, // ( {message , details} ) => {}
|
|
20
|
+
} = props;
|
|
21
|
+
const [showDownload, setShowDownload] = useState(false);
|
|
22
|
+
const [loading, setLoading] = useState(false);
|
|
23
|
+
|
|
24
|
+
const getSrc = () => {
|
|
25
|
+
const temp = url.split("/");
|
|
26
|
+
return temp[temp.length - 1];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const getFile = async () => {
|
|
30
|
+
try {
|
|
31
|
+
setLoading(true);
|
|
32
|
+
const responseFile = await axios({
|
|
33
|
+
url: url,
|
|
34
|
+
method: "GET",
|
|
35
|
+
responseType: "blob",
|
|
36
|
+
});
|
|
37
|
+
if (responseFile.status != 200) {
|
|
38
|
+
setLoading(false);
|
|
39
|
+
onDownload &&
|
|
40
|
+
onDownload({
|
|
41
|
+
message: "No se pudo descargar el archivo",
|
|
42
|
+
details: responseFile.statusText,
|
|
43
|
+
});
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const newUrl = window.URL.createObjectURL(new Blob([responseFile.data]));
|
|
47
|
+
const link = document.createElement("a");
|
|
48
|
+
link.href = newUrl;
|
|
49
|
+
link.setAttribute("download", getSrc());
|
|
50
|
+
link.style.display = "none";
|
|
51
|
+
document.body.appendChild(link);
|
|
52
|
+
setLoading(false);
|
|
53
|
+
link.click();
|
|
54
|
+
document.body.removeChild(link);
|
|
55
|
+
} catch (err) {
|
|
56
|
+
setLoading(false);
|
|
57
|
+
onDownload &&
|
|
58
|
+
onDownload({
|
|
59
|
+
message: "No se pudo descargar el archivo",
|
|
60
|
+
details: err.message,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<>
|
|
67
|
+
<Container
|
|
68
|
+
id={id}
|
|
69
|
+
key={key}
|
|
70
|
+
className={className}
|
|
71
|
+
borderType={borderType}
|
|
72
|
+
onMouseEnter={(event) => {
|
|
73
|
+
if (!showDownload) {
|
|
74
|
+
setShowDownload(true);
|
|
75
|
+
//console.log("showDownload");
|
|
76
|
+
}
|
|
77
|
+
}}
|
|
78
|
+
onMouseLeave={(event) => {
|
|
79
|
+
if (!loading) {
|
|
80
|
+
setShowDownload(false);
|
|
81
|
+
//console.log("showIconFile");
|
|
82
|
+
}
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
{showDownload ? (
|
|
86
|
+
<ButtonV2
|
|
87
|
+
className={"buttonDownload"}
|
|
88
|
+
type={type}
|
|
89
|
+
transparent={transparent}
|
|
90
|
+
size={size}
|
|
91
|
+
borderType={borderType}
|
|
92
|
+
icon={IconDownload}
|
|
93
|
+
isLoading={loading}
|
|
94
|
+
onClick={async (event) => {
|
|
95
|
+
getFile();
|
|
96
|
+
}}
|
|
97
|
+
/>
|
|
98
|
+
) : (
|
|
99
|
+
<IconFile
|
|
100
|
+
className="iconFile"
|
|
101
|
+
type={type}
|
|
102
|
+
transparent={transparent}
|
|
103
|
+
size={size}
|
|
104
|
+
borderType={borderType}
|
|
105
|
+
ext={getFileExtension(getSrc())}
|
|
106
|
+
/>
|
|
107
|
+
)}
|
|
108
|
+
</Container>
|
|
109
|
+
</>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
@@ -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)
|