@sydsoft/base 1.44.0 → 1.48.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 (48) hide show
  1. package/README.md +8 -1
  2. package/dist/esm/_lib/baseFunctions.js +25 -38
  3. package/dist/esm/_lib/inputMask.js +66 -68
  4. package/dist/esm/_lib/listFunctions.js +12 -13
  5. package/dist/esm/_lib/storage/cookies.js +20 -21
  6. package/dist/esm/_lib/storage/encData.js +19 -21
  7. package/dist/esm/_lib/storage/localStorage.js +10 -10
  8. package/dist/esm/_lib/storage/sessionStorage.js +10 -10
  9. package/dist/esm/_lib/useInterval.js +5 -5
  10. package/dist/esm/alert/index.js +28 -30
  11. package/dist/esm/box/Box.js +6 -7
  12. package/dist/esm/box/BoxContent.js +2 -4
  13. package/dist/esm/box/BoxFooter.js +6 -4
  14. package/dist/esm/box/BoxHeader.js +6 -5
  15. package/dist/esm/countDown/index.js +28 -33
  16. package/dist/esm/dateTime/index.js +25 -31
  17. package/dist/esm/form/Button.js +28 -22
  18. package/dist/esm/form/Checkbox.js +7 -8
  19. package/dist/esm/form/Dialog.d.ts +7 -6
  20. package/dist/esm/form/Dialog.js +51 -38
  21. package/dist/esm/form/Form.js +3 -5
  22. package/dist/esm/form/FormOlustur.js +15 -17
  23. package/dist/esm/form/Input.d.ts +12 -7
  24. package/dist/esm/form/Input.js +68 -77
  25. package/dist/esm/form/Label.d.ts +1 -1
  26. package/dist/esm/form/Label.js +5 -10
  27. package/dist/esm/form/SearchableInput.js +77 -89
  28. package/dist/esm/form/UploadBase.js +30 -32
  29. package/dist/esm/grid/index.js +40 -41
  30. package/dist/esm/icon/icons.js +1 -1
  31. package/dist/esm/icon/index.js +21 -10
  32. package/dist/esm/index.module.css +89 -0
  33. package/dist/esm/menu/index.d.ts +30 -4
  34. package/dist/esm/menu/index.js +32 -14
  35. package/dist/esm/modal/index.js +14 -16
  36. package/dist/esm/popover/index.d.ts +21 -7
  37. package/dist/esm/popover/index.js +320 -119
  38. package/dist/esm/tooltip/index.js +117 -34
  39. package/package.json +12 -6
  40. package/dist/esm/alert/index.module.css +0 -119
  41. package/dist/esm/grid/index.module.css +0 -805
  42. package/dist/esm/menu/index.module.css +0 -67
  43. package/dist/esm/modal/index.module.css +0 -76
  44. /package/dist/esm/{box/Box.module.css → Box.module.css} +0 -0
  45. /package/dist/esm/{form/styles → styles}/Button.module.css +0 -0
  46. /package/dist/esm/{form/styles → styles}/Input.module.css +0 -0
  47. /package/dist/esm/{form/styles → styles}/Label.module.css +0 -0
  48. /package/dist/esm/{form/styles → styles}/SearchableInput.module.css +0 -0
@@ -1,7 +1,7 @@
1
1
  import { decData, encData } from "./encData";
2
2
  import { isDev } from "../baseFunctions";
3
- var storageAvailable = typeof Storage === "undefined" || !window.sessionStorage ? false : true;
4
- export var setSessionStorage = function (key, value) {
3
+ const storageAvailable = typeof Storage === "undefined" || !window.sessionStorage ? false : true;
4
+ export const setSessionStorage = (key, value) => {
5
5
  if (!storageAvailable)
6
6
  return false;
7
7
  try {
@@ -13,11 +13,11 @@ export var setSessionStorage = function (key, value) {
13
13
  return false;
14
14
  }
15
15
  };
16
- export var getSessionStorage = function (key) {
16
+ export const getSessionStorage = (key) => {
17
17
  if (!storageAvailable)
18
18
  return false;
19
19
  try {
20
- var saved = sessionStorage.getItem(key);
20
+ const saved = sessionStorage.getItem(key);
21
21
  return saved ? decData(saved) : null;
22
22
  }
23
23
  catch (e) {
@@ -25,7 +25,7 @@ export var getSessionStorage = function (key) {
25
25
  return null;
26
26
  }
27
27
  };
28
- export var removeSessionStorage = function (key) {
28
+ export const removeSessionStorage = (key) => {
29
29
  if (!storageAvailable)
30
30
  return false;
31
31
  try {
@@ -37,7 +37,7 @@ export var removeSessionStorage = function (key) {
37
37
  return false;
38
38
  }
39
39
  };
40
- export var clearSessionStorage = function () {
40
+ export const clearSessionStorage = () => {
41
41
  if (!storageAvailable)
42
42
  return false;
43
43
  try {
@@ -50,17 +50,17 @@ export var clearSessionStorage = function () {
50
50
  }
51
51
  };
52
52
  // Tüm SessionStorage anahtarlarını getir
53
- export var getSessionStorageAllKeys = function () {
53
+ export const getSessionStorageAllKeys = () => {
54
54
  if (!storageAvailable)
55
55
  return [];
56
56
  return Object.keys(sessionStorage);
57
57
  };
58
58
  // Tüm SessionStorage boyutunu getir
59
- export var getSessionStorageSize = function () {
59
+ export const getSessionStorageSize = () => {
60
60
  if (!storageAvailable)
61
61
  return 0;
62
- var total = 0;
63
- for (var key in sessionStorage) {
62
+ let total = 0;
63
+ for (const key in sessionStorage) {
64
64
  if (sessionStorage.hasOwnProperty(key)) {
65
65
  total += sessionStorage[key].length + key.length;
66
66
  }
@@ -6,19 +6,19 @@
6
6
  // source: https://overreacted.io/making-setinterval-declarative-with-react-hooks/
7
7
  import { useEffect, useRef } from "react";
8
8
  export function useInterval(callback, delay) {
9
- var savedCallback = useRef(null);
9
+ const savedCallback = useRef(null);
10
10
  // Remember the latest callback.
11
- useEffect(function () {
11
+ useEffect(() => {
12
12
  savedCallback.current = callback;
13
13
  }, [callback]);
14
14
  // Set up the interval.
15
- useEffect(function () {
15
+ useEffect(() => {
16
16
  function tick() {
17
17
  savedCallback && savedCallback.current && savedCallback.current();
18
18
  }
19
19
  if (delay !== null) {
20
- var id_1 = setInterval(tick, delay);
21
- return function () { return clearInterval(id_1); };
20
+ const id = setInterval(tick, delay);
21
+ return () => clearInterval(id);
22
22
  }
23
23
  }, [delay]);
24
24
  }
@@ -2,21 +2,20 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect } from "react";
3
3
  import { createRoot } from "react-dom/client";
4
4
  import styles from "./index.module.css";
5
- var sAlertTimeout = [];
6
- export var Alert = function (_a) {
7
- var _b = _a.defaultTimer, defaultTimer = _b === void 0 ? "5000" : _b, _c = _a.defaultErrorTimer, defaultErrorTimer = _c === void 0 ? "10000" : _c, _d = _a.defaultSuccessTimer, defaultSuccessTimer = _d === void 0 ? "5000" : _d;
8
- useEffect(function () {
5
+ const sAlertTimeout = [];
6
+ export const Alert = ({ defaultTimer = "5000", defaultErrorTimer = "10000", defaultSuccessTimer = "5000" }) => {
7
+ useEffect(() => {
9
8
  if (typeof window === "undefined")
10
9
  return;
11
- var divCheck = document.getElementById("salert");
10
+ const divCheck = document.getElementById("salert");
12
11
  if (!divCheck) {
13
12
  // let div = document.createElement('div') as HTMLDivElement
14
- var div = document.createElement("div");
13
+ const div = document.createElement("div");
15
14
  div.setAttribute("id", "salert");
16
15
  div.setAttribute("defaultTimer", defaultTimer);
17
16
  div.setAttribute("defaultErrorTimer", defaultErrorTimer);
18
17
  div.setAttribute("defaultSuccessTimer", defaultSuccessTimer);
19
- var alertStyle = [
18
+ const alertStyle = [
20
19
  "position: fixed",
21
20
  "bottom: 0",
22
21
  "right: 0",
@@ -34,27 +33,26 @@ export var Alert = function (_a) {
34
33
  }, []);
35
34
  return null;
36
35
  };
37
- export var alert_add = function (_a) {
38
- var _b, _c, _d;
39
- var type = _a.type, message = _a.message, style = _a.style, timer = _a.timer;
36
+ export const alert_add = ({ type, message, style, timer }) => {
37
+ var _a, _b, _c;
40
38
  if (typeof window === "undefined")
41
39
  return false;
42
- var mainDiv = document.getElementById("salert");
40
+ const mainDiv = document.getElementById("salert");
43
41
  if (mainDiv) {
44
- var alert_1 = document.createElement("div");
45
- mainDiv.prepend(alert_1);
46
- var onClose_1 = function () {
47
- if (mainDiv && alert_1 && mainDiv.contains(alert_1))
48
- mainDiv.removeChild(alert_1);
42
+ const alert = document.createElement("div");
43
+ mainDiv.prepend(alert);
44
+ const onClose = () => {
45
+ if (mainDiv && alert && mainDiv.contains(alert))
46
+ mainDiv.removeChild(alert);
49
47
  };
50
- var root = createRoot(alert_1);
51
- var Component = (_jsxs("div", { className: "".concat(styles.salert, " ").concat(styles[type]), style: style, children: [_jsx("div", { className: styles.message, dangerouslySetInnerHTML: { __html: message } }), _jsx("div", { className: styles.close, onClick: onClose_1, children: "\u2715" })] }));
48
+ const root = createRoot(alert);
49
+ const Component = (_jsxs("div", { className: `${styles.salert} ${styles[type]}`, style: style, children: [_jsx("div", { className: styles.message, dangerouslySetInnerHTML: { __html: message } }), _jsx("div", { className: styles.close, onClick: onClose, children: "\u2715" })] }));
52
50
  root.render(Component);
53
- var defaultTimer = (_b = mainDiv.getAttribute("defaulttimer")) !== null && _b !== void 0 ? _b : "5000";
54
- var defaultErrorTimer = (_c = mainDiv.getAttribute("defaulterrortimer")) !== null && _c !== void 0 ? _c : "10000";
55
- var defaultSuccessTimer = (_d = mainDiv.getAttribute("defaultsuccesstimer")) !== null && _d !== void 0 ? _d : "5000";
56
- var timerFilled = typeof timer === "number" && timer > 0;
57
- var newTimer = timerFilled ? timer : defaultTimer;
51
+ const defaultTimer = (_a = mainDiv.getAttribute("defaulttimer")) !== null && _a !== void 0 ? _a : "5000";
52
+ const defaultErrorTimer = (_b = mainDiv.getAttribute("defaulterrortimer")) !== null && _b !== void 0 ? _b : "10000";
53
+ const defaultSuccessTimer = (_c = mainDiv.getAttribute("defaultsuccesstimer")) !== null && _c !== void 0 ? _c : "5000";
54
+ const timerFilled = typeof timer === "number" && timer > 0;
55
+ let newTimer = timerFilled ? timer : defaultTimer;
58
56
  switch (type) {
59
57
  case "error":
60
58
  newTimer = timerFilled ? timer : defaultErrorTimer;
@@ -69,27 +67,27 @@ export var alert_add = function (_a) {
69
67
  if (typeof timer !== "boolean") {
70
68
  // False gelmişse sabit kalsın
71
69
  if (newTimer > 0) {
72
- var timeout = setTimeout(function () { return onClose_1(); }, newTimer);
70
+ const timeout = setTimeout(() => onClose(), newTimer);
73
71
  sAlertTimeout.push(timeout);
74
72
  }
75
73
  }
76
- return alert_1;
74
+ return alert;
77
75
  }
78
76
  return null;
79
77
  };
80
- export var alert_remove = function (alert) {
78
+ export const alert_remove = (alert) => {
81
79
  if (typeof window === "undefined" || !alert)
82
80
  return;
83
- var mainDiv = document.getElementById("salert");
81
+ const mainDiv = document.getElementById("salert");
84
82
  if (mainDiv && alert && mainDiv.contains(alert))
85
83
  mainDiv.removeChild(alert);
86
84
  return;
87
85
  };
88
- export var alert_clear = function () {
86
+ export const alert_clear = () => {
89
87
  if (typeof window === "undefined")
90
88
  return false;
91
- sAlertTimeout.map(function (id) { return clearTimeout(id); });
92
- var mainDiv = document.getElementById("salert");
89
+ sAlertTimeout.map((id) => clearTimeout(id));
90
+ const mainDiv = document.getElementById("salert");
93
91
  if (mainDiv)
94
92
  mainDiv.innerHTML = "";
95
93
  return true;
@@ -1,15 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { memo, useEffect, useRef, useState } from "react";
3
3
  import styles from "./Box.module.css";
4
- export var Box = memo(function MemoFunction(_a) {
5
- var children = _a.children, className = _a.className, style = _a.style, _b = _a.loading, loading = _b === void 0 ? false : _b;
6
- var boxRef = useRef(null);
7
- var _c = useState(false), hasContent = _c[0], setHasContent = _c[1];
8
- useEffect(function () {
4
+ export const Box = memo(function MemoFunction({ children, className, style, loading = false }) {
5
+ const boxRef = useRef(null);
6
+ const [hasContent, setHasContent] = useState(false);
7
+ useEffect(() => {
9
8
  if (!boxRef.current)
10
9
  return;
11
- var found = boxRef.current.querySelector(".sbox_content");
10
+ const found = boxRef.current.querySelector(".sbox_content");
12
11
  setHasContent(!!found);
13
12
  }, [children]);
14
- return (_jsxs("div", { ref: boxRef, className: "sbox ".concat(styles.sbox, " ").concat(className || ""), style: style, children: [(hasContent && children) || _jsx("div", { className: styles.content, children: children }), loading && (_jsx("div", { className: styles.loading, children: _jsx("div", { className: styles.loading_spinner }) }))] }));
13
+ return (_jsxs("div", { ref: boxRef, className: `sbox ${styles.sbox} ${className || ""}`, style: style, children: [(hasContent && children) || _jsx("div", { className: styles.content, children: children }), loading && (_jsx("div", { className: styles.loading, children: _jsx("div", { className: styles.loading_spinner }) }))] }));
15
14
  });
@@ -1,7 +1,5 @@
1
- import { __assign } from "tslib";
2
1
  import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import styles from "./Box.module.css";
4
- export var BoxContent = function (_a) {
5
- var className = _a.className, style = _a.style, padding = _a.padding, children = _a.children;
6
- return (_jsx("div", { className: "".concat(styles.content, " sbox_content ").concat(className || ""), style: __assign(__assign({}, style), { padding: padding }), children: children }));
3
+ export const BoxContent = ({ className, style, padding, children }) => {
4
+ return (_jsx("div", { className: `${styles.content} sbox_content ${className || ""}`, style: { ...style, padding }, children: children }));
7
5
  };
@@ -1,8 +1,10 @@
1
- import { __assign } from "tslib";
2
1
  import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import { memo } from "react";
4
3
  import styles from "./Box.module.css";
5
- export var BoxFooter = memo(function FunctionMemo(_a) {
6
- var children = _a.children, className = _a.className, style = _a.style, align = _a.align, marginTop = _a.marginTop;
7
- return (_jsx("div", { className: "sbox_footer ".concat(styles.footer, " ").concat(className || ""), style: __assign({ marginTop: marginTop, justifyContent: align }, style), children: children }));
4
+ export const BoxFooter = memo(function FunctionMemo({ children, className, style, align, marginTop }) {
5
+ return (_jsx("div", { className: `sbox_footer ${styles.footer} ${className || ""}`, style: {
6
+ marginTop,
7
+ justifyContent: align,
8
+ ...style
9
+ }, children: children }));
8
10
  });
@@ -1,9 +1,10 @@
1
- import { __assign } from "tslib";
2
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
2
  import { memo } from 'react';
4
3
  import styles from './Box.module.css';
5
- export var BoxHeader = memo(function FunctionMemo(_a) {
6
- var children = _a.children, className = _a.className, title = _a.title, icon = _a.icon, menu = _a.menu, mainStyle = _a.mainStyle, iconStyle = _a.iconStyle, titleStyle = _a.titleStyle, menuStyle = _a.menuStyle, marginBottom = _a.marginBottom, _b = _a.component, component = _b === void 0 ? 'div' : _b;
7
- var Comp = component;
8
- return (_jsxs("div", { className: "sbox_header ".concat(styles.header, " ").concat(className || ''), style: __assign({ marginBottom: marginBottom }, mainStyle), children: [icon && (_jsx("div", { className: styles.icon, style: iconStyle, children: icon })), _jsx(Comp, { className: "sbox_title ".concat(styles.title), style: titleStyle, children: children || title }), menu && (_jsx("div", { className: styles.menu, style: menuStyle, children: menu }))] }));
4
+ export const BoxHeader = memo(function FunctionMemo({ children, className, title, icon, menu, mainStyle, iconStyle, titleStyle, menuStyle, marginBottom, component = 'div' }) {
5
+ const Comp = component;
6
+ return (_jsxs("div", { className: `sbox_header ${styles.header} ${className || ''}`, style: {
7
+ marginBottom,
8
+ ...mainStyle
9
+ }, children: [icon && (_jsx("div", { className: styles.icon, style: iconStyle, children: icon })), _jsx(Comp, { className: `sbox_title ${styles.title}`, style: titleStyle, children: children || title }), menu && (_jsx("div", { className: styles.menu, style: menuStyle, children: menu }))] }));
9
10
  });
@@ -1,18 +1,17 @@
1
1
  import { useEffect, useRef, useState } from 'react';
2
2
  import React from 'react';
3
3
  import { useInterval } from '../_lib/useInterval';
4
- export var useCountDown = function (_a) {
5
- var _b = _a.autoStart, autoStart = _b === void 0 ? false : _b, onComplete = _a.onComplete, getStatus = _a.getStatus, targetTime = _a.targetTime, _c = _a.timerType, timerType = _c === void 0 ? 'countdown' : _c, _d = _a.countType, countType = _d === void 0 ? 'seconds' : _d, _e = _a.speed, speed = _e === void 0 ? 1000 : _e, hide = _a.hide;
6
- var refCountDownRender = useRef(null);
7
- var _f = useState(timerType === 'datetime' || autoStart), enabled = _f[0], setEnabled = _f[1];
8
- var _g = useState(0), timer = _g[0], setTimer = _g[1];
9
- var _h = useState(typeof speed === 'number' && speed > 0 ? speed : 1000), timerSpeed = _h[0], setTimerSpeed = _h[1];
10
- useEffect(function () { return prepareTimer(targetTime); }, [targetTime]);
11
- useEffect(function () {
4
+ export const useCountDown = ({ autoStart = false, onComplete, getStatus, targetTime, timerType = 'countdown', countType = 'seconds', speed = 1000, hide }) => {
5
+ const refCountDownRender = useRef(null);
6
+ const [enabled, setEnabled] = useState(timerType === 'datetime' || autoStart);
7
+ const [timer, setTimer] = useState(0);
8
+ const [timerSpeed, setTimerSpeed] = useState(typeof speed === 'number' && speed > 0 ? speed : 1000);
9
+ useEffect(() => prepareTimer(targetTime), [targetTime]);
10
+ useEffect(() => {
12
11
  if (!hide)
13
12
  render();
14
13
  }, [timer]);
15
- useInterval(function () {
14
+ useInterval(() => {
16
15
  if (enabled) {
17
16
  if (timer <= 1) {
18
17
  stopCountDown();
@@ -22,7 +21,7 @@ export var useCountDown = function (_a) {
22
21
  }
23
22
  }
24
23
  }, enabled ? timerSpeed : null);
25
- var prepareTimer = function (timeORstring) {
24
+ const prepareTimer = (timeORstring) => {
26
25
  if (timerType === 'datetime') {
27
26
  setTimer(Math.floor((new Date(timeORstring).getTime() - new Date().getTime()) / 1000));
28
27
  setEnabled(true);
@@ -31,20 +30,16 @@ export var useCountDown = function (_a) {
31
30
  setTimer(timeORstring);
32
31
  }
33
32
  };
34
- var stopCountDown = function () {
33
+ const stopCountDown = () => {
35
34
  setTimer(0);
36
35
  setEnabled(false);
37
36
  if ((enabled && onComplete) || (timerType === 'datetime' && onComplete)) {
38
37
  onComplete();
39
38
  }
40
39
  };
41
- var padNumber = function (num, padLength, padString) {
42
- if (padLength === void 0) { padLength = 2; }
43
- if (padString === void 0) { padString = '0'; }
44
- return (typeof targetTime === 'number' && targetTime < 10 ? num : String(num).padStart(padLength, padString));
45
- };
46
- var render = function () {
47
- var days = 0, hours = 0, minutes = 0, seconds = timer;
40
+ const padNumber = (num, padLength = 2, padString = '0') => (typeof targetTime === 'number' && targetTime < 10 ? num : String(num).padStart(padLength, padString));
41
+ const render = () => {
42
+ let days = 0, hours = 0, minutes = 0, seconds = timer;
48
43
  if (countType === 'minutes:seconds') {
49
44
  minutes = Math.floor(seconds / 60);
50
45
  seconds -= minutes * 60;
@@ -65,33 +60,33 @@ export var useCountDown = function (_a) {
65
60
  }
66
61
  seconds = Math.floor(seconds);
67
62
  if (getStatus && timer > 0)
68
- getStatus({ days: days, hours: hours, minutes: minutes, seconds: seconds, timer: timer });
63
+ getStatus({ days, hours, minutes, seconds, timer });
69
64
  if (refCountDownRender.current) {
70
- var getPadValues = function (div) {
71
- var length = div.dataset.padlength || 2;
72
- var string = div.dataset.padstring || '0';
73
- return { length: length, string: string };
65
+ const getPadValues = (div) => {
66
+ const length = div.dataset.padlength || 2;
67
+ const string = div.dataset.padstring || '0';
68
+ return { length, string };
74
69
  };
75
- var divGun = refCountDownRender.current.querySelector("[data-name='days']");
70
+ const divGun = refCountDownRender.current.querySelector("[data-name='days']");
76
71
  if (divGun)
77
72
  divGun.innerHTML = padNumber(days, getPadValues(divGun).length, getPadValues(divGun).string).toString();
78
- var divSaat = refCountDownRender.current.querySelector("[data-name='hours']");
73
+ const divSaat = refCountDownRender.current.querySelector("[data-name='hours']");
79
74
  if (divSaat)
80
75
  divSaat.innerHTML = padNumber(hours, getPadValues(divSaat).length, getPadValues(divSaat).string).toString();
81
- var divDakika = refCountDownRender.current.querySelector("[data-name='minutes']");
76
+ const divDakika = refCountDownRender.current.querySelector("[data-name='minutes']");
82
77
  if (divDakika)
83
78
  divDakika.innerHTML = padNumber(minutes, getPadValues(divDakika).length, getPadValues(divDakika).string).toString();
84
- var divSaniye = refCountDownRender.current.querySelector("[data-name='seconds']");
79
+ const divSaniye = refCountDownRender.current.querySelector("[data-name='seconds']");
85
80
  if (divSaniye)
86
81
  divSaniye.innerHTML = padNumber(seconds, getPadValues(divSaniye).length, getPadValues(divSaniye).string).toString();
87
82
  }
88
83
  };
89
84
  return {
90
- ComponentCountDown: function (children) { return (hide ? null : React.cloneElement(children, { ref: refCountDownRender })); },
91
- startCountDown: function () { return setEnabled(true); },
92
- stopCountDown: function () { return setEnabled(false); },
93
- setTargetTime: function (targetTime) { return prepareTimer(targetTime); },
94
- setTimerSpeed: function (timerSpeed) { return setTimerSpeed(timerSpeed); },
95
- getChildrenRef: function () { return refCountDownRender.current || null; }
85
+ ComponentCountDown: (children) => (hide ? null : React.cloneElement(children, { ref: refCountDownRender })),
86
+ startCountDown: () => setEnabled(true),
87
+ stopCountDown: () => setEnabled(false),
88
+ setTargetTime: (targetTime) => prepareTimer(targetTime),
89
+ setTimerSpeed: (timerSpeed) => setTimerSpeed(timerSpeed),
90
+ getChildrenRef: () => refCountDownRender.current || null
96
91
  };
97
92
  };
@@ -1,22 +1,20 @@
1
- var dateTime = /** @class */ (function () {
2
- function dateTime(datetime, format) {
3
- if (datetime === void 0) { datetime = null; }
4
- if (format === void 0) { format = "y-m-d h:i:s"; }
1
+ export default class dateTime {
2
+ constructor(datetime = null, format = "y-m-d h:i:s") {
5
3
  this.resut_format = "y-m-d h:i:s";
6
4
  this.format(format);
7
5
  this.datetime = datetime !== "0000-00-00 00:00:00" && datetime !== "0000-00-00" && datetime ? datetime : new Date().toISOString(); // GMT ekli halde
8
6
  return this;
9
7
  }
10
- dateTime.prototype.addDays = function (days) {
11
- var datetime = new Date(this.datetime);
8
+ addDays(days) {
9
+ const datetime = new Date(this.datetime);
12
10
  datetime.setDate(datetime.getDate() + days);
13
11
  this.datetime = datetime.toISOString();
14
12
  return this;
15
- };
16
- dateTime.prototype.parse = function () {
17
- var datetime = new Date(this.datetime);
18
- var monthNames = ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"];
19
- var dayNames = ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"];
13
+ }
14
+ parse() {
15
+ const datetime = new Date(this.datetime);
16
+ const monthNames = ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"];
17
+ const dayNames = ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"];
20
18
  return {
21
19
  y: datetime.getFullYear().toString(),
22
20
  m: (datetime.getMonth() + 1).toString().padStart(2, "0"),
@@ -30,10 +28,10 @@ var dateTime = /** @class */ (function () {
30
28
  TAMAY: monthNames[datetime.getMonth()],
31
29
  TAMGUN: dayNames[datetime.getDay()]
32
30
  };
33
- };
34
- dateTime.prototype.getResult = function () {
35
- var parse = this.parse();
36
- var result = this.resut_format;
31
+ }
32
+ getResult() {
33
+ const parse = this.parse();
34
+ let result = this.resut_format;
37
35
  result = result.replace(new RegExp("y", "g"), parse.y.toString());
38
36
  result = result.replace(new RegExp("m", "g"), parse.m.toString());
39
37
  result = result.replace(new RegExp("d", "g"), parse.d.toString());
@@ -45,24 +43,22 @@ var dateTime = /** @class */ (function () {
45
43
  result = result.replace(new RegExp("TAMAY", "g"), parse.TAMAY.toString());
46
44
  result = result.replace(new RegExp("TAMGUN", "g"), parse.TAMGUN.toString());
47
45
  return result;
48
- };
49
- dateTime.prototype.format = function (format) {
50
- if (format === void 0) { format = "y-m-d h:i:s"; }
46
+ }
47
+ format(format = "y-m-d h:i:s") {
51
48
  this.resut_format = format;
52
49
  return this;
53
- };
54
- dateTime.prototype.today = function () {
50
+ }
51
+ today() {
55
52
  this.datetime = new Date().toISOString();
56
53
  this.format("y-m-d");
57
54
  return this.getResult();
58
- };
59
- dateTime.prototype.getTime = function () {
60
- var convertDateTime = new dateTime(this.datetime).format("y-m-d h:i:s").getResult();
61
- var datetime = new Date(convertDateTime);
55
+ }
56
+ getTime() {
57
+ const convertDateTime = new dateTime(this.datetime).format("y-m-d h:i:s").getResult();
58
+ const datetime = new Date(convertDateTime);
62
59
  return datetime.getTime();
63
- };
64
- dateTime.prototype.nextMonthFirstDay = function (format) {
65
- if (format === void 0) { format = "y-m-d"; }
60
+ }
61
+ nextMonthFirstDay(format = "y-m-d") {
66
62
  // Verilen tarihin bir sonraki ayının ilk gününü bul
67
63
  this.datetime = new Date(this.datetime);
68
64
  this.datetime.setMonth(this.datetime.getMonth() + 1);
@@ -70,7 +66,5 @@ var dateTime = /** @class */ (function () {
70
66
  this.datetime = this.datetime.toISOString();
71
67
  this.format(format);
72
68
  return this.getResult();
73
- };
74
- return dateTime;
75
- }());
76
- export default dateTime;
69
+ }
70
+ }
@@ -1,28 +1,26 @@
1
- import { __assign, __rest } from "tslib";
2
1
  import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import { Dialog } from "./Dialog";
4
3
  import { memo, useCallback, useEffect, useState } from "react";
5
4
  import { Tooltip } from "../tooltip";
6
5
  import Link from "next/link";
7
6
  import styles from "./styles/Button.module.css";
8
- export var Button = memo(function MemoFunction(_a) {
9
- var children = _a.children, _b = _a.component, component = _b === void 0 ? "button" : _b, className = _a.className, _c = _a.buttonClass, buttonClass = _c === void 0 ? "default" : _c, _d = _a.buttonSize, buttonSize = _d === void 0 ? "medium" : _d, style = _a.style, _e = _a.type, type = _e === void 0 ? "button" : _e, _f = _a.fullWidth, fullWidth = _f === void 0 ? false : _f, onlyIcon = _a.onlyIcon, onClick = _a.onClick, href = _a.href, target = _a.target, tabIndex = _a.tabIndex, title = _a.title, titlePosition = _a.titlePosition, titleArrow = _a.titleArrow, dialog = _a.dialog, autoFocus = _a.autoFocus, other = __rest(_a, ["children", "component", "className", "buttonClass", "buttonSize", "style", "type", "fullWidth", "onlyIcon", "onClick", "href", "target", "tabIndex", "title", "titlePosition", "titleArrow", "dialog", "autoFocus"]);
10
- var Comp = component;
11
- var ripple = function (e) {
12
- var el = e.currentTarget;
13
- var circle = document.createElement("span");
14
- var diameter = Math.max(el.clientWidth, el.clientHeight);
15
- circle.style.width = circle.style.height = "".concat(diameter, "px");
7
+ export const Button = memo(function MemoFunction({ children, component = "button", className, buttonClass = "default", buttonSize = "medium", style, type = "button", fullWidth = false, onlyIcon, onClick, href, target, tabIndex, title, titlePosition, titleArrow, dialog, autoFocus, ...other }) {
8
+ const Comp = component;
9
+ const ripple = (e) => {
10
+ const el = e.currentTarget;
11
+ const circle = document.createElement("span");
12
+ const diameter = Math.max(el.clientWidth, el.clientHeight);
13
+ circle.style.width = circle.style.height = `${diameter}px`;
16
14
  circle.classList.add(styles.ripple);
17
- var ripple = el.getElementsByClassName(styles.ripple)[0];
15
+ const ripple = el.getElementsByClassName(styles.ripple)[0];
18
16
  if (ripple)
19
17
  ripple.remove();
20
18
  el.appendChild(circle);
21
19
  };
22
- var handleClick = function (e) {
20
+ const handleClick = (e) => {
23
21
  ripple(e);
24
22
  if (dialog) {
25
- Dialog(dialog).then(function (result) {
23
+ Dialog(dialog).then((result) => {
26
24
  if (result && onClick) {
27
25
  onClick(e);
28
26
  }
@@ -33,8 +31,8 @@ export var Button = memo(function MemoFunction(_a) {
33
31
  onClick(e);
34
32
  }
35
33
  };
36
- var createClassList = useCallback(function () {
37
- var list = ["sbutton", styles.button];
34
+ const createClassList = useCallback(() => {
35
+ const list = ["sbutton", styles.button];
38
36
  if (buttonClass)
39
37
  list.push(styles[buttonClass]);
40
38
  if (className)
@@ -45,27 +43,35 @@ export var Button = memo(function MemoFunction(_a) {
45
43
  list.push(styles.fullwidth);
46
44
  return list.join(" ");
47
45
  }, [buttonClass, className, onlyIcon, fullWidth]);
48
- var _g = useState(function () { return createClassList(); }), classList = _g[0], setClassList = _g[1];
49
- useEffect(function () {
50
- var newClassList = createClassList().split(" ").filter(Boolean);
46
+ const [classList, setClassList] = useState(() => createClassList());
47
+ useEffect(() => {
48
+ const newClassList = createClassList().split(" ").filter(Boolean);
51
49
  if (href && typeof window !== "undefined" && window.location.pathname === href) {
52
50
  newClassList.push("active");
53
51
  }
54
52
  setClassList(newClassList.join(" "));
55
53
  }, [href, createClassList]);
56
- var ortakProps = __assign({ className: classList, style: style, onClick: handleClick, tabIndex: tabIndex, autoFocus: autoFocus, "data-button-size": (!onlyIcon) ? buttonSize : null }, other);
57
- var renderComponent;
54
+ let ortakProps = {
55
+ className: classList,
56
+ style,
57
+ onClick: handleClick,
58
+ tabIndex,
59
+ autoFocus,
60
+ "data-button-size": (!onlyIcon) ? buttonSize : null,
61
+ ...other
62
+ };
63
+ let renderComponent;
58
64
  if (href !== undefined) {
59
65
  if (other === null || other === void 0 ? void 0 : other.hidden) {
60
66
  renderComponent = null;
61
67
  }
62
68
  else {
63
- var checkHref = (other === null || other === void 0 ? void 0 : other.disabled) ? "#" : href;
64
- renderComponent = (_jsx(Link, { href: checkHref, target: (other === null || other === void 0 ? void 0 : other.disabled) ? "_self" : target, children: _jsx(Comp, __assign({}, ortakProps, { children: onlyIcon ? onlyIcon : children })) }));
69
+ let checkHref = (other === null || other === void 0 ? void 0 : other.disabled) ? "#" : href;
70
+ renderComponent = (_jsx(Link, { href: checkHref, target: (other === null || other === void 0 ? void 0 : other.disabled) ? "_self" : target, children: _jsx(Comp, { ...ortakProps, children: onlyIcon ? onlyIcon : children }) }));
65
71
  }
66
72
  }
67
73
  else {
68
- renderComponent = (_jsx(Comp, __assign({ type: type }, ortakProps, { children: onlyIcon ? onlyIcon : children })));
74
+ renderComponent = (_jsx(Comp, { type: type, ...ortakProps, children: onlyIcon ? onlyIcon : children }));
69
75
  }
70
76
  if (title && renderComponent) {
71
77
  return (_jsx(Tooltip, { title: title, position: titlePosition, arrow: titleArrow, children: renderComponent }));
@@ -1,23 +1,22 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useRef } from "react";
3
3
  import styles from "./styles/Input.module.css";
4
- export var Checkbox = function (_a) {
5
- var ref = _a.ref, children = _a.children, name = _a.name, label = _a.label, checked = _a.checked, className = _a.className, style = _a.style, styleCheckbox = _a.styleCheckbox, styleLabel = _a.styleLabel, onToogle = _a.onToogle, disabled = _a.disabled, tabIndex = _a.tabIndex, _b = _a.required, required = _b === void 0 ? false : _b;
6
- var refMain = useRef(null);
4
+ export const Checkbox = ({ ref, children, name, label, checked, className, style, styleCheckbox, styleLabel, onToogle, disabled, tabIndex, required = false }) => {
5
+ const refMain = useRef(null);
7
6
  // checked değerini boolean hâline getiriyoruz
8
- var isChecked = checked === "1" || checked === true;
9
- var handleChange = function (newChecked) {
7
+ const isChecked = checked === "1" || checked === true;
8
+ const handleChange = (newChecked) => {
10
9
  if (disabled)
11
10
  return;
12
11
  onToogle === null || onToogle === void 0 ? void 0 : onToogle({
13
12
  target: {
14
- name: name,
13
+ name,
15
14
  value: newChecked ? "1" : "0"
16
15
  }
17
16
  });
18
17
  };
19
- var toggleCheck = function () {
18
+ const toggleCheck = () => {
20
19
  handleChange(!isChecked);
21
20
  };
22
- return (_jsxs("div", { ref: refMain, className: "".concat(styles.checkbox, " ").concat(className || ""), style: style, tabIndex: tabIndex, onClick: toggleCheck, children: [_jsx("input", { ref: ref, type: "checkbox", name: name, onChange: function (e) { return handleChange(e.target.checked); }, checked: isChecked, required: required, style: styleCheckbox, disabled: disabled }), label && _jsx("label", { style: styleLabel, children: label }), children && _jsx("div", { children: children })] }));
21
+ return (_jsxs("div", { ref: refMain, className: `${styles.checkbox} ${className || ""}`, style: style, tabIndex: tabIndex, onClick: toggleCheck, children: [_jsx("input", { ref: ref, type: "checkbox", name: name, onChange: (e) => handleChange(e.target.checked), checked: isChecked, required: required, style: styleCheckbox, disabled: disabled }), label && _jsx("label", { style: styleLabel, children: label }), children && _jsx("div", { children: children })] }));
23
22
  };
@@ -1,19 +1,20 @@
1
- import React, { ReactNode } from "react";
1
+ import React, { ReactNode } from 'react';
2
2
  export type propsDialog = {
3
3
  message: any;
4
4
  acceptButtonShow?: boolean;
5
5
  cancelButtonShow?: boolean;
6
6
  acceptButtonText?: string | ReactNode;
7
7
  cancelButtonText?: string | ReactNode;
8
- acceptButtonClass?: "default" | "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "light" | "dark" | "link";
9
- cancelButtonClass?: "default" | "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "light" | "dark" | "link";
10
- vertialAlign?: "flex-start" | "center" | "flex-end";
11
- horizontalAlign?: "flex-start" | "center" | "flex-end";
8
+ acceptButtonClass?: 'default' | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light' | 'dark' | 'link';
9
+ cancelButtonClass?: 'default' | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light' | 'dark' | 'link';
10
+ vertialAlign?: 'flex-start' | 'center' | 'flex-end';
11
+ horizontalAlign?: 'flex-start' | 'center' | 'flex-end';
12
12
  hideBackdrop?: boolean;
13
13
  hideEsc?: boolean;
14
14
  styleMessage?: React.CSSProperties;
15
15
  styleBox?: React.CSSProperties;
16
16
  styleBoxFooter?: React.CSSProperties;
17
- autoFocus?: "accept" | "cancel";
17
+ autoFocus?: 'accept' | 'cancel';
18
+ backdropStyle?: React.CSSProperties;
18
19
  };
19
20
  export declare const Dialog: (config: propsDialog) => Promise<unknown>;