@sydsoft/base 1.3.0 → 1.5.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.
Files changed (64) hide show
  1. package/README.md +9 -0
  2. package/dist/esm/_lib/baseFunctions.d.ts +5 -0
  3. package/dist/esm/_lib/baseFunctions.js +38 -0
  4. package/dist/esm/_lib/inputMask.d.ts +7 -0
  5. package/dist/esm/_lib/inputMask.js +228 -0
  6. package/dist/esm/box/Box.d.ts +9 -0
  7. package/dist/esm/box/Box.js +15 -0
  8. package/dist/esm/box/Box.module.css +152 -0
  9. package/dist/esm/box/BoxContent.d.ts +9 -0
  10. package/dist/esm/box/BoxContent.js +7 -0
  11. package/dist/esm/box/BoxFooter.d.ts +10 -0
  12. package/dist/esm/box/BoxFooter.js +8 -0
  13. package/dist/esm/box/BoxHeader.d.ts +16 -0
  14. package/dist/esm/box/BoxHeader.js +9 -0
  15. package/dist/esm/box/index.d.ts +9 -0
  16. package/dist/esm/box/index.js +9 -0
  17. package/dist/esm/form/Button.d.ts +27 -0
  18. package/dist/esm/form/Button.js +76 -0
  19. package/dist/esm/form/Checkbox.d.ts +23 -0
  20. package/dist/esm/form/Checkbox.js +23 -0
  21. package/dist/esm/form/Dialog.d.ts +19 -0
  22. package/dist/esm/form/Dialog.js +40 -0
  23. package/dist/esm/form/Form.d.ts +10 -0
  24. package/dist/esm/form/Form.js +12 -0
  25. package/dist/esm/form/FormOlustur.d.ts +39 -0
  26. package/dist/esm/form/FormOlustur.js +51 -0
  27. package/dist/esm/form/Input.d.ts +62 -0
  28. package/dist/esm/form/Input.js +207 -0
  29. package/dist/esm/form/Label.d.ts +7 -0
  30. package/dist/esm/form/Label.js +12 -0
  31. package/dist/esm/form/SearchableInput.d.ts +35 -0
  32. package/dist/esm/form/SearchableInput.js +313 -0
  33. package/dist/esm/form/UploadBase.d.ts +25 -0
  34. package/dist/esm/form/UploadBase.js +86 -0
  35. package/dist/esm/form/index.d.ts +9 -0
  36. package/dist/esm/form/index.js +9 -0
  37. package/dist/esm/form/styles/Button.module.css +144 -0
  38. package/dist/esm/form/styles/Input.module.css +220 -0
  39. package/dist/esm/form/styles/Label.module.css +31 -0
  40. package/dist/esm/form/styles/SearchableInput.module.css +79 -0
  41. package/dist/esm/grid/index.d.ts +37 -0
  42. package/dist/esm/grid/index.js +63 -0
  43. package/dist/esm/grid/index.module.css +805 -0
  44. package/dist/esm/index.d.ts +10 -0
  45. package/dist/esm/index.js +10 -0
  46. package/dist/esm/modal/index.d.ts +23 -0
  47. package/dist/esm/modal/index.js +66 -0
  48. package/dist/esm/modal/index.module.css +74 -0
  49. package/dist/esm/popover/index.d.ts +12 -0
  50. package/dist/esm/popover/index.js +142 -0
  51. package/dist/esm/tooltip/index.d.ts +11 -0
  52. package/dist/esm/tooltip/index.js +119 -0
  53. package/package.json +10 -6
  54. package/dist/index.d.ts +0 -8
  55. package/dist/index.js +0 -8
  56. package/global.d.ts +0 -2
  57. package/tsconfig.json +0 -22
  58. /package/dist/{alert → esm/alert}/index.d.ts +0 -0
  59. /package/dist/{alert → esm/alert}/index.js +0 -0
  60. /package/dist/{alert → esm/alert}/index.module.css +0 -0
  61. /package/dist/{datetime → esm/datetime}/index.d.ts +0 -0
  62. /package/dist/{datetime → esm/datetime}/index.js +0 -0
  63. /package/dist/{icon → esm/icon}/index.d.ts +0 -0
  64. /package/dist/{icon → esm/icon}/index.js +0 -0
@@ -0,0 +1,10 @@
1
+ export * from "./_lib/baseFunctions";
2
+ export * from "./alert";
3
+ export * from "./box";
4
+ export * from "./datetime";
5
+ export * from "./form";
6
+ export * from "./grid";
7
+ export * from "./icon";
8
+ export * from "./modal";
9
+ export * from "./popover";
10
+ export * from "./tooltip";
@@ -0,0 +1,10 @@
1
+ export * from "./_lib/baseFunctions";
2
+ export * from "./alert";
3
+ export * from "./box";
4
+ export * from "./datetime";
5
+ export * from "./form";
6
+ export * from "./grid";
7
+ export * from "./icon";
8
+ export * from "./modal";
9
+ export * from "./popover";
10
+ export * from "./tooltip";
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Copyright (c) 2023
3
+ * @author: izzetseydaoglu
4
+ * @last-modified: 9.02.2024 06:07
5
+ */
6
+ import React from "react";
7
+ interface Props {
8
+ children: React.ReactNode;
9
+ open: boolean;
10
+ close?: Function;
11
+ keepMounted?: boolean;
12
+ hideBackdrop?: boolean;
13
+ hideEsc?: boolean;
14
+ hideCloseButton?: boolean;
15
+ fullScreen?: boolean;
16
+ modalStyle?: React.CSSProperties;
17
+ backdropStyle?: React.CSSProperties;
18
+ vertialAlign?: "flex-start" | "center" | "flex-end";
19
+ horizontalAlign?: "flex-start" | "center" | "flex-end";
20
+ refModal?: any;
21
+ }
22
+ export declare const Modal: React.NamedExoticComponent<Props>;
23
+ export {};
@@ -0,0 +1,66 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /**
4
+ * Copyright (c) 2023
5
+ * @author: izzetseydaoglu
6
+ * @last-modified: 9.02.2024 06:07
7
+ */
8
+ import { memo, useEffect, useRef, useState } from "react";
9
+ import ReactDOM from "react-dom";
10
+ import styles from "./index.module.css";
11
+ export var Modal = memo(function MemoFunction(_a) {
12
+ var _b = _a.refModal, refModal = _b === void 0 ? null : _b, children = _a.children, _c = _a.open, open = _c === void 0 ? false : _c, close = _a.close, _d = _a.keepMounted, keepMounted = _d === void 0 ? false : _d, _e = _a.fullScreen, fullScreen = _e === void 0 ? false : _e, _f = _a.hideBackdrop, hideBackdrop = _f === void 0 ? true : _f, _g = _a.hideEsc, hideEsc = _g === void 0 ? false : _g, _h = _a.hideCloseButton, hideCloseButton = _h === void 0 ? false : _h, modalStyle = _a.modalStyle, backdropStyle = _a.backdropStyle, _j = _a.vertialAlign, vertialAlign = _j === void 0 ? "center" : _j, _k = _a.horizontalAlign, horizontalAlign = _k === void 0 ? "center" : _k;
13
+ var _l = useState(null), modalDiv = _l[0], setModalDiv = _l[1];
14
+ var ref = useRef(null);
15
+ useEffect(function () {
16
+ if (refModal)
17
+ refModal.current = ref.current;
18
+ }, [ref.current]);
19
+ var onClose = function () {
20
+ if (close)
21
+ close();
22
+ };
23
+ var checkHideBackDrop = function (e) {
24
+ if (open && ref.current && !ref.current.contains(e.target))
25
+ onClose();
26
+ };
27
+ var checkESC = function (e) {
28
+ if (e.keyCode === 27 || e.key === "Escape" || e.code === "Escape")
29
+ onClose();
30
+ };
31
+ useEffect(function () {
32
+ if (open) {
33
+ if (hideBackdrop)
34
+ window.addEventListener("mousedown", checkHideBackDrop);
35
+ if (hideEsc)
36
+ window.addEventListener("keydown", checkESC);
37
+ }
38
+ return function () {
39
+ if (hideBackdrop)
40
+ window.removeEventListener("mousedown", checkHideBackDrop);
41
+ if (hideEsc)
42
+ window.removeEventListener("keydown", checkESC);
43
+ };
44
+ });
45
+ useEffect(function () {
46
+ if (!modalDiv) {
47
+ var modalDivCheck = document.getElementById("smodal");
48
+ if (modalDivCheck) {
49
+ setModalDiv(modalDivCheck);
50
+ }
51
+ else {
52
+ var div = document.createElement("div");
53
+ div.setAttribute("id", "smodal");
54
+ document.body.appendChild(div);
55
+ setModalDiv(div);
56
+ }
57
+ }
58
+ return function () {
59
+ onClose();
60
+ };
61
+ }, []);
62
+ if ((!keepMounted && !open) || typeof window === "undefined")
63
+ return null;
64
+ var Component = (_jsx("div", { className: "".concat(styles.backdrop, " ").concat(open ? styles.backdrop_open : ""), style: __assign({ alignItems: vertialAlign, justifyContent: horizontalAlign }, backdropStyle), children: _jsxs("div", { ref: ref, className: "".concat(styles.modal, " ").concat(fullScreen ? styles.fullscreen : ""), style: modalStyle, children: [!hideCloseButton && (_jsx("div", { className: styles.close_fixed, children: _jsx("div", { className: styles.close, onClick: onClose, children: "\u2715" }) })), children] }) }));
65
+ return modalDiv ? ReactDOM.createPortal(Component, modalDiv) : null;
66
+ });
@@ -0,0 +1,74 @@
1
+ .backdrop {
2
+ position: fixed;
3
+ z-index: 1300;
4
+ inset: 0;
5
+ display: none;
6
+ align-items: center;
7
+ justify-content: center;
8
+ background: rgba(0, 0, 0, 0.23);
9
+ width: 100%;
10
+ height: 100%;
11
+ outline: none;
12
+ }
13
+ .backdrop_open {
14
+ display: flex !important;
15
+ }
16
+
17
+ .modal {
18
+ position: relative;
19
+ min-width: 200px;
20
+ max-width: 90%;
21
+ max-height: calc(100% - 64px);
22
+ overflow-x: hidden;
23
+ border-radius: 8px;
24
+ background: transparent;
25
+ box-shadow: rgb(0 0 0 / 32%) 0 4px 8px, rgb(0 0 0 / 40%) 0 8px 40px;
26
+ margin: 15px;
27
+ padding: 0;
28
+ z-index: 1;
29
+ outline: none;
30
+ }
31
+ .fullscreen {
32
+ width: 100vw;
33
+ max-width: 100vw;
34
+ height: 100vh;
35
+ max-height: 100vh;
36
+ border-radius: 0;
37
+ margin: 0;
38
+ }
39
+ .close_fixed {
40
+ position: absolute;
41
+ top: 0;
42
+ right: 1px;
43
+ z-index: 1000;
44
+ text-align: right;
45
+ border-radius: inherit;
46
+ }
47
+
48
+ .close {
49
+ position: fixed;
50
+ background: #e7e7e7;
51
+ padding: 0 7px;
52
+ font-size: 11px;
53
+ transform: translateX(-100%);
54
+ border-radius: inherit;
55
+ border-top-left-radius: 0;
56
+ border-bottom-right-radius: 0;
57
+ border-bottom-left-radius: 50%;
58
+ cursor: pointer;
59
+ }
60
+ .close:hover {
61
+ zoom: 1.3;
62
+ }
63
+
64
+ .sbox_header {
65
+ position: sticky;
66
+ top: 0;
67
+ z-index: 10;
68
+ }
69
+
70
+ .sbox_footer {
71
+ position: sticky;
72
+ bottom: 0;
73
+ z-index: 10;
74
+ }
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ type position = "top" | "bottom" | "left" | "right";
3
+ interface Props {
4
+ Component: React.ReactElement;
5
+ children: React.ReactNode;
6
+ position?: position;
7
+ removeWhenClickInside?: boolean;
8
+ arrow?: boolean;
9
+ distance?: number;
10
+ }
11
+ export declare const Popover: React.NamedExoticComponent<Props>;
12
+ export {};
@@ -0,0 +1,142 @@
1
+ import { __assign, __rest } from "tslib";
2
+ import React, { memo, useEffect } from "react";
3
+ import { createRoot } from "react-dom/client";
4
+ export var Popover = memo(function MemoFunction(_a) {
5
+ // const refChildren = useRef<any>(null);
6
+ var children = _a.children, Component = _a.Component, _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, _e = _a.removeWhenClickInside, removeWhenClickInside = _e === void 0 ? false : _e, other = __rest(_a, ["children", "Component", "position", "arrow", "distance", "removeWhenClickInside"]);
7
+ useEffect(function () {
8
+ if (typeof window === "undefined")
9
+ return null;
10
+ var cssCheck = document.getElementsByClassName("spopover_css")[0];
11
+ if (!cssCheck) {
12
+ var head = document.getElementsByTagName("head")[0];
13
+ var s = document.createElement("style");
14
+ s.setAttribute("type", "text/css");
15
+ s.classList.add("spopover_css");
16
+ s.appendChild(document.createTextNode(popoverCss));
17
+ head.appendChild(s);
18
+ }
19
+ return function () {
20
+ popoverSil();
21
+ };
22
+ }, []);
23
+ var checkHideBackDrop = function (e) {
24
+ var spopover = document.querySelector(".spopover");
25
+ if (spopover && !spopover.contains(e.target))
26
+ popoverSil();
27
+ };
28
+ var popoverEkle = function (e) {
29
+ popoverSil();
30
+ var popover = document.createElement("div");
31
+ popover.classList.add("spopover");
32
+ document.body.appendChild(popover);
33
+ // ReactDOM.render(children, popover)
34
+ var root = createRoot(popover); // createRoot(container!) if you use TypeScript
35
+ root.render(children);
36
+ var target = e.currentTarget;
37
+ setTimeout(function () {
38
+ popoverPosition({ target: target, position: position });
39
+ }, 100);
40
+ window.addEventListener("mousedown", checkHideBackDrop);
41
+ if (removeWhenClickInside)
42
+ popover.addEventListener("mouseup", popoverGecikmeliSil);
43
+ document.body.classList.add("spopover_open");
44
+ };
45
+ var popoverSil = function () {
46
+ var check = document.body.getElementsByClassName("spopover")[0];
47
+ if (check) {
48
+ if (removeWhenClickInside)
49
+ check.removeEventListener("mouseup", popoverGecikmeliSil);
50
+ check.remove();
51
+ }
52
+ window.removeEventListener("mousedown", checkHideBackDrop);
53
+ document.body.classList.remove("spopover_open");
54
+ };
55
+ var popoverGecikmeliSil = function () { return setTimeout(function () { return popoverSil(); }, 100); };
56
+ var popoverPosition = function (_a) {
57
+ var target = _a.target, position = _a.position;
58
+ var popover = document.body.getElementsByClassName("spopover")[0];
59
+ if (popover) {
60
+ var arrowMargin = arrow ? 5 : 0;
61
+ var margin = distance + arrowMargin;
62
+ if (arrow)
63
+ popover.classList.add("arrow");
64
+ var targetPosition = target.getBoundingClientRect();
65
+ var popoverPosition_1 = popover.getBoundingClientRect();
66
+ var style = [];
67
+ if (position === "top" || position === "bottom") {
68
+ if (position === "top") {
69
+ if (targetPosition.top - popoverPosition_1.height - margin < 0) {
70
+ style.push("top:" + (targetPosition.bottom + margin) + "px");
71
+ popover.classList.add("bottom");
72
+ }
73
+ else {
74
+ style.push("top:" + (targetPosition.top - popoverPosition_1.height - margin) + "px");
75
+ popover.classList.add("top");
76
+ }
77
+ }
78
+ if (position === "bottom") {
79
+ if (targetPosition.bottom + popoverPosition_1.height + margin > window.innerHeight) {
80
+ style.push("top:" + (targetPosition.top - popoverPosition_1.height - margin) + "px");
81
+ popover.classList.add("top");
82
+ }
83
+ else {
84
+ style.push("top:" + (targetPosition.bottom + margin) + "px");
85
+ popover.classList.add("bottom");
86
+ }
87
+ }
88
+ if (targetPosition.left + targetPosition.width / 2 - popoverPosition_1.width / 2 < 0) {
89
+ style.push("left:2px");
90
+ popover.classList.add("start");
91
+ }
92
+ else if (targetPosition.left + targetPosition.width / 2 + popoverPosition_1.width > window.innerWidth) {
93
+ style.push("right:2px");
94
+ popover.classList.add("end");
95
+ }
96
+ else {
97
+ style.push("left:" + (targetPosition.left + targetPosition.width / 2) + "px");
98
+ style.push("transform:translate(-50%,0)");
99
+ popover.classList.add("center");
100
+ }
101
+ }
102
+ if (position === "left" || position === "right") {
103
+ if (position === "left") {
104
+ if (targetPosition.left - popoverPosition_1.width - margin < 0) {
105
+ style.push("left:" + (targetPosition.right + margin) + "px");
106
+ popover.classList.add("right");
107
+ }
108
+ else {
109
+ style.push("left:" + (targetPosition.left - popoverPosition_1.width - margin) + "px");
110
+ popover.classList.add("left");
111
+ }
112
+ }
113
+ if (position === "right") {
114
+ if (targetPosition.left + targetPosition.width / 2 + popoverPosition_1.width + margin > window.innerWidth) {
115
+ style.push("left:" + (targetPosition.left - popoverPosition_1.width - margin) + "px");
116
+ popover.classList.add("left");
117
+ }
118
+ else {
119
+ style.push("left:" + (targetPosition.right + margin) + "px");
120
+ popover.classList.add("right");
121
+ }
122
+ }
123
+ if (targetPosition.top + targetPosition.height / 2 - popoverPosition_1.height / 2 < 0) {
124
+ style.push("top:2px");
125
+ popover.classList.add("start");
126
+ }
127
+ else if (targetPosition.top + targetPosition.height / 2 + popoverPosition_1.height / 2 > window.innerHeight) {
128
+ style.push("bottom:2px");
129
+ popover.classList.add("end");
130
+ }
131
+ else {
132
+ style.push("top:" + (targetPosition.top + targetPosition.height / 2) + "px");
133
+ style.push("transform:translate(0,-50%)");
134
+ popover.classList.add("center");
135
+ }
136
+ }
137
+ popover.setAttribute("style", style.join(";"));
138
+ }
139
+ };
140
+ return React.cloneElement(Component, __assign({ onClick: popoverEkle }, other));
141
+ });
142
+ var popoverCss = "\n.spopover {\n position: fixed;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10000;\n}\n\n.spopover.arrow:after {\n content: \"\";\n position: absolute;\n margin-left: -5px;\n border-width: 5px;\n border-style: solid;\n}\n\n.spopover.arrow.top:after {\n top: 100%;\n border-color: #757575 transparent transparent transparent;\n}\n\n.spopover.arrow.top.start:after { left: 15px;}\n\n.spopover.arrow.top.center:after { left: 50%;}\n\n.spopover.arrow.top.end:after { right: 15px;}\n\n\n.spopover.arrow.bottom:after {\n bottom: 100%;\n border-color: transparent transparent #757575 transparent;\n}\n\n.spopover.arrow.bottom.start:after { left: 15px;}\n\n.spopover.arrow.bottom.center:after { left: 50%;}\n\n.spopover.bottom.end:after { right: 15px;}\n\n.spopover.arrow.left:after {\n margin-left: -1px;\n left: 100%;\n border-color: transparent transparent transparent #757575;\n}\n\n.spopover.arrow.left.start:after { top: 5px;}\n\n.spopover.arrow.left.center:after { top: 50%; margin-top: -5px;}\n\n.spopover.arrow.left.end:after { bottom: 15px;}\n\n.spopover.arrow.right:after {\n margin-right: -1px;\n right: 100%;\n border-color: transparent #757575 transparent transparent;\n}\n\n.spopover.arrow.right.start:after { top: 5px;}\n\n.spopover.arrow.right.center:after { top: 50%; margin-top: -5px;}\n\n.spopover.arrow.right.end:after { bottom: 15px;}\n";
@@ -0,0 +1,11 @@
1
+ import React, { ReactElement } from "react";
2
+ export type typeTooltipPosition = "top" | "bottom" | "left" | "right";
3
+ interface Props {
4
+ children: ReactElement;
5
+ title: string;
6
+ position?: typeTooltipPosition;
7
+ arrow?: boolean;
8
+ distance?: number;
9
+ }
10
+ export declare const Tooltip: React.NamedExoticComponent<Props>;
11
+ export {};
@@ -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,15 +1,19 @@
1
1
  {
2
2
  "name": "@sydsoft/base",
3
3
  "private": false,
4
- "version": "1.3.0",
4
+ "version": "1.5.0",
5
5
  "description": "",
6
- "main": "dist/index.js",
7
- "module": "dist/index.js",
8
- "types": "dist/index.d.ts",
6
+ "main": "./dist/cjs/index.js",
7
+ "module": "./dist/esm/index.js",
8
+ "types": "./dist/esm/index.d.ts",
9
+ "files": [
10
+ "./dist/",
11
+ "README.md"
12
+ ],
9
13
  "scripts": {
14
+ "test": "npm run build && npm pack",
15
+ "copyCSS": "copyfiles -u 2 \"../@base/**/*.css\" dist/esm",
10
16
  "build": "rm -rf ./dist && tsc && npm run copyCSS",
11
- "pack": "npm pack",
12
- "copyCSS": "copyfiles -u 2 \"../@base/**/*.css\" dist/",
13
17
  "publishNPM": "npm run build && npm version patch && npm version minor && npm publish --dry-run && npm publish --access public"
14
18
  },
15
19
  "publishConfig": {
package/dist/index.d.ts DELETED
@@ -1,8 +0,0 @@
1
- /**
2
- * Copyright (c) 2024
3
- * @author: izzetseydaoglu
4
- * @last-modified: 16.02.2024 03:33
5
- */
6
- export { Alert } from "./alert";
7
- export * from './datetime';
8
- export * from './icon';
package/dist/index.js DELETED
@@ -1,8 +0,0 @@
1
- /**
2
- * Copyright (c) 2024
3
- * @author: izzetseydaoglu
4
- * @last-modified: 16.02.2024 03:33
5
- */
6
- export { Alert } from "./alert";
7
- export * from './datetime';
8
- export * from './icon';
package/global.d.ts DELETED
@@ -1,2 +0,0 @@
1
- // global.d.ts
2
- declare module "*.module.css";
package/tsconfig.json DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "include": ["../@base", "global.d.ts"],
3
- "exclude": ["./dist", "node_modules"],
4
- "compilerOptions": {
5
- "module": "esnext",
6
- "lib": ["dom", "esnext"],
7
- "importHelpers": true,
8
- "declaration": true,
9
- "sourceMap": false,
10
- "rootDir": "../@base",
11
- "outDir": "./dist",
12
- "strict": true,
13
- "noFallthroughCasesInSwitch": true,
14
- "noUnusedLocals": true,
15
- "noUnusedParameters": true,
16
- "moduleResolution": "Node",
17
- "jsx": "react-jsx",
18
- "esModuleInterop": true,
19
- "skipLibCheck": true,
20
- "forceConsistentCasingInFileNames": true
21
- }
22
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes