@sydsoft/base 1.54.0 → 1.57.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 (81) hide show
  1. package/package.json +8 -16
  2. package/_dist/_lib/baseFunctions.d.ts +0 -11
  3. package/_dist/_lib/baseFunctions.js +0 -110
  4. package/_dist/_lib/inputMask.d.ts +0 -7
  5. package/_dist/_lib/inputMask.js +0 -233
  6. package/_dist/_lib/listFunctions.d.ts +0 -2
  7. package/_dist/_lib/listFunctions.js +0 -119
  8. package/_dist/_lib/storage/cookies.d.ts +0 -4
  9. package/_dist/_lib/storage/cookies.js +0 -41
  10. package/_dist/_lib/storage/encData.d.ts +0 -2
  11. package/_dist/_lib/storage/encData.js +0 -48
  12. package/_dist/_lib/storage/localStorage.d.ts +0 -6
  13. package/_dist/_lib/storage/localStorage.js +0 -78
  14. package/_dist/_lib/storage/sessionStorage.d.ts +0 -6
  15. package/_dist/_lib/storage/sessionStorage.js +0 -78
  16. package/_dist/_lib/useInterval.d.ts +0 -6
  17. package/_dist/_lib/useInterval.js +0 -27
  18. package/_dist/alert/index.d.ts +0 -18
  19. package/_dist/alert/index.js +0 -116
  20. package/_dist/alert/index.module.css +0 -119
  21. package/_dist/box/Box.d.ts +0 -9
  22. package/_dist/box/Box.js +0 -19
  23. package/_dist/box/Box.module.css +0 -153
  24. package/_dist/box/BoxContent.d.ts +0 -9
  25. package/_dist/box/BoxContent.js +0 -11
  26. package/_dist/box/BoxFooter.d.ts +0 -10
  27. package/_dist/box/BoxFooter.js +0 -11
  28. package/_dist/box/BoxHeader.d.ts +0 -16
  29. package/_dist/box/BoxHeader.js +0 -12
  30. package/_dist/box/index.d.ts +0 -9
  31. package/_dist/box/index.js +0 -12
  32. package/_dist/countDown/index.d.ts +0 -22
  33. package/_dist/countDown/index.js +0 -102
  34. package/_dist/dateTime/index.d.ts +0 -12
  35. package/_dist/dateTime/index.js +0 -78
  36. package/_dist/form/Button.d.ts +0 -27
  37. package/_dist/form/Button.js +0 -79
  38. package/_dist/form/Checkbox.d.ts +0 -23
  39. package/_dist/form/Checkbox.js +0 -28
  40. package/_dist/form/Dialog.d.ts +0 -20
  41. package/_dist/form/Dialog.js +0 -44
  42. package/_dist/form/Form.d.ts +0 -10
  43. package/_dist/form/Form.js +0 -15
  44. package/_dist/form/FormOlustur.d.ts +0 -39
  45. package/_dist/form/FormOlustur.js +0 -55
  46. package/_dist/form/Input.d.ts +0 -66
  47. package/_dist/form/Input.js +0 -200
  48. package/_dist/form/Label.d.ts +0 -7
  49. package/_dist/form/Label.js +0 -12
  50. package/_dist/form/SearchableInput.d.ts +0 -37
  51. package/_dist/form/SearchableInput.js +0 -275
  52. package/_dist/form/UploadBase.d.ts +0 -25
  53. package/_dist/form/UploadBase.js +0 -91
  54. package/_dist/form/index.d.ts +0 -9
  55. package/_dist/form/index.js +0 -12
  56. package/_dist/form/styles/Button.module.css +0 -145
  57. package/_dist/form/styles/Input.module.css +0 -221
  58. package/_dist/form/styles/Label.module.css +0 -31
  59. package/_dist/form/styles/SearchableInput.module.css +0 -80
  60. package/_dist/grid/index.d.ts +0 -38
  61. package/_dist/grid/index.js +0 -104
  62. package/_dist/grid/index.module.css +0 -805
  63. package/_dist/icon/icons.d.ts +0 -22
  64. package/_dist/icon/icons.js +0 -26
  65. package/_dist/icon/index.d.ts +0 -34
  66. package/_dist/icon/index.js +0 -30
  67. package/_dist/icon/mui.d.ts +0 -1
  68. package/_dist/icon/mui.js +0 -2
  69. package/_dist/index.d.ts +0 -19
  70. package/_dist/index.js +0 -22
  71. package/_dist/menu/index.d.ts +0 -69
  72. package/_dist/menu/index.js +0 -55
  73. package/_dist/menu/index.module.css +0 -92
  74. package/_dist/modal/index.d.ts +0 -23
  75. package/_dist/modal/index.js +0 -69
  76. package/_dist/modal/index.module.css +0 -77
  77. package/_dist/popover/index.d.ts +0 -26
  78. package/_dist/popover/index.js +0 -346
  79. package/_dist/popover/index.module.css +0 -89
  80. package/_dist/tooltip/index.d.ts +0 -11
  81. package/_dist/tooltip/index.js +0 -122
@@ -1,346 +0,0 @@
1
- "use strict";
2
- /**
3
- * @author : izzetseydaoglu
4
- * @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
5
- * @version : 2026-02-10 16:12:35
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.Popover = void 0;
9
- var tslib_1 = require("tslib");
10
- var react_1 = require("react");
11
- var client_1 = require("react-dom/client");
12
- var index_module_css_1 = tslib_1.__importDefault(require("./index.module.css"));
13
- exports.Popover = (0, react_1.memo)(function MemoFunction(_a) {
14
- 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, _f = _a.hideBackdrop, hideBackdrop = _f === void 0 ? true : _f, _g = _a.fade, fade = _g === void 0 ? true : _g, _h = _a.arrowColor, arrowColor = _h === void 0 ? 'auto' : _h, _j = _a.hover, hover = _j === void 0 ? false : _j, _k = _a.hoverCloseDelay, hoverCloseDelay = _k === void 0 ? 120 : _k, _l = _a.keepMounted, keepMounted = _l === void 0 ? false : _l, other = tslib_1.__rest(_a, ["children", "component", "position", "arrow", "distance", "removeWhenClickInside", "hideBackdrop", "fade", "arrowColor", "hover", "hoverCloseDelay", "keepMounted"]);
15
- var refComponent = (0, react_1.useRef)(null);
16
- var closeTimer = (0, react_1.useRef)(null);
17
- var hoverCloseTimer = (0, react_1.useRef)(null);
18
- var popoverRef = (0, react_1.useRef)(null);
19
- var rootRef = (0, react_1.useRef)(null);
20
- var zIndexRef = (0, react_1.useRef)(null);
21
- (0, react_1.useEffect)(function () {
22
- if (typeof window === 'undefined')
23
- return;
24
- return function () {
25
- popoverSil(false);
26
- };
27
- }, []);
28
- var checkHideBackDrop = function (e) {
29
- var spopover = popoverRef.current;
30
- if (!spopover)
31
- return;
32
- if (!((e === null || e === void 0 ? void 0 : e.target) instanceof Node)) {
33
- popoverSil();
34
- return;
35
- }
36
- if (!spopover.contains(e.target))
37
- popoverSil();
38
- };
39
- var popoverEkle = function (e) {
40
- var _a, _b;
41
- if (popoverRef.current && keepMounted) {
42
- var popover_1 = popoverRef.current;
43
- var target_1 = e.currentTarget;
44
- var wasVisible = popover_1.classList.contains(index_module_css_1.default.visible);
45
- (_b = (_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.render) === null || _b === void 0 ? void 0 : _b.call(_a, children);
46
- applyArrowColor(popover_1);
47
- popoverPosition({ target: target_1, position: position });
48
- popover_1.style.zIndex = String(nextPopoverZIndex());
49
- popover_1.classList.remove(index_module_css_1.default.closing);
50
- popover_1.classList.add(index_module_css_1.default.visible);
51
- if (!wasVisible) {
52
- if (hideBackdrop) {
53
- window.addEventListener('mousedown', checkHideBackDrop);
54
- window.addEventListener('blur', checkHideBackDrop);
55
- }
56
- if (removeWhenClickInside)
57
- popover_1.addEventListener('mouseup', popoverGecikmeliSil);
58
- if (hover) {
59
- popover_1.addEventListener('mouseenter', clearHoverClose);
60
- popover_1.addEventListener('mouseleave', scheduleHoverClose);
61
- }
62
- incrementBodyPopover();
63
- }
64
- return;
65
- }
66
- popoverSil(false);
67
- var popover = document.createElement('div');
68
- popover.classList.add('spopover', index_module_css_1.default.popover);
69
- var zIndex = nextPopoverZIndex();
70
- zIndexRef.current = zIndex;
71
- document.body.appendChild(popover);
72
- // ReactDOM.render(children, popover)
73
- var root = (0, client_1.createRoot)(popover);
74
- root.render(children);
75
- popoverRef.current = popover;
76
- rootRef.current = root;
77
- var target = e.currentTarget;
78
- refComponent.current && refComponent.current.classList.add('spopover_active');
79
- setTimeout(function () {
80
- var _a;
81
- applyArrowColor(popover);
82
- popoverPosition({ target: target, position: position });
83
- popover.style.zIndex = String((_a = zIndexRef.current) !== null && _a !== void 0 ? _a : zIndex);
84
- popover.classList.add(index_module_css_1.default.visible);
85
- }, 100);
86
- if (hideBackdrop) {
87
- window.addEventListener('mousedown', checkHideBackDrop);
88
- window.addEventListener('blur', checkHideBackDrop);
89
- }
90
- if (removeWhenClickInside)
91
- popover.addEventListener('mouseup', popoverGecikmeliSil);
92
- if (hover) {
93
- popover.addEventListener('mouseenter', clearHoverClose);
94
- popover.addEventListener('mouseleave', scheduleHoverClose);
95
- }
96
- incrementBodyPopover();
97
- };
98
- var popoverSil = function (animate) {
99
- if (animate === void 0) { animate = true; }
100
- refComponent.current && refComponent.current.classList.remove('spopover_active');
101
- var check = popoverRef.current;
102
- var wasVisible = !!(check === null || check === void 0 ? void 0 : check.classList.contains(index_module_css_1.default.visible));
103
- if (check) {
104
- if (removeWhenClickInside)
105
- check.removeEventListener('mouseup', popoverGecikmeliSil);
106
- if (hover) {
107
- check.removeEventListener('mouseenter', clearHoverClose);
108
- check.removeEventListener('mouseleave', scheduleHoverClose);
109
- }
110
- if (closeTimer.current)
111
- window.clearTimeout(closeTimer.current);
112
- if (hoverCloseTimer.current)
113
- window.clearTimeout(hoverCloseTimer.current);
114
- if (!fade || !animate) {
115
- if (!keepMounted) {
116
- var root_1 = rootRef.current;
117
- window.setTimeout(function () {
118
- var _a;
119
- (_a = root_1 === null || root_1 === void 0 ? void 0 : root_1.unmount) === null || _a === void 0 ? void 0 : _a.call(root_1);
120
- }, 0);
121
- check.remove();
122
- popoverRef.current = null;
123
- rootRef.current = null;
124
- }
125
- else {
126
- check.classList.remove(index_module_css_1.default.visible);
127
- check.classList.remove(index_module_css_1.default.closing);
128
- }
129
- }
130
- else if (!check.classList.contains(index_module_css_1.default.closing)) {
131
- check.classList.add(index_module_css_1.default.closing);
132
- closeTimer.current = window.setTimeout(function () {
133
- var _a;
134
- if (!keepMounted) {
135
- var root = rootRef.current;
136
- (_a = root === null || root === void 0 ? void 0 : root.unmount) === null || _a === void 0 ? void 0 : _a.call(root);
137
- check.remove();
138
- popoverRef.current = null;
139
- rootRef.current = null;
140
- }
141
- else {
142
- check.classList.remove(index_module_css_1.default.visible);
143
- check.classList.remove(index_module_css_1.default.closing);
144
- }
145
- }, FADE_DURATION);
146
- }
147
- }
148
- if (hideBackdrop) {
149
- window.removeEventListener('mousedown', checkHideBackDrop);
150
- window.removeEventListener('blur', checkHideBackDrop);
151
- }
152
- if (wasVisible)
153
- decrementBodyPopover();
154
- };
155
- var popoverGecikmeliSil = function () { return setTimeout(function () { return popoverSil(); }, 100); };
156
- var clearHoverClose = function () {
157
- if (hoverCloseTimer.current)
158
- window.clearTimeout(hoverCloseTimer.current);
159
- hoverCloseTimer.current = null;
160
- };
161
- var scheduleHoverClose = function () {
162
- clearHoverClose();
163
- hoverCloseTimer.current = window.setTimeout(function () { return popoverSil(); }, hoverCloseDelay);
164
- };
165
- var popoverPosition = function (_a) {
166
- var target = _a.target, position = _a.position;
167
- var popover = popoverRef.current;
168
- if (popover) {
169
- var arrowMargin = arrow ? 5 : 0;
170
- var margin = distance + arrowMargin;
171
- var _b = normalizePosition(position), preferredSide = _b.side, preferredAlign = _b.align;
172
- var targetPosition = target.getBoundingClientRect();
173
- var popoverPosition_1 = popover.getBoundingClientRect();
174
- var style = [];
175
- var side = preferredSide;
176
- if (side === 'top' && targetPosition.top - popoverPosition_1.height - margin < 0)
177
- side = 'bottom';
178
- if (side === 'bottom' && targetPosition.bottom + popoverPosition_1.height + margin > window.innerHeight)
179
- side = 'top';
180
- if (side === 'left' && targetPosition.left - popoverPosition_1.width - margin < 0)
181
- side = 'right';
182
- if (side === 'right' && targetPosition.right + popoverPosition_1.width + margin > window.innerWidth)
183
- side = 'left';
184
- if (side === 'top')
185
- style.push('top:' + (targetPosition.top - popoverPosition_1.height - margin) + 'px');
186
- if (side === 'bottom')
187
- style.push('top:' + (targetPosition.bottom + margin) + 'px');
188
- if (side === 'left')
189
- style.push('left:' + (targetPosition.left - popoverPosition_1.width - margin) + 'px');
190
- if (side === 'right')
191
- style.push('left:' + (targetPosition.right + margin) + 'px');
192
- var alignClass = 'center';
193
- if (side === 'top' || side === 'bottom') {
194
- var _c = resolveHorizontalAlign(preferredAlign, targetPosition, popoverPosition_1), left = _c.left, resolvedAlign = _c.alignClass;
195
- alignClass = resolvedAlign;
196
- style.push('left:' + left + 'px');
197
- }
198
- else {
199
- var _d = resolveVerticalAlign(preferredAlign, targetPosition, popoverPosition_1), top_1 = _d.top, resolvedAlign = _d.alignClass;
200
- alignClass = resolvedAlign;
201
- style.push('top:' + top_1 + 'px');
202
- }
203
- var classNames = ['spopover', index_module_css_1.default.popover, arrow ? index_module_css_1.default.arrow : '', fade ? '' : index_module_css_1.default.noFade, sideClass[side], alignClassMap[alignClass]].filter(Boolean);
204
- popover.className = classNames.join(' ');
205
- popover.setAttribute('style', style.join(';'));
206
- applyArrowColor(popover);
207
- }
208
- };
209
- function applyArrowColor(popoverEl) {
210
- var _a;
211
- if (!arrowColor) {
212
- popoverEl.style.removeProperty('--popover-arrow-color');
213
- return;
214
- }
215
- if (arrowColor === 'auto') {
216
- var targetEl = (_a = popoverEl.firstElementChild) !== null && _a !== void 0 ? _a : popoverEl;
217
- var bg = window.getComputedStyle(targetEl).backgroundColor;
218
- if (bg === 'rgba(0, 0, 0, 0)' || bg === 'transparent') {
219
- var parent_1 = targetEl.parentElement;
220
- if (parent_1)
221
- bg = window.getComputedStyle(parent_1).backgroundColor;
222
- }
223
- if (bg)
224
- popoverEl.style.setProperty('--popover-arrow-color', bg);
225
- return;
226
- }
227
- popoverEl.style.setProperty('--popover-arrow-color', arrowColor);
228
- }
229
- function incrementBodyPopover() {
230
- var body = document.body;
231
- var count = Number(body.dataset.spopoverCount || '0') + 1;
232
- body.dataset.spopoverCount = String(count);
233
- if (count > 0)
234
- body.classList.add('spopover_open');
235
- }
236
- function decrementBodyPopover() {
237
- var body = document.body;
238
- var count = Math.max(0, Number(body.dataset.spopoverCount || '0') - 1);
239
- if (count === 0) {
240
- delete body.dataset.spopoverCount;
241
- body.classList.remove('spopover_open');
242
- }
243
- else {
244
- body.dataset.spopoverCount = String(count);
245
- }
246
- }
247
- function nextPopoverZIndex() {
248
- var body = document.body;
249
- var current = Number(body.dataset.spopoverZIndex || '10000');
250
- var next = current + 1;
251
- body.dataset.spopoverZIndex = String(next);
252
- return next;
253
- }
254
- var componentProps = tslib_1.__assign({ ref: refComponent, onClick: function (e) {
255
- var _a, _b;
256
- (_b = (_a = component.props) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
257
- popoverEkle(e);
258
- } }, other);
259
- if (hover) {
260
- componentProps.onMouseEnter = function (e) {
261
- var _a, _b;
262
- (_b = (_a = component.props) === null || _a === void 0 ? void 0 : _a.onMouseEnter) === null || _b === void 0 ? void 0 : _b.call(_a, e);
263
- clearHoverClose();
264
- popoverEkle(e);
265
- };
266
- componentProps.onMouseLeave = function (e) {
267
- var _a, _b;
268
- (_b = (_a = component.props) === null || _a === void 0 ? void 0 : _a.onMouseLeave) === null || _b === void 0 ? void 0 : _b.call(_a, e);
269
- scheduleHoverClose();
270
- };
271
- }
272
- return (0, react_1.cloneElement)(component, componentProps);
273
- });
274
- var sideClass = {
275
- top: index_module_css_1.default.top,
276
- bottom: index_module_css_1.default.bottom,
277
- left: index_module_css_1.default.left,
278
- right: index_module_css_1.default.right
279
- };
280
- var alignClassMap = {
281
- start: index_module_css_1.default.alignStart,
282
- center: index_module_css_1.default.alignCenter,
283
- end: index_module_css_1.default.alignEnd
284
- };
285
- var FADE_DURATION = 160;
286
- var normalizePosition = function (position) {
287
- var _a = position.split('-'), side = _a[0], rawAlign = _a[1];
288
- if (side === 'top' || side === 'bottom') {
289
- var align_1 = rawAlign === 'left' || rawAlign === 'right' ? rawAlign : 'center';
290
- return { side: side, align: align_1 };
291
- }
292
- var align = rawAlign === 'top' || rawAlign === 'bottom' ? rawAlign : 'center';
293
- return { side: side, align: align };
294
- };
295
- var resolveHorizontalAlign = function (align, target, popover) {
296
- var clamp = 2;
297
- var left = 0;
298
- var alignClass = 'center';
299
- if (align === 'left') {
300
- left = target.left;
301
- alignClass = 'start';
302
- }
303
- else if (align === 'right') {
304
- left = target.right - popover.width;
305
- alignClass = 'end';
306
- }
307
- else {
308
- left = target.left + target.width / 2 - popover.width / 2;
309
- alignClass = 'center';
310
- }
311
- if (left < clamp) {
312
- left = clamp;
313
- alignClass = 'start';
314
- }
315
- else if (left + popover.width > window.innerWidth - clamp) {
316
- left = window.innerWidth - popover.width - clamp;
317
- alignClass = 'end';
318
- }
319
- return { left: left, alignClass: alignClass };
320
- };
321
- var resolveVerticalAlign = function (align, target, popover) {
322
- var clamp = 2;
323
- var top = 0;
324
- var alignClass = 'center';
325
- if (align === 'top') {
326
- top = target.top;
327
- alignClass = 'start';
328
- }
329
- else if (align === 'bottom') {
330
- top = target.bottom - popover.height;
331
- alignClass = 'end';
332
- }
333
- else {
334
- top = target.top + target.height / 2 - popover.height / 2;
335
- alignClass = 'center';
336
- }
337
- if (top < clamp) {
338
- top = clamp;
339
- alignClass = 'start';
340
- }
341
- else if (top + popover.height > window.innerHeight - clamp) {
342
- top = window.innerHeight - popover.height - clamp;
343
- alignClass = 'end';
344
- }
345
- return { top: top, alignClass: alignClass };
346
- };
@@ -1,89 +0,0 @@
1
- .popover {
2
- position: fixed;
3
- display: flex;
4
- align-items: center;
5
- justify-content: center;
6
- z-index: 10000;
7
- opacity: 0;
8
- visibility: hidden;
9
- pointer-events: none;
10
- transition: opacity 160ms ease;
11
- }
12
-
13
- .noFade {
14
- transition: none;
15
- }
16
-
17
- .visible {
18
- opacity: 1;
19
- visibility: visible;
20
- pointer-events: auto;
21
- }
22
-
23
- .closing {
24
- opacity: 0;
25
- }
26
-
27
- .arrow::after {
28
- content: "";
29
- position: absolute;
30
- border-width: 5px;
31
- border-style: solid;
32
- width: 0;
33
- height: 0;
34
- border-color: var(--popover-arrow-color, #757575);
35
- }
36
-
37
- .arrow.top::after {
38
- top: 100%;
39
- border-color: var(--popover-arrow-color, #757575) transparent transparent transparent;
40
- }
41
-
42
- .arrow.bottom::after {
43
- bottom: 100%;
44
- border-color: transparent transparent var(--popover-arrow-color, #757575) transparent;
45
- }
46
-
47
- .arrow.left::after {
48
- left: 100%;
49
- margin-left: -1px;
50
- border-color: transparent transparent transparent var(--popover-arrow-color, #757575);
51
- }
52
-
53
- .arrow.right::after {
54
- right: 100%;
55
- margin-right: -1px;
56
- border-color: transparent var(--popover-arrow-color, #757575) transparent transparent;
57
- }
58
-
59
- .arrow.top.alignStart::after,
60
- .arrow.bottom.alignStart::after {
61
- left: 12px;
62
- }
63
-
64
- .arrow.top.alignCenter::after,
65
- .arrow.bottom.alignCenter::after {
66
- left: 50%;
67
- transform: translateX(-50%);
68
- }
69
-
70
- .arrow.top.alignEnd::after,
71
- .arrow.bottom.alignEnd::after {
72
- right: 12px;
73
- }
74
-
75
- .arrow.left.alignStart::after,
76
- .arrow.right.alignStart::after {
77
- top: 12px;
78
- }
79
-
80
- .arrow.left.alignCenter::after,
81
- .arrow.right.alignCenter::after {
82
- top: 50%;
83
- transform: translateY(-50%);
84
- }
85
-
86
- .arrow.left.alignEnd::after,
87
- .arrow.right.alignEnd::after {
88
- bottom: 12px;
89
- }
@@ -1,11 +0,0 @@
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 {};
@@ -1,122 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Tooltip = void 0;
4
- var tslib_1 = require("tslib");
5
- var react_1 = tslib_1.__importStar(require("react"));
6
- exports.Tooltip = (0, react_1.memo)(function MemoFunction(_a) {
7
- 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 = tslib_1.__rest(_a, ["children", "title", "position", "arrow", "distance"]);
8
- (0, react_1.useEffect)(function () {
9
- if (typeof window === "undefined")
10
- return null;
11
- var cssCheck = document.getElementsByClassName("stooltip_css")[0];
12
- if (!cssCheck) {
13
- var head = document.getElementsByTagName('head')[0];
14
- var s = document.createElement('style');
15
- s.setAttribute('type', 'text/css');
16
- s.classList.add("stooltip_css");
17
- s.appendChild(document.createTextNode(tooltipCss));
18
- head.appendChild(s);
19
- }
20
- return function () { return tooltipSil(); };
21
- }, []);
22
- var tooltipEkle = function (e) {
23
- tooltipSil();
24
- var tooltip = document.createElement("div");
25
- tooltip.innerHTML = title;
26
- tooltip.classList.add("stooltip");
27
- document.body.appendChild(tooltip);
28
- tooltipPosition({ target: e.currentTarget, position: position });
29
- };
30
- var tooltipSil = function () {
31
- var check = document.body.getElementsByClassName("stooltip")[0];
32
- if (check)
33
- check.remove();
34
- };
35
- var tooltipPosition = function (_a) {
36
- var target = _a.target, position = _a.position;
37
- var tooltip = document.body.getElementsByClassName("stooltip")[0];
38
- if (tooltip) {
39
- var arrowMargin = (arrow) ? 5 : 0;
40
- var margin = distance + arrowMargin;
41
- if (arrow)
42
- tooltip.classList.add("arrow");
43
- var targetPosition = target.getBoundingClientRect();
44
- var tooltipPosition_1 = tooltip.getBoundingClientRect();
45
- var style = [];
46
- if (position === "top" || position === "bottom") {
47
- if (position === "top") {
48
- if ((targetPosition.top - tooltipPosition_1.height - margin) < 0) {
49
- style.push("top:" + (targetPosition.bottom + margin) + "px");
50
- tooltip.classList.add("bottom");
51
- }
52
- else {
53
- style.push("top:" + (targetPosition.top - tooltipPosition_1.height - margin) + "px");
54
- tooltip.classList.add("top");
55
- }
56
- }
57
- if (position === "bottom") {
58
- if ((targetPosition.bottom + tooltipPosition_1.height + margin) > window.innerHeight) {
59
- style.push("top:" + (targetPosition.top - tooltipPosition_1.height - margin) + "px");
60
- tooltip.classList.add("top");
61
- }
62
- else {
63
- style.push("top:" + (targetPosition.bottom + margin) + "px");
64
- tooltip.classList.add("bottom");
65
- }
66
- }
67
- // if ((targetPosition.left - tooltipPosition.width) < 0) {
68
- if ((targetPosition.left + (targetPosition.width / 2) - (tooltipPosition_1.width / 2)) < 0) {
69
- style.push("left:2px");
70
- tooltip.classList.add("start");
71
- }
72
- else if ((targetPosition.left + (targetPosition.width / 2) + tooltipPosition_1.width) > window.innerWidth) {
73
- style.push("right:2px");
74
- tooltip.classList.add("end");
75
- }
76
- else {
77
- style.push("left:" + (targetPosition.left + (targetPosition.width / 2)) + "px");
78
- style.push("transform:translate(-50%,0)");
79
- tooltip.classList.add("center");
80
- }
81
- }
82
- if (position === "left" || position === "right") {
83
- if (position === "left") {
84
- if ((targetPosition.left - tooltipPosition_1.width - margin) < 0) {
85
- style.push("left:" + (targetPosition.right + margin) + "px");
86
- tooltip.classList.add("right");
87
- }
88
- else {
89
- style.push("left:" + (targetPosition.left - tooltipPosition_1.width - margin) + "px");
90
- tooltip.classList.add("left");
91
- }
92
- }
93
- if (position === "right") {
94
- if ((targetPosition.left + (targetPosition.width / 2) + tooltipPosition_1.width + margin) > window.innerWidth) {
95
- style.push("left:" + (targetPosition.left - tooltipPosition_1.width - margin) + "px");
96
- tooltip.classList.add("left");
97
- }
98
- else {
99
- style.push("left:" + (targetPosition.right + margin) + "px");
100
- tooltip.classList.add("right");
101
- }
102
- }
103
- if ((targetPosition.top + (targetPosition.height / 2) - (tooltipPosition_1.height / 2)) < 0) {
104
- style.push("top:2px");
105
- tooltip.classList.add("start");
106
- }
107
- else if ((targetPosition.top + (targetPosition.height / 2) + (tooltipPosition_1.height / 2)) > window.innerHeight) {
108
- style.push("bottom:2px");
109
- tooltip.classList.add("end");
110
- }
111
- else {
112
- style.push("top:" + (targetPosition.top + (targetPosition.height / 2)) + "px");
113
- style.push("transform:translate(0,-50%)");
114
- tooltip.classList.add("center");
115
- }
116
- }
117
- tooltip.setAttribute("style", style.join(";"));
118
- }
119
- };
120
- return react_1.default.cloneElement(children, tslib_1.__assign({ onMouseEnter: tooltipEkle, onMouseLeave: tooltipSil, onMouseDown: tooltipSil }, other));
121
- });
122
- 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";