contentoh-components-library 15.0.0 → 18.0.0
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/dist/assets/images/generalButton/downloadIcon.svg +3 -0
- package/dist/components/atoms/CheckBox/index.js +4 -2
- package/dist/components/atoms/GeneralButton/styles.js +4 -2
- package/dist/components/atoms/GeneralInput/index.js +14 -27
- package/dist/components/atoms/GenericModal/index.js +4 -2
- package/dist/components/atoms/GenericModal/styles.js +1 -1
- package/dist/components/atoms/Input/index.js +1 -1
- package/dist/components/atoms/Input/style.js +4 -4
- package/dist/components/atoms/InputFormatter/Wysiwyg.stories.js +30 -0
- package/dist/components/atoms/InputFormatter/index.js +119 -0
- package/dist/components/atoms/InputFormatter/styles.js +33 -0
- package/dist/components/atoms/LabelToInput/style.js +3 -3
- package/dist/components/atoms/ProductPercentCard/Percent.stories.js +41 -0
- package/dist/components/atoms/ProductPercentCard/index.js +45 -0
- package/dist/components/atoms/ProductPercentCard/styles.js +20 -0
- package/dist/components/molecules/GalleryElement/index.js +24 -2
- package/dist/components/molecules/GalleryHeader/index.js +19 -2
- package/dist/components/molecules/StatusAsignationInfo/index.js +12 -27
- package/dist/components/molecules/TableHeader/index.js +4 -2
- package/dist/components/organisms/FullProductNameHeader/index.js +1 -1
- package/dist/components/organisms/FullTabsMenu/index.js +8 -8
- package/dist/components/organisms/ImageDataTable/index.js +4 -2
- package/dist/components/organisms/ProductImageModal/index.js +2 -3
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +4 -14
- package/dist/components/pages/RetailerProductEdition/index.js +330 -169
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/package.json +5 -1
- package/src/assets/images/generalButton/downloadIcon.svg +3 -0
- package/src/components/atoms/CheckBox/index.js +8 -2
- package/src/components/atoms/GeneralButton/styles.js +14 -0
- package/src/components/atoms/GeneralInput/index.js +12 -29
- package/src/components/atoms/GenericModal/index.js +2 -2
- package/src/components/atoms/GenericModal/styles.js +3 -0
- package/src/components/atoms/Input/index.js +2 -1
- package/src/components/atoms/Input/style.js +9 -5
- package/src/components/atoms/InputFormatter/Wysiwyg.stories.js +12 -0
- package/src/components/atoms/InputFormatter/index.js +76 -0
- package/src/components/atoms/InputFormatter/styles.js +34 -0
- package/src/components/atoms/LabelToInput/style.js +10 -2
- package/src/components/atoms/ProductPercentCard/Percent.stories.js +41 -0
- package/src/components/atoms/ProductPercentCard/index.js +23 -0
- package/src/components/atoms/{Percent → ProductPercentCard}/styles.js +11 -7
- package/src/components/molecules/GalleryElement/index.js +18 -1
- package/src/components/molecules/GalleryHeader/index.js +8 -2
- package/src/components/molecules/StatusAsignationInfo/index.js +12 -24
- package/src/components/molecules/TableHeader/index.js +2 -0
- package/src/components/organisms/FullProductNameHeader/index.js +1 -1
- package/src/components/organisms/FullTabsMenu/index.js +6 -6
- package/src/components/organisms/ImageDataTable/index.js +2 -0
- package/src/components/organisms/ProductImageModal/index.js +8 -2
- package/src/components/organisms/ProductImageModal/styles.js +3 -0
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +4 -14
- package/src/components/pages/RetailerProductEdition/index.js +250 -90
- package/src/components/pages/RetailerProductEdition/styles.js +11 -3
- package/src/components/atoms/Percent/Percent.stories.js +0 -38
- package/src/components/atoms/Percent/index.js +0 -15
|
@@ -13,7 +13,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
13
13
|
|
|
14
14
|
var _templateObject;
|
|
15
15
|
|
|
16
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n height: 100%;\n flex: 1;\n overflow: auto;\n\n .data-container {\n display: flex;\n flex: 0%;\n height: calc(100% - ", "px);\n .image-data-panel {\n width: 340px;\n\n & + * {\n margin-left: 10px;\n }\n }\n\n .product-information {\n width: 100%;\n display: flex;\n flex-direction: column;\n\n .services-information-container {\n height: 100%;\n overflow: auto;\n }\n\n .image-services {\n aside {\n display: grid;\n grid-template-columns: repeat(auto-fill, 179px);\n column-gap: 15px;\n row-gap: 15px;\n padding: 20px;\n }\n }\n\n .commentary-box {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n padding: 10px;\n padding-left: 0;\n\n .commentary {\n display: flex;\n align-items: flex-end;\n\n .input-container {\n & + * {\n margin-left: 5px;\n }\n }\n\n .buttons-box {\n display: flex;\n
|
|
16
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n height: 100%;\n flex: 1;\n overflow: auto;\n\n .data-container {\n display: flex;\n flex: 0%;\n height: calc(100% - ", "px);\n .image-data-panel {\n width: 340px;\n\n & + * {\n margin-left: 10px;\n }\n }\n\n .product-information {\n width: 100%;\n display: flex;\n flex-direction: column;\n\n .services-information-container {\n height: 100%;\n overflow: auto;\n }\n\n .image-services {\n aside {\n display: grid;\n grid-template-columns: repeat(auto-fill, 179px);\n column-gap: 15px;\n row-gap: 15px;\n padding: 20px;\n }\n }\n\n .commentary-box {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n padding: 10px;\n padding-left: 0;\n\n .commentary {\n display: flex;\n align-items: flex-end;\n\n .input-container {\n width: 500px;\n\n .quill {\n height: 100px;\n }\n\n & + * {\n margin-left: 5px;\n }\n }\n\n .buttons-box {\n display: flex;\n width: 210px;\n flex-wrap: wrap;\n\n .general-transparent-button {\n & + * {\n margin-top: 5px;\n }\n }\n\n .general-transparent-button,\n .general-green-button,\n .general-button-disabled {\n width: fit-content;\n min-width: 201px;\n height: 40px;\n }\n }\n }\n }\n\n .feedback-box {\n display: flex;\n }\n }\n }\n .container {\n width: 100%;\n height: 100%;\n .dropzone {\n height: 100%;\n width: 100%;\n }\n }\n"])), function (_ref) {
|
|
17
17
|
var headerTop = _ref.headerTop;
|
|
18
18
|
return headerTop;
|
|
19
19
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contentoh-components-library",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.0.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@babel/runtime": "^7.17.2",
|
|
6
6
|
"@storybook/addon-postcss": "^2.0.0",
|
|
@@ -11,13 +11,17 @@
|
|
|
11
11
|
"axios": "^0.25.0",
|
|
12
12
|
"babel-preset-react-app": "^10.0.1",
|
|
13
13
|
"chart.js": "^3.7.1",
|
|
14
|
+
"draft-js": "^0.11.7",
|
|
15
|
+
"file-saver": "^2.0.5",
|
|
14
16
|
"js-base64": "^3.7.2",
|
|
15
17
|
"prop-types": "^15.7.2",
|
|
16
18
|
"react": "^17.0.2",
|
|
17
19
|
"react-chartjs-2": "^4.0.1",
|
|
18
20
|
"react-dom": "^17.0.2",
|
|
21
|
+
"react-draft-wysiwyg": "^1.14.7",
|
|
19
22
|
"react-dropzone": "^12.0.4",
|
|
20
23
|
"react-image-fallback": "^8.0.0",
|
|
24
|
+
"react-quill": "^1.3.5",
|
|
21
25
|
"styled-components": "^5.3.3",
|
|
22
26
|
"uuid": "^8.3.2",
|
|
23
27
|
"web-vitals": "^1.0.1"
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="17" height="18" viewBox="0 0 17 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M13.7063 7.61134C13.2246 5.16759 11.0783 3.33301 8.5 3.33301C6.45292 3.33301 4.675 4.49467 3.78958 6.19467C1.6575 6.42134 0 8.22759 0 10.4163C0 12.7609 1.90542 14.6663 4.25 14.6663H13.4583C15.4133 14.6663 17 13.0797 17 11.1247C17 9.25467 15.5479 7.73884 13.7063 7.61134ZM12.0417 9.70801L8.5 13.2497L4.95833 9.70801H7.08333V6.87467H9.91667V9.70801H12.0417Z" fill="#817393"/>
|
|
3
|
+
</svg>
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { Container } from "./styles";
|
|
2
2
|
|
|
3
|
-
export const CheckBox = ({ id, label, onChange, isFilter }) => {
|
|
3
|
+
export const CheckBox = ({ id, label, onChange, isFilter, defaultChecked }) => {
|
|
4
4
|
return (
|
|
5
5
|
<Container key={`check-${id}`}>
|
|
6
|
-
<input
|
|
6
|
+
<input
|
|
7
|
+
type="checkbox"
|
|
8
|
+
name={id}
|
|
9
|
+
id={id}
|
|
10
|
+
onChange={onChange}
|
|
11
|
+
defaultChecked={defaultChecked}
|
|
12
|
+
/>
|
|
7
13
|
<label htmlFor={id}>
|
|
8
14
|
{label && <p className={isFilter && "filter-text"}>{label}</p>}
|
|
9
15
|
</label>
|
|
@@ -12,6 +12,7 @@ import saveIcon from "../../../assets/images/generalButton/saveIcon.svg";
|
|
|
12
12
|
import saveIconHover from "../../../assets/images/generalButton/saveIconHover.svg";
|
|
13
13
|
import deleteIcon from "../../../assets/images/generalButton/deleteIcon.svg";
|
|
14
14
|
import deleteIconHover from "../../../assets/images/generalButton/deleteIconHover.svg";
|
|
15
|
+
import downloadIcon from "../../../assets/images/generalButton/downloadIcon.svg";
|
|
15
16
|
import { GlobalColors } from "../../../global-files/variables";
|
|
16
17
|
|
|
17
18
|
export const Container = styled.button`
|
|
@@ -92,6 +93,19 @@ export const Container = styled.button`
|
|
|
92
93
|
border: 1px solid ${GlobalColors.magenta_s2};
|
|
93
94
|
}
|
|
94
95
|
}
|
|
96
|
+
|
|
97
|
+
&.download-button {
|
|
98
|
+
background-image: url(${downloadIcon});
|
|
99
|
+
border: 1px solid ${GlobalColors.s3};
|
|
100
|
+
border-radius: 15px;
|
|
101
|
+
background-size: 15px;
|
|
102
|
+
|
|
103
|
+
&:hover {
|
|
104
|
+
color: white;
|
|
105
|
+
background-color: ${GlobalColors.magenta_s2};
|
|
106
|
+
border: 1px solid ${GlobalColors.magenta_s2};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
95
109
|
}
|
|
96
110
|
|
|
97
111
|
&.general-arrow-button {
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import { isValid } from "js-base64";
|
|
2
|
-
import { number } from "prop-types";
|
|
3
1
|
import { useEffect, useState } from "react";
|
|
4
|
-
import { version } from "styled-components";
|
|
5
2
|
import { Container } from "./styles";
|
|
3
|
+
import { InputFormatter } from "../InputFormatter";
|
|
6
4
|
|
|
7
5
|
export const GeneralInput = ({
|
|
8
6
|
inputType,
|
|
9
7
|
inputId,
|
|
10
|
-
inputCols,
|
|
11
|
-
inputRows,
|
|
12
|
-
inputName,
|
|
13
8
|
inputValue,
|
|
14
9
|
articleId,
|
|
15
10
|
isRequired,
|
|
16
11
|
version,
|
|
17
12
|
inputPlaceholder,
|
|
18
|
-
updatedDescriptions,
|
|
19
13
|
setUpdatedDescriptions,
|
|
20
14
|
updatedDatasheets,
|
|
21
15
|
setUpdatedDatasheets,
|
|
@@ -36,16 +30,6 @@ export const GeneralInput = ({
|
|
|
36
30
|
);
|
|
37
31
|
};
|
|
38
32
|
|
|
39
|
-
const onHandleTextAreaChange = (e) => {
|
|
40
|
-
setTextValue(({ value }) => (value = e.target.value));
|
|
41
|
-
updatedDatasheets &&
|
|
42
|
-
addTextAreaToArray(
|
|
43
|
-
e.target.value,
|
|
44
|
-
updatedDescriptions,
|
|
45
|
-
setUpdatedDescriptions
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
33
|
useEffect(() => {
|
|
50
34
|
if (dinamicHeight) {
|
|
51
35
|
const input = document.querySelector(
|
|
@@ -57,7 +41,7 @@ export const GeneralInput = ({
|
|
|
57
41
|
}
|
|
58
42
|
}, [textValue]);
|
|
59
43
|
|
|
60
|
-
const addTextAreaToArray = (textValue, array, setArray) => {
|
|
44
|
+
const addTextAreaToArray = (textValue, array = [], setArray) => {
|
|
61
45
|
const tempDescriptions = array;
|
|
62
46
|
const newArticle = {
|
|
63
47
|
articleId: articleId,
|
|
@@ -65,18 +49,18 @@ export const GeneralInput = ({
|
|
|
65
49
|
value: textValue,
|
|
66
50
|
versionId: version,
|
|
67
51
|
};
|
|
68
|
-
const isOnArray = tempDescriptions
|
|
52
|
+
const isOnArray = tempDescriptions?.some((desc, index) => {
|
|
69
53
|
if (desc.attributeId === newArticle.attributeId) {
|
|
70
54
|
tempDescriptions[index] = newArticle;
|
|
71
55
|
return true;
|
|
72
56
|
}
|
|
73
57
|
});
|
|
74
|
-
!isOnArray && tempDescriptions
|
|
58
|
+
!isOnArray && tempDescriptions?.push(newArticle);
|
|
75
59
|
setArray(tempDescriptions);
|
|
76
60
|
};
|
|
77
61
|
|
|
78
62
|
return (
|
|
79
|
-
<Container isRequired={isRequired && !textValue}>
|
|
63
|
+
<Container isRequired={isRequired && !textValue.value}>
|
|
80
64
|
{inputType !== "textarea" ? (
|
|
81
65
|
<input
|
|
82
66
|
type={inputType}
|
|
@@ -87,15 +71,14 @@ export const GeneralInput = ({
|
|
|
87
71
|
onChange={onHandleChange}
|
|
88
72
|
/>
|
|
89
73
|
) : (
|
|
90
|
-
<
|
|
91
|
-
name={inputName}
|
|
74
|
+
<InputFormatter
|
|
92
75
|
id={"description-" + inputId + "-" + index}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
></
|
|
76
|
+
addTextAreaToArray={addTextAreaToArray}
|
|
77
|
+
updatedDescriptions={updatedDatasheets}
|
|
78
|
+
setUpdatedDescriptions={setUpdatedDescriptions}
|
|
79
|
+
inputValue={inputValue?.replace(/<br>/gm, "<p><br></p>")}
|
|
80
|
+
isRequired={isRequired && !inputValue}
|
|
81
|
+
></InputFormatter>
|
|
99
82
|
)}
|
|
100
83
|
</Container>
|
|
101
84
|
);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Container } from "./styles";
|
|
2
2
|
|
|
3
|
-
export const GenericModal = ({ componentsArray = [], buttonType }) => {
|
|
3
|
+
export const GenericModal = ({ componentsArray = [], buttonType, onClick }) => {
|
|
4
4
|
return (
|
|
5
5
|
<Container>
|
|
6
6
|
<div className={"global-styles " + buttonType}>
|
|
7
|
-
<button className="close-button" />
|
|
7
|
+
<button className="close-button" onClick={onClick} />
|
|
8
8
|
{componentsArray?.map((component) => component)}
|
|
9
9
|
</div>
|
|
10
10
|
</Container>
|
|
@@ -2,8 +2,9 @@ import { MainContainer, InputCustom } from "./style";
|
|
|
2
2
|
|
|
3
3
|
export default function Input(props) {
|
|
4
4
|
return (
|
|
5
|
-
<MainContainer
|
|
5
|
+
<MainContainer error={props.error}>
|
|
6
6
|
<InputCustom
|
|
7
|
+
autoFocus
|
|
7
8
|
onChange={(event) =>
|
|
8
9
|
props.onChange && props.onChange(event.target.value)
|
|
9
10
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
|
+
import { GlobalColors, FontFamily } from "../../../global-files/variables";
|
|
2
3
|
|
|
3
4
|
export const MainContainer = styled.div`
|
|
4
5
|
display: flex;
|
|
5
6
|
align-items: center;
|
|
6
|
-
width:
|
|
7
|
+
width: fit-content;
|
|
7
8
|
height: 20px;
|
|
8
9
|
padding: 0 5px;
|
|
9
10
|
box-sizing: border-box;
|
|
@@ -15,11 +16,14 @@ export const MainContainer = styled.div`
|
|
|
15
16
|
export const InputCustom = styled.input`
|
|
16
17
|
border-width: 0;
|
|
17
18
|
width: 100%;
|
|
18
|
-
font-family:
|
|
19
|
-
font-
|
|
20
|
-
font-
|
|
19
|
+
font-family: ${FontFamily.AvenirNext};
|
|
20
|
+
font-weight: 400;
|
|
21
|
+
font-size: 11px;
|
|
22
|
+
line-height: 19px;
|
|
21
23
|
border-width: 0;
|
|
22
|
-
|
|
24
|
+
color: ${GlobalColors.s5};
|
|
25
|
+
background-color: ${GlobalColors.s2};
|
|
26
|
+
outline: none;
|
|
23
27
|
&::placeholder {
|
|
24
28
|
font-size: 12px;
|
|
25
29
|
color: #d4d1d7;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InputFormatter } from "./index";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/atoms/InputFormatter",
|
|
5
|
+
component: InputFormatter,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Template = (args) => <InputFormatter {...args} />;
|
|
9
|
+
|
|
10
|
+
export const DefaultInputFormatter = Template.bind({});
|
|
11
|
+
|
|
12
|
+
DefaultInputFormatter.args = { text: "hola mundo" };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import ReactQuill from "react-quill";
|
|
2
|
+
import "react-quill/dist/quill.snow.css";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Container } from "./styles";
|
|
5
|
+
|
|
6
|
+
export const InputFormatter = ({
|
|
7
|
+
inputValue = "",
|
|
8
|
+
id,
|
|
9
|
+
updatedDescriptions,
|
|
10
|
+
setUpdatedDescriptions,
|
|
11
|
+
addTextAreaToArray,
|
|
12
|
+
isRequired,
|
|
13
|
+
}) => {
|
|
14
|
+
const [convertedText, setConvertedText] = useState(inputValue);
|
|
15
|
+
const [focus, setFocus] = useState(false);
|
|
16
|
+
const [selection, setSelection] = useState(false);
|
|
17
|
+
const [position, setPosition] = useState({ left: 0, top: 0 });
|
|
18
|
+
|
|
19
|
+
const onHandleTextAreaChange = (value) => {
|
|
20
|
+
setConvertedText((current) => (current = value));
|
|
21
|
+
!id.includes("commentary") &&
|
|
22
|
+
addTextAreaToArray(
|
|
23
|
+
value.replace(/<\/?p>/gm, ""),
|
|
24
|
+
updatedDescriptions,
|
|
25
|
+
setUpdatedDescriptions
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
function getSelectionText() {
|
|
30
|
+
setPosition({ left: 0, top: 0 });
|
|
31
|
+
var text = "";
|
|
32
|
+
if (window.getSelection) {
|
|
33
|
+
text = window.getSelection().toString();
|
|
34
|
+
} else if (document.selection && document.selection.type != "Control") {
|
|
35
|
+
text = document.selection.createRange().text;
|
|
36
|
+
}
|
|
37
|
+
setSelection(text.length > 0);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const getCursorPosition = (e) => {
|
|
41
|
+
const input = document.getElementById(id);
|
|
42
|
+
const elementPosition = input.getBoundingClientRect();
|
|
43
|
+
position.top === 0 &&
|
|
44
|
+
position.left === 0 &&
|
|
45
|
+
setPosition({
|
|
46
|
+
left: e.clientX - elementPosition.x,
|
|
47
|
+
top: e.clientY - elementPosition.y,
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Container
|
|
53
|
+
focus={focus}
|
|
54
|
+
selection={selection}
|
|
55
|
+
position={position}
|
|
56
|
+
isRequired={isRequired}
|
|
57
|
+
onClick={(e) => {
|
|
58
|
+
getCursorPosition(e);
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
<ReactQuill
|
|
62
|
+
id={id}
|
|
63
|
+
value={convertedText}
|
|
64
|
+
onChange={onHandleTextAreaChange}
|
|
65
|
+
modules={{ toolbar: ["bold"] }}
|
|
66
|
+
onFocus={() => setFocus(true)}
|
|
67
|
+
onBlur={() => {
|
|
68
|
+
setFocus(false);
|
|
69
|
+
setSelection(false);
|
|
70
|
+
setPosition({ left: 0, top: 0 });
|
|
71
|
+
}}
|
|
72
|
+
onChangeSelection={() => getSelectionText()}
|
|
73
|
+
/>
|
|
74
|
+
</Container>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { GlobalColors, FontFamily } from "../../../global-files/variables";
|
|
3
|
+
|
|
4
|
+
export const Container = styled.div`
|
|
5
|
+
.quill {
|
|
6
|
+
border: 1px solid
|
|
7
|
+
${({ focus, isRequired }) =>
|
|
8
|
+
focus ? GlobalColors.magenta_s2 : isRequired ? "red" : GlobalColors.s3};
|
|
9
|
+
position: relative;
|
|
10
|
+
border-radius: 2px;
|
|
11
|
+
|
|
12
|
+
.ql-toolbar {
|
|
13
|
+
background-color: ${GlobalColors.s2};
|
|
14
|
+
position: absolute;
|
|
15
|
+
z-index: 10;
|
|
16
|
+
border: 1px solid ${GlobalColors.s3};
|
|
17
|
+
width: 45px;
|
|
18
|
+
height: 45px;
|
|
19
|
+
border-radius: 4px;
|
|
20
|
+
visibility: ${({ selection }) => (selection ? "visible" : "hidden")};
|
|
21
|
+
top: ${({ position }) => position.top}px;
|
|
22
|
+
left: ${({ position }) => position.left}px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ql-container {
|
|
26
|
+
border: none;
|
|
27
|
+
font-family: ${FontFamily.AvenirNext};
|
|
28
|
+
color: ${GlobalColors.s4};
|
|
29
|
+
strong {
|
|
30
|
+
font-family: ${FontFamily.Raleway_900};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
|
+
import { GlobalColors, FontFamily } from "../../../global-files/variables";
|
|
2
3
|
|
|
3
4
|
export const MainContainer = styled.div`
|
|
4
5
|
display: flex;
|
|
5
6
|
align-items: center;
|
|
6
|
-
width:
|
|
7
|
+
width: fit-content;
|
|
7
8
|
height: 20px;
|
|
8
9
|
padding: 0 5px;
|
|
9
10
|
box-sizing: border-box;
|
|
@@ -13,7 +14,14 @@ export const MainContainer = styled.div`
|
|
|
13
14
|
overflow-x: auto;
|
|
14
15
|
overflow-y: hidden;
|
|
15
16
|
& > p {
|
|
16
|
-
|
|
17
|
+
font-family: ${FontFamily.AvenirNext};
|
|
18
|
+
font-weight: 400;
|
|
19
|
+
font-size: 11px;
|
|
20
|
+
line-height: 19px;
|
|
21
|
+
color: ${GlobalColors.s5};
|
|
22
|
+
background-color: ${GlobalColors.s2};
|
|
23
|
+
padding: 1px 3px;
|
|
24
|
+
border-radius: 3px;
|
|
17
25
|
}
|
|
18
26
|
border: ${(props) => props.error && "1px solid red"};
|
|
19
27
|
::-webkit-scrollbar {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ProductPercentCard } from "./index";
|
|
2
|
+
|
|
3
|
+
const status = [
|
|
4
|
+
"-",
|
|
5
|
+
"Pr",
|
|
6
|
+
"Rc",
|
|
7
|
+
"As",
|
|
8
|
+
"P",
|
|
9
|
+
"QF",
|
|
10
|
+
"AF",
|
|
11
|
+
"AA",
|
|
12
|
+
"AP",
|
|
13
|
+
"AC",
|
|
14
|
+
"RA",
|
|
15
|
+
"RF",
|
|
16
|
+
"RP",
|
|
17
|
+
"RC",
|
|
18
|
+
"Ex",
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
title: "Components/atoms/ProductPercentCard",
|
|
23
|
+
component: ProductPercentCard,
|
|
24
|
+
argTypes: {
|
|
25
|
+
statusType: {
|
|
26
|
+
options: status,
|
|
27
|
+
control: { type: "select" },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const Template = (args) => <ProductPercentCard {...args}/>;
|
|
33
|
+
|
|
34
|
+
export const ProductPercentCardDefault = Template.bind ({});
|
|
35
|
+
|
|
36
|
+
ProductPercentCardDefault.args = {
|
|
37
|
+
statusType: "-",
|
|
38
|
+
productsInStatus: 0,
|
|
39
|
+
totalProcucts: 0,
|
|
40
|
+
|
|
41
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Container } from "./styles";
|
|
2
|
+
import polygon from "../../../assets/images/arrow/polygon.svg";
|
|
3
|
+
|
|
4
|
+
export const ProductPercentCard = ({
|
|
5
|
+
statusType,
|
|
6
|
+
totalProcucts = 0,
|
|
7
|
+
productsInStatus = 0,
|
|
8
|
+
}) => {
|
|
9
|
+
var result = (productsInStatus / totalProcucts) * 100;
|
|
10
|
+
|
|
11
|
+
var percent = result.toString().search(/\./) ? result.toFixed(2) : result;
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<Container className={`status-${statusType}`}>
|
|
15
|
+
<p className="text">Productos en proceso</p>
|
|
16
|
+
<div className="percent-text">
|
|
17
|
+
<p className="number">{productsInStatus}</p>
|
|
18
|
+
<img src={polygon} alt="" />
|
|
19
|
+
<span className="span">{percent == "NaN" ? 0 : percent}%</span>
|
|
20
|
+
</div>
|
|
21
|
+
</Container>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
@@ -3,10 +3,10 @@ import { GlobalColors, FontFamily } from "../../../global-files/variables";
|
|
|
3
3
|
|
|
4
4
|
export const Container = styled.div`
|
|
5
5
|
border-radius: 7px;
|
|
6
|
-
width:
|
|
6
|
+
max-width: fit-content;
|
|
7
|
+
flex-direction: column;
|
|
7
8
|
height: 83px;
|
|
8
|
-
|
|
9
|
-
padding: 15px;
|
|
9
|
+
padding: 10px;
|
|
10
10
|
|
|
11
11
|
&.status-Pr,
|
|
12
12
|
&.status-Rc {
|
|
@@ -60,20 +60,24 @@ export const Container = styled.div`
|
|
|
60
60
|
|
|
61
61
|
.text {
|
|
62
62
|
color: ${GlobalColors.s4};
|
|
63
|
+
text-align: center;
|
|
63
64
|
font-size: 12px;
|
|
65
|
+
width: 70px;
|
|
64
66
|
font-family: ${FontFamily.Raleway};
|
|
65
67
|
line-height: 14px;
|
|
68
|
+
margin: auto;
|
|
66
69
|
}
|
|
67
70
|
.percent-text {
|
|
68
71
|
display: flex;
|
|
72
|
+
font-family: ${FontFamily.AvenirNext};
|
|
73
|
+
align-items: center;
|
|
69
74
|
.number {
|
|
70
|
-
font-family: ${FontFamily.AvenirNext};
|
|
71
75
|
font-size: 28px;
|
|
72
76
|
color: ${GlobalColors.s4};
|
|
73
77
|
}
|
|
74
|
-
.span{
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
.span {
|
|
79
|
+
padding-top: 8px;
|
|
80
|
+
font-size: 18px;
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
83
|
`;
|
|
@@ -17,6 +17,9 @@ export const GalleryElement = ({
|
|
|
17
17
|
imageType,
|
|
18
18
|
imagePackagingType,
|
|
19
19
|
changeImage,
|
|
20
|
+
selectedImages,
|
|
21
|
+
setSelectedImages,
|
|
22
|
+
setCheckAll,
|
|
20
23
|
}) => {
|
|
21
24
|
const [statusValidation, setStatusValidation] = useState(validation);
|
|
22
25
|
const [showValidationPanel, setShowValidationPanel] = useState(false);
|
|
@@ -31,6 +34,20 @@ export const GalleryElement = ({
|
|
|
31
34
|
}
|
|
32
35
|
};
|
|
33
36
|
|
|
37
|
+
const checkOnChange = (e) => {
|
|
38
|
+
const chkGlobal = document.getElementById("check-all-images");
|
|
39
|
+
const checkboxList = document.querySelectorAll("[id^='gallery-element-']");
|
|
40
|
+
let temp = selectedImages.slice();
|
|
41
|
+
e.target.checked
|
|
42
|
+
? temp.push(image)
|
|
43
|
+
: (temp = temp.filter((img) => image.id !== img.id));
|
|
44
|
+
let counter = 0;
|
|
45
|
+
checkboxList?.forEach((chk) => chk.checked && counter++);
|
|
46
|
+
chkGlobal.checked = checkboxList.length === counter;
|
|
47
|
+
setCheckAll(checkboxList.length === counter);
|
|
48
|
+
setSelectedImages(temp);
|
|
49
|
+
};
|
|
50
|
+
|
|
34
51
|
useEffect(() => {
|
|
35
52
|
if (showValidationPanel) {
|
|
36
53
|
document.addEventListener("click", closeValidationPanel, false);
|
|
@@ -40,7 +57,7 @@ export const GalleryElement = ({
|
|
|
40
57
|
return (
|
|
41
58
|
<Container className={gridLayout ? "grid-gallery" : "row-gallery"}>
|
|
42
59
|
<div className="buttons-container">
|
|
43
|
-
<CheckBox id={id} label={label} />
|
|
60
|
+
<CheckBox id={id} label={label} onChange={(e) => checkOnChange(e)} />
|
|
44
61
|
</div>
|
|
45
62
|
<div className="image-container">
|
|
46
63
|
<ProductImage
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { Container } from "./styles";
|
|
2
2
|
import { CheckBox } from "../../atoms/CheckBox";
|
|
3
3
|
|
|
4
|
-
export const GalleryHeader = () => {
|
|
4
|
+
export const GalleryHeader = ({ setCheckAll, setSelectedImages }) => {
|
|
5
|
+
const checkAll = (e) => {
|
|
6
|
+
const checkboxList = document.querySelectorAll("[id^='gallery-element-']");
|
|
7
|
+
checkboxList.forEach((chk) => (chk.checked = e.target.checked));
|
|
8
|
+
setCheckAll(e.target.checked);
|
|
9
|
+
if (!e.target.checked) setSelectedImages([]);
|
|
10
|
+
};
|
|
5
11
|
return (
|
|
6
12
|
<Container>
|
|
7
13
|
<div>
|
|
8
|
-
<CheckBox />
|
|
14
|
+
<CheckBox id="check-all-images" onChange={(e) => checkAll(e)} />
|
|
9
15
|
</div>
|
|
10
16
|
<p className="image-header">Image</p>
|
|
11
17
|
<p className="image-name">Nombre</p>
|
|
@@ -11,20 +11,17 @@ export const StatusAsignationInfo = ({
|
|
|
11
11
|
status = "-",
|
|
12
12
|
imagesSection,
|
|
13
13
|
setImageLayout,
|
|
14
|
-
asignationsList,
|
|
15
14
|
percent = 0,
|
|
16
|
-
activeTab,
|
|
17
|
-
deleteImages,
|
|
18
|
-
saveDatasheets,
|
|
19
|
-
saveDescriptions,
|
|
20
|
-
updateImages,
|
|
21
15
|
assignationsImages,
|
|
22
16
|
setAssignation,
|
|
23
17
|
isRetailer,
|
|
18
|
+
downloadImages,
|
|
19
|
+
askToDeleteImages,
|
|
24
20
|
id = "default-id",
|
|
21
|
+
onClickSave,
|
|
25
22
|
}) => {
|
|
26
23
|
const [showAsignationPanel, setShowAsignationPanel] = useState(false);
|
|
27
|
-
const [layout, setLayout] = useState(
|
|
24
|
+
const [layout, setLayout] = useState(false);
|
|
28
25
|
const [assignationType, setAssignationType] = useState("facilitator");
|
|
29
26
|
|
|
30
27
|
const closeAsignations = (e) => {
|
|
@@ -44,29 +41,20 @@ export const StatusAsignationInfo = ({
|
|
|
44
41
|
<Container id={id}>
|
|
45
42
|
<Button
|
|
46
43
|
buttonType={"circular-button save-button"}
|
|
47
|
-
onClick={
|
|
48
|
-
switch (activeTab) {
|
|
49
|
-
case "Descripción":
|
|
50
|
-
saveDescriptions && saveDescriptions();
|
|
51
|
-
break;
|
|
52
|
-
case "Ficha técnica":
|
|
53
|
-
saveDatasheets && saveDatasheets();
|
|
54
|
-
break;
|
|
55
|
-
case "Imágenes":
|
|
56
|
-
updateImages && updateImages();
|
|
57
|
-
break;
|
|
58
|
-
|
|
59
|
-
default:
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
}}
|
|
44
|
+
onClick={onClickSave}
|
|
63
45
|
/>
|
|
64
46
|
{imagesSection && (
|
|
65
47
|
<div className="images-buttons">
|
|
66
48
|
<Button
|
|
67
49
|
buttonType={"circular-button delete-button"}
|
|
68
50
|
onClick={() => {
|
|
69
|
-
|
|
51
|
+
askToDeleteImages && askToDeleteImages();
|
|
52
|
+
}}
|
|
53
|
+
/>
|
|
54
|
+
<Button
|
|
55
|
+
buttonType={"circular-button download-button"}
|
|
56
|
+
onClick={() => {
|
|
57
|
+
downloadImages();
|
|
70
58
|
}}
|
|
71
59
|
/>
|
|
72
60
|
<Button
|
|
@@ -9,6 +9,7 @@ export const TableHeader = ({
|
|
|
9
9
|
assignationsImages,
|
|
10
10
|
setAssignation,
|
|
11
11
|
isRetailer,
|
|
12
|
+
onClickSave,
|
|
12
13
|
}) => {
|
|
13
14
|
return (
|
|
14
15
|
<Container>
|
|
@@ -22,6 +23,7 @@ export const TableHeader = ({
|
|
|
22
23
|
assignationsImages={assignationsImages}
|
|
23
24
|
setAssignation={setAssignation}
|
|
24
25
|
isRetailer={isRetailer}
|
|
26
|
+
onClickSave={onClickSave}
|
|
25
27
|
/>
|
|
26
28
|
</Container>
|
|
27
29
|
);
|
|
@@ -18,7 +18,7 @@ export const FullProductNameHeader = ({
|
|
|
18
18
|
<ProductNameHeader
|
|
19
19
|
productName={headerData?.article?.name}
|
|
20
20
|
statusType={headerData?.status}
|
|
21
|
-
percent={percent}
|
|
21
|
+
percent={percent?.toFixed(0)}
|
|
22
22
|
priority={headerData?.prio}
|
|
23
23
|
date={new Date(headerData?.article?.timestamp).toLocaleDateString()}
|
|
24
24
|
/>
|