@sydsoft/base 1.47.0 → 1.49.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 (151) hide show
  1. package/README.md +8 -1
  2. package/{dist/esm → _dist}/_lib/baseFunctions.d.ts +0 -1
  3. package/{dist/esm → _dist}/_lib/baseFunctions.js +25 -38
  4. package/{dist/esm → _dist}/_lib/inputMask.js +66 -69
  5. package/{dist/esm → _dist}/_lib/listFunctions.js +12 -13
  6. package/_dist/_lib/storage/cookies.d.ts +4 -0
  7. package/_dist/_lib/storage/cookies.js +33 -0
  8. package/_dist/_lib/storage/encData.js +41 -0
  9. package/{dist/esm → _dist}/_lib/storage/localStorage.js +10 -10
  10. package/{dist/esm → _dist}/_lib/storage/sessionStorage.js +10 -10
  11. package/{dist/esm → _dist}/_lib/useInterval.js +5 -5
  12. package/{dist/esm → _dist}/alert/index.js +28 -30
  13. package/_dist/box/Box.js +14 -0
  14. package/_dist/box/BoxContent.js +5 -0
  15. package/_dist/box/BoxFooter.js +10 -0
  16. package/_dist/box/BoxHeader.js +10 -0
  17. package/_dist/countDown/index.js +92 -0
  18. package/{dist/esm → _dist}/dateTime/index.js +25 -31
  19. package/_dist/form/Button.js +82 -0
  20. package/_dist/form/Checkbox.js +22 -0
  21. package/_dist/form/Dialog.js +53 -0
  22. package/_dist/form/Form.js +10 -0
  23. package/_dist/form/FormOlustur.js +50 -0
  24. package/{dist/esm → _dist}/form/Input.js +57 -56
  25. package/_dist/form/Label.js +7 -0
  26. package/{dist/esm → _dist}/form/SearchableInput.d.ts +0 -1
  27. package/_dist/form/SearchableInput.js +260 -0
  28. package/_dist/form/UploadBase.js +84 -0
  29. package/_dist/grid/index.js +96 -0
  30. package/{dist/esm → _dist}/icon/icons.js +1 -1
  31. package/{dist/esm → _dist}/icon/index.d.ts +1 -1
  32. package/_dist/icon/index.js +34 -0
  33. package/_dist/menu/index.js +50 -0
  34. package/_dist/modal/index.js +64 -0
  35. package/{dist/esm → _dist}/popover/index.js +100 -100
  36. package/_dist/tooltip/index.js +202 -0
  37. package/_lib/baseFunctions.ts +94 -0
  38. package/_lib/inputMask.ts +257 -0
  39. package/_lib/listFunctions.ts +106 -0
  40. package/_lib/storage/cookies.ts +39 -0
  41. package/_lib/storage/encData.ts +41 -0
  42. package/_lib/storage/localStorage.ts +67 -0
  43. package/_lib/storage/sessionStorage.ts +67 -0
  44. package/_lib/useInterval.ts +30 -0
  45. package/alert/index.module.css +119 -0
  46. package/alert/index.tsx +131 -0
  47. package/box/Box.module.css +153 -0
  48. package/box/Box.tsx +33 -0
  49. package/box/BoxContent.tsx +18 -0
  50. package/box/BoxFooter.tsx +25 -0
  51. package/box/BoxHeader.tsx +46 -0
  52. package/box/index.ts +10 -0
  53. package/countDown/index.tsx +116 -0
  54. package/dateTime/index.ts +79 -0
  55. package/form/Button.tsx +143 -0
  56. package/form/Checkbox.tsx +48 -0
  57. package/form/Dialog.tsx +109 -0
  58. package/form/Form.tsx +19 -0
  59. package/form/FormOlustur.tsx +105 -0
  60. package/form/Input.tsx +364 -0
  61. package/form/Label.tsx +20 -0
  62. package/form/SearchableInput.tsx +406 -0
  63. package/form/UploadBase.tsx +133 -0
  64. package/form/index.ts +10 -0
  65. package/form/styles/Button.module.css +145 -0
  66. package/form/styles/Input.module.css +221 -0
  67. package/form/styles/Label.module.css +31 -0
  68. package/form/styles/SearchableInput.module.css +80 -0
  69. package/global.d.ts +9 -0
  70. package/grid/index.module.css +805 -0
  71. package/grid/index.tsx +171 -0
  72. package/icon/icons.tsx +33 -0
  73. package/icon/index.tsx +95 -0
  74. package/icon/mui.tsx +5932 -0
  75. package/index.ts +21 -0
  76. package/menu/index.module.css +92 -0
  77. package/menu/index.tsx +143 -0
  78. package/modal/index.module.css +77 -0
  79. package/modal/index.tsx +106 -0
  80. package/npm_recovery_codes.txt +5 -0
  81. package/package.json +18 -11
  82. package/popover/index.module.css +89 -0
  83. package/popover/index.tsx +392 -0
  84. package/tooltip/index.tsx +216 -0
  85. package/tsconfig.json +24 -0
  86. package/dist/esm/_lib/storage/cookies.d.ts +0 -4
  87. package/dist/esm/_lib/storage/cookies.js +0 -34
  88. package/dist/esm/_lib/storage/encData.js +0 -43
  89. package/dist/esm/box/Box.js +0 -15
  90. package/dist/esm/box/BoxContent.js +0 -7
  91. package/dist/esm/box/BoxFooter.js +0 -8
  92. package/dist/esm/box/BoxHeader.js +0 -9
  93. package/dist/esm/countDown/index.js +0 -97
  94. package/dist/esm/form/Button.js +0 -76
  95. package/dist/esm/form/Checkbox.js +0 -23
  96. package/dist/esm/form/Dialog.js +0 -40
  97. package/dist/esm/form/Form.js +0 -12
  98. package/dist/esm/form/FormOlustur.js +0 -52
  99. package/dist/esm/form/Label.js +0 -9
  100. package/dist/esm/form/SearchableInput.js +0 -272
  101. package/dist/esm/form/UploadBase.js +0 -86
  102. package/dist/esm/grid/index.js +0 -97
  103. package/dist/esm/icon/index.js +0 -26
  104. package/dist/esm/menu/index.js +0 -52
  105. package/dist/esm/modal/index.js +0 -66
  106. package/dist/esm/tooltip/index.js +0 -119
  107. /package/{dist/esm → _dist}/_lib/inputMask.d.ts +0 -0
  108. /package/{dist/esm → _dist}/_lib/listFunctions.d.ts +0 -0
  109. /package/{dist/esm → _dist}/_lib/storage/encData.d.ts +0 -0
  110. /package/{dist/esm → _dist}/_lib/storage/localStorage.d.ts +0 -0
  111. /package/{dist/esm → _dist}/_lib/storage/sessionStorage.d.ts +0 -0
  112. /package/{dist/esm → _dist}/_lib/useInterval.d.ts +0 -0
  113. /package/{dist/esm → _dist}/alert/index.d.ts +0 -0
  114. /package/{dist/esm → _dist}/alert/index.module.css +0 -0
  115. /package/{dist/esm → _dist}/box/Box.d.ts +0 -0
  116. /package/{dist/esm → _dist}/box/Box.module.css +0 -0
  117. /package/{dist/esm → _dist}/box/BoxContent.d.ts +0 -0
  118. /package/{dist/esm → _dist}/box/BoxFooter.d.ts +0 -0
  119. /package/{dist/esm → _dist}/box/BoxHeader.d.ts +0 -0
  120. /package/{dist/esm → _dist}/box/index.d.ts +0 -0
  121. /package/{dist/esm → _dist}/box/index.js +0 -0
  122. /package/{dist/esm → _dist}/countDown/index.d.ts +0 -0
  123. /package/{dist/esm → _dist}/dateTime/index.d.ts +0 -0
  124. /package/{dist/esm → _dist}/form/Button.d.ts +0 -0
  125. /package/{dist/esm → _dist}/form/Checkbox.d.ts +0 -0
  126. /package/{dist/esm → _dist}/form/Dialog.d.ts +0 -0
  127. /package/{dist/esm → _dist}/form/Form.d.ts +0 -0
  128. /package/{dist/esm → _dist}/form/FormOlustur.d.ts +0 -0
  129. /package/{dist/esm → _dist}/form/Input.d.ts +0 -0
  130. /package/{dist/esm → _dist}/form/Label.d.ts +0 -0
  131. /package/{dist/esm → _dist}/form/UploadBase.d.ts +0 -0
  132. /package/{dist/esm → _dist}/form/index.d.ts +0 -0
  133. /package/{dist/esm → _dist}/form/index.js +0 -0
  134. /package/{dist/esm → _dist}/form/styles/Button.module.css +0 -0
  135. /package/{dist/esm → _dist}/form/styles/Input.module.css +0 -0
  136. /package/{dist/esm → _dist}/form/styles/Label.module.css +0 -0
  137. /package/{dist/esm → _dist}/form/styles/SearchableInput.module.css +0 -0
  138. /package/{dist/esm → _dist}/grid/index.d.ts +0 -0
  139. /package/{dist/esm → _dist}/grid/index.module.css +0 -0
  140. /package/{dist/esm → _dist}/icon/icons.d.ts +0 -0
  141. /package/{dist/esm → _dist}/icon/mui.d.ts +0 -0
  142. /package/{dist/esm → _dist}/icon/mui.js +0 -0
  143. /package/{dist/esm → _dist}/index.d.ts +0 -0
  144. /package/{dist/esm → _dist}/index.js +0 -0
  145. /package/{dist/esm → _dist}/menu/index.d.ts +0 -0
  146. /package/{dist/esm → _dist}/menu/index.module.css +0 -0
  147. /package/{dist/esm → _dist}/modal/index.d.ts +0 -0
  148. /package/{dist/esm → _dist}/modal/index.module.css +0 -0
  149. /package/{dist/esm → _dist}/popover/index.d.ts +0 -0
  150. /package/{dist/esm → _dist}/popover/index.module.css +0 -0
  151. /package/{dist/esm → _dist}/tooltip/index.d.ts +0 -0
@@ -1,43 +0,0 @@
1
- import { isDev } from "../baseFunctions";
2
- var encDecDataKeys = [3, 5, 8, 11, 15, 22];
3
- export var encData = function (data, keys) {
4
- if (keys === void 0) { keys = encDecDataKeys; }
5
- try {
6
- var newJSON = { data: data };
7
- var utf8Data = unescape(encodeURIComponent(JSON.stringify(newJSON))); // Dizeyi UTF-8'e dönüştür
8
- var newData_1 = btoa(utf8Data);
9
- keys.map(function (value) {
10
- var randomChar = String.fromCharCode(Math.floor(Math.random() * (122 - 97 + 1)) + 97);
11
- newData_1 = newData_1.slice(0, value) + randomChar + newData_1.slice(value);
12
- });
13
- return newData_1;
14
- }
15
- catch (e) {
16
- isDev && console.log("ERROR => encData =>", e);
17
- return "";
18
- }
19
- };
20
- export var decData = function (data, keys) {
21
- var _a;
22
- if (keys === void 0) { keys = encDecDataKeys; }
23
- try {
24
- var decode_1 = data;
25
- keys.map(function (value, index) {
26
- var prevValue = keys[index - 1];
27
- if (!prevValue) {
28
- decode_1 = decode_1.slice(0, value) + decode_1.slice(value + 1);
29
- }
30
- else {
31
- decode_1 = decode_1.slice(0, value - index) + decode_1.slice(value - index + 1);
32
- }
33
- });
34
- var decodedString = atob(decode_1);
35
- var utf8DecodedString = decodeURIComponent(escape(decodedString));
36
- var parse = JSON.parse(utf8DecodedString);
37
- return (_a = parse === null || parse === void 0 ? void 0 : parse.data) !== null && _a !== void 0 ? _a : "";
38
- }
39
- catch (e) {
40
- isDev && console.log("ERROR => decData =>", e);
41
- return "";
42
- }
43
- };
@@ -1,15 +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 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 () {
9
- if (!boxRef.current)
10
- return;
11
- var found = boxRef.current.querySelector(".sbox_content");
12
- setHasContent(!!found);
13
- }, [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 }) }))] }));
15
- });
@@ -1,7 +0,0 @@
1
- import { __assign } from "tslib";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- 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 }));
7
- };
@@ -1,8 +0,0 @@
1
- import { __assign } from "tslib";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { memo } from "react";
4
- 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 }));
8
- });
@@ -1,9 +0,0 @@
1
- import { __assign } from "tslib";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { memo } from 'react';
4
- 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 }))] }));
9
- });
@@ -1,97 +0,0 @@
1
- import { useEffect, useRef, useState } from 'react';
2
- import React from 'react';
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 () {
12
- if (!hide)
13
- render();
14
- }, [timer]);
15
- useInterval(function () {
16
- if (enabled) {
17
- if (timer <= 1) {
18
- stopCountDown();
19
- }
20
- else {
21
- setTimer(timer - 1);
22
- }
23
- }
24
- }, enabled ? timerSpeed : null);
25
- var prepareTimer = function (timeORstring) {
26
- if (timerType === 'datetime') {
27
- setTimer(Math.floor((new Date(timeORstring).getTime() - new Date().getTime()) / 1000));
28
- setEnabled(true);
29
- }
30
- else {
31
- setTimer(timeORstring);
32
- }
33
- };
34
- var stopCountDown = function () {
35
- setTimer(0);
36
- setEnabled(false);
37
- if ((enabled && onComplete) || (timerType === 'datetime' && onComplete)) {
38
- onComplete();
39
- }
40
- };
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;
48
- if (countType === 'minutes:seconds') {
49
- minutes = Math.floor(seconds / 60);
50
- seconds -= minutes * 60;
51
- }
52
- else if (countType === 'hours:minutes:seconds') {
53
- hours = Math.floor(seconds / (60 * 60));
54
- seconds -= hours * 60 * 60;
55
- minutes = Math.floor(seconds / 60);
56
- seconds -= minutes * 60;
57
- }
58
- else if (countType === 'days:hours:minutes:seconds') {
59
- days = Math.floor(seconds / (60 * 60 * 24));
60
- seconds -= days * 60 * 60 * 24;
61
- hours = Math.floor(seconds / (60 * 60));
62
- seconds -= hours * 60 * 60;
63
- minutes = Math.floor(seconds / 60);
64
- seconds -= minutes * 60;
65
- }
66
- seconds = Math.floor(seconds);
67
- if (getStatus && timer > 0)
68
- getStatus({ days: days, hours: hours, minutes: minutes, seconds: seconds, timer: timer });
69
- 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 };
74
- };
75
- var divGun = refCountDownRender.current.querySelector("[data-name='days']");
76
- if (divGun)
77
- divGun.innerHTML = padNumber(days, getPadValues(divGun).length, getPadValues(divGun).string).toString();
78
- var divSaat = refCountDownRender.current.querySelector("[data-name='hours']");
79
- if (divSaat)
80
- divSaat.innerHTML = padNumber(hours, getPadValues(divSaat).length, getPadValues(divSaat).string).toString();
81
- var divDakika = refCountDownRender.current.querySelector("[data-name='minutes']");
82
- if (divDakika)
83
- divDakika.innerHTML = padNumber(minutes, getPadValues(divDakika).length, getPadValues(divDakika).string).toString();
84
- var divSaniye = refCountDownRender.current.querySelector("[data-name='seconds']");
85
- if (divSaniye)
86
- divSaniye.innerHTML = padNumber(seconds, getPadValues(divSaniye).length, getPadValues(divSaniye).string).toString();
87
- }
88
- };
89
- 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; }
96
- };
97
- };
@@ -1,76 +0,0 @@
1
- import { __assign, __rest } from "tslib";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { Dialog } from "./Dialog";
4
- import { memo, useCallback, useEffect, useState } from "react";
5
- import { Tooltip } from "../tooltip";
6
- import Link from "next/link";
7
- 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");
16
- circle.classList.add(styles.ripple);
17
- var ripple = el.getElementsByClassName(styles.ripple)[0];
18
- if (ripple)
19
- ripple.remove();
20
- el.appendChild(circle);
21
- };
22
- var handleClick = function (e) {
23
- ripple(e);
24
- if (dialog) {
25
- Dialog(dialog).then(function (result) {
26
- if (result && onClick) {
27
- onClick(e);
28
- }
29
- });
30
- }
31
- else {
32
- if (onClick)
33
- onClick(e);
34
- }
35
- };
36
- var createClassList = useCallback(function () {
37
- var list = ["sbutton", styles.button];
38
- if (buttonClass)
39
- list.push(styles[buttonClass]);
40
- if (className)
41
- list.push(className);
42
- if (onlyIcon)
43
- list.push(styles.iconbutton);
44
- if (fullWidth)
45
- list.push(styles.fullwidth);
46
- return list.join(" ");
47
- }, [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);
51
- if (href && typeof window !== "undefined" && window.location.pathname === href) {
52
- newClassList.push("active");
53
- }
54
- setClassList(newClassList.join(" "));
55
- }, [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;
58
- if (href !== undefined) {
59
- if (other === null || other === void 0 ? void 0 : other.hidden) {
60
- renderComponent = null;
61
- }
62
- 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 })) }));
65
- }
66
- }
67
- else {
68
- renderComponent = (_jsx(Comp, __assign({ type: type }, ortakProps, { children: onlyIcon ? onlyIcon : children })));
69
- }
70
- if (title && renderComponent) {
71
- return (_jsx(Tooltip, { title: title, position: titlePosition, arrow: titleArrow, children: renderComponent }));
72
- }
73
- else {
74
- return renderComponent;
75
- }
76
- });
@@ -1,23 +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 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);
7
- // checked değerini boolean hâline getiriyoruz
8
- var isChecked = checked === "1" || checked === true;
9
- var handleChange = function (newChecked) {
10
- if (disabled)
11
- return;
12
- onToogle === null || onToogle === void 0 ? void 0 : onToogle({
13
- target: {
14
- name: name,
15
- value: newChecked ? "1" : "0"
16
- }
17
- });
18
- };
19
- var toggleCheck = function () {
20
- handleChange(!isChecked);
21
- };
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 })] }));
23
- };
@@ -1,40 +0,0 @@
1
- import { __assign } from "tslib";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Box, BoxFooter } from '../box';
4
- import { createRoot } from 'react-dom/client';
5
- import { Modal } from '../modal';
6
- import { Button } from './Button';
7
- export var Dialog = function (config) {
8
- return new Promise(function (resolve) {
9
- if (typeof window === 'undefined')
10
- return false;
11
- var mainDiv = document.getElementById('sdialog');
12
- if (!mainDiv) {
13
- var createDiv = document.createElement('div');
14
- createDiv.setAttribute('id', 'sdialog');
15
- document.body.appendChild(createDiv);
16
- mainDiv = createDiv;
17
- }
18
- var root = createRoot(mainDiv);
19
- var settings = __assign({ acceptButtonShow: true, cancelButtonShow: true, acceptButtonText: 'EVET', cancelButtonText: 'HAYIR', acceptButtonClass: 'danger', cancelButtonClass: 'secondary', vertialAlign: 'center', horizontalAlign: 'center', hideBackdrop: true, hideEsc: true, styleMessage: {
20
- fontSize: '1.1rem',
21
- padding: '10px 20px'
22
- }, styleBox: { padding: 0, margin: 0, minWidth: 250 }, styleBoxFooter: { padding: '8px 5px' }, autoFocus: 'accept' }, config);
23
- var close = function () {
24
- if (mainDiv) {
25
- root.unmount();
26
- mainDiv.remove();
27
- }
28
- };
29
- var onCancel = function () {
30
- resolve(false);
31
- close();
32
- };
33
- var onAccept = function () {
34
- resolve(true);
35
- close();
36
- };
37
- var 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 }))] }))] }) }));
38
- root.render(Component);
39
- });
40
- };
@@ -1,12 +0,0 @@
1
- import { __assign, __rest } from "tslib";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { memo } from "react";
4
- export var Form = memo(function FunctionMemo(_a) {
5
- var _b = _a.encType, encType = _b === void 0 ? "multipart/form-data" : _b, onSubmit = _a.onSubmit, style = _a.style, _c = _a.disableOnEnterSubmit, disableOnEnterSubmit = _c === void 0 ? false : _c, other = __rest(_a, ["encType", "onSubmit", "style", "disableOnEnterSubmit"]);
6
- var onKeyDown = function (e) {
7
- if (e.key === "Enter" && disableOnEnterSubmit) {
8
- e.preventDefault();
9
- }
10
- };
11
- return _jsx("form", __assign({ style: style, encType: encType, onSubmit: onSubmit, onKeyDown: onKeyDown }, other));
12
- });
@@ -1,52 +0,0 @@
1
- import { __assign } from "tslib";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import React, { memo, useEffect, useMemo } from 'react';
4
- import { Col, Row } from '../grid';
5
- import { isDev } from '../_lib/baseFunctions';
6
- import { Label } from './Label';
7
- export var FormOlustur = memo(function FunctionMemo(props) {
8
- var form = props.form, formOgeler = props.formOgeler, onChange = props.onChange, formType = props.formType, sabitGrid = props.sabitGrid, justifyContent = props.justifyContent, rowSpacing = props.rowSpacing, colSpacing = props.colSpacing;
9
- useEffect(function () {
10
- if (formOgeler && onChange && form) {
11
- formOgeler.forEach(function (formOgeler) {
12
- var _a, _b, _c, _d;
13
- var 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;
14
- if (formOgeler.noRender && fieldName && form[fieldName] && form[fieldName] != '') {
15
- isDev && console.log('noRenderGuncelle');
16
- 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)) {
17
- onChange({
18
- target: {
19
- name: fieldName,
20
- value: ''
21
- }
22
- });
23
- }
24
- }
25
- });
26
- }
27
- }, [JSON.stringify(form), formOgeler]);
28
- var result = useMemo(function () {
29
- return formOgeler.map(function (_a, i) {
30
- var noRender = _a.noRender, fullComponent = _a.fullComponent, component = _a.component, propsComponent = _a.propsComponent, propsRow = _a.propsRow, label = _a.label, propsLabel = _a.propsLabel, gridLabel = _a.gridLabel, gridInput = _a.gridInput;
31
- if (noRender) {
32
- return null;
33
- }
34
- if (fullComponent)
35
- return React.cloneElement(fullComponent, { key: i });
36
- var newProps = __assign({}, propsComponent);
37
- if (onChange && component && !component.props.onChange) {
38
- newProps = __assign(__assign({}, newProps), { onChange: onChange });
39
- }
40
- if (onChange && form && component.props.name && !component.props.value) {
41
- newProps = __assign(__assign({}, newProps), { value: form[component.props.name] && form[component.props.name].length > 0 ? String(form[component.props.name]) : '' });
42
- }
43
- if (formType === 'label')
44
- newProps = __assign(__assign({}, newProps), { label: '' });
45
- var detectLabel = label || component.props.label;
46
- gridLabel = __assign(__assign({}, sabitGrid.label), gridLabel);
47
- gridInput = __assign(__assign({}, sabitGrid.input), gridInput);
48
- return (_jsxs(Row, __assign({ justifyContent: justifyContent, rowSpacing: rowSpacing, colSpacing: colSpacing }, propsRow, { children: [formType === 'label' && detectLabel && (_jsx(Col, __assign({}, gridLabel, { children: _jsx(Label, __assign({ required: component.props.required }, propsLabel, { children: detectLabel })) }))), _jsx(Col, __assign({}, gridInput, { children: React.cloneElement(component, newProps) }))] }), i));
49
- });
50
- }, [form, formOgeler, onChange, formType, sabitGrid, justifyContent, rowSpacing, colSpacing]);
51
- return _jsx(React.Fragment, { children: result });
52
- });
@@ -1,9 +0,0 @@
1
- import { __assign, __rest } from "tslib";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { memo } from 'react';
4
- import { Tooltip } from '../tooltip';
5
- import styles from './styles/Label.module.css';
6
- export var Label = memo(function FMemo(_a) {
7
- var _b = _a.required, required = _b === void 0 ? false : _b, children = _a.children, other = __rest(_a, ["required", "children"]);
8
- return (_jsxs("label", __assign({ className: styles.label }, other, { children: [children, _jsx(Tooltip, { title: 'Zorunlu Alan', children: _jsx("span", { className: styles.required, children: required && '*' }) })] })));
9
- });