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.
- package/dist/cjs/components/Modal/Modal.css +3 -3
- package/dist/cjs/components/Modal/Modal.d.ts +1 -1
- package/dist/cjs/components/Modal/Modal.js +2 -2
- package/dist/cjs/components/Modal/types.d.ts +0 -1
- package/dist/cjs/components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar.css +40 -0
- package/dist/cjs/components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar.d.ts +5 -0
- package/dist/cjs/components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar.js +48 -0
- package/dist/cjs/components/MultipleJoinedButtonsBar/types.d.ts +6 -0
- package/dist/cjs/components/ParallelSelectionList/ParallelSelectionList.css +229 -0
- package/dist/cjs/components/ParallelSelectionList/ParallelSelectionList.d.ts +5 -0
- package/dist/cjs/components/ParallelSelectionList/ParallelSelectionList.js +135 -0
- package/dist/cjs/components/ParallelSelectionList/types.d.ts +19 -0
- package/dist/cjs/components/PopUp/PopUp.css +1 -1
- package/dist/cjs/components/PopUp/PopUp.d.ts +2 -2
- package/dist/cjs/components/PopUp/PopUp.js +6 -6
- package/dist/cjs/components/PopUp/types.d.ts +3 -2
- package/dist/cjs/components/ProgressBar/ProgressBar.css +39 -0
- package/dist/cjs/components/ProgressBar/ProgressBar.d.ts +5 -0
- package/dist/cjs/components/ProgressBar/ProgressBar.js +56 -0
- package/dist/cjs/components/ProgressBar/types.d.ts +7 -0
- package/dist/cjs/components/Slider/Slider.css +51 -0
- package/dist/cjs/components/Slider/Slider.d.ts +5 -0
- package/dist/cjs/components/Slider/Slider.js +165 -0
- package/dist/cjs/components/Slider/SliderOwnFunctions.d.ts +2 -0
- package/dist/cjs/components/Slider/SliderOwnFunctions.js +11 -0
- package/dist/cjs/components/Slider/types.d.ts +13 -0
- package/dist/cjs/hooks/useOutsideClick.d.ts +1 -1
- package/dist/cjs/hooks/useOutsideClick.js +5 -3
- package/dist/cjs/index.d.ts +5 -1
- package/dist/cjs/index.js +9 -1
- package/dist/esm/components/Modal/Modal.css +3 -3
- package/dist/esm/components/Modal/Modal.d.ts +1 -1
- package/dist/esm/components/Modal/Modal.js +2 -2
- package/dist/esm/components/Modal/types.d.ts +0 -1
- package/dist/esm/components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar.css +40 -0
- package/dist/esm/components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar.d.ts +5 -0
- package/dist/esm/components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar.js +23 -0
- package/dist/esm/components/MultipleJoinedButtonsBar/types.d.ts +6 -0
- package/dist/esm/components/ParallelSelectionList/ParallelSelectionList.css +229 -0
- package/dist/esm/components/ParallelSelectionList/ParallelSelectionList.d.ts +5 -0
- package/dist/esm/components/ParallelSelectionList/ParallelSelectionList.js +130 -0
- package/dist/esm/components/ParallelSelectionList/types.d.ts +19 -0
- package/dist/esm/components/PopUp/PopUp.css +1 -1
- package/dist/esm/components/PopUp/PopUp.d.ts +2 -2
- package/dist/esm/components/PopUp/PopUp.js +6 -6
- package/dist/esm/components/PopUp/types.d.ts +3 -2
- package/dist/esm/components/ProgressBar/ProgressBar.css +39 -0
- package/dist/esm/components/ProgressBar/ProgressBar.d.ts +5 -0
- package/dist/esm/components/ProgressBar/ProgressBar.js +31 -0
- package/dist/esm/components/ProgressBar/types.d.ts +7 -0
- package/dist/esm/components/Slider/Slider.css +51 -0
- package/dist/esm/components/Slider/Slider.d.ts +5 -0
- package/dist/esm/components/Slider/Slider.js +140 -0
- package/dist/esm/components/Slider/SliderOwnFunctions.d.ts +2 -0
- package/dist/esm/components/Slider/SliderOwnFunctions.js +6 -0
- package/dist/esm/components/Slider/types.d.ts +13 -0
- package/dist/esm/hooks/useOutsideClick.d.ts +1 -1
- package/dist/esm/hooks/useOutsideClick.js +5 -3
- package/dist/esm/index.d.ts +5 -1
- package/dist/esm/index.js +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
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("./ProgressBar.css");
|
|
28
|
+
const ProgressBar = ({ totalSize, currentValue, color = "var(--secondary-color)", }) => {
|
|
29
|
+
var _a;
|
|
30
|
+
//useRef
|
|
31
|
+
const fillableBodyRef = (0, react_1.useRef)(null);
|
|
32
|
+
//useStates
|
|
33
|
+
const [currentPercentage, setCurrentPercentage] = (0, react_1.useState)(totalSize !== 0 ? currentValue / totalSize : 0);
|
|
34
|
+
const [barWidth, setBarWidth] = (0, react_1.useState)(0);
|
|
35
|
+
//useEffects
|
|
36
|
+
(0, react_1.useEffect)(() => {
|
|
37
|
+
if (totalSize !== 0) {
|
|
38
|
+
setCurrentPercentage(currentValue / totalSize);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
setCurrentPercentage(0);
|
|
42
|
+
}
|
|
43
|
+
}, [totalSize, currentValue]);
|
|
44
|
+
(0, react_1.useEffect)(() => {
|
|
45
|
+
if (fillableBodyRef.current !== null) {
|
|
46
|
+
setBarWidth(fillableBodyRef.current.clientWidth);
|
|
47
|
+
}
|
|
48
|
+
}, [(_a = fillableBodyRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight]);
|
|
49
|
+
return (react_1.default.createElement("div", { className: "progress-bar" },
|
|
50
|
+
react_1.default.createElement("div", { ref: fillableBodyRef, className: "fillable-body" },
|
|
51
|
+
react_1.default.createElement("div", { className: "filler", style: { width: barWidth * currentPercentage, backgroundColor: color } }),
|
|
52
|
+
react_1.default.createElement("p", null,
|
|
53
|
+
(currentPercentage * 100).toFixed(0),
|
|
54
|
+
"%"))));
|
|
55
|
+
};
|
|
56
|
+
exports.default = ProgressBar;
|
|
@@ -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;
|
|
@@ -0,0 +1,165 @@
|
|
|
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
|
+
const ownFunctions = __importStar(require("./SliderOwnFunctions"));
|
|
28
|
+
require("./Slider.css");
|
|
29
|
+
const Slider = ({ minimumValue, maximumValue, onChange, initialValue = 0, value, showValueInsideButton, editableValueInsideButton, height = 40, width = 300, sufix, prefix, }) => {
|
|
30
|
+
//Refs
|
|
31
|
+
const sliderRef = (0, react_1.useRef)(null);
|
|
32
|
+
//Estados
|
|
33
|
+
const [position, setPosition] = (0, react_1.useState)(initialValue !== undefined
|
|
34
|
+
? ownFunctions.definePostionByValue(initialValue, width, maximumValue, minimumValue)
|
|
35
|
+
: width / 2);
|
|
36
|
+
const [visibleValue, setVisibleValue] = (0, react_1.useState)(initialValue);
|
|
37
|
+
const [temporalVisibleValue, setTemporalVisibleValue] = (0, react_1.useState)(undefined);
|
|
38
|
+
const [cancelTransition, setCancelTransition] = (0, react_1.useState)(false);
|
|
39
|
+
(0, react_1.useEffect)(() => {
|
|
40
|
+
if (value !== undefined) {
|
|
41
|
+
setVisibleValue(value);
|
|
42
|
+
setPosition(ownFunctions.definePostionByValue(value, width, maximumValue, minimumValue));
|
|
43
|
+
}
|
|
44
|
+
}, [value, width, maximumValue, minimumValue]);
|
|
45
|
+
return (react_1.default.createElement("div", { ref: sliderRef, style: { width: width, height: height }, className: "slider", onMouseDown: (event1) => {
|
|
46
|
+
var nuevovisibleValue;
|
|
47
|
+
if (sliderRef.current !== null && sliderRef.current !== undefined) {
|
|
48
|
+
setCancelTransition(false);
|
|
49
|
+
const newPosition = event1.clientX - sliderRef.current.getBoundingClientRect().x;
|
|
50
|
+
setPosition(newPosition);
|
|
51
|
+
nuevovisibleValue = ownFunctions.defineVisibleValue(newPosition, width, maximumValue, minimumValue);
|
|
52
|
+
setVisibleValue(nuevovisibleValue);
|
|
53
|
+
}
|
|
54
|
+
function repositioning(event2) {
|
|
55
|
+
setCancelTransition(true);
|
|
56
|
+
if (sliderRef.current !== null && sliderRef.current !== undefined) {
|
|
57
|
+
setTemporalVisibleValue(undefined);
|
|
58
|
+
let newPosition = event2.clientX - sliderRef.current.getBoundingClientRect().x;
|
|
59
|
+
if (newPosition < 0)
|
|
60
|
+
newPosition = 0;
|
|
61
|
+
if (newPosition > width)
|
|
62
|
+
newPosition = width;
|
|
63
|
+
setPosition(newPosition);
|
|
64
|
+
nuevovisibleValue = ownFunctions.defineVisibleValue(newPosition, width, maximumValue, minimumValue);
|
|
65
|
+
setVisibleValue(nuevovisibleValue);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
document.addEventListener("mousemove", repositioning);
|
|
69
|
+
function removeEventListeners() {
|
|
70
|
+
document.removeEventListener("mousemove", repositioning);
|
|
71
|
+
document.removeEventListener("mouseup", removeEventListeners);
|
|
72
|
+
setCancelTransition(false);
|
|
73
|
+
onChange(nuevovisibleValue);
|
|
74
|
+
}
|
|
75
|
+
document.addEventListener("mouseup", removeEventListeners);
|
|
76
|
+
}, onTouchStart: (event1) => {
|
|
77
|
+
var nuevovisibleValue;
|
|
78
|
+
if (sliderRef.current !== null && sliderRef.current !== undefined) {
|
|
79
|
+
setCancelTransition(false);
|
|
80
|
+
const newPosition = event1.touches[0].clientX - sliderRef.current.getBoundingClientRect().x;
|
|
81
|
+
setPosition(newPosition);
|
|
82
|
+
nuevovisibleValue = ownFunctions.defineVisibleValue(newPosition, width, maximumValue, minimumValue);
|
|
83
|
+
setVisibleValue(nuevovisibleValue);
|
|
84
|
+
}
|
|
85
|
+
function repositioning(event2) {
|
|
86
|
+
setCancelTransition(true);
|
|
87
|
+
if (sliderRef.current !== null && sliderRef.current !== undefined) {
|
|
88
|
+
setTemporalVisibleValue(undefined);
|
|
89
|
+
let newPosition = event2.touches[0].clientX - sliderRef.current.getBoundingClientRect().x;
|
|
90
|
+
if (newPosition < 0)
|
|
91
|
+
newPosition = 0;
|
|
92
|
+
if (newPosition > width)
|
|
93
|
+
newPosition = width;
|
|
94
|
+
setPosition(newPosition);
|
|
95
|
+
nuevovisibleValue = ownFunctions.defineVisibleValue(newPosition, width, maximumValue, minimumValue);
|
|
96
|
+
setVisibleValue(nuevovisibleValue);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
document.addEventListener("touchmove", repositioning);
|
|
100
|
+
function removeEventListeners() {
|
|
101
|
+
document.removeEventListener("touchmove", repositioning);
|
|
102
|
+
document.removeEventListener("touchend", removeEventListeners);
|
|
103
|
+
setCancelTransition(false);
|
|
104
|
+
onChange(nuevovisibleValue);
|
|
105
|
+
}
|
|
106
|
+
document.addEventListener("touchend", removeEventListeners);
|
|
107
|
+
} },
|
|
108
|
+
react_1.default.createElement("div", { style: {
|
|
109
|
+
width: position,
|
|
110
|
+
height: height * 0.8,
|
|
111
|
+
borderTopLeftRadius: (height * 0.8) / 2,
|
|
112
|
+
borderBottomLeftRadius: (height * 0.8) / 2,
|
|
113
|
+
marginRight: -height / 2,
|
|
114
|
+
transition: cancelTransition ? "none" : "all 0.3s",
|
|
115
|
+
}, className: "left-fill" }),
|
|
116
|
+
react_1.default.createElement("div", { style: { width: height, height: height }, className: "sphere" }, showValueInsideButton && (react_1.default.createElement(react_1.Fragment, null,
|
|
117
|
+
prefix !== undefined && react_1.default.createElement("p", null, prefix),
|
|
118
|
+
react_1.default.createElement("input", { disabled: !editableValueInsideButton, type: "number", min: minimumValue, max: maximumValue, value: temporalVisibleValue !== undefined ? temporalVisibleValue : visibleValue, onChange: (event) => {
|
|
119
|
+
setTemporalVisibleValue(Number(event.target.value));
|
|
120
|
+
}, onFocus: () => {
|
|
121
|
+
setTemporalVisibleValue(visibleValue);
|
|
122
|
+
}, onKeyDown: (event) => {
|
|
123
|
+
if (event.key === "Enter" && temporalVisibleValue !== undefined) {
|
|
124
|
+
let nuevovalue = temporalVisibleValue;
|
|
125
|
+
if (nuevovalue < minimumValue)
|
|
126
|
+
nuevovalue = minimumValue;
|
|
127
|
+
if (nuevovalue > maximumValue)
|
|
128
|
+
nuevovalue = maximumValue;
|
|
129
|
+
const newPosition = ownFunctions.definePostionByValue(nuevovalue, width, maximumValue, minimumValue);
|
|
130
|
+
setPosition(newPosition);
|
|
131
|
+
const nuevovisibleValue = ownFunctions.defineVisibleValue(newPosition, width, maximumValue, minimumValue);
|
|
132
|
+
setVisibleValue(nuevovisibleValue);
|
|
133
|
+
onChange(nuevovisibleValue);
|
|
134
|
+
setTemporalVisibleValue(undefined);
|
|
135
|
+
}
|
|
136
|
+
if (event.key === "Escape") {
|
|
137
|
+
setPosition(ownFunctions.definePostionByValue(visibleValue, width, maximumValue, minimumValue));
|
|
138
|
+
setTemporalVisibleValue(undefined);
|
|
139
|
+
}
|
|
140
|
+
}, onBlur: () => {
|
|
141
|
+
if (temporalVisibleValue !== undefined) {
|
|
142
|
+
let nuevovalue = temporalVisibleValue;
|
|
143
|
+
if (nuevovalue < minimumValue)
|
|
144
|
+
nuevovalue = minimumValue;
|
|
145
|
+
if (nuevovalue > maximumValue)
|
|
146
|
+
nuevovalue = maximumValue;
|
|
147
|
+
const newPosition = ownFunctions.definePostionByValue(nuevovalue, width, maximumValue, minimumValue);
|
|
148
|
+
setPosition(newPosition);
|
|
149
|
+
const nuevovisibleValue = ownFunctions.defineVisibleValue(newPosition, width, maximumValue, minimumValue);
|
|
150
|
+
setVisibleValue(nuevovisibleValue);
|
|
151
|
+
onChange(nuevovisibleValue);
|
|
152
|
+
setTemporalVisibleValue(undefined);
|
|
153
|
+
}
|
|
154
|
+
} }),
|
|
155
|
+
sufix !== undefined && react_1.default.createElement("p", null, sufix)))),
|
|
156
|
+
react_1.default.createElement("div", { style: {
|
|
157
|
+
width: width - position,
|
|
158
|
+
height: height * 0.8,
|
|
159
|
+
borderTopRightRadius: (height * 0.8) / 2,
|
|
160
|
+
borderBottomRightRadius: (height * 0.8) / 2,
|
|
161
|
+
marginLeft: -height / 2,
|
|
162
|
+
transition: cancelTransition ? "none" : "all 0.3s",
|
|
163
|
+
}, className: "right-fill" })));
|
|
164
|
+
};
|
|
165
|
+
exports.default = Slider;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.definePostionByValue = exports.defineVisibleValue = void 0;
|
|
4
|
+
function defineVisibleValue(posicion, ancho, valorMaximo, valorMinimo) {
|
|
5
|
+
return Math.round((posicion / (ancho)) * (valorMaximo - valorMinimo) + valorMinimo);
|
|
6
|
+
}
|
|
7
|
+
exports.defineVisibleValue = defineVisibleValue;
|
|
8
|
+
function definePostionByValue(nuevoValor, ancho, valorMaximo, valorMinimo) {
|
|
9
|
+
return ((nuevoValor - valorMinimo) / (valorMaximo - valorMinimo)) * (ancho);
|
|
10
|
+
}
|
|
11
|
+
exports.definePostionByValue = definePostionByValue;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface SliderPropsType {
|
|
2
|
+
minimumValue: number;
|
|
3
|
+
maximumValue: number;
|
|
4
|
+
onChange: (newValue: number) => Function;
|
|
5
|
+
initialValue?: number;
|
|
6
|
+
value?: number;
|
|
7
|
+
showValueInsideButton?: boolean;
|
|
8
|
+
editableValueInsideButton?: boolean;
|
|
9
|
+
height?: number;
|
|
10
|
+
width?: number;
|
|
11
|
+
sufix?: string;
|
|
12
|
+
prefix?: string;
|
|
13
|
+
}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Hook that alerts clicks outside of the passed ref
|
|
4
4
|
*/
|
|
5
|
-
declare function useOutsideClick(elementRef: React.MutableRefObject<HTMLElement | null>, onOutsideClickAction: Function): void;
|
|
5
|
+
declare function useOutsideClick(elementRef: React.MutableRefObject<HTMLElement | null>, onOutsideClickAction: Function, elementsRefsExceptions?: React.MutableRefObject<HTMLElement | null>[]): void;
|
|
6
6
|
export default useOutsideClick;
|
|
@@ -4,13 +4,15 @@ const react_1 = require("react");
|
|
|
4
4
|
/**
|
|
5
5
|
* Hook that alerts clicks outside of the passed ref
|
|
6
6
|
*/
|
|
7
|
-
function useOutsideClick(elementRef, onOutsideClickAction) {
|
|
7
|
+
function useOutsideClick(elementRef, onOutsideClickAction, elementsRefsExceptions = []) {
|
|
8
8
|
(0, react_1.useEffect)(() => {
|
|
9
9
|
/**
|
|
10
10
|
* Alert if clicked on outside of element
|
|
11
11
|
*/
|
|
12
12
|
function handleClickOutside(event) {
|
|
13
|
-
if (elementRef.current &&
|
|
13
|
+
if (elementRef.current &&
|
|
14
|
+
!elementRef.current.contains(event.target) &&
|
|
15
|
+
elementsRefsExceptions.every((elementRefException) => elementRefException.current !== event.target)) {
|
|
14
16
|
onOutsideClickAction();
|
|
15
17
|
}
|
|
16
18
|
}
|
|
@@ -20,6 +22,6 @@ function useOutsideClick(elementRef, onOutsideClickAction) {
|
|
|
20
22
|
// Unbind the event listener on clean up
|
|
21
23
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
22
24
|
};
|
|
23
|
-
}, [elementRef, onOutsideClickAction]);
|
|
25
|
+
}, [elementRef, onOutsideClickAction, elementsRefsExceptions]);
|
|
24
26
|
}
|
|
25
27
|
exports.default = useOutsideClick;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -3,5 +3,9 @@ import SideBar from "./components/SideBar/SideBar";
|
|
|
3
3
|
import SearchBar from "./components/SearchBar/SearchBar";
|
|
4
4
|
import Modal from "./components/Modal/Modal";
|
|
5
5
|
import PopUp from "./components/PopUp/PopUp";
|
|
6
|
+
import ProgressBar from "./components/ProgressBar/ProgressBar";
|
|
7
|
+
import ParallelSelectionList from "./components/ParallelSelectionList/ParallelSelectionList";
|
|
8
|
+
import Slider from "./components/Slider/Slider";
|
|
9
|
+
import MultipleJoinedButtonsBar from "./components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar";
|
|
6
10
|
import { setMulticalendarYScrollPosition } from "./Services/MulticalendarStatesAndSettings";
|
|
7
|
-
export { Multicalendar, setMulticalendarYScrollPosition, SideBar, SearchBar, Modal, PopUp, };
|
|
11
|
+
export { Multicalendar, setMulticalendarYScrollPosition, SideBar, SearchBar, Modal, PopUp, ProgressBar, ParallelSelectionList, Slider, MultipleJoinedButtonsBar, };
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.PopUp = exports.Modal = exports.SearchBar = exports.SideBar = exports.setMulticalendarYScrollPosition = exports.Multicalendar = void 0;
|
|
6
|
+
exports.MultipleJoinedButtonsBar = exports.Slider = exports.ParallelSelectionList = exports.ProgressBar = exports.PopUp = exports.Modal = exports.SearchBar = exports.SideBar = exports.setMulticalendarYScrollPosition = exports.Multicalendar = void 0;
|
|
7
7
|
const Multicalendar_1 = __importDefault(require("./components/Multicalendar/Multicalendar"));
|
|
8
8
|
exports.Multicalendar = Multicalendar_1.default;
|
|
9
9
|
const SideBar_1 = __importDefault(require("./components/SideBar/SideBar"));
|
|
@@ -14,5 +14,13 @@ const Modal_1 = __importDefault(require("./components/Modal/Modal"));
|
|
|
14
14
|
exports.Modal = Modal_1.default;
|
|
15
15
|
const PopUp_1 = __importDefault(require("./components/PopUp/PopUp"));
|
|
16
16
|
exports.PopUp = PopUp_1.default;
|
|
17
|
+
const ProgressBar_1 = __importDefault(require("./components/ProgressBar/ProgressBar"));
|
|
18
|
+
exports.ProgressBar = ProgressBar_1.default;
|
|
19
|
+
const ParallelSelectionList_1 = __importDefault(require("./components/ParallelSelectionList/ParallelSelectionList"));
|
|
20
|
+
exports.ParallelSelectionList = ParallelSelectionList_1.default;
|
|
21
|
+
const Slider_1 = __importDefault(require("./components/Slider/Slider"));
|
|
22
|
+
exports.Slider = Slider_1.default;
|
|
23
|
+
const MultipleJoinedButtonsBar_1 = __importDefault(require("./components/MultipleJoinedButtonsBar/MultipleJoinedButtonsBar"));
|
|
24
|
+
exports.MultipleJoinedButtonsBar = MultipleJoinedButtonsBar_1.default;
|
|
17
25
|
const MulticalendarStatesAndSettings_1 = require("./Services/MulticalendarStatesAndSettings");
|
|
18
26
|
Object.defineProperty(exports, "setMulticalendarYScrollPosition", { enumerable: true, get: function () { return MulticalendarStatesAndSettings_1.setMulticalendarYScrollPosition; } });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
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,
|
|
4
|
+
declare const Modal: ({ children, visibility, forced, onOpen, onClose, transitionTime, }: ModalPropsType) => JSX.Element;
|
|
5
5
|
export default Modal;
|
|
@@ -3,7 +3,7 @@ import ReactDOM from "react-dom";
|
|
|
3
3
|
import "./Modal.css";
|
|
4
4
|
//Hooks
|
|
5
5
|
import useOutsideClick from "../../hooks/useOutsideClick";
|
|
6
|
-
const Modal = ({ children,
|
|
6
|
+
const Modal = ({ children, visibility, forced = false, onOpen, onClose, transitionTime = 500, }) => {
|
|
7
7
|
//Refs
|
|
8
8
|
const modalRef = useRef(null);
|
|
9
9
|
//Estados
|
|
@@ -45,7 +45,7 @@ const Modal = ({ children, parentElement, visibility, forced = false, onOpen, on
|
|
|
45
45
|
onClose();
|
|
46
46
|
}, transitionTime - 50);
|
|
47
47
|
}
|
|
48
|
-
} }, children),
|
|
48
|
+
} }, children), document.body);
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
51
|
return React.createElement(React.Fragment, null);
|
|
@@ -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,23 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import "./MultipleJoinedButtonsBar.css";
|
|
3
|
+
const MultipleJoinedButtonsBar = ({ options, onSelectOption, initialSelectedValue, externalSelectedValue, }) => {
|
|
4
|
+
//States
|
|
5
|
+
const [selectedValue, setSelectedValue] = useState(initialSelectedValue);
|
|
6
|
+
//Effects
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (externalSelectedValue &&
|
|
9
|
+
options.map((option) => option._id).includes(externalSelectedValue)) {
|
|
10
|
+
setSelectedValue(externalSelectedValue);
|
|
11
|
+
}
|
|
12
|
+
}, [externalSelectedValue]);
|
|
13
|
+
return (React.createElement("div", { className: "multiple-joined-buttons-bar" }, options.map((option, index) => (React.createElement("button", { key: option._id, className: (selectedValue === option._id ? "selected" : "") +
|
|
14
|
+
(index === 0
|
|
15
|
+
? " left-side-button"
|
|
16
|
+
: index === options.length - 1
|
|
17
|
+
? " right-side-button"
|
|
18
|
+
: ""), onClick: () => {
|
|
19
|
+
setSelectedValue(option._id);
|
|
20
|
+
onSelectOption(option._id);
|
|
21
|
+
} }, option.visibleValue)))));
|
|
22
|
+
};
|
|
23
|
+
export default MultipleJoinedButtonsBar;
|