contentoh-components-library 21.4.60 → 21.4.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/components/molecules/BoxAttribute/styles.js +1 -1
  2. package/dist/components/molecules/BoxButtons/index.js +1 -0
  3. package/dist/components/molecules/TagAndInput/index.js +64 -3
  4. package/dist/components/organisms/InputGroup/index.js +153 -48
  5. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +82 -146
  6. package/dist/components/pages/ProviderProductEdition/index.js +231 -203
  7. package/dist/components/pages/RetailerProductEdition/index.js +5 -5
  8. package/dist/global-files/data.js +8 -4
  9. package/package.json +1 -1
  10. package/src/assets/images/Icons/info.svg +8 -0
  11. package/src/components/atoms/TabSection/styles.js +23 -0
  12. package/src/components/molecules/BoxAttribute/BoxAttribute.stories.js +16 -0
  13. package/src/components/molecules/BoxAttribute/index.js +71 -0
  14. package/src/components/molecules/BoxAttribute/styles.js +38 -0
  15. package/src/components/molecules/BoxButtons/BoxButtons.stories.js +15 -0
  16. package/src/components/molecules/BoxButtons/index.js +28 -0
  17. package/src/components/molecules/BoxButtons/styles.js +43 -0
  18. package/src/components/molecules/TagAndInput/index.js +52 -8
  19. package/src/components/organisms/Box/Box.stories.js +17 -0
  20. package/src/components/organisms/Box/index.js +103 -0
  21. package/src/components/organisms/Box/styles.js +48 -0
  22. package/src/components/organisms/BoxOnboarding/BoxOnboarding.stories.js +17 -0
  23. package/src/components/organisms/BoxOnboarding/index.js +60 -0
  24. package/src/components/organisms/BoxOnboarding/styles.js +44 -0
  25. package/src/components/organisms/InputGroup/index.js +233 -87
  26. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +86 -175
  27. package/src/components/pages/ProviderProductEdition/index.js +97 -73
  28. package/src/components/pages/ProviderProductEdition/out.json +0 -0
  29. package/src/components/pages/RetailerProductEdition/index.js +7 -5
  30. package/src/global-files/data.js +11 -2
  31. package/dist/assets/fonts/roboto/LICENSE.txt +0 -202
  32. package/dist/components/atoms/ImageCarousel/ImgeSlider.stories.js +0 -90
  33. package/dist/components/atoms/ImageCarousel/index.js +0 -120
  34. package/dist/components/atoms/ImageCarousel/styles.js +0 -18
  35. package/dist/components/atoms/PercentTag/PercentTag.stories.js +0 -31
  36. package/dist/components/atoms/PercentTag/index.js +0 -23
  37. package/dist/components/atoms/PercentTag/styles.js +0 -22
  38. package/dist/components/atoms/RatingStars/RatingStars.stories.js +0 -30
  39. package/dist/components/atoms/RatingStars/index.js +0 -53
  40. package/dist/components/atoms/RatingStars/styles.js +0 -18
  41. package/dist/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +0 -48
  42. package/dist/components/atoms/RetailerCatalog/index.js +0 -69
  43. package/dist/components/atoms/RetailerCatalog/styles.js +0 -20
  44. package/dist/components/atoms/RetailerOption/RetailerOption.stories.js +0 -33
  45. package/dist/components/atoms/RetailerOption/index.js +0 -62
  46. package/dist/components/atoms/RetailerOption/styles.js +0 -20
  47. package/dist/components/atoms/RetailersList/RetailersList.stories.js +0 -45
  48. package/dist/components/atoms/RetailersList/index.js +0 -46
  49. package/dist/components/atoms/RetailersList/styles.js +0 -18
  50. package/dist/components/atoms/UserCatalog/UserCatalog.stories.js +0 -73
  51. package/dist/components/atoms/UserCatalog/index.js +0 -101
  52. package/dist/components/atoms/UserCatalog/styles.js +0 -18
  53. package/dist/components/atoms/UserOption/UserOption.stories.js +0 -40
  54. package/dist/components/atoms/UserOption/index.js +0 -130
  55. package/dist/components/atoms/UserOption/styles.js +0 -20
  56. package/dist/components/atoms/UserSelector/UserSelector.stories.js +0 -40
  57. package/dist/components/atoms/UserSelector/index.js +0 -98
  58. package/dist/components/atoms/UserSelector/styles.js +0 -32
  59. package/dist/components/molecules/GridItem/GridItem.stories.js +0 -123
  60. package/dist/components/molecules/GridItem/index.js +0 -152
  61. package/dist/components/molecules/GridItem/styles.js +0 -20
  62. package/dist/components/molecules/HeaderItem/ColumnItem.js +0 -23
  63. package/dist/components/molecules/HeaderItem/HeaderItem.stories.js +0 -70
  64. package/dist/components/molecules/HeaderItem/index.js +0 -42
  65. package/dist/components/molecules/HeaderItem/styles.js +0 -30
  66. package/dist/components/molecules/RowItem/ColumnItem.js +0 -23
  67. package/dist/components/molecules/RowItem/RowItem.stories.js +0 -5242
  68. package/dist/components/molecules/RowItem/index.js +0 -58
  69. package/dist/components/molecules/RowItem/styles.js +0 -30
  70. package/dist/components/organisms/GridProducts/GridProducts.stories.js +0 -5097
  71. package/dist/components/organisms/GridProducts/index.js +0 -63
  72. package/dist/components/organisms/GridProducts/styles.js +0 -18
  73. package/dist/components/organisms/GridProducts/utils.js +0 -149
@@ -516,7 +516,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
516
516
  }
517
517
 
518
518
  _context2.next = 3;
519
- return (0, _data.getRetailerServices)(product === null || product === void 0 ? void 0 : (_product$article = product.article) === null || _product$article === void 0 ? void 0 : _product$article.id_article, product === null || product === void 0 ? void 0 : (_product$article2 = product.article) === null || _product$article2 === void 0 ? void 0 : _product$article2.category, parseInt(product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_category), auditableVersion.version);
519
+ return (0, _data.getRetailerServices)(product === null || product === void 0 ? void 0 : (_product$article = product.article) === null || _product$article === void 0 ? void 0 : _product$article.id_article, product === null || product === void 0 ? void 0 : (_product$article2 = product.article) === null || _product$article2 === void 0 ? void 0 : _product$article2.category, parseInt(product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_category), auditableVersion.version, token);
520
520
 
521
521
  case 3:
522
522
  _auditServices = _context2.sent;
@@ -556,7 +556,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
556
556
  case 0:
557
557
  _context3.prev = 0;
558
558
  _context3.next = 3;
559
- return (0, _data.getRetailerServices)(product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_article, product === null || product === void 0 ? void 0 : (_product$article5 = product.article) === null || _product$article5 === void 0 ? void 0 : _product$article5.category, parseInt(product === null || product === void 0 ? void 0 : (_product$article6 = product.article) === null || _product$article6 === void 0 ? void 0 : _product$article6.id_category), version);
559
+ return (0, _data.getRetailerServices)(product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_article, product === null || product === void 0 ? void 0 : (_product$article5 = product.article) === null || _product$article5 === void 0 ? void 0 : _product$article5.category, parseInt(product === null || product === void 0 ? void 0 : (_product$article6 = product.article) === null || _product$article6 === void 0 ? void 0 : _product$article6.id_category), version, token);
560
560
 
561
561
  case 3:
562
562
  _services = _context3.sent;
@@ -1351,7 +1351,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1351
1351
 
1352
1352
  body.isAproved = result === "A";
1353
1353
  _context11.next = 12;
1354
- return _axios.default.post("".concat(process.env.REACT_APP_EVALUATION_REFACTOR), body, {
1354
+ return _axios.default.post("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), body, {
1355
1355
  headers: {
1356
1356
  Authorization: token
1357
1357
  }
@@ -1376,7 +1376,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1376
1376
  }
1377
1377
 
1378
1378
  _context11.next = 21;
1379
- return _axios.default.post("".concat(process.env.REACT_APP_EVALUATION_REFACTOR), body, {
1379
+ return _axios.default.post("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), body, {
1380
1380
  headers: {
1381
1381
  Authorization: token
1382
1382
  }
@@ -1839,7 +1839,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1839
1839
  };
1840
1840
  conceptArray.forEach(function (concept) {
1841
1841
  body.service = concept;
1842
- evaluationArray.push(_axios.default.post("".concat(process.env.REACT_APP_EVALUATION_REFACTOR), body, {
1842
+ evaluationArray.push(_axios.default.post("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), body, {
1843
1843
  headers: {
1844
1844
  Authorization: token
1845
1845
  }
@@ -20,7 +20,7 @@ var _jsBase = require("js-base64");
20
20
  var _uuid = require("uuid");
21
21
 
22
22
  var getRetailerServices = /*#__PURE__*/function () {
23
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(articleId, category, categoryId, version) {
23
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(articleId, category, categoryId, version, token) {
24
24
  var _images$values, responseArray, datasheets, descriptions, images;
25
25
 
26
26
  return _regenerator.default.wrap(function _callee$(_context) {
@@ -29,7 +29,11 @@ var getRetailerServices = /*#__PURE__*/function () {
29
29
  case 0:
30
30
  _context.prev = 0;
31
31
  _context.next = 3;
32
- return Promise.all([_axios.default.post("".concat(process.env.REACT_APP_ARTICLE_DATA_DATASHEET_ENDPOINT, "?idCategory=").concat(categoryId, "&articleId=").concat(articleId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_ARTICLE_DATA_DESCRIPTION_ENDPOINT, "?idCategory=").concat(categoryId, "&articleId=").concat(articleId, "&version=").concat(version)), _axios.default.post("".concat(process.env.REACT_APP_ARTICLE_DATA_IMAGES_ENDPOINT, "?articleId=").concat(articleId, "&version=").concat(version), {
32
+ return Promise.all([_axios.default.post("".concat(process.env.REACT_APP_ARTICLE_DATA_DATASHEET_ENDPOINT, "?idCategory=").concat(categoryId, "&articleId=").concat(articleId, "&version=").concat(version), {}, {
33
+ headers: {
34
+ Authorization: token
35
+ }
36
+ }), _axios.default.get("".concat(process.env.REACT_APP_ARTICLE_DATA_DESCRIPTION_ENDPOINT, "?idCategory=").concat(categoryId, "&articleId=").concat(articleId, "&version=").concat(version)), _axios.default.post("".concat(process.env.REACT_APP_ARTICLE_DATA_IMAGES_ENDPOINT, "?articleId=").concat(articleId, "&version=").concat(version), {
33
37
  category: category
34
38
  })]);
35
39
 
@@ -61,7 +65,7 @@ var getRetailerServices = /*#__PURE__*/function () {
61
65
  }, _callee, null, [[0, 11]]);
62
66
  }));
63
67
 
64
- return function getRetailerServices(_x, _x2, _x3, _x4) {
68
+ return function getRetailerServices(_x, _x2, _x3, _x4, _x5) {
65
69
  return _ref.apply(this, arguments);
66
70
  };
67
71
  }();
@@ -263,7 +267,7 @@ var fetchUsers = /*#__PURE__*/function () {
263
267
  }, _callee4);
264
268
  }));
265
269
 
266
- return function fetchUsers(_x5) {
270
+ return function fetchUsers(_x6) {
267
271
  return _ref4.apply(this, arguments);
268
272
  };
269
273
  }();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.4.60",
3
+ "version": "21.4.62",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -0,0 +1,8 @@
1
+ <svg width="8" height="8" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <mask id="mask0_37_379" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="8" height="8">
3
+ <rect width="8" height="8" fill="#D9D9D9"/>
4
+ </mask>
5
+ <g mask="url(#mask0_37_379)">
6
+ <path d="M3.63807 5.98825H4.40893V3.62867H3.63807V5.98825ZM3.99596 3.07403C4.124 3.07403 4.2311 3.03169 4.31727 2.947C4.40345 2.86232 4.44653 2.75738 4.44653 2.6322C4.44653 2.49463 4.40331 2.38347 4.31685 2.29871C4.2304 2.21394 4.12327 2.17156 3.99547 2.17156C3.86061 2.17156 3.75166 2.21394 3.66863 2.29871C3.58559 2.38347 3.54407 2.49307 3.54407 2.6275C3.54407 2.7566 3.58737 2.8633 3.67398 2.94759C3.7606 3.03188 3.86792 3.07403 3.99596 3.07403ZM3.9991 8C3.44212 8 2.92156 7.89633 2.43741 7.68899C1.95324 7.48165 1.52964 7.19646 1.16659 6.83341C0.803541 6.47036 0.518349 6.04696 0.311013 5.5632C0.103671 5.07943 0 4.5588 0 4.0013C0 3.44379 0.103671 2.92273 0.311013 2.4381C0.518349 1.95348 0.803049 1.53104 1.16511 1.1708C1.52718 0.810554 1.95032 0.525358 2.43455 0.315215C2.91877 0.105072 3.43989 0 3.99792 0C4.55595 0 5.07764 0.10483 5.56301 0.314491C6.04837 0.524146 6.47094 0.80868 6.83072 1.16809C7.1905 1.52751 7.47533 1.95015 7.6852 2.43603C7.89507 2.92191 8 3.44396 8 4.0022C8 4.56004 7.89493 5.08098 7.68479 5.56504C7.47464 6.04909 7.18945 6.47169 6.8292 6.83282C6.46896 7.19395 6.04646 7.47876 5.56169 7.68726C5.07694 7.89575 4.55607 8 3.9991 8ZM4 7.11633C4.86173 7.11633 5.59499 6.81435 6.19977 6.21037C6.80454 5.60639 7.10693 4.8696 7.10693 4C7.10693 3.13827 6.80513 2.40501 6.20153 1.80024C5.59793 1.19546 4.86095 0.893067 3.9906 0.893067C3.12887 0.893067 2.39561 1.19487 1.79083 1.79847C1.18606 2.40207 0.883666 3.13905 0.883666 4.0094C0.883666 4.87113 1.18565 5.60439 1.78963 6.20917C2.39361 6.81394 3.1304 7.11633 4 7.11633Z" fill="#ECDD1D"/>
7
+ </g>
8
+ </svg>
@@ -0,0 +1,23 @@
1
+ import styled from "styled-components";
2
+ import { FontFamily, GlobalColors } from "../../../global-files/variables";
3
+
4
+ export const Container = styled.div`
5
+ font-family: ${FontFamily.Raleway_500};
6
+ color: ${GlobalColors.s5};
7
+ font-size: 14px;
8
+ line-height: 21px;
9
+ border-bottom: 2px solid ${GlobalColors.s3};
10
+ width: 149px;
11
+ padding-bottom: 5px;
12
+ transition: 0.1s all;
13
+ cursor: pointer;
14
+
15
+ &.active {
16
+ font-size: 18px;
17
+ border-bottom: 2px solid ${GlobalColors.magenta_s2};
18
+ }
19
+
20
+ & + * {
21
+ margin-left: 10px;
22
+ }
23
+ `;
@@ -0,0 +1,16 @@
1
+ import { BoxAttribute } from "./index";
2
+
3
+ export default {
4
+ title: "Components/molecules/BoxAttribute",
5
+ component: BoxAttribute,
6
+ };
7
+
8
+ const Template = (args) => <BoxAttribute {...args} />;
9
+
10
+ export const BoxAttributeDefault = Template.bind({});
11
+
12
+ BoxAttributeDefault.args = {
13
+ text:"texto prueba",
14
+ titletool:"Porcentaje de requeridos",
15
+ texttool:"Este porcentaje indica la completitud de los atributos requeridos para todos los servicios.",
16
+ };
@@ -0,0 +1,71 @@
1
+ import { Container } from "./styles";
2
+ import IconInfo from "../../../assets/images/Icons/info.svg";
3
+ import TextField from "@mui/material/TextField";
4
+ import Tooltip, { tooltipClasses } from '@mui/material/Tooltip';
5
+ import { styled } from '@mui/material/styles';
6
+ import { FontFamily, GlobalColors } from "../../../global-files/variables";
7
+
8
+ export const BoxAttribute = (props) => {
9
+ const {
10
+ id,
11
+ key,
12
+ className,
13
+ text,
14
+ borderType,
15
+ atributos,
16
+ setAtributos,
17
+ required,
18
+ description,
19
+ } = props;
20
+ const handleInputChange = (event) => {
21
+ const { name, value } = event.target;
22
+ setAtributos((prevAtributos) => ({
23
+ ...prevAtributos,
24
+ [name]: value,
25
+ }));
26
+ };
27
+ const LightTooltip = styled(({ className, ...props }) => (
28
+ <Tooltip {...props} classes={{ popper: className }} />
29
+ ))(({ theme }) => ({
30
+ [`& .${tooltipClasses.tooltip}`]: {
31
+ backgroundColor: GlobalColors.white,
32
+ color: 'rgba(0, 0, 0, 0.87)',
33
+ boxShadow: theme.shadows[1],
34
+ fontSize: 11,
35
+ fontFamily: `${FontFamily.Roboto}, sans-serif`,
36
+ },
37
+ }));
38
+ return (
39
+ <>
40
+ <Container
41
+ id={id}
42
+ key={key}
43
+ className={className}
44
+ borderType={borderType}
45
+ >
46
+ <LightTooltip title={
47
+ <div className="container-tooltip">
48
+ <p className="container-tooltip">{description}</p>
49
+ </div>
50
+ }>
51
+ <Container className="">
52
+ <img className="icon" src={IconInfo} alt="iconInfo" />
53
+ </Container>
54
+ </LightTooltip>
55
+ <span>{text}<span className={required ? 'required-text' : ''}>{required ? '*' : ''}</span></span>
56
+ <TextField
57
+ hiddenLabel
58
+ key={props.id}
59
+ name={props.id}
60
+ value={atributos[props.id]}
61
+ onChange={handleInputChange}
62
+ className="caja-borde"
63
+ variant="outlined"
64
+ size="small"
65
+ type="number"
66
+ required={required}
67
+ />
68
+ </Container>
69
+ </>
70
+ );
71
+ };
@@ -0,0 +1,38 @@
1
+ import styled from "styled-components";
2
+ import { FontFamily, GlobalColors } from "../../../global-files/variables";
3
+
4
+ export const Container = styled.div`
5
+ display: flex;
6
+ align-items: center;
7
+ gap:4px;
8
+ #atr-alto {
9
+ display: flex;
10
+ align-items: center;
11
+ justify-content: space-between;
12
+ }
13
+ .caja-borde {
14
+ font-family: ${FontFamily.RobotoMedium}, sans-serif;
15
+ font-size: 12px;
16
+ line-height: 1.2;
17
+ border-radius: ${({ borderType }) => {
18
+ return borderType?.toLowerCase() === "rectangle"
19
+ ? "5px"
20
+ : borderType?.toLowerCase() === "circle"
21
+ ? "50%"
22
+ : "none";
23
+ }};
24
+ }
25
+ span {
26
+ font-family: ${FontFamily.RobotoMedium}, sans-serif;
27
+ font-size: 12px;
28
+ line-height: 1.2;
29
+ font-weight: 600;
30
+ }
31
+ .icon {
32
+ width: 8px;
33
+ height: 8px;
34
+ }
35
+ .required-text {
36
+ color: red;
37
+ }
38
+ `;
@@ -0,0 +1,15 @@
1
+ import { BoxButtons } from "./index";
2
+
3
+ export default {
4
+ title: "Components/molecules/BoxButtons",
5
+ component: BoxButtons,
6
+ };
7
+
8
+ const Template = (args) => <BoxButtons {...args} />;
9
+
10
+ export const BoxButtonsDefault = Template.bind({});
11
+
12
+ BoxButtonsDefault.args = {
13
+ text:"texto prueba",
14
+ showAdd:true,
15
+ };
@@ -0,0 +1,28 @@
1
+ import { Container, ContainerIcon } from "./styles";
2
+ import { Button } from "@mui/material";
3
+
4
+ export const BoxButtons = ({ showAdd, onAdd, onDelete, isTheFirstBox, index }) => {
5
+ console.log("index",index)
6
+ return (
7
+ <Container index={index}>
8
+ {!isTheFirstBox && (
9
+ <Button
10
+ variant="outlined"
11
+ className="button-circle"
12
+ onClick={onDelete}
13
+ >
14
+ <ContainerIcon>
15
+ <span className="iconos-out">delete_forever</span>
16
+ </ContainerIcon>
17
+ </Button>
18
+ )}
19
+ {showAdd && (
20
+ <Button onClick={onAdd} variant="outlined" className="button-circle">
21
+ <ContainerIcon>
22
+ <span className="iconos-out iconos-grises">add</span>
23
+ </ContainerIcon>
24
+ </Button>
25
+ )}
26
+ </Container>
27
+ );
28
+ };
@@ -0,0 +1,43 @@
1
+ import styled from "styled-components";
2
+ import { GlobalColors } from "../../../global-files/variables";
3
+
4
+ export const Container = styled.div`
5
+ display:flex;
6
+ flex-direction:row;
7
+ gap:8px;
8
+ .button-circle{
9
+ width:30px;
10
+ height:30px;
11
+ padding:2px;
12
+ border-radius:100%;
13
+ min-width:30px;
14
+ border: 1px solid #F0F0F0;
15
+ }
16
+ .button-circle:hover {
17
+ border: 1px solid #F0F0F0;
18
+ }
19
+
20
+ `;
21
+ export const ContainerIcon = styled.div`
22
+ cursor: pointer;
23
+ @font-face {
24
+ font-family: "Material Symbols Outlined";
25
+ font-style: normal;
26
+ font-weight: 100 700;
27
+ src: url(https://fonts.gstatic.com/s/materialsymbolsoutlined/v68/kJEhBvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oFsLjBuVY.woff2)
28
+ format("woff2");
29
+ }
30
+ .iconos-out {
31
+ font-family: "Material Symbols Outlined";
32
+ font-size: 20px;
33
+ //line-height: 1;
34
+ margin-top: 10px;
35
+ }
36
+ .iconos-out {
37
+ font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 48;
38
+ color: #B64545;
39
+ }
40
+ .iconos-grises {
41
+ font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 48;
42
+ color: ${GlobalColors.gray};
43
+ }`;
@@ -1,6 +1,7 @@
1
1
  import { Container } from "./styles";
2
2
  import { ScreenHeader } from "../../atoms/ScreenHeader/index";
3
3
  import { GeneralInput } from "../../atoms/GeneralInput/index";
4
+ import { useState, useEffect } from "react";
4
5
 
5
6
  export const TagAndInput = ({
6
7
  inputType,
@@ -29,21 +30,54 @@ export const TagAndInput = ({
29
30
  onKeyDown,
30
31
  showTooltip,
31
32
  auditClass,
33
+ onChange,
34
+ dataInputs,
35
+ inputGroup,
36
+ boxOnboardingData,
32
37
  }) => {
38
+ const [boxOnboardingList, setBoxOnboardingList] = useState(boxOnboardingData || []);
39
+
40
+ useEffect(() => {
41
+ const temp = {};
42
+ let maxBoxId = 0;
43
+ inputGroup?.inputs.forEach((attrId) => {
44
+ if (!dataInputs[attrId].box) return;
45
+ Object.entries(dataInputs[attrId].box).forEach(([boxId, value]) => {
46
+ if (boxId > maxBoxId) maxBoxId = boxId;
47
+ if (!temp[boxId]) temp[boxId] = {};
48
+ temp[boxId][attrId] = value;
49
+ });
50
+ });
51
+ const tempList = Object.values(temp);
52
+ if (tempList.length > 0) {
53
+ setBoxOnboardingList(
54
+ tempList.map((value, index) =>
55
+ index === tempList.length - 1 ? {value } : { value }
56
+ )
57
+ );
58
+ }
59
+ }, []);
60
+
61
+ useEffect(() => {
62
+ onChange && onChange(boxOnboardingList);
63
+ }, [boxOnboardingList]);
64
+
33
65
  return (
34
66
  <Container
35
67
  inputType={inputType}
36
68
  className={"input-container"}
37
69
  key={`generalTagInput-${inputType}`}
38
70
  >
39
- <div className="title-container">
40
- <ScreenHeader
41
- text={label}
42
- headerType={"input-name-header"}
43
- color={color}
44
- />
45
- {showTooltip && <span className="tooltip">{label}</span>}
46
- </div>
71
+ {label?.length && (
72
+ <div className="title-container">
73
+ <ScreenHeader
74
+ text={label}
75
+ headerType={"input-name-header"}
76
+ color={color}
77
+ />
78
+ {showTooltip && <span className="tooltip">{label}</span>}
79
+ </div>
80
+ )}
47
81
  <GeneralInput
48
82
  inputId={inputId}
49
83
  inputType={inputType}
@@ -68,6 +102,16 @@ export const TagAndInput = ({
68
102
  inputOnChange={inputOnChange}
69
103
  onKeyDown={onKeyDown}
70
104
  auditClass={auditClass}
105
+ onChange={(e) => {
106
+ setBoxOnboardingList((prev) => {
107
+ return prev.map((box, i) => {
108
+ if (i != index) {
109
+ return box;
110
+ }
111
+ return { ...box, value: e };
112
+ });
113
+ });
114
+ }}
71
115
  />
72
116
  </Container>
73
117
  );
@@ -0,0 +1,17 @@
1
+ import { Box } from "./index";
2
+ import LoginImage from "../../../assets/images/carouselImagesLogin/loginImage.svg";
3
+ import Login2 from "../../../assets/images/carouselImagesLogin/login2.svg";
4
+ import Login3 from "../../../assets/images/carouselImagesLogin/login3.svg";
5
+
6
+ export default {
7
+ title: "Components/organisms/Box",
8
+ component: Box,
9
+ };
10
+
11
+ const Template = (args) => <Box {...args} />;
12
+
13
+ export const BoxDefault = Template.bind({});
14
+ BoxDefault.args = {
15
+ panelImg:[LoginImage, Login2, Login3],
16
+ panelText:"Elige la plataforma que conecta proovedores y retailers",
17
+ };
@@ -0,0 +1,103 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import { Container } from "./styles";
3
+ import { FontFamily, GlobalColors } from "../../../global-files/variables";
4
+ import { BoxOnboarding } from "../BoxOnboarding";
5
+ import { BoxButtons } from "../../molecules/BoxButtons";
6
+
7
+ export const Box = ({ onChange, dataInputs, inputGroup }) => {
8
+ const [isDeleteDisabled, setIsDeleteDisabled] = useState(true);
9
+ const [boxOnboardingList, setBoxOnboardingList] = useState([
10
+ {
11
+ showAdd: true,
12
+ value: {},
13
+ },
14
+ ]);
15
+
16
+ useEffect(() => {
17
+ const temp = {};
18
+ let maxBoxId = 0;
19
+ inputGroup.inputs.forEach((attrId) => {
20
+ if (!dataInputs[attrId].box) return;
21
+ Object.entries(dataInputs[attrId].box).forEach(([boxId, value]) => {
22
+ if (boxId > maxBoxId) maxBoxId = boxId;
23
+ if (!temp[boxId]) temp[boxId] = {};
24
+ temp[boxId][attrId] = value;
25
+ });
26
+ });
27
+ const tempList = Object.values(temp);
28
+ if (tempList.length > 0) {
29
+ setBoxOnboardingList(
30
+ tempList.map((value, index) =>
31
+ index === tempList.length - 1 ? { showAdd: true, value } : { value }
32
+ )
33
+ );
34
+ }
35
+ }, []);
36
+
37
+ const handleAddBoxOnboarding = () => {
38
+ const newBoxOnboarding = {
39
+ showAdd: false,
40
+ value: {},
41
+ };
42
+
43
+ setBoxOnboardingList([...boxOnboardingList, newBoxOnboarding]);
44
+ };
45
+
46
+ const handleDeleteBoxOnboarding = (index) => {
47
+ if (index !== 0) {
48
+ const updatedBoxOnboardingList = [...boxOnboardingList];
49
+ updatedBoxOnboardingList.splice(index, 1);
50
+ setBoxOnboardingList(updatedBoxOnboardingList);
51
+ } else {
52
+ setIsDeleteDisabled(true);
53
+ }
54
+ };
55
+
56
+ useEffect(() => {
57
+ onChange && onChange(boxOnboardingList);
58
+ }, [boxOnboardingList]);
59
+
60
+ return (
61
+ <Container
62
+ fontFamily={FontFamily.Raleway}
63
+ color={GlobalColors.original_magenta}
64
+ >
65
+ <h1 fontFamily={FontFamily.Raleway}>{inputGroup.dataGroup}</h1>
66
+ <div className="container-box">
67
+ {boxOnboardingList.map((boxOnboarding, index) => (
68
+ <>
69
+
70
+ <div className="container-buttons">
71
+ <BoxOnboarding
72
+ key={index}
73
+ index={index}
74
+ showAdd={boxOnboarding.showAdd}
75
+ data={boxOnboarding.value}
76
+ dataInputs={dataInputs}
77
+ inputs={inputGroup.inputs}
78
+ onChange={(e) => {
79
+ setBoxOnboardingList((prev) => {
80
+ return prev.map((box, i) => {
81
+ if (i != index) {
82
+ return box;
83
+ }
84
+ return { ...box, value: e };
85
+ });
86
+ });
87
+ }}
88
+ />
89
+ <BoxButtons
90
+ key={index}
91
+ index={index}
92
+ showAdd={boxOnboarding.showAdd}
93
+ onAdd={handleAddBoxOnboarding}
94
+ onDelete={() => handleDeleteBoxOnboarding(index)}
95
+ isDeleteDisabled={isDeleteDisabled}
96
+ />
97
+ </div>
98
+ </>
99
+ ))}
100
+ </div>
101
+ </Container>
102
+ );
103
+ };
@@ -0,0 +1,48 @@
1
+ import styled from "styled-components";
2
+ import { FontFamily, GlobalColors } from "../../../global-files/variables";
3
+
4
+ export const Container = styled.div`
5
+ font-family: ${FontFamily.Roboto}, sans-serif;
6
+ font-weight: 400;
7
+ display: flex;
8
+ flex-direction: column;
9
+ gap: 10px;
10
+ font-size: var(--size);
11
+ line-height: 1.2;
12
+ height: auto;
13
+ border-radius: 10px;
14
+ background: white;
15
+ position: relative;
16
+ overflow: hidden;
17
+ width: 100%;
18
+ text-align: center;
19
+ .container-buttons {
20
+ display: flex;
21
+ gap:10px;
22
+ }
23
+ .container-box{
24
+ display: flex;
25
+ flex-direction:column-reverse;
26
+ gap:10px;
27
+ }
28
+ #contenedor-caja {
29
+ display: flex;
30
+ justify-content: space-between;
31
+ color: #262626;
32
+ white-space: nowrap;
33
+ gap: 10px;
34
+ }
35
+ #atr-alto {
36
+ display: flex;
37
+ justify-content: space-between;
38
+ align-items: center;
39
+ gap: 6px;
40
+ }
41
+ h1 {
42
+ font-family: ${FontFamily.RobotoMedium}, sans-serif;
43
+ font-size: 17px;
44
+ line-height: 1.2;
45
+ font-weight: 500;
46
+ text-align: left;
47
+ }
48
+ `;
@@ -0,0 +1,17 @@
1
+ import { BoxOnboarding } from "./index";
2
+ import LoginImage from "../../../assets/images/carouselImagesLogin/loginImage.svg";
3
+ import Login2 from "../../../assets/images/carouselImagesLogin/login2.svg";
4
+ import Login3 from "../../../assets/images/carouselImagesLogin/login3.svg";
5
+
6
+ export default {
7
+ title: "Components/organisms/BoxOnboarding",
8
+ component: BoxOnboarding,
9
+ };
10
+
11
+ const Template = (args) => <BoxOnboarding {...args} />;
12
+
13
+ export const BoxOnboardingDefault = Template.bind({});
14
+ BoxOnboardingDefault.args = {
15
+ panelImg:[LoginImage, Login2, Login3],
16
+ panelText:"Elige la plataforma que conecta proovedores y retailers",
17
+ };