contentoh-components-library 21.3.30 → 21.3.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/.env.development +3 -0
  2. package/.env.production +2 -3
  3. package/dist/assets/images/generalButton/closeIcon.svg +2 -2
  4. package/dist/components/atoms/ProgressBar/index.js +36 -6
  5. package/dist/components/atoms/ProgressBar/styles.js +11 -3
  6. package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +21 -22
  7. package/dist/components/molecules/CustomSelect/SelectItem.js +10 -1
  8. package/dist/components/molecules/GalleryElement/index.js +1 -1
  9. package/dist/components/molecules/HeaderTop/styles.js +1 -1
  10. package/dist/components/molecules/ProductNameHeader/index.js +6 -4
  11. package/dist/components/molecules/StatusAsignationInfo/index.js +1 -1
  12. package/dist/components/organisms/FullProductNameHeader/index.js +1 -0
  13. package/dist/components/organisms/ProductImageModal/index.js +10 -3
  14. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +214 -30
  15. package/dist/components/pages/ProviderProductEdition/index.js +88 -66
  16. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +73 -41
  17. package/dist/components/pages/RetailerProductEdition/index.js +20 -15
  18. package/dist/components/pages/RetailerProductEdition/utils.js +1 -1
  19. package/dist/global-files/data.js +18 -23
  20. package/dist/global-files/fonts.css +6 -0
  21. package/dist/global-files/variables.js +2 -0
  22. package/dist/index.js +267 -46
  23. package/package.json +13 -1
  24. package/src/assets/images/customSelect/starIcon.svg +14 -0
  25. package/src/assets/images/defaultImages/Spinner.gif +0 -0
  26. package/src/assets/images/defaultImages/notFound.svg +124 -0
  27. package/src/assets/images/generalButton/closeIcon.svg +2 -2
  28. package/src/assets/sounds/newMessage.mp3 +0 -0
  29. package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +47 -0
  30. package/src/components/atoms/ButtonFileChooser/index.js +68 -0
  31. package/src/components/atoms/ButtonFileChooser/styles.js +4 -0
  32. package/src/components/atoms/ButtonV2/ButtonV2.stories.js +53 -0
  33. package/src/components/atoms/ButtonV2/index.js +85 -0
  34. package/src/components/atoms/ButtonV2/styles.js +217 -0
  35. package/src/components/atoms/CustomIcon/CustomIcon.stories.js +36 -0
  36. package/src/components/atoms/CustomIcon/index.js +41 -0
  37. package/src/components/atoms/CustomIcon/styles.js +85 -0
  38. package/src/components/atoms/IconFile/IconFile.stories.js +35 -0
  39. package/src/components/atoms/IconFile/index.js +119 -0
  40. package/src/components/atoms/IconFile/styles.js +67 -0
  41. package/src/components/atoms/Image/Image.stories.js +51 -0
  42. package/src/components/atoms/Image/index.js +55 -0
  43. package/src/components/atoms/Image/styles.js +34 -0
  44. package/src/components/atoms/ImageLink/ImageLink.stories.js +43 -0
  45. package/src/components/atoms/ImageLink/index.js +57 -0
  46. package/src/components/atoms/ImageLink/styles.js +30 -0
  47. package/src/components/atoms/ImagePreview/ImagePreview.stories.js +52 -0
  48. package/src/components/atoms/ImagePreview/index.js +178 -0
  49. package/src/components/atoms/ImagePreview/styles.js +77 -0
  50. package/src/components/atoms/InputText/InputText.stories.js +39 -0
  51. package/src/components/atoms/InputText/index.js +61 -0
  52. package/src/components/atoms/InputText/styles.js +89 -0
  53. package/src/components/atoms/NotFound/NotFound.stories.js +19 -0
  54. package/src/components/atoms/NotFound/index.js +52 -0
  55. package/src/components/atoms/NotFound/styles.js +55 -0
  56. package/src/components/atoms/ProgressBar/index.js +40 -5
  57. package/src/components/atoms/ProgressBar/styles.js +24 -0
  58. package/src/components/atoms/SelectItemV2/SelectItemV2.stories.js +26 -0
  59. package/src/components/atoms/SelectItemV2/index.js +61 -0
  60. package/src/components/atoms/SelectItemV2/styles.js +90 -0
  61. package/src/components/atoms/Tooltip/Tooltip.stories.js +51 -0
  62. package/src/components/atoms/Tooltip/index.js +59 -0
  63. package/src/components/atoms/Tooltip/styles.js +42 -0
  64. package/src/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +54 -0
  65. package/src/components/molecules/ButtonDownloadFile/index.js +109 -0
  66. package/src/components/molecules/ButtonDownloadFile/styles.js +66 -0
  67. package/src/components/molecules/CustomSelect/CustomSelect.stories.js +20 -12
  68. package/src/components/molecules/CustomSelect/SelectItem.js +7 -0
  69. package/src/components/molecules/Dropdown/Dropdown.stories.js +103 -0
  70. package/src/components/molecules/Dropdown/index.js +150 -0
  71. package/src/components/molecules/Dropdown/styles.js +75 -0
  72. package/src/components/molecules/GalleryElement/index.js +1 -1
  73. package/src/components/molecules/HeaderTop/styles.js +5 -2
  74. package/src/components/molecules/ImageTooltip/ImageTooltip.stories.js +68 -0
  75. package/src/components/molecules/ImageTooltip/index.js +63 -0
  76. package/src/components/molecules/ImageTooltip/styles.js +18 -0
  77. package/src/components/molecules/ProductNameHeader/index.js +7 -2
  78. package/src/components/molecules/SelectV2/SelectV2.stories.js +115 -0
  79. package/src/components/molecules/SelectV2/index.js +357 -0
  80. package/src/components/molecules/SelectV2/styles.js +105 -0
  81. package/src/components/molecules/SelectV2/test.js +60 -0
  82. package/src/components/molecules/SelectV2/test.stories.js +10 -0
  83. package/src/components/molecules/StatusAsignationInfo/index.js +11 -9
  84. package/src/components/organisms/Chat/Chat.stories.js +149 -0
  85. package/src/components/organisms/Chat/ChatLists/ChatLists.stories.js +65 -0
  86. package/src/components/organisms/Chat/ChatLists/Rotoplas.jpeg +0 -0
  87. package/src/components/organisms/Chat/ChatLists/THD.png +0 -0
  88. package/src/components/organisms/Chat/ChatLists/index.js +141 -0
  89. package/src/components/organisms/Chat/ChatLists/styles.js +162 -0
  90. package/src/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +142 -0
  91. package/src/components/organisms/Chat/ContainerItems/index.js +522 -0
  92. package/src/components/organisms/Chat/ContainerItems/styles.js +348 -0
  93. package/src/components/organisms/Chat/ContentChat/ContentChat.stories.js +102 -0
  94. package/src/components/organisms/Chat/ContentChat/Rotoplas.jpeg +0 -0
  95. package/src/components/organisms/Chat/ContentChat/THD.png +0 -0
  96. package/src/components/organisms/Chat/ContentChat/index.js +922 -0
  97. package/src/components/organisms/Chat/ContentChat/styles.js +41 -0
  98. package/src/components/organisms/Chat/Footer/Footer.stories.js +22 -0
  99. package/src/components/organisms/Chat/Footer/index.js +661 -0
  100. package/src/components/organisms/Chat/Footer/styles.js +286 -0
  101. package/src/components/organisms/Chat/Header/Header.stories.js +66 -0
  102. package/src/components/organisms/Chat/Header/index.js +93 -0
  103. package/src/components/organisms/Chat/Header/styles.js +49 -0
  104. package/src/components/organisms/Chat/index.js +238 -0
  105. package/src/components/organisms/Chat/styles.js +42 -0
  106. package/src/components/organisms/FullProductNameHeader/index.js +1 -0
  107. package/src/components/organisms/Modal/Modal.stories.js +55 -0
  108. package/src/components/organisms/Modal/index.js +97 -0
  109. package/src/components/organisms/Modal/styles.js +103 -0
  110. package/src/components/organisms/ProductImageModal/index.js +6 -3
  111. package/src/components/organisms/RangeCalendar/RangeCalendar.stories.js +16 -0
  112. package/src/components/organisms/RangeCalendar/index.js +121 -0
  113. package/src/components/organisms/RangeCalendar/styles.js +883 -0
  114. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +239 -32
  115. package/src/components/pages/ProviderProductEdition/index.js +88 -67
  116. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +78 -41
  117. package/src/components/pages/RetailerProductEdition/index.js +19 -21
  118. package/src/components/pages/RetailerProductEdition/utils.js +2 -1
  119. package/src/global-files/data.js +18 -23
  120. package/src/global-files/fonts.css +6 -0
  121. package/src/global-files/handle_http.js +225 -0
  122. package/src/global-files/handle_userTech.js +7 -0
  123. package/src/global-files/utils.js +330 -0
  124. package/src/global-files/variables.js +2 -0
  125. package/src/index.js +17 -0
@@ -0,0 +1,115 @@
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
+ };
@@ -0,0 +1,357 @@
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
+ };
@@ -0,0 +1,105 @@
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
+ `;
@@ -0,0 +1,60 @@
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
+ setSelected(selectedItems);
42
+ }}
43
+ />
44
+
45
+ <button
46
+ onClick={(event) => {
47
+ setItems([
48
+ { label: "item 1", value: 1 },
49
+ { label: "item 2", value: 2 },
50
+ { label: "item 3", value: 3 },
51
+ { label: "item 4", value: 4 },
52
+ { label: "item 5", value: 5 },
53
+ ]);
54
+ }}
55
+ >
56
+ Refresh lista
57
+ </button>
58
+ </>
59
+ );
60
+ };
@@ -0,0 +1,10 @@
1
+ import { TestSelectV2 } from "./test";
2
+
3
+ export default {
4
+ title: "Components/molecules/SelectV2/TestSelectV2",
5
+ component: TestSelectV2,
6
+ };
7
+
8
+ const Template = (args) => <TestSelectV2 {...args} />;
9
+
10
+ export const Test = Template.bind({});
@@ -74,15 +74,17 @@ export const StatusAsignationInfo = ({
74
74
  iconSize={"medium-image"}
75
75
  slidePosition={"bottom-slide"}
76
76
  />
77
- <Button
78
- buttonType={"general circular-button version-button"}
79
- onClick={(e) => {
80
- e.stopPropagation();
81
- e.preventDefault();
82
- setShowVersionSelector(true);
83
- }}
84
- label={`V${version}`}
85
- />
77
+ {version && (
78
+ <Button
79
+ buttonType={"general circular-button version-button"}
80
+ onClick={(e) => {
81
+ e.stopPropagation();
82
+ e.preventDefault();
83
+ setShowVersionSelector(true);
84
+ }}
85
+ label={`V${version}`}
86
+ />
87
+ )}
86
88
  {status !== "-" && <StatusTag statusType={status} ovalForm={true} />}
87
89
  {showSaveButton && (
88
90
  <Button