px-react-ui-components 1.0.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 (75) hide show
  1. package/.babelrc +3 -0
  2. package/README.md +126 -0
  3. package/dist/components/MyAlert/MyAlert.css +113 -0
  4. package/dist/components/MyAlert/MyAlert.js +109 -0
  5. package/dist/components/MyContainer/MyContainer.js +59 -0
  6. package/dist/components/MyContainer/MyContainer.module.css +110 -0
  7. package/dist/components/MyContainer/MyContainerBody.js +9 -0
  8. package/dist/components/MyContainer/MyContainerFooter.js +9 -0
  9. package/dist/components/MyContainer/MyContainerRight.js +10 -0
  10. package/dist/components/MyEditor/MyEditor.js +292 -0
  11. package/dist/components/MyEditor/MyEditor.scss +277 -0
  12. package/dist/components/MyFileUpload/MyFileUpload.js +288 -0
  13. package/dist/components/MyFileUpload/MyFileUpload.module.css +86 -0
  14. package/dist/components/MyImageCropper/MyImageCropper.js +95 -0
  15. package/dist/components/MyInput/MyInput.js +768 -0
  16. package/dist/components/MyInput/MyInput.module.css +420 -0
  17. package/dist/components/MyMaps/YandexMaps.js +162 -0
  18. package/dist/components/MyMenu/MenuItem.js +55 -0
  19. package/dist/components/MyMenu/MyMenu.module.css +102 -0
  20. package/dist/components/MyModal/MyModal.css +83 -0
  21. package/dist/components/MyModal/MyModal.js +71 -0
  22. package/dist/components/MyModal/MyModalBody.js +9 -0
  23. package/dist/components/MyModal/MyModalFooter.js +9 -0
  24. package/dist/components/MyNotFound/MyNotFound.css +22 -0
  25. package/dist/components/MyNotFound/MyNotFound.js +20 -0
  26. package/dist/components/MyScrollableCard/MyScrollableCard.js +74 -0
  27. package/dist/components/MyTable/MyTable.js +310 -0
  28. package/dist/components/MyTable/MyTable.module.css +350 -0
  29. package/dist/components/MyTable/MyTableBody.js +9 -0
  30. package/dist/components/MyTable/MyTableHead.js +9 -0
  31. package/dist/components/MyTabs/MyTabPane.js +17 -0
  32. package/dist/components/MyTabs/MyTabs.css +105 -0
  33. package/dist/components/MyTabs/MyTabs.js +66 -0
  34. package/dist/components/MyWaiting/MyWaiting.css +28 -0
  35. package/dist/components/MyWaiting/MyWaiting.js +27 -0
  36. package/dist/components/MyZoomImage/MyZoomImage.css +0 -0
  37. package/dist/components/MyZoomImage/MyZoomImage.js +108 -0
  38. package/dist/index.js +15 -0
  39. package/package.json +44 -0
  40. package/src/components/MyAlert/MyAlert.css +113 -0
  41. package/src/components/MyAlert/MyAlert.jsx +96 -0
  42. package/src/components/MyContainer/MyContainer.jsx +90 -0
  43. package/src/components/MyContainer/MyContainer.module.css +110 -0
  44. package/src/components/MyContainer/MyContainerBody.jsx +8 -0
  45. package/src/components/MyContainer/MyContainerFooter.jsx +8 -0
  46. package/src/components/MyContainer/MyContainerRight.jsx +11 -0
  47. package/src/components/MyEditor/MyEditor.jsx +252 -0
  48. package/src/components/MyEditor/MyEditor.scss +277 -0
  49. package/src/components/MyFileUpload/MyFileUpload.jsx +373 -0
  50. package/src/components/MyFileUpload/MyFileUpload.module.css +86 -0
  51. package/src/components/MyImageCropper/MyImageCropper.jsx +108 -0
  52. package/src/components/MyInput/MyInput.jsx +896 -0
  53. package/src/components/MyInput/MyInput.module.css +420 -0
  54. package/src/components/MyMaps/YandexMaps.jsx +186 -0
  55. package/src/components/MyMenu/MenuItem.jsx +62 -0
  56. package/src/components/MyMenu/MyMenu.module.css +102 -0
  57. package/src/components/MyModal/MyModal.css +83 -0
  58. package/src/components/MyModal/MyModal.jsx +78 -0
  59. package/src/components/MyModal/MyModalBody.jsx +8 -0
  60. package/src/components/MyModal/MyModalFooter.jsx +8 -0
  61. package/src/components/MyNotFound/MyNotFound.css +22 -0
  62. package/src/components/MyNotFound/MyNotFound.jsx +11 -0
  63. package/src/components/MyScrollableCard/MyScrollableCard.jsx +86 -0
  64. package/src/components/MyTable/MyTable.jsx +458 -0
  65. package/src/components/MyTable/MyTable.module.css +350 -0
  66. package/src/components/MyTable/MyTableBody.jsx +8 -0
  67. package/src/components/MyTable/MyTableHead.jsx +10 -0
  68. package/src/components/MyTabs/MyTabPane.jsx +9 -0
  69. package/src/components/MyTabs/MyTabs.css +105 -0
  70. package/src/components/MyTabs/MyTabs.jsx +63 -0
  71. package/src/components/MyWaiting/MyWaiting.css +28 -0
  72. package/src/components/MyWaiting/MyWaiting.jsx +27 -0
  73. package/src/components/MyZoomImage/MyZoomImage.css +0 -0
  74. package/src/components/MyZoomImage/MyZoomImage.jsx +139 -0
  75. package/src/index.js +15 -0
@@ -0,0 +1,768 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React, { useEffect, useRef, useState } from "react";
3
+ import styles from "./MyInput.module.css";
4
+ import { PiCaretDownBold, PiEye, PiEyeSlash } from "react-icons/pi";
5
+ import { useTranslation } from "../../context/TranslationContext";
6
+ export const MyInputType = Object.freeze({
7
+ TEXT: 'text',
8
+ PASSWORD: 'password',
9
+ SELECT: 'select',
10
+ SELECTFILTER: 'selectfilter',
11
+ FILE: 'file',
12
+ IMAGE: 'image',
13
+ TEXTAREA: 'textarea',
14
+ COLOR: 'color',
15
+ READONLY: 'readonly',
16
+ DATE: 'date',
17
+ DATETIME: 'datetime',
18
+ TIME: 'time',
19
+ MONEY: 'money',
20
+ NUMBER: 'number',
21
+ MAIL: 'mail',
22
+ PHONE: 'phone'
23
+ });
24
+ export const MyInputIsNumeric = value => {
25
+ if (value === null || value === undefined || value === '') return false;
26
+ return !isNaN(value) && !isNaN(parseFloat(value));
27
+ };
28
+ function MyInput({
29
+ id = null,
30
+ ref = null,
31
+ title = "",
32
+ placeholder = "",
33
+ placeholdersearchtext = "",
34
+ description = null,
35
+ type = MyInputType.TEXT,
36
+ className = null,
37
+ rows = 0,
38
+ icon = null,
39
+ options = null,
40
+ options_key_value = "value",
41
+ options_key_text = "text",
42
+ options_key_subtext = "subtext",
43
+ multiple = false,
44
+ disabled = false,
45
+ value = null,
46
+ decimalCount = 2,
47
+ buttonText = "",
48
+ accept = ".jpg,.jpeg,.png",
49
+ minDate = null,
50
+ maxDate = null,
51
+ style = null,
52
+ maxlength = null,
53
+ dangerouslySetInnerHTML = null,
54
+ uppercase = false,
55
+ lowercase = false,
56
+ firstUppercase = false,
57
+ onChange = null,
58
+ onBlur = null,
59
+ onFocus = null,
60
+ onKeyDown = null,
61
+ onKeyUp = null,
62
+ onKeyPress = null,
63
+ onMouseDown = null,
64
+ onMouseUp = null,
65
+ onMouseEnter = null,
66
+ onMouseLeave = null,
67
+ onRemoveImage = null
68
+ }) {
69
+ const {
70
+ t
71
+ } = useTranslation();
72
+ const myInputId = `key${Date.now() + Math.random().toString(36).substr(2, 9)}`;
73
+ const fileInputRef = useRef(null);
74
+ const [loaded, setLoaded] = useState(false);
75
+ const [myValue, setMyValue] = useState(value);
76
+ const [myEyeView, setMyEyeView] = useState(false);
77
+ const [myFileName, setMyFileName] = useState(null);
78
+ const [myTitleLite, setMyTitleLite] = useState("");
79
+ const [filtertext, setFiltertext] = useState("");
80
+ const [isError, setIsError] = useState(false);
81
+ const toBase64 = file => new Promise((resolve, reject) => {
82
+ const reader = new FileReader();
83
+ reader.readAsDataURL(file);
84
+ reader.onload = () => resolve(reader.result);
85
+ reader.onerror = reject;
86
+ });
87
+ const calculateFileSize = sizeInBytes => {
88
+ const units = ['B', 'KB', 'MB'];
89
+ let size = sizeInBytes;
90
+ let unitIndex = 0;
91
+ while (size >= 1024 && unitIndex < units.length - 1) {
92
+ size /= 1024;
93
+ unitIndex++;
94
+ }
95
+ return `${size.toFixed(2)} ${units[unitIndex]}`;
96
+ };
97
+ const moneyFormat = _value => {
98
+ let money = '';
99
+ let inputValue = _value;
100
+ if (inputValue == null || inputValue == undefined || inputValue == '') return money;
101
+ try {
102
+ inputValue = inputValue.toString();
103
+ // Tüm virgülleri kaldır ve son girilen karakteri kontrol et
104
+ money = inputValue.replace(/,/g, '');
105
+ const lastChar = inputValue.slice(-1);
106
+ if (lastChar === ',') {
107
+ money = money + '.';
108
+ }
109
+
110
+ // Sadece sayılar ve tek bir nokta kalacak şekilde temizle
111
+ money = money.replace(/[^0-9.]/g, '');
112
+
113
+ // Birden fazla nokta varsa ilkini koru
114
+ const parts = money.split('.');
115
+ if (parts.length > 2) {
116
+ money = parts[0] + '.' + parts[1];
117
+ }
118
+
119
+ // Noktadan sonra en fazla 2 basamak
120
+ if (parts.length === 2 && parts[1].length > decimalCount) {
121
+ money = parts[0] + '.' + parts[1].substring(0, decimalCount);
122
+ }
123
+
124
+ // Binlik ayracı için formatlama
125
+ if (money) {
126
+ const numParts = money.split('.');
127
+ if (numParts[0]) {
128
+ // Sayıyı önce tam sayıya çevir, sonra binlik ayracı ekle
129
+ numParts[0] = parseInt(numParts[0], 10).toLocaleString('en-US');
130
+ }
131
+ money = numParts.join('.');
132
+ }
133
+ const numParts = money.split('.');
134
+ if (numParts[0]) {
135
+ numParts[0] = numParts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
136
+ }
137
+ money = numParts.join('.');
138
+ } catch (error) {
139
+ money = '';
140
+ console.log(inputValue);
141
+ console.error(error);
142
+ }
143
+ return money;
144
+ };
145
+ const onMyBlur = e => {
146
+ setIsError(false);
147
+ if (myValue != null && myValue != "") {
148
+ switch (type) {
149
+ case MyInputType.MAIL:
150
+ if (!myValue.includes("@") || !myValue.includes(".")) {
151
+ setIsError(true);
152
+ }
153
+ break;
154
+ case MyInputType.PHONE:
155
+ if (myValue.length < 10 || myValue.length > 15) {
156
+ setIsError(true);
157
+ }
158
+ break;
159
+ default:
160
+ break;
161
+ }
162
+ }
163
+ if (onBlur != null) onBlur(e);
164
+ };
165
+ const onMyFocus = e => {
166
+ if (onFocus != null) onFocus(e);
167
+ };
168
+ const onMyKeyDown = e => {
169
+ if (onKeyDown != null) onKeyDown(e);
170
+ };
171
+ const onMyKeyUp = e => {
172
+ if (onKeyUp != null) onKeyUp(e);
173
+ };
174
+ const onMyKeyPress = e => {
175
+ if (onKeyPress != null) onKeyPress(e);
176
+ };
177
+ const onMyMouseDown = e => {
178
+ if (onMouseDown != null) onMouseDown(e);
179
+ };
180
+ const onMyMouseUp = e => {
181
+ if (onMouseUp != null) onMouseUp(e);
182
+ };
183
+ const onMyMouseEnter = e => {
184
+ if (onMouseEnter != null) onMouseEnter(e);
185
+ };
186
+ const onMyMouseLeave = e => {
187
+ if (onMouseLeave != null) onMouseLeave(e);
188
+ };
189
+ const onRemoveImageClick = e => {
190
+ if (onRemoveImage != null) onRemoveImage();
191
+ };
192
+ const onMyChange = async e => {
193
+ switch (type) {
194
+ case MyInputType.FILE:
195
+ case MyInputType.IMAGE:
196
+ let files = [];
197
+ if (e.target.files.length > 0) {
198
+ let totalSize = 0;
199
+ for (let i = 0; i < e.target.files.length; i++) {
200
+ const file = e.target.files[i];
201
+ totalSize += parseInt(file.size);
202
+ files.push({
203
+ // file: file,
204
+ base64: await toBase64(file),
205
+ filename: file.name,
206
+ size: file.size,
207
+ sizeText: calculateFileSize(file.size)
208
+ });
209
+ } //for
210
+
211
+ totalSize = calculateFileSize(totalSize);
212
+ setMyFileName(`<span>${files.length == 1 ? files[0].filename : files.length + " Dosya Seçildi"}</span>
213
+ <small>(${totalSize})</small>`);
214
+ } else {
215
+ setMyFileName("");
216
+ }
217
+ setMyValue(files);
218
+ break;
219
+ case MyInputType.NUMBER:
220
+ let number = e.target.value.replace(/[^0-9.]/g, '');
221
+
222
+ // Birden fazla nokta varsa ilkini koru
223
+ const numberParts = number.split('.');
224
+ if (numberParts.length > 2) {
225
+ number = numberParts[0] + '.' + numberParts[1];
226
+ }
227
+ setMyValue(number);
228
+ break;
229
+ case MyInputType.MONEY:
230
+ let money = moneyFormat(e.target.value);
231
+ setMyValue(money);
232
+ break;
233
+ case MyInputType.DATE:
234
+ case MyInputType.DATETIME:
235
+ case MyInputType.TIME:
236
+ const selectedDate = e.target.value;
237
+ setMyValue(selectedDate);
238
+ break;
239
+ default:
240
+ if (uppercase) setMyValue(e.target.value.toLocaleUpperCase("TR"));else if (lowercase) setMyValue(e.target.value.toLocaleLowerCase("TR"));else if (firstUppercase) setMyValue(e.target.value.split(' ').map(word => word.charAt(0).toLocaleUpperCase("TR") + word.slice(1).toLocaleLowerCase("TR")).join(' '));else setMyValue(e.target.value);
241
+ break;
242
+ }
243
+ };
244
+ const mySelectFilterListClick = item => {
245
+ const selectElement = document.getElementById("mySelectFilterHiddenSelect" + myInputId);
246
+ selectElement.value = item.value;
247
+ setMyValue(item.value);
248
+ setFiltertext("");
249
+ };
250
+ const getMyValueText = () => {
251
+ if (!myValue || myValue == 0) return "";
252
+ if (!MyInputIsNumeric(myValue) || options == null) return myValue;
253
+ let result = options.find(e => e.value.toString() == myValue.toString());
254
+ if (result) return result.text + (result[options_key_subtext] ? ` - <span style="color: #73889d; font-style: italic; font-weight: 300;">${result[options_key_subtext]}</span>` : '');
255
+ return "";
256
+ };
257
+ const filterSelectEvents = () => {
258
+ const selectElement = document.getElementById("mySelectFilterSelected" + (id ? id : myInputId));
259
+ const selectListElement = document.getElementById("mySelectFilterList" + (id ? id : myInputId));
260
+ const filterInput = document.getElementById("mySelectFilterInput" + (id ? id : myInputId));
261
+ if (!selectElement || !selectListElement || !filterInput) return;
262
+ let isInputFocused = false;
263
+
264
+ // Select'e tıklandığında seçim listesini aç
265
+ selectElement.addEventListener('click', function () {
266
+ if (!isInputFocused) {
267
+ filterInput.style.display = 'block';
268
+ selectListElement.style.display = 'block';
269
+ setTimeout(() => {
270
+ filterInput.focus();
271
+ }, 100); // Gecikme, select listesi açılırken input'a odaklanması için
272
+ }
273
+ });
274
+
275
+ // Input odaklandığında flag'i true yap
276
+ filterInput.addEventListener('focus', function () {
277
+ isInputFocused = true;
278
+ });
279
+
280
+ // Input odaktan çıktığında ve select'in blur olayında input'u gizle
281
+ filterInput.addEventListener('blur', function () {
282
+ isInputFocused = false;
283
+ setTimeout(() => {
284
+ setFiltertext("");
285
+ filterInput.style.display = 'none';
286
+ selectListElement.style.display = 'none';
287
+ }, 150); // Gecikme ile select kapanmasını sağla
288
+ });
289
+ };
290
+ const getFilterOptions = () => {
291
+ let rv = options.filter(() => true);
292
+ if (filtertext != "") {
293
+ rv = rv.filter(e => e.text.toLocaleLowerCase().includes(filtertext.toLocaleLowerCase()));
294
+ }
295
+ return rv;
296
+ };
297
+ const getFileImageControl = filename => {
298
+ if (!filename) return false;
299
+ if (filename.includes(";base64,")) return true;
300
+ const validExtensions = ['.jpg', '.jpeg', '.png', '.webp', '.gif'];
301
+ return validExtensions.some(ext => filename.toString().toLocaleLowerCase().includes(ext));
302
+ };
303
+ useEffect(() => {
304
+ if (loaded) {
305
+ let vl = value;
306
+ if (value == undefined) vl = null;
307
+ if (vl == null && (type == MyInputType.TEXT || type == MyInputType.MAIL || type == MyInputType.TEXTAREA || type == MyInputType.PASSWORD)) vl = "";
308
+ // if (vl != myValue) setMyValue(vl);
309
+ if (vl == null) setMyFileName(null);
310
+ }
311
+ }, [value]);
312
+ useEffect(() => {
313
+ if (myValue != value && onChange != null) {
314
+ onChange({
315
+ value: myValue,
316
+ target: {
317
+ value: myValue
318
+ }
319
+ });
320
+ }
321
+ }, [myValue]);
322
+ useEffect(() => {
323
+ if (title) {
324
+ setMyTitleLite(title.replace(/<\/?[^>]+(>|$)/g, ""));
325
+ }
326
+ }, [title]);
327
+ useEffect(() => {
328
+ setLoaded(true);
329
+ if (type == MyInputType.SELECTFILTER) filterSelectEvents();
330
+ if (type == MyInputType.DATE) {
331
+ const dateInput = document.getElementById("myDate" + myInputId);
332
+ dateInput.addEventListener('click', () => {
333
+ // Tarih seçiciyi göstermek için odaklanma
334
+ dateInput.showPicker?.(); // Eğer destekliyorsa
335
+ });
336
+ }
337
+ if (type == MyInputType.DATETIME) {
338
+ const dateTimeInput = document.getElementById("myDateTime" + myInputId);
339
+ dateTimeInput.addEventListener('click', () => {
340
+ // Tarih seçiciyi göstermek için odaklanma
341
+ dateTimeInput.showPicker?.(); // Eğer destekliyorsa
342
+ });
343
+ }
344
+ if (type == MyInputType.TIME) {
345
+ const timeInput = document.getElementById("myTime" + myInputId);
346
+ timeInput.addEventListener('click', () => {
347
+ // Saat seçiciyi göstermek için odaklanma
348
+ timeInput.showPicker?.(); // Eğer destekliyorsa
349
+ });
350
+ }
351
+ }, []);
352
+ const renderInput = () => {
353
+ if (disabled || type === MyInputType.READONLY) {
354
+ return /*#__PURE__*/React.createElement("span", {
355
+ className: styles.disabledInput,
356
+ dangerouslySetInnerHTML: dangerouslySetInnerHTML ? dangerouslySetInnerHTML : {
357
+ __html: getMyValueText()
358
+ },
359
+ style: rows > 0 ? {
360
+ ...(style ? style : {}),
361
+ height: rows * 30 + 'px',
362
+ alignItems: "flex-start"
363
+ } : style
364
+ });
365
+ }
366
+ const inputTypes = {
367
+ [MyInputType.TEXT]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
368
+ ref: ref,
369
+ id: id,
370
+ type: "text",
371
+ value: myValue,
372
+ onChange: onMyChange,
373
+ placeholder: placeholder || myTitleLite,
374
+ autoComplete: "off",
375
+ style: style,
376
+ maxLength: maxlength,
377
+ onBlur: onMyBlur,
378
+ onFocus: onMyFocus,
379
+ onKeyDown: onMyKeyDown,
380
+ onKeyUp: onMyKeyUp,
381
+ onKeyPress: onMyKeyPress,
382
+ onMouseDown: onMyMouseDown,
383
+ onMouseUp: onMyMouseUp,
384
+ onMouseEnter: onMyMouseEnter,
385
+ onMouseLeave: onMyMouseLeave
386
+ })),
387
+ [MyInputType.MAIL]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
388
+ ref: ref,
389
+ id: id,
390
+ type: "text",
391
+ value: myValue?.toLowerCase(),
392
+ onChange: e => onMyChange({
393
+ ...e,
394
+ target: {
395
+ ...e.target,
396
+ value: e.target.value.toLowerCase().replace(/\s/g, '')
397
+ }
398
+ }),
399
+ placeholder: placeholder || myTitleLite,
400
+ autoComplete: "off",
401
+ style: style,
402
+ onBlur: onMyBlur,
403
+ onFocus: onMyFocus,
404
+ onKeyDown: onMyKeyDown,
405
+ onKeyUp: onMyKeyUp,
406
+ onKeyPress: onMyKeyPress,
407
+ onMouseDown: onMyMouseDown,
408
+ onMouseUp: onMyMouseUp,
409
+ onMouseEnter: onMyMouseEnter,
410
+ onMouseLeave: onMyMouseLeave
411
+ })),
412
+ [MyInputType.PHONE]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
413
+ ref: ref,
414
+ id: id,
415
+ type: "text",
416
+ value: myValue,
417
+ onChange: e => {
418
+ const value = e.target.value.replace(/[^0-9()-]/g, '');
419
+ onMyChange({
420
+ ...e,
421
+ target: {
422
+ ...e.target,
423
+ value
424
+ }
425
+ });
426
+ },
427
+ placeholder: placeholder || myTitleLite,
428
+ autoComplete: "off",
429
+ style: style,
430
+ onBlur: onMyBlur,
431
+ onFocus: onMyFocus,
432
+ onKeyDown: onMyKeyDown,
433
+ onKeyUp: onMyKeyUp,
434
+ onKeyPress: onMyKeyPress,
435
+ onMouseDown: onMyMouseDown,
436
+ onMouseUp: onMyMouseUp,
437
+ onMouseEnter: onMyMouseEnter,
438
+ onMouseLeave: onMyMouseLeave
439
+ })),
440
+ [MyInputType.MONEY]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
441
+ ref: ref,
442
+ id: id,
443
+ type: "text",
444
+ value: moneyFormat(myValue),
445
+ onChange: onMyChange,
446
+ placeholder: placeholder || myTitleLite,
447
+ autoComplete: "off",
448
+ style: style,
449
+ onBlur: onMyBlur,
450
+ onFocus: onMyFocus,
451
+ onKeyDown: onMyKeyDown,
452
+ onKeyUp: onMyKeyUp,
453
+ onKeyPress: onMyKeyPress,
454
+ onMouseDown: onMyMouseDown,
455
+ onMouseUp: onMyMouseUp,
456
+ onMouseEnter: onMyMouseEnter,
457
+ onMouseLeave: onMyMouseLeave
458
+ })),
459
+ [MyInputType.NUMBER]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
460
+ ref: ref,
461
+ id: id,
462
+ type: "number",
463
+ value: myValue,
464
+ onChange: onMyChange,
465
+ placeholder: placeholder || myTitleLite,
466
+ autoComplete: "off",
467
+ style: style,
468
+ onBlur: onMyBlur,
469
+ onFocus: onMyFocus,
470
+ onKeyDown: onMyKeyDown,
471
+ onKeyUp: onMyKeyUp,
472
+ onKeyPress: onMyKeyPress,
473
+ onMouseDown: onMyMouseDown,
474
+ onMouseUp: onMyMouseUp,
475
+ onMouseEnter: onMyMouseEnter,
476
+ onMouseLeave: onMyMouseLeave
477
+ })),
478
+ [MyInputType.DATE]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
479
+ ref: ref,
480
+ type: "date",
481
+ id: "myDate" + myInputId,
482
+ value: myValue || '',
483
+ onChange: onMyChange,
484
+ placeholder: placeholder || myTitleLite,
485
+ min: minDate,
486
+ max: maxDate,
487
+ style: style,
488
+ onBlur: onMyBlur,
489
+ onFocus: onMyFocus,
490
+ onKeyDown: onMyKeyDown,
491
+ onKeyUp: onMyKeyUp,
492
+ onKeyPress: onMyKeyPress,
493
+ onMouseDown: onMyMouseDown,
494
+ onMouseUp: onMyMouseUp,
495
+ onMouseEnter: onMyMouseEnter,
496
+ onMouseLeave: onMyMouseLeave
497
+ })),
498
+ [MyInputType.DATETIME]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
499
+ ref: ref,
500
+ type: "datetime-local",
501
+ id: "myDateTime" + myInputId,
502
+ value: myValue || '',
503
+ onChange: onMyChange,
504
+ placeholder: placeholder || myTitleLite,
505
+ min: minDate,
506
+ max: maxDate,
507
+ style: style,
508
+ onBlur: onMyBlur,
509
+ onFocus: onMyFocus,
510
+ onKeyDown: onMyKeyDown,
511
+ onKeyUp: onMyKeyUp,
512
+ onKeyPress: onMyKeyPress,
513
+ onMouseDown: onMyMouseDown,
514
+ onMouseUp: onMyMouseUp,
515
+ onMouseEnter: onMyMouseEnter,
516
+ onMouseLeave: onMyMouseLeave
517
+ })),
518
+ [MyInputType.TIME]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
519
+ ref: ref,
520
+ type: "time",
521
+ id: "myTime" + myInputId,
522
+ value: myValue || '',
523
+ onChange: onMyChange,
524
+ placeholder: placeholder || myTitleLite,
525
+ style: style,
526
+ onBlur: onMyBlur,
527
+ onFocus: onMyFocus,
528
+ onKeyDown: onMyKeyDown,
529
+ onKeyUp: onMyKeyUp,
530
+ onKeyPress: onMyKeyPress,
531
+ onMouseDown: onMyMouseDown,
532
+ onMouseUp: onMyMouseUp,
533
+ onMouseEnter: onMyMouseEnter,
534
+ onMouseLeave: onMyMouseLeave
535
+ })),
536
+ [MyInputType.PASSWORD]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
537
+ ref: ref,
538
+ id: id,
539
+ type: myEyeView ? "text" : "password",
540
+ value: myValue,
541
+ onChange: onMyChange,
542
+ placeholder: placeholder || myTitleLite,
543
+ autoComplete: "new-password",
544
+ style: style,
545
+ maxLength: maxlength,
546
+ onBlur: onMyBlur,
547
+ onFocus: onMyFocus,
548
+ onKeyDown: onMyKeyDown,
549
+ onKeyUp: onMyKeyUp,
550
+ onKeyPress: onMyKeyPress,
551
+ onMouseDown: onMyMouseDown,
552
+ onMouseUp: onMyMouseUp,
553
+ onMouseEnter: onMyMouseEnter,
554
+ onMouseLeave: onMyMouseLeave
555
+ }), /*#__PURE__*/React.createElement("button", {
556
+ type: "button",
557
+ className: styles.eye,
558
+ onClick: () => setMyEyeView(!myEyeView)
559
+ }, myEyeView ? /*#__PURE__*/React.createElement(PiEyeSlash, null) : /*#__PURE__*/React.createElement(PiEye, null))),
560
+ [MyInputType.COLOR]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
561
+ ref: ref,
562
+ id: id,
563
+ type: "color",
564
+ value: myValue,
565
+ onChange: onMyChange,
566
+ placeholder: placeholder || myTitleLite,
567
+ style: style,
568
+ onBlur: onMyBlur,
569
+ onFocus: onMyFocus,
570
+ onKeyDown: onMyKeyDown,
571
+ onKeyUp: onMyKeyUp,
572
+ onKeyPress: onMyKeyPress,
573
+ onMouseDown: onMyMouseDown,
574
+ onMouseUp: onMyMouseUp,
575
+ onMouseEnter: onMyMouseEnter,
576
+ onMouseLeave: onMyMouseLeave
577
+ })),
578
+ [MyInputType.TEXTAREA]: () => /*#__PURE__*/React.createElement("textarea", {
579
+ ref: ref,
580
+ id: id,
581
+ onChange: onMyChange,
582
+ rows: rows,
583
+ placeholder: placeholder || myTitleLite,
584
+ value: myValue,
585
+ style: style,
586
+ maxLength: maxlength,
587
+ onBlur: onMyBlur,
588
+ onFocus: onMyFocus,
589
+ onKeyDown: onMyKeyDown,
590
+ onKeyUp: onMyKeyUp,
591
+ onKeyPress: onMyKeyPress,
592
+ onMouseDown: onMyMouseDown,
593
+ onMouseUp: onMyMouseUp,
594
+ onMouseEnter: onMyMouseEnter,
595
+ onMouseLeave: onMyMouseLeave
596
+ }),
597
+ [MyInputType.SELECT]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("select", {
598
+ ref: ref,
599
+ id: id,
600
+ onChange: e => onMyChange(e),
601
+ value: myValue && !isNaN(myValue) ? MyInputIsNumeric(myValue) ? parseInt(myValue) : myValue : "",
602
+ style: style,
603
+ onBlur: onMyBlur,
604
+ onFocus: onMyFocus,
605
+ onKeyDown: onMyKeyDown,
606
+ onKeyUp: onMyKeyUp,
607
+ onKeyPress: onMyKeyPress,
608
+ onMouseDown: onMyMouseDown,
609
+ onMouseUp: onMyMouseUp,
610
+ onMouseEnter: onMyMouseEnter,
611
+ onMouseLeave: onMyMouseLeave
612
+ }, options && options.map(e => {
613
+ return /*#__PURE__*/React.createElement("option", {
614
+ key: e[options_key_value],
615
+ value: MyInputIsNumeric(e[options_key_value]) ? parseInt(e[options_key_value]) : e[options_key_value]
616
+ }, e[options_key_text] || e["label"]);
617
+ })), !myValue && !options && (placeholder || myTitleLite) && /*#__PURE__*/React.createElement("span", {
618
+ className: styles.placeholder
619
+ }, placeholder ? placeholder : myTitleLite)),
620
+ [MyInputType.SELECTFILTER]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
621
+ ref: ref,
622
+ id: "mySelectFilterInput" + (id ? id : myInputId),
623
+ type: "text",
624
+ className: styles.filterInput,
625
+ style: style,
626
+ value: filtertext,
627
+ onChange: e => setFiltertext(e.target.value),
628
+ placeholder: placeholdersearchtext && placeholdersearchtext != "" ? placeholdersearchtext : (placeholder ? placeholder : myTitleLite) + " " + t("Ara"),
629
+ onBlur: onMyBlur,
630
+ onFocus: onMyFocus,
631
+ onKeyDown: onMyKeyDown,
632
+ onKeyUp: onMyKeyUp,
633
+ onKeyPress: onMyKeyPress,
634
+ onMouseDown: onMyMouseDown,
635
+ onMouseUp: onMyMouseUp,
636
+ onMouseEnter: onMyMouseEnter,
637
+ onMouseLeave: onMyMouseLeave
638
+ }), /*#__PURE__*/React.createElement("div", {
639
+ className: styles.filterInputSelectedContainer + " " + (myValue ? styles.filterInputSelectedContainerSelected : '')
640
+ }, /*#__PURE__*/React.createElement("span", {
641
+ id: "mySelectFilterSelected" + (id ? id : myInputId),
642
+ className: styles.filterInputSelected,
643
+ dangerouslySetInnerHTML: {
644
+ __html: getMyValueText()
645
+ }
646
+ }), myValue && /*#__PURE__*/React.createElement("span", {
647
+ className: styles.filterInputSelectedX,
648
+ onClick: () => setMyValue(null),
649
+ title: t("Seçimi Kaldır")
650
+ }, "x") || "", /*#__PURE__*/React.createElement(PiCaretDownBold, {
651
+ className: styles.caretdown
652
+ })), !myValue && (placeholder || myTitleLite) && /*#__PURE__*/React.createElement("span", {
653
+ className: styles.placeholder
654
+ }, placeholder ? placeholder : myTitleLite), /*#__PURE__*/React.createElement("ul", {
655
+ id: "mySelectFilterList" + (id ? id : myInputId),
656
+ className: styles.filterInputList
657
+ }, options && getFilterOptions().map(item => {
658
+ return /*#__PURE__*/React.createElement("li", {
659
+ key: item[options_key_value],
660
+ value: MyInputIsNumeric(item[options_key_value]) ? parseInt(item[options_key_value]) : item[options_key_value],
661
+ onClick: () => mySelectFilterListClick(item),
662
+ className: item[options_key_subtext] ? styles.subtextli : ''
663
+ }, /*#__PURE__*/React.createElement("span", {
664
+ dangerouslySetInnerHTML: {
665
+ __html: item[options_key_text] || item["label"]
666
+ }
667
+ }), item[options_key_subtext] && /*#__PURE__*/React.createElement("span", {
668
+ className: styles.subtext
669
+ }, item[options_key_subtext]));
670
+ })), /*#__PURE__*/React.createElement("div", {
671
+ style: {
672
+ display: "none"
673
+ }
674
+ }, /*#__PURE__*/React.createElement("select", {
675
+ id: "mySelectFilterHiddenSelect" + myInputId,
676
+ onChange: e => onMyChange(e),
677
+ value: myValue && !isNaN(myValue) ? MyInputIsNumeric(myValue) ? parseInt(myValue) : myValue : ""
678
+ }, options && options.map(item => {
679
+ return /*#__PURE__*/React.createElement("option", {
680
+ key: item[options_key_value],
681
+ value: MyInputIsNumeric(item[options_key_value]) ? parseInt(item[options_key_value]) : item[options_key_value]
682
+ }, item[options_key_text] || item["label"]);
683
+ })))),
684
+ [MyInputType.FILE]: () => /*#__PURE__*/React.createElement("div", {
685
+ className: styles.fileinput
686
+ }, (() => {
687
+ // Dosya önizleme gösterimi için kontrol
688
+ if (myValue && (type === MyInputType.IMAGE || accept === '.jpg,.jpeg,.png')) {
689
+ if (Array.isArray(myValue) && myValue.length === 1 && getFileImageControl(myValue[0].filename)) {
690
+ return /*#__PURE__*/React.createElement("img", {
691
+ src: myValue[0].base64,
692
+ className: styles.fileImagePreview,
693
+ alt: "Preview"
694
+ });
695
+ } else if (getFileImageControl(myValue)) {
696
+ return /*#__PURE__*/React.createElement("img", {
697
+ src: myValue,
698
+ className: styles.fileImagePreview,
699
+ alt: "Preview"
700
+ });
701
+ }
702
+ }
703
+ return null;
704
+ })(), /*#__PURE__*/React.createElement("div", {
705
+ className: styles.filename + " " + (myFileName && styles.selected),
706
+ dangerouslySetInnerHTML: {
707
+ __html: myFileName || (placeholder ? placeholder : t(type === MyInputType.IMAGE ? "Görsel Seçiniz" : "Dosya Seçiniz"))
708
+ }
709
+ }), (() => {
710
+ if (onRemoveImage && myValue && type === MyInputType.IMAGE && (Array.isArray(myValue) && myValue.length === 1 && getFileImageControl(myValue[0].filename) || getFileImageControl(myValue) && !(myValue.includes("nologo") || myValue.includes("noimage")))) {
711
+ return /*#__PURE__*/React.createElement("button", {
712
+ type: "button",
713
+ onClick: onRemoveImageClick,
714
+ className: styles.filebuttonremove,
715
+ title: t("Kaldır")
716
+ }, "x");
717
+ }
718
+ return null;
719
+ })(), /*#__PURE__*/React.createElement("button", {
720
+ type: "button",
721
+ onClick: () => fileInputRef.current.click(),
722
+ className: styles.filebutton
723
+ }, type === MyInputType.IMAGE ? t("Görsel Seç") : t("Dosya Seç")), /*#__PURE__*/React.createElement("input", _extends({
724
+ type: "file",
725
+ ref: fileInputRef,
726
+ onChange: e => onMyChange(e),
727
+ placeholder: placeholder || myTitleLite,
728
+ style: {
729
+ display: "none"
730
+ }
731
+ }, multiple ? {
732
+ multiple: true
733
+ } : {}, {
734
+ accept: type === MyInputType.IMAGE ? '.jpg,.jpeg,.png' : accept
735
+ }))),
736
+ [MyInputType.IMAGE]: function () {
737
+ return this[MyInputType.FILE]();
738
+ }
739
+ };
740
+ return inputTypes[type]?.() || null;
741
+ };
742
+ return /*#__PURE__*/React.createElement("div", {
743
+ id: "myinput" + myInputId,
744
+ className: styles.container + " " + (className != null ? className : '') + " " + (isError ? styles.error : ''),
745
+ title: title && myTitleLite || placeholder && placeholder,
746
+ style: style && style.width && {
747
+ display: 'inline-block'
748
+ } || {
749
+ width: '100%'
750
+ }
751
+ }, title && /*#__PURE__*/React.createElement("small", {
752
+ dangerouslySetInnerHTML: {
753
+ __html: title
754
+ }
755
+ }), /*#__PURE__*/React.createElement("div", {
756
+ className: styles.inputblock + " " + (disabled || type === MyInputType.READONLY ? styles.inputblockdisabled : '') + " " + (icon || type === MyInputType.IMAGE ? styles.inputblockicon : ''),
757
+ style: style && {
758
+ ...(style.backgroundColor && {
759
+ backgroundColor: style.backgroundColor
760
+ })
761
+ }
762
+ }, icon && /*#__PURE__*/React.createElement("div", {
763
+ className: `${styles.icon} ${type === MyInputType.TEXTAREA || rows > 0 ? styles.icontextarea : ''}`
764
+ }, icon), renderInput()), description && /*#__PURE__*/React.createElement("small", {
765
+ className: styles.description
766
+ }, description));
767
+ }
768
+ export default MyInput;