contentoh-components-library 21.2.40 → 21.2.42
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/customSelect/starIcon.svg +14 -0
- package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +18 -22
- package/dist/components/molecules/CustomSelect/SelectItem.js +10 -1
- package/dist/components/molecules/CustomSelect/index.js +33 -7
- package/dist/components/molecules/CustomSelect/styles.js +3 -1
- package/package.json +1 -1
- package/src/assets/images/customSelect/starIcon.svg +14 -0
- package/src/components/molecules/CustomSelect/CustomSelect.stories.js +18 -11
- package/src/components/molecules/CustomSelect/SelectItem.js +7 -0
- package/src/components/molecules/CustomSelect/index.js +27 -6
- package/src/components/molecules/CustomSelect/styles.js +3 -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/atoms/StatusTag/StatusTag.stories.js +0 -48
- package/dist/components/atoms/StatusTag/index.js +0 -58
- package/dist/components/atoms/StatusTag/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/dist/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +0 -37
- package/dist/components/pages/RegistrationLoginFirstStep/index.js +0 -269
- package/dist/components/pages/RegistrationLoginFirstStep/styles.js +0 -20
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<svg id="Componente_34_12" data-name="Componente 34 – 12" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
|
|
2
|
+
<defs>
|
|
3
|
+
<clipPath id="clip-path">
|
|
4
|
+
<rect id="Rectángulo_107" data-name="Rectángulo 107" width="10" height="10" transform="translate(3 3)" fill="#b3b3b3" stroke="#b3b3b3" stroke-width="1"/>
|
|
5
|
+
</clipPath>
|
|
6
|
+
</defs>
|
|
7
|
+
<g id="Rectángulo_287" data-name="Rectángulo 287" fill="#fff" stroke="#f0f0f0" stroke-width="1">
|
|
8
|
+
<rect width="16" height="16" rx="8" stroke="none"/>
|
|
9
|
+
<rect x="0.5" y="0.5" width="15" height="15" rx="7.5" fill="none"/>
|
|
10
|
+
</g>
|
|
11
|
+
<g id="Enmascarar_grupo_79" data-name="Enmascarar grupo 79" clip-path="url(#clip-path)">
|
|
12
|
+
<path id="star_FILL0_wght400_GRAD0_opsz48" d="M4.037,9.438,6,8.262,7.963,9.45,7.438,7.225l1.725-1.5-2.275-.2L6,3.425,5.113,5.512l-2.275.2,1.725,1.5ZM2.912,11l.813-3.512L1,5.125l3.6-.312L6,1.5,7.4,4.813l3.6.313L8.275,7.488,9.087,11,6,9.137ZM6,6.563Z" transform="translate(2 1.5)" fill="#b3b3b3"/>
|
|
13
|
+
</g>
|
|
14
|
+
</svg>
|
|
@@ -11,6 +11,8 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/
|
|
|
11
11
|
|
|
12
12
|
var _index = require("./index");
|
|
13
13
|
|
|
14
|
+
var _starIcon = _interopRequireDefault(require("../../../assets/images/customSelect/starIcon.svg"));
|
|
15
|
+
|
|
14
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
17
|
|
|
16
18
|
var _default = {
|
|
@@ -26,29 +28,23 @@ var Template = function Template(args) {
|
|
|
26
28
|
var CustomSelectDefault = Template.bind({});
|
|
27
29
|
exports.CustomSelectDefault = CustomSelectDefault;
|
|
28
30
|
CustomSelectDefault.args = {
|
|
29
|
-
selectLabel: "Todos los departamentos",
|
|
31
|
+
// selectLabel: "Todos los departamentos",
|
|
30
32
|
defaultOption: "Todos los departamentos",
|
|
31
33
|
options: [{
|
|
32
|
-
id:
|
|
33
|
-
|
|
34
|
-
|
|
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"
|
|
34
|
+
id: 47,
|
|
35
|
+
name: "Enero 2023",
|
|
36
|
+
isSelected: true
|
|
50
37
|
}, {
|
|
51
|
-
id:
|
|
52
|
-
|
|
53
|
-
}]
|
|
38
|
+
id: 49,
|
|
39
|
+
name: "Mis Favoritos"
|
|
40
|
+
}],
|
|
41
|
+
onClickItem: function onClickItem(v, id) {
|
|
42
|
+
if (v) {
|
|
43
|
+
console.log("Agregar a la lista", id);
|
|
44
|
+
} else {
|
|
45
|
+
console.log("Eliminar a la lista", id);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
icon: _starIcon.default,
|
|
49
|
+
showSearchBar: true
|
|
54
50
|
};
|
|
@@ -26,7 +26,8 @@ var SelecItem = function SelecItem(_ref) {
|
|
|
26
26
|
customSelectId = _ref.customSelectId,
|
|
27
27
|
setParameterArray = _ref.setParameterArray,
|
|
28
28
|
activeFilters = _ref.activeFilters,
|
|
29
|
-
setActiveFilters = _ref.setActiveFilters
|
|
29
|
+
setActiveFilters = _ref.setActiveFilters,
|
|
30
|
+
onClickItem = _ref.onClickItem;
|
|
30
31
|
|
|
31
32
|
var _useState = (0, _react.useState)(false),
|
|
32
33
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -46,6 +47,10 @@ var SelecItem = function SelecItem(_ref) {
|
|
|
46
47
|
id: "main-item-" + option.id,
|
|
47
48
|
label: option.name,
|
|
48
49
|
onChange: function onChange(e) {
|
|
50
|
+
if (onClickItem) {
|
|
51
|
+
onClickItem(e.target.checked, option.id);
|
|
52
|
+
}
|
|
53
|
+
|
|
49
54
|
var subOptions = option.subOptions;
|
|
50
55
|
var filtersCopy = (0, _objectSpread2.default)({}, activeFilters);
|
|
51
56
|
|
|
@@ -108,6 +113,10 @@ var SelecItem = function SelecItem(_ref) {
|
|
|
108
113
|
label: sub.name,
|
|
109
114
|
defaultChecked: activeFilters[option.name] && activeFilters[option.name][sub.name],
|
|
110
115
|
onChange: function onChange(e) {
|
|
116
|
+
if (onClickItem) {
|
|
117
|
+
onClickItem(e.target.checked, sub.id);
|
|
118
|
+
}
|
|
119
|
+
|
|
111
120
|
if (e.target.checked) {
|
|
112
121
|
setParameterArray(function (current) {
|
|
113
122
|
return [].concat((0, _toConsumableArray2.default)(current), [sub.id]).sort(function (a, b) {
|
|
@@ -35,9 +35,11 @@ var CustomSelect = function CustomSelect(_ref) {
|
|
|
35
35
|
_ref$customSelectId = _ref.customSelectId,
|
|
36
36
|
customSelectId = _ref$customSelectId === void 0 ? "defaultSelectId" : _ref$customSelectId,
|
|
37
37
|
defaultOption = _ref.defaultOption,
|
|
38
|
-
setParameterArray = _ref.setParameterArray
|
|
38
|
+
setParameterArray = _ref.setParameterArray,
|
|
39
|
+
onClickItem = _ref.onClickItem,
|
|
40
|
+
icon = _ref.icon;
|
|
39
41
|
|
|
40
|
-
var _useState = (0, _react.useState)(
|
|
42
|
+
var _useState = (0, _react.useState)([]),
|
|
41
43
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
42
44
|
filters = _useState2[0],
|
|
43
45
|
setFilters = _useState2[1];
|
|
@@ -83,7 +85,25 @@ var CustomSelect = function CustomSelect(_ref) {
|
|
|
83
85
|
var end = new Date();
|
|
84
86
|
setStartDate(start);
|
|
85
87
|
setEndDate(end);
|
|
86
|
-
|
|
88
|
+
var obj = {};
|
|
89
|
+
options.forEach(function (o) {
|
|
90
|
+
var name = o.name,
|
|
91
|
+
isSelected = o.isSelected,
|
|
92
|
+
subOptions = o.subOptions;
|
|
93
|
+
if (isSelected) obj[name] = {};
|
|
94
|
+
subOptions === null || subOptions === void 0 ? void 0 : subOptions.forEach(function (so) {
|
|
95
|
+
var nameSO = so.name,
|
|
96
|
+
isSelectedSO = so.isSelected;
|
|
97
|
+
|
|
98
|
+
if (isSelectedSO) {
|
|
99
|
+
if (!obj[name]) obj[name] = {};
|
|
100
|
+
obj[name][nameSO] = true;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
setActiveFilters(obj);
|
|
105
|
+
setFilters(options);
|
|
106
|
+
}, [options]);
|
|
87
107
|
|
|
88
108
|
var onChangeDatePicker = function onChangeDatePicker(dates) {
|
|
89
109
|
var _dates = (0, _slicedToArray2.default)(dates, 2),
|
|
@@ -113,14 +133,19 @@ var CustomSelect = function CustomSelect(_ref) {
|
|
|
113
133
|
}, [text]);
|
|
114
134
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
115
135
|
id: customSelectId,
|
|
136
|
+
selectLabel: selectLabel,
|
|
116
137
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
117
138
|
className: "button-list",
|
|
118
139
|
onClick: function onClick() {
|
|
119
140
|
return setShowList(!showList);
|
|
120
141
|
},
|
|
121
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
142
|
+
children: [selectLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
122
143
|
children: selectLabel
|
|
123
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("
|
|
144
|
+
}), icon ? /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
145
|
+
src: icon,
|
|
146
|
+
alt: "Favorite",
|
|
147
|
+
width: "20px"
|
|
148
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
124
149
|
className: "arrow-item",
|
|
125
150
|
children: "\u25C0"
|
|
126
151
|
})]
|
|
@@ -140,7 +165,7 @@ var CustomSelect = function CustomSelect(_ref) {
|
|
|
140
165
|
}), defaultOption && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
141
166
|
className: "default-option",
|
|
142
167
|
onClick: function onClick() {
|
|
143
|
-
setParameterArray([]);
|
|
168
|
+
setParameterArray && setParameterArray([]);
|
|
144
169
|
setActiveFilters({});
|
|
145
170
|
setShowList(false);
|
|
146
171
|
},
|
|
@@ -163,7 +188,8 @@ var CustomSelect = function CustomSelect(_ref) {
|
|
|
163
188
|
customSelectId: customSelectId,
|
|
164
189
|
setParameterArray: setParameterArray,
|
|
165
190
|
activeFilters: activeFilters,
|
|
166
|
-
setActiveFilters: setActiveFilters
|
|
191
|
+
setActiveFilters: setActiveFilters,
|
|
192
|
+
onClickItem: onClickItem
|
|
167
193
|
}, customSelectId + option.id);
|
|
168
194
|
})
|
|
169
195
|
})]
|
|
@@ -15,6 +15,8 @@ var _variables = require("../../../global-files/variables");
|
|
|
15
15
|
|
|
16
16
|
var _templateObject;
|
|
17
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 margin-left: 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)
|
|
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: ", ";\n //padding: 10px 15px;\n //padding: 5px 5px;\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 margin-left: 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, function (props) {
|
|
19
|
+
return props.selectLabel !== "" ? "10px 15px" : "5px 5px";
|
|
20
|
+
});
|
|
19
21
|
|
|
20
22
|
exports.Container = Container;
|
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<svg id="Componente_34_12" data-name="Componente 34 – 12" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
|
|
2
|
+
<defs>
|
|
3
|
+
<clipPath id="clip-path">
|
|
4
|
+
<rect id="Rectángulo_107" data-name="Rectángulo 107" width="10" height="10" transform="translate(3 3)" fill="#b3b3b3" stroke="#b3b3b3" stroke-width="1"/>
|
|
5
|
+
</clipPath>
|
|
6
|
+
</defs>
|
|
7
|
+
<g id="Rectángulo_287" data-name="Rectángulo 287" fill="#fff" stroke="#f0f0f0" stroke-width="1">
|
|
8
|
+
<rect width="16" height="16" rx="8" stroke="none"/>
|
|
9
|
+
<rect x="0.5" y="0.5" width="15" height="15" rx="7.5" fill="none"/>
|
|
10
|
+
</g>
|
|
11
|
+
<g id="Enmascarar_grupo_79" data-name="Enmascarar grupo 79" clip-path="url(#clip-path)">
|
|
12
|
+
<path id="star_FILL0_wght400_GRAD0_opsz48" d="M4.037,9.438,6,8.262,7.963,9.45,7.438,7.225l1.725-1.5-2.275-.2L6,3.425,5.113,5.512l-2.275.2,1.725,1.5ZM2.912,11l.813-3.512L1,5.125l3.6-.312L6,1.5,7.4,4.813l3.6.313L8.275,7.488,9.087,11,6,9.137ZM6,6.563Z" transform="translate(2 1.5)" fill="#b3b3b3"/>
|
|
13
|
+
</g>
|
|
14
|
+
</svg>
|
|
@@ -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,26 @@ 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
|
{
|
|
15
|
-
id:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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,
|
|
27
34
|
};
|
|
@@ -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)
|
|
@@ -13,8 +13,10 @@ export const CustomSelect = ({
|
|
|
13
13
|
customSelectId = "defaultSelectId",
|
|
14
14
|
defaultOption,
|
|
15
15
|
setParameterArray,
|
|
16
|
+
onClickItem,
|
|
17
|
+
icon,
|
|
16
18
|
}) => {
|
|
17
|
-
const [filters, setFilters] = useState(
|
|
19
|
+
const [filters, setFilters] = useState([]);
|
|
18
20
|
const [showList, setShowList] = useCloseModal(customSelectId);
|
|
19
21
|
const [text, setText] = useState("");
|
|
20
22
|
const [showDatePicker, setShowDatePicker] = useCloseModal(customSelectId);
|
|
@@ -33,7 +35,21 @@ export const CustomSelect = ({
|
|
|
33
35
|
const end = new Date();
|
|
34
36
|
setStartDate(start);
|
|
35
37
|
setEndDate(end);
|
|
36
|
-
|
|
38
|
+
const obj = {};
|
|
39
|
+
options.forEach((o) => {
|
|
40
|
+
const { name, isSelected, subOptions } = o;
|
|
41
|
+
if (isSelected) obj[name] = {};
|
|
42
|
+
subOptions?.forEach((so) => {
|
|
43
|
+
const { name: nameSO, isSelected: isSelectedSO } = so;
|
|
44
|
+
if (isSelectedSO) {
|
|
45
|
+
if (!obj[name]) obj[name] = {};
|
|
46
|
+
obj[name][nameSO] = true;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
setActiveFilters(obj);
|
|
51
|
+
setFilters(options);
|
|
52
|
+
}, [options]);
|
|
37
53
|
|
|
38
54
|
const onChangeDatePicker = (dates) => {
|
|
39
55
|
const [start, end] = dates;
|
|
@@ -64,10 +80,14 @@ export const CustomSelect = ({
|
|
|
64
80
|
}, [text]);
|
|
65
81
|
|
|
66
82
|
return (
|
|
67
|
-
<Container id={customSelectId}>
|
|
83
|
+
<Container id={customSelectId} selectLabel={selectLabel}>
|
|
68
84
|
<div className="button-list" onClick={() => setShowList(!showList)}>
|
|
69
|
-
<p>{selectLabel}</p>
|
|
70
|
-
|
|
85
|
+
{selectLabel && <p>{selectLabel}</p>}
|
|
86
|
+
{icon ? (
|
|
87
|
+
<img src={icon} alt="Favorite" width={"20px"} />
|
|
88
|
+
) : (
|
|
89
|
+
<div className="arrow-item">◀</div>
|
|
90
|
+
)}
|
|
71
91
|
</div>
|
|
72
92
|
{showList && (
|
|
73
93
|
<div className="select-container">
|
|
@@ -86,7 +106,7 @@ export const CustomSelect = ({
|
|
|
86
106
|
<div
|
|
87
107
|
className="default-option"
|
|
88
108
|
onClick={() => {
|
|
89
|
-
setParameterArray([]);
|
|
109
|
+
setParameterArray && setParameterArray([]);
|
|
90
110
|
setActiveFilters({});
|
|
91
111
|
setShowList(false);
|
|
92
112
|
}}
|
|
@@ -116,6 +136,7 @@ export const CustomSelect = ({
|
|
|
116
136
|
setParameterArray={setParameterArray}
|
|
117
137
|
activeFilters={activeFilters}
|
|
118
138
|
setActiveFilters={setActiveFilters}
|
|
139
|
+
onClickItem={onClickItem}
|
|
119
140
|
/>
|
|
120
141
|
)
|
|
121
142
|
)}
|
|
@@ -9,7 +9,9 @@ export const Container = styled.div`
|
|
|
9
9
|
font-family: ${FontFamily.Raleway};
|
|
10
10
|
font-size: 13px;
|
|
11
11
|
display: flex;
|
|
12
|
-
padding: 10px 15px;
|
|
12
|
+
padding: ${(props) => (props.selectLabel !== "" ? "10px 15px" : "5px 5px")};
|
|
13
|
+
//padding: 10px 15px;
|
|
14
|
+
//padding: 5px 5px;
|
|
13
15
|
justify-content: space-between;
|
|
14
16
|
border-radius: 50px;
|
|
15
17
|
background-color: #fff;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.ListCommercialRetailersDefault = void 0;
|
|
7
|
-
|
|
8
|
-
var _index = require("./index");
|
|
9
|
-
|
|
10
|
-
var _default = {
|
|
11
|
-
title: "Components/atoms/ListCommercialRetailers",
|
|
12
|
-
component: _index.ListCommercialRetailers
|
|
13
|
-
};
|
|
14
|
-
exports.default = _default;
|
|
15
|
-
|
|
16
|
-
var Template = function Template(args) {
|
|
17
|
-
return /*#__PURE__*/React.createElement(_index.ListCommercialRetailers, args);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
var ListCommercialRetailersDefault = Template.bind({});
|
|
21
|
-
exports.ListCommercialRetailersDefault = ListCommercialRetailersDefault;
|
|
22
|
-
ListCommercialRetailersDefault.args = {
|
|
23
|
-
retailersAvailable: [{
|
|
24
|
-
id: 54,
|
|
25
|
-
name: "Construrama",
|
|
26
|
-
country: "México",
|
|
27
|
-
id_region: 1,
|
|
28
|
-
active: 1
|
|
29
|
-
}, {
|
|
30
|
-
id: 4,
|
|
31
|
-
name: "Walmart Super y Superama"
|
|
32
|
-
}, {
|
|
33
|
-
id: 6,
|
|
34
|
-
name: "HEB"
|
|
35
|
-
}]
|
|
36
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
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.ListCommercialRetailers = void 0;
|
|
9
|
-
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
11
|
-
|
|
12
|
-
var _styles = require("./styles");
|
|
13
|
-
|
|
14
|
-
var _listCommercialRetailers = _interopRequireDefault(require("../../../assets/images/listCommercialRetailers/listCommercialRetailers.svg"));
|
|
15
|
-
|
|
16
|
-
var _react = require("react");
|
|
17
|
-
|
|
18
|
-
var _index = require("../CheckBox/index");
|
|
19
|
-
|
|
20
|
-
var ListCommercialRetailers = function ListCommercialRetailers(_ref) {
|
|
21
|
-
var retailersAvailable = _ref.retailersAvailable;
|
|
22
|
-
|
|
23
|
-
var _useState = (0, _react.useState)(false),
|
|
24
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
25
|
-
showMenu = _useState2[0],
|
|
26
|
-
setShowMenu = _useState2[1];
|
|
27
|
-
|
|
28
|
-
var closeMenu = function closeMenu(e) {
|
|
29
|
-
if (!e.target.closest(".menu-list-commercial-retailers") && showMenu) {
|
|
30
|
-
document.removeEventListener("click", closeMenu, false);
|
|
31
|
-
setShowMenu(false);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
(0, _react.useEffect)(function () {
|
|
36
|
-
if (showMenu) {
|
|
37
|
-
document.addEventListener("click", closeMenu, false);
|
|
38
|
-
}
|
|
39
|
-
}, [showMenu]);
|
|
40
|
-
return /*#__PURE__*/React.createElement(_styles.Container, {
|
|
41
|
-
onClick: function onClick(event) {
|
|
42
|
-
if (!showMenu) {
|
|
43
|
-
setShowMenu(true);
|
|
44
|
-
} else if (showMenu && !event.target.closest(".menu-list-commercial-retailers")) {
|
|
45
|
-
setShowMenu(false);
|
|
46
|
-
document.removeEventListener("click", closeMenu, false);
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
className: "list-commercial-retailers"
|
|
50
|
-
}, /*#__PURE__*/React.createElement("img", {
|
|
51
|
-
src: _listCommercialRetailers.default,
|
|
52
|
-
alt: "button up icon"
|
|
53
|
-
}), showMenu && /*#__PURE__*/React.createElement("div", {
|
|
54
|
-
className: "menu-list-commercial-retailers"
|
|
55
|
-
}, retailersAvailable === null || retailersAvailable === void 0 ? void 0 : retailersAvailable.map(function (component, index) {
|
|
56
|
-
return /*#__PURE__*/React.createElement(_index.CheckBox, {
|
|
57
|
-
id: component.id,
|
|
58
|
-
label: component.name,
|
|
59
|
-
key: index + "-" + component.id
|
|
60
|
-
});
|
|
61
|
-
})));
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
exports.ListCommercialRetailers = ListCommercialRetailers;
|
|
@@ -1,20 +0,0 @@
|
|
|
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.button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: transparent;\n border: 1px solid ", ";\n border-radius: 2px;\n padding: 3px;\n display: flex;\n align-items: center;\n cursor: pointer;\n position: relative;\n height: 30px;\n .menu-list-commercial-retailers {\n width: 540px;\n height: auto;\n border-radius: 7px;\n background-color: ", ";\n padding: 14px 14px 8px 20px;\n box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);\n position: absolute;\n top: calc(100% + 3px);\n right: calc(100% - 20px);\n display: flex;\n flex-wrap: wrap;\n z-index: 1;\n div {\n & + * {\n margin-left: 15px;\n }\n p {\n font-size: 11px;\n }\n }\n }\n"])), _variables.GlobalColors.magenta_s2, _variables.GlobalColors.s2);
|
|
19
|
-
|
|
20
|
-
exports.Container = Container;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.MenuCommercialRetailersDefault = void 0;
|
|
7
|
-
|
|
8
|
-
var _index = require("./index");
|
|
9
|
-
|
|
10
|
-
var _default = {
|
|
11
|
-
title: "Components/atoms/MenuCommercialRetailers",
|
|
12
|
-
component: _index.MenuCommercialRetailers
|
|
13
|
-
};
|
|
14
|
-
exports.default = _default;
|
|
15
|
-
|
|
16
|
-
var Template = function Template(args) {
|
|
17
|
-
return /*#__PURE__*/React.createElement(_index.MenuCommercialRetailers, args);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
var MenuCommercialRetailersDefault = Template.bind({});
|
|
21
|
-
exports.MenuCommercialRetailersDefault = MenuCommercialRetailersDefault;
|
|
22
|
-
MenuCommercialRetailersDefault.args = {
|
|
23
|
-
editType: "3",
|
|
24
|
-
retailersAvailable: [{
|
|
25
|
-
id: 54,
|
|
26
|
-
name: "Construrama",
|
|
27
|
-
country: "México",
|
|
28
|
-
id_region: 1,
|
|
29
|
-
active: 1
|
|
30
|
-
}, {
|
|
31
|
-
id: 4,
|
|
32
|
-
name: "Walmart Super y Superama"
|
|
33
|
-
}, {
|
|
34
|
-
id: 6,
|
|
35
|
-
name: "HEB"
|
|
36
|
-
}]
|
|
37
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.MenuCommercialRetailers = void 0;
|
|
7
|
-
|
|
8
|
-
var _styles = require("./styles");
|
|
9
|
-
|
|
10
|
-
var _StatusTag = require("../StatusTag");
|
|
11
|
-
|
|
12
|
-
var _ListCommercialRetailers = require("../ListCommercialRetailers");
|
|
13
|
-
|
|
14
|
-
var MenuCommercialRetailers = function MenuCommercialRetailers(_ref) {
|
|
15
|
-
var editType = _ref.editType,
|
|
16
|
-
retailersAvailable = _ref.retailersAvailable;
|
|
17
|
-
return /*#__PURE__*/React.createElement(_styles.Container, null, /*#__PURE__*/React.createElement(_StatusTag.StatusTag, {
|
|
18
|
-
editType: editType,
|
|
19
|
-
ovalForm: true
|
|
20
|
-
}), /*#__PURE__*/React.createElement(_ListCommercialRetailers.ListCommercialRetailers, {
|
|
21
|
-
retailersAvailable: retailersAvailable
|
|
22
|
-
}));
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
exports.MenuCommercialRetailers = MenuCommercialRetailers;
|
|
@@ -1,20 +0,0 @@
|
|
|
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 display: flex;\n align-items: center;\n .status-version {\n & + * {\n margin-left: 5px;\n }\n }\n .list-commercial-retailers {\n border: 1px solid transparent;\n img {\n display: none;\n }\n &:hover {\n border: 1px solid ", ";\n img {\n display: block;\n }\n }\n }\n"])), _variables.GlobalColors.magenta_s2);
|
|
19
|
-
|
|
20
|
-
exports.Container = Container;
|
|
@@ -1,28 +0,0 @@
|
|
|
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.MenuProductImageDefault = void 0;
|
|
9
|
-
|
|
10
|
-
var _index = require("./index");
|
|
11
|
-
|
|
12
|
-
var _menuProductImage = _interopRequireDefault(require("../../../assets/images/menuProductImage/menuProductImage.svg"));
|
|
13
|
-
|
|
14
|
-
var _default = {
|
|
15
|
-
title: "Components/atoms/MenuProductImage",
|
|
16
|
-
component: _index.MenuProductImage
|
|
17
|
-
};
|
|
18
|
-
exports.default = _default;
|
|
19
|
-
|
|
20
|
-
var Template = function Template(args) {
|
|
21
|
-
return /*#__PURE__*/React.createElement(_index.MenuProductImage, args);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
var MenuProductImageDefault = Template.bind({});
|
|
25
|
-
exports.MenuProductImageDefault = MenuProductImageDefault;
|
|
26
|
-
MenuProductImageDefault.args = {
|
|
27
|
-
ProductImg: _menuProductImage.default
|
|
28
|
-
};
|