@sydsoft/base 1.51.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.
Files changed (111) hide show
  1. package/_dist/esm/_lib/baseFunctions.js +97 -0
  2. package/_dist/{_lib → esm/_lib}/inputMask.js +70 -71
  3. package/_dist/{_lib → esm/_lib}/listFunctions.js +14 -18
  4. package/_dist/esm/_lib/storage/cookies.js +34 -0
  5. package/_dist/esm/_lib/storage/encData.js +43 -0
  6. package/_dist/esm/_lib/storage/localStorage.js +69 -0
  7. package/_dist/esm/_lib/storage/sessionStorage.js +69 -0
  8. package/_dist/{_lib → esm/_lib}/useInterval.js +7 -10
  9. package/_dist/esm/alert/index.js +107 -0
  10. package/_dist/esm/box/Box.js +15 -0
  11. package/_dist/esm/box/BoxContent.js +7 -0
  12. package/_dist/esm/box/BoxFooter.js +8 -0
  13. package/_dist/esm/box/BoxHeader.js +9 -0
  14. package/_dist/esm/box/index.js +9 -0
  15. package/_dist/esm/countDown/index.js +97 -0
  16. package/_dist/{dateTime → esm/dateTime}/index.js +31 -28
  17. package/_dist/esm/form/Button.js +76 -0
  18. package/_dist/esm/form/Checkbox.js +23 -0
  19. package/_dist/esm/form/Dialog.js +40 -0
  20. package/_dist/esm/form/Form.js +12 -0
  21. package/_dist/esm/form/FormOlustur.js +52 -0
  22. package/_dist/esm/form/Input.js +196 -0
  23. package/_dist/esm/form/Label.js +9 -0
  24. package/_dist/esm/form/SearchableInput.js +272 -0
  25. package/_dist/esm/form/UploadBase.js +86 -0
  26. package/_dist/esm/form/index.js +9 -0
  27. package/_dist/esm/grid/index.js +97 -0
  28. package/_dist/esm/icon/icons.js +23 -0
  29. package/_dist/esm/icon/index.js +26 -0
  30. package/_dist/esm/icon/mui.js +1 -0
  31. package/_dist/esm/index.js +19 -0
  32. package/_dist/esm/menu/index.js +52 -0
  33. package/_dist/esm/modal/index.js +66 -0
  34. package/_dist/{popover → esm/popover}/index.js +119 -123
  35. package/_dist/esm/tooltip/index.js +119 -0
  36. package/package.json +8 -7
  37. package/_dist/_lib/baseFunctions.js +0 -97
  38. package/_dist/_lib/storage/cookies.js +0 -41
  39. package/_dist/_lib/storage/encData.js +0 -46
  40. package/_dist/_lib/storage/localStorage.js +0 -78
  41. package/_dist/_lib/storage/sessionStorage.js +0 -78
  42. package/_dist/alert/index.js +0 -114
  43. package/_dist/box/Box.js +0 -18
  44. package/_dist/box/BoxContent.js +0 -10
  45. package/_dist/box/BoxFooter.js +0 -14
  46. package/_dist/box/BoxHeader.js +0 -14
  47. package/_dist/box/index.js +0 -12
  48. package/_dist/countDown/index.js +0 -97
  49. package/_dist/form/Button.js +0 -86
  50. package/_dist/form/Checkbox.js +0 -27
  51. package/_dist/form/Dialog.js +0 -57
  52. package/_dist/form/Form.js +0 -13
  53. package/_dist/form/FormOlustur.js +0 -54
  54. package/_dist/form/Input.js +0 -202
  55. package/_dist/form/Label.js +0 -11
  56. package/_dist/form/SearchableInput.js +0 -264
  57. package/_dist/form/UploadBase.js +0 -89
  58. package/_dist/form/index.js +0 -12
  59. package/_dist/grid/index.js +0 -104
  60. package/_dist/icon/icons.js +0 -26
  61. package/_dist/icon/index.js +0 -38
  62. package/_dist/icon/mui.js +0 -2
  63. package/_dist/index.js +0 -22
  64. package/_dist/menu/index.js +0 -54
  65. package/_dist/modal/index.js +0 -68
  66. package/_dist/tooltip/index.js +0 -206
  67. /package/_dist/{_lib → esm/_lib}/baseFunctions.d.ts +0 -0
  68. /package/_dist/{_lib → esm/_lib}/inputMask.d.ts +0 -0
  69. /package/_dist/{_lib → esm/_lib}/listFunctions.d.ts +0 -0
  70. /package/_dist/{_lib → esm/_lib}/storage/cookies.d.ts +0 -0
  71. /package/_dist/{_lib → esm/_lib}/storage/encData.d.ts +0 -0
  72. /package/_dist/{_lib → esm/_lib}/storage/localStorage.d.ts +0 -0
  73. /package/_dist/{_lib → esm/_lib}/storage/sessionStorage.d.ts +0 -0
  74. /package/_dist/{_lib → esm/_lib}/useInterval.d.ts +0 -0
  75. /package/_dist/{alert → esm/alert}/index.d.ts +0 -0
  76. /package/_dist/{alert → esm/alert}/index.module.css +0 -0
  77. /package/_dist/{box → esm/box}/Box.d.ts +0 -0
  78. /package/_dist/{box → esm/box}/Box.module.css +0 -0
  79. /package/_dist/{box → esm/box}/BoxContent.d.ts +0 -0
  80. /package/_dist/{box → esm/box}/BoxFooter.d.ts +0 -0
  81. /package/_dist/{box → esm/box}/BoxHeader.d.ts +0 -0
  82. /package/_dist/{box → esm/box}/index.d.ts +0 -0
  83. /package/_dist/{countDown → esm/countDown}/index.d.ts +0 -0
  84. /package/_dist/{dateTime → esm/dateTime}/index.d.ts +0 -0
  85. /package/_dist/{form → esm/form}/Button.d.ts +0 -0
  86. /package/_dist/{form → esm/form}/Checkbox.d.ts +0 -0
  87. /package/_dist/{form → esm/form}/Dialog.d.ts +0 -0
  88. /package/_dist/{form → esm/form}/Form.d.ts +0 -0
  89. /package/_dist/{form → esm/form}/FormOlustur.d.ts +0 -0
  90. /package/_dist/{form → esm/form}/Input.d.ts +0 -0
  91. /package/_dist/{form → esm/form}/Label.d.ts +0 -0
  92. /package/_dist/{form → esm/form}/SearchableInput.d.ts +0 -0
  93. /package/_dist/{form → esm/form}/UploadBase.d.ts +0 -0
  94. /package/_dist/{form → esm/form}/index.d.ts +0 -0
  95. /package/_dist/{form → esm/form}/styles/Button.module.css +0 -0
  96. /package/_dist/{form → esm/form}/styles/Input.module.css +0 -0
  97. /package/_dist/{form → esm/form}/styles/Label.module.css +0 -0
  98. /package/_dist/{form → esm/form}/styles/SearchableInput.module.css +0 -0
  99. /package/_dist/{grid → esm/grid}/index.d.ts +0 -0
  100. /package/_dist/{grid → esm/grid}/index.module.css +0 -0
  101. /package/_dist/{icon → esm/icon}/icons.d.ts +0 -0
  102. /package/_dist/{icon → esm/icon}/index.d.ts +0 -0
  103. /package/_dist/{icon → esm/icon}/mui.d.ts +0 -0
  104. /package/_dist/{index.d.ts → esm/index.d.ts} +0 -0
  105. /package/_dist/{menu → esm/menu}/index.d.ts +0 -0
  106. /package/_dist/{menu → esm/menu}/index.module.css +0 -0
  107. /package/_dist/{modal → esm/modal}/index.d.ts +0 -0
  108. /package/_dist/{modal → esm/modal}/index.module.css +0 -0
  109. /package/_dist/{popover → esm/popover}/index.d.ts +0 -0
  110. /package/_dist/{popover → esm/popover}/index.module.css +0 -0
  111. /package/_dist/{tooltip → esm/tooltip}/index.d.ts +0 -0
@@ -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
+ };
@@ -1,24 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.applyInputMask = void 0;
4
- const baseFunctions_1 = require("./baseFunctions");
1
+ import { isDev } from "./baseFunctions";
5
2
  // Mask işleme core fonksiyonları
6
- const createMaskCore = () => {
7
- const defaultTranslation = {
3
+ var createMaskCore = function () {
4
+ var defaultTranslation = {
8
5
  "0": { pattern: /\d/ },
9
6
  "9": { pattern: /\d/, optional: true },
10
7
  "#": { pattern: /\d/, recursive: true },
11
8
  A: { pattern: /[a-zA-Z0-9]/ },
12
9
  S: { pattern: /[a-zA-Z]/ },
13
- U: { pattern: /[a-zA-Z]/, transform: (char) => char.toUpperCase() },
14
- L: { pattern: /[a-zA-Z]/, transform: (char) => char.toLowerCase() },
10
+ U: { pattern: /[a-zA-Z]/, transform: function (char) { return char.toUpperCase(); } },
11
+ L: { pattern: /[a-zA-Z]/, transform: function (char) { return char.toLowerCase(); } },
15
12
  X: { pattern: /[0-9a-fA-F]/ }
16
13
  };
17
- const parseMask = (maskString, translation = defaultTranslation) => {
18
- const tokens = [];
19
- let i = 0;
14
+ var parseMask = function (maskString, translation) {
15
+ if (translation === void 0) { translation = defaultTranslation; }
16
+ var tokens = [];
17
+ var i = 0;
20
18
  while (i < maskString.length) {
21
- const char = maskString[i];
19
+ var char = maskString[i];
22
20
  if (translation[char]) {
23
21
  tokens.push({
24
22
  type: "input",
@@ -38,27 +36,28 @@ const createMaskCore = () => {
38
36
  }
39
37
  return tokens;
40
38
  };
41
- const applyMask = (inputValue, maskTokens, reverse = false) => {
39
+ var applyMask = function (inputValue, maskTokens, reverse) {
40
+ if (reverse === void 0) { reverse = false; }
42
41
  if (!maskTokens.length)
43
42
  return inputValue;
44
- const normalizedValue = inputValue == null ? "" : String(inputValue);
45
- const cleanValue = normalizedValue.replace(/[^\w\s]/g, "");
43
+ var normalizedValue = inputValue == null ? "" : String(inputValue);
44
+ var cleanValue = normalizedValue.replace(/[^\w\s]/g, "");
46
45
  if (reverse) {
47
46
  return applyReverseMask(cleanValue, maskTokens);
48
47
  }
49
- let result = "";
50
- let valueIndex = 0;
51
- let maskIndex = 0;
48
+ var result = "";
49
+ var valueIndex = 0;
50
+ var maskIndex = 0;
52
51
  while (maskIndex < maskTokens.length && valueIndex < cleanValue.length) {
53
- const token = maskTokens[maskIndex];
52
+ var token = maskTokens[maskIndex];
54
53
  if (token.type === "literal") {
55
54
  result += token.char;
56
55
  maskIndex++;
57
56
  }
58
57
  else {
59
- const char = cleanValue[valueIndex];
58
+ var char = cleanValue[valueIndex];
60
59
  if (token.pattern.test(char)) {
61
- const transformedChar = token.transform ? token.transform(char) : char;
60
+ var transformedChar = token.transform ? token.transform(char) : char;
62
61
  result += transformedChar;
63
62
  valueIndex++;
64
63
  maskIndex++;
@@ -72,7 +71,7 @@ const createMaskCore = () => {
72
71
  }
73
72
  }
74
73
  while (maskIndex < maskTokens.length) {
75
- const token = maskTokens[maskIndex];
74
+ var token = maskTokens[maskIndex];
76
75
  if (token.type === "literal") {
77
76
  result += token.char;
78
77
  }
@@ -83,22 +82,22 @@ const createMaskCore = () => {
83
82
  }
84
83
  return result;
85
84
  };
86
- const applyReverseMask = (inputValue, maskTokens) => {
87
- const reversedMask = maskTokens.slice().reverse();
88
- const reversedValue = inputValue.split("").reverse().join("");
89
- let result = "";
90
- let valueIndex = 0;
91
- let maskIndex = 0;
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;
92
91
  while (maskIndex < reversedMask.length && valueIndex < reversedValue.length) {
93
- const token = reversedMask[maskIndex];
92
+ var token = reversedMask[maskIndex];
94
93
  if (token.type === "literal") {
95
94
  result = token.char + result;
96
95
  maskIndex++;
97
96
  }
98
97
  else {
99
- const char = reversedValue[valueIndex];
98
+ var char = reversedValue[valueIndex];
100
99
  if (token.pattern.test(char)) {
101
- const transformedChar = token.transform ? token.transform(char) : char;
100
+ var transformedChar = token.transform ? token.transform(char) : char;
102
101
  result = transformedChar + result;
103
102
  valueIndex++;
104
103
  maskIndex++;
@@ -113,14 +112,14 @@ const createMaskCore = () => {
113
112
  }
114
113
  return result;
115
114
  };
116
- const getCleanValue = (maskedValue, maskTokens) => {
115
+ var getCleanValue = function (maskedValue, maskTokens) {
117
116
  if (!maskTokens.length)
118
117
  return maskedValue;
119
- let clean = "";
120
- let valueIndex = 0;
121
- let maskIndex = 0;
118
+ var clean = "";
119
+ var valueIndex = 0;
120
+ var maskIndex = 0;
122
121
  while (maskIndex < maskTokens.length && valueIndex < maskedValue.length) {
123
- const token = maskTokens[maskIndex];
122
+ var token = maskTokens[maskIndex];
124
123
  if (token.type === "literal") {
125
124
  if (maskedValue[valueIndex] === token.char) {
126
125
  valueIndex++;
@@ -136,35 +135,36 @@ const createMaskCore = () => {
136
135
  return clean;
137
136
  };
138
137
  return {
139
- parseMask,
140
- applyMask,
141
- getCleanValue
138
+ parseMask: parseMask,
139
+ applyMask: applyMask,
140
+ getCleanValue: getCleanValue
142
141
  };
143
142
  };
144
143
  // Fonksiyonel yaklaşım - herhangi bir input elementine mask uygula
145
- const applyInputMask = (inputElement, mask, options = {}) => {
144
+ export var applyInputMask = function (inputElement, mask, options) {
145
+ if (options === void 0) { options = {}; }
146
146
  if (!inputElement || !mask)
147
147
  return null;
148
- baseFunctions_1.isDev && console.log("Input mask applied:", { inputElement, mask, options });
149
- const { translation, reverse = false, clearIfNotMatch = true, selectOnFocus = false, onChange } = options;
150
- const maskCore = createMaskCore();
151
- const maskTokens = maskCore.parseMask(mask, translation);
152
- const applyMaskToValue = (inputValue) => maskCore.applyMask(inputValue, maskTokens, reverse);
153
- const getCleanValue = (maskedValue) => maskCore.getCleanValue(maskedValue, maskTokens);
154
- const handleInputChange = (e) => {
155
- const inputValue = e.target.value;
156
- const maskedValue = applyMaskToValue(inputValue);
157
- const cleanValue = getCleanValue(maskedValue);
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
158
  e.target.value = maskedValue;
159
159
  onChange === null || onChange === void 0 ? void 0 : onChange(maskedValue, cleanValue, e);
160
160
  };
161
- const handleKeyDown = (e) => {
162
- const { key, target } = e;
163
- const cursorStart = target.selectionStart;
164
- const cursorEnd = target.selectionEnd;
161
+ var handleKeyDown = function (e) {
162
+ var key = e.key, target = e.target;
163
+ var cursorStart = target.selectionStart;
164
+ var cursorEnd = target.selectionEnd;
165
165
  if (key === "Backspace" || key === "Delete") {
166
166
  e.preventDefault();
167
- let newValue = target.value;
167
+ var newValue = target.value;
168
168
  if (cursorStart !== cursorEnd) {
169
169
  newValue = newValue.substring(0, cursorStart) + newValue.substring(cursorEnd);
170
170
  }
@@ -174,27 +174,27 @@ const applyInputMask = (inputElement, mask, options = {}) => {
174
174
  else if (key === "Delete" && cursorStart < newValue.length) {
175
175
  newValue = newValue.substring(0, cursorStart) + newValue.substring(cursorStart + 1);
176
176
  }
177
- const maskedValue = applyMaskToValue(newValue);
177
+ var maskedValue = applyMaskToValue(newValue);
178
178
  target.value = maskedValue;
179
- const cleanValue = getCleanValue(maskedValue);
179
+ var cleanValue = getCleanValue(maskedValue);
180
180
  onChange === null || onChange === void 0 ? void 0 : onChange(maskedValue, cleanValue, e);
181
- setTimeout(() => {
182
- const newPos = key === "Backspace" ? Math.max(0, cursorStart - 1) : cursorStart;
181
+ setTimeout(function () {
182
+ var newPos = key === "Backspace" ? Math.max(0, cursorStart - 1) : cursorStart;
183
183
  target.setSelectionRange(newPos, newPos);
184
184
  }, 0);
185
185
  }
186
186
  };
187
- const handleFocus = (e) => {
187
+ var handleFocus = function (e) {
188
188
  if (selectOnFocus) {
189
- setTimeout(() => {
189
+ setTimeout(function () {
190
190
  e.target.select();
191
191
  }, 0);
192
192
  }
193
193
  };
194
- const handleBlur = (e) => {
194
+ var handleBlur = function (e) {
195
195
  if (clearIfNotMatch) {
196
- const cleanValue = getCleanValue(e.target.value);
197
- const expectedLength = maskTokens.filter((t) => t.type === "input" && !t.optional).length;
196
+ var cleanValue = getCleanValue(e.target.value);
197
+ var expectedLength = maskTokens.filter(function (t) { return t.type === "input" && !t.optional; }).length;
198
198
  if (cleanValue.length < expectedLength) {
199
199
  e.target.value = "";
200
200
  onChange === null || onChange === void 0 ? void 0 : onChange("", "", e);
@@ -207,7 +207,7 @@ const applyInputMask = (inputElement, mask, options = {}) => {
207
207
  inputElement.addEventListener("focus", handleFocus);
208
208
  inputElement.addEventListener("blur", handleBlur);
209
209
  // Cleanup fonksiyonu
210
- const destroy = () => {
210
+ var destroy = function () {
211
211
  inputElement.removeEventListener("input", handleInputChange);
212
212
  inputElement.removeEventListener("keydown", handleKeyDown);
213
213
  inputElement.removeEventListener("focus", handleFocus);
@@ -215,16 +215,15 @@ const applyInputMask = (inputElement, mask, options = {}) => {
215
215
  };
216
216
  // Utility fonksiyonları
217
217
  return {
218
- destroy,
219
- setValue: (value) => {
218
+ destroy: destroy,
219
+ setValue: function (value) {
220
220
  if (!value)
221
221
  return;
222
- const maskedValue = applyMaskToValue(value || "");
222
+ var maskedValue = applyMaskToValue(value || "");
223
223
  inputElement.value = maskedValue;
224
224
  },
225
- getValue: () => inputElement.value,
226
- getCleanValue: () => getCleanValue(inputElement.value),
225
+ getValue: function () { return inputElement.value; },
226
+ getCleanValue: function () { return getCleanValue(inputElement.value); },
227
227
  applyMask: applyMaskToValue
228
228
  };
229
229
  };
230
- exports.applyInputMask = applyInputMask;
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.onKeyboardSelection = void 0;
4
- exports.setScrollListPosition = setScrollListPosition;
5
- const onKeyboardSelection = ({ e, targetElement, itemClass = `item`, selectedClass = "selected", checkByValue, checkByInput, clear }) => {
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;
6
3
  if (!targetElement.current)
7
4
  return null;
8
- const config = {
5
+ var config = {
9
6
  e: e,
10
7
  itemClass: itemClass,
11
8
  selectedClass: selectedClass,
@@ -13,12 +10,12 @@ const onKeyboardSelection = ({ e, targetElement, itemClass = `item`, selectedCla
13
10
  function selectEnter() {
14
11
  if (!targetElement.current)
15
12
  return null;
16
- const text = targetElement.current.querySelector(`${config.itemClass}.${config.selectedClass}`);
13
+ var text = targetElement.current.querySelector("".concat(config.itemClass, ".").concat(config.selectedClass));
17
14
  if (text) {
18
15
  checkByValue(text.dataset.value);
19
16
  }
20
- else if (targetElement.current.querySelectorAll(`${config.itemClass}`).length > 0) {
21
- const target = targetElement.current.querySelectorAll(`${config.itemClass}.${config.selectedClass}`)[0];
17
+ else if (targetElement.current.querySelectorAll("".concat(config.itemClass)).length > 0) {
18
+ var target = targetElement.current.querySelectorAll("".concat(config.itemClass, ".").concat(config.selectedClass))[0];
22
19
  checkByValue(target.dataset.value);
23
20
  }
24
21
  else {
@@ -28,7 +25,7 @@ const onKeyboardSelection = ({ e, targetElement, itemClass = `item`, selectedCla
28
25
  function selectFirst() {
29
26
  if (!targetElement.current)
30
27
  return null;
31
- const showList = targetElement.current.querySelectorAll(`${config.itemClass}`);
28
+ var showList = targetElement.current.querySelectorAll("".concat(config.itemClass));
32
29
  if (showList.length > 0) {
33
30
  showList[0].classList.add(config.selectedClass);
34
31
  }
@@ -36,14 +33,14 @@ const onKeyboardSelection = ({ e, targetElement, itemClass = `item`, selectedCla
36
33
  function selectLast() {
37
34
  if (!targetElement.current)
38
35
  return null;
39
- const showList = targetElement.current.querySelectorAll(`${config.itemClass}`);
36
+ var showList = targetElement.current.querySelectorAll("".concat(config.itemClass));
40
37
  if (showList.length > 0) {
41
38
  showList[showList.length - 1].classList.add(config.selectedClass);
42
39
  }
43
40
  }
44
41
  function selectNext(element) {
45
42
  element.classList.remove(config.selectedClass);
46
- const next = element.nextElementSibling;
43
+ var next = element.nextElementSibling;
47
44
  if (next && next.nodeType !== -1) {
48
45
  if (next.classList.contains("item")) {
49
46
  next.classList.add(config.selectedClass);
@@ -58,7 +55,7 @@ const onKeyboardSelection = ({ e, targetElement, itemClass = `item`, selectedCla
58
55
  }
59
56
  function selectPrev(element) {
60
57
  element.classList.remove(config.selectedClass);
61
- const next = element.previousElementSibling;
58
+ var next = element.previousElementSibling;
62
59
  if (next && next.nodeType !== -1) {
63
60
  if (next.classList.contains("item")) {
64
61
  next.classList.add(config.selectedClass);
@@ -71,7 +68,7 @@ const onKeyboardSelection = ({ e, targetElement, itemClass = `item`, selectedCla
71
68
  selectLast();
72
69
  }
73
70
  }
74
- const selected = targetElement.current.querySelector(`${config.itemClass}.${config.selectedClass}`);
71
+ var selected = targetElement.current.querySelector("".concat(config.itemClass, ".").concat(config.selectedClass));
75
72
  if (e.which == 40) {
76
73
  if (selected) {
77
74
  selectNext(selected);
@@ -102,11 +99,10 @@ const onKeyboardSelection = ({ e, targetElement, itemClass = `item`, selectedCla
102
99
  }
103
100
  setScrollListPosition(targetElement);
104
101
  };
105
- exports.onKeyboardSelection = onKeyboardSelection;
106
- function setScrollListPosition(targetElement) {
102
+ export function setScrollListPosition(targetElement) {
107
103
  if (targetElement.current) {
108
- let position = 0;
109
- const text = targetElement.current.querySelector(".selected");
104
+ var position = 0;
105
+ var text = targetElement.current.querySelector(".selected");
110
106
  if (text) {
111
107
  position = text.offsetTop - 35;
112
108
  }
@@ -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,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,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,69 @@
1
+ import { decData, encData } from "./encData";
2
+ import { isDev } from "../baseFunctions";
3
+ var storageAvailable = typeof Storage === "undefined" || !window.sessionStorage ? false : true;
4
+ export var setSessionStorage = function (key, value) {
5
+ if (!storageAvailable)
6
+ return false;
7
+ try {
8
+ sessionStorage.setItem(key, encData(value));
9
+ return true;
10
+ }
11
+ catch (e) {
12
+ isDev && console.log("ERROR => SessionStorage =>", e);
13
+ return false;
14
+ }
15
+ };
16
+ export var getSessionStorage = function (key) {
17
+ if (!storageAvailable)
18
+ return false;
19
+ try {
20
+ var saved = sessionStorage.getItem(key);
21
+ return saved ? decData(saved) : null;
22
+ }
23
+ catch (e) {
24
+ isDev && console.log("ERROR => SessionStorage =>", e);
25
+ return null;
26
+ }
27
+ };
28
+ export var removeSessionStorage = function (key) {
29
+ if (!storageAvailable)
30
+ return false;
31
+ try {
32
+ sessionStorage.removeItem(key);
33
+ return true;
34
+ }
35
+ catch (e) {
36
+ isDev && console.log("ERROR => SessionStorage =>", e);
37
+ return false;
38
+ }
39
+ };
40
+ export var clearSessionStorage = function () {
41
+ if (!storageAvailable)
42
+ return false;
43
+ try {
44
+ sessionStorage.clear();
45
+ return true;
46
+ }
47
+ catch (e) {
48
+ isDev && console.log("ERROR => SessionStorage =>", e);
49
+ return false;
50
+ }
51
+ };
52
+ // Tüm SessionStorage anahtarlarını getir
53
+ export var getSessionStorageAllKeys = function () {
54
+ if (!storageAvailable)
55
+ return [];
56
+ return Object.keys(sessionStorage);
57
+ };
58
+ // Tüm SessionStorage boyutunu getir
59
+ export var getSessionStorageSize = function () {
60
+ if (!storageAvailable)
61
+ return 0;
62
+ var total = 0;
63
+ for (var key in sessionStorage) {
64
+ if (sessionStorage.hasOwnProperty(key)) {
65
+ total += sessionStorage[key].length + key.length;
66
+ }
67
+ }
68
+ return total;
69
+ };