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