@sydsoft/base 1.50.0 → 1.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/_dist/{_lib → esm/_lib}/baseFunctions.js +38 -25
  2. package/_dist/{_lib → esm/_lib}/inputMask.js +69 -66
  3. package/_dist/{_lib → esm/_lib}/listFunctions.js +13 -12
  4. package/_dist/esm/_lib/storage/cookies.js +34 -0
  5. package/_dist/esm/_lib/storage/encData.js +43 -0
  6. package/_dist/{_lib → esm/_lib}/storage/localStorage.js +10 -10
  7. package/_dist/{_lib → esm/_lib}/storage/sessionStorage.js +10 -10
  8. package/_dist/{_lib → esm/_lib}/useInterval.js +5 -5
  9. package/_dist/{alert → esm/alert}/index.js +30 -28
  10. package/_dist/esm/box/Box.js +15 -0
  11. package/_dist/esm/box/BoxContent.js +7 -0
  12. package/_dist/esm/box/BoxFooter.js +8 -0
  13. package/_dist/esm/box/BoxHeader.js +9 -0
  14. package/_dist/esm/countDown/index.js +97 -0
  15. package/_dist/{dateTime → esm/dateTime}/index.js +31 -25
  16. package/_dist/esm/form/Button.js +76 -0
  17. package/_dist/esm/form/Checkbox.js +23 -0
  18. package/_dist/esm/form/Dialog.js +40 -0
  19. package/_dist/esm/form/Form.js +12 -0
  20. package/_dist/esm/form/FormOlustur.js +52 -0
  21. package/_dist/{form → esm/form}/Input.js +56 -57
  22. package/_dist/esm/form/Label.js +9 -0
  23. package/_dist/esm/form/SearchableInput.js +272 -0
  24. package/_dist/esm/form/UploadBase.js +86 -0
  25. package/_dist/esm/grid/index.js +97 -0
  26. package/_dist/{icon → esm/icon}/icons.js +1 -1
  27. package/_dist/esm/icon/index.js +26 -0
  28. package/_dist/esm/menu/index.js +52 -0
  29. package/_dist/esm/modal/index.js +66 -0
  30. package/_dist/{popover → esm/popover}/index.js +100 -100
  31. package/_dist/esm/tooltip/index.js +119 -0
  32. package/package.json +8 -9
  33. package/_dist/_lib/storage/cookies.js +0 -33
  34. package/_dist/_lib/storage/encData.js +0 -41
  35. package/_dist/box/Box.js +0 -14
  36. package/_dist/box/BoxContent.js +0 -5
  37. package/_dist/box/BoxFooter.js +0 -10
  38. package/_dist/box/BoxHeader.js +0 -10
  39. package/_dist/countDown/index.js +0 -92
  40. package/_dist/form/Button.js +0 -82
  41. package/_dist/form/Checkbox.js +0 -22
  42. package/_dist/form/Dialog.js +0 -53
  43. package/_dist/form/Form.js +0 -10
  44. package/_dist/form/FormOlustur.js +0 -50
  45. package/_dist/form/Label.js +0 -7
  46. package/_dist/form/SearchableInput.js +0 -260
  47. package/_dist/form/UploadBase.js +0 -84
  48. package/_dist/grid/index.js +0 -96
  49. package/_dist/icon/index.js +0 -34
  50. package/_dist/menu/index.js +0 -50
  51. package/_dist/modal/index.js +0 -64
  52. package/_dist/tooltip/index.js +0 -202
  53. /package/_dist/{_lib → esm/_lib}/baseFunctions.d.ts +0 -0
  54. /package/_dist/{_lib → esm/_lib}/inputMask.d.ts +0 -0
  55. /package/_dist/{_lib → esm/_lib}/listFunctions.d.ts +0 -0
  56. /package/_dist/{_lib → esm/_lib}/storage/cookies.d.ts +0 -0
  57. /package/_dist/{_lib → esm/_lib}/storage/encData.d.ts +0 -0
  58. /package/_dist/{_lib → esm/_lib}/storage/localStorage.d.ts +0 -0
  59. /package/_dist/{_lib → esm/_lib}/storage/sessionStorage.d.ts +0 -0
  60. /package/_dist/{_lib → esm/_lib}/useInterval.d.ts +0 -0
  61. /package/_dist/{alert → esm/alert}/index.d.ts +0 -0
  62. /package/_dist/{alert → esm/alert}/index.module.css +0 -0
  63. /package/_dist/{box → esm/box}/Box.d.ts +0 -0
  64. /package/_dist/{box → esm/box}/Box.module.css +0 -0
  65. /package/_dist/{box → esm/box}/BoxContent.d.ts +0 -0
  66. /package/_dist/{box → esm/box}/BoxFooter.d.ts +0 -0
  67. /package/_dist/{box → esm/box}/BoxHeader.d.ts +0 -0
  68. /package/_dist/{box → esm/box}/index.d.ts +0 -0
  69. /package/_dist/{box → esm/box}/index.js +0 -0
  70. /package/_dist/{countDown → esm/countDown}/index.d.ts +0 -0
  71. /package/_dist/{dateTime → esm/dateTime}/index.d.ts +0 -0
  72. /package/_dist/{form → esm/form}/Button.d.ts +0 -0
  73. /package/_dist/{form → esm/form}/Checkbox.d.ts +0 -0
  74. /package/_dist/{form → esm/form}/Dialog.d.ts +0 -0
  75. /package/_dist/{form → esm/form}/Form.d.ts +0 -0
  76. /package/_dist/{form → esm/form}/FormOlustur.d.ts +0 -0
  77. /package/_dist/{form → esm/form}/Input.d.ts +0 -0
  78. /package/_dist/{form → esm/form}/Label.d.ts +0 -0
  79. /package/_dist/{form → esm/form}/SearchableInput.d.ts +0 -0
  80. /package/_dist/{form → esm/form}/UploadBase.d.ts +0 -0
  81. /package/_dist/{form → esm/form}/index.d.ts +0 -0
  82. /package/_dist/{form → esm/form}/index.js +0 -0
  83. /package/_dist/{form → esm/form}/styles/Button.module.css +0 -0
  84. /package/_dist/{form → esm/form}/styles/Input.module.css +0 -0
  85. /package/_dist/{form → esm/form}/styles/Label.module.css +0 -0
  86. /package/_dist/{form → esm/form}/styles/SearchableInput.module.css +0 -0
  87. /package/_dist/{grid → esm/grid}/index.d.ts +0 -0
  88. /package/_dist/{grid → esm/grid}/index.module.css +0 -0
  89. /package/_dist/{icon → esm/icon}/icons.d.ts +0 -0
  90. /package/_dist/{icon → esm/icon}/index.d.ts +0 -0
  91. /package/_dist/{icon → esm/icon}/mui.d.ts +0 -0
  92. /package/_dist/{icon → esm/icon}/mui.js +0 -0
  93. /package/_dist/{index.d.ts → esm/index.d.ts} +0 -0
  94. /package/_dist/{index.js → esm/index.js} +0 -0
  95. /package/_dist/{menu → esm/menu}/index.d.ts +0 -0
  96. /package/_dist/{menu → esm/menu}/index.module.css +0 -0
  97. /package/_dist/{modal → esm/modal}/index.d.ts +0 -0
  98. /package/_dist/{modal → esm/modal}/index.module.css +0 -0
  99. /package/_dist/{popover → esm/popover}/index.d.ts +0 -0
  100. /package/_dist/{popover → esm/popover}/index.module.css +0 -0
  101. /package/_dist/{tooltip → esm/tooltip}/index.d.ts +0 -0
@@ -0,0 +1,119 @@
1
+ import { __assign, __rest } from "tslib";
2
+ import React, { memo, useEffect } from "react";
3
+ export var Tooltip = memo(function MemoFunction(_a) {
4
+ var children = _a.children, title = _a.title, _b = _a.position, position = _b === void 0 ? "top" : _b, _c = _a.arrow, arrow = _c === void 0 ? false : _c, _d = _a.distance, distance = _d === void 0 ? 5 : _d, other = __rest(_a, ["children", "title", "position", "arrow", "distance"]);
5
+ useEffect(function () {
6
+ if (typeof window === "undefined")
7
+ return null;
8
+ var cssCheck = document.getElementsByClassName("stooltip_css")[0];
9
+ if (!cssCheck) {
10
+ var head = document.getElementsByTagName('head')[0];
11
+ var s = document.createElement('style');
12
+ s.setAttribute('type', 'text/css');
13
+ s.classList.add("stooltip_css");
14
+ s.appendChild(document.createTextNode(tooltipCss));
15
+ head.appendChild(s);
16
+ }
17
+ return function () { return tooltipSil(); };
18
+ }, []);
19
+ var tooltipEkle = function (e) {
20
+ tooltipSil();
21
+ var tooltip = document.createElement("div");
22
+ tooltip.innerHTML = title;
23
+ tooltip.classList.add("stooltip");
24
+ document.body.appendChild(tooltip);
25
+ tooltipPosition({ target: e.currentTarget, position: position });
26
+ };
27
+ var tooltipSil = function () {
28
+ var check = document.body.getElementsByClassName("stooltip")[0];
29
+ if (check)
30
+ check.remove();
31
+ };
32
+ var tooltipPosition = function (_a) {
33
+ var target = _a.target, position = _a.position;
34
+ var tooltip = document.body.getElementsByClassName("stooltip")[0];
35
+ if (tooltip) {
36
+ var arrowMargin = (arrow) ? 5 : 0;
37
+ var margin = distance + arrowMargin;
38
+ if (arrow)
39
+ tooltip.classList.add("arrow");
40
+ var targetPosition = target.getBoundingClientRect();
41
+ var tooltipPosition_1 = tooltip.getBoundingClientRect();
42
+ var style = [];
43
+ if (position === "top" || position === "bottom") {
44
+ if (position === "top") {
45
+ if ((targetPosition.top - tooltipPosition_1.height - margin) < 0) {
46
+ style.push("top:" + (targetPosition.bottom + margin) + "px");
47
+ tooltip.classList.add("bottom");
48
+ }
49
+ else {
50
+ style.push("top:" + (targetPosition.top - tooltipPosition_1.height - margin) + "px");
51
+ tooltip.classList.add("top");
52
+ }
53
+ }
54
+ if (position === "bottom") {
55
+ if ((targetPosition.bottom + tooltipPosition_1.height + margin) > window.innerHeight) {
56
+ style.push("top:" + (targetPosition.top - tooltipPosition_1.height - margin) + "px");
57
+ tooltip.classList.add("top");
58
+ }
59
+ else {
60
+ style.push("top:" + (targetPosition.bottom + margin) + "px");
61
+ tooltip.classList.add("bottom");
62
+ }
63
+ }
64
+ // if ((targetPosition.left - tooltipPosition.width) < 0) {
65
+ if ((targetPosition.left + (targetPosition.width / 2) - (tooltipPosition_1.width / 2)) < 0) {
66
+ style.push("left:2px");
67
+ tooltip.classList.add("start");
68
+ }
69
+ else if ((targetPosition.left + (targetPosition.width / 2) + tooltipPosition_1.width) > window.innerWidth) {
70
+ style.push("right:2px");
71
+ tooltip.classList.add("end");
72
+ }
73
+ else {
74
+ style.push("left:" + (targetPosition.left + (targetPosition.width / 2)) + "px");
75
+ style.push("transform:translate(-50%,0)");
76
+ tooltip.classList.add("center");
77
+ }
78
+ }
79
+ if (position === "left" || position === "right") {
80
+ if (position === "left") {
81
+ if ((targetPosition.left - tooltipPosition_1.width - margin) < 0) {
82
+ style.push("left:" + (targetPosition.right + margin) + "px");
83
+ tooltip.classList.add("right");
84
+ }
85
+ else {
86
+ style.push("left:" + (targetPosition.left - tooltipPosition_1.width - margin) + "px");
87
+ tooltip.classList.add("left");
88
+ }
89
+ }
90
+ if (position === "right") {
91
+ if ((targetPosition.left + (targetPosition.width / 2) + tooltipPosition_1.width + margin) > window.innerWidth) {
92
+ style.push("left:" + (targetPosition.left - tooltipPosition_1.width - margin) + "px");
93
+ tooltip.classList.add("left");
94
+ }
95
+ else {
96
+ style.push("left:" + (targetPosition.right + margin) + "px");
97
+ tooltip.classList.add("right");
98
+ }
99
+ }
100
+ if ((targetPosition.top + (targetPosition.height / 2) - (tooltipPosition_1.height / 2)) < 0) {
101
+ style.push("top:2px");
102
+ tooltip.classList.add("start");
103
+ }
104
+ else if ((targetPosition.top + (targetPosition.height / 2) + (tooltipPosition_1.height / 2)) > window.innerHeight) {
105
+ style.push("bottom:2px");
106
+ tooltip.classList.add("end");
107
+ }
108
+ else {
109
+ style.push("top:" + (targetPosition.top + (targetPosition.height / 2)) + "px");
110
+ style.push("transform:translate(0,-50%)");
111
+ tooltip.classList.add("center");
112
+ }
113
+ }
114
+ tooltip.setAttribute("style", style.join(";"));
115
+ }
116
+ };
117
+ return React.cloneElement(children, __assign({ onMouseEnter: tooltipEkle, onMouseLeave: tooltipSil, onMouseDown: tooltipSil }, other));
118
+ });
119
+ var tooltipCss = "\n.stooltip {\n position: fixed;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #1a1a1a;\n color: rgba(255,255,255,0.9);\n text-align: center;\n font-size: 0.9rem;\n font-weight:400;\n padding: 5px 10px;\n border-radius: 8px;\n z-index: 1000000;\n opacity: 0.9;\n pointer-events: none;\n /*transition: all 0.1s;*/\n white-space:pre-line;\n max-width: 300px;\n animation: stooltip_fadein 0.7s;\n}\n\n.stooltip.arrow:after {\n content: \"\";\n position: absolute;\n margin-left: -5px;\n border-width: 5px;\n border-style: solid;\n}\n\n.stooltip.arrow.top:after {\n top: 100%;\n border-color: #1a1a1a transparent transparent transparent;\n}\n\n.stooltip.arrow.top.start:after { left: 15px;}\n\n.stooltip.arrow.top.center:after { left: 50%;}\n\n.stooltip.arrow.top.end:after { right: 15px;}\n\n\n.stooltip.arrow.bottom:after {\n bottom: 100%;\n border-color: transparent transparent #1a1a1a transparent;\n}\n\n.stooltip.arrow.bottom.start:after { left: 15px;}\n\n.stooltip.arrow.bottom.center:after { left: 50%;}\n\n.stooltip.bottom.end:after { right: 15px;}\n\n.stooltip.arrow.left:after {\n margin-left: -1px;\n left: 100%;\n border-color: transparent transparent transparent #1a1a1a;\n}\n\n.stooltip.arrow.left.start:after { top: 5px;}\n\n.stooltip.arrow.left.center:after { top: 50%; margin-top: -5px;}\n\n.stooltip.arrow.left.end:after { bottom: 15px;}\n\n.stooltip.arrow.right:after {\n margin-right: -1px;\n right: 100%;\n border-color: transparent #1a1a1a transparent transparent;\n}\n\n.stooltip.arrow.right.start:after { top: 5px;}\n\n.stooltip.arrow.right.center:after { top: 50%; margin-top: -5px;}\n\n.stooltip.arrow.right.end:after { bottom: 15px;}\n\n@keyframes stooltip_fadein {\n from { opacity: 0; }\n to { opacity: 0.85; }\n}\n";
package/package.json CHANGED
@@ -1,26 +1,25 @@
1
1
  {
2
2
  "name": "@sydsoft/base",
3
3
  "private": false,
4
- "version": "1.50.0",
4
+ "version": "1.52.0",
5
5
  "description": "",
6
- "type": "module",
7
- "main": "./_dist/index.js",
8
- "module": "./_dist/index.js",
9
- "types": "./_dist/index.d.ts",
6
+ "main": "./_dist/cjs/index.js",
7
+ "module": "./_dist/esm/index.js",
8
+ "types": "./_dist/esm/index.d.ts",
10
9
  "files": [
11
10
  "./_dist/",
12
11
  "README.md"
13
12
  ],
14
13
  "exports": {
15
14
  ".": {
16
- "types": "./_dist/index.d.ts",
17
- "import": "./_dist/index.js"
15
+ "types": "./_dist/esm/index.d.ts",
16
+ "default": "./_dist/esm/index.js"
18
17
  }
19
18
  },
20
19
  "scripts": {
21
20
  "clean": "rm -rf ./_dist",
22
- "copyFiles": "copyfiles \"**/*.css\" _dist",
23
- "build": "rm -rf ./_dist && tsc && npm run copyFiles",
21
+ "copyFiles": "find . -name \"*.css\" -not -path \"./_dist/*\" -exec sh -c 'for f do mkdir -p \"_dist/esm/$(dirname \"$f\")\"; cp \"$f\" \"_dist/esm/$f\"; done' sh {} +",
22
+ "build": "npm run clean && tsc && npm run copyFiles",
24
23
  "publishNPM": "npm run build && npm version patch && npm version minor && npm publish --dry-run && npm publish --access public && npm run clean"
25
24
  },
26
25
  "publishConfig": {
@@ -1,33 +0,0 @@
1
- import nookies, { destroyCookie, parseCookies, setCookie } from 'nookies';
2
- import { getDomain } from '../baseFunctions';
3
- export const cerezOku = (context = null, key) => {
4
- const cookies = context ? nookies.get(context) : parseCookies();
5
- return cookies[key] || false;
6
- };
7
- export const cerezKaydet = (context = null, key, value, time = 0) => {
8
- const newConfig = checkDomain(context);
9
- setCookie(context, key, value, {
10
- maxAge: time > 0 ? time : null,
11
- ...newConfig
12
- });
13
- };
14
- export const cerezSil = (context = null, key) => {
15
- const newConfig = checkDomain(context);
16
- destroyCookie(context, key, newConfig);
17
- };
18
- export const cerezTumuSil = (context = null) => {
19
- const cookies = parseCookies(context);
20
- if (cookies) {
21
- Object.keys(cookies).forEach((key) => {
22
- destroyCookie(context, key);
23
- });
24
- }
25
- };
26
- const checkDomain = (context = null, config = {}) => {
27
- let cookieDomain = getDomain(context);
28
- return {
29
- ...config,
30
- domain: '.' + cookieDomain,
31
- path: '/'
32
- };
33
- };
@@ -1,41 +0,0 @@
1
- import { isDev } from "../baseFunctions";
2
- const encDecDataKeys = [3, 5, 8, 11, 15, 22];
3
- export const encData = (data, keys = encDecDataKeys) => {
4
- try {
5
- const newJSON = { data: data };
6
- const utf8Data = unescape(encodeURIComponent(JSON.stringify(newJSON))); // Dizeyi UTF-8'e dönüştür
7
- let newData = btoa(utf8Data);
8
- keys.map((value) => {
9
- const randomChar = String.fromCharCode(Math.floor(Math.random() * (122 - 97 + 1)) + 97);
10
- newData = newData.slice(0, value) + randomChar + newData.slice(value);
11
- });
12
- return newData;
13
- }
14
- catch (e) {
15
- isDev && console.log("ERROR => encData =>", e);
16
- return "";
17
- }
18
- };
19
- export const decData = (data, keys = encDecDataKeys) => {
20
- var _a;
21
- try {
22
- let decode = data;
23
- keys.map((value, index) => {
24
- const prevValue = keys[index - 1];
25
- if (!prevValue) {
26
- decode = decode.slice(0, value) + decode.slice(value + 1);
27
- }
28
- else {
29
- decode = decode.slice(0, value - index) + decode.slice(value - index + 1);
30
- }
31
- });
32
- const decodedString = atob(decode);
33
- const utf8DecodedString = decodeURIComponent(escape(decodedString));
34
- const parse = JSON.parse(utf8DecodedString);
35
- return (_a = parse === null || parse === void 0 ? void 0 : parse.data) !== null && _a !== void 0 ? _a : "";
36
- }
37
- catch (e) {
38
- isDev && console.log("ERROR => decData =>", e);
39
- return "";
40
- }
41
- };
package/_dist/box/Box.js DELETED
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo, useEffect, useRef, useState } from "react";
3
- import styles from "./Box.module.css";
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(() => {
8
- if (!boxRef.current)
9
- return;
10
- const found = boxRef.current.querySelector(".sbox_content");
11
- setHasContent(!!found);
12
- }, [children]);
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 }) }))] }));
14
- });
@@ -1,5 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import styles from "./Box.module.css";
3
- export const BoxContent = ({ className, style, padding, children }) => {
4
- return (_jsx("div", { className: `${styles.content} sbox_content ${className || ""}`, style: { ...style, padding }, children: children }));
5
- };
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { memo } from "react";
3
- import styles from "./Box.module.css";
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 }));
10
- });
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo } from 'react';
3
- import styles from './Box.module.css';
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 }))] }));
10
- });
@@ -1,92 +0,0 @@
1
- import { useEffect, useRef, useState } from 'react';
2
- import React from 'react';
3
- import { useInterval } from '../_lib/useInterval';
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(() => {
11
- if (!hide)
12
- render();
13
- }, [timer]);
14
- useInterval(() => {
15
- if (enabled) {
16
- if (timer <= 1) {
17
- stopCountDown();
18
- }
19
- else {
20
- setTimer(timer - 1);
21
- }
22
- }
23
- }, enabled ? timerSpeed : null);
24
- const prepareTimer = (timeORstring) => {
25
- if (timerType === 'datetime') {
26
- setTimer(Math.floor((new Date(timeORstring).getTime() - new Date().getTime()) / 1000));
27
- setEnabled(true);
28
- }
29
- else {
30
- setTimer(timeORstring);
31
- }
32
- };
33
- const stopCountDown = () => {
34
- setTimer(0);
35
- setEnabled(false);
36
- if ((enabled && onComplete) || (timerType === 'datetime' && onComplete)) {
37
- onComplete();
38
- }
39
- };
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;
43
- if (countType === 'minutes:seconds') {
44
- minutes = Math.floor(seconds / 60);
45
- seconds -= minutes * 60;
46
- }
47
- else if (countType === 'hours:minutes:seconds') {
48
- hours = Math.floor(seconds / (60 * 60));
49
- seconds -= hours * 60 * 60;
50
- minutes = Math.floor(seconds / 60);
51
- seconds -= minutes * 60;
52
- }
53
- else if (countType === 'days:hours:minutes:seconds') {
54
- days = Math.floor(seconds / (60 * 60 * 24));
55
- seconds -= days * 60 * 60 * 24;
56
- hours = Math.floor(seconds / (60 * 60));
57
- seconds -= hours * 60 * 60;
58
- minutes = Math.floor(seconds / 60);
59
- seconds -= minutes * 60;
60
- }
61
- seconds = Math.floor(seconds);
62
- if (getStatus && timer > 0)
63
- getStatus({ days, hours, minutes, seconds, timer });
64
- if (refCountDownRender.current) {
65
- const getPadValues = (div) => {
66
- const length = div.dataset.padlength || 2;
67
- const string = div.dataset.padstring || '0';
68
- return { length, string };
69
- };
70
- const divGun = refCountDownRender.current.querySelector("[data-name='days']");
71
- if (divGun)
72
- divGun.innerHTML = padNumber(days, getPadValues(divGun).length, getPadValues(divGun).string).toString();
73
- const divSaat = refCountDownRender.current.querySelector("[data-name='hours']");
74
- if (divSaat)
75
- divSaat.innerHTML = padNumber(hours, getPadValues(divSaat).length, getPadValues(divSaat).string).toString();
76
- const divDakika = refCountDownRender.current.querySelector("[data-name='minutes']");
77
- if (divDakika)
78
- divDakika.innerHTML = padNumber(minutes, getPadValues(divDakika).length, getPadValues(divDakika).string).toString();
79
- const divSaniye = refCountDownRender.current.querySelector("[data-name='seconds']");
80
- if (divSaniye)
81
- divSaniye.innerHTML = padNumber(seconds, getPadValues(divSaniye).length, getPadValues(divSaniye).string).toString();
82
- }
83
- };
84
- return {
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
91
- };
92
- };
@@ -1,82 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Dialog } from "./Dialog";
3
- import { memo, useCallback, useEffect, useState } from "react";
4
- import { Tooltip } from "../tooltip";
5
- import Link from "next/link";
6
- import styles from "./styles/Button.module.css";
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`;
14
- circle.classList.add(styles.ripple);
15
- const ripple = el.getElementsByClassName(styles.ripple)[0];
16
- if (ripple)
17
- ripple.remove();
18
- el.appendChild(circle);
19
- };
20
- const handleClick = (e) => {
21
- ripple(e);
22
- if (dialog) {
23
- Dialog(dialog).then((result) => {
24
- if (result && onClick) {
25
- onClick(e);
26
- }
27
- });
28
- }
29
- else {
30
- if (onClick)
31
- onClick(e);
32
- }
33
- };
34
- const createClassList = useCallback(() => {
35
- const list = ["sbutton", styles.button];
36
- if (buttonClass)
37
- list.push(styles[buttonClass]);
38
- if (className)
39
- list.push(className);
40
- if (onlyIcon)
41
- list.push(styles.iconbutton);
42
- if (fullWidth)
43
- list.push(styles.fullwidth);
44
- return list.join(" ");
45
- }, [buttonClass, className, onlyIcon, fullWidth]);
46
- const [classList, setClassList] = useState(() => createClassList());
47
- useEffect(() => {
48
- const newClassList = createClassList().split(" ").filter(Boolean);
49
- if (href && typeof window !== "undefined" && window.location.pathname === href) {
50
- newClassList.push("active");
51
- }
52
- setClassList(newClassList.join(" "));
53
- }, [href, createClassList]);
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;
64
- if (href !== undefined) {
65
- if (other === null || other === void 0 ? void 0 : other.hidden) {
66
- renderComponent = null;
67
- }
68
- else {
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 }) }));
71
- }
72
- }
73
- else {
74
- renderComponent = (_jsx(Comp, { type: type, ...ortakProps, children: onlyIcon ? onlyIcon : children }));
75
- }
76
- if (title && renderComponent) {
77
- return (_jsx(Tooltip, { title: title, position: titlePosition, arrow: titleArrow, children: renderComponent }));
78
- }
79
- else {
80
- return renderComponent;
81
- }
82
- });
@@ -1,22 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useRef } from "react";
3
- import styles from "./styles/Input.module.css";
4
- export const Checkbox = ({ ref, children, name, label, checked, className, style, styleCheckbox, styleLabel, onToogle, disabled, tabIndex, required = false }) => {
5
- const refMain = useRef(null);
6
- // checked değerini boolean hâline getiriyoruz
7
- const isChecked = checked === "1" || checked === true;
8
- const handleChange = (newChecked) => {
9
- if (disabled)
10
- return;
11
- onToogle === null || onToogle === void 0 ? void 0 : onToogle({
12
- target: {
13
- name,
14
- value: newChecked ? "1" : "0"
15
- }
16
- });
17
- };
18
- const toggleCheck = () => {
19
- handleChange(!isChecked);
20
- };
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 })] }));
22
- };
@@ -1,53 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, BoxFooter } from '../box';
3
- import { createRoot } from 'react-dom/client';
4
- import { Modal } from '../modal';
5
- import { Button } from './Button';
6
- export const Dialog = (config) => new Promise((resolve) => {
7
- if (typeof window === 'undefined')
8
- return false;
9
- let mainDiv = document.getElementById('sdialog');
10
- if (!mainDiv) {
11
- const createDiv = document.createElement('div');
12
- createDiv.setAttribute('id', 'sdialog');
13
- document.body.appendChild(createDiv);
14
- mainDiv = createDiv;
15
- }
16
- const root = createRoot(mainDiv);
17
- const settings = {
18
- acceptButtonShow: true,
19
- cancelButtonShow: true,
20
- acceptButtonText: 'EVET',
21
- cancelButtonText: 'HAYIR',
22
- acceptButtonClass: 'danger',
23
- cancelButtonClass: 'secondary',
24
- vertialAlign: 'center',
25
- horizontalAlign: 'center',
26
- hideBackdrop: true,
27
- hideEsc: true,
28
- styleMessage: {
29
- fontSize: '1.1rem',
30
- padding: '10px 20px'
31
- },
32
- styleBox: { padding: 0, margin: 0, minWidth: 250 },
33
- styleBoxFooter: { padding: '8px 5px' },
34
- autoFocus: 'accept',
35
- ...config
36
- };
37
- const close = () => {
38
- if (mainDiv) {
39
- root.unmount();
40
- mainDiv.remove();
41
- }
42
- };
43
- const onCancel = () => {
44
- resolve(false);
45
- close();
46
- };
47
- const onAccept = () => {
48
- resolve(true);
49
- close();
50
- };
51
- const Component = (_jsx(Modal, { open: true, keepMounted: false, close: onCancel, hideBackdrop: settings.hideBackdrop, hideEsc: settings.hideEsc, hideCloseButton: true, vertialAlign: settings.vertialAlign, horizontalAlign: settings.horizontalAlign, backdropStyle: settings.backdropStyle, children: _jsxs(Box, { style: settings.styleBox, children: [_jsx("div", { className: "sbox_content", style: settings.styleMessage, dangerouslySetInnerHTML: { __html: settings.message } }), (settings.acceptButtonShow || settings.cancelButtonShow) && (_jsxs(BoxFooter, { style: settings.styleBoxFooter, children: [settings.cancelButtonShow && (_jsx(Button, { autoFocus: settings.autoFocus === 'cancel', buttonClass: settings.cancelButtonClass, onClick: onCancel, children: settings.cancelButtonText })), settings.acceptButtonShow && (_jsx(Button, { autoFocus: settings.autoFocus === 'accept', buttonClass: settings.acceptButtonClass, onClick: onAccept, children: settings.acceptButtonText }))] }))] }) }));
52
- root.render(Component);
53
- });
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { memo } from "react";
3
- export const Form = memo(function FunctionMemo({ encType = "multipart/form-data", onSubmit, style, disableOnEnterSubmit = false, ...other }) {
4
- const onKeyDown = (e) => {
5
- if (e.key === "Enter" && disableOnEnterSubmit) {
6
- e.preventDefault();
7
- }
8
- };
9
- return _jsx("form", { style: style, encType: encType, onSubmit: onSubmit, onKeyDown: onKeyDown, ...other });
10
- });
@@ -1,50 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React, { memo, useEffect, useMemo } from 'react';
3
- import { Col, Row } from '../grid';
4
- import { isDev } from '../_lib/baseFunctions';
5
- import { Label } from './Label';
6
- export const FormOlustur = memo(function FunctionMemo(props) {
7
- const { form, formOgeler, onChange, formType, sabitGrid, justifyContent, rowSpacing, colSpacing } = props;
8
- useEffect(() => {
9
- if (formOgeler && onChange && form) {
10
- formOgeler.forEach((formOgeler) => {
11
- var _a, _b, _c, _d;
12
- const fieldName = (_b = (_a = formOgeler === null || formOgeler === void 0 ? void 0 : formOgeler.component) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.name;
13
- if (formOgeler.noRender && fieldName && form[fieldName] && form[fieldName] != '') {
14
- isDev && console.log('noRenderGuncelle');
15
- if ((formOgeler === null || formOgeler === void 0 ? void 0 : formOgeler.component) && ((_d = (_c = formOgeler === null || formOgeler === void 0 ? void 0 : formOgeler.component) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.name)) {
16
- onChange({
17
- target: {
18
- name: fieldName,
19
- value: ''
20
- }
21
- });
22
- }
23
- }
24
- });
25
- }
26
- }, [JSON.stringify(form), formOgeler]);
27
- const result = useMemo(() => {
28
- return formOgeler.map(({ noRender, fullComponent, component, propsComponent, propsRow, label, propsLabel, gridLabel, gridInput }, i) => {
29
- if (noRender) {
30
- return null;
31
- }
32
- if (fullComponent)
33
- return React.cloneElement(fullComponent, { key: i });
34
- let newProps = { ...propsComponent };
35
- if (onChange && component && !component.props.onChange) {
36
- newProps = { ...newProps, onChange };
37
- }
38
- if (onChange && form && component.props.name && !component.props.value) {
39
- newProps = { ...newProps, value: form[component.props.name] && form[component.props.name].length > 0 ? String(form[component.props.name]) : '' };
40
- }
41
- if (formType === 'label')
42
- newProps = { ...newProps, label: '' };
43
- const detectLabel = label || component.props.label;
44
- gridLabel = { ...sabitGrid.label, ...gridLabel };
45
- gridInput = { ...sabitGrid.input, ...gridInput };
46
- return (_jsxs(Row, { justifyContent: justifyContent, rowSpacing: rowSpacing, colSpacing: colSpacing, ...propsRow, children: [formType === 'label' && detectLabel && (_jsx(Col, { ...gridLabel, children: _jsx(Label, { required: component.props.required, ...propsLabel, children: detectLabel }) })), _jsx(Col, { ...gridInput, children: React.cloneElement(component, newProps) })] }, i));
47
- });
48
- }, [form, formOgeler, onChange, formType, sabitGrid, justifyContent, rowSpacing, colSpacing]);
49
- return _jsx(React.Fragment, { children: result });
50
- });
@@ -1,7 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo } from 'react';
3
- import { Tooltip } from '../tooltip';
4
- import styles from './styles/Label.module.css';
5
- export const Label = memo(function FMemo({ required = false, children, ...other }) {
6
- return (_jsxs("label", { className: styles.label, ...other, children: [children, _jsx(Tooltip, { title: 'Zorunlu Alan', children: _jsx("span", { className: styles.required, children: required && '*' }) })] }));
7
- });