@sydsoft/base 1.47.0 → 1.48.0
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/README.md +8 -1
- package/dist/esm/_lib/baseFunctions.js +25 -38
- package/dist/esm/_lib/inputMask.js +66 -69
- package/dist/esm/_lib/listFunctions.js +12 -13
- package/dist/esm/_lib/storage/cookies.js +20 -21
- package/dist/esm/_lib/storage/encData.js +18 -20
- package/dist/esm/_lib/storage/localStorage.js +10 -10
- package/dist/esm/_lib/storage/sessionStorage.js +10 -10
- package/dist/esm/_lib/useInterval.js +5 -5
- package/dist/esm/alert/index.js +28 -30
- package/dist/esm/box/Box.js +6 -7
- package/dist/esm/box/BoxContent.js +2 -4
- package/dist/esm/box/BoxFooter.js +6 -4
- package/dist/esm/box/BoxHeader.js +6 -5
- package/dist/esm/countDown/index.js +28 -33
- package/dist/esm/dateTime/index.js +25 -31
- package/dist/esm/form/Button.js +28 -22
- package/dist/esm/form/Checkbox.js +7 -8
- package/dist/esm/form/Dialog.js +47 -34
- package/dist/esm/form/Form.js +3 -5
- package/dist/esm/form/FormOlustur.js +15 -17
- package/dist/esm/form/Input.js +57 -56
- package/dist/esm/form/Label.js +2 -4
- package/dist/esm/form/SearchableInput.js +77 -89
- package/dist/esm/form/UploadBase.js +30 -32
- package/dist/esm/grid/index.js +40 -41
- package/dist/esm/icon/icons.js +1 -1
- package/dist/esm/icon/index.js +16 -8
- package/dist/esm/menu/index.js +14 -16
- package/dist/esm/modal/index.js +14 -16
- package/dist/esm/popover/index.js +100 -100
- package/dist/esm/tooltip/index.js +117 -34
- package/package.json +12 -6
- package/dist/esm/alert/index.module.css +0 -119
- package/dist/esm/grid/index.module.css +0 -805
- package/dist/esm/menu/index.module.css +0 -92
- package/dist/esm/modal/index.module.css +0 -77
- /package/dist/esm/{box/Box.module.css → Box.module.css} +0 -0
- /package/dist/esm/{popover/index.module.css → index.module.css} +0 -0
- /package/dist/esm/{form/styles → styles}/Button.module.css +0 -0
- /package/dist/esm/{form/styles → styles}/Input.module.css +0 -0
- /package/dist/esm/{form/styles → styles}/Label.module.css +0 -0
- /package/dist/esm/{form/styles → styles}/SearchableInput.module.css +0 -0
|
@@ -1,59 +1,56 @@
|
|
|
1
|
-
import { __assign, __rest } from "tslib";
|
|
2
1
|
import React, { memo, useEffect } from "react";
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
useEffect(function () {
|
|
2
|
+
export const Tooltip = memo(function MemoFunction({ children, title, position = "top", arrow = false, distance = 5, ...other }) {
|
|
3
|
+
useEffect(() => {
|
|
6
4
|
if (typeof window === "undefined")
|
|
7
5
|
return null;
|
|
8
|
-
|
|
6
|
+
const cssCheck = document.getElementsByClassName("stooltip_css")[0];
|
|
9
7
|
if (!cssCheck) {
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const head = document.getElementsByTagName('head')[0];
|
|
9
|
+
const s = document.createElement('style');
|
|
12
10
|
s.setAttribute('type', 'text/css');
|
|
13
11
|
s.classList.add("stooltip_css");
|
|
14
12
|
s.appendChild(document.createTextNode(tooltipCss));
|
|
15
13
|
head.appendChild(s);
|
|
16
14
|
}
|
|
17
|
-
return
|
|
15
|
+
return () => tooltipSil();
|
|
18
16
|
}, []);
|
|
19
|
-
|
|
17
|
+
const tooltipEkle = (e) => {
|
|
20
18
|
tooltipSil();
|
|
21
|
-
|
|
19
|
+
const tooltip = document.createElement("div");
|
|
22
20
|
tooltip.innerHTML = title;
|
|
23
21
|
tooltip.classList.add("stooltip");
|
|
24
22
|
document.body.appendChild(tooltip);
|
|
25
23
|
tooltipPosition({ target: e.currentTarget, position: position });
|
|
26
24
|
};
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
const tooltipSil = () => {
|
|
26
|
+
const check = document.body.getElementsByClassName("stooltip")[0];
|
|
29
27
|
if (check)
|
|
30
28
|
check.remove();
|
|
31
29
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var tooltip = document.body.getElementsByClassName("stooltip")[0];
|
|
30
|
+
const tooltipPosition = ({ target, position }) => {
|
|
31
|
+
const tooltip = document.body.getElementsByClassName("stooltip")[0];
|
|
35
32
|
if (tooltip) {
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
const arrowMargin = (arrow) ? 5 : 0;
|
|
34
|
+
const margin = distance + arrowMargin;
|
|
38
35
|
if (arrow)
|
|
39
36
|
tooltip.classList.add("arrow");
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
const targetPosition = target.getBoundingClientRect();
|
|
38
|
+
const tooltipPosition = tooltip.getBoundingClientRect();
|
|
39
|
+
const style = [];
|
|
43
40
|
if (position === "top" || position === "bottom") {
|
|
44
41
|
if (position === "top") {
|
|
45
|
-
if ((targetPosition.top -
|
|
42
|
+
if ((targetPosition.top - tooltipPosition.height - margin) < 0) {
|
|
46
43
|
style.push("top:" + (targetPosition.bottom + margin) + "px");
|
|
47
44
|
tooltip.classList.add("bottom");
|
|
48
45
|
}
|
|
49
46
|
else {
|
|
50
|
-
style.push("top:" + (targetPosition.top -
|
|
47
|
+
style.push("top:" + (targetPosition.top - tooltipPosition.height - margin) + "px");
|
|
51
48
|
tooltip.classList.add("top");
|
|
52
49
|
}
|
|
53
50
|
}
|
|
54
51
|
if (position === "bottom") {
|
|
55
|
-
if ((targetPosition.bottom +
|
|
56
|
-
style.push("top:" + (targetPosition.top -
|
|
52
|
+
if ((targetPosition.bottom + tooltipPosition.height + margin) > window.innerHeight) {
|
|
53
|
+
style.push("top:" + (targetPosition.top - tooltipPosition.height - margin) + "px");
|
|
57
54
|
tooltip.classList.add("top");
|
|
58
55
|
}
|
|
59
56
|
else {
|
|
@@ -62,11 +59,11 @@ export var Tooltip = memo(function MemoFunction(_a) {
|
|
|
62
59
|
}
|
|
63
60
|
}
|
|
64
61
|
// if ((targetPosition.left - tooltipPosition.width) < 0) {
|
|
65
|
-
if ((targetPosition.left + (targetPosition.width / 2) - (
|
|
62
|
+
if ((targetPosition.left + (targetPosition.width / 2) - (tooltipPosition.width / 2)) < 0) {
|
|
66
63
|
style.push("left:2px");
|
|
67
64
|
tooltip.classList.add("start");
|
|
68
65
|
}
|
|
69
|
-
else if ((targetPosition.left + (targetPosition.width / 2) +
|
|
66
|
+
else if ((targetPosition.left + (targetPosition.width / 2) + tooltipPosition.width) > window.innerWidth) {
|
|
70
67
|
style.push("right:2px");
|
|
71
68
|
tooltip.classList.add("end");
|
|
72
69
|
}
|
|
@@ -78,18 +75,18 @@ export var Tooltip = memo(function MemoFunction(_a) {
|
|
|
78
75
|
}
|
|
79
76
|
if (position === "left" || position === "right") {
|
|
80
77
|
if (position === "left") {
|
|
81
|
-
if ((targetPosition.left -
|
|
78
|
+
if ((targetPosition.left - tooltipPosition.width - margin) < 0) {
|
|
82
79
|
style.push("left:" + (targetPosition.right + margin) + "px");
|
|
83
80
|
tooltip.classList.add("right");
|
|
84
81
|
}
|
|
85
82
|
else {
|
|
86
|
-
style.push("left:" + (targetPosition.left -
|
|
83
|
+
style.push("left:" + (targetPosition.left - tooltipPosition.width - margin) + "px");
|
|
87
84
|
tooltip.classList.add("left");
|
|
88
85
|
}
|
|
89
86
|
}
|
|
90
87
|
if (position === "right") {
|
|
91
|
-
if ((targetPosition.left + (targetPosition.width / 2) +
|
|
92
|
-
style.push("left:" + (targetPosition.left -
|
|
88
|
+
if ((targetPosition.left + (targetPosition.width / 2) + tooltipPosition.width + margin) > window.innerWidth) {
|
|
89
|
+
style.push("left:" + (targetPosition.left - tooltipPosition.width - margin) + "px");
|
|
93
90
|
tooltip.classList.add("left");
|
|
94
91
|
}
|
|
95
92
|
else {
|
|
@@ -97,11 +94,11 @@ export var Tooltip = memo(function MemoFunction(_a) {
|
|
|
97
94
|
tooltip.classList.add("right");
|
|
98
95
|
}
|
|
99
96
|
}
|
|
100
|
-
if ((targetPosition.top + (targetPosition.height / 2) - (
|
|
97
|
+
if ((targetPosition.top + (targetPosition.height / 2) - (tooltipPosition.height / 2)) < 0) {
|
|
101
98
|
style.push("top:2px");
|
|
102
99
|
tooltip.classList.add("start");
|
|
103
100
|
}
|
|
104
|
-
else if ((targetPosition.top + (targetPosition.height / 2) + (
|
|
101
|
+
else if ((targetPosition.top + (targetPosition.height / 2) + (tooltipPosition.height / 2)) > window.innerHeight) {
|
|
105
102
|
style.push("bottom:2px");
|
|
106
103
|
tooltip.classList.add("end");
|
|
107
104
|
}
|
|
@@ -114,6 +111,92 @@ export var Tooltip = memo(function MemoFunction(_a) {
|
|
|
114
111
|
tooltip.setAttribute("style", style.join(";"));
|
|
115
112
|
}
|
|
116
113
|
};
|
|
117
|
-
return React.cloneElement(children,
|
|
114
|
+
return React.cloneElement(children, {
|
|
115
|
+
onMouseEnter: tooltipEkle,
|
|
116
|
+
onMouseLeave: tooltipSil,
|
|
117
|
+
onMouseDown: tooltipSil,
|
|
118
|
+
...other
|
|
119
|
+
});
|
|
118
120
|
});
|
|
119
|
-
|
|
121
|
+
const tooltipCss = `
|
|
122
|
+
.stooltip {
|
|
123
|
+
position: fixed;
|
|
124
|
+
display: flex;
|
|
125
|
+
align-items: center;
|
|
126
|
+
justify-content: center;
|
|
127
|
+
background-color: #1a1a1a;
|
|
128
|
+
color: rgba(255,255,255,0.9);
|
|
129
|
+
text-align: center;
|
|
130
|
+
font-size: 0.9rem;
|
|
131
|
+
font-weight:400;
|
|
132
|
+
padding: 5px 10px;
|
|
133
|
+
border-radius: 8px;
|
|
134
|
+
z-index: 1000000;
|
|
135
|
+
opacity: 0.9;
|
|
136
|
+
pointer-events: none;
|
|
137
|
+
/*transition: all 0.1s;*/
|
|
138
|
+
white-space:pre-line;
|
|
139
|
+
max-width: 300px;
|
|
140
|
+
animation: stooltip_fadein 0.7s;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.stooltip.arrow:after {
|
|
144
|
+
content: "";
|
|
145
|
+
position: absolute;
|
|
146
|
+
margin-left: -5px;
|
|
147
|
+
border-width: 5px;
|
|
148
|
+
border-style: solid;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.stooltip.arrow.top:after {
|
|
152
|
+
top: 100%;
|
|
153
|
+
border-color: #1a1a1a transparent transparent transparent;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.stooltip.arrow.top.start:after { left: 15px;}
|
|
157
|
+
|
|
158
|
+
.stooltip.arrow.top.center:after { left: 50%;}
|
|
159
|
+
|
|
160
|
+
.stooltip.arrow.top.end:after { right: 15px;}
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
.stooltip.arrow.bottom:after {
|
|
164
|
+
bottom: 100%;
|
|
165
|
+
border-color: transparent transparent #1a1a1a transparent;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.stooltip.arrow.bottom.start:after { left: 15px;}
|
|
169
|
+
|
|
170
|
+
.stooltip.arrow.bottom.center:after { left: 50%;}
|
|
171
|
+
|
|
172
|
+
.stooltip.bottom.end:after { right: 15px;}
|
|
173
|
+
|
|
174
|
+
.stooltip.arrow.left:after {
|
|
175
|
+
margin-left: -1px;
|
|
176
|
+
left: 100%;
|
|
177
|
+
border-color: transparent transparent transparent #1a1a1a;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.stooltip.arrow.left.start:after { top: 5px;}
|
|
181
|
+
|
|
182
|
+
.stooltip.arrow.left.center:after { top: 50%; margin-top: -5px;}
|
|
183
|
+
|
|
184
|
+
.stooltip.arrow.left.end:after { bottom: 15px;}
|
|
185
|
+
|
|
186
|
+
.stooltip.arrow.right:after {
|
|
187
|
+
margin-right: -1px;
|
|
188
|
+
right: 100%;
|
|
189
|
+
border-color: transparent #1a1a1a transparent transparent;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.stooltip.arrow.right.start:after { top: 5px;}
|
|
193
|
+
|
|
194
|
+
.stooltip.arrow.right.center:after { top: 50%; margin-top: -5px;}
|
|
195
|
+
|
|
196
|
+
.stooltip.arrow.right.end:after { bottom: 15px;}
|
|
197
|
+
|
|
198
|
+
@keyframes stooltip_fadein {
|
|
199
|
+
from { opacity: 0; }
|
|
200
|
+
to { opacity: 0.85; }
|
|
201
|
+
}
|
|
202
|
+
`;
|
package/package.json
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sydsoft/base",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.48.0",
|
|
5
5
|
"description": "",
|
|
6
|
-
"main": "./dist/
|
|
6
|
+
"main": "./dist/esm/index.js",
|
|
7
7
|
"module": "./dist/esm/index.js",
|
|
8
8
|
"types": "./dist/esm/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"./dist/",
|
|
11
11
|
"README.md"
|
|
12
12
|
],
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/esm/index.d.ts",
|
|
16
|
+
"default": "./dist/esm/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
13
19
|
"scripts": {
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"build": "rm -rf ./dist && tsc && npm run copyFiles",
|
|
20
|
+
"clean": "rm -rf ./dist",
|
|
21
|
+
"copyFiles": "copyfiles -u 1 \"**/*.css\" dist/esm",
|
|
22
|
+
"build": "npm run clean && tsc && npm run copyFiles",
|
|
18
23
|
"publishNPM": "npm run build && npm version patch && npm version minor && npm publish --dry-run && npm publish --access public && rm -rf ./dist"
|
|
19
24
|
},
|
|
20
25
|
"publishConfig": {
|
|
@@ -36,6 +41,7 @@
|
|
|
36
41
|
"devDependencies": {
|
|
37
42
|
"@types/react": "^18",
|
|
38
43
|
"@types/react-dom": "^18",
|
|
44
|
+
"copyfiles": "^2.4.1",
|
|
39
45
|
"react": "^18",
|
|
40
46
|
"react-dom": "^18",
|
|
41
47
|
"typescript": "^5"
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
.message {
|
|
2
|
-
flex: 1;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.close {
|
|
6
|
-
position: absolute;
|
|
7
|
-
top: 0;
|
|
8
|
-
left: 0;
|
|
9
|
-
width: 17px;
|
|
10
|
-
height: 17px;
|
|
11
|
-
border-radius: 50%;
|
|
12
|
-
padding: 3px;
|
|
13
|
-
display: flex;
|
|
14
|
-
align-items: center;
|
|
15
|
-
justify-content: center;
|
|
16
|
-
font-size: 9px;
|
|
17
|
-
letter-spacing: 0;
|
|
18
|
-
transform: translate(-50%, -50%) scale(0);
|
|
19
|
-
transition: ease-in-out 0.2s;
|
|
20
|
-
border: 1px #97979740 solid;
|
|
21
|
-
box-shadow: 1px 1px 4px 0 #000000a6;
|
|
22
|
-
cursor: pointer;
|
|
23
|
-
background: inherit;
|
|
24
|
-
}
|
|
25
|
-
.close:hover {
|
|
26
|
-
zoom: 1.1;
|
|
27
|
-
}
|
|
28
|
-
.salert:hover .close {
|
|
29
|
-
transform: translate(-50%, -50%) scale(1);
|
|
30
|
-
}
|
|
31
|
-
.salert {
|
|
32
|
-
position: relative;
|
|
33
|
-
min-width: 50px;
|
|
34
|
-
width: fit-content;
|
|
35
|
-
margin: 6px 0 6px auto;
|
|
36
|
-
padding: 10px 15px;
|
|
37
|
-
border-radius: 5px;
|
|
38
|
-
cursor: default;
|
|
39
|
-
background: #1f1f1f;
|
|
40
|
-
color: rgba(255, 255, 255, 0.93);
|
|
41
|
-
border: 1px #97979740 solid;
|
|
42
|
-
box-shadow: 1px 1px 4px 0 #000000a6;
|
|
43
|
-
display: flex;
|
|
44
|
-
flex-direction: row;
|
|
45
|
-
align-items: center;
|
|
46
|
-
transition: transform 225ms cubic-bezier(0, 0, 0.2, 1) 0ms;
|
|
47
|
-
animation: show 0.3s;
|
|
48
|
-
font-family: inherit;
|
|
49
|
-
font-size: 1rem;
|
|
50
|
-
line-height: 1.5;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.error {
|
|
54
|
-
background: rgb(211, 47, 47);
|
|
55
|
-
background: linear-gradient(
|
|
56
|
-
135deg,
|
|
57
|
-
rgba(211, 47, 47, 1) 0%,
|
|
58
|
-
rgba(211, 47, 47, 0.8) 70%
|
|
59
|
-
);
|
|
60
|
-
color: rgba(255, 255, 255, 0.93);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.success {
|
|
64
|
-
background: rgb(67, 160, 71);
|
|
65
|
-
background: linear-gradient(
|
|
66
|
-
135deg,
|
|
67
|
-
rgba(67, 160, 71, 1) 0%,
|
|
68
|
-
rgba(67, 160, 71, 0.8) 70%
|
|
69
|
-
);
|
|
70
|
-
color: rgba(255, 255, 255, 0.93);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.info {
|
|
74
|
-
background: rgb(13, 141, 189);
|
|
75
|
-
background: linear-gradient(
|
|
76
|
-
135deg,
|
|
77
|
-
rgba(13, 141, 189, 1) 0%,
|
|
78
|
-
rgba(13, 141, 189, 0.8) 70%
|
|
79
|
-
);
|
|
80
|
-
color: rgba(255, 255, 255, 0.93);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.warning {
|
|
84
|
-
background: rgb(217, 142, 4);
|
|
85
|
-
background: linear-gradient(
|
|
86
|
-
135deg,
|
|
87
|
-
rgba(217, 142, 4, 1) 0%,
|
|
88
|
-
rgba(217, 142, 4, 0.8) 70%
|
|
89
|
-
);
|
|
90
|
-
color: rgba(255, 255, 255, 0.93);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.loading {
|
|
94
|
-
background: linear-gradient(
|
|
95
|
-
60deg,
|
|
96
|
-
rgb(15 33 34) 0%,
|
|
97
|
-
rgba(0, 172, 193, 1) 100%
|
|
98
|
-
);
|
|
99
|
-
color: rgba(255, 255, 255, 0.93);
|
|
100
|
-
animation: waves 50s infinite linear;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
@keyframes show {
|
|
104
|
-
from {
|
|
105
|
-
transform: translateX(200%);
|
|
106
|
-
}
|
|
107
|
-
to {
|
|
108
|
-
transform: translateX(0);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
@keyframes waves {
|
|
113
|
-
from {
|
|
114
|
-
background-position: 0;
|
|
115
|
-
}
|
|
116
|
-
to {
|
|
117
|
-
background-position: 100vw 0;
|
|
118
|
-
}
|
|
119
|
-
}
|