px-react-ui-components 1.0.2 → 1.0.5

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.
@@ -1,9 +1,18 @@
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, PiImage } from "react-icons/pi";
5
- import { MdOutlineAttachFile } from "react-icons/md";
6
- export const MyInputType = Object.freeze({
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.MyInputType = exports.MyInputIsNumeric = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _MyInputModule = _interopRequireDefault(require("./MyInput.module.css"));
9
+ var _pi = require("react-icons/pi");
10
+ var _md = require("react-icons/md");
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
14
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
+ const MyInputType = exports.MyInputType = Object.freeze({
7
16
  TEXT: 'text',
8
17
  PASSWORD: 'password',
9
18
  SELECT: 'select',
@@ -21,10 +30,11 @@ export const MyInputType = Object.freeze({
21
30
  MAIL: 'mail',
22
31
  PHONE: 'phone'
23
32
  });
24
- export const MyInputIsNumeric = value => {
33
+ const MyInputIsNumeric = value => {
25
34
  if (value === null || value === undefined || value === '') return false;
26
35
  return !isNaN(value) && !isNaN(parseFloat(value));
27
36
  };
37
+ exports.MyInputIsNumeric = MyInputIsNumeric;
28
38
  function MyInput({
29
39
  id = null,
30
40
  ref = null,
@@ -67,14 +77,14 @@ function MyInput({
67
77
  onRemoveImage = null
68
78
  }) {
69
79
  const myInputId = `key${Date.now() + Math.random().toString(36).substr(2, 9)}`;
70
- const fileInputRef = useRef(null);
71
- const [loaded, setLoaded] = useState(false);
72
- const [myValue, setMyValue] = useState(value);
73
- const [myEyeView, setMyEyeView] = useState(false);
74
- const [myFileName, setMyFileName] = useState(null);
75
- const [myTitleLite, setMyTitleLite] = useState("");
76
- const [filtertext, setFiltertext] = useState("");
77
- const [isError, setIsError] = useState(false);
80
+ const fileInputRef = (0, _react.useRef)(null);
81
+ const [loaded, setLoaded] = (0, _react.useState)(false);
82
+ const [myValue, setMyValue] = (0, _react.useState)(value);
83
+ const [myEyeView, setMyEyeView] = (0, _react.useState)(false);
84
+ const [myFileName, setMyFileName] = (0, _react.useState)(null);
85
+ const [myTitleLite, setMyTitleLite] = (0, _react.useState)("");
86
+ const [filtertext, setFiltertext] = (0, _react.useState)("");
87
+ const [isError, setIsError] = (0, _react.useState)(false);
78
88
  const toBase64 = file => new Promise((resolve, reject) => {
79
89
  const reader = new FileReader();
80
90
  reader.readAsDataURL(file);
@@ -297,7 +307,7 @@ function MyInput({
297
307
  const validExtensions = ['.jpg', '.jpeg', '.png', '.webp', '.gif'];
298
308
  return validExtensions.some(ext => filename.toString().toLocaleLowerCase().includes(ext));
299
309
  };
300
- useEffect(() => {
310
+ (0, _react.useEffect)(() => {
301
311
  if (loaded) {
302
312
  let vl = value;
303
313
  if (value == undefined) vl = null;
@@ -306,7 +316,7 @@ function MyInput({
306
316
  if (vl == null) setMyFileName(null);
307
317
  }
308
318
  }, [value]);
309
- useEffect(() => {
319
+ (0, _react.useEffect)(() => {
310
320
  if (myValue != value && onChange != null) {
311
321
  onChange({
312
322
  value: myValue,
@@ -316,12 +326,12 @@ function MyInput({
316
326
  });
317
327
  }
318
328
  }, [myValue]);
319
- useEffect(() => {
329
+ (0, _react.useEffect)(() => {
320
330
  if (title) {
321
331
  setMyTitleLite(title.replace(/<\/?[^>]+(>|$)/g, ""));
322
332
  }
323
333
  }, [title]);
324
- useEffect(() => {
334
+ (0, _react.useEffect)(() => {
325
335
  setLoaded(true);
326
336
  if (type == MyInputType.SELECTFILTER) filterSelectEvents();
327
337
  if (type == MyInputType.DATE) {
@@ -348,8 +358,8 @@ function MyInput({
348
358
  }, []);
349
359
  const renderInput = () => {
350
360
  if (disabled || type === MyInputType.READONLY) {
351
- return /*#__PURE__*/React.createElement("span", {
352
- className: styles.disabledInput,
361
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
362
+ className: _MyInputModule.default.disabledInput,
353
363
  dangerouslySetInnerHTML: dangerouslySetInnerHTML ? dangerouslySetInnerHTML : {
354
364
  __html: getMyValueText()
355
365
  },
@@ -361,218 +371,239 @@ function MyInput({
361
371
  });
362
372
  }
363
373
  const inputTypes = {
364
- [MyInputType.TEXT]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
365
- ref: ref,
366
- id: id,
367
- type: "text",
368
- value: myValue,
369
- onChange: onMyChange,
370
- placeholder: placeholder || myTitleLite,
371
- autoComplete: "off",
372
- style: style,
373
- maxLength: maxlength,
374
- onBlur: onMyBlur,
375
- onFocus: onMyFocus,
376
- onKeyDown: onMyKeyDown,
377
- onKeyUp: onMyKeyUp,
378
- onKeyPress: onMyKeyPress,
379
- onMouseDown: onMyMouseDown,
380
- onMouseUp: onMyMouseUp,
381
- onMouseEnter: onMyMouseEnter,
382
- onMouseLeave: onMyMouseLeave
383
- })),
384
- [MyInputType.MAIL]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
385
- ref: ref,
386
- id: id,
387
- type: "text",
388
- value: myValue?.toLowerCase(),
389
- onChange: e => onMyChange({
390
- ...e,
391
- target: {
392
- ...e.target,
393
- value: e.target.value.toLowerCase().replace(/\s/g, '')
394
- }
395
- }),
396
- placeholder: placeholder || myTitleLite,
397
- autoComplete: "off",
398
- style: style,
399
- onBlur: onMyBlur,
400
- onFocus: onMyFocus,
401
- onKeyDown: onMyKeyDown,
402
- onKeyUp: onMyKeyUp,
403
- onKeyPress: onMyKeyPress,
404
- onMouseDown: onMyMouseDown,
405
- onMouseUp: onMyMouseUp,
406
- onMouseEnter: onMyMouseEnter,
407
- onMouseLeave: onMyMouseLeave
408
- })),
409
- [MyInputType.PHONE]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
410
- ref: ref,
411
- id: id,
412
- type: "text",
413
- value: myValue,
414
- onChange: e => {
415
- const value = e.target.value.replace(/[^0-9()-]/g, '');
416
- onMyChange({
374
+ [MyInputType.TEXT]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
375
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
376
+ ref: ref,
377
+ id: id,
378
+ type: "text",
379
+ value: myValue,
380
+ onChange: onMyChange,
381
+ placeholder: placeholder || myTitleLite,
382
+ autoComplete: "off",
383
+ style: style,
384
+ maxLength: maxlength,
385
+ onBlur: onMyBlur,
386
+ onFocus: onMyFocus,
387
+ onKeyDown: onMyKeyDown,
388
+ onKeyUp: onMyKeyUp,
389
+ onKeyPress: onMyKeyPress,
390
+ onMouseDown: onMyMouseDown,
391
+ onMouseUp: onMyMouseUp,
392
+ onMouseEnter: onMyMouseEnter,
393
+ onMouseLeave: onMyMouseLeave
394
+ })
395
+ }),
396
+ [MyInputType.MAIL]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
397
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
398
+ ref: ref,
399
+ id: id,
400
+ type: "text",
401
+ value: myValue?.toLowerCase(),
402
+ onChange: e => onMyChange({
417
403
  ...e,
418
404
  target: {
419
405
  ...e.target,
420
- value
406
+ value: e.target.value.toLowerCase().replace(/\s/g, '')
421
407
  }
422
- });
423
- },
424
- placeholder: placeholder || myTitleLite,
425
- autoComplete: "off",
426
- style: style,
427
- onBlur: onMyBlur,
428
- onFocus: onMyFocus,
429
- onKeyDown: onMyKeyDown,
430
- onKeyUp: onMyKeyUp,
431
- onKeyPress: onMyKeyPress,
432
- onMouseDown: onMyMouseDown,
433
- onMouseUp: onMyMouseUp,
434
- onMouseEnter: onMyMouseEnter,
435
- onMouseLeave: onMyMouseLeave
436
- })),
437
- [MyInputType.MONEY]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
438
- ref: ref,
439
- id: id,
440
- type: "text",
441
- value: moneyFormat(myValue),
442
- onChange: onMyChange,
443
- placeholder: placeholder || myTitleLite,
444
- autoComplete: "off",
445
- style: style,
446
- onBlur: onMyBlur,
447
- onFocus: onMyFocus,
448
- onKeyDown: onMyKeyDown,
449
- onKeyUp: onMyKeyUp,
450
- onKeyPress: onMyKeyPress,
451
- onMouseDown: onMyMouseDown,
452
- onMouseUp: onMyMouseUp,
453
- onMouseEnter: onMyMouseEnter,
454
- onMouseLeave: onMyMouseLeave
455
- })),
456
- [MyInputType.NUMBER]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
457
- ref: ref,
458
- id: id,
459
- type: "number",
460
- value: myValue,
461
- onChange: onMyChange,
462
- placeholder: placeholder || myTitleLite,
463
- autoComplete: "off",
464
- style: style,
465
- onBlur: onMyBlur,
466
- onFocus: onMyFocus,
467
- onKeyDown: onMyKeyDown,
468
- onKeyUp: onMyKeyUp,
469
- onKeyPress: onMyKeyPress,
470
- onMouseDown: onMyMouseDown,
471
- onMouseUp: onMyMouseUp,
472
- onMouseEnter: onMyMouseEnter,
473
- onMouseLeave: onMyMouseLeave
474
- })),
475
- [MyInputType.DATE]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
476
- ref: ref,
477
- type: "date",
478
- id: "myDate" + myInputId,
479
- value: myValue || '',
480
- onChange: onMyChange,
481
- placeholder: placeholder || myTitleLite,
482
- min: minDate,
483
- max: maxDate,
484
- style: style,
485
- onBlur: onMyBlur,
486
- onFocus: onMyFocus,
487
- onKeyDown: onMyKeyDown,
488
- onKeyUp: onMyKeyUp,
489
- onKeyPress: onMyKeyPress,
490
- onMouseDown: onMyMouseDown,
491
- onMouseUp: onMyMouseUp,
492
- onMouseEnter: onMyMouseEnter,
493
- onMouseLeave: onMyMouseLeave
494
- })),
495
- [MyInputType.DATETIME]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
496
- ref: ref,
497
- type: "datetime-local",
498
- id: "myDateTime" + myInputId,
499
- value: myValue || '',
500
- onChange: onMyChange,
501
- placeholder: placeholder || myTitleLite,
502
- min: minDate,
503
- max: maxDate,
504
- style: style,
505
- onBlur: onMyBlur,
506
- onFocus: onMyFocus,
507
- onKeyDown: onMyKeyDown,
508
- onKeyUp: onMyKeyUp,
509
- onKeyPress: onMyKeyPress,
510
- onMouseDown: onMyMouseDown,
511
- onMouseUp: onMyMouseUp,
512
- onMouseEnter: onMyMouseEnter,
513
- onMouseLeave: onMyMouseLeave
514
- })),
515
- [MyInputType.TIME]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
516
- ref: ref,
517
- type: "time",
518
- id: "myTime" + myInputId,
519
- value: myValue || '',
520
- onChange: onMyChange,
521
- placeholder: placeholder || myTitleLite,
522
- style: style,
523
- onBlur: onMyBlur,
524
- onFocus: onMyFocus,
525
- onKeyDown: onMyKeyDown,
526
- onKeyUp: onMyKeyUp,
527
- onKeyPress: onMyKeyPress,
528
- onMouseDown: onMyMouseDown,
529
- onMouseUp: onMyMouseUp,
530
- onMouseEnter: onMyMouseEnter,
531
- onMouseLeave: onMyMouseLeave
532
- })),
533
- [MyInputType.PASSWORD]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
534
- ref: ref,
535
- id: id,
536
- type: myEyeView ? "text" : "password",
537
- value: myValue,
538
- onChange: onMyChange,
539
- placeholder: placeholder || myTitleLite,
540
- autoComplete: "new-password",
541
- style: style,
542
- maxLength: maxlength,
543
- onBlur: onMyBlur,
544
- onFocus: onMyFocus,
545
- onKeyDown: onMyKeyDown,
546
- onKeyUp: onMyKeyUp,
547
- onKeyPress: onMyKeyPress,
548
- onMouseDown: onMyMouseDown,
549
- onMouseUp: onMyMouseUp,
550
- onMouseEnter: onMyMouseEnter,
551
- onMouseLeave: onMyMouseLeave
552
- }), /*#__PURE__*/React.createElement("button", {
553
- type: "button",
554
- className: styles.eye,
555
- onClick: () => setMyEyeView(!myEyeView)
556
- }, myEyeView ? /*#__PURE__*/React.createElement(PiEyeSlash, null) : /*#__PURE__*/React.createElement(PiEye, null))),
557
- [MyInputType.COLOR]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
558
- ref: ref,
559
- id: id,
560
- type: "color",
561
- value: myValue,
562
- onChange: onMyChange,
563
- placeholder: placeholder || myTitleLite,
564
- style: style,
565
- onBlur: onMyBlur,
566
- onFocus: onMyFocus,
567
- onKeyDown: onMyKeyDown,
568
- onKeyUp: onMyKeyUp,
569
- onKeyPress: onMyKeyPress,
570
- onMouseDown: onMyMouseDown,
571
- onMouseUp: onMyMouseUp,
572
- onMouseEnter: onMyMouseEnter,
573
- onMouseLeave: onMyMouseLeave
574
- })),
575
- [MyInputType.TEXTAREA]: () => /*#__PURE__*/React.createElement("textarea", {
408
+ }),
409
+ placeholder: placeholder || myTitleLite,
410
+ autoComplete: "off",
411
+ style: style,
412
+ onBlur: onMyBlur,
413
+ onFocus: onMyFocus,
414
+ onKeyDown: onMyKeyDown,
415
+ onKeyUp: onMyKeyUp,
416
+ onKeyPress: onMyKeyPress,
417
+ onMouseDown: onMyMouseDown,
418
+ onMouseUp: onMyMouseUp,
419
+ onMouseEnter: onMyMouseEnter,
420
+ onMouseLeave: onMyMouseLeave
421
+ })
422
+ }),
423
+ [MyInputType.PHONE]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
424
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
425
+ ref: ref,
426
+ id: id,
427
+ type: "text",
428
+ value: myValue,
429
+ onChange: e => {
430
+ const value = e.target.value.replace(/[^0-9()-]/g, '');
431
+ onMyChange({
432
+ ...e,
433
+ target: {
434
+ ...e.target,
435
+ value
436
+ }
437
+ });
438
+ },
439
+ placeholder: placeholder || myTitleLite,
440
+ autoComplete: "off",
441
+ style: style,
442
+ onBlur: onMyBlur,
443
+ onFocus: onMyFocus,
444
+ onKeyDown: onMyKeyDown,
445
+ onKeyUp: onMyKeyUp,
446
+ onKeyPress: onMyKeyPress,
447
+ onMouseDown: onMyMouseDown,
448
+ onMouseUp: onMyMouseUp,
449
+ onMouseEnter: onMyMouseEnter,
450
+ onMouseLeave: onMyMouseLeave
451
+ })
452
+ }),
453
+ [MyInputType.MONEY]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
454
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
455
+ ref: ref,
456
+ id: id,
457
+ type: "text",
458
+ value: moneyFormat(myValue),
459
+ onChange: onMyChange,
460
+ placeholder: placeholder || myTitleLite,
461
+ autoComplete: "off",
462
+ style: style,
463
+ onBlur: onMyBlur,
464
+ onFocus: onMyFocus,
465
+ onKeyDown: onMyKeyDown,
466
+ onKeyUp: onMyKeyUp,
467
+ onKeyPress: onMyKeyPress,
468
+ onMouseDown: onMyMouseDown,
469
+ onMouseUp: onMyMouseUp,
470
+ onMouseEnter: onMyMouseEnter,
471
+ onMouseLeave: onMyMouseLeave
472
+ })
473
+ }),
474
+ [MyInputType.NUMBER]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
475
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
476
+ ref: ref,
477
+ id: id,
478
+ type: "number",
479
+ value: myValue,
480
+ onChange: onMyChange,
481
+ placeholder: placeholder || myTitleLite,
482
+ autoComplete: "off",
483
+ style: style,
484
+ onBlur: onMyBlur,
485
+ onFocus: onMyFocus,
486
+ onKeyDown: onMyKeyDown,
487
+ onKeyUp: onMyKeyUp,
488
+ onKeyPress: onMyKeyPress,
489
+ onMouseDown: onMyMouseDown,
490
+ onMouseUp: onMyMouseUp,
491
+ onMouseEnter: onMyMouseEnter,
492
+ onMouseLeave: onMyMouseLeave
493
+ })
494
+ }),
495
+ [MyInputType.DATE]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
496
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
497
+ ref: ref,
498
+ type: "date",
499
+ id: "myDate" + myInputId,
500
+ value: myValue || '',
501
+ onChange: onMyChange,
502
+ placeholder: placeholder || myTitleLite,
503
+ min: minDate,
504
+ max: maxDate,
505
+ style: style,
506
+ onBlur: onMyBlur,
507
+ onFocus: onMyFocus,
508
+ onKeyDown: onMyKeyDown,
509
+ onKeyUp: onMyKeyUp,
510
+ onKeyPress: onMyKeyPress,
511
+ onMouseDown: onMyMouseDown,
512
+ onMouseUp: onMyMouseUp,
513
+ onMouseEnter: onMyMouseEnter,
514
+ onMouseLeave: onMyMouseLeave
515
+ })
516
+ }),
517
+ [MyInputType.DATETIME]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
518
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
519
+ ref: ref,
520
+ type: "datetime-local",
521
+ id: "myDateTime" + myInputId,
522
+ value: myValue || '',
523
+ onChange: onMyChange,
524
+ placeholder: placeholder || myTitleLite,
525
+ min: minDate,
526
+ max: maxDate,
527
+ style: style,
528
+ onBlur: onMyBlur,
529
+ onFocus: onMyFocus,
530
+ onKeyDown: onMyKeyDown,
531
+ onKeyUp: onMyKeyUp,
532
+ onKeyPress: onMyKeyPress,
533
+ onMouseDown: onMyMouseDown,
534
+ onMouseUp: onMyMouseUp,
535
+ onMouseEnter: onMyMouseEnter,
536
+ onMouseLeave: onMyMouseLeave
537
+ })
538
+ }),
539
+ [MyInputType.TIME]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
540
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
541
+ ref: ref,
542
+ type: "time",
543
+ id: "myTime" + myInputId,
544
+ value: myValue || '',
545
+ onChange: onMyChange,
546
+ placeholder: placeholder || myTitleLite,
547
+ style: style,
548
+ onBlur: onMyBlur,
549
+ onFocus: onMyFocus,
550
+ onKeyDown: onMyKeyDown,
551
+ onKeyUp: onMyKeyUp,
552
+ onKeyPress: onMyKeyPress,
553
+ onMouseDown: onMyMouseDown,
554
+ onMouseUp: onMyMouseUp,
555
+ onMouseEnter: onMyMouseEnter,
556
+ onMouseLeave: onMyMouseLeave
557
+ })
558
+ }),
559
+ [MyInputType.PASSWORD]: () => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
560
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
561
+ ref: ref,
562
+ id: id,
563
+ type: myEyeView ? "text" : "password",
564
+ value: myValue,
565
+ onChange: onMyChange,
566
+ placeholder: placeholder || myTitleLite,
567
+ autoComplete: "new-password",
568
+ style: style,
569
+ maxLength: maxlength,
570
+ onBlur: onMyBlur,
571
+ onFocus: onMyFocus,
572
+ onKeyDown: onMyKeyDown,
573
+ onKeyUp: onMyKeyUp,
574
+ onKeyPress: onMyKeyPress,
575
+ onMouseDown: onMyMouseDown,
576
+ onMouseUp: onMyMouseUp,
577
+ onMouseEnter: onMyMouseEnter,
578
+ onMouseLeave: onMyMouseLeave
579
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
580
+ type: "button",
581
+ className: _MyInputModule.default.eye,
582
+ onClick: () => setMyEyeView(!myEyeView),
583
+ children: myEyeView ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_pi.PiEyeSlash, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_pi.PiEye, {})
584
+ })]
585
+ }),
586
+ [MyInputType.COLOR]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
587
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
588
+ ref: ref,
589
+ id: id,
590
+ type: "color",
591
+ value: myValue,
592
+ onChange: onMyChange,
593
+ placeholder: placeholder || myTitleLite,
594
+ style: style,
595
+ onBlur: onMyBlur,
596
+ onFocus: onMyFocus,
597
+ onKeyDown: onMyKeyDown,
598
+ onKeyUp: onMyKeyUp,
599
+ onKeyPress: onMyKeyPress,
600
+ onMouseDown: onMyMouseDown,
601
+ onMouseUp: onMyMouseUp,
602
+ onMouseEnter: onMyMouseEnter,
603
+ onMouseLeave: onMyMouseLeave
604
+ })
605
+ }),
606
+ [MyInputType.TEXTAREA]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("textarea", {
576
607
  ref: ref,
577
608
  id: id,
578
609
  onChange: onMyChange,
@@ -591,175 +622,195 @@ function MyInput({
591
622
  onMouseEnter: onMyMouseEnter,
592
623
  onMouseLeave: onMyMouseLeave
593
624
  }),
594
- [MyInputType.SELECT]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("select", {
595
- ref: ref,
596
- id: id,
597
- onChange: e => onMyChange(e),
598
- value: myValue && !isNaN(myValue) ? MyInputIsNumeric(myValue) ? parseInt(myValue) : myValue : "",
599
- style: style,
600
- onBlur: onMyBlur,
601
- onFocus: onMyFocus,
602
- onKeyDown: onMyKeyDown,
603
- onKeyUp: onMyKeyUp,
604
- onKeyPress: onMyKeyPress,
605
- onMouseDown: onMyMouseDown,
606
- onMouseUp: onMyMouseUp,
607
- onMouseEnter: onMyMouseEnter,
608
- onMouseLeave: onMyMouseLeave
609
- }, options && options.map(e => {
610
- return /*#__PURE__*/React.createElement("option", {
611
- key: e[options_key_value],
612
- value: MyInputIsNumeric(e[options_key_value]) ? parseInt(e[options_key_value]) : e[options_key_value]
613
- }, e[options_key_text] || e["label"]);
614
- })), !myValue && !options && (placeholder || myTitleLite) && /*#__PURE__*/React.createElement("span", {
615
- className: styles.placeholder
616
- }, placeholder ? placeholder : myTitleLite)),
617
- [MyInputType.SELECTFILTER]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
618
- ref: ref,
619
- id: "mySelectFilterInput" + (id ? id : myInputId),
620
- type: "text",
621
- className: styles.filterInput,
622
- style: style,
623
- value: filtertext,
624
- onChange: e => setFiltertext(e.target.value),
625
- placeholder: placeholdersearchtext && placeholdersearchtext != "" ? placeholdersearchtext : (placeholder ? placeholder : myTitleLite) + " ...",
626
- onBlur: onMyBlur,
627
- onFocus: onMyFocus,
628
- onKeyDown: onMyKeyDown,
629
- onKeyUp: onMyKeyUp,
630
- onKeyPress: onMyKeyPress,
631
- onMouseDown: onMyMouseDown,
632
- onMouseUp: onMyMouseUp,
633
- onMouseEnter: onMyMouseEnter,
634
- onMouseLeave: onMyMouseLeave
635
- }), /*#__PURE__*/React.createElement("div", {
636
- className: styles.filterInputSelectedContainer + " " + (myValue ? styles.filterInputSelectedContainerSelected : '')
637
- }, /*#__PURE__*/React.createElement("span", {
638
- id: "mySelectFilterSelected" + (id ? id : myInputId),
639
- className: styles.filterInputSelected,
640
- dangerouslySetInnerHTML: {
641
- __html: getMyValueText()
642
- }
643
- }), myValue && /*#__PURE__*/React.createElement("span", {
644
- className: styles.filterInputSelectedX,
645
- onClick: () => setMyValue(null),
646
- title: t("Seçimi Kaldır")
647
- }, "x") || "", /*#__PURE__*/React.createElement(PiCaretDownBold, {
648
- className: styles.caretdown
649
- })), !myValue && (placeholder || myTitleLite) && /*#__PURE__*/React.createElement("span", {
650
- className: styles.placeholder
651
- }, placeholder ? placeholder : myTitleLite), /*#__PURE__*/React.createElement("ul", {
652
- id: "mySelectFilterList" + (id ? id : myInputId),
653
- className: styles.filterInputList
654
- }, options && getFilterOptions().map(item => {
655
- return /*#__PURE__*/React.createElement("li", {
656
- key: item[options_key_value],
657
- value: MyInputIsNumeric(item[options_key_value]) ? parseInt(item[options_key_value]) : item[options_key_value],
658
- onClick: () => mySelectFilterListClick(item),
659
- className: item[options_key_subtext] ? styles.subtextli : ''
660
- }, /*#__PURE__*/React.createElement("span", {
625
+ [MyInputType.SELECT]: () => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
626
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("select", {
627
+ ref: ref,
628
+ id: id,
629
+ onChange: e => onMyChange(e),
630
+ value: myValue && !isNaN(myValue) ? MyInputIsNumeric(myValue) ? parseInt(myValue) : myValue : "",
631
+ style: style,
632
+ onBlur: onMyBlur,
633
+ onFocus: onMyFocus,
634
+ onKeyDown: onMyKeyDown,
635
+ onKeyUp: onMyKeyUp,
636
+ onKeyPress: onMyKeyPress,
637
+ onMouseDown: onMyMouseDown,
638
+ onMouseUp: onMyMouseUp,
639
+ onMouseEnter: onMyMouseEnter,
640
+ onMouseLeave: onMyMouseLeave,
641
+ children: options && options.map(e => {
642
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
643
+ value: MyInputIsNumeric(e[options_key_value]) ? parseInt(e[options_key_value]) : e[options_key_value],
644
+ children: e[options_key_text] || e["label"]
645
+ }, e[options_key_value]);
646
+ })
647
+ }), !myValue && !options && (placeholder || myTitleLite) && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
648
+ className: _MyInputModule.default.placeholder,
649
+ children: placeholder ? placeholder : myTitleLite
650
+ })]
651
+ }),
652
+ [MyInputType.SELECTFILTER]: () => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
653
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
654
+ ref: ref,
655
+ id: "mySelectFilterInput" + (id ? id : myInputId),
656
+ type: "text",
657
+ className: _MyInputModule.default.filterInput,
658
+ style: style,
659
+ value: filtertext,
660
+ onChange: e => setFiltertext(e.target.value),
661
+ placeholder: placeholdersearchtext && placeholdersearchtext != "" ? placeholdersearchtext : (placeholder ? placeholder : myTitleLite) + " ...",
662
+ onBlur: onMyBlur,
663
+ onFocus: onMyFocus,
664
+ onKeyDown: onMyKeyDown,
665
+ onKeyUp: onMyKeyUp,
666
+ onKeyPress: onMyKeyPress,
667
+ onMouseDown: onMyMouseDown,
668
+ onMouseUp: onMyMouseUp,
669
+ onMouseEnter: onMyMouseEnter,
670
+ onMouseLeave: onMyMouseLeave
671
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
672
+ className: _MyInputModule.default.filterInputSelectedContainer + " " + (myValue ? _MyInputModule.default.filterInputSelectedContainerSelected : ''),
673
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
674
+ id: "mySelectFilterSelected" + (id ? id : myInputId),
675
+ className: _MyInputModule.default.filterInputSelected,
676
+ dangerouslySetInnerHTML: {
677
+ __html: getMyValueText()
678
+ }
679
+ }), myValue && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
680
+ className: _MyInputModule.default.filterInputSelectedX,
681
+ onClick: () => setMyValue(null),
682
+ title: t("Seçimi Kaldır"),
683
+ children: "x"
684
+ }) || "", /*#__PURE__*/(0, _jsxRuntime.jsx)(_pi.PiCaretDownBold, {
685
+ className: _MyInputModule.default.caretdown
686
+ })]
687
+ }), !myValue && (placeholder || myTitleLite) && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
688
+ className: _MyInputModule.default.placeholder,
689
+ children: placeholder ? placeholder : myTitleLite
690
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
691
+ id: "mySelectFilterList" + (id ? id : myInputId),
692
+ className: _MyInputModule.default.filterInputList,
693
+ children: options && getFilterOptions().map(item => {
694
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
695
+ value: MyInputIsNumeric(item[options_key_value]) ? parseInt(item[options_key_value]) : item[options_key_value],
696
+ onClick: () => mySelectFilterListClick(item),
697
+ className: item[options_key_subtext] ? _MyInputModule.default.subtextli : '',
698
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
699
+ dangerouslySetInnerHTML: {
700
+ __html: item[options_key_text] || item["label"]
701
+ }
702
+ }), item[options_key_subtext] && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
703
+ className: _MyInputModule.default.subtext,
704
+ children: item[options_key_subtext]
705
+ })]
706
+ }, item[options_key_value]);
707
+ })
708
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
709
+ style: {
710
+ display: "none"
711
+ },
712
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("select", {
713
+ id: "mySelectFilterHiddenSelect" + myInputId,
714
+ onChange: e => onMyChange(e),
715
+ value: myValue && !isNaN(myValue) ? MyInputIsNumeric(myValue) ? parseInt(myValue) : myValue : "",
716
+ children: options && options.map(item => {
717
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
718
+ value: MyInputIsNumeric(item[options_key_value]) ? parseInt(item[options_key_value]) : item[options_key_value],
719
+ children: item[options_key_text] || item["label"]
720
+ }, item[options_key_value]);
721
+ })
722
+ })
723
+ })]
724
+ }),
725
+ [MyInputType.FILE]: () => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
726
+ className: _MyInputModule.default.fileinput,
727
+ children: [(() => {
728
+ // Dosya önizleme gösterimi için kontrol
729
+ if (myValue && (type === MyInputType.IMAGE || accept === '.jpg,.jpeg,.png')) {
730
+ if (Array.isArray(myValue) && myValue.length === 1 && getFileImageControl(myValue[0].filename)) {
731
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
732
+ src: myValue[0].base64,
733
+ className: _MyInputModule.default.fileImagePreview,
734
+ alt: "Preview"
735
+ });
736
+ } else if (getFileImageControl(myValue)) {
737
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
738
+ src: myValue,
739
+ className: _MyInputModule.default.fileImagePreview,
740
+ alt: "Preview"
741
+ });
742
+ }
743
+ }
744
+ return null;
745
+ })(), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
746
+ className: _MyInputModule.default.filename + " " + (myFileName && _MyInputModule.default.selected),
661
747
  dangerouslySetInnerHTML: {
662
- __html: item[options_key_text] || item["label"]
748
+ __html: myFileName || (placeholder ? placeholder : t(type === MyInputType.IMAGE ? "Görsel Seçiniz" : "Dosya Seçiniz"))
663
749
  }
664
- }), item[options_key_subtext] && /*#__PURE__*/React.createElement("span", {
665
- className: styles.subtext
666
- }, item[options_key_subtext]));
667
- })), /*#__PURE__*/React.createElement("div", {
668
- style: {
669
- display: "none"
670
- }
671
- }, /*#__PURE__*/React.createElement("select", {
672
- id: "mySelectFilterHiddenSelect" + myInputId,
673
- onChange: e => onMyChange(e),
674
- value: myValue && !isNaN(myValue) ? MyInputIsNumeric(myValue) ? parseInt(myValue) : myValue : ""
675
- }, options && options.map(item => {
676
- return /*#__PURE__*/React.createElement("option", {
677
- key: item[options_key_value],
678
- value: MyInputIsNumeric(item[options_key_value]) ? parseInt(item[options_key_value]) : item[options_key_value]
679
- }, item[options_key_text] || item["label"]);
680
- })))),
681
- [MyInputType.FILE]: () => /*#__PURE__*/React.createElement("div", {
682
- className: styles.fileinput
683
- }, (() => {
684
- // Dosya önizleme gösterimi için kontrol
685
- if (myValue && (type === MyInputType.IMAGE || accept === '.jpg,.jpeg,.png')) {
686
- if (Array.isArray(myValue) && myValue.length === 1 && getFileImageControl(myValue[0].filename)) {
687
- return /*#__PURE__*/React.createElement("img", {
688
- src: myValue[0].base64,
689
- className: styles.fileImagePreview,
690
- alt: "Preview"
691
- });
692
- } else if (getFileImageControl(myValue)) {
693
- return /*#__PURE__*/React.createElement("img", {
694
- src: myValue,
695
- className: styles.fileImagePreview,
696
- alt: "Preview"
750
+ }), (() => {
751
+ if (onRemoveImage && myValue && type === MyInputType.IMAGE && (Array.isArray(myValue) && myValue.length === 1 && getFileImageControl(myValue[0].filename) || getFileImageControl(myValue) && !(myValue.includes("nologo") || myValue.includes("noimage")))) {
752
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
753
+ type: "button",
754
+ onClick: onRemoveImageClick,
755
+ className: _MyInputModule.default.filebuttonremove,
756
+ title: t("Kaldır"),
757
+ children: "x"
697
758
  });
698
759
  }
699
- }
700
- return null;
701
- })(), /*#__PURE__*/React.createElement("div", {
702
- className: styles.filename + " " + (myFileName && styles.selected),
703
- dangerouslySetInnerHTML: {
704
- __html: myFileName || (placeholder ? placeholder : t(type === MyInputType.IMAGE ? "Görsel Seçiniz" : "Dosya Seçiniz"))
705
- }
706
- }), (() => {
707
- if (onRemoveImage && myValue && type === MyInputType.IMAGE && (Array.isArray(myValue) && myValue.length === 1 && getFileImageControl(myValue[0].filename) || getFileImageControl(myValue) && !(myValue.includes("nologo") || myValue.includes("noimage")))) {
708
- return /*#__PURE__*/React.createElement("button", {
709
- type: "button",
710
- onClick: onRemoveImageClick,
711
- className: styles.filebuttonremove,
712
- title: t("Kaldır")
713
- }, "x");
714
- }
715
- return null;
716
- })(), /*#__PURE__*/React.createElement("button", {
717
- type: "button",
718
- onClick: () => fileInputRef.current.click(),
719
- className: styles.filebutton
720
- }, type === MyInputType.IMAGE ? /*#__PURE__*/React.createElement(PiImage, null) : /*#__PURE__*/React.createElement(MdOutlineAttachFile, null)), /*#__PURE__*/React.createElement("input", _extends({
721
- type: "file",
722
- ref: fileInputRef,
723
- onChange: e => onMyChange(e),
724
- placeholder: placeholder || myTitleLite,
725
- style: {
726
- display: "none"
727
- }
728
- }, multiple ? {
729
- multiple: true
730
- } : {}, {
731
- accept: type === MyInputType.IMAGE ? '.jpg,.jpeg,.png' : accept
732
- }))),
760
+ return null;
761
+ })(), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
762
+ type: "button",
763
+ onClick: () => fileInputRef.current.click(),
764
+ className: _MyInputModule.default.filebutton,
765
+ children: type === MyInputType.IMAGE ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_pi.PiImage, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdOutlineAttachFile, {})
766
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
767
+ type: "file",
768
+ ref: fileInputRef,
769
+ onChange: e => onMyChange(e),
770
+ placeholder: placeholder || myTitleLite,
771
+ style: {
772
+ display: "none"
773
+ },
774
+ ...(multiple ? {
775
+ multiple: true
776
+ } : {}),
777
+ accept: type === MyInputType.IMAGE ? '.jpg,.jpeg,.png' : accept
778
+ })]
779
+ }),
733
780
  [MyInputType.IMAGE]: function () {
734
781
  return this[MyInputType.FILE]();
735
782
  }
736
783
  };
737
784
  return inputTypes[type]?.() || null;
738
785
  };
739
- return /*#__PURE__*/React.createElement("div", {
786
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
740
787
  id: "myinput" + myInputId,
741
- className: styles.container + " " + (className != null ? className : '') + " " + (isError ? styles.error : ''),
788
+ className: _MyInputModule.default.container + " " + (className != null ? className : '') + " " + (isError ? _MyInputModule.default.error : ''),
742
789
  title: title && myTitleLite || placeholder && placeholder,
743
790
  style: style && style.width && {
744
791
  display: 'inline-block'
745
792
  } || {
746
793
  width: '100%'
747
- }
748
- }, title && /*#__PURE__*/React.createElement("small", {
749
- dangerouslySetInnerHTML: {
750
- __html: title
751
- }
752
- }), /*#__PURE__*/React.createElement("div", {
753
- className: styles.inputblock + " " + (disabled || type === MyInputType.READONLY ? styles.inputblockdisabled : '') + " " + (icon || type === MyInputType.IMAGE ? styles.inputblockicon : ''),
754
- style: style && {
755
- ...(style.backgroundColor && {
756
- backgroundColor: style.backgroundColor
757
- })
758
- }
759
- }, icon && /*#__PURE__*/React.createElement("div", {
760
- className: `${styles.icon} ${type === MyInputType.TEXTAREA || rows > 0 ? styles.icontextarea : ''}`
761
- }, icon), renderInput()), description && /*#__PURE__*/React.createElement("small", {
762
- className: styles.description
763
- }, description));
794
+ },
795
+ children: [title && /*#__PURE__*/(0, _jsxRuntime.jsx)("small", {
796
+ dangerouslySetInnerHTML: {
797
+ __html: title
798
+ }
799
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
800
+ className: _MyInputModule.default.inputblock + " " + (disabled || type === MyInputType.READONLY ? _MyInputModule.default.inputblockdisabled : '') + " " + (icon || type === MyInputType.IMAGE ? _MyInputModule.default.inputblockicon : ''),
801
+ style: style && {
802
+ ...(style.backgroundColor && {
803
+ backgroundColor: style.backgroundColor
804
+ })
805
+ },
806
+ children: [icon && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
807
+ className: `${_MyInputModule.default.icon} ${type === MyInputType.TEXTAREA || rows > 0 ? _MyInputModule.default.icontextarea : ''}`,
808
+ children: icon
809
+ }), renderInput()]
810
+ }), description && /*#__PURE__*/(0, _jsxRuntime.jsx)("small", {
811
+ className: _MyInputModule.default.description,
812
+ children: description
813
+ })]
814
+ });
764
815
  }
765
- export default MyInput;
816
+ var _default = exports.default = MyInput;