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
@@ -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,130 @@
1
+ import React from "react";
2
+ import { useState, useEffect, useRef } from "react";
3
+ import "./ParallelSelectionList.css";
4
+ //Icons
5
+ import { BsChevronDoubleLeft, BsChevronDoubleRight, BsChevronLeft, BsChevronRight, BsSearch, } from "react-icons/bs";
6
+ //Hooks
7
+ import useResizeObserver from "../../hooks/useResizeObserver";
8
+ const ParallelSelectionList = ({ dataList, applyAction, cancelAction, leftListTitle, rightListTitle, searchBarsVisible, applyButonText, cancelButtonText, preSelectedDatumsIds = [], listElementsHeight = 50, }) => {
9
+ //Refs
10
+ const leftListRef = useRef(null);
11
+ const rightListRef = useRef(null);
12
+ //useState
13
+ const [selectedDatumsIds, setSelectedDatumsIds] = useState(preSelectedDatumsIds);
14
+ const [filteredLeftList, setFilteredLeftList] = useState([]);
15
+ const [filteredRightList, setFilteredRightList] = useState([]);
16
+ const [leftListFirstVisibleElementIndex, setLeftListFirstVisibleElementIndex] = useState(0);
17
+ const [leftListLastVisibleElementIndex, setLeftListLastVisibleElementIndex] = useState(0);
18
+ const [rightListFirstVisibleElementIndex, setRightListFirstVisibleElementIndex] = useState(0);
19
+ const [rightListLastVisibleElementIndex, setRightListLastVisibleElementIndex] = useState(0);
20
+ const [leftListSearchValue, setLeftListSearchValue] = useState("");
21
+ const [rightListSearchValue, setRightListSearchValue] = useState("");
22
+ //hooks
23
+ const [leftListWidth, leftListHeight] = useResizeObserver(leftListRef);
24
+ const [rightListWidth, rightListHeight] = useResizeObserver(rightListRef);
25
+ //Functions
26
+ const addToSelectedDatumsIds = (datumIdsArray) => {
27
+ const selectedDatumsIdsClone = [...selectedDatumsIds];
28
+ datumIdsArray.forEach((datumId) => {
29
+ if (!selectedDatumsIds.includes(datumId)) {
30
+ selectedDatumsIdsClone.push(datumId);
31
+ }
32
+ });
33
+ setSelectedDatumsIds(selectedDatumsIdsClone);
34
+ };
35
+ const removeFromSelectedDatumsIds = (datumIdsArray) => {
36
+ const selectedDatumsIdsClone = [...selectedDatumsIds];
37
+ datumIdsArray.forEach((datumId) => {
38
+ if (selectedDatumsIds.includes(datumId)) {
39
+ selectedDatumsIdsClone.splice(selectedDatumsIdsClone.indexOf(datumId), 1);
40
+ }
41
+ });
42
+ setSelectedDatumsIds(selectedDatumsIdsClone);
43
+ };
44
+ //useEffects
45
+ useEffect(() => {
46
+ let dataListClone = [...dataList];
47
+ dataListClone = dataListClone.filter((datum) => !selectedDatumsIds.includes(datum._id));
48
+ dataListClone = dataListClone.filter((datum) => datum.searchValue.toLowerCase().includes(leftListSearchValue.toLowerCase()));
49
+ setFilteredLeftList(dataListClone);
50
+ }, [leftListSearchValue, dataList, selectedDatumsIds]);
51
+ useEffect(() => {
52
+ let dataListClone = [...dataList];
53
+ dataListClone = dataListClone.filter((datum) => selectedDatumsIds.includes(datum._id));
54
+ dataListClone = dataListClone.filter((datum) => datum.searchValue.toLowerCase().includes(rightListSearchValue.toLowerCase()));
55
+ setFilteredRightList(dataListClone);
56
+ }, [rightListSearchValue, dataList, selectedDatumsIds]);
57
+ useEffect(() => {
58
+ if (leftListRef.current && leftListRef.current.clientHeight !== 0) {
59
+ setLeftListLastVisibleElementIndex(leftListFirstVisibleElementIndex +
60
+ Math.floor(leftListRef.current.clientHeight / listElementsHeight) +
61
+ 2);
62
+ }
63
+ else {
64
+ setLeftListLastVisibleElementIndex(filteredLeftList.length);
65
+ }
66
+ }, [
67
+ leftListHeight,
68
+ leftListWidth,
69
+ leftListFirstVisibleElementIndex,
70
+ listElementsHeight,
71
+ filteredLeftList.length
72
+ ]);
73
+ useEffect(() => {
74
+ if (rightListRef.current && rightListRef.current.clientHeight !== 0) {
75
+ setRightListLastVisibleElementIndex(rightListFirstVisibleElementIndex +
76
+ Math.floor(rightListRef.current.clientHeight / listElementsHeight) +
77
+ 2);
78
+ }
79
+ else {
80
+ setRightListLastVisibleElementIndex(filteredRightList.length);
81
+ }
82
+ }, [
83
+ rightListHeight,
84
+ rightListWidth,
85
+ rightListFirstVisibleElementIndex,
86
+ listElementsHeight,
87
+ filteredRightList.length
88
+ ]);
89
+ return (React.createElement("div", { className: "parallel-selection-list" },
90
+ React.createElement("div", { className: "div-left-list" },
91
+ React.createElement("p", { className: "list-title" }, leftListTitle),
92
+ searchBarsVisible && (React.createElement("div", { className: "div-search-bar" },
93
+ React.createElement(BsSearch, null),
94
+ React.createElement("input", { type: "text", value: leftListSearchValue, onChange: (event) => setLeftListSearchValue(event.target.value) }))),
95
+ React.createElement("div", { className: "list-container" },
96
+ React.createElement("button", { className: "apply-all-button", onClick: () => addToSelectedDatumsIds(filteredLeftList.map((datum) => datum._id)) },
97
+ React.createElement(BsChevronDoubleRight, null)),
98
+ React.createElement("div", { ref: leftListRef, className: "scrollable-section", onScroll: (event) => setLeftListFirstVisibleElementIndex(Math.floor(event.target.scrollTop / listElementsHeight)) },
99
+ React.createElement("div", { className: "resizable-div-for-scroll", style: {
100
+ paddingTop: leftListFirstVisibleElementIndex * listElementsHeight,
101
+ height: filteredLeftList.length * listElementsHeight,
102
+ } }, filteredLeftList
103
+ .slice(leftListFirstVisibleElementIndex, leftListLastVisibleElementIndex)
104
+ .map((datum) => (React.createElement("div", { key: datum._id, className: "div-datum-wrapper", style: { height: listElementsHeight } },
105
+ datum.customComponent ? (React.createElement("div", { className: "div-custom-component-wrapper" }, datum.customComponent)) : (React.createElement("p", { className: "visible-default-name", title: datum.visibleDefaultName }, datum.visibleDefaultName)),
106
+ React.createElement("button", { className: "apply-to-one-button", onClick: () => addToSelectedDatumsIds([datum._id]) },
107
+ React.createElement(BsChevronRight, null))))))))),
108
+ React.createElement("div", { className: "div-right-list" },
109
+ React.createElement("p", { className: "list-title" }, rightListTitle),
110
+ searchBarsVisible && (React.createElement("div", { className: "div-search-bar" },
111
+ React.createElement(BsSearch, null),
112
+ React.createElement("input", { type: "text", value: rightListSearchValue, onChange: (event) => setRightListSearchValue(event.target.value) }))),
113
+ React.createElement("div", { className: "list-container" },
114
+ React.createElement("button", { className: "apply-all-button", onClick: () => removeFromSelectedDatumsIds(filteredRightList.map((datum) => datum._id)) },
115
+ React.createElement(BsChevronDoubleLeft, null)),
116
+ React.createElement("div", { ref: rightListRef, className: "scrollable-section", onScroll: (event) => setRightListFirstVisibleElementIndex(Math.floor(event.target.scrollTop / listElementsHeight)) },
117
+ React.createElement("div", { className: "resizable-div-for-scroll", style: {
118
+ paddingTop: rightListFirstVisibleElementIndex * listElementsHeight,
119
+ height: filteredRightList.length * listElementsHeight,
120
+ } }, filteredRightList
121
+ .slice(rightListFirstVisibleElementIndex, rightListLastVisibleElementIndex)
122
+ .map((datum) => (React.createElement("div", { key: datum._id, className: "div-datum-wrapper", style: { height: listElementsHeight } },
123
+ React.createElement("button", { className: "apply-to-one-button", onClick: () => removeFromSelectedDatumsIds([datum._id]) },
124
+ React.createElement(BsChevronLeft, null)),
125
+ datum.customComponent ? (React.createElement("div", { className: "div-custom-component-wrapper" }, datum.customComponent)) : (React.createElement("p", { className: "visible-default-name", title: datum.visibleDefaultName }, datum.visibleDefaultName))))))))),
126
+ React.createElement("div", { className: "div-action-buttons" },
127
+ React.createElement("button", { className: "cancel-button", onClick: () => cancelAction() }, cancelButtonText ? cancelButtonText : "Cancel"),
128
+ React.createElement("button", { className: "apply-button", onClick: () => applyAction(selectedDatumsIds) }, applyButonText ? applyButonText : "Apply"))));
129
+ };
130
+ export 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;
@@ -1,7 +1,8 @@
1
1
  import React, { useState, useRef } from "react";
2
- import useOutsideClick from "../../hooks/useOutsideClick";
3
2
  import "./PopUp.css";
4
- const PopUp = ({ open = false, children, closeAction, outBoundClickClosesPopUp, aditionalInlineStyle = {}, aditionalClass, }) => {
3
+ //hooks
4
+ import useOutsideClick from "../../hooks/useOutsideClick";
5
+ const PopUp = ({ open = false, children, closeAction, outBoundClickClosesPopUp, aditionalInlineStyle = {}, aditionalClass, activationButtonRef, }) => {
5
6
  //Refs
6
7
  const popUpRef = useRef(null);
7
8
  //Hooks
@@ -11,12 +12,11 @@ const PopUp = ({ open = false, children, closeAction, outBoundClickClosesPopUp,
11
12
  if (closeAction)
12
13
  closeAction();
13
14
  }
14
- });
15
- //Estados
16
- const [openState, setOpenState] = useState(open);
15
+ }, activationButtonRef ? [activationButtonRef] : []);
17
16
  //useState
17
+ const [openState, setOpenState] = useState(open);
18
18
  return (React.createElement("div", { ref: popUpRef, className: "pop-up" +
19
19
  ((closeAction && open) || (!closeAction && openState) ? "" : " pop-up-hidden") +
20
- (aditionalClass ? " " + aditionalClass : ""), style: aditionalInlineStyle }, children));
20
+ (aditionalClass ? " " + aditionalClass : ""), style: open ? aditionalInlineStyle : {} }, children));
21
21
  };
22
22
  export 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;
@@ -0,0 +1,31 @@
1
+ import React, { useEffect, useState, useRef } from "react";
2
+ import "./ProgressBar.css";
3
+ const ProgressBar = ({ totalSize, currentValue, color = "var(--secondary-color)", }) => {
4
+ var _a;
5
+ //useRef
6
+ const fillableBodyRef = useRef(null);
7
+ //useStates
8
+ const [currentPercentage, setCurrentPercentage] = useState(totalSize !== 0 ? currentValue / totalSize : 0);
9
+ const [barWidth, setBarWidth] = useState(0);
10
+ //useEffects
11
+ useEffect(() => {
12
+ if (totalSize !== 0) {
13
+ setCurrentPercentage(currentValue / totalSize);
14
+ }
15
+ else {
16
+ setCurrentPercentage(0);
17
+ }
18
+ }, [totalSize, currentValue]);
19
+ useEffect(() => {
20
+ if (fillableBodyRef.current !== null) {
21
+ setBarWidth(fillableBodyRef.current.clientWidth);
22
+ }
23
+ }, [(_a = fillableBodyRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight]);
24
+ return (React.createElement("div", { className: "progress-bar" },
25
+ React.createElement("div", { ref: fillableBodyRef, className: "fillable-body" },
26
+ React.createElement("div", { className: "filler", style: { width: barWidth * currentPercentage, backgroundColor: color } }),
27
+ React.createElement("p", null,
28
+ (currentPercentage * 100).toFixed(0),
29
+ "%"))));
30
+ };
31
+ export default ProgressBar;
@@ -0,0 +1,7 @@
1
+ import { languageType } from "../../../assets/languages/types";
2
+
3
+ export interface ProgressBarPropsType {
4
+ totalSize: number;
5
+ currentValue: number;
6
+ color?: string,
7
+ }
@@ -0,0 +1,51 @@
1
+ .slider {
2
+ display: flex;
3
+ align-items: center;
4
+ }
5
+
6
+ .slider .left-fill {
7
+ border: 2px solid rgb(216, 216, 216);
8
+ background-color: var(--secondary-color);
9
+ }
10
+
11
+ .slider .right-fill {
12
+ border: 2px solid rgb(216, 216, 216);
13
+ background-color: rgb(211, 211, 211);
14
+ }
15
+
16
+ .slider .sphere {
17
+ border-radius: 100%;
18
+ box-shadow: 0px 0px 20px 2px #a7a7a7;
19
+ background-color: rgb(255, 255, 255);
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: center;
23
+ cursor: grab;
24
+ z-index: 2;
25
+ }
26
+
27
+ .slider .sphere p {
28
+ margin: 0;
29
+ font-size: 12px;
30
+ font-weight: 600;
31
+ color: #757575;
32
+ width: 25%;
33
+ }
34
+
35
+ .slider .sphere input {
36
+ width: 70%;
37
+ border: none;
38
+ background-color: transparent;
39
+ text-align: right;
40
+ font-size: 12px;
41
+ font-weight: 600;
42
+ color: #757575;
43
+ }
44
+
45
+ .slider .sphere input::-webkit-inner-spin-button {
46
+ display: none;
47
+ }
48
+
49
+ .slider .sphere input:focus {
50
+ outline: none;
51
+ }
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import "./Slider.css";
3
+ import { SliderPropsType } from "./types";
4
+ declare const Slider: ({ minimumValue, maximumValue, onChange, initialValue, value, showValueInsideButton, editableValueInsideButton, height, width, sufix, prefix, }: SliderPropsType) => JSX.Element;
5
+ export default Slider;