contentoh-components-library 21.3.11 → 21.3.13
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 +0 -5
- package/dist/assets/images/generalButton/closeIcon.svg +2 -2
- package/dist/components/atoms/ButtonFileChooser/index.js +25 -33
- package/dist/components/atoms/ImagePreview/index.js +0 -14
- package/dist/components/atoms/ProgressBar/index.js +6 -36
- package/dist/components/atoms/ProgressBar/styles.js +3 -11
- package/dist/components/molecules/ButtonDownloadFile/index.js +2 -2
- package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +22 -21
- package/dist/components/molecules/CustomSelect/SelectItem.js +1 -10
- package/dist/components/molecules/HeaderTop/index.js +6 -23
- package/dist/components/molecules/HeaderTop/styles.js +1 -1
- package/dist/components/molecules/ProductNameHeader/index.js +4 -6
- package/dist/components/organisms/Chat/ContainerItems/index.js +15 -49
- package/dist/components/organisms/Chat/ContentChat/index.js +81 -131
- package/dist/components/organisms/Chat/Footer/index.js +25 -33
- package/dist/components/organisms/FullProductNameHeader/index.js +0 -1
- package/dist/components/pages/Dashboard/index.js +21 -13
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +50 -65
- package/dist/components/pages/ProviderProductEdition/index.js +11 -15
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +86 -60
- package/dist/components/pages/RetailerProductEdition/index.js +12 -13
- package/dist/global-files/fonts.css +0 -6
- package/dist/global-files/handle_http.js +7 -9
- package/dist/global-files/utils.js +3 -9
- package/dist/global-files/variables.js +0 -2
- package/dist/index.js +46 -267
- package/package.json +1 -12
- package/src/assets/images/generalButton/closeIcon.svg +2 -2
- package/src/components/atoms/ProgressBar/index.js +5 -40
- package/src/components/atoms/ProgressBar/styles.js +0 -24
- package/src/components/molecules/CustomSelect/CustomSelect.stories.js +12 -20
- package/src/components/molecules/CustomSelect/SelectItem.js +0 -7
- package/src/components/molecules/HeaderTop/index.js +8 -29
- package/src/components/molecules/HeaderTop/styles.js +0 -4
- package/src/components/molecules/ProductNameHeader/index.js +2 -7
- package/src/components/organisms/FullProductNameHeader/index.js +0 -1
- package/src/components/pages/Dashboard/index.js +37 -31
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +49 -67
- package/src/components/pages/ProviderProductEdition/index.js +7 -16
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +85 -62
- package/src/components/pages/RetailerProductEdition/index.js +10 -12
- package/src/global-files/fonts.css +0 -6
- package/src/global-files/variables.js +0 -2
- package/src/index.js +0 -17
- package/src/assets/images/customSelect/starIcon.svg +0 -14
- package/src/assets/images/defaultImages/Spinner.gif +0 -0
- package/src/assets/images/defaultImages/notFound.svg +0 -124
- package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +0 -47
- package/src/components/atoms/ButtonFileChooser/index.js +0 -69
- package/src/components/atoms/ButtonFileChooser/styles.js +0 -4
- package/src/components/atoms/ButtonV2/ButtonV2.stories.js +0 -53
- package/src/components/atoms/ButtonV2/index.js +0 -85
- package/src/components/atoms/ButtonV2/styles.js +0 -217
- package/src/components/atoms/CustomIcon/CustomIcon.stories.js +0 -36
- package/src/components/atoms/CustomIcon/index.js +0 -41
- package/src/components/atoms/CustomIcon/styles.js +0 -85
- package/src/components/atoms/IconFile/IconFile.stories.js +0 -35
- package/src/components/atoms/IconFile/index.js +0 -119
- package/src/components/atoms/IconFile/styles.js +0 -67
- package/src/components/atoms/Image/Image.stories.js +0 -51
- package/src/components/atoms/Image/index.js +0 -55
- package/src/components/atoms/Image/styles.js +0 -34
- package/src/components/atoms/ImageLink/ImageLink.stories.js +0 -43
- package/src/components/atoms/ImageLink/index.js +0 -57
- package/src/components/atoms/ImageLink/styles.js +0 -30
- package/src/components/atoms/ImagePreview/ImagePreview.stories.js +0 -52
- package/src/components/atoms/ImagePreview/index.js +0 -191
- package/src/components/atoms/ImagePreview/styles.js +0 -77
- package/src/components/atoms/InputText/InputText.stories.js +0 -39
- package/src/components/atoms/InputText/index.js +0 -61
- package/src/components/atoms/InputText/styles.js +0 -89
- package/src/components/atoms/NotFound/NotFound.stories.js +0 -19
- package/src/components/atoms/NotFound/index.js +0 -52
- package/src/components/atoms/NotFound/styles.js +0 -55
- package/src/components/atoms/SelectItemV2/SelectItemV2.stories.js +0 -26
- package/src/components/atoms/SelectItemV2/index.js +0 -61
- package/src/components/atoms/SelectItemV2/styles.js +0 -90
- package/src/components/atoms/Tooltip/Tooltip.stories.js +0 -51
- package/src/components/atoms/Tooltip/index.js +0 -59
- package/src/components/atoms/Tooltip/styles.js +0 -42
- package/src/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +0 -54
- package/src/components/molecules/ButtonDownloadFile/index.js +0 -111
- package/src/components/molecules/ButtonDownloadFile/styles.js +0 -66
- package/src/components/molecules/Dropdown/Dropdown.stories.js +0 -103
- package/src/components/molecules/Dropdown/index.js +0 -150
- package/src/components/molecules/Dropdown/styles.js +0 -75
- package/src/components/molecules/ImageTooltip/ImageTooltip.stories.js +0 -68
- package/src/components/molecules/ImageTooltip/index.js +0 -63
- package/src/components/molecules/ImageTooltip/styles.js +0 -18
- package/src/components/molecules/SelectV2/SelectV2.stories.js +0 -115
- package/src/components/molecules/SelectV2/index.js +0 -357
- package/src/components/molecules/SelectV2/styles.js +0 -105
- package/src/components/molecules/SelectV2/test.js +0 -61
- package/src/components/molecules/SelectV2/test.stories.js +0 -10
- package/src/components/organisms/Chat/Chat.stories.js +0 -147
- package/src/components/organisms/Chat/ChatLists/ChatLists.stories.js +0 -65
- package/src/components/organisms/Chat/ChatLists/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chat/ChatLists/THD.png +0 -0
- package/src/components/organisms/Chat/ChatLists/index.js +0 -141
- package/src/components/organisms/Chat/ChatLists/styles.js +0 -162
- package/src/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +0 -142
- package/src/components/organisms/Chat/ContainerItems/index.js +0 -550
- package/src/components/organisms/Chat/ContainerItems/styles.js +0 -328
- package/src/components/organisms/Chat/ContentChat/ContentChat.stories.js +0 -102
- package/src/components/organisms/Chat/ContentChat/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chat/ContentChat/THD.png +0 -0
- package/src/components/organisms/Chat/ContentChat/index.js +0 -947
- package/src/components/organisms/Chat/ContentChat/styles.js +0 -41
- package/src/components/organisms/Chat/Footer/Footer.stories.js +0 -22
- package/src/components/organisms/Chat/Footer/index.js +0 -669
- package/src/components/organisms/Chat/Footer/styles.js +0 -286
- package/src/components/organisms/Chat/Header/Header.stories.js +0 -66
- package/src/components/organisms/Chat/Header/index.js +0 -94
- package/src/components/organisms/Chat/Header/styles.js +0 -49
- package/src/components/organisms/Chat/index.js +0 -235
- package/src/components/organisms/Chat/styles.js +0 -42
- package/src/components/organisms/Modal/Modal.stories.js +0 -55
- package/src/components/organisms/Modal/index.js +0 -97
- package/src/components/organisms/Modal/styles.js +0 -103
- package/src/components/organisms/RangeCalendar/RangeCalendar.stories.js +0 -16
- package/src/components/organisms/RangeCalendar/index.js +0 -121
- package/src/components/organisms/RangeCalendar/styles.js +0 -883
- package/src/global-files/handle_http.js +0 -231
- package/src/global-files/handle_userTech.js +0 -7
- package/src/global-files/utils.js +0 -322
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { SelectV2 } from "./index";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "Components/molecules/SelectV2",
|
|
5
|
-
component: SelectV2,
|
|
6
|
-
argTypes: {
|
|
7
|
-
positionDropdown: {
|
|
8
|
-
options: [
|
|
9
|
-
undefined,
|
|
10
|
-
"topStart",
|
|
11
|
-
"topEnd",
|
|
12
|
-
"topCenter",
|
|
13
|
-
"rightStart",
|
|
14
|
-
"rightEnd",
|
|
15
|
-
"rightCenter",
|
|
16
|
-
"bottomStart",
|
|
17
|
-
"bottomEnd",
|
|
18
|
-
"bottomCenter",
|
|
19
|
-
"leftStart",
|
|
20
|
-
"leftEnd",
|
|
21
|
-
"leftCenter",
|
|
22
|
-
],
|
|
23
|
-
control: { type: "select" },
|
|
24
|
-
},
|
|
25
|
-
triggerType: {
|
|
26
|
-
options: [undefined, "hover", "click"],
|
|
27
|
-
control: { type: "select" },
|
|
28
|
-
},
|
|
29
|
-
typeSelectItems: {
|
|
30
|
-
options: [undefined, "checkbox", "marginCheckbox", "labelOnly"],
|
|
31
|
-
control: { type: "select" },
|
|
32
|
-
},
|
|
33
|
-
borderType: {
|
|
34
|
-
options: [undefined, "rectangle", "oval"],
|
|
35
|
-
control: { type: "select" },
|
|
36
|
-
},
|
|
37
|
-
alignmentItemsOverflow: {
|
|
38
|
-
options: [undefined, "columns", "rows"],
|
|
39
|
-
control: { type: "select" },
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const Template = (args) => <SelectV2 {...args} />;
|
|
45
|
-
|
|
46
|
-
export const SelectV2Test = Template.bind({});
|
|
47
|
-
SelectV2Test.args = {
|
|
48
|
-
items: [
|
|
49
|
-
{
|
|
50
|
-
label: "Palomitas de maiz",
|
|
51
|
-
value: 1,
|
|
52
|
-
selected: false,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
label: "Sabritas",
|
|
56
|
-
value: 2,
|
|
57
|
-
selected: true,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
label: "sabritas Doritos",
|
|
61
|
-
value: 3,
|
|
62
|
-
selected: false,
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
label:
|
|
66
|
-
"Este es un texto muy largo que deberia llegar al limite establecido para el width",
|
|
67
|
-
value: 4,
|
|
68
|
-
selected: true,
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
label: "galletas",
|
|
72
|
-
value: 5,
|
|
73
|
-
selected: false,
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
label: "jugo de uva",
|
|
77
|
-
value: 6,
|
|
78
|
-
selected: false,
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
triggerType: "hover",
|
|
82
|
-
selectButton: {
|
|
83
|
-
className: "btnSelectPrueba",
|
|
84
|
-
type: "whiteS3",
|
|
85
|
-
transparent: undefined,
|
|
86
|
-
disabled: false,
|
|
87
|
-
label: "select de prueba",
|
|
88
|
-
size: 12,
|
|
89
|
-
borderType: "oval",
|
|
90
|
-
iconPosition: "left",
|
|
91
|
-
},
|
|
92
|
-
defaultItem: {
|
|
93
|
-
label: "Ningun filtro",
|
|
94
|
-
itemType: undefined,
|
|
95
|
-
showLabelInSelect: true,
|
|
96
|
-
},
|
|
97
|
-
inputSearch: {
|
|
98
|
-
className: "inputBusqueda",
|
|
99
|
-
defaultText: "hola",
|
|
100
|
-
},
|
|
101
|
-
typeSelectItems: undefined,
|
|
102
|
-
borderType: undefined,
|
|
103
|
-
maxWidthSelect: "150px",
|
|
104
|
-
maxWidthDropdown: "300px",
|
|
105
|
-
maxHeightDropdown: "300px",
|
|
106
|
-
maxWidthItems: "100px",
|
|
107
|
-
alignmentItemsOverflow: undefined,
|
|
108
|
-
multiple: true,
|
|
109
|
-
classNameSelect: "selectPrueba",
|
|
110
|
-
classNameDropdown: "dropdownSelectPrueba",
|
|
111
|
-
positionDropdown: undefined,
|
|
112
|
-
onChange: (selectedItems) => {
|
|
113
|
-
console.log("selectedItems:", selectedItems);
|
|
114
|
-
},
|
|
115
|
-
};
|
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from "react";
|
|
2
|
-
import {
|
|
3
|
-
ClickAwayListener,
|
|
4
|
-
Fade,
|
|
5
|
-
Grow,
|
|
6
|
-
Popper,
|
|
7
|
-
Tooltip as TooltipMUI,
|
|
8
|
-
Zoom,
|
|
9
|
-
} from "@mui/material";
|
|
10
|
-
import { Container, ContainerSelect } from "./styles";
|
|
11
|
-
import React from "react";
|
|
12
|
-
import { ButtonV2 } from "../../atoms/ButtonV2";
|
|
13
|
-
import {
|
|
14
|
-
faCaretDown as IconDownArrow,
|
|
15
|
-
faSearch as IconSearch,
|
|
16
|
-
} from "@fortawesome/free-solid-svg-icons";
|
|
17
|
-
import {
|
|
18
|
-
isArrayEmpty,
|
|
19
|
-
isObject,
|
|
20
|
-
isStringEmpty,
|
|
21
|
-
} from "../../../global-files/utils";
|
|
22
|
-
import { SelectItemV2 } from "../../atoms/SelectItemV2";
|
|
23
|
-
import { InputText } from "../../atoms/InputText";
|
|
24
|
-
|
|
25
|
-
export const SelectV2 = (props) => {
|
|
26
|
-
const {
|
|
27
|
-
items /* [
|
|
28
|
-
{
|
|
29
|
-
label: string,
|
|
30
|
-
value: string | number,
|
|
31
|
-
} ,
|
|
32
|
-
...
|
|
33
|
-
] */,
|
|
34
|
-
initialSelectedItems, // { value: null , ... } -> value = string | number
|
|
35
|
-
triggerType, // (string) "hover" | "click"
|
|
36
|
-
selectButton /* {
|
|
37
|
-
className: string,
|
|
38
|
-
type: (string) tipos validos de ButtonV2,
|
|
39
|
-
transparent: boolean,
|
|
40
|
-
disabled: boolean,
|
|
41
|
-
label: string ,
|
|
42
|
-
size: number ,
|
|
43
|
-
iconPosition: string (por default "right")
|
|
44
|
-
} */,
|
|
45
|
-
defaultItem /* {
|
|
46
|
-
label: string,
|
|
47
|
-
itemType: (string) "checkbox" | "marginCheckbox" | "labelOnly"
|
|
48
|
-
showLabelInSelect: boolean, cuando esta seleccionado ver label en el btnSelect??
|
|
49
|
-
} */,
|
|
50
|
-
inputSearch /* {
|
|
51
|
-
className: string,
|
|
52
|
-
defaultText: string ,
|
|
53
|
-
} */,
|
|
54
|
-
maxWidthSelect, // string
|
|
55
|
-
maxWidthDropdown, // string
|
|
56
|
-
maxHeightDropdown, // string
|
|
57
|
-
maxWidthItems, // string
|
|
58
|
-
alignmentItemsOverflow, // (string) "columns" | "rows" -> por default "rows"
|
|
59
|
-
typeSelectItems, // (string) "checkbox" | "marginCheckbox" | "labelOnly"
|
|
60
|
-
multiple, // (boolean) se permite multiple seleccion??
|
|
61
|
-
borderType, // (string) "rectangle" | "oval" -> por default oval
|
|
62
|
-
classNameSelect, // (string) clase del container select
|
|
63
|
-
classNameDropdown, // (string) clase del contenedor tooltip
|
|
64
|
-
positionDropdown, // (string) posicion del contenedor tooltip (values en object positions)
|
|
65
|
-
onChange, // (selectedItems: {}) = {} obj con los values de los items seleccionados
|
|
66
|
-
} = props;
|
|
67
|
-
const positions = {
|
|
68
|
-
topStart: "top-start",
|
|
69
|
-
topEnd: "top-end",
|
|
70
|
-
topCenter: "top",
|
|
71
|
-
|
|
72
|
-
rightStart: "right-start",
|
|
73
|
-
rightEnd: "right-end",
|
|
74
|
-
rightCenter: "right",
|
|
75
|
-
|
|
76
|
-
bottomStart: "bottom-start",
|
|
77
|
-
bottomEnd: "bottom-end",
|
|
78
|
-
bottomCenter: "bottom",
|
|
79
|
-
|
|
80
|
-
leftStart: "left-start",
|
|
81
|
-
leftEnd: "left-end",
|
|
82
|
-
leftCenter: "left",
|
|
83
|
-
};
|
|
84
|
-
const [selectedItems, setSelectedItems] = useState(); // { .. }
|
|
85
|
-
const [customItems, setCustomItems] = useState([]);
|
|
86
|
-
const [showDropdown, setShowDropdown] = useState(false);
|
|
87
|
-
const [labelSelect, setLabelSelect] = useState("Sin titulo");
|
|
88
|
-
const [textInputSearch, setTextInputSearch] = useState("");
|
|
89
|
-
|
|
90
|
-
const refInputTextSearch = useRef();
|
|
91
|
-
|
|
92
|
-
// cada que cambie la lista de items
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
if (isArrayEmpty(items) || !isObject(initialSelectedItems)) {
|
|
95
|
-
setSelectedItems({});
|
|
96
|
-
renderItems();
|
|
97
|
-
renderLabelSelect();
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
// items iniciales seleccionados
|
|
101
|
-
if (!multiple) {
|
|
102
|
-
const values = Object.keys(initialSelectedItems);
|
|
103
|
-
if (values.length) setSelectedItems({ [values[0]]: null });
|
|
104
|
-
else setSelectedItems({});
|
|
105
|
-
} else {
|
|
106
|
-
setSelectedItems(initialSelectedItems);
|
|
107
|
-
}
|
|
108
|
-
renderItems();
|
|
109
|
-
renderLabelSelect();
|
|
110
|
-
}, [items]);
|
|
111
|
-
|
|
112
|
-
// cada que cambien los items seleccionados
|
|
113
|
-
useEffect(() => {
|
|
114
|
-
if (!isObject(selectedItems)) return;
|
|
115
|
-
renderItems();
|
|
116
|
-
renderLabelSelect();
|
|
117
|
-
}, [selectedItems]);
|
|
118
|
-
|
|
119
|
-
// evento click de cada item de la lista
|
|
120
|
-
const onClickItem = (isSelected, value) => {
|
|
121
|
-
let selectedItemsCopy = { ...selectedItems };
|
|
122
|
-
if (isSelected) {
|
|
123
|
-
multiple
|
|
124
|
-
? (selectedItemsCopy[value] = null)
|
|
125
|
-
: (selectedItemsCopy = { [value]: null });
|
|
126
|
-
} else delete selectedItemsCopy[value];
|
|
127
|
-
setSelectedItems(selectedItemsCopy);
|
|
128
|
-
onChange && onChange(selectedItemsCopy);
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const onClickSearch = () => {
|
|
132
|
-
setTextInputSearch(textInputSearch.trim());
|
|
133
|
-
refInputTextSearch?.current && refInputTextSearch.current.blur();
|
|
134
|
-
renderItems(textInputSearch.trim());
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
const renderLabelSelect = () => {
|
|
138
|
-
if (!isObject(selectedItems)) return;
|
|
139
|
-
const selectedItemsCopy = Object.keys(selectedItems);
|
|
140
|
-
if (selectedItemsCopy.length > 1) {
|
|
141
|
-
setLabelSelect("Personalizado");
|
|
142
|
-
} else if (selectedItemsCopy.length === 1) {
|
|
143
|
-
let labelItem = undefined;
|
|
144
|
-
for (const item of items) {
|
|
145
|
-
if (item.value == selectedItemsCopy[0]) {
|
|
146
|
-
labelItem = item.label;
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
!isStringEmpty(labelItem)
|
|
151
|
-
? setLabelSelect(labelItem)
|
|
152
|
-
: setLabelSelect("Sin titulo");
|
|
153
|
-
} else {
|
|
154
|
-
if (
|
|
155
|
-
!isStringEmpty(defaultItem?.label) &&
|
|
156
|
-
defaultItem?.showLabelInSelect
|
|
157
|
-
) {
|
|
158
|
-
setLabelSelect(defaultItem.label);
|
|
159
|
-
} else if (!isStringEmpty(selectButton?.label)) {
|
|
160
|
-
setLabelSelect(selectButton.label);
|
|
161
|
-
} else {
|
|
162
|
-
setLabelSelect("Sin titulo");
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
const renderItems = (textSearch = "") => {
|
|
168
|
-
if (isArrayEmpty(items)) setCustomItems([]);
|
|
169
|
-
setCustomItems(
|
|
170
|
-
items.map((item, index) => {
|
|
171
|
-
if (
|
|
172
|
-
!isStringEmpty(textSearch) &&
|
|
173
|
-
!item.label
|
|
174
|
-
.trim()
|
|
175
|
-
.toLowerCase()
|
|
176
|
-
.includes(textSearch.trim().toLowerCase())
|
|
177
|
-
) {
|
|
178
|
-
return null;
|
|
179
|
-
}
|
|
180
|
-
return (
|
|
181
|
-
<SelectItemV2
|
|
182
|
-
key={classNameSelect + "_item" + index}
|
|
183
|
-
label={item.label}
|
|
184
|
-
value={item.value}
|
|
185
|
-
checkbox={
|
|
186
|
-
typeSelectItems === "checkbox"
|
|
187
|
-
? true
|
|
188
|
-
: typeSelectItems === "marginCheckbox"
|
|
189
|
-
? false
|
|
190
|
-
: undefined
|
|
191
|
-
}
|
|
192
|
-
selected={
|
|
193
|
-
isObject(selectedItems) && selectedItems[item.value] !== undefined
|
|
194
|
-
? true
|
|
195
|
-
: false
|
|
196
|
-
}
|
|
197
|
-
onClick={onClickItem}
|
|
198
|
-
/>
|
|
199
|
-
);
|
|
200
|
-
})
|
|
201
|
-
);
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
return (
|
|
205
|
-
<ClickAwayListener
|
|
206
|
-
onClickAway={(event) => {
|
|
207
|
-
if (triggerType !== "hover") setShowDropdown(false);
|
|
208
|
-
}}
|
|
209
|
-
>
|
|
210
|
-
<Container
|
|
211
|
-
className={!isStringEmpty(classNameSelect) ? classNameSelect : ""}
|
|
212
|
-
borderType={borderType}
|
|
213
|
-
maxWidthSelect={maxWidthSelect}
|
|
214
|
-
>
|
|
215
|
-
<TooltipMUI
|
|
216
|
-
placement={positions[positionDropdown] ?? positions.bottomCenter}
|
|
217
|
-
open={triggerType !== "hover" ? showDropdown : undefined}
|
|
218
|
-
arrow={false}
|
|
219
|
-
componentsProps={{
|
|
220
|
-
tooltip: {
|
|
221
|
-
className:
|
|
222
|
-
"dropdownSelect" +
|
|
223
|
-
(isStringEmpty(classNameDropdown)
|
|
224
|
-
? ""
|
|
225
|
-
: " " + classNameDropdown),
|
|
226
|
-
},
|
|
227
|
-
popper: { disablePortal: true },
|
|
228
|
-
transition: { timeout: 300 },
|
|
229
|
-
}}
|
|
230
|
-
TransitionComponent={Fade}
|
|
231
|
-
enterDelay={100}
|
|
232
|
-
followCursor={false}
|
|
233
|
-
disableFocusListener
|
|
234
|
-
disableTouchListener
|
|
235
|
-
disableHoverListener={
|
|
236
|
-
triggerType !== "hover" || selectButton?.disabled
|
|
237
|
-
}
|
|
238
|
-
title={
|
|
239
|
-
<>
|
|
240
|
-
{/* input search */}
|
|
241
|
-
{inputSearch && (
|
|
242
|
-
<div
|
|
243
|
-
className={
|
|
244
|
-
"container-inputSearch" +
|
|
245
|
-
(!isStringEmpty(inputSearch?.className)
|
|
246
|
-
? " " + inputSearch.className
|
|
247
|
-
: "")
|
|
248
|
-
}
|
|
249
|
-
>
|
|
250
|
-
<ButtonV2
|
|
251
|
-
className="buttonSearch"
|
|
252
|
-
type={"gray"}
|
|
253
|
-
transparent
|
|
254
|
-
size={14}
|
|
255
|
-
icon={IconSearch}
|
|
256
|
-
onClick={(event) => {
|
|
257
|
-
if (
|
|
258
|
-
isStringEmpty(textInputSearch) &&
|
|
259
|
-
refInputTextSearch?.current
|
|
260
|
-
) {
|
|
261
|
-
setTextInputSearch("");
|
|
262
|
-
refInputTextSearch.current.focus();
|
|
263
|
-
} else {
|
|
264
|
-
onClickSearch();
|
|
265
|
-
}
|
|
266
|
-
}}
|
|
267
|
-
/>
|
|
268
|
-
|
|
269
|
-
<InputText
|
|
270
|
-
className="inputSearch"
|
|
271
|
-
type="black"
|
|
272
|
-
transparent
|
|
273
|
-
size={12}
|
|
274
|
-
placeHolder={
|
|
275
|
-
isStringEmpty(inputSearch?.defaultText)
|
|
276
|
-
? "Texto a buscar"
|
|
277
|
-
: inputSearch.defaultText
|
|
278
|
-
}
|
|
279
|
-
text={textInputSearch}
|
|
280
|
-
onChangeText={(newValue) => setTextInputSearch(newValue)}
|
|
281
|
-
onEnter={(event) => onClickSearch()}
|
|
282
|
-
refInputText={refInputTextSearch}
|
|
283
|
-
/>
|
|
284
|
-
</div>
|
|
285
|
-
)}
|
|
286
|
-
|
|
287
|
-
{/* item por default */}
|
|
288
|
-
{defaultItem && (
|
|
289
|
-
<SelectItemV2
|
|
290
|
-
label={defaultItem.label}
|
|
291
|
-
value={null}
|
|
292
|
-
checkbox={
|
|
293
|
-
defaultItem.itemType === "checkbox"
|
|
294
|
-
? true
|
|
295
|
-
: defaultItem.itemType === "marginCheckbox"
|
|
296
|
-
? false
|
|
297
|
-
: undefined
|
|
298
|
-
}
|
|
299
|
-
selected={
|
|
300
|
-
isObject(selectedItems) && Object.keys(selectedItems).length
|
|
301
|
-
? false
|
|
302
|
-
: true
|
|
303
|
-
}
|
|
304
|
-
onClick={(isSelected, value) => {
|
|
305
|
-
if (
|
|
306
|
-
isObject(selectedItems) &&
|
|
307
|
-
Object.keys(selectedItems).length
|
|
308
|
-
) {
|
|
309
|
-
setSelectedItems({});
|
|
310
|
-
onChange && onChange({});
|
|
311
|
-
}
|
|
312
|
-
}}
|
|
313
|
-
/>
|
|
314
|
-
)}
|
|
315
|
-
|
|
316
|
-
{/* lista de items */}
|
|
317
|
-
<div className="container-items">{customItems}</div>
|
|
318
|
-
</>
|
|
319
|
-
}
|
|
320
|
-
>
|
|
321
|
-
<ContainerSelect
|
|
322
|
-
className={"container-buttonSelect"}
|
|
323
|
-
maxWidthDropdown={maxWidthDropdown}
|
|
324
|
-
maxHeightDropdown={maxHeightDropdown}
|
|
325
|
-
alignmentItemsOverflow={alignmentItemsOverflow}
|
|
326
|
-
maxWidthItems={maxWidthItems}
|
|
327
|
-
>
|
|
328
|
-
<ButtonV2
|
|
329
|
-
className={
|
|
330
|
-
"buttonSelect" +
|
|
331
|
-
(!isStringEmpty(selectButton?.className)
|
|
332
|
-
? " " + selectButton.className
|
|
333
|
-
: "")
|
|
334
|
-
}
|
|
335
|
-
disabled={selectButton?.disabled}
|
|
336
|
-
type={selectButton?.type}
|
|
337
|
-
transparent={selectButton?.transparent}
|
|
338
|
-
label={labelSelect}
|
|
339
|
-
size={selectButton?.size}
|
|
340
|
-
icon={IconDownArrow}
|
|
341
|
-
iconPosition={
|
|
342
|
-
["left", "right", "top", "bottom"].includes(
|
|
343
|
-
selectButton?.iconPosition
|
|
344
|
-
)
|
|
345
|
-
? selectButton.iconPosition
|
|
346
|
-
: "right"
|
|
347
|
-
}
|
|
348
|
-
onClick={(event) => {
|
|
349
|
-
if (triggerType !== "hover") setShowDropdown((prev) => !prev);
|
|
350
|
-
}}
|
|
351
|
-
/>
|
|
352
|
-
</ContainerSelect>
|
|
353
|
-
</TooltipMUI>
|
|
354
|
-
</Container>
|
|
355
|
-
</ClickAwayListener>
|
|
356
|
-
);
|
|
357
|
-
};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { FontFamily } from "../../../global-files/variables";
|
|
2
|
-
import styled from "styled-components";
|
|
3
|
-
|
|
4
|
-
export const Container = styled.div`
|
|
5
|
-
width: fit-content;
|
|
6
|
-
max-width: ${({ maxWidthSelect }) =>
|
|
7
|
-
maxWidthSelect ? maxWidthSelect : "unset"};
|
|
8
|
-
//border: 1px solid red;
|
|
9
|
-
border-radius: ${({ borderType }) => {
|
|
10
|
-
return borderType?.toLowerCase() === "rectangle"
|
|
11
|
-
? "6px"
|
|
12
|
-
: borderType?.toLowerCase() === "oval"
|
|
13
|
-
? "17px"
|
|
14
|
-
: "0px"; // default none
|
|
15
|
-
}};
|
|
16
|
-
`;
|
|
17
|
-
|
|
18
|
-
export const ContainerSelect = styled.div`
|
|
19
|
-
width: 100%;
|
|
20
|
-
border-radius: inherit;
|
|
21
|
-
|
|
22
|
-
.buttonSelect {
|
|
23
|
-
width: 100%;
|
|
24
|
-
border-radius: inherit;
|
|
25
|
-
|
|
26
|
-
.button {
|
|
27
|
-
padding: 10px 16px;
|
|
28
|
-
gap: 10px;
|
|
29
|
-
.icon {
|
|
30
|
-
font-size: 13px;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
+ .MuiTooltip-popper {
|
|
36
|
-
background-color: transparent;
|
|
37
|
-
|
|
38
|
-
.dropdownSelect {
|
|
39
|
-
--background: white;
|
|
40
|
-
box-shadow: 0px 0px 10px 1px gray;
|
|
41
|
-
background-color: var(--background);
|
|
42
|
-
padding: 0px 0px;
|
|
43
|
-
border-radius: 7px;
|
|
44
|
-
display: flex;
|
|
45
|
-
flex-direction: column;
|
|
46
|
-
gap: 0px;
|
|
47
|
-
overflow: hidden;
|
|
48
|
-
max-width: ${({ maxWidthDropdown }) =>
|
|
49
|
-
maxWidthDropdown ? maxWidthDropdown : "400px"};
|
|
50
|
-
max-height: ${({ maxHeightDropdown }) =>
|
|
51
|
-
maxHeightDropdown ? maxHeightDropdown : "80vh"};
|
|
52
|
-
|
|
53
|
-
.container-inputSearch {
|
|
54
|
-
width: 100%;
|
|
55
|
-
display: flex;
|
|
56
|
-
flex-direction: row;
|
|
57
|
-
flex-wrap: nowrap;
|
|
58
|
-
align-items: center;
|
|
59
|
-
gap: 0px;
|
|
60
|
-
padding: 0px 10px 8px 10px;
|
|
61
|
-
border-bottom: 1px solid #f0f0f0;
|
|
62
|
-
|
|
63
|
-
.inputSearch {
|
|
64
|
-
padding-left: 8px;
|
|
65
|
-
flex-grow: 2;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.selectItemV2 {
|
|
70
|
-
width: 100%;
|
|
71
|
-
|
|
72
|
-
.button {
|
|
73
|
-
justify-content: flex-start;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.container-items {
|
|
78
|
-
flex-grow: 2;
|
|
79
|
-
display: flex;
|
|
80
|
-
flex-direction: column;
|
|
81
|
-
flex-wrap: ${({ alignmentItemsOverflow }) =>
|
|
82
|
-
alignmentItemsOverflow === "columns" ? "wrap" : "nowrap"};
|
|
83
|
-
overflow: auto;
|
|
84
|
-
|
|
85
|
-
.selectItemV2 {
|
|
86
|
-
width: ${({ maxWidthItems }) =>
|
|
87
|
-
maxWidthItems ? maxWidthItems : "100%"};
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
&[data-popper-placement*="bottom"] .dropdownSelect {
|
|
93
|
-
margin-top: 10px;
|
|
94
|
-
}
|
|
95
|
-
&[data-popper-placement*="top"] .dropdownSelect {
|
|
96
|
-
margin-bottom: 10px;
|
|
97
|
-
}
|
|
98
|
-
&[data-popper-placement*="left"] .dropdownSelect {
|
|
99
|
-
margin-right: 10px;
|
|
100
|
-
}
|
|
101
|
-
&[data-popper-placement*="right"] .dropdownSelect {
|
|
102
|
-
margin-left: 10px;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
`;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import { SelectV2 } from ".";
|
|
3
|
-
|
|
4
|
-
export const TestSelectV2 = () => {
|
|
5
|
-
const [items, setItems] = useState([
|
|
6
|
-
{ label: "item 1", value: 1 },
|
|
7
|
-
{ label: "item 2", value: 2 },
|
|
8
|
-
{ label: "item 3", value: 3 },
|
|
9
|
-
{ label: "item 4", value: 4 },
|
|
10
|
-
]);
|
|
11
|
-
const [selected, setSelected] = useState({
|
|
12
|
-
2: null,
|
|
13
|
-
4: null,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<>
|
|
18
|
-
<SelectV2
|
|
19
|
-
items={items}
|
|
20
|
-
initialSelectedItems={undefined}
|
|
21
|
-
triggerType={"hover"}
|
|
22
|
-
selectButton={{
|
|
23
|
-
type: "whiteS3",
|
|
24
|
-
transparent: true,
|
|
25
|
-
disabled: false,
|
|
26
|
-
label: "Prueba select",
|
|
27
|
-
size: 12,
|
|
28
|
-
}}
|
|
29
|
-
defaultItem={{
|
|
30
|
-
label: "default opcion",
|
|
31
|
-
itemType: "labelOnly",
|
|
32
|
-
showLabelInSelect: true,
|
|
33
|
-
}}
|
|
34
|
-
inputSearch={{
|
|
35
|
-
defaultText: "Buscar",
|
|
36
|
-
}}
|
|
37
|
-
typeSelectItems={"checkbox"}
|
|
38
|
-
multiple={false}
|
|
39
|
-
borderType={"oval"}
|
|
40
|
-
onChange={(selectedItems) => {
|
|
41
|
-
console.log("onChange:", selectedItems);
|
|
42
|
-
setSelected(selectedItems);
|
|
43
|
-
}}
|
|
44
|
-
/>
|
|
45
|
-
|
|
46
|
-
<button
|
|
47
|
-
onClick={(event) => {
|
|
48
|
-
setItems([
|
|
49
|
-
{ label: "item 1", value: 1 },
|
|
50
|
-
{ label: "item 2", value: 2 },
|
|
51
|
-
{ label: "item 3", value: 3 },
|
|
52
|
-
{ label: "item 4", value: 4 },
|
|
53
|
-
{ label: "item 5", value: 5 },
|
|
54
|
-
]);
|
|
55
|
-
}}
|
|
56
|
-
>
|
|
57
|
-
Refresh lista
|
|
58
|
-
</button>
|
|
59
|
-
</>
|
|
60
|
-
);
|
|
61
|
-
};
|