josenanodev-react-components-library 0.0.16 → 0.0.18

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 (61) hide show
  1. package/dist/cjs/components/Modal/Modal.css +3 -3
  2. package/dist/cjs/components/Modal/Modal.d.ts +1 -1
  3. package/dist/cjs/components/Modal/Modal.js +2 -2
  4. package/dist/cjs/components/Modal/types.d.ts +0 -1
  5. package/dist/cjs/components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar.css +40 -0
  6. package/dist/cjs/components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar.d.ts +5 -0
  7. package/dist/cjs/components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar.js +48 -0
  8. package/dist/cjs/components/MultipleJoinedButtonsBar/types.d.ts +6 -0
  9. package/dist/cjs/components/ParallelSelectionList/ParallelSelectionList.css +229 -0
  10. package/dist/cjs/components/ParallelSelectionList/ParallelSelectionList.d.ts +5 -0
  11. package/dist/cjs/components/ParallelSelectionList/ParallelSelectionList.js +135 -0
  12. package/dist/cjs/components/ParallelSelectionList/types.d.ts +19 -0
  13. package/dist/cjs/components/PopUp/PopUp.css +1 -1
  14. package/dist/cjs/components/PopUp/PopUp.d.ts +2 -2
  15. package/dist/cjs/components/PopUp/PopUp.js +6 -6
  16. package/dist/cjs/components/PopUp/types.d.ts +3 -2
  17. package/dist/cjs/components/ProgressBar/ProgressBar.css +39 -0
  18. package/dist/cjs/components/ProgressBar/ProgressBar.d.ts +5 -0
  19. package/dist/cjs/components/ProgressBar/ProgressBar.js +56 -0
  20. package/dist/cjs/components/ProgressBar/types.d.ts +7 -0
  21. package/dist/cjs/components/Slider/Slider.css +51 -0
  22. package/dist/cjs/components/Slider/Slider.d.ts +5 -0
  23. package/dist/cjs/components/Slider/Slider.js +165 -0
  24. package/dist/cjs/components/Slider/SliderOwnFunctions.d.ts +2 -0
  25. package/dist/cjs/components/Slider/SliderOwnFunctions.js +11 -0
  26. package/dist/cjs/components/Slider/types.d.ts +13 -0
  27. package/dist/cjs/hooks/useOutsideClick.d.ts +1 -1
  28. package/dist/cjs/hooks/useOutsideClick.js +5 -3
  29. package/dist/cjs/index.d.ts +5 -1
  30. package/dist/cjs/index.js +9 -1
  31. package/dist/esm/components/Modal/Modal.css +3 -3
  32. package/dist/esm/components/Modal/Modal.d.ts +1 -1
  33. package/dist/esm/components/Modal/Modal.js +2 -2
  34. package/dist/esm/components/Modal/types.d.ts +0 -1
  35. package/dist/esm/components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar.css +40 -0
  36. package/dist/esm/components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar.d.ts +5 -0
  37. package/dist/esm/components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar.js +23 -0
  38. package/dist/esm/components/MultipleJoinedButtonsBar/types.d.ts +6 -0
  39. package/dist/esm/components/ParallelSelectionList/ParallelSelectionList.css +229 -0
  40. package/dist/esm/components/ParallelSelectionList/ParallelSelectionList.d.ts +5 -0
  41. package/dist/esm/components/ParallelSelectionList/ParallelSelectionList.js +130 -0
  42. package/dist/esm/components/ParallelSelectionList/types.d.ts +19 -0
  43. package/dist/esm/components/PopUp/PopUp.css +1 -1
  44. package/dist/esm/components/PopUp/PopUp.d.ts +2 -2
  45. package/dist/esm/components/PopUp/PopUp.js +6 -6
  46. package/dist/esm/components/PopUp/types.d.ts +3 -2
  47. package/dist/esm/components/ProgressBar/ProgressBar.css +39 -0
  48. package/dist/esm/components/ProgressBar/ProgressBar.d.ts +5 -0
  49. package/dist/esm/components/ProgressBar/ProgressBar.js +31 -0
  50. package/dist/esm/components/ProgressBar/types.d.ts +7 -0
  51. package/dist/esm/components/Slider/Slider.css +51 -0
  52. package/dist/esm/components/Slider/Slider.d.ts +5 -0
  53. package/dist/esm/components/Slider/Slider.js +140 -0
  54. package/dist/esm/components/Slider/SliderOwnFunctions.d.ts +2 -0
  55. package/dist/esm/components/Slider/SliderOwnFunctions.js +6 -0
  56. package/dist/esm/components/Slider/types.d.ts +13 -0
  57. package/dist/esm/hooks/useOutsideClick.d.ts +1 -1
  58. package/dist/esm/hooks/useOutsideClick.js +5 -3
  59. package/dist/esm/index.d.ts +5 -1
  60. package/dist/esm/index.js +5 -1
  61. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- #modal,
2
- #close-modal {
1
+ .modal,
2
+ .close-modal {
3
3
  position: fixed;
4
4
  width: 100vw;
5
5
  height: 100vh;
@@ -14,7 +14,7 @@
14
14
  animation-duration: 500ms;
15
15
  }
16
16
 
17
- #close-modal {
17
+ .close-modal {
18
18
  animation-name: close-modal;
19
19
  animation-duration: 500ms;
20
20
  }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import "./Modal.css";
3
3
  import { ModalPropsType } from "./types";
4
- declare const Modal: ({ children, parentElement, visibility, forced, onOpen, onClose, transitionTime, }: ModalPropsType) => JSX.Element;
4
+ declare const Modal: ({ children, visibility, forced, onOpen, onClose, transitionTime, }: ModalPropsType) => JSX.Element;
5
5
  export default Modal;
@@ -31,7 +31,7 @@ const react_dom_1 = __importDefault(require("react-dom"));
31
31
  require("./Modal.css");
32
32
  //Hooks
33
33
  const useOutsideClick_1 = __importDefault(require("../../hooks/useOutsideClick"));
34
- const Modal = ({ children, parentElement, visibility, forced = false, onOpen, onClose, transitionTime = 500, }) => {
34
+ const Modal = ({ children, visibility, forced = false, onOpen, onClose, transitionTime = 500, }) => {
35
35
  //Refs
36
36
  const modalRef = (0, react_1.useRef)(null);
37
37
  //Estados
@@ -73,7 +73,7 @@ const Modal = ({ children, parentElement, visibility, forced = false, onOpen, on
73
73
  onClose();
74
74
  }, transitionTime - 50);
75
75
  }
76
- } }, children), parentElement);
76
+ } }, children), document.body);
77
77
  }
78
78
  else {
79
79
  return react_1.default.createElement(react_1.default.Fragment, null);
@@ -1,6 +1,5 @@
1
1
  export interface ModalPropsType {
2
2
  children: JSX.Element;
3
- parentElement: HTMLElement;
4
3
  visibility: boolean;
5
4
  forced?: boolean;
6
5
  onOpen?: Function;
@@ -0,0 +1,40 @@
1
+ .multiple-joined-buttons-bar {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ }
6
+
7
+ .multiple-joined-buttons-bar button {
8
+ border: var(--primary-color) solid 2px;
9
+ border-left-width: 1px;
10
+ border-right-width: 1px;
11
+ color: var(--primary-color);
12
+ background-color: rgb(255, 255, 255);
13
+ padding: 5px 15px;
14
+ box-sizing: border-box;
15
+ font-weight: 600;
16
+ font-size: 16px;
17
+ cursor: pointer;
18
+ transition: all 0.3s;
19
+ }
20
+
21
+ .multiple-joined-buttons-bar button:hover {
22
+ background-color: rgb(240, 240, 240);
23
+ }
24
+
25
+ .multiple-joined-buttons-bar button.selected {
26
+ background-color: var(--primary-color);
27
+ color: white;
28
+ }
29
+
30
+ .multiple-joined-buttons-bar button.left-side-button {
31
+ border-left-width: 2px;
32
+ border-top-left-radius: 6px;
33
+ border-bottom-left-radius: 6px;
34
+ }
35
+
36
+ .multiple-joined-buttons-bar button.right-side-button {
37
+ border-right-width: 2px;
38
+ border-top-right-radius: 6px;
39
+ border-bottom-right-radius: 6px;
40
+ }
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import "./MultipleJoinedButtonsBar.css";
3
+ import { MultipleJoinedButtonsBarPropsType } from "./types";
4
+ declare const MultipleJoinedButtonsBar: ({ options, onSelectOption, initialSelectedValue, externalSelectedValue, }: MultipleJoinedButtonsBarPropsType) => JSX.Element;
5
+ export default MultipleJoinedButtonsBar;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const react_1 = __importStar(require("react"));
27
+ require("./MultipleJoinedButtonsBar.css");
28
+ const MultipleJoinedButtonsBar = ({ options, onSelectOption, initialSelectedValue, externalSelectedValue, }) => {
29
+ //States
30
+ const [selectedValue, setSelectedValue] = (0, react_1.useState)(initialSelectedValue);
31
+ //Effects
32
+ (0, react_1.useEffect)(() => {
33
+ if (externalSelectedValue &&
34
+ options.map((option) => option._id).includes(externalSelectedValue)) {
35
+ setSelectedValue(externalSelectedValue);
36
+ }
37
+ }, [externalSelectedValue]);
38
+ return (react_1.default.createElement("div", { className: "multiple-joined-buttons-bar" }, options.map((option, index) => (react_1.default.createElement("button", { key: option._id, className: (selectedValue === option._id ? "selected" : "") +
39
+ (index === 0
40
+ ? " left-side-button"
41
+ : index === options.length - 1
42
+ ? " right-side-button"
43
+ : ""), onClick: () => {
44
+ setSelectedValue(option._id);
45
+ onSelectOption(option._id);
46
+ } }, option.visibleValue)))));
47
+ };
48
+ exports.default = MultipleJoinedButtonsBar;
@@ -0,0 +1,6 @@
1
+ export interface MultipleJoinedButtonsBarPropsType {
2
+ options: { _id: string; visibleValue: string }[];
3
+ onSelectOption: (selectedValue: string) => Function;
4
+ initialSelectedValue?: string;
5
+ externalSelectedValue?: string;
6
+ }
@@ -0,0 +1,229 @@
1
+ .parallel-selection-list {
2
+ display: grid;
3
+ grid-template-areas:
4
+ "lef rig"
5
+ "but but";
6
+ height: 100%;
7
+ grid-template-rows: calc(100% - 80px) 80px;
8
+ grid-template-columns: 50% 50%;
9
+ }
10
+
11
+ .parallel-selection-list .div-left-list {
12
+ grid-area: lef;
13
+ display: flex;
14
+ flex-flow: column;
15
+ align-items: center;
16
+ box-sizing: border-box;
17
+ padding: 10px;
18
+ height: 100%;
19
+ }
20
+
21
+ .parallel-selection-list .div-right-list {
22
+ grid-area: rig;
23
+ display: flex;
24
+ flex-flow: column;
25
+ align-items: center;
26
+ box-sizing: border-box;
27
+ padding: 10px;
28
+ height: 100%;
29
+ }
30
+
31
+ .parallel-selection-list .div-action-buttons {
32
+ grid-area: but;
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: space-between;
36
+ box-sizing: border-box;
37
+ padding: 10px 20px;
38
+ }
39
+
40
+ .parallel-selection-list .list-title {
41
+ font-size: 20px;
42
+ font-weight: 600;
43
+ color: dimgray;
44
+ height: 30px;
45
+ display: flex;
46
+ align-items: center;
47
+ justify-content: center;
48
+ }
49
+
50
+ .parallel-selection-list .div-search-bar {
51
+ width: 100%;
52
+ border: 1px solid rgb(185, 185, 185);
53
+ border-top-left-radius: 6px;
54
+ border-top-right-radius: 6px;
55
+ padding: 6px;
56
+ height: 30px;
57
+ box-sizing: border-box;
58
+ color: dimgray;
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: center;
62
+ }
63
+
64
+ .parallel-selection-list .div-search-bar input {
65
+ border: none;
66
+ padding-left: 10px;
67
+ width: 100%;
68
+ }
69
+
70
+ .parallel-selection-list .div-search-bar input:focus {
71
+ outline: none;
72
+ }
73
+
74
+ .parallel-selection-list .list-container {
75
+ width: 100%;
76
+ display: flex;
77
+ flex-flow: column;
78
+ box-sizing: border-box;
79
+ border: 1px solid rgb(169, 169, 169);
80
+ border-bottom-left-radius: 6px;
81
+ border-bottom-right-radius: 6px;
82
+ border-top: none;
83
+ height: calc(100% - 60px);
84
+ }
85
+
86
+ .parallel-selection-list .list-container .apply-all-button {
87
+ display: flex;
88
+ align-items: center;
89
+ justify-content: center;
90
+ width: 100%;
91
+ height: 30px;
92
+ border: none;
93
+ background-color: transparent;
94
+ color: dimgray;
95
+ font-weight: 700;
96
+ border-bottom: 1px solid rgb(169, 169, 169);
97
+ box-sizing: border-box;
98
+ padding: 5px 0;
99
+ transition: all 0.3s;
100
+ cursor: pointer;
101
+ }
102
+
103
+ .parallel-selection-list .list-container .apply-all-button svg {
104
+ width: 20px;
105
+ height: 20px;
106
+ }
107
+
108
+ .parallel-selection-list .list-container .apply-all-button:hover {
109
+ background-color: rgb(238, 238, 238);
110
+ }
111
+
112
+ .parallel-selection-list .list-container .scrollable-section {
113
+ overflow-y: auto;
114
+ height: calc(100% - 30px);
115
+ }
116
+
117
+ .parallel-selection-list .list-container .scrollable-section .resizable-div-for-scroll {
118
+ width: 100%;
119
+ box-sizing: border-box;
120
+ }
121
+
122
+ .parallel-selection-list
123
+ .list-container
124
+ .scrollable-section
125
+ .resizable-div-for-scroll
126
+ .div-datum-wrapper {
127
+ width: 100%;
128
+ display: flex;
129
+ justify-content: space-between;
130
+ align-items: center;
131
+ border-bottom: 1px solid rgb(169, 169, 169);
132
+ }
133
+
134
+ .parallel-selection-list
135
+ .list-container
136
+ .scrollable-section
137
+ .resizable-div-for-scroll
138
+ .div-datum-wrapper
139
+ .div-custom-component-wrapper {
140
+ position: relative;
141
+ height: 100%;
142
+ width: calc(100% - 50px);
143
+ display: flex;
144
+ align-items: center;
145
+ justify-content: center;
146
+ overflow: hidden;
147
+ }
148
+
149
+ .parallel-selection-list
150
+ .list-container
151
+ .scrollable-section
152
+ .resizable-div-for-scroll
153
+ .div-datum-wrapper
154
+ .visible-default-name {
155
+ box-sizing: border-box;
156
+ padding: 17px 10px;
157
+ font-size: 16px;
158
+ font-weight: 600;
159
+ color: dimgray;
160
+ height: 50px;
161
+ white-space: nowrap;
162
+ text-overflow: ellipsis;
163
+ overflow: hidden;
164
+ width: calc(100% - 50px);
165
+ text-align: start;
166
+ }
167
+
168
+ .parallel-selection-list
169
+ .list-container
170
+ .scrollable-section
171
+ .resizable-div-for-scroll
172
+ .div-datum-wrapper
173
+ .apply-to-one-button {
174
+ height: 30px;
175
+ width: 30px;
176
+ display: flex;
177
+ align-items: center;
178
+ justify-content: center;
179
+ margin: 10px;
180
+ background-color: transparent;
181
+ border: none;
182
+ border-radius: 15px;
183
+ transition: all 0.3s;
184
+ cursor: pointer;
185
+ }
186
+
187
+ .parallel-selection-list
188
+ .list-container
189
+ .scrollable-section
190
+ .resizable-div-for-scroll
191
+ .div-datum-wrapper
192
+ .apply-to-one-button:hover {
193
+ background-color: rgb(238, 238, 238);
194
+ }
195
+
196
+ .parallel-selection-list .div-action-buttons button {
197
+ box-sizing: border-box;
198
+ padding: 10px 15px;
199
+ display: flex;
200
+ align-items: center;
201
+ justify-content: center;
202
+ background-color: transparent;
203
+ border: solid 2px;
204
+ border-radius: 6px;
205
+ font-size: 16px;
206
+ font-weight: 600;
207
+ transition: all 0.3s;
208
+ cursor: pointer;
209
+ }
210
+
211
+ .parallel-selection-list .div-action-buttons .cancel-button {
212
+ border-color: dimgray;
213
+ color: dimgray;
214
+ }
215
+
216
+ .parallel-selection-list .div-action-buttons .cancel-button:hover {
217
+ background-color: dimgray;
218
+ color: white;
219
+ }
220
+
221
+ .parallel-selection-list .div-action-buttons .apply-button {
222
+ border-color: var(--primary-color);
223
+ color: var(--primary-color);
224
+ }
225
+
226
+ .parallel-selection-list .div-action-buttons .apply-button:hover {
227
+ background-color: var(--primary-color);
228
+ color: white;
229
+ }
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import "./ParallelSelectionList.css";
3
+ import { ParallelSelectionListPropsTypes } from "./types";
4
+ declare const ParallelSelectionList: ({ dataList, applyAction, cancelAction, leftListTitle, rightListTitle, searchBarsVisible, applyButonText, cancelButtonText, preSelectedDatumsIds, listElementsHeight, }: ParallelSelectionListPropsTypes) => JSX.Element;
5
+ export default ParallelSelectionList;
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const react_2 = require("react");
8
+ require("./ParallelSelectionList.css");
9
+ //Icons
10
+ const bs_1 = require("react-icons/bs");
11
+ //Hooks
12
+ const useResizeObserver_1 = __importDefault(require("../../hooks/useResizeObserver"));
13
+ const ParallelSelectionList = ({ dataList, applyAction, cancelAction, leftListTitle, rightListTitle, searchBarsVisible, applyButonText, cancelButtonText, preSelectedDatumsIds = [], listElementsHeight = 50, }) => {
14
+ //Refs
15
+ const leftListRef = (0, react_2.useRef)(null);
16
+ const rightListRef = (0, react_2.useRef)(null);
17
+ //useState
18
+ const [selectedDatumsIds, setSelectedDatumsIds] = (0, react_2.useState)(preSelectedDatumsIds);
19
+ const [filteredLeftList, setFilteredLeftList] = (0, react_2.useState)([]);
20
+ const [filteredRightList, setFilteredRightList] = (0, react_2.useState)([]);
21
+ const [leftListFirstVisibleElementIndex, setLeftListFirstVisibleElementIndex] = (0, react_2.useState)(0);
22
+ const [leftListLastVisibleElementIndex, setLeftListLastVisibleElementIndex] = (0, react_2.useState)(0);
23
+ const [rightListFirstVisibleElementIndex, setRightListFirstVisibleElementIndex] = (0, react_2.useState)(0);
24
+ const [rightListLastVisibleElementIndex, setRightListLastVisibleElementIndex] = (0, react_2.useState)(0);
25
+ const [leftListSearchValue, setLeftListSearchValue] = (0, react_2.useState)("");
26
+ const [rightListSearchValue, setRightListSearchValue] = (0, react_2.useState)("");
27
+ //hooks
28
+ const [leftListWidth, leftListHeight] = (0, useResizeObserver_1.default)(leftListRef);
29
+ const [rightListWidth, rightListHeight] = (0, useResizeObserver_1.default)(rightListRef);
30
+ //Functions
31
+ const addToSelectedDatumsIds = (datumIdsArray) => {
32
+ const selectedDatumsIdsClone = [...selectedDatumsIds];
33
+ datumIdsArray.forEach((datumId) => {
34
+ if (!selectedDatumsIds.includes(datumId)) {
35
+ selectedDatumsIdsClone.push(datumId);
36
+ }
37
+ });
38
+ setSelectedDatumsIds(selectedDatumsIdsClone);
39
+ };
40
+ const removeFromSelectedDatumsIds = (datumIdsArray) => {
41
+ const selectedDatumsIdsClone = [...selectedDatumsIds];
42
+ datumIdsArray.forEach((datumId) => {
43
+ if (selectedDatumsIds.includes(datumId)) {
44
+ selectedDatumsIdsClone.splice(selectedDatumsIdsClone.indexOf(datumId), 1);
45
+ }
46
+ });
47
+ setSelectedDatumsIds(selectedDatumsIdsClone);
48
+ };
49
+ //useEffects
50
+ (0, react_2.useEffect)(() => {
51
+ let dataListClone = [...dataList];
52
+ dataListClone = dataListClone.filter((datum) => !selectedDatumsIds.includes(datum._id));
53
+ dataListClone = dataListClone.filter((datum) => datum.searchValue.toLowerCase().includes(leftListSearchValue.toLowerCase()));
54
+ setFilteredLeftList(dataListClone);
55
+ }, [leftListSearchValue, dataList, selectedDatumsIds]);
56
+ (0, react_2.useEffect)(() => {
57
+ let dataListClone = [...dataList];
58
+ dataListClone = dataListClone.filter((datum) => selectedDatumsIds.includes(datum._id));
59
+ dataListClone = dataListClone.filter((datum) => datum.searchValue.toLowerCase().includes(rightListSearchValue.toLowerCase()));
60
+ setFilteredRightList(dataListClone);
61
+ }, [rightListSearchValue, dataList, selectedDatumsIds]);
62
+ (0, react_2.useEffect)(() => {
63
+ if (leftListRef.current && leftListRef.current.clientHeight !== 0) {
64
+ setLeftListLastVisibleElementIndex(leftListFirstVisibleElementIndex +
65
+ Math.floor(leftListRef.current.clientHeight / listElementsHeight) +
66
+ 2);
67
+ }
68
+ else {
69
+ setLeftListLastVisibleElementIndex(filteredLeftList.length);
70
+ }
71
+ }, [
72
+ leftListHeight,
73
+ leftListWidth,
74
+ leftListFirstVisibleElementIndex,
75
+ listElementsHeight,
76
+ filteredLeftList.length
77
+ ]);
78
+ (0, react_2.useEffect)(() => {
79
+ if (rightListRef.current && rightListRef.current.clientHeight !== 0) {
80
+ setRightListLastVisibleElementIndex(rightListFirstVisibleElementIndex +
81
+ Math.floor(rightListRef.current.clientHeight / listElementsHeight) +
82
+ 2);
83
+ }
84
+ else {
85
+ setRightListLastVisibleElementIndex(filteredRightList.length);
86
+ }
87
+ }, [
88
+ rightListHeight,
89
+ rightListWidth,
90
+ rightListFirstVisibleElementIndex,
91
+ listElementsHeight,
92
+ filteredRightList.length
93
+ ]);
94
+ return (react_1.default.createElement("div", { className: "parallel-selection-list" },
95
+ react_1.default.createElement("div", { className: "div-left-list" },
96
+ react_1.default.createElement("p", { className: "list-title" }, leftListTitle),
97
+ searchBarsVisible && (react_1.default.createElement("div", { className: "div-search-bar" },
98
+ react_1.default.createElement(bs_1.BsSearch, null),
99
+ react_1.default.createElement("input", { type: "text", value: leftListSearchValue, onChange: (event) => setLeftListSearchValue(event.target.value) }))),
100
+ react_1.default.createElement("div", { className: "list-container" },
101
+ react_1.default.createElement("button", { className: "apply-all-button", onClick: () => addToSelectedDatumsIds(filteredLeftList.map((datum) => datum._id)) },
102
+ react_1.default.createElement(bs_1.BsChevronDoubleRight, null)),
103
+ react_1.default.createElement("div", { ref: leftListRef, className: "scrollable-section", onScroll: (event) => setLeftListFirstVisibleElementIndex(Math.floor(event.target.scrollTop / listElementsHeight)) },
104
+ react_1.default.createElement("div", { className: "resizable-div-for-scroll", style: {
105
+ paddingTop: leftListFirstVisibleElementIndex * listElementsHeight,
106
+ height: filteredLeftList.length * listElementsHeight,
107
+ } }, filteredLeftList
108
+ .slice(leftListFirstVisibleElementIndex, leftListLastVisibleElementIndex)
109
+ .map((datum) => (react_1.default.createElement("div", { key: datum._id, className: "div-datum-wrapper", style: { height: listElementsHeight } },
110
+ datum.customComponent ? (react_1.default.createElement("div", { className: "div-custom-component-wrapper" }, datum.customComponent)) : (react_1.default.createElement("p", { className: "visible-default-name", title: datum.visibleDefaultName }, datum.visibleDefaultName)),
111
+ react_1.default.createElement("button", { className: "apply-to-one-button", onClick: () => addToSelectedDatumsIds([datum._id]) },
112
+ react_1.default.createElement(bs_1.BsChevronRight, null))))))))),
113
+ react_1.default.createElement("div", { className: "div-right-list" },
114
+ react_1.default.createElement("p", { className: "list-title" }, rightListTitle),
115
+ searchBarsVisible && (react_1.default.createElement("div", { className: "div-search-bar" },
116
+ react_1.default.createElement(bs_1.BsSearch, null),
117
+ react_1.default.createElement("input", { type: "text", value: rightListSearchValue, onChange: (event) => setRightListSearchValue(event.target.value) }))),
118
+ react_1.default.createElement("div", { className: "list-container" },
119
+ react_1.default.createElement("button", { className: "apply-all-button", onClick: () => removeFromSelectedDatumsIds(filteredRightList.map((datum) => datum._id)) },
120
+ react_1.default.createElement(bs_1.BsChevronDoubleLeft, null)),
121
+ react_1.default.createElement("div", { ref: rightListRef, className: "scrollable-section", onScroll: (event) => setRightListFirstVisibleElementIndex(Math.floor(event.target.scrollTop / listElementsHeight)) },
122
+ react_1.default.createElement("div", { className: "resizable-div-for-scroll", style: {
123
+ paddingTop: rightListFirstVisibleElementIndex * listElementsHeight,
124
+ height: filteredRightList.length * listElementsHeight,
125
+ } }, filteredRightList
126
+ .slice(rightListFirstVisibleElementIndex, rightListLastVisibleElementIndex)
127
+ .map((datum) => (react_1.default.createElement("div", { key: datum._id, className: "div-datum-wrapper", style: { height: listElementsHeight } },
128
+ react_1.default.createElement("button", { className: "apply-to-one-button", onClick: () => removeFromSelectedDatumsIds([datum._id]) },
129
+ react_1.default.createElement(bs_1.BsChevronLeft, null)),
130
+ datum.customComponent ? (react_1.default.createElement("div", { className: "div-custom-component-wrapper" }, datum.customComponent)) : (react_1.default.createElement("p", { className: "visible-default-name", title: datum.visibleDefaultName }, datum.visibleDefaultName))))))))),
131
+ react_1.default.createElement("div", { className: "div-action-buttons" },
132
+ react_1.default.createElement("button", { className: "cancel-button", onClick: () => cancelAction() }, cancelButtonText ? cancelButtonText : "Cancel"),
133
+ react_1.default.createElement("button", { className: "apply-button", onClick: () => applyAction(selectedDatumsIds) }, applyButonText ? applyButonText : "Apply"))));
134
+ };
135
+ exports.default = ParallelSelectionList;
@@ -0,0 +1,19 @@
1
+ export interface ParallelSelectionListPropsTypes {
2
+ dataList: ListDatumType[];
3
+ applyAction: (dataListId: ListDatumType["_id"][]) => Fuction;
4
+ cancelAction: Function;
5
+ leftListTitle?: string;
6
+ rightListTitle?: string;
7
+ searchBarsVisible?: boolean;
8
+ applyButonText?: string;
9
+ cancelButtonText?: string;
10
+ preSelectedDatumsIds?: ListDatumType["_id"][];
11
+ listElementsHeight?: number;
12
+ }
13
+
14
+ export type ListDatumType = {
15
+ _id: string;
16
+ searchValue: string;
17
+ visibleDefaultName: string;
18
+ customComponent?: JSX.Element;
19
+ };
@@ -5,7 +5,7 @@
5
5
  border-width: 0px 1px 1px;
6
6
  box-shadow: rgb(0 0 0 / 15%) 0px 14px 36px 2px;
7
7
  padding: 0px;
8
- position: relative;
8
+ position: absolute;
9
9
  overflow: auto;
10
10
  box-sizing: border-box;
11
11
  }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import "./PopUp.css";
3
- import { PopUpProps } from "./types";
4
- declare const PopUp: ({ open, children, closeAction, outBoundClickClosesPopUp, aditionalInlineStyle, aditionalClass, }: PopUpProps) => JSX.Element;
3
+ import { PopUpPropsType } from "./types";
4
+ declare const PopUp: ({ open, children, closeAction, outBoundClickClosesPopUp, aditionalInlineStyle, aditionalClass, activationButtonRef, }: PopUpPropsType) => JSX.Element;
5
5
  export default PopUp;
@@ -27,9 +27,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const react_1 = __importStar(require("react"));
30
- const useOutsideClick_1 = __importDefault(require("../../hooks/useOutsideClick"));
31
30
  require("./PopUp.css");
32
- const PopUp = ({ open = false, children, closeAction, outBoundClickClosesPopUp, aditionalInlineStyle = {}, aditionalClass, }) => {
31
+ //hooks
32
+ const useOutsideClick_1 = __importDefault(require("../../hooks/useOutsideClick"));
33
+ const PopUp = ({ open = false, children, closeAction, outBoundClickClosesPopUp, aditionalInlineStyle = {}, aditionalClass, activationButtonRef, }) => {
33
34
  //Refs
34
35
  const popUpRef = (0, react_1.useRef)(null);
35
36
  //Hooks
@@ -39,12 +40,11 @@ const PopUp = ({ open = false, children, closeAction, outBoundClickClosesPopUp,
39
40
  if (closeAction)
40
41
  closeAction();
41
42
  }
42
- });
43
- //Estados
44
- const [openState, setOpenState] = (0, react_1.useState)(open);
43
+ }, activationButtonRef ? [activationButtonRef] : []);
45
44
  //useState
45
+ const [openState, setOpenState] = (0, react_1.useState)(open);
46
46
  return (react_1.default.createElement("div", { ref: popUpRef, className: "pop-up" +
47
47
  ((closeAction && open) || (!closeAction && openState) ? "" : " pop-up-hidden") +
48
- (aditionalClass ? " " + aditionalClass : ""), style: aditionalInlineStyle }, children));
48
+ (aditionalClass ? " " + aditionalClass : ""), style: open ? aditionalInlineStyle : {} }, children));
49
49
  };
50
50
  exports.default = PopUp;
@@ -1,8 +1,9 @@
1
- export interface PopUpProps {
1
+ export interface PopUpPropsType {
2
2
  children: JSX.Element | JSX.Element[];
3
3
  open: boolean;
4
4
  closeAction?: Function;
5
5
  outBoundClickClosesPopUp?: boolean;
6
6
  aditionalInlineStyle?: React.CSSProperties;
7
- aditionalClass: string;
7
+ aditionalClass?: string;
8
+ activationButtonRef?: React.MutableRefObject<HTMLElement | null>;
8
9
  }
@@ -0,0 +1,39 @@
1
+ .progress-bar {
2
+ height: 40px;
3
+ width: 100%;
4
+ position: relative;
5
+ opacity: 0.9;
6
+ backdrop-filter: blur(10px);
7
+ }
8
+
9
+ .progress-bar .fillable-body {
10
+ position: relative;
11
+ height: 100%;
12
+ width: 100%;
13
+ background-color: dimgray;
14
+ border-radius: 100px;
15
+ display: flex;
16
+ align-items: center;
17
+ justify-content: flex-start;
18
+ overflow: hidden;
19
+ }
20
+
21
+ .progress-bar .fillable-body .filler {
22
+ height: 100%;
23
+ box-sizing: border-box;
24
+ transition: all 0.2s;
25
+ border-radius: 100px;
26
+ }
27
+
28
+ .progress-bar .fillable-body p {
29
+ position: absolute;
30
+ width: 100%;
31
+ height: 100%;
32
+ text-align: center;
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: center;
36
+ font-size: 16px;
37
+ font-weight: 600;
38
+ color: white;
39
+ }
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import "./ProgressBar.css";
3
+ import { ProgressBarPropsType } from "./types";
4
+ declare const ProgressBar: ({ totalSize, currentValue, color, }: ProgressBarPropsType) => JSX.Element;
5
+ export default ProgressBar;