@sydsoft/base 1.4.0 → 1.6.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 +9 -0
- package/dist/esm/_lib/baseFunctions.d.ts +5 -0
- package/dist/esm/_lib/baseFunctions.js +38 -0
- package/dist/esm/_lib/inputMask.d.ts +7 -0
- package/dist/esm/_lib/inputMask.js +228 -0
- package/dist/esm/box/Box.d.ts +9 -0
- package/dist/esm/box/Box.js +15 -0
- package/dist/esm/box/Box.module.css +152 -0
- package/dist/esm/box/BoxContent.d.ts +9 -0
- package/dist/esm/box/BoxContent.js +7 -0
- package/dist/esm/box/BoxFooter.d.ts +10 -0
- package/dist/esm/box/BoxFooter.js +8 -0
- package/dist/esm/box/BoxHeader.d.ts +16 -0
- package/dist/esm/box/BoxHeader.js +9 -0
- package/dist/esm/box/index.d.ts +9 -0
- package/dist/esm/box/index.js +9 -0
- package/dist/esm/form/Button.d.ts +27 -0
- package/dist/esm/form/Button.js +76 -0
- package/dist/esm/form/Checkbox.d.ts +23 -0
- package/dist/esm/form/Checkbox.js +23 -0
- package/dist/esm/form/Dialog.d.ts +19 -0
- package/dist/esm/form/Dialog.js +40 -0
- package/dist/esm/form/Form.d.ts +10 -0
- package/dist/esm/form/Form.js +12 -0
- package/dist/esm/form/FormOlustur.d.ts +39 -0
- package/dist/esm/form/FormOlustur.js +51 -0
- package/dist/esm/form/Input.d.ts +62 -0
- package/dist/esm/form/Input.js +207 -0
- package/dist/esm/form/Label.d.ts +7 -0
- package/dist/esm/form/Label.js +12 -0
- package/dist/esm/form/SearchableInput.d.ts +35 -0
- package/dist/esm/form/SearchableInput.js +313 -0
- package/dist/esm/form/UploadBase.d.ts +25 -0
- package/dist/esm/form/UploadBase.js +86 -0
- package/dist/esm/form/index.d.ts +9 -0
- package/dist/esm/form/index.js +9 -0
- package/dist/esm/form/styles/Button.module.css +144 -0
- package/dist/esm/form/styles/Input.module.css +220 -0
- package/dist/esm/form/styles/Label.module.css +31 -0
- package/dist/esm/form/styles/SearchableInput.module.css +79 -0
- package/dist/esm/grid/index.d.ts +37 -0
- package/dist/esm/grid/index.js +63 -0
- package/dist/esm/grid/index.module.css +805 -0
- package/dist/esm/icon/icons.json +22 -0
- package/dist/esm/icon/index.d.ts +27 -3
- package/dist/esm/icon/index.js +18 -37
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/modal/index.d.ts +23 -0
- package/dist/esm/modal/index.js +66 -0
- package/dist/esm/modal/index.module.css +74 -0
- package/dist/esm/popover/index.d.ts +12 -0
- package/dist/esm/popover/index.js +142 -0
- package/dist/esm/tooltip/index.d.ts +11 -0
- package/dist/esm/tooltip/index.js +119 -0
- package/package.json +5 -4
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
|
+
import React, { memo, useEffect } from "react";
|
|
3
|
+
export var Tooltip = memo(function MemoFunction(_a) {
|
|
4
|
+
var children = _a.children, title = _a.title, _b = _a.position, position = _b === void 0 ? "top" : _b, _c = _a.arrow, arrow = _c === void 0 ? false : _c, _d = _a.distance, distance = _d === void 0 ? 5 : _d, other = __rest(_a, ["children", "title", "position", "arrow", "distance"]);
|
|
5
|
+
useEffect(function () {
|
|
6
|
+
if (typeof window === "undefined")
|
|
7
|
+
return null;
|
|
8
|
+
var cssCheck = document.getElementsByClassName("stooltip_css")[0];
|
|
9
|
+
if (!cssCheck) {
|
|
10
|
+
var head = document.getElementsByTagName('head')[0];
|
|
11
|
+
var s = document.createElement('style');
|
|
12
|
+
s.setAttribute('type', 'text/css');
|
|
13
|
+
s.classList.add("stooltip_css");
|
|
14
|
+
s.appendChild(document.createTextNode(tooltipCss));
|
|
15
|
+
head.appendChild(s);
|
|
16
|
+
}
|
|
17
|
+
return function () { return tooltipSil(); };
|
|
18
|
+
}, []);
|
|
19
|
+
var tooltipEkle = function (e) {
|
|
20
|
+
tooltipSil();
|
|
21
|
+
var tooltip = document.createElement("div");
|
|
22
|
+
tooltip.innerHTML = title;
|
|
23
|
+
tooltip.classList.add("stooltip");
|
|
24
|
+
document.body.appendChild(tooltip);
|
|
25
|
+
tooltipPosition({ target: e.currentTarget, position: position });
|
|
26
|
+
};
|
|
27
|
+
var tooltipSil = function () {
|
|
28
|
+
var check = document.body.getElementsByClassName("stooltip")[0];
|
|
29
|
+
if (check)
|
|
30
|
+
check.remove();
|
|
31
|
+
};
|
|
32
|
+
var tooltipPosition = function (_a) {
|
|
33
|
+
var target = _a.target, position = _a.position;
|
|
34
|
+
var tooltip = document.body.getElementsByClassName("stooltip")[0];
|
|
35
|
+
if (tooltip) {
|
|
36
|
+
var arrowMargin = (arrow) ? 5 : 0;
|
|
37
|
+
var margin = distance + arrowMargin;
|
|
38
|
+
if (arrow)
|
|
39
|
+
tooltip.classList.add("arrow");
|
|
40
|
+
var targetPosition = target.getBoundingClientRect();
|
|
41
|
+
var tooltipPosition_1 = tooltip.getBoundingClientRect();
|
|
42
|
+
var style = [];
|
|
43
|
+
if (position === "top" || position === "bottom") {
|
|
44
|
+
if (position === "top") {
|
|
45
|
+
if ((targetPosition.top - tooltipPosition_1.height - margin) < 0) {
|
|
46
|
+
style.push("top:" + (targetPosition.bottom + margin) + "px");
|
|
47
|
+
tooltip.classList.add("bottom");
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
style.push("top:" + (targetPosition.top - tooltipPosition_1.height - margin) + "px");
|
|
51
|
+
tooltip.classList.add("top");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (position === "bottom") {
|
|
55
|
+
if ((targetPosition.bottom + tooltipPosition_1.height + margin) > window.innerHeight) {
|
|
56
|
+
style.push("top:" + (targetPosition.top - tooltipPosition_1.height - margin) + "px");
|
|
57
|
+
tooltip.classList.add("top");
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
style.push("top:" + (targetPosition.bottom + margin) + "px");
|
|
61
|
+
tooltip.classList.add("bottom");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// if ((targetPosition.left - tooltipPosition.width) < 0) {
|
|
65
|
+
if ((targetPosition.left + (targetPosition.width / 2) - (tooltipPosition_1.width / 2)) < 0) {
|
|
66
|
+
style.push("left:2px");
|
|
67
|
+
tooltip.classList.add("start");
|
|
68
|
+
}
|
|
69
|
+
else if ((targetPosition.left + (targetPosition.width / 2) + tooltipPosition_1.width) > window.innerWidth) {
|
|
70
|
+
style.push("right:2px");
|
|
71
|
+
tooltip.classList.add("end");
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
style.push("left:" + (targetPosition.left + (targetPosition.width / 2)) + "px");
|
|
75
|
+
style.push("transform:translate(-50%,0)");
|
|
76
|
+
tooltip.classList.add("center");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (position === "left" || position === "right") {
|
|
80
|
+
if (position === "left") {
|
|
81
|
+
if ((targetPosition.left - tooltipPosition_1.width - margin) < 0) {
|
|
82
|
+
style.push("left:" + (targetPosition.right + margin) + "px");
|
|
83
|
+
tooltip.classList.add("right");
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
style.push("left:" + (targetPosition.left - tooltipPosition_1.width - margin) + "px");
|
|
87
|
+
tooltip.classList.add("left");
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (position === "right") {
|
|
91
|
+
if ((targetPosition.left + (targetPosition.width / 2) + tooltipPosition_1.width + margin) > window.innerWidth) {
|
|
92
|
+
style.push("left:" + (targetPosition.left - tooltipPosition_1.width - margin) + "px");
|
|
93
|
+
tooltip.classList.add("left");
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
style.push("left:" + (targetPosition.right + margin) + "px");
|
|
97
|
+
tooltip.classList.add("right");
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if ((targetPosition.top + (targetPosition.height / 2) - (tooltipPosition_1.height / 2)) < 0) {
|
|
101
|
+
style.push("top:2px");
|
|
102
|
+
tooltip.classList.add("start");
|
|
103
|
+
}
|
|
104
|
+
else if ((targetPosition.top + (targetPosition.height / 2) + (tooltipPosition_1.height / 2)) > window.innerHeight) {
|
|
105
|
+
style.push("bottom:2px");
|
|
106
|
+
tooltip.classList.add("end");
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
style.push("top:" + (targetPosition.top + (targetPosition.height / 2)) + "px");
|
|
110
|
+
style.push("transform:translate(0,-50%)");
|
|
111
|
+
tooltip.classList.add("center");
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
tooltip.setAttribute("style", style.join(";"));
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
return React.cloneElement(children, __assign({ onMouseEnter: tooltipEkle, onMouseLeave: tooltipSil, onMouseDown: tooltipSil }, other));
|
|
118
|
+
});
|
|
119
|
+
var tooltipCss = "\n.stooltip {\n position: fixed;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #1a1a1a;\n color: rgba(255,255,255,0.9);\n text-align: center;\n font-size: 0.9rem;\n font-weight:400;\n padding: 5px 10px;\n border-radius: 8px;\n z-index: 1000000;\n opacity: 0.9;\n pointer-events: none;\n /*transition: all 0.1s;*/\n white-space:pre-line;\n max-width: 300px;\n animation: stooltip_fadein 0.7s;\n}\n\n.stooltip.arrow:after {\n content: \"\";\n position: absolute;\n margin-left: -5px;\n border-width: 5px;\n border-style: solid;\n}\n\n.stooltip.arrow.top:after {\n top: 100%;\n border-color: #1a1a1a transparent transparent transparent;\n}\n\n.stooltip.arrow.top.start:after { left: 15px;}\n\n.stooltip.arrow.top.center:after { left: 50%;}\n\n.stooltip.arrow.top.end:after { right: 15px;}\n\n\n.stooltip.arrow.bottom:after {\n bottom: 100%;\n border-color: transparent transparent #1a1a1a transparent;\n}\n\n.stooltip.arrow.bottom.start:after { left: 15px;}\n\n.stooltip.arrow.bottom.center:after { left: 50%;}\n\n.stooltip.bottom.end:after { right: 15px;}\n\n.stooltip.arrow.left:after {\n margin-left: -1px;\n left: 100%;\n border-color: transparent transparent transparent #1a1a1a;\n}\n\n.stooltip.arrow.left.start:after { top: 5px;}\n\n.stooltip.arrow.left.center:after { top: 50%; margin-top: -5px;}\n\n.stooltip.arrow.left.end:after { bottom: 15px;}\n\n.stooltip.arrow.right:after {\n margin-right: -1px;\n right: 100%;\n border-color: transparent #1a1a1a transparent transparent;\n}\n\n.stooltip.arrow.right.start:after { top: 5px;}\n\n.stooltip.arrow.right.center:after { top: 50%; margin-top: -5px;}\n\n.stooltip.arrow.right.end:after { bottom: 15px;}\n\n@keyframes stooltip_fadein {\n from { opacity: 0; }\n to { opacity: 0.85; }\n}\n";
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sydsoft/base",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.6.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
7
7
|
"module": "./dist/esm/index.js",
|
|
8
8
|
"types": "./dist/esm/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
|
-
"./dist/"
|
|
10
|
+
"./dist/",
|
|
11
|
+
"README.md"
|
|
11
12
|
],
|
|
12
13
|
"scripts": {
|
|
13
14
|
"test": "npm run build && npm pack",
|
|
14
|
-
"
|
|
15
|
-
"build": "rm -rf ./dist && tsc && npm run
|
|
15
|
+
"copyFiles": "copyfiles -u 2 \"../@base/**/*.css\" dist/esm",
|
|
16
|
+
"build": "rm -rf ./dist && tsc && npm run copyFiles",
|
|
16
17
|
"publishNPM": "npm run build && npm version patch && npm version minor && npm publish --dry-run && npm publish --access public"
|
|
17
18
|
},
|
|
18
19
|
"publishConfig": {
|