@sydsoft/base 1.57.0 → 1.59.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/dist/esm/_lib/baseFunctions.d.ts +11 -0
  2. package/dist/esm/_lib/baseFunctions.js +97 -0
  3. package/dist/esm/_lib/inputMask.d.ts +7 -0
  4. package/dist/esm/_lib/inputMask.js +229 -0
  5. package/dist/esm/_lib/listFunctions.d.ts +2 -0
  6. package/dist/esm/_lib/listFunctions.js +114 -0
  7. package/dist/esm/_lib/storage/cookies.d.ts +4 -0
  8. package/dist/esm/_lib/storage/cookies.js +34 -0
  9. package/dist/esm/_lib/storage/encData.d.ts +2 -0
  10. package/dist/esm/_lib/storage/encData.js +43 -0
  11. package/dist/esm/_lib/storage/localStorage.d.ts +6 -0
  12. package/dist/esm/_lib/storage/localStorage.js +69 -0
  13. package/dist/esm/_lib/storage/sessionStorage.d.ts +6 -0
  14. package/dist/esm/_lib/storage/sessionStorage.js +69 -0
  15. package/dist/esm/_lib/useInterval.d.ts +6 -0
  16. package/dist/esm/_lib/useInterval.js +24 -0
  17. package/dist/esm/alert/index.d.ts +18 -0
  18. package/dist/esm/alert/index.js +107 -0
  19. package/dist/esm/alert/index.module.css +119 -0
  20. package/dist/esm/box/Box.d.ts +9 -0
  21. package/dist/esm/box/Box.js +15 -0
  22. package/dist/esm/box/Box.module.css +153 -0
  23. package/dist/esm/box/BoxContent.d.ts +9 -0
  24. package/dist/esm/box/BoxContent.js +7 -0
  25. package/dist/esm/box/BoxFooter.d.ts +10 -0
  26. package/dist/esm/box/BoxFooter.js +8 -0
  27. package/dist/esm/box/BoxHeader.d.ts +16 -0
  28. package/dist/esm/box/BoxHeader.js +9 -0
  29. package/dist/esm/box/index.d.ts +9 -0
  30. package/dist/esm/box/index.js +9 -0
  31. package/dist/esm/countDown/index.d.ts +22 -0
  32. package/dist/esm/countDown/index.js +97 -0
  33. package/dist/esm/dateTime/index.d.ts +12 -0
  34. package/dist/esm/dateTime/index.js +76 -0
  35. package/dist/esm/form/Button.d.ts +27 -0
  36. package/dist/esm/form/Button.js +76 -0
  37. package/dist/esm/form/Checkbox.d.ts +23 -0
  38. package/dist/esm/form/Checkbox.js +23 -0
  39. package/dist/esm/form/Dialog.d.ts +20 -0
  40. package/dist/esm/form/Dialog.js +40 -0
  41. package/dist/esm/form/Form.d.ts +10 -0
  42. package/dist/esm/form/Form.js +12 -0
  43. package/dist/esm/form/FormOlustur.d.ts +39 -0
  44. package/dist/esm/form/FormOlustur.js +52 -0
  45. package/dist/esm/form/Input.d.ts +66 -0
  46. package/dist/esm/form/Input.js +196 -0
  47. package/dist/esm/form/Label.d.ts +7 -0
  48. package/dist/esm/form/Label.js +9 -0
  49. package/dist/esm/form/SearchableInput.d.ts +37 -0
  50. package/dist/esm/form/SearchableInput.js +272 -0
  51. package/dist/esm/form/UploadBase.d.ts +25 -0
  52. package/dist/esm/form/UploadBase.js +86 -0
  53. package/dist/esm/form/index.d.ts +9 -0
  54. package/dist/esm/form/index.js +9 -0
  55. package/dist/esm/form/styles/Button.module.css +145 -0
  56. package/dist/esm/form/styles/Input.module.css +221 -0
  57. package/dist/esm/form/styles/Label.module.css +31 -0
  58. package/dist/esm/form/styles/SearchableInput.module.css +80 -0
  59. package/dist/esm/grid/index.d.ts +38 -0
  60. package/dist/esm/grid/index.js +97 -0
  61. package/dist/esm/grid/index.module.css +805 -0
  62. package/dist/esm/icon/icons.d.ts +22 -0
  63. package/dist/esm/icon/icons.js +23 -0
  64. package/dist/esm/icon/index.d.ts +34 -0
  65. package/dist/esm/icon/index.js +26 -0
  66. package/dist/esm/icon/mui.d.ts +1 -0
  67. package/dist/esm/icon/mui.js +1 -0
  68. package/dist/esm/index.d.ts +19 -0
  69. package/dist/esm/index.js +19 -0
  70. package/dist/esm/menu/index.d.ts +69 -0
  71. package/dist/esm/menu/index.js +52 -0
  72. package/dist/esm/menu/index.module.css +92 -0
  73. package/dist/esm/modal/index.d.ts +23 -0
  74. package/dist/esm/modal/index.js +66 -0
  75. package/dist/esm/modal/index.module.css +77 -0
  76. package/dist/esm/popover/index.d.ts +26 -0
  77. package/dist/esm/popover/index.js +343 -0
  78. package/dist/esm/popover/index.module.css +89 -0
  79. package/dist/esm/tooltip/index.d.ts +11 -0
  80. package/dist/esm/tooltip/index.js +119 -0
  81. package/package.json +7 -7
@@ -0,0 +1,11 @@
1
+ export declare const isDev: boolean;
2
+ export declare const isServerReq: (context: any) => boolean;
3
+ export declare const sleep: (ms?: number) => Promise<unknown>;
4
+ export declare const padNumber: (num: number, padLength?: number, padString?: string) => string;
5
+ export declare function inputTumuBuyukCevir(e: React.ChangeEvent<HTMLInputElement>): void;
6
+ export declare function inputTumuKucukCevir(e: React.ChangeEvent<HTMLInputElement>): void;
7
+ export declare const convertLowerCase: (text?: any) => any;
8
+ export declare const convertForSearch: (value: string) => string;
9
+ export declare function convertForSEO(e: React.ChangeEvent<HTMLInputElement>): void;
10
+ export declare function getDomain(context?: any): string;
11
+ export declare const uniqueID: (key?: string, length?: number) => string;
@@ -0,0 +1,97 @@
1
+ export var isDev = !process.env.NODE_ENV || process.env.NODE_ENV === 'development';
2
+ export var isServerReq = function (context) { var _a, _b; return !((_b = (_a = context === null || context === void 0 ? void 0 : context.req) === null || _a === void 0 ? void 0 : _a.url) === null || _b === void 0 ? void 0 : _b.startsWith('/_next')); };
3
+ export var sleep = function (ms) {
4
+ if (ms === void 0) { ms = 1000; }
5
+ return new Promise(function (resolve) { return setTimeout(resolve, ms); });
6
+ };
7
+ export var padNumber = function (num, padLength, padString) {
8
+ if (padLength === void 0) { padLength = 2; }
9
+ if (padString === void 0) { padString = '0'; }
10
+ return String(num).padStart(padLength, padString);
11
+ };
12
+ export function inputTumuBuyukCevir(e) {
13
+ var _a;
14
+ if ((e === null || e === void 0 ? void 0 : e.target) && ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.setSelectionRange)) {
15
+ var start = e.target.selectionStart;
16
+ var end = e.target.selectionEnd;
17
+ e.target.value = e.target.value.toString().toLocaleUpperCase('tr-TR');
18
+ e.target.setSelectionRange(start, end);
19
+ }
20
+ }
21
+ export function inputTumuKucukCevir(e) {
22
+ var _a;
23
+ if ((e === null || e === void 0 ? void 0 : e.target) && ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.setSelectionRange)) {
24
+ var start = e.target.selectionStart;
25
+ var end = e.target.selectionEnd;
26
+ e.target.value = e.target.value.toString().toLocaleLowerCase('tr-TR');
27
+ e.target.setSelectionRange(start, end);
28
+ }
29
+ }
30
+ export var convertLowerCase = function (text) {
31
+ if (text === void 0) { text = ''; }
32
+ return text.toString().toLocaleLowerCase('tr-TR');
33
+ };
34
+ export var convertForSearch = function (value) {
35
+ var data = value === null || value === void 0 ? void 0 : value.toString().toLocaleLowerCase('tr-TR');
36
+ data = data.replace(/ö/g, 'o');
37
+ data = data.replace(/ç/g, 'c');
38
+ data = data.replace(/ş/g, 's');
39
+ data = data.replace(/ı/g, 'i');
40
+ data = data.replace(/ğ/g, 'g');
41
+ data = data.replace(/ü/g, 'u');
42
+ data = data.replace(/[^a-z\d]/g, ''); // %_- are allowed
43
+ data = data.replace(/^\s+|\s+$/g, '');
44
+ return data;
45
+ };
46
+ export function convertForSEO(e) {
47
+ var _a;
48
+ if ((e === null || e === void 0 ? void 0 : e.target) && ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.setSelectionRange)) {
49
+ var start = e.target.selectionStart;
50
+ var end = e.target.selectionEnd;
51
+ var string = e.target.value.toString().toLocaleLowerCase('tr');
52
+ var turkce = [' ', '-', 'ş', 'Ş', 'ı', 'ü', 'Ü', 'ö', 'Ö', 'ç', 'Ç', 'ş', 'Ş', 'ı', 'ğ', 'Ğ', 'İ', 'ö', 'Ö', 'Ç', 'ç', 'ü', 'Ü', 'â', 'ê', 'Â', '“', '”'];
53
+ var duzgun = ['-', '-', 's', 'S', 'i', 'u', 'U', 'o', 'O', 'c', 'C', 's', 'S', 'i', 'g', 'G', 'I', 'o', 'O', 'C', 'c', 'u', 'U', 'a', 'ê', 'a', '', ''];
54
+ for (var i = 0; i < turkce.length; i++) {
55
+ string = string.split(turkce[i]).join(duzgun[i]);
56
+ }
57
+ string = string.replace(/[^a-z0-9\-_şıüğçİŞĞÜÇ]+/gi, '_');
58
+ string = string.replace(/_+/g, '_');
59
+ string = string.replace(/^-/, '_');
60
+ string = string.replace(/-$/, '_');
61
+ e.target.value = string;
62
+ e.target.setSelectionRange(start, end);
63
+ }
64
+ }
65
+ export function getDomain(context) {
66
+ if (context === void 0) { context = null; }
67
+ var url = '';
68
+ if (context) {
69
+ url = context.req.headers.host;
70
+ }
71
+ else if (typeof window !== 'undefined') {
72
+ url = window.location.hostname;
73
+ }
74
+ if (url.length) {
75
+ var parts = url.split('.').reverse();
76
+ var cnt = parts.length;
77
+ if (cnt >= 3) {
78
+ // see if the second level domain is a common SLD.
79
+ if (parts[1].match(/^(com|edu|gov|net|mil|org|nom|co|name|info|biz)$/i)) {
80
+ var domain_1 = parts[2] + '.' + parts[1] + '.' + parts[0];
81
+ return domain_1.split(':')[0];
82
+ }
83
+ }
84
+ var domain = parts[1] + '.' + parts[0];
85
+ return domain.split(':')[0];
86
+ }
87
+ return url;
88
+ }
89
+ export var uniqueID = function (key, length) {
90
+ if (key === void 0) { key = ''; }
91
+ if (length === void 0) { length = 16; }
92
+ return (key +
93
+ parseInt(Math.ceil(Math.random() * Date.now())
94
+ .toPrecision(length)
95
+ .toString()
96
+ .replace('.', '')));
97
+ };
@@ -0,0 +1,7 @@
1
+ export declare const applyInputMask: (inputElement: any, mask: string, options?: any) => {
2
+ destroy: () => void;
3
+ setValue: (value: any) => void;
4
+ getValue: () => any;
5
+ getCleanValue: () => string;
6
+ applyMask: (inputValue: any) => string;
7
+ } | null;
@@ -0,0 +1,229 @@
1
+ import { isDev } from "./baseFunctions";
2
+ // Mask işleme core fonksiyonları
3
+ var createMaskCore = function () {
4
+ var defaultTranslation = {
5
+ "0": { pattern: /\d/ },
6
+ "9": { pattern: /\d/, optional: true },
7
+ "#": { pattern: /\d/, recursive: true },
8
+ A: { pattern: /[a-zA-Z0-9]/ },
9
+ S: { pattern: /[a-zA-Z]/ },
10
+ U: { pattern: /[a-zA-Z]/, transform: function (char) { return char.toUpperCase(); } },
11
+ L: { pattern: /[a-zA-Z]/, transform: function (char) { return char.toLowerCase(); } },
12
+ X: { pattern: /[0-9a-fA-F]/ }
13
+ };
14
+ var parseMask = function (maskString, translation) {
15
+ if (translation === void 0) { translation = defaultTranslation; }
16
+ var tokens = [];
17
+ var i = 0;
18
+ while (i < maskString.length) {
19
+ var char = maskString[i];
20
+ if (translation[char]) {
21
+ tokens.push({
22
+ type: "input",
23
+ pattern: translation[char].pattern,
24
+ optional: translation[char].optional,
25
+ recursive: translation[char].recursive,
26
+ transform: translation[char].transform
27
+ });
28
+ }
29
+ else {
30
+ tokens.push({
31
+ type: "literal",
32
+ char: char
33
+ });
34
+ }
35
+ i++;
36
+ }
37
+ return tokens;
38
+ };
39
+ var applyMask = function (inputValue, maskTokens, reverse) {
40
+ if (reverse === void 0) { reverse = false; }
41
+ if (!maskTokens.length)
42
+ return inputValue;
43
+ var normalizedValue = inputValue == null ? "" : String(inputValue);
44
+ var cleanValue = normalizedValue.replace(/[^\w\s]/g, "");
45
+ if (reverse) {
46
+ return applyReverseMask(cleanValue, maskTokens);
47
+ }
48
+ var result = "";
49
+ var valueIndex = 0;
50
+ var maskIndex = 0;
51
+ while (maskIndex < maskTokens.length && valueIndex < cleanValue.length) {
52
+ var token = maskTokens[maskIndex];
53
+ if (token.type === "literal") {
54
+ result += token.char;
55
+ maskIndex++;
56
+ }
57
+ else {
58
+ var char = cleanValue[valueIndex];
59
+ if (token.pattern.test(char)) {
60
+ var transformedChar = token.transform ? token.transform(char) : char;
61
+ result += transformedChar;
62
+ valueIndex++;
63
+ maskIndex++;
64
+ }
65
+ else if (token.optional) {
66
+ maskIndex++;
67
+ }
68
+ else {
69
+ valueIndex++;
70
+ }
71
+ }
72
+ }
73
+ while (maskIndex < maskTokens.length) {
74
+ var token = maskTokens[maskIndex];
75
+ if (token.type === "literal") {
76
+ result += token.char;
77
+ }
78
+ else if (!token.optional) {
79
+ break;
80
+ }
81
+ maskIndex++;
82
+ }
83
+ return result;
84
+ };
85
+ var applyReverseMask = function (inputValue, maskTokens) {
86
+ var reversedMask = maskTokens.slice().reverse();
87
+ var reversedValue = inputValue.split("").reverse().join("");
88
+ var result = "";
89
+ var valueIndex = 0;
90
+ var maskIndex = 0;
91
+ while (maskIndex < reversedMask.length && valueIndex < reversedValue.length) {
92
+ var token = reversedMask[maskIndex];
93
+ if (token.type === "literal") {
94
+ result = token.char + result;
95
+ maskIndex++;
96
+ }
97
+ else {
98
+ var char = reversedValue[valueIndex];
99
+ if (token.pattern.test(char)) {
100
+ var transformedChar = token.transform ? token.transform(char) : char;
101
+ result = transformedChar + result;
102
+ valueIndex++;
103
+ maskIndex++;
104
+ }
105
+ else if (token.optional) {
106
+ maskIndex++;
107
+ }
108
+ else {
109
+ valueIndex++;
110
+ }
111
+ }
112
+ }
113
+ return result;
114
+ };
115
+ var getCleanValue = function (maskedValue, maskTokens) {
116
+ if (!maskTokens.length)
117
+ return maskedValue;
118
+ var clean = "";
119
+ var valueIndex = 0;
120
+ var maskIndex = 0;
121
+ while (maskIndex < maskTokens.length && valueIndex < maskedValue.length) {
122
+ var token = maskTokens[maskIndex];
123
+ if (token.type === "literal") {
124
+ if (maskedValue[valueIndex] === token.char) {
125
+ valueIndex++;
126
+ }
127
+ maskIndex++;
128
+ }
129
+ else {
130
+ clean += maskedValue[valueIndex];
131
+ valueIndex++;
132
+ maskIndex++;
133
+ }
134
+ }
135
+ return clean;
136
+ };
137
+ return {
138
+ parseMask: parseMask,
139
+ applyMask: applyMask,
140
+ getCleanValue: getCleanValue
141
+ };
142
+ };
143
+ // Fonksiyonel yaklaşım - herhangi bir input elementine mask uygula
144
+ export var applyInputMask = function (inputElement, mask, options) {
145
+ if (options === void 0) { options = {}; }
146
+ if (!inputElement || !mask)
147
+ return null;
148
+ isDev && console.log("Input mask applied:", { inputElement: inputElement, mask: mask, options: options });
149
+ var translation = options.translation, _a = options.reverse, reverse = _a === void 0 ? false : _a, _b = options.clearIfNotMatch, clearIfNotMatch = _b === void 0 ? true : _b, _c = options.selectOnFocus, selectOnFocus = _c === void 0 ? false : _c, onChange = options.onChange;
150
+ var maskCore = createMaskCore();
151
+ var maskTokens = maskCore.parseMask(mask, translation);
152
+ var applyMaskToValue = function (inputValue) { return maskCore.applyMask(inputValue, maskTokens, reverse); };
153
+ var getCleanValue = function (maskedValue) { return maskCore.getCleanValue(maskedValue, maskTokens); };
154
+ var handleInputChange = function (e) {
155
+ var inputValue = e.target.value;
156
+ var maskedValue = applyMaskToValue(inputValue);
157
+ var cleanValue = getCleanValue(maskedValue);
158
+ e.target.value = maskedValue;
159
+ onChange === null || onChange === void 0 ? void 0 : onChange(maskedValue, cleanValue, e);
160
+ };
161
+ var handleKeyDown = function (e) {
162
+ var key = e.key, target = e.target;
163
+ var cursorStart = target.selectionStart;
164
+ var cursorEnd = target.selectionEnd;
165
+ if (key === "Backspace" || key === "Delete") {
166
+ e.preventDefault();
167
+ var newValue = target.value;
168
+ if (cursorStart !== cursorEnd) {
169
+ newValue = newValue.substring(0, cursorStart) + newValue.substring(cursorEnd);
170
+ }
171
+ else if (key === "Backspace" && cursorStart > 0) {
172
+ newValue = newValue.substring(0, cursorStart - 1) + newValue.substring(cursorStart);
173
+ }
174
+ else if (key === "Delete" && cursorStart < newValue.length) {
175
+ newValue = newValue.substring(0, cursorStart) + newValue.substring(cursorStart + 1);
176
+ }
177
+ var maskedValue = applyMaskToValue(newValue);
178
+ target.value = maskedValue;
179
+ var cleanValue = getCleanValue(maskedValue);
180
+ onChange === null || onChange === void 0 ? void 0 : onChange(maskedValue, cleanValue, e);
181
+ setTimeout(function () {
182
+ var newPos = key === "Backspace" ? Math.max(0, cursorStart - 1) : cursorStart;
183
+ target.setSelectionRange(newPos, newPos);
184
+ }, 0);
185
+ }
186
+ };
187
+ var handleFocus = function (e) {
188
+ if (selectOnFocus) {
189
+ setTimeout(function () {
190
+ e.target.select();
191
+ }, 0);
192
+ }
193
+ };
194
+ var handleBlur = function (e) {
195
+ if (clearIfNotMatch) {
196
+ var cleanValue = getCleanValue(e.target.value);
197
+ var expectedLength = maskTokens.filter(function (t) { return t.type === "input" && !t.optional; }).length;
198
+ if (cleanValue.length < expectedLength) {
199
+ e.target.value = "";
200
+ onChange === null || onChange === void 0 ? void 0 : onChange("", "", e);
201
+ }
202
+ }
203
+ };
204
+ // Event listener'ları ekle
205
+ inputElement.addEventListener("input", handleInputChange);
206
+ inputElement.addEventListener("keydown", handleKeyDown);
207
+ inputElement.addEventListener("focus", handleFocus);
208
+ inputElement.addEventListener("blur", handleBlur);
209
+ // Cleanup fonksiyonu
210
+ var destroy = function () {
211
+ inputElement.removeEventListener("input", handleInputChange);
212
+ inputElement.removeEventListener("keydown", handleKeyDown);
213
+ inputElement.removeEventListener("focus", handleFocus);
214
+ inputElement.removeEventListener("blur", handleBlur);
215
+ };
216
+ // Utility fonksiyonları
217
+ return {
218
+ destroy: destroy,
219
+ setValue: function (value) {
220
+ if (!value)
221
+ return;
222
+ var maskedValue = applyMaskToValue(value || "");
223
+ inputElement.value = maskedValue;
224
+ },
225
+ getValue: function () { return inputElement.value; },
226
+ getCleanValue: function () { return getCleanValue(inputElement.value); },
227
+ applyMask: applyMaskToValue
228
+ };
229
+ };
@@ -0,0 +1,2 @@
1
+ export declare const onKeyboardSelection: ({ e, targetElement, itemClass, selectedClass, checkByValue, checkByInput, clear }: any) => null | undefined;
2
+ export declare function setScrollListPosition(targetElement: any): void;
@@ -0,0 +1,114 @@
1
+ export var onKeyboardSelection = function (_a) {
2
+ var e = _a.e, targetElement = _a.targetElement, _b = _a.itemClass, itemClass = _b === void 0 ? "item" : _b, _c = _a.selectedClass, selectedClass = _c === void 0 ? "selected" : _c, checkByValue = _a.checkByValue, checkByInput = _a.checkByInput, clear = _a.clear;
3
+ if (!targetElement.current)
4
+ return null;
5
+ var config = {
6
+ e: e,
7
+ itemClass: itemClass,
8
+ selectedClass: selectedClass,
9
+ };
10
+ function selectEnter() {
11
+ if (!targetElement.current)
12
+ return null;
13
+ var text = targetElement.current.querySelector("".concat(config.itemClass, ".").concat(config.selectedClass));
14
+ if (text) {
15
+ checkByValue(text.dataset.value);
16
+ }
17
+ else if (targetElement.current.querySelectorAll("".concat(config.itemClass)).length > 0) {
18
+ var target = targetElement.current.querySelectorAll("".concat(config.itemClass, ".").concat(config.selectedClass))[0];
19
+ checkByValue(target.dataset.value);
20
+ }
21
+ else {
22
+ clear(true, true);
23
+ }
24
+ }
25
+ function selectFirst() {
26
+ if (!targetElement.current)
27
+ return null;
28
+ var showList = targetElement.current.querySelectorAll("".concat(config.itemClass));
29
+ if (showList.length > 0) {
30
+ showList[0].classList.add(config.selectedClass);
31
+ }
32
+ }
33
+ function selectLast() {
34
+ if (!targetElement.current)
35
+ return null;
36
+ var showList = targetElement.current.querySelectorAll("".concat(config.itemClass));
37
+ if (showList.length > 0) {
38
+ showList[showList.length - 1].classList.add(config.selectedClass);
39
+ }
40
+ }
41
+ function selectNext(element) {
42
+ element.classList.remove(config.selectedClass);
43
+ var next = element.nextElementSibling;
44
+ if (next && next.nodeType !== -1) {
45
+ if (next.classList.contains("item")) {
46
+ next.classList.add(config.selectedClass);
47
+ }
48
+ else {
49
+ selectNext(next);
50
+ }
51
+ }
52
+ else {
53
+ selectFirst();
54
+ }
55
+ }
56
+ function selectPrev(element) {
57
+ element.classList.remove(config.selectedClass);
58
+ var next = element.previousElementSibling;
59
+ if (next && next.nodeType !== -1) {
60
+ if (next.classList.contains("item")) {
61
+ next.classList.add(config.selectedClass);
62
+ }
63
+ else {
64
+ selectPrev(next);
65
+ }
66
+ }
67
+ else {
68
+ selectLast();
69
+ }
70
+ }
71
+ var selected = targetElement.current.querySelector("".concat(config.itemClass, ".").concat(config.selectedClass));
72
+ if (e.which == 40) {
73
+ if (selected) {
74
+ selectNext(selected);
75
+ }
76
+ else {
77
+ selectFirst();
78
+ }
79
+ }
80
+ else if (e.which == 38) {
81
+ if (selected) {
82
+ selectPrev(selected);
83
+ }
84
+ else {
85
+ selectLast();
86
+ }
87
+ }
88
+ else if (e.which == 35) {
89
+ selectLast();
90
+ }
91
+ else if (e.which == 36) {
92
+ selectFirst();
93
+ }
94
+ else if (e.which == 13) {
95
+ selectEnter();
96
+ }
97
+ else if (e.which == 9) {
98
+ checkByInput();
99
+ }
100
+ setScrollListPosition(targetElement);
101
+ };
102
+ export function setScrollListPosition(targetElement) {
103
+ if (targetElement.current) {
104
+ var position = 0;
105
+ var text = targetElement.current.querySelector(".selected");
106
+ if (text) {
107
+ position = text.offsetTop - 35;
108
+ }
109
+ else if (targetElement.current.querySelector(".active")) {
110
+ position = targetElement.current.querySelector(".active").offsetTop - 35;
111
+ }
112
+ targetElement.current.scrollTop = position;
113
+ }
114
+ }
@@ -0,0 +1,4 @@
1
+ export declare const cerezOku: (context: any | null | undefined, key: string) => string | false;
2
+ export declare const cerezKaydet: (context: any | null | undefined, key: string, value: string, time?: number) => void;
3
+ export declare const cerezSil: (context: any | null | undefined, key: string) => void;
4
+ export declare const cerezTumuSil: (context?: any | null) => void;
@@ -0,0 +1,34 @@
1
+ import { __assign } from "tslib";
2
+ import nookies, { destroyCookie, parseCookies, setCookie } from 'nookies';
3
+ import { getDomain } from '../baseFunctions';
4
+ export var cerezOku = function (context, key) {
5
+ if (context === void 0) { context = null; }
6
+ var cookies = context ? nookies.get(context) : parseCookies();
7
+ return cookies[key] || false;
8
+ };
9
+ export var cerezKaydet = function (context, key, value, time) {
10
+ if (context === void 0) { context = null; }
11
+ if (time === void 0) { time = 0; }
12
+ var newConfig = checkDomain(context);
13
+ setCookie(context, key, value, __assign({ maxAge: time > 0 ? time : null }, newConfig));
14
+ };
15
+ export var cerezSil = function (context, key) {
16
+ if (context === void 0) { context = null; }
17
+ var newConfig = checkDomain(context);
18
+ destroyCookie(context, key, newConfig);
19
+ };
20
+ export var cerezTumuSil = function (context) {
21
+ if (context === void 0) { context = null; }
22
+ var cookies = parseCookies(context);
23
+ if (cookies) {
24
+ Object.keys(cookies).forEach(function (key) {
25
+ destroyCookie(context, key);
26
+ });
27
+ }
28
+ };
29
+ var checkDomain = function (context, config) {
30
+ if (context === void 0) { context = null; }
31
+ if (config === void 0) { config = {}; }
32
+ var cookieDomain = getDomain(context);
33
+ return __assign(__assign({}, config), { domain: '.' + cookieDomain, path: '/' });
34
+ };
@@ -0,0 +1,2 @@
1
+ export declare const encData: (data: object | string | number, keys?: number[]) => string;
2
+ export declare const decData: (data: string, keys?: number[]) => any;
@@ -0,0 +1,43 @@
1
+ import { isDev } from "../baseFunctions";
2
+ var encDecDataKeys = [3, 5, 8, 11, 15, 22];
3
+ export var encData = function (data, keys) {
4
+ if (keys === void 0) { keys = encDecDataKeys; }
5
+ try {
6
+ var newJSON = { data: data };
7
+ var utf8Data = unescape(encodeURIComponent(JSON.stringify(newJSON))); // Dizeyi UTF-8'e dönüştür
8
+ var newData_1 = btoa(utf8Data);
9
+ keys.map(function (value) {
10
+ var randomChar = String.fromCharCode(Math.floor(Math.random() * (122 - 97 + 1)) + 97);
11
+ newData_1 = newData_1.slice(0, value) + randomChar + newData_1.slice(value);
12
+ });
13
+ return newData_1;
14
+ }
15
+ catch (e) {
16
+ isDev && console.log("ERROR => encData =>", e);
17
+ return "";
18
+ }
19
+ };
20
+ export var decData = function (data, keys) {
21
+ var _a;
22
+ if (keys === void 0) { keys = encDecDataKeys; }
23
+ try {
24
+ var decode_1 = data;
25
+ keys.map(function (value, index) {
26
+ var prevValue = keys[index - 1];
27
+ if (!prevValue) {
28
+ decode_1 = decode_1.slice(0, value) + decode_1.slice(value + 1);
29
+ }
30
+ else {
31
+ decode_1 = decode_1.slice(0, value - index) + decode_1.slice(value - index + 1);
32
+ }
33
+ });
34
+ var decodedString = atob(decode_1);
35
+ var utf8DecodedString = decodeURIComponent(escape(decodedString));
36
+ var parse = JSON.parse(utf8DecodedString);
37
+ return (_a = parse === null || parse === void 0 ? void 0 : parse.data) !== null && _a !== void 0 ? _a : "";
38
+ }
39
+ catch (e) {
40
+ isDev && console.log("ERROR => decData =>", e);
41
+ return "";
42
+ }
43
+ };
@@ -0,0 +1,6 @@
1
+ export declare const setLocalStorage: (key: string, value: any) => boolean;
2
+ export declare const getLocalStorage: (key: string) => any;
3
+ export declare const removeLocalStorage: (key: string) => boolean;
4
+ export declare const clearLocalStorage: () => boolean;
5
+ export declare const getLocalStorageAllKeys: () => string[];
6
+ export declare const getLocalStorageSize: () => number;
@@ -0,0 +1,69 @@
1
+ import { decData, encData } from './encData';
2
+ import { isDev } from '../baseFunctions';
3
+ var storageAvailable = typeof Storage === 'undefined' || !window.localStorage ? false : true;
4
+ export var setLocalStorage = function (key, value) {
5
+ if (!storageAvailable)
6
+ return false;
7
+ try {
8
+ localStorage.setItem(key, encData(value));
9
+ return true;
10
+ }
11
+ catch (e) {
12
+ isDev && console.log('ERROR => localStorage =>', e);
13
+ return false;
14
+ }
15
+ };
16
+ export var getLocalStorage = function (key) {
17
+ if (!storageAvailable)
18
+ return false;
19
+ try {
20
+ var saved = localStorage.getItem(key);
21
+ return saved ? decData(saved) : null;
22
+ }
23
+ catch (e) {
24
+ isDev && console.log('ERROR => localStorage =>', e);
25
+ return null;
26
+ }
27
+ };
28
+ export var removeLocalStorage = function (key) {
29
+ if (!storageAvailable)
30
+ return false;
31
+ try {
32
+ localStorage.removeItem(key);
33
+ return true;
34
+ }
35
+ catch (e) {
36
+ isDev && console.log('ERROR => localStorage =>', e);
37
+ return false;
38
+ }
39
+ };
40
+ export var clearLocalStorage = function () {
41
+ if (!storageAvailable)
42
+ return false;
43
+ try {
44
+ localStorage.clear();
45
+ return true;
46
+ }
47
+ catch (e) {
48
+ isDev && console.log('ERROR => localStorage =>', e);
49
+ return false;
50
+ }
51
+ };
52
+ // Tüm localStorage anahtarlarını getir
53
+ export var getLocalStorageAllKeys = function () {
54
+ if (!storageAvailable)
55
+ return [];
56
+ return Object.keys(localStorage);
57
+ };
58
+ // Tüm localStorage boyutunu getir
59
+ export var getLocalStorageSize = function () {
60
+ if (!storageAvailable)
61
+ return 0;
62
+ var total = 0;
63
+ for (var key in localStorage) {
64
+ if (localStorage.hasOwnProperty(key)) {
65
+ total += localStorage[key].length + key.length;
66
+ }
67
+ }
68
+ return total;
69
+ };
@@ -0,0 +1,6 @@
1
+ export declare const setSessionStorage: (key: string, value: any) => boolean;
2
+ export declare const getSessionStorage: (key: string) => any;
3
+ export declare const removeSessionStorage: (key: string) => boolean;
4
+ export declare const clearSessionStorage: () => boolean;
5
+ export declare const getSessionStorageAllKeys: () => string[];
6
+ export declare const getSessionStorageSize: () => number;