contentoh-components-library 21.2.27 → 21.2.30
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 +2 -0
- package/.env.production +2 -0
- package/dist/assets/images/customSelect/searchIcon.png +0 -0
- package/dist/components/atoms/VerticalSideMenuMainPage/index.js +46 -53
- package/dist/components/atoms/VerticalSideMenuMainPage/styles.js +18 -29
- package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +54 -0
- package/dist/components/molecules/CustomSelect/SelectItem.js +132 -0
- package/dist/components/molecules/CustomSelect/index.js +178 -0
- package/dist/components/molecules/CustomSelect/styles.js +20 -0
- package/dist/components/organisms/Calendar/styles.js +1 -1
- package/dist/components/organisms/DashboardMetric/index.js +5 -80
- package/dist/components/pages/Dashboard/Dashboard.stories.js +36 -1
- package/dist/components/pages/Dashboard/dashboardUtils.js +129 -0
- package/dist/components/pages/Dashboard/index.js +294 -65
- package/dist/components/pages/Dashboard/styles.js +1 -1
- package/dist/global-files/customHooks.js +0 -1
- package/package.json +1 -1
- package/src/assets/images/customSelect/searchIcon.png +0 -0
- package/src/components/atoms/VerticalSideMenuMainPage/index.js +37 -55
- package/src/components/atoms/VerticalSideMenuMainPage/styles.js +69 -140
- package/src/components/molecules/CustomSelect/CustomSelect.stories.js +27 -0
- package/src/components/molecules/CustomSelect/SelectItem.js +97 -0
- package/src/components/molecules/CustomSelect/index.js +134 -0
- package/src/components/molecules/CustomSelect/styles.js +115 -0
- package/src/components/organisms/Calendar/styles.js +2 -0
- package/src/components/organisms/DashboardMetric/index.js +3 -58
- package/src/components/pages/Dashboard/Dashboard.stories.js +36 -1
- package/src/components/pages/Dashboard/dashboardUtils.js +62 -0
- package/src/components/pages/Dashboard/index.js +190 -26
- package/src/components/pages/Dashboard/styles.js +13 -0
- package/src/global-files/customHooks.js +0 -1
- package/dist/components/atoms/ListCommercialRetailers/ListCommercialRetailers.stories.js +0 -36
- package/dist/components/atoms/ListCommercialRetailers/index.js +0 -64
- package/dist/components/atoms/ListCommercialRetailers/styles.js +0 -20
- package/dist/components/atoms/MenuCommercialRetailers/MenuCommercialRetailers.stories.js +0 -37
- package/dist/components/atoms/MenuCommercialRetailers/index.js +0 -25
- package/dist/components/atoms/MenuCommercialRetailers/styles.js +0 -20
- package/dist/components/atoms/MenuProductImage/MenuProductImage.stories.js +0 -28
- package/dist/components/atoms/MenuProductImage/index.js +0 -88
- package/dist/components/atoms/MenuProductImage/styles.js +0 -20
- package/dist/components/molecules/ApproveRejetPanel/ApproveRejetPanel.stories.js +0 -25
- package/dist/components/molecules/ApproveRejetPanel/index.js +0 -49
- package/dist/components/molecules/ApproveRejetPanel/styles.js +0 -18
- package/dist/components/molecules/SignInLoginCreationApp/SignInLogin.stories.js +0 -28
- package/dist/components/molecules/SignInLoginCreationApp/index.js +0 -270
- package/dist/components/molecules/SignInLoginCreationApp/styles.js +0 -20
package/.env.development
CHANGED
|
@@ -18,6 +18,8 @@ REACT_APP_VERSIONS_ENDPOINT = https://lqrc8jfjqi.execute-api.us-east-1.amazonaws
|
|
|
18
18
|
REACT_APP_RETAILER_ENDPOINT=https://lqrc8jfjqi.execute-api.us-east-1.amazonaws.com/dev/retailers
|
|
19
19
|
REACT_APP_READ_ORDERS_BY_STATUS=https://lqrc8jfjqi.execute-api.us-east-1.amazonaws.com/dev/read-orders-by-status
|
|
20
20
|
REACT_APP_READ_REQUIRED_ORDERS=https://lqrc8jfjqi.execute-api.us-east-1.amazonaws.com/dev/read-required-orders
|
|
21
|
+
REACT_APP_CATEGORY_ENDPOINT=https://lqrc8jfjqi.execute-api.us-east-1.amazonaws.com/dev/categories
|
|
22
|
+
REACT_APP_READ_PROVIDERS=https://lqrc8jfjqi.execute-api.us-east-1.amazonaws.com/dev/providers
|
|
21
23
|
|
|
22
24
|
REACT_APP_IMAGES_BUCKET=content-management-images
|
|
23
25
|
REACT_APP_KEY_UPLOAD_TO_S3=AKIA5CPHLQTT46EQ5TIK
|
package/.env.production
CHANGED
|
@@ -18,6 +18,8 @@ REACT_APP_VERSIONS_ENDPOINT = https://6jqnpjf841.execute-api.us-east-1.amazonaws
|
|
|
18
18
|
REACT_APP_RETAILER_ENDPOINT=https://6jqnpjf841.execute-api.us-east-1.amazonaws.com/prod/retailers
|
|
19
19
|
REACT_APP_READ_ORDERS_BY_STATUS=https://6jqnpjf841.execute-api.us-east-1.amazonaws.com/prod/read-orders-by-status
|
|
20
20
|
REACT_APP_READ_REQUIRED_ORDERS=https://6jqnpjf841.execute-api.us-east-1.amazonaws.com/prod/read-required-orders
|
|
21
|
+
REACT_APP_CATEGORY_ENDPOINT=https://6jqnpjf841.execute-api.us-east-1.amazonaws.com/prod/categories
|
|
22
|
+
REACT_APP_READ_PROVIDERS=https://6jqnpjf841.execute-api.us-east-1.amazonaws.com/prod/providers
|
|
21
23
|
|
|
22
24
|
REACT_APP_IMAGES_BUCKET=content-management-images-prod
|
|
23
25
|
REACT_APP_KEY_UPLOAD_TO_S3=AKIA5CPHLQTT46EQ5TIK
|
|
Binary file
|
|
@@ -24,68 +24,61 @@ var _reactRouterDom = require("react-router-dom");
|
|
|
24
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
25
|
|
|
26
26
|
var VerticalSideMenuMainPage = function VerticalSideMenuMainPage(_ref) {
|
|
27
|
-
var
|
|
28
|
-
menuoption = _ref$menuoption === void 0 ? [] : _ref$menuoption,
|
|
29
|
-
conteinerdash = _ref.conteinerdash;
|
|
27
|
+
var menuoption = _ref.menuoption;
|
|
30
28
|
|
|
31
29
|
var _useState = (0, _react.useState)(),
|
|
32
30
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
33
31
|
trueBar = _useState2[0],
|
|
34
32
|
setTrueBar = _useState2[1];
|
|
35
33
|
|
|
36
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var _item$suboption;
|
|
34
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
|
|
35
|
+
className: trueBar,
|
|
36
|
+
bar: trueBar,
|
|
37
|
+
onMouseOver: function onMouseOver() {
|
|
38
|
+
return setTrueBar(true);
|
|
39
|
+
},
|
|
40
|
+
onMouseOut: function onMouseOut() {
|
|
41
|
+
return setTrueBar(false);
|
|
42
|
+
},
|
|
43
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
44
|
+
className: "navbar-top",
|
|
45
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
46
|
+
src: trueBar ? _iconLogoContentoh.default : _iconLogo.default,
|
|
47
|
+
alt: "Logo",
|
|
48
|
+
className: "logo"
|
|
49
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
50
|
+
className: "option",
|
|
51
|
+
children: menuoption.map(function (item, index) {
|
|
52
|
+
var _item$suboption;
|
|
56
53
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
children: subitem.title
|
|
78
|
-
})
|
|
79
|
-
})
|
|
80
|
-
});
|
|
54
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
55
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactRouterDom.NavLink, {
|
|
56
|
+
to: item.path,
|
|
57
|
+
className: "option-link",
|
|
58
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
59
|
+
src: item.icon,
|
|
60
|
+
alt: item.title
|
|
61
|
+
}), trueBar && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
62
|
+
children: item.title
|
|
63
|
+
})]
|
|
64
|
+
}), item.suboption !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
65
|
+
children: item === null || item === void 0 ? void 0 : (_item$suboption = item.suboption) === null || _item$suboption === void 0 ? void 0 : _item$suboption.map(function (subitem) {
|
|
66
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
67
|
+
className: "sub-option",
|
|
68
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.NavLink, {
|
|
69
|
+
to: subitem.path,
|
|
70
|
+
className: "sub-option-link",
|
|
71
|
+
children: trueBar && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
72
|
+
children: subitem.title
|
|
73
|
+
})
|
|
81
74
|
})
|
|
82
|
-
})
|
|
83
|
-
}
|
|
84
|
-
})
|
|
85
|
-
})
|
|
75
|
+
});
|
|
76
|
+
})
|
|
77
|
+
})]
|
|
78
|
+
}, index);
|
|
86
79
|
})
|
|
87
|
-
})
|
|
88
|
-
})
|
|
80
|
+
})]
|
|
81
|
+
})
|
|
89
82
|
});
|
|
90
83
|
};
|
|
91
84
|
|
|
@@ -2,61 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
exports.
|
|
8
|
+
exports.Container = void 0;
|
|
11
9
|
|
|
12
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
13
11
|
|
|
14
|
-
var _styledComponents =
|
|
15
|
-
|
|
16
|
-
var _reactRouterDom = require("react-router-dom");
|
|
12
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
17
13
|
|
|
18
|
-
var _templateObject
|
|
14
|
+
var _templateObject;
|
|
19
15
|
|
|
20
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n height: 98%;\n box-sizing: border-box;\n padding: 23px 10px 70px 10px;\n flex-direction: column;\n justify-content: space-between;\n overflow:
|
|
16
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n height: 98%;\n box-sizing: border-box;\n padding: 23px 10px 70px 10px;\n flex-direction: column;\n justify-content: space-between;\n overflow: auto;\n width: ", "px;\n border-radius: ", "px;\n background: linear-gradient(180deg, #e33aa9 0%, #3b1366 100%);\n scrollbar-width: none;\n display: flex;\n text-align: center;\n transition: width 0.3s linear;\n margin: 10px 0 10px 20px;\n & + * {\n margin-left: 30px;\n }\n .navbar-top {\n transition: all 0.3s linear;\n .option {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n margin-top: ", "%;\n padding-left: ", "px;\n .active {\n background: #e33aa9;\n }\n & + div {\n margin-top: 5px;\n }\n a {\n height: ", "px;\n display: flex;\n justify-content: ", ";\n border-radius: ", "px;\n align-items: center;\n font-family: sans-serif;\n font-style: normal;\n font-weight: 400;\n font-size: 18px;\n line-height: 21px;\n letter-spacing: -0.015em;\n color: #fafafa;\n text-decoration: none;\n &.option-link {\n cursor: pointer;\n width: ", "px;\n margin: 5px 0;\n padding-left: ", "px;\n }\n p {\n cursor: pointer;\n margin: 0%;\n pointer-events: none;\n }\n img {\n width: 22px;\n & + * {\n margin-left: 12px;\n }\n }\n }\n .option-link:hover {\n background: #e33aa9;\n }\n .sub-option {\n display: flex;\n flex-direction: column;\n padding-left: ", "px;\n height: auto;\n width: auto;\n a {\n display: flex;\n justify-content: flex-start;\n text-decoration: none;\n position: relative;\n font-size: 13px;\n border-left: 1px solid #f0eef2;\n border-radius: 0;\n color: #f0eef2;\n padding-top: 14px;\n padding-left: 12px;\n height: 25px;\n &::before {\n border-left: 1px solid #e33aa9;\n width: 10px;\n content: \"\";\n border-radius: 50%;\n height: 10px;\n background-color: white;\n position: absolute;\n bottom: 0;\n left: ", "%;\n }\n &.active {\n background: none;\n &::before {\n background-color: #e33aa9;\n }\n }\n }\n }\n }\n }\n"])), function (_ref) {
|
|
21
17
|
var bar = _ref.bar;
|
|
22
|
-
return bar ?
|
|
18
|
+
return bar ? 270 : 58;
|
|
23
19
|
}, function (_ref2) {
|
|
24
20
|
var bar = _ref2.bar;
|
|
25
21
|
return bar ? 20 : 50;
|
|
26
22
|
}, function (_ref3) {
|
|
27
23
|
var bar = _ref3.bar;
|
|
28
|
-
return bar === "" ? 145 :
|
|
24
|
+
return bar === "" ? 145 : 50;
|
|
29
25
|
}, function (_ref4) {
|
|
30
26
|
var bar = _ref4.bar;
|
|
31
|
-
return bar ?
|
|
27
|
+
return bar ? 5 : 0;
|
|
32
28
|
}, function (_ref5) {
|
|
33
29
|
var bar = _ref5.bar;
|
|
34
|
-
return bar ? 28 : 20;
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
exports.Container = Container;
|
|
38
|
-
var RouterComponent = (0, _styledComponents.default)(_reactRouterDom.BrowserRouter)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)([""])));
|
|
39
|
-
exports.RouterComponent = RouterComponent;
|
|
40
|
-
var NavLinkOption = (0, _styledComponents.default)(_reactRouterDom.NavLink)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n height: ", "px;\n display: flex;\n justify-content: ", ";\n border-radius: ", "px;\n align-items: center;\n font-family: sans-serif;\n font-style: normal;\n font-weight: 400;\n font-size: 18px;\n line-height: 21px;\n margin: 5px 0;\n letter-spacing: -0.015em;\n color: #fafafa;\n text-decoration: none;\n cursor: pointer;\n width: ", "px;\n padding: 0 17px;\n &:hover {\n background: #e33aa9;\n }\n p {\n cursor: pointer;\n margin: 0%;\n pointer-events: none;\n }\n img {\n width: 22px;\n & + * {\n margin-left: 12px;\n }\n }\n &.sub-option-link {\n display: flex;\n justify-content: flex-start;\n text-decoration: none;\n position: relative;\n font-size: 13px;\n border-left: 1px solid #f0eef2;\n border-radius: 0;\n color: #f0eef2;\n padding-top: 14px;\n height: 25px;\n margin: 0;\n padding-left: 12px;\n &::before {\n border-left: 1px solid #e33aa9;\n width: 10px;\n content: \"\";\n border-radius: 50%;\n height: 10px;\n background-color: white;\n position: absolute;\n bottom: 0;\n left: ", "%;\n }\n &.active {\n background: none;\n &::before {\n background-color: #e33aa9;\n }\n }\n &:hover {\n background: none;\n }\n }\n"])), function (_ref6) {
|
|
41
|
-
var bar = _ref6.bar;
|
|
42
30
|
return bar ? 32 : 38;
|
|
31
|
+
}, function (_ref6) {
|
|
32
|
+
var bar = _ref6.bar;
|
|
33
|
+
return bar ? "flex-start" : "center";
|
|
43
34
|
}, function (_ref7) {
|
|
44
35
|
var bar = _ref7.bar;
|
|
45
|
-
return bar ?
|
|
36
|
+
return bar ? 18 : 100;
|
|
46
37
|
}, function (_ref8) {
|
|
47
38
|
var bar = _ref8.bar;
|
|
48
|
-
return bar ?
|
|
39
|
+
return bar ? "160" : "38";
|
|
49
40
|
}, function (_ref9) {
|
|
50
41
|
var bar = _ref9.bar;
|
|
51
|
-
return bar ?
|
|
42
|
+
return bar ? 15 : 0;
|
|
52
43
|
}, function (_ref10) {
|
|
53
44
|
var bar = _ref10.bar;
|
|
54
|
-
return bar ?
|
|
45
|
+
return bar ? 28 : 20;
|
|
46
|
+
}, function (_ref11) {
|
|
47
|
+
var bar = _ref11.bar;
|
|
48
|
+
return bar ? -4 : -34;
|
|
55
49
|
});
|
|
56
|
-
exports.NavLinkOption = NavLinkOption;
|
|
57
|
-
|
|
58
|
-
var ContainerPrincipal = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n display: flex;\n height: 100vh;\n justify-content: space-between;\n"])));
|
|
59
50
|
|
|
60
|
-
exports.
|
|
61
|
-
var GlobalStyle = (0, _styledComponents.createGlobalStyle)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n@font-face {\n font-family: 'Avenir Next';\n font-style: normal;\n font-weight: normal;\n src:\n url('../../assets/fonts/AvenirNextLTPro-Bold.otf') format('otf'),\n url('../../assets/fonts/AvenirNextLTPro-Regular.otf') format('otf');\n}\n\nhtml, body, div, span, applet, object, iframe,\nh1, h2, h3, h4, h5, h6, p, blockquote, pre,\na, abbr, acronym, address, big, cite, code,\ndel, dfn, em, font, img, ins, kbd, q, s, samp,\nsmall, strike, strong, sub, sup, tt, var,\nb, u, i, center,\ndl, dt, dd, ol, ul, li,\nfieldset, figure, form, label, legend,\ntable, caption, tbody, tfoot, thead, tr, th, td {\n margin: 0;\n padding: 0;\n border: 0;\n outline: 0;\n font-size: 100%;\n vertical-align: baseline;\n background: transparent;\n}\nbody {\n line-height: 1;\n}\nol, ul {\n list-style: none;\n}\nblockquote, q {\n quotes: none;\n}\nblockquote:before, blockquote:after,\nq:before, q:after {\n content: '';\n content: none;\n}\n:focus {\n outline: 0;\n}\nins {\n text-decoration: none;\n}\ndel {\n text-decoration: line-through;\n}\ntable {\n border-collapse: collapse;\n border-spacing: 0;\n}\n\n"])));
|
|
62
|
-
exports.GlobalStyle = GlobalStyle;
|
|
51
|
+
exports.Container = Container;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = exports.CustomSelectDefault = void 0;
|
|
9
|
+
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
|
+
|
|
12
|
+
var _index = require("./index");
|
|
13
|
+
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
|
|
16
|
+
var _default = {
|
|
17
|
+
title: "Components/molecules/CustomSelect",
|
|
18
|
+
component: _index.CustomSelect
|
|
19
|
+
};
|
|
20
|
+
exports.default = _default;
|
|
21
|
+
|
|
22
|
+
var Template = function Template(args) {
|
|
23
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.CustomSelect, (0, _objectSpread2.default)({}, args));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var CustomSelectDefault = Template.bind({});
|
|
27
|
+
exports.CustomSelectDefault = CustomSelectDefault;
|
|
28
|
+
CustomSelectDefault.args = {
|
|
29
|
+
selectLabel: "Todos los departamentos",
|
|
30
|
+
defaultOption: "Todos los departamentos",
|
|
31
|
+
options: [{
|
|
32
|
+
id: 1,
|
|
33
|
+
value: "Decoración",
|
|
34
|
+
subOptions: [{
|
|
35
|
+
id: 1,
|
|
36
|
+
value: "Espejos"
|
|
37
|
+
}, {
|
|
38
|
+
id: 2,
|
|
39
|
+
value: "Persianas"
|
|
40
|
+
}]
|
|
41
|
+
}, {
|
|
42
|
+
id: 2,
|
|
43
|
+
value: "Eléctrico"
|
|
44
|
+
}, {
|
|
45
|
+
id: 3,
|
|
46
|
+
value: "Ferretería"
|
|
47
|
+
}, {
|
|
48
|
+
id: 4,
|
|
49
|
+
value: "Herramientas"
|
|
50
|
+
}, {
|
|
51
|
+
id: 5,
|
|
52
|
+
value: "Iluminación"
|
|
53
|
+
}]
|
|
54
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.SelecItem = void 0;
|
|
9
|
+
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
11
|
+
|
|
12
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var _react = require("react");
|
|
17
|
+
|
|
18
|
+
var _CheckBox = require("../../atoms/CheckBox");
|
|
19
|
+
|
|
20
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
+
|
|
22
|
+
var SelecItem = function SelecItem(_ref) {
|
|
23
|
+
var _option$subOptions;
|
|
24
|
+
|
|
25
|
+
var option = _ref.option,
|
|
26
|
+
customSelectId = _ref.customSelectId,
|
|
27
|
+
setParameterArray = _ref.setParameterArray,
|
|
28
|
+
activeFilters = _ref.activeFilters,
|
|
29
|
+
setActiveFilters = _ref.setActiveFilters;
|
|
30
|
+
|
|
31
|
+
var _useState = (0, _react.useState)(false),
|
|
32
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
33
|
+
showSubOptions = _useState2[0],
|
|
34
|
+
setShowSubOptions = _useState2[1];
|
|
35
|
+
|
|
36
|
+
var _useState3 = (0, _react.useState)(false),
|
|
37
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
38
|
+
chkGlobal = _useState4[0],
|
|
39
|
+
setChkGlobal = _useState4[1];
|
|
40
|
+
|
|
41
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
42
|
+
className: "option-container",
|
|
43
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
44
|
+
className: "main-item",
|
|
45
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckBox.CheckBox, {
|
|
46
|
+
id: "main-item-" + option.id,
|
|
47
|
+
label: option.name,
|
|
48
|
+
onChange: function onChange(e) {
|
|
49
|
+
var subOptions = option.subOptions;
|
|
50
|
+
var filtersCopy = (0, _objectSpread2.default)({}, activeFilters);
|
|
51
|
+
|
|
52
|
+
if (subOptions) {
|
|
53
|
+
setChkGlobal(e.target.checked);
|
|
54
|
+
|
|
55
|
+
if (e.target.checked) {
|
|
56
|
+
subOptions.forEach(function (element) {
|
|
57
|
+
if (!filtersCopy[option.name]) filtersCopy[option.name] = {};
|
|
58
|
+
filtersCopy[option.name][element.name] = 1;
|
|
59
|
+
});
|
|
60
|
+
setParameterArray(function (current) {
|
|
61
|
+
return [].concat((0, _toConsumableArray2.default)(current), (0, _toConsumableArray2.default)(subOptions.map(function (element) {
|
|
62
|
+
return element.id;
|
|
63
|
+
})));
|
|
64
|
+
});
|
|
65
|
+
} else {
|
|
66
|
+
setParameterArray(function (current) {
|
|
67
|
+
return current.filter(function (item) {
|
|
68
|
+
return !subOptions.map(function (opt) {
|
|
69
|
+
return opt.id;
|
|
70
|
+
}).includes(item);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
delete filtersCopy[option.name];
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
if (e.target.checked) {
|
|
77
|
+
filtersCopy[option.name] = 1;
|
|
78
|
+
setParameterArray(function (current) {
|
|
79
|
+
return [].concat((0, _toConsumableArray2.default)(current), [option.id]);
|
|
80
|
+
});
|
|
81
|
+
} else {
|
|
82
|
+
delete filtersCopy[option.name];
|
|
83
|
+
setParameterArray(function (current) {
|
|
84
|
+
return current.filter(function (item) {
|
|
85
|
+
return option.id !== item;
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
setActiveFilters(filtersCopy);
|
|
92
|
+
},
|
|
93
|
+
defaultChecked: activeFilters[option.name]
|
|
94
|
+
}), option.subOptions && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
95
|
+
onClick: function onClick() {
|
|
96
|
+
return setShowSubOptions(!showSubOptions);
|
|
97
|
+
},
|
|
98
|
+
className: "arrow-item",
|
|
99
|
+
children: "\u25C0"
|
|
100
|
+
})]
|
|
101
|
+
}), showSubOptions && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
102
|
+
className: "sub-menu",
|
|
103
|
+
children: option === null || option === void 0 ? void 0 : (_option$subOptions = option.subOptions) === null || _option$subOptions === void 0 ? void 0 : _option$subOptions.map(function (sub) {
|
|
104
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
105
|
+
className: "sub-filter",
|
|
106
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckBox.CheckBox, {
|
|
107
|
+
id: "sub-item-" + sub.id,
|
|
108
|
+
label: sub.name,
|
|
109
|
+
defaultChecked: activeFilters[option.name] && activeFilters[option.name][sub.name],
|
|
110
|
+
onChange: function onChange(e) {
|
|
111
|
+
if (e.target.checked) {
|
|
112
|
+
setParameterArray(function (current) {
|
|
113
|
+
return [].concat((0, _toConsumableArray2.default)(current), [sub.id]).sort(function (a, b) {
|
|
114
|
+
return a - b;
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
} else {
|
|
118
|
+
setParameterArray(function (current) {
|
|
119
|
+
return current.filter(function (item) {
|
|
120
|
+
return sub.id !== item;
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
}, customSelectId + "-" + option.id + "-" + sub.id);
|
|
127
|
+
})
|
|
128
|
+
})]
|
|
129
|
+
}, customSelectId + option.id);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
exports.SelecItem = SelecItem;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.CustomSelect = void 0;
|
|
9
|
+
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _styles = require("./styles");
|
|
15
|
+
|
|
16
|
+
var _react = require("react");
|
|
17
|
+
|
|
18
|
+
var _searchIcon = _interopRequireDefault(require("../../../assets/images/customSelect/searchIcon.png"));
|
|
19
|
+
|
|
20
|
+
var _customHooks = require("../../../global-files/customHooks");
|
|
21
|
+
|
|
22
|
+
var _SelectItem = require("./SelectItem");
|
|
23
|
+
|
|
24
|
+
var _Calendar = require("../../organisms/Calendar");
|
|
25
|
+
|
|
26
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
|
+
|
|
28
|
+
var CustomSelect = function CustomSelect(_ref) {
|
|
29
|
+
var options = _ref.options,
|
|
30
|
+
showSearchBar = _ref.showSearchBar,
|
|
31
|
+
_ref$placeHolder = _ref.placeHolder,
|
|
32
|
+
placeHolder = _ref$placeHolder === void 0 ? "Buscar departamento" : _ref$placeHolder,
|
|
33
|
+
_ref$selectLabel = _ref.selectLabel,
|
|
34
|
+
selectLabel = _ref$selectLabel === void 0 ? "" : _ref$selectLabel,
|
|
35
|
+
_ref$customSelectId = _ref.customSelectId,
|
|
36
|
+
customSelectId = _ref$customSelectId === void 0 ? "defaultSelectId" : _ref$customSelectId,
|
|
37
|
+
defaultOption = _ref.defaultOption,
|
|
38
|
+
setParameterArray = _ref.setParameterArray;
|
|
39
|
+
|
|
40
|
+
var _useState = (0, _react.useState)(options || []),
|
|
41
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
42
|
+
filters = _useState2[0],
|
|
43
|
+
setFilters = _useState2[1];
|
|
44
|
+
|
|
45
|
+
var _useCloseModal = (0, _customHooks.useCloseModal)(customSelectId),
|
|
46
|
+
_useCloseModal2 = (0, _slicedToArray2.default)(_useCloseModal, 2),
|
|
47
|
+
showList = _useCloseModal2[0],
|
|
48
|
+
setShowList = _useCloseModal2[1];
|
|
49
|
+
|
|
50
|
+
var _useState3 = (0, _react.useState)(""),
|
|
51
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
52
|
+
text = _useState4[0],
|
|
53
|
+
setText = _useState4[1];
|
|
54
|
+
|
|
55
|
+
var _useCloseModal3 = (0, _customHooks.useCloseModal)(customSelectId),
|
|
56
|
+
_useCloseModal4 = (0, _slicedToArray2.default)(_useCloseModal3, 2),
|
|
57
|
+
showDatePicker = _useCloseModal4[0],
|
|
58
|
+
setShowDatePicker = _useCloseModal4[1];
|
|
59
|
+
|
|
60
|
+
var _useState5 = (0, _react.useState)(new Date()),
|
|
61
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
62
|
+
startDate = _useState6[0],
|
|
63
|
+
setStartDate = _useState6[1];
|
|
64
|
+
|
|
65
|
+
var _useState7 = (0, _react.useState)(new Date()),
|
|
66
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
67
|
+
endDate = _useState8[0],
|
|
68
|
+
setEndDate = _useState8[1];
|
|
69
|
+
|
|
70
|
+
var _useState9 = (0, _react.useState)({}),
|
|
71
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
72
|
+
activeFilters = _useState10[0],
|
|
73
|
+
setActiveFilters = _useState10[1];
|
|
74
|
+
|
|
75
|
+
var onChange = function onChange(evt) {
|
|
76
|
+
setText(evt.target.value);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
(0, _react.useEffect)(function () {
|
|
80
|
+
var today = new Date();
|
|
81
|
+
var diff = today.getDate() - today.getDay();
|
|
82
|
+
var start = new Date(today.setDate(diff));
|
|
83
|
+
var end = new Date();
|
|
84
|
+
setStartDate(start);
|
|
85
|
+
setEndDate(end);
|
|
86
|
+
}, []);
|
|
87
|
+
|
|
88
|
+
var onChangeDatePicker = function onChangeDatePicker(dates) {
|
|
89
|
+
var _dates = (0, _slicedToArray2.default)(dates, 2),
|
|
90
|
+
start = _dates[0],
|
|
91
|
+
end = _dates[1];
|
|
92
|
+
|
|
93
|
+
setStartDate(start);
|
|
94
|
+
setEndDate(end);
|
|
95
|
+
if (end) setParameterArray(function (current) {
|
|
96
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, current), {}, {
|
|
97
|
+
startDate: "".concat(start.getFullYear(), "-").concat(start.getMonth() + 1, "-").concat(start.getDate()),
|
|
98
|
+
endDate: "".concat(end.getFullYear(), "-").concat(end.getMonth() + 1, "-").concat(end.getDate())
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
(0, _react.useEffect)(function () {
|
|
104
|
+
var filteredArray = (options === null || options === void 0 ? void 0 : options.slice()) || [];
|
|
105
|
+
|
|
106
|
+
if (text.length > 0) {
|
|
107
|
+
filteredArray = filteredArray.filter(function (option) {
|
|
108
|
+
return option === null || option === void 0 ? void 0 : option.name.toLowerCase().includes(text.toLocaleLowerCase());
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
setFilters(filteredArray);
|
|
113
|
+
}, [text]);
|
|
114
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
115
|
+
id: customSelectId,
|
|
116
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
117
|
+
className: "button-list",
|
|
118
|
+
onClick: function onClick() {
|
|
119
|
+
return setShowList(true);
|
|
120
|
+
},
|
|
121
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
122
|
+
children: selectLabel
|
|
123
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
124
|
+
className: "arrow-item",
|
|
125
|
+
children: "\u25C0"
|
|
126
|
+
})]
|
|
127
|
+
}), showList && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
128
|
+
className: "select-container",
|
|
129
|
+
children: [showSearchBar && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
130
|
+
className: "search-bar-filter",
|
|
131
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
132
|
+
src: _searchIcon.default,
|
|
133
|
+
alt: "search icon"
|
|
134
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
135
|
+
type: "text",
|
|
136
|
+
placeholder: placeHolder,
|
|
137
|
+
value: text,
|
|
138
|
+
onChange: onChange
|
|
139
|
+
})]
|
|
140
|
+
}), defaultOption && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
141
|
+
className: "default-option",
|
|
142
|
+
onClick: function onClick() {
|
|
143
|
+
setParameterArray([]);
|
|
144
|
+
setActiveFilters({});
|
|
145
|
+
setShowList(false);
|
|
146
|
+
},
|
|
147
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
148
|
+
children: defaultOption
|
|
149
|
+
})
|
|
150
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
151
|
+
className: "filters-container",
|
|
152
|
+
children: filters === null || filters === void 0 ? void 0 : filters.map(function (option) {
|
|
153
|
+
return customSelectId === "dates-select" ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
154
|
+
className: "dates-select-item",
|
|
155
|
+
onClick: function onClick() {
|
|
156
|
+
option.function ? option.function(setShowDatePicker) : setShowDatePicker(true);
|
|
157
|
+
},
|
|
158
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
159
|
+
children: option.name
|
|
160
|
+
})
|
|
161
|
+
}, customSelectId + option.id) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectItem.SelecItem, {
|
|
162
|
+
option: option,
|
|
163
|
+
customSelectId: customSelectId,
|
|
164
|
+
setParameterArray: setParameterArray,
|
|
165
|
+
activeFilters: activeFilters,
|
|
166
|
+
setActiveFilters: setActiveFilters
|
|
167
|
+
}, customSelectId + option.id);
|
|
168
|
+
})
|
|
169
|
+
})]
|
|
170
|
+
}), showDatePicker && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Calendar.Calendar, {
|
|
171
|
+
onChange: onChangeDatePicker,
|
|
172
|
+
startDate: startDate,
|
|
173
|
+
endDate: endDate
|
|
174
|
+
})]
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
exports.CustomSelect = CustomSelect;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.Container = void 0;
|
|
9
|
+
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
11
|
+
|
|
12
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
+
|
|
14
|
+
var _variables = require("../../../global-files/variables");
|
|
15
|
+
|
|
16
|
+
var _templateObject;
|
|
17
|
+
|
|
18
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: fit-content;\n position: relative;\n\n .button-list {\n font-family: ", ";\n font-size: 13px;\n display: flex;\n padding: 10px 15px;\n justify-content: space-between;\n border-radius: 50px;\n background-color: #fff;\n border: 1px solid #f0f0f0;\n cursor: pointer;\n\n .arrow-item {\n transform: rotate(-90deg);\n cursor: pointer;\n font-size: 10px;\n }\n & + * {\n margin-top: 10px;\n }\n }\n\n .select-container {\n box-shadow: 0px 2px 4px #00000040;\n border-radius: 5px;\n background-color: #fff;\n padding-bottom: 10px;\n position: absolute;\n z-index: 10;\n .search-bar-filter {\n display: flex;\n align-items: center;\n border: 1px solid #f0f0f0;\n padding-left: 10px;\n\n img {\n width: 15px;\n height: 15px;\n }\n\n input {\n background-color: transparent;\n padding: 10px 10px;\n outline: none;\n border: none;\n }\n }\n .default-option {\n padding-top: 5px;\n cursor: pointer;\n padding: 5px 10px;\n color: #817393;\n font-family: Avenir Next;\n font-weight: 500;\n font-size: 13px;\n line-height: 21px;\n &:hover {\n background-color: #f0f0f0;\n }\n }\n .filters-container {\n overflow: auto;\n max-height: 500px;\n .option-container,\n .default-option {\n cursor: pointer;\n padding: 5px 10px;\n .main-item {\n display: flex;\n justify-content: space-between;\n\n .arrow-item {\n transform: rotate(-90deg);\n cursor: pointer;\n font-size: 10px;\n }\n }\n .sub-menu {\n padding-left: 20px;\n .sub-filter {\n & + * {\n margin-top: 10px;\n }\n }\n }\n\n &:hover {\n background-color: #f0f0f0;\n }\n label {\n white-space: nowrap;\n }\n }\n\n .dates-select-item {\n cursor: pointer;\n padding: 5px 10px;\n color: #817393;\n font-family: Avenir Next;\n font-weight: 500;\n font-size: 13px;\n line-height: 21px;\n &:hover {\n background-color: #f0f0f0;\n }\n }\n }\n }\n"])), _variables.FontFamily.Raleway);
|
|
19
|
+
|
|
20
|
+
exports.Container = Container;
|