@sydsoft/base 1.50.0 → 1.52.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/_dist/{_lib → esm/_lib}/baseFunctions.js +38 -25
- package/_dist/{_lib → esm/_lib}/inputMask.js +69 -66
- package/_dist/{_lib → esm/_lib}/listFunctions.js +13 -12
- package/_dist/esm/_lib/storage/cookies.js +34 -0
- package/_dist/esm/_lib/storage/encData.js +43 -0
- package/_dist/{_lib → esm/_lib}/storage/localStorage.js +10 -10
- package/_dist/{_lib → esm/_lib}/storage/sessionStorage.js +10 -10
- package/_dist/{_lib → esm/_lib}/useInterval.js +5 -5
- package/_dist/{alert → esm/alert}/index.js +30 -28
- package/_dist/esm/box/Box.js +15 -0
- package/_dist/esm/box/BoxContent.js +7 -0
- package/_dist/esm/box/BoxFooter.js +8 -0
- package/_dist/esm/box/BoxHeader.js +9 -0
- package/_dist/esm/countDown/index.js +97 -0
- package/_dist/{dateTime → esm/dateTime}/index.js +31 -25
- package/_dist/esm/form/Button.js +76 -0
- package/_dist/esm/form/Checkbox.js +23 -0
- package/_dist/esm/form/Dialog.js +40 -0
- package/_dist/esm/form/Form.js +12 -0
- package/_dist/esm/form/FormOlustur.js +52 -0
- package/_dist/{form → esm/form}/Input.js +56 -57
- package/_dist/esm/form/Label.js +9 -0
- package/_dist/esm/form/SearchableInput.js +272 -0
- package/_dist/esm/form/UploadBase.js +86 -0
- package/_dist/esm/grid/index.js +97 -0
- package/_dist/{icon → esm/icon}/icons.js +1 -1
- package/_dist/esm/icon/index.js +26 -0
- package/_dist/esm/menu/index.js +52 -0
- package/_dist/esm/modal/index.js +66 -0
- package/_dist/{popover → esm/popover}/index.js +100 -100
- package/_dist/esm/tooltip/index.js +119 -0
- package/package.json +8 -9
- package/_dist/_lib/storage/cookies.js +0 -33
- package/_dist/_lib/storage/encData.js +0 -41
- package/_dist/box/Box.js +0 -14
- package/_dist/box/BoxContent.js +0 -5
- package/_dist/box/BoxFooter.js +0 -10
- package/_dist/box/BoxHeader.js +0 -10
- package/_dist/countDown/index.js +0 -92
- package/_dist/form/Button.js +0 -82
- package/_dist/form/Checkbox.js +0 -22
- package/_dist/form/Dialog.js +0 -53
- package/_dist/form/Form.js +0 -10
- package/_dist/form/FormOlustur.js +0 -50
- package/_dist/form/Label.js +0 -7
- package/_dist/form/SearchableInput.js +0 -260
- package/_dist/form/UploadBase.js +0 -84
- package/_dist/grid/index.js +0 -96
- package/_dist/icon/index.js +0 -34
- package/_dist/menu/index.js +0 -50
- package/_dist/modal/index.js +0 -64
- package/_dist/tooltip/index.js +0 -202
- /package/_dist/{_lib → esm/_lib}/baseFunctions.d.ts +0 -0
- /package/_dist/{_lib → esm/_lib}/inputMask.d.ts +0 -0
- /package/_dist/{_lib → esm/_lib}/listFunctions.d.ts +0 -0
- /package/_dist/{_lib → esm/_lib}/storage/cookies.d.ts +0 -0
- /package/_dist/{_lib → esm/_lib}/storage/encData.d.ts +0 -0
- /package/_dist/{_lib → esm/_lib}/storage/localStorage.d.ts +0 -0
- /package/_dist/{_lib → esm/_lib}/storage/sessionStorage.d.ts +0 -0
- /package/_dist/{_lib → esm/_lib}/useInterval.d.ts +0 -0
- /package/_dist/{alert → esm/alert}/index.d.ts +0 -0
- /package/_dist/{alert → esm/alert}/index.module.css +0 -0
- /package/_dist/{box → esm/box}/Box.d.ts +0 -0
- /package/_dist/{box → esm/box}/Box.module.css +0 -0
- /package/_dist/{box → esm/box}/BoxContent.d.ts +0 -0
- /package/_dist/{box → esm/box}/BoxFooter.d.ts +0 -0
- /package/_dist/{box → esm/box}/BoxHeader.d.ts +0 -0
- /package/_dist/{box → esm/box}/index.d.ts +0 -0
- /package/_dist/{box → esm/box}/index.js +0 -0
- /package/_dist/{countDown → esm/countDown}/index.d.ts +0 -0
- /package/_dist/{dateTime → esm/dateTime}/index.d.ts +0 -0
- /package/_dist/{form → esm/form}/Button.d.ts +0 -0
- /package/_dist/{form → esm/form}/Checkbox.d.ts +0 -0
- /package/_dist/{form → esm/form}/Dialog.d.ts +0 -0
- /package/_dist/{form → esm/form}/Form.d.ts +0 -0
- /package/_dist/{form → esm/form}/FormOlustur.d.ts +0 -0
- /package/_dist/{form → esm/form}/Input.d.ts +0 -0
- /package/_dist/{form → esm/form}/Label.d.ts +0 -0
- /package/_dist/{form → esm/form}/SearchableInput.d.ts +0 -0
- /package/_dist/{form → esm/form}/UploadBase.d.ts +0 -0
- /package/_dist/{form → esm/form}/index.d.ts +0 -0
- /package/_dist/{form → esm/form}/index.js +0 -0
- /package/_dist/{form → esm/form}/styles/Button.module.css +0 -0
- /package/_dist/{form → esm/form}/styles/Input.module.css +0 -0
- /package/_dist/{form → esm/form}/styles/Label.module.css +0 -0
- /package/_dist/{form → esm/form}/styles/SearchableInput.module.css +0 -0
- /package/_dist/{grid → esm/grid}/index.d.ts +0 -0
- /package/_dist/{grid → esm/grid}/index.module.css +0 -0
- /package/_dist/{icon → esm/icon}/icons.d.ts +0 -0
- /package/_dist/{icon → esm/icon}/index.d.ts +0 -0
- /package/_dist/{icon → esm/icon}/mui.d.ts +0 -0
- /package/_dist/{icon → esm/icon}/mui.js +0 -0
- /package/_dist/{index.d.ts → esm/index.d.ts} +0 -0
- /package/_dist/{index.js → esm/index.js} +0 -0
- /package/_dist/{menu → esm/menu}/index.d.ts +0 -0
- /package/_dist/{menu → esm/menu}/index.module.css +0 -0
- /package/_dist/{modal → esm/modal}/index.d.ts +0 -0
- /package/_dist/{modal → esm/modal}/index.module.css +0 -0
- /package/_dist/{popover → esm/popover}/index.d.ts +0 -0
- /package/_dist/{popover → esm/popover}/index.module.css +0 -0
- /package/_dist/{tooltip → esm/tooltip}/index.d.ts +0 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { __assign, __rest, __spreadArray } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import styles from './index.module.css';
|
|
5
|
+
export var Row = function (_a) {
|
|
6
|
+
var children = _a.children, _b = _a.className, className = _b === void 0 ? '' : _b, style = _a.style, _c = _a.flexDirection, flexDirection = _c === void 0 ? 'row' : _c, _d = _a.flexWrap, flexWrap = _d === void 0 ? 'wrap' : _d, _e = _a.justifyContent, justifyContent = _e === void 0 ? 'flex-start' : _e, _f = _a.alignContent, alignContent = _f === void 0 ? 'center' : _f, _g = _a.alignItems, alignItems = _g === void 0 ? 'center' : _g, _h = _a.rowSpacing, rowSpacing = _h === void 0 ? 2 : _h, _j = _a.colSpacing, colSpacing = _j === void 0 ? 2 : _j, other = __rest(_a, ["children", "className", "style", "flexDirection", "flexWrap", "justifyContent", "alignContent", "alignItems", "rowSpacing", "colSpacing"]);
|
|
7
|
+
var classes = [
|
|
8
|
+
styles.row,
|
|
9
|
+
rowSpacing !== undefined && styles["row-spacing-".concat(rowSpacing)],
|
|
10
|
+
colSpacing !== undefined && styles["col-spacing-".concat(colSpacing)],
|
|
11
|
+
flexDirection !== 'row' && styles["flex-".concat(flexDirection.replace('-', '-'))],
|
|
12
|
+
flexWrap !== 'wrap' && styles["flex-".concat(flexWrap)],
|
|
13
|
+
justifyContent !== 'flex-start' && styles["justify-".concat(justifyContent.replace('flex-', '').replace('space-', ''))],
|
|
14
|
+
alignItems !== 'center' && styles["align-items-".concat(alignItems.replace('flex-', ''))],
|
|
15
|
+
alignContent !== 'center' && styles["align-content-".concat(alignContent.replace('flex-', ''))],
|
|
16
|
+
className
|
|
17
|
+
]
|
|
18
|
+
.filter(Boolean)
|
|
19
|
+
.join(' ');
|
|
20
|
+
return (_jsx("div", __assign({ className: classes, style: style }, other, { children: children })));
|
|
21
|
+
};
|
|
22
|
+
export var Col = function (_a) {
|
|
23
|
+
// Cascading logic - aynı sizin component'inizdeki gibi
|
|
24
|
+
var children = _a.children, _b = _a.className, className = _b === void 0 ? '' : _b, style = _a.style, xs = _a.xs, sm = _a.sm, md = _a.md, lg = _a.lg, xl = _a.xl, xxl = _a.xxl, other = __rest(_a, ["children", "className", "style", "xs", "sm", "md", "lg", "xl", "xxl"]);
|
|
25
|
+
var classes = [
|
|
26
|
+
styles.col,
|
|
27
|
+
// Sadece belirtilen breakpoint'ler için class ekle
|
|
28
|
+
xs && styles["col-xs-".concat(xs)],
|
|
29
|
+
sm && styles["col-sm-".concat(sm)],
|
|
30
|
+
md && styles["col-md-".concat(md)],
|
|
31
|
+
lg && styles["col-lg-".concat(lg)],
|
|
32
|
+
xl && styles["col-xl-".concat(xl)],
|
|
33
|
+
xxl && styles["col-xxl-".concat(xxl)],
|
|
34
|
+
className
|
|
35
|
+
]
|
|
36
|
+
.filter(Boolean)
|
|
37
|
+
.join(' ');
|
|
38
|
+
return (_jsx("div", __assign({ className: classes, style: style }, other, { children: children })));
|
|
39
|
+
};
|
|
40
|
+
export var Hidden = function (_a) {
|
|
41
|
+
var children = _a.children, hidden = _a.hidden, onlyHidden = _a.onlyHidden, other = __rest(_a, ["children", "hidden", "onlyHidden"]);
|
|
42
|
+
var existingClassName = children.props.className || '';
|
|
43
|
+
var hiddenClasses = [];
|
|
44
|
+
if (onlyHidden) {
|
|
45
|
+
onlyHidden.forEach(function (breakpoint) {
|
|
46
|
+
hiddenClasses.push(styles["hidden-".concat(breakpoint)]);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else if (hidden) {
|
|
50
|
+
// Orijinal mantık: seçilen breakpoint ve altındaki tüm breakpoint'ler gizlenir
|
|
51
|
+
var breakpoints = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
52
|
+
var targetIndex = breakpoints.indexOf(hidden);
|
|
53
|
+
if (targetIndex !== -1) {
|
|
54
|
+
for (var i = 0; i <= targetIndex; i++) {
|
|
55
|
+
hiddenClasses.push(styles["hidden-".concat(breakpoints[i])]);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
var newClassName = __spreadArray([existingClassName], hiddenClasses, true).filter(Boolean).join(' ');
|
|
60
|
+
return React.cloneElement(children, __assign({ className: newClassName }, other));
|
|
61
|
+
};
|
|
62
|
+
export var DevelopGridComponent = function () {
|
|
63
|
+
var _a = useState(''), currentBreakpoint = _a[0], setCurrentBreakpoint = _a[1];
|
|
64
|
+
// Breakpoint detector
|
|
65
|
+
React.useEffect(function () {
|
|
66
|
+
var updateBreakpoint = function () {
|
|
67
|
+
var width = window.innerWidth;
|
|
68
|
+
var breakpoint = '';
|
|
69
|
+
if (width <= 576)
|
|
70
|
+
breakpoint = 'XS (≤576px)';
|
|
71
|
+
else if (width <= 768)
|
|
72
|
+
breakpoint = 'SM (577-768px)';
|
|
73
|
+
else if (width <= 992)
|
|
74
|
+
breakpoint = 'MD (769-992px)';
|
|
75
|
+
else if (width <= 1200)
|
|
76
|
+
breakpoint = 'LG (993-1200px)';
|
|
77
|
+
else if (width <= 1400)
|
|
78
|
+
breakpoint = 'XL (1201-1400px)';
|
|
79
|
+
else
|
|
80
|
+
breakpoint = 'XXL (≥1401px)';
|
|
81
|
+
setCurrentBreakpoint(breakpoint);
|
|
82
|
+
};
|
|
83
|
+
updateBreakpoint();
|
|
84
|
+
window.addEventListener('resize', updateBreakpoint);
|
|
85
|
+
return function () { return window.removeEventListener('resize', updateBreakpoint); };
|
|
86
|
+
}, []);
|
|
87
|
+
return (_jsxs("div", { style: {
|
|
88
|
+
position: 'fixed',
|
|
89
|
+
bottom: '10px',
|
|
90
|
+
right: '10px',
|
|
91
|
+
background: '#333',
|
|
92
|
+
color: 'white',
|
|
93
|
+
padding: '10px',
|
|
94
|
+
borderRadius: '4px',
|
|
95
|
+
zIndex: 9999999
|
|
96
|
+
}, children: ["Current: ", currentBreakpoint] }));
|
|
97
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export
|
|
2
|
+
export var iconMap = {
|
|
3
3
|
close: {
|
|
4
4
|
viewBox: '0 -960 960 960',
|
|
5
5
|
content: (_jsx(_Fragment, { children: _jsx("path", { d: "m336-280-56-56 144-144-144-143 56-56 144 144 143-144 56 56-144 143 144 144-56 56-143-144-144 144Z" }) }))
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { iconMap } from './icons';
|
|
4
|
+
export var iconList = Object.keys(iconMap);
|
|
5
|
+
var defaultIconStyle = {
|
|
6
|
+
userSelect: 'none',
|
|
7
|
+
width: '1em',
|
|
8
|
+
height: '1em',
|
|
9
|
+
// display: 'inline-block',
|
|
10
|
+
verticalAlign: 'middle',
|
|
11
|
+
flexShrink: 0,
|
|
12
|
+
display: 'flex',
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
justifyContent: 'center'
|
|
15
|
+
};
|
|
16
|
+
export var Icon = function (_a) {
|
|
17
|
+
var name = _a.name, iconMui = _a.iconMui, customIcon = _a.customIcon, fontSize = _a.fontSize, color = _a.color, className = _a.className, style = _a.style, other = __rest(_a, ["name", "iconMui", "customIcon", "fontSize", "color", "className", "style"]);
|
|
18
|
+
if (iconMui) {
|
|
19
|
+
return (_jsx("span", __assign({ className: "material-icons ".concat(className || ''), style: __assign(__assign(__assign({}, defaultIconStyle), style), { fontSize: fontSize || '1.3rem', color: color || 'inherit' }), "aria-hidden": "true" }, other, { children: iconMui })));
|
|
20
|
+
}
|
|
21
|
+
var iconComponent = name ? iconMap[name] : customIcon;
|
|
22
|
+
if (!iconComponent) {
|
|
23
|
+
return _jsx("span", { children: "\u26A0\uFE0F" });
|
|
24
|
+
}
|
|
25
|
+
return (_jsx("span", __assign({ className: className, style: __assign(__assign(__assign({}, defaultIconStyle), style), { fontSize: fontSize || '1.5rem', color: color || 'inherit' }) }, other, { children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: iconComponent.viewBox, fill: 'currentColor', width: "1em", height: "1em", style: { display: 'block', flexShrink: 0 }, children: iconComponent.content }) })));
|
|
26
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* @author : izzetseydaoglu
|
|
5
|
+
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
6
|
+
* @version : 2026-02-07 19:31:01
|
|
7
|
+
*/
|
|
8
|
+
import React, { memo, useMemo } from 'react';
|
|
9
|
+
import { Dialog } from '../form';
|
|
10
|
+
import { Popover } from '../popover';
|
|
11
|
+
import Link from 'next/link';
|
|
12
|
+
import styles from './index.module.css';
|
|
13
|
+
export var Menu = memo(function MemoFunction(_a) {
|
|
14
|
+
var menu = _a.menu, className = _a.className, style = _a.style, _b = _a.withIcon, withIcon = _b === void 0 ? 'auto' : _b;
|
|
15
|
+
var withIconComponent = useMemo(function () {
|
|
16
|
+
if (withIcon === true)
|
|
17
|
+
return true;
|
|
18
|
+
if (withIcon === false)
|
|
19
|
+
return false;
|
|
20
|
+
return Object.values(menu).some(function (item) { return 'icon' in item && !!item.icon; });
|
|
21
|
+
}, [menu, withIcon]);
|
|
22
|
+
var withRightComponent = useMemo(function () {
|
|
23
|
+
return Object.values(menu).some(function (item) { return 'rightComponent' in item && !!item.rightComponent; });
|
|
24
|
+
}, [menu]);
|
|
25
|
+
var handleClick = function (item, e) {
|
|
26
|
+
if (!item.onClick)
|
|
27
|
+
return;
|
|
28
|
+
if (item.dialog) {
|
|
29
|
+
Dialog(__assign({}, item.dialog)).then(function (result) {
|
|
30
|
+
if (result && item.onClick) {
|
|
31
|
+
item.onClick(e);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
item.onClick(e);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
return (_jsx("ul", { className: "smenu ".concat(styles.ul, " ").concat(className || ''), style: style, children: Object.values(menu).map(function (item, key) {
|
|
40
|
+
var _a = item, fullComponent = _a.fullComponent, icon = _a.icon, title = _a.title, rightComponent = _a.rightComponent, seperator = _a.seperator, href = _a.href, style = _a.style, itemProps = _a.itemProps, type = _a.type, items = _a.items, menuProps = _a.menuProps, subMenuPopoverProps = _a.subMenuPopoverProps, other = __rest(_a, ["fullComponent", "icon", "title", "rightComponent", "seperator", "href", "style", "itemProps", "type", "items", "menuProps", "subMenuPopoverProps"]);
|
|
41
|
+
var hasSubmenu = type === 'submenu' && Array.isArray(items) && items.length > 0;
|
|
42
|
+
if (fullComponent)
|
|
43
|
+
return React.cloneElement(fullComponent, { key: key });
|
|
44
|
+
if (seperator)
|
|
45
|
+
return _jsx("li", __assign({ className: styles.seperator, style: style }, itemProps, other), key);
|
|
46
|
+
var Component = (_jsxs(_Fragment, { children: [withIconComponent && _jsx("div", { className: styles.menuicon, children: icon }), _jsx("div", { className: styles.menutitle, children: title }), withRightComponent && _jsx("div", { className: styles.rightmenu, children: rightComponent })] }));
|
|
47
|
+
if (hasSubmenu) {
|
|
48
|
+
return (_jsx(Popover, __assign({ component: _jsx("li", __assign({ style: style }, itemProps, other, { children: Component })), position: "right-top" }, (subMenuPopoverProps || {}), { children: _jsx(Menu, __assign({ menu: items }, (menuProps || {}))) }), key));
|
|
49
|
+
}
|
|
50
|
+
return (_jsx("li", __assign({ style: style, onClick: function (e) { return handleClick(item, e); } }, itemProps, other, { children: href ? _jsx(Link, { href: href, children: Component }) : Component }), key));
|
|
51
|
+
}) }));
|
|
52
|
+
});
|
|
@@ -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: "smodal ".concat(styles.modal, " ").concat(fullScreen ? styles.fullscreen : ""), style: modalStyle, children: [!hideCloseButton && (_jsx("div", { className: "close ".concat(styles.close_fixed), children: _jsx("div", { className: styles.close, onClick: onClose, children: "\u2715" }) })), children] }) }));
|
|
65
|
+
return modalDiv ? ReactDOM.createPortal(Component, modalDiv) : null;
|
|
66
|
+
});
|
|
@@ -3,25 +3,27 @@
|
|
|
3
3
|
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
4
4
|
* @version : 2026-02-10 16:12:35
|
|
5
5
|
*/
|
|
6
|
+
import { __assign, __rest } from "tslib";
|
|
6
7
|
import { cloneElement, memo, useEffect, useRef } from 'react';
|
|
7
8
|
import { createRoot } from 'react-dom/client';
|
|
8
9
|
import styles from './index.module.css';
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
export var Popover = memo(function MemoFunction(_a) {
|
|
11
|
+
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 = __rest(_a, ["children", "component", "position", "arrow", "distance", "removeWhenClickInside", "hideBackdrop", "fade", "arrowColor", "hover", "hoverCloseDelay", "keepMounted"]);
|
|
12
|
+
var refComponent = useRef(null);
|
|
13
|
+
var closeTimer = useRef(null);
|
|
14
|
+
var hoverCloseTimer = useRef(null);
|
|
15
|
+
var popoverRef = useRef(null);
|
|
16
|
+
var rootRef = useRef(null);
|
|
17
|
+
var zIndexRef = useRef(null);
|
|
18
|
+
useEffect(function () {
|
|
17
19
|
if (typeof window === 'undefined')
|
|
18
20
|
return;
|
|
19
|
-
return ()
|
|
21
|
+
return function () {
|
|
20
22
|
popoverSil(false);
|
|
21
23
|
};
|
|
22
24
|
}, []);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
var checkHideBackDrop = function (e) {
|
|
26
|
+
var spopover = popoverRef.current;
|
|
25
27
|
if (!spopover)
|
|
26
28
|
return;
|
|
27
29
|
if (!((e === null || e === void 0 ? void 0 : e.target) instanceof Node)) {
|
|
@@ -31,50 +33,50 @@ export const Popover = memo(function MemoFunction({ children, component, positio
|
|
|
31
33
|
if (!spopover.contains(e.target))
|
|
32
34
|
popoverSil();
|
|
33
35
|
};
|
|
34
|
-
|
|
36
|
+
var popoverEkle = function (e) {
|
|
35
37
|
var _a, _b;
|
|
36
38
|
if (popoverRef.current && keepMounted) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
var popover_1 = popoverRef.current;
|
|
40
|
+
var target_1 = e.currentTarget;
|
|
41
|
+
var wasVisible = popover_1.classList.contains(styles.visible);
|
|
40
42
|
(_b = (_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.render) === null || _b === void 0 ? void 0 : _b.call(_a, children);
|
|
41
|
-
applyArrowColor(
|
|
42
|
-
popoverPosition({ target, position: position });
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
applyArrowColor(popover_1);
|
|
44
|
+
popoverPosition({ target: target_1, position: position });
|
|
45
|
+
popover_1.style.zIndex = String(nextPopoverZIndex());
|
|
46
|
+
popover_1.classList.remove(styles.closing);
|
|
47
|
+
popover_1.classList.add(styles.visible);
|
|
46
48
|
if (!wasVisible) {
|
|
47
49
|
if (hideBackdrop) {
|
|
48
50
|
window.addEventListener('mousedown', checkHideBackDrop);
|
|
49
51
|
window.addEventListener('blur', checkHideBackDrop);
|
|
50
52
|
}
|
|
51
53
|
if (removeWhenClickInside)
|
|
52
|
-
|
|
54
|
+
popover_1.addEventListener('mouseup', popoverGecikmeliSil);
|
|
53
55
|
if (hover) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
popover_1.addEventListener('mouseenter', clearHoverClose);
|
|
57
|
+
popover_1.addEventListener('mouseleave', scheduleHoverClose);
|
|
56
58
|
}
|
|
57
59
|
incrementBodyPopover();
|
|
58
60
|
}
|
|
59
61
|
return;
|
|
60
62
|
}
|
|
61
63
|
popoverSil(false);
|
|
62
|
-
|
|
64
|
+
var popover = document.createElement('div');
|
|
63
65
|
popover.classList.add('spopover', styles.popover);
|
|
64
|
-
|
|
66
|
+
var zIndex = nextPopoverZIndex();
|
|
65
67
|
zIndexRef.current = zIndex;
|
|
66
68
|
document.body.appendChild(popover);
|
|
67
69
|
// ReactDOM.render(children, popover)
|
|
68
|
-
|
|
70
|
+
var root = createRoot(popover);
|
|
69
71
|
root.render(children);
|
|
70
72
|
popoverRef.current = popover;
|
|
71
73
|
rootRef.current = root;
|
|
72
|
-
|
|
74
|
+
var target = e.currentTarget;
|
|
73
75
|
refComponent.current && refComponent.current.classList.add('spopover_active');
|
|
74
|
-
setTimeout(()
|
|
76
|
+
setTimeout(function () {
|
|
75
77
|
var _a;
|
|
76
78
|
applyArrowColor(popover);
|
|
77
|
-
popoverPosition({ target, position: position });
|
|
79
|
+
popoverPosition({ target: target, position: position });
|
|
78
80
|
popover.style.zIndex = String((_a = zIndexRef.current) !== null && _a !== void 0 ? _a : zIndex);
|
|
79
81
|
popover.classList.add(styles.visible);
|
|
80
82
|
}, 100);
|
|
@@ -90,10 +92,11 @@ export const Popover = memo(function MemoFunction({ children, component, positio
|
|
|
90
92
|
}
|
|
91
93
|
incrementBodyPopover();
|
|
92
94
|
};
|
|
93
|
-
|
|
95
|
+
var popoverSil = function (animate) {
|
|
96
|
+
if (animate === void 0) { animate = true; }
|
|
94
97
|
refComponent.current && refComponent.current.classList.remove('spopover_active');
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
var check = popoverRef.current;
|
|
99
|
+
var wasVisible = !!(check === null || check === void 0 ? void 0 : check.classList.contains(styles.visible));
|
|
97
100
|
if (check) {
|
|
98
101
|
if (removeWhenClickInside)
|
|
99
102
|
check.removeEventListener('mouseup', popoverGecikmeliSil);
|
|
@@ -107,10 +110,10 @@ export const Popover = memo(function MemoFunction({ children, component, positio
|
|
|
107
110
|
window.clearTimeout(hoverCloseTimer.current);
|
|
108
111
|
if (!fade || !animate) {
|
|
109
112
|
if (!keepMounted) {
|
|
110
|
-
|
|
111
|
-
window.setTimeout(()
|
|
113
|
+
var root_1 = rootRef.current;
|
|
114
|
+
window.setTimeout(function () {
|
|
112
115
|
var _a;
|
|
113
|
-
(_a =
|
|
116
|
+
(_a = root_1 === null || root_1 === void 0 ? void 0 : root_1.unmount) === null || _a === void 0 ? void 0 : _a.call(root_1);
|
|
114
117
|
}, 0);
|
|
115
118
|
check.remove();
|
|
116
119
|
popoverRef.current = null;
|
|
@@ -123,10 +126,10 @@ export const Popover = memo(function MemoFunction({ children, component, positio
|
|
|
123
126
|
}
|
|
124
127
|
else if (!check.classList.contains(styles.closing)) {
|
|
125
128
|
check.classList.add(styles.closing);
|
|
126
|
-
closeTimer.current = window.setTimeout(()
|
|
129
|
+
closeTimer.current = window.setTimeout(function () {
|
|
127
130
|
var _a;
|
|
128
131
|
if (!keepMounted) {
|
|
129
|
-
|
|
132
|
+
var root = rootRef.current;
|
|
130
133
|
(_a = root === null || root === void 0 ? void 0 : root.unmount) === null || _a === void 0 ? void 0 : _a.call(root);
|
|
131
134
|
check.remove();
|
|
132
135
|
popoverRef.current = null;
|
|
@@ -146,54 +149,55 @@ export const Popover = memo(function MemoFunction({ children, component, positio
|
|
|
146
149
|
if (wasVisible)
|
|
147
150
|
decrementBodyPopover();
|
|
148
151
|
};
|
|
149
|
-
|
|
150
|
-
|
|
152
|
+
var popoverGecikmeliSil = function () { return setTimeout(function () { return popoverSil(); }, 100); };
|
|
153
|
+
var clearHoverClose = function () {
|
|
151
154
|
if (hoverCloseTimer.current)
|
|
152
155
|
window.clearTimeout(hoverCloseTimer.current);
|
|
153
156
|
hoverCloseTimer.current = null;
|
|
154
157
|
};
|
|
155
|
-
|
|
158
|
+
var scheduleHoverClose = function () {
|
|
156
159
|
clearHoverClose();
|
|
157
|
-
hoverCloseTimer.current = window.setTimeout(()
|
|
160
|
+
hoverCloseTimer.current = window.setTimeout(function () { return popoverSil(); }, hoverCloseDelay);
|
|
158
161
|
};
|
|
159
|
-
|
|
160
|
-
|
|
162
|
+
var popoverPosition = function (_a) {
|
|
163
|
+
var target = _a.target, position = _a.position;
|
|
164
|
+
var popover = popoverRef.current;
|
|
161
165
|
if (popover) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
if (side === 'top' && targetPosition.top -
|
|
166
|
+
var arrowMargin = arrow ? 5 : 0;
|
|
167
|
+
var margin = distance + arrowMargin;
|
|
168
|
+
var _b = normalizePosition(position), preferredSide = _b.side, preferredAlign = _b.align;
|
|
169
|
+
var targetPosition = target.getBoundingClientRect();
|
|
170
|
+
var popoverPosition_1 = popover.getBoundingClientRect();
|
|
171
|
+
var style = [];
|
|
172
|
+
var side = preferredSide;
|
|
173
|
+
if (side === 'top' && targetPosition.top - popoverPosition_1.height - margin < 0)
|
|
170
174
|
side = 'bottom';
|
|
171
|
-
if (side === 'bottom' && targetPosition.bottom +
|
|
175
|
+
if (side === 'bottom' && targetPosition.bottom + popoverPosition_1.height + margin > window.innerHeight)
|
|
172
176
|
side = 'top';
|
|
173
|
-
if (side === 'left' && targetPosition.left -
|
|
177
|
+
if (side === 'left' && targetPosition.left - popoverPosition_1.width - margin < 0)
|
|
174
178
|
side = 'right';
|
|
175
|
-
if (side === 'right' && targetPosition.right +
|
|
179
|
+
if (side === 'right' && targetPosition.right + popoverPosition_1.width + margin > window.innerWidth)
|
|
176
180
|
side = 'left';
|
|
177
181
|
if (side === 'top')
|
|
178
|
-
style.push('top:' + (targetPosition.top -
|
|
182
|
+
style.push('top:' + (targetPosition.top - popoverPosition_1.height - margin) + 'px');
|
|
179
183
|
if (side === 'bottom')
|
|
180
184
|
style.push('top:' + (targetPosition.bottom + margin) + 'px');
|
|
181
185
|
if (side === 'left')
|
|
182
|
-
style.push('left:' + (targetPosition.left -
|
|
186
|
+
style.push('left:' + (targetPosition.left - popoverPosition_1.width - margin) + 'px');
|
|
183
187
|
if (side === 'right')
|
|
184
188
|
style.push('left:' + (targetPosition.right + margin) + 'px');
|
|
185
|
-
|
|
189
|
+
var alignClass = 'center';
|
|
186
190
|
if (side === 'top' || side === 'bottom') {
|
|
187
|
-
|
|
191
|
+
var _c = resolveHorizontalAlign(preferredAlign, targetPosition, popoverPosition_1), left = _c.left, resolvedAlign = _c.alignClass;
|
|
188
192
|
alignClass = resolvedAlign;
|
|
189
193
|
style.push('left:' + left + 'px');
|
|
190
194
|
}
|
|
191
195
|
else {
|
|
192
|
-
|
|
196
|
+
var _d = resolveVerticalAlign(preferredAlign, targetPosition, popoverPosition_1), top_1 = _d.top, resolvedAlign = _d.alignClass;
|
|
193
197
|
alignClass = resolvedAlign;
|
|
194
|
-
style.push('top:' +
|
|
198
|
+
style.push('top:' + top_1 + 'px');
|
|
195
199
|
}
|
|
196
|
-
|
|
200
|
+
var classNames = ['spopover', styles.popover, arrow ? styles.arrow : '', fade ? '' : styles.noFade, sideClass[side], alignClassMap[alignClass]].filter(Boolean);
|
|
197
201
|
popover.className = classNames.join(' ');
|
|
198
202
|
popover.setAttribute('style', style.join(';'));
|
|
199
203
|
applyArrowColor(popover);
|
|
@@ -206,12 +210,12 @@ export const Popover = memo(function MemoFunction({ children, component, positio
|
|
|
206
210
|
return;
|
|
207
211
|
}
|
|
208
212
|
if (arrowColor === 'auto') {
|
|
209
|
-
|
|
210
|
-
|
|
213
|
+
var targetEl = (_a = popoverEl.firstElementChild) !== null && _a !== void 0 ? _a : popoverEl;
|
|
214
|
+
var bg = window.getComputedStyle(targetEl).backgroundColor;
|
|
211
215
|
if (bg === 'rgba(0, 0, 0, 0)' || bg === 'transparent') {
|
|
212
|
-
|
|
213
|
-
if (
|
|
214
|
-
bg = window.getComputedStyle(
|
|
216
|
+
var parent_1 = targetEl.parentElement;
|
|
217
|
+
if (parent_1)
|
|
218
|
+
bg = window.getComputedStyle(parent_1).backgroundColor;
|
|
215
219
|
}
|
|
216
220
|
if (bg)
|
|
217
221
|
popoverEl.style.setProperty('--popover-arrow-color', bg);
|
|
@@ -220,15 +224,15 @@ export const Popover = memo(function MemoFunction({ children, component, positio
|
|
|
220
224
|
popoverEl.style.setProperty('--popover-arrow-color', arrowColor);
|
|
221
225
|
}
|
|
222
226
|
function incrementBodyPopover() {
|
|
223
|
-
|
|
224
|
-
|
|
227
|
+
var body = document.body;
|
|
228
|
+
var count = Number(body.dataset.spopoverCount || '0') + 1;
|
|
225
229
|
body.dataset.spopoverCount = String(count);
|
|
226
230
|
if (count > 0)
|
|
227
231
|
body.classList.add('spopover_open');
|
|
228
232
|
}
|
|
229
233
|
function decrementBodyPopover() {
|
|
230
|
-
|
|
231
|
-
|
|
234
|
+
var body = document.body;
|
|
235
|
+
var count = Math.max(0, Number(body.dataset.spopoverCount || '0') - 1);
|
|
232
236
|
if (count === 0) {
|
|
233
237
|
delete body.dataset.spopoverCount;
|
|
234
238
|
body.classList.remove('spopover_open');
|
|
@@ -238,29 +242,25 @@ export const Popover = memo(function MemoFunction({ children, component, positio
|
|
|
238
242
|
}
|
|
239
243
|
}
|
|
240
244
|
function nextPopoverZIndex() {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
245
|
+
var body = document.body;
|
|
246
|
+
var current = Number(body.dataset.spopoverZIndex || '10000');
|
|
247
|
+
var next = current + 1;
|
|
244
248
|
body.dataset.spopoverZIndex = String(next);
|
|
245
249
|
return next;
|
|
246
250
|
}
|
|
247
|
-
|
|
248
|
-
ref: refComponent,
|
|
249
|
-
onClick: (e) => {
|
|
251
|
+
var componentProps = __assign({ ref: refComponent, onClick: function (e) {
|
|
250
252
|
var _a, _b;
|
|
251
253
|
(_b = (_a = component.props) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
252
254
|
popoverEkle(e);
|
|
253
|
-
},
|
|
254
|
-
...other
|
|
255
|
-
};
|
|
255
|
+
} }, other);
|
|
256
256
|
if (hover) {
|
|
257
|
-
componentProps.onMouseEnter = (e)
|
|
257
|
+
componentProps.onMouseEnter = function (e) {
|
|
258
258
|
var _a, _b;
|
|
259
259
|
(_b = (_a = component.props) === null || _a === void 0 ? void 0 : _a.onMouseEnter) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
260
260
|
clearHoverClose();
|
|
261
261
|
popoverEkle(e);
|
|
262
262
|
};
|
|
263
|
-
componentProps.onMouseLeave = (e)
|
|
263
|
+
componentProps.onMouseLeave = function (e) {
|
|
264
264
|
var _a, _b;
|
|
265
265
|
(_b = (_a = component.props) === null || _a === void 0 ? void 0 : _a.onMouseLeave) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
266
266
|
scheduleHoverClose();
|
|
@@ -268,31 +268,31 @@ export const Popover = memo(function MemoFunction({ children, component, positio
|
|
|
268
268
|
}
|
|
269
269
|
return cloneElement(component, componentProps);
|
|
270
270
|
});
|
|
271
|
-
|
|
271
|
+
var sideClass = {
|
|
272
272
|
top: styles.top,
|
|
273
273
|
bottom: styles.bottom,
|
|
274
274
|
left: styles.left,
|
|
275
275
|
right: styles.right
|
|
276
276
|
};
|
|
277
|
-
|
|
277
|
+
var alignClassMap = {
|
|
278
278
|
start: styles.alignStart,
|
|
279
279
|
center: styles.alignCenter,
|
|
280
280
|
end: styles.alignEnd
|
|
281
281
|
};
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
282
|
+
var FADE_DURATION = 160;
|
|
283
|
+
var normalizePosition = function (position) {
|
|
284
|
+
var _a = position.split('-'), side = _a[0], rawAlign = _a[1];
|
|
285
285
|
if (side === 'top' || side === 'bottom') {
|
|
286
|
-
|
|
287
|
-
return { side, align };
|
|
286
|
+
var align_1 = rawAlign === 'left' || rawAlign === 'right' ? rawAlign : 'center';
|
|
287
|
+
return { side: side, align: align_1 };
|
|
288
288
|
}
|
|
289
|
-
|
|
290
|
-
return { side, align };
|
|
289
|
+
var align = rawAlign === 'top' || rawAlign === 'bottom' ? rawAlign : 'center';
|
|
290
|
+
return { side: side, align: align };
|
|
291
291
|
};
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
292
|
+
var resolveHorizontalAlign = function (align, target, popover) {
|
|
293
|
+
var clamp = 2;
|
|
294
|
+
var left = 0;
|
|
295
|
+
var alignClass = 'center';
|
|
296
296
|
if (align === 'left') {
|
|
297
297
|
left = target.left;
|
|
298
298
|
alignClass = 'start';
|
|
@@ -313,12 +313,12 @@ const resolveHorizontalAlign = (align, target, popover) => {
|
|
|
313
313
|
left = window.innerWidth - popover.width - clamp;
|
|
314
314
|
alignClass = 'end';
|
|
315
315
|
}
|
|
316
|
-
return { left, alignClass };
|
|
316
|
+
return { left: left, alignClass: alignClass };
|
|
317
317
|
};
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
318
|
+
var resolveVerticalAlign = function (align, target, popover) {
|
|
319
|
+
var clamp = 2;
|
|
320
|
+
var top = 0;
|
|
321
|
+
var alignClass = 'center';
|
|
322
322
|
if (align === 'top') {
|
|
323
323
|
top = target.top;
|
|
324
324
|
alignClass = 'start';
|
|
@@ -339,5 +339,5 @@ const resolveVerticalAlign = (align, target, popover) => {
|
|
|
339
339
|
top = window.innerHeight - popover.height - clamp;
|
|
340
340
|
alignClass = 'end';
|
|
341
341
|
}
|
|
342
|
-
return { top, alignClass };
|
|
342
|
+
return { top: top, alignClass: alignClass };
|
|
343
343
|
};
|