@sydsoft/base 1.49.0 → 1.51.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/baseFunctions.js +24 -11
- package/_dist/_lib/inputMask.js +7 -3
- package/_dist/_lib/listFunctions.js +7 -2
- package/_dist/_lib/storage/cookies.js +20 -12
- package/_dist/_lib/storage/encData.js +10 -5
- package/_dist/_lib/storage/localStorage.js +23 -14
- package/_dist/_lib/storage/sessionStorage.js +23 -14
- package/_dist/_lib/useInterval.js +8 -5
- package/_dist/alert/index.js +22 -13
- package/_dist/box/Box.js +12 -8
- package/_dist/box/BoxContent.js +9 -4
- package/_dist/box/BoxFooter.js +9 -5
- package/_dist/box/BoxHeader.js +10 -6
- package/_dist/box/index.js +7 -4
- package/_dist/countDown/index.js +17 -12
- package/_dist/dateTime/index.js +4 -1
- package/_dist/form/Button.js +24 -20
- package/_dist/form/Checkbox.js +11 -6
- package/_dist/form/Dialog.js +12 -8
- package/_dist/form/Form.js +7 -4
- package/_dist/form/FormOlustur.js +16 -12
- package/_dist/form/Input.js +49 -44
- package/_dist/form/Label.js +10 -6
- package/_dist/form/SearchableInput.js +47 -43
- package/_dist/form/UploadBase.js +16 -11
- package/_dist/form/index.js +12 -9
- package/_dist/grid/index.js +38 -30
- package/_dist/icon/icons.js +10 -7
- package/_dist/icon/index.js +13 -9
- package/_dist/icon/mui.js +2 -1
- package/_dist/index.js +22 -19
- package/_dist/menu/index.js +20 -16
- package/_dist/modal/index.js +16 -12
- package/_dist/popover/index.js +37 -33
- package/_dist/tooltip/index.js +8 -4
- package/package.json +3 -5
- package/_lib/baseFunctions.ts +0 -94
- package/_lib/inputMask.ts +0 -257
- package/_lib/listFunctions.ts +0 -106
- package/_lib/storage/cookies.ts +0 -39
- package/_lib/storage/encData.ts +0 -41
- package/_lib/storage/localStorage.ts +0 -67
- package/_lib/storage/sessionStorage.ts +0 -67
- package/_lib/useInterval.ts +0 -30
- package/alert/index.module.css +0 -119
- package/alert/index.tsx +0 -131
- package/box/Box.module.css +0 -153
- package/box/Box.tsx +0 -33
- package/box/BoxContent.tsx +0 -18
- package/box/BoxFooter.tsx +0 -25
- package/box/BoxHeader.tsx +0 -46
- package/box/index.ts +0 -10
- package/countDown/index.tsx +0 -116
- package/dateTime/index.ts +0 -79
- package/form/Button.tsx +0 -143
- package/form/Checkbox.tsx +0 -48
- package/form/Dialog.tsx +0 -109
- package/form/Form.tsx +0 -19
- package/form/FormOlustur.tsx +0 -105
- package/form/Input.tsx +0 -364
- package/form/Label.tsx +0 -20
- package/form/SearchableInput.tsx +0 -406
- package/form/UploadBase.tsx +0 -133
- package/form/index.ts +0 -10
- package/form/styles/Button.module.css +0 -145
- package/form/styles/Input.module.css +0 -221
- package/form/styles/Label.module.css +0 -31
- package/form/styles/SearchableInput.module.css +0 -80
- package/global.d.ts +0 -9
- package/grid/index.module.css +0 -805
- package/grid/index.tsx +0 -171
- package/icon/icons.tsx +0 -33
- package/icon/index.tsx +0 -95
- package/icon/mui.tsx +0 -5932
- package/index.ts +0 -21
- package/menu/index.module.css +0 -92
- package/menu/index.tsx +0 -143
- package/modal/index.module.css +0 -77
- package/modal/index.tsx +0 -106
- package/npm_recovery_codes.txt +0 -5
- package/popover/index.module.css +0 -89
- package/popover/index.tsx +0 -392
- package/tooltip/index.tsx +0 -216
- package/tsconfig.json +0 -24
package/_dist/menu/index.js
CHANGED
|
@@ -1,30 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Menu = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
2
6
|
/**
|
|
3
7
|
* @author : izzetseydaoglu
|
|
4
8
|
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
5
9
|
* @version : 2026-02-07 19:31:01
|
|
6
10
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const withIconComponent = useMemo(() => {
|
|
11
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
12
|
+
const form_1 = require("../form");
|
|
13
|
+
const popover_1 = require("../popover");
|
|
14
|
+
const link_1 = tslib_1.__importDefault(require("next/link"));
|
|
15
|
+
const index_module_css_1 = tslib_1.__importDefault(require("./index.module.css"));
|
|
16
|
+
exports.Menu = (0, react_1.memo)(function MemoFunction({ menu, className, style, withIcon = 'auto' }) {
|
|
17
|
+
const withIconComponent = (0, react_1.useMemo)(() => {
|
|
14
18
|
if (withIcon === true)
|
|
15
19
|
return true;
|
|
16
20
|
if (withIcon === false)
|
|
17
21
|
return false;
|
|
18
22
|
return Object.values(menu).some((item) => 'icon' in item && !!item.icon);
|
|
19
23
|
}, [menu, withIcon]);
|
|
20
|
-
const withRightComponent = useMemo(() => {
|
|
24
|
+
const withRightComponent = (0, react_1.useMemo)(() => {
|
|
21
25
|
return Object.values(menu).some((item) => 'rightComponent' in item && !!item.rightComponent);
|
|
22
26
|
}, [menu]);
|
|
23
27
|
const handleClick = (item, e) => {
|
|
24
28
|
if (!item.onClick)
|
|
25
29
|
return;
|
|
26
30
|
if (item.dialog) {
|
|
27
|
-
Dialog({ ...item.dialog }).then((result) => {
|
|
31
|
+
(0, form_1.Dialog)({ ...item.dialog }).then((result) => {
|
|
28
32
|
if (result && item.onClick) {
|
|
29
33
|
item.onClick(e);
|
|
30
34
|
}
|
|
@@ -34,17 +38,17 @@ export const Menu = memo(function MemoFunction({ menu, className, style, withIco
|
|
|
34
38
|
item.onClick(e);
|
|
35
39
|
}
|
|
36
40
|
};
|
|
37
|
-
return (
|
|
41
|
+
return ((0, jsx_runtime_1.jsx)("ul", { className: `smenu ${index_module_css_1.default.ul} ${className || ''}`, style: style, children: Object.values(menu).map((item, key) => {
|
|
38
42
|
const { fullComponent, icon, title, rightComponent, seperator, href, style, itemProps, type, items, menuProps, subMenuPopoverProps, ...other } = item;
|
|
39
43
|
const hasSubmenu = type === 'submenu' && Array.isArray(items) && items.length > 0;
|
|
40
44
|
if (fullComponent)
|
|
41
|
-
return
|
|
45
|
+
return react_1.default.cloneElement(fullComponent, { key: key });
|
|
42
46
|
if (seperator)
|
|
43
|
-
return
|
|
44
|
-
const Component = (
|
|
47
|
+
return (0, jsx_runtime_1.jsx)("li", { className: index_module_css_1.default.seperator, style: style, ...itemProps, ...other }, key);
|
|
48
|
+
const Component = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [withIconComponent && (0, jsx_runtime_1.jsx)("div", { className: index_module_css_1.default.menuicon, children: icon }), (0, jsx_runtime_1.jsx)("div", { className: index_module_css_1.default.menutitle, children: title }), withRightComponent && (0, jsx_runtime_1.jsx)("div", { className: index_module_css_1.default.rightmenu, children: rightComponent })] }));
|
|
45
49
|
if (hasSubmenu) {
|
|
46
|
-
return (
|
|
50
|
+
return ((0, jsx_runtime_1.jsx)(popover_1.Popover, { component: (0, jsx_runtime_1.jsx)("li", { style: style, ...itemProps, ...other, children: Component }), position: "right-top", ...(subMenuPopoverProps || {}), children: (0, jsx_runtime_1.jsx)(exports.Menu, { menu: items, ...(menuProps || {}) }) }, key));
|
|
47
51
|
}
|
|
48
|
-
return (
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)("li", { style: style, onClick: (e) => handleClick(item, e), ...itemProps, ...other, children: href ? (0, jsx_runtime_1.jsx)(link_1.default, { href: href, children: Component }) : Component }, key));
|
|
49
53
|
}) }));
|
|
50
54
|
});
|
package/_dist/modal/index.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Modal = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
2
6
|
/**
|
|
3
7
|
* Copyright (c) 2023
|
|
4
8
|
* @author: izzetseydaoglu
|
|
5
9
|
* @last-modified: 9.02.2024 06:07
|
|
6
10
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const [modalDiv, setModalDiv] = useState(null);
|
|
12
|
-
const ref = useRef(null);
|
|
13
|
-
useEffect(() => {
|
|
11
|
+
const react_1 = require("react");
|
|
12
|
+
const react_dom_1 = tslib_1.__importDefault(require("react-dom"));
|
|
13
|
+
const index_module_css_1 = tslib_1.__importDefault(require("./index.module.css"));
|
|
14
|
+
exports.Modal = (0, react_1.memo)(function MemoFunction({ refModal = null, children, open = false, close, keepMounted = false, fullScreen = false, hideBackdrop = true, hideEsc = false, hideCloseButton = false, modalStyle, backdropStyle, vertialAlign = "center", horizontalAlign = "center" }) {
|
|
15
|
+
const [modalDiv, setModalDiv] = (0, react_1.useState)(null);
|
|
16
|
+
const ref = (0, react_1.useRef)(null);
|
|
17
|
+
(0, react_1.useEffect)(() => {
|
|
14
18
|
if (refModal)
|
|
15
19
|
refModal.current = ref.current;
|
|
16
20
|
}, [ref.current]);
|
|
@@ -26,7 +30,7 @@ export const Modal = memo(function MemoFunction({ refModal = null, children, ope
|
|
|
26
30
|
if (e.keyCode === 27 || e.key === "Escape" || e.code === "Escape")
|
|
27
31
|
onClose();
|
|
28
32
|
};
|
|
29
|
-
useEffect(() => {
|
|
33
|
+
(0, react_1.useEffect)(() => {
|
|
30
34
|
if (open) {
|
|
31
35
|
if (hideBackdrop)
|
|
32
36
|
window.addEventListener("mousedown", checkHideBackDrop);
|
|
@@ -40,7 +44,7 @@ export const Modal = memo(function MemoFunction({ refModal = null, children, ope
|
|
|
40
44
|
window.removeEventListener("keydown", checkESC);
|
|
41
45
|
};
|
|
42
46
|
});
|
|
43
|
-
useEffect(() => {
|
|
47
|
+
(0, react_1.useEffect)(() => {
|
|
44
48
|
if (!modalDiv) {
|
|
45
49
|
const modalDivCheck = document.getElementById("smodal");
|
|
46
50
|
if (modalDivCheck) {
|
|
@@ -59,6 +63,6 @@ export const Modal = memo(function MemoFunction({ refModal = null, children, ope
|
|
|
59
63
|
}, []);
|
|
60
64
|
if ((!keepMounted && !open) || typeof window === "undefined")
|
|
61
65
|
return null;
|
|
62
|
-
const Component = (
|
|
63
|
-
return modalDiv ?
|
|
66
|
+
const Component = ((0, jsx_runtime_1.jsx)("div", { className: `${index_module_css_1.default.backdrop} ${open ? index_module_css_1.default.backdrop_open : ""}`, style: { alignItems: vertialAlign, justifyContent: horizontalAlign, ...backdropStyle }, children: (0, jsx_runtime_1.jsxs)("div", { ref: ref, className: `smodal ${index_module_css_1.default.modal} ${fullScreen ? index_module_css_1.default.fullscreen : ""}`, style: modalStyle, children: [!hideCloseButton && ((0, jsx_runtime_1.jsx)("div", { className: `close ${index_module_css_1.default.close_fixed}`, children: (0, jsx_runtime_1.jsx)("div", { className: index_module_css_1.default.close, onClick: onClose, children: "\u2715" }) })), children] }) }));
|
|
67
|
+
return modalDiv ? react_dom_1.default.createPortal(Component, modalDiv) : null;
|
|
64
68
|
});
|
package/_dist/popover/index.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* @author : izzetseydaoglu
|
|
3
4
|
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
4
5
|
* @version : 2026-02-10 16:12:35
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.Popover = void 0;
|
|
9
|
+
const tslib_1 = require("tslib");
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const client_1 = require("react-dom/client");
|
|
12
|
+
const index_module_css_1 = tslib_1.__importDefault(require("./index.module.css"));
|
|
13
|
+
exports.Popover = (0, react_1.memo)(function MemoFunction({ children, component, position = 'top', arrow = false, distance = 5, removeWhenClickInside = false, hideBackdrop = true, fade = true, arrowColor = 'auto', hover = false, hoverCloseDelay = 120, keepMounted = false, ...other }) {
|
|
14
|
+
const refComponent = (0, react_1.useRef)(null);
|
|
15
|
+
const closeTimer = (0, react_1.useRef)(null);
|
|
16
|
+
const hoverCloseTimer = (0, react_1.useRef)(null);
|
|
17
|
+
const popoverRef = (0, react_1.useRef)(null);
|
|
18
|
+
const rootRef = (0, react_1.useRef)(null);
|
|
19
|
+
const zIndexRef = (0, react_1.useRef)(null);
|
|
20
|
+
(0, react_1.useEffect)(() => {
|
|
17
21
|
if (typeof window === 'undefined')
|
|
18
22
|
return;
|
|
19
23
|
return () => {
|
|
@@ -36,13 +40,13 @@ export const Popover = memo(function MemoFunction({ children, component, positio
|
|
|
36
40
|
if (popoverRef.current && keepMounted) {
|
|
37
41
|
const popover = popoverRef.current;
|
|
38
42
|
const target = e.currentTarget;
|
|
39
|
-
const wasVisible = popover.classList.contains(
|
|
43
|
+
const wasVisible = popover.classList.contains(index_module_css_1.default.visible);
|
|
40
44
|
(_b = (_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.render) === null || _b === void 0 ? void 0 : _b.call(_a, children);
|
|
41
45
|
applyArrowColor(popover);
|
|
42
46
|
popoverPosition({ target, position: position });
|
|
43
47
|
popover.style.zIndex = String(nextPopoverZIndex());
|
|
44
|
-
popover.classList.remove(
|
|
45
|
-
popover.classList.add(
|
|
48
|
+
popover.classList.remove(index_module_css_1.default.closing);
|
|
49
|
+
popover.classList.add(index_module_css_1.default.visible);
|
|
46
50
|
if (!wasVisible) {
|
|
47
51
|
if (hideBackdrop) {
|
|
48
52
|
window.addEventListener('mousedown', checkHideBackDrop);
|
|
@@ -60,12 +64,12 @@ export const Popover = memo(function MemoFunction({ children, component, positio
|
|
|
60
64
|
}
|
|
61
65
|
popoverSil(false);
|
|
62
66
|
const popover = document.createElement('div');
|
|
63
|
-
popover.classList.add('spopover',
|
|
67
|
+
popover.classList.add('spopover', index_module_css_1.default.popover);
|
|
64
68
|
const zIndex = nextPopoverZIndex();
|
|
65
69
|
zIndexRef.current = zIndex;
|
|
66
70
|
document.body.appendChild(popover);
|
|
67
71
|
// ReactDOM.render(children, popover)
|
|
68
|
-
const root = createRoot(popover);
|
|
72
|
+
const root = (0, client_1.createRoot)(popover);
|
|
69
73
|
root.render(children);
|
|
70
74
|
popoverRef.current = popover;
|
|
71
75
|
rootRef.current = root;
|
|
@@ -76,7 +80,7 @@ export const Popover = memo(function MemoFunction({ children, component, positio
|
|
|
76
80
|
applyArrowColor(popover);
|
|
77
81
|
popoverPosition({ target, position: position });
|
|
78
82
|
popover.style.zIndex = String((_a = zIndexRef.current) !== null && _a !== void 0 ? _a : zIndex);
|
|
79
|
-
popover.classList.add(
|
|
83
|
+
popover.classList.add(index_module_css_1.default.visible);
|
|
80
84
|
}, 100);
|
|
81
85
|
if (hideBackdrop) {
|
|
82
86
|
window.addEventListener('mousedown', checkHideBackDrop);
|
|
@@ -93,7 +97,7 @@ export const Popover = memo(function MemoFunction({ children, component, positio
|
|
|
93
97
|
const popoverSil = (animate = true) => {
|
|
94
98
|
refComponent.current && refComponent.current.classList.remove('spopover_active');
|
|
95
99
|
const check = popoverRef.current;
|
|
96
|
-
const wasVisible = !!(check === null || check === void 0 ? void 0 : check.classList.contains(
|
|
100
|
+
const wasVisible = !!(check === null || check === void 0 ? void 0 : check.classList.contains(index_module_css_1.default.visible));
|
|
97
101
|
if (check) {
|
|
98
102
|
if (removeWhenClickInside)
|
|
99
103
|
check.removeEventListener('mouseup', popoverGecikmeliSil);
|
|
@@ -117,12 +121,12 @@ export const Popover = memo(function MemoFunction({ children, component, positio
|
|
|
117
121
|
rootRef.current = null;
|
|
118
122
|
}
|
|
119
123
|
else {
|
|
120
|
-
check.classList.remove(
|
|
121
|
-
check.classList.remove(
|
|
124
|
+
check.classList.remove(index_module_css_1.default.visible);
|
|
125
|
+
check.classList.remove(index_module_css_1.default.closing);
|
|
122
126
|
}
|
|
123
127
|
}
|
|
124
|
-
else if (!check.classList.contains(
|
|
125
|
-
check.classList.add(
|
|
128
|
+
else if (!check.classList.contains(index_module_css_1.default.closing)) {
|
|
129
|
+
check.classList.add(index_module_css_1.default.closing);
|
|
126
130
|
closeTimer.current = window.setTimeout(() => {
|
|
127
131
|
var _a;
|
|
128
132
|
if (!keepMounted) {
|
|
@@ -133,8 +137,8 @@ export const Popover = memo(function MemoFunction({ children, component, positio
|
|
|
133
137
|
rootRef.current = null;
|
|
134
138
|
}
|
|
135
139
|
else {
|
|
136
|
-
check.classList.remove(
|
|
137
|
-
check.classList.remove(
|
|
140
|
+
check.classList.remove(index_module_css_1.default.visible);
|
|
141
|
+
check.classList.remove(index_module_css_1.default.closing);
|
|
138
142
|
}
|
|
139
143
|
}, FADE_DURATION);
|
|
140
144
|
}
|
|
@@ -193,7 +197,7 @@ export const Popover = memo(function MemoFunction({ children, component, positio
|
|
|
193
197
|
alignClass = resolvedAlign;
|
|
194
198
|
style.push('top:' + top + 'px');
|
|
195
199
|
}
|
|
196
|
-
const classNames = ['spopover',
|
|
200
|
+
const 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);
|
|
197
201
|
popover.className = classNames.join(' ');
|
|
198
202
|
popover.setAttribute('style', style.join(';'));
|
|
199
203
|
applyArrowColor(popover);
|
|
@@ -266,18 +270,18 @@ export const Popover = memo(function MemoFunction({ children, component, positio
|
|
|
266
270
|
scheduleHoverClose();
|
|
267
271
|
};
|
|
268
272
|
}
|
|
269
|
-
return cloneElement(component, componentProps);
|
|
273
|
+
return (0, react_1.cloneElement)(component, componentProps);
|
|
270
274
|
});
|
|
271
275
|
const sideClass = {
|
|
272
|
-
top:
|
|
273
|
-
bottom:
|
|
274
|
-
left:
|
|
275
|
-
right:
|
|
276
|
+
top: index_module_css_1.default.top,
|
|
277
|
+
bottom: index_module_css_1.default.bottom,
|
|
278
|
+
left: index_module_css_1.default.left,
|
|
279
|
+
right: index_module_css_1.default.right
|
|
276
280
|
};
|
|
277
281
|
const alignClassMap = {
|
|
278
|
-
start:
|
|
279
|
-
center:
|
|
280
|
-
end:
|
|
282
|
+
start: index_module_css_1.default.alignStart,
|
|
283
|
+
center: index_module_css_1.default.alignCenter,
|
|
284
|
+
end: index_module_css_1.default.alignEnd
|
|
281
285
|
};
|
|
282
286
|
const FADE_DURATION = 160;
|
|
283
287
|
const normalizePosition = (position) => {
|
package/_dist/tooltip/index.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Tooltip = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
exports.Tooltip = (0, react_1.memo)(function MemoFunction({ children, title, position = "top", arrow = false, distance = 5, ...other }) {
|
|
7
|
+
(0, react_1.useEffect)(() => {
|
|
4
8
|
if (typeof window === "undefined")
|
|
5
9
|
return null;
|
|
6
10
|
const cssCheck = document.getElementsByClassName("stooltip_css")[0];
|
|
@@ -111,7 +115,7 @@ export const Tooltip = memo(function MemoFunction({ children, title, position =
|
|
|
111
115
|
tooltip.setAttribute("style", style.join(";"));
|
|
112
116
|
}
|
|
113
117
|
};
|
|
114
|
-
return
|
|
118
|
+
return react_1.default.cloneElement(children, {
|
|
115
119
|
onMouseEnter: tooltipEkle,
|
|
116
120
|
onMouseLeave: tooltipSil,
|
|
117
121
|
onMouseDown: tooltipSil,
|
package/package.json
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sydsoft/base",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.51.0",
|
|
5
5
|
"description": "",
|
|
6
|
-
"type": "module",
|
|
7
6
|
"main": "./_dist/index.js",
|
|
8
|
-
"module": "./_dist/index.js",
|
|
9
7
|
"types": "./_dist/index.d.ts",
|
|
10
|
-
"
|
|
8
|
+
"files": [
|
|
11
9
|
"./_dist/",
|
|
12
10
|
"README.md"
|
|
13
11
|
],
|
|
14
12
|
"exports": {
|
|
15
13
|
".": {
|
|
16
14
|
"types": "./_dist/index.d.ts",
|
|
17
|
-
"
|
|
15
|
+
"default": "./_dist/index.js"
|
|
18
16
|
}
|
|
19
17
|
},
|
|
20
18
|
"scripts": {
|
package/_lib/baseFunctions.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
export const isDev = !process.env.NODE_ENV || process.env.NODE_ENV === 'development';
|
|
2
|
-
export const isServerReq = (context: any) => !context?.req?.url?.startsWith('/_next');
|
|
3
|
-
export const sleep = (ms = 1000) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
4
|
-
|
|
5
|
-
export const padNumber = (num: number, padLength = 2, padString = '0') => String(num).padStart(padLength, padString);
|
|
6
|
-
|
|
7
|
-
export function inputTumuBuyukCevir(e: React.ChangeEvent<HTMLInputElement>) {
|
|
8
|
-
if (e?.target && e?.target?.setSelectionRange) {
|
|
9
|
-
const start = e.target.selectionStart;
|
|
10
|
-
const end = e.target.selectionEnd;
|
|
11
|
-
e.target.value = e.target.value.toString().toLocaleUpperCase('tr-TR');
|
|
12
|
-
e.target.setSelectionRange(start, end);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function inputTumuKucukCevir(e: React.ChangeEvent<HTMLInputElement>) {
|
|
17
|
-
if (e?.target && e?.target?.setSelectionRange) {
|
|
18
|
-
const start = e.target.selectionStart;
|
|
19
|
-
const end = e.target.selectionEnd;
|
|
20
|
-
e.target.value = e.target.value.toString().toLocaleLowerCase('tr-TR');
|
|
21
|
-
e.target.setSelectionRange(start, end);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const convertLowerCase = (text: any = '') => text.toString().toLocaleLowerCase('tr-TR');
|
|
26
|
-
|
|
27
|
-
export const convertForSearch = (value: string) => {
|
|
28
|
-
let data = value?.toString().toLocaleLowerCase('tr-TR');
|
|
29
|
-
data = data.replace(/ö/g, 'o');
|
|
30
|
-
data = data.replace(/ç/g, 'c');
|
|
31
|
-
data = data.replace(/ş/g, 's');
|
|
32
|
-
data = data.replace(/ı/g, 'i');
|
|
33
|
-
data = data.replace(/ğ/g, 'g');
|
|
34
|
-
data = data.replace(/ü/g, 'u');
|
|
35
|
-
data = data.replace(/[^a-z\d]/g, ''); // %_- are allowed
|
|
36
|
-
data = data.replace(/^\s+|\s+$/g, '');
|
|
37
|
-
return data;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export function convertForSEO(e: React.ChangeEvent<HTMLInputElement>) {
|
|
41
|
-
if (e?.target && e?.target?.setSelectionRange) {
|
|
42
|
-
const start = e.target.selectionStart;
|
|
43
|
-
const end = e.target.selectionEnd;
|
|
44
|
-
let string = e.target.value.toString().toLocaleLowerCase('tr');
|
|
45
|
-
const turkce = [' ', '-', 'ş', 'Ş', 'ı', 'ü', 'Ü', 'ö', 'Ö', 'ç', 'Ç', 'ş', 'Ş', 'ı', 'ğ', 'Ğ', 'İ', 'ö', 'Ö', 'Ç', 'ç', 'ü', 'Ü', 'â', 'ê', 'Â', '“', '”'];
|
|
46
|
-
const duzgun = ['-', '-', 's', 'S', 'i', 'u', 'U', 'o', 'O', 'c', 'C', 's', 'S', 'i', 'g', 'G', 'I', 'o', 'O', 'C', 'c', 'u', 'U', 'a', 'ê', 'a', '', ''];
|
|
47
|
-
for (let i = 0; i < turkce.length; i++) {
|
|
48
|
-
string = string.split(turkce[i]).join(duzgun[i]);
|
|
49
|
-
}
|
|
50
|
-
string = string.replace(/[^a-z0-9\-_şıüğçİŞĞÜÇ]+/gi, '_');
|
|
51
|
-
string = string.replace(/_+/g, '_');
|
|
52
|
-
string = string.replace(/^-/, '_');
|
|
53
|
-
string = string.replace(/-$/, '_');
|
|
54
|
-
|
|
55
|
-
e.target.value = string;
|
|
56
|
-
e.target.setSelectionRange(start, end);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function getDomain(context: any = null) {
|
|
61
|
-
let url = '';
|
|
62
|
-
if (context) {
|
|
63
|
-
url = context.req.headers.host;
|
|
64
|
-
} else if (typeof window !== 'undefined') {
|
|
65
|
-
url = window.location.hostname;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (url.length) {
|
|
69
|
-
const parts = url.split('.').reverse();
|
|
70
|
-
const cnt = parts.length;
|
|
71
|
-
if (cnt >= 3) {
|
|
72
|
-
// see if the second level domain is a common SLD.
|
|
73
|
-
if (parts[1].match(/^(com|edu|gov|net|mil|org|nom|co|name|info|biz)$/i)) {
|
|
74
|
-
const domain = parts[2] + '.' + parts[1] + '.' + parts[0];
|
|
75
|
-
return domain.split(':')[0];
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
const domain = parts[1] + '.' + parts[0];
|
|
79
|
-
return domain.split(':')[0];
|
|
80
|
-
}
|
|
81
|
-
return url;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export const uniqueID = (key = '', length = 16) => {
|
|
85
|
-
return (
|
|
86
|
-
key +
|
|
87
|
-
parseInt(
|
|
88
|
-
Math.ceil(Math.random() * Date.now())
|
|
89
|
-
.toPrecision(length)
|
|
90
|
-
.toString()
|
|
91
|
-
.replace('.', '')
|
|
92
|
-
)
|
|
93
|
-
);
|
|
94
|
-
};
|