@sydsoft/base 1.4.0 → 1.5.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.
- package/README.md +9 -0
- package/dist/esm/_lib/baseFunctions.d.ts +5 -0
- package/dist/esm/_lib/baseFunctions.js +38 -0
- package/dist/esm/_lib/inputMask.d.ts +7 -0
- package/dist/esm/_lib/inputMask.js +228 -0
- package/dist/esm/box/Box.d.ts +9 -0
- package/dist/esm/box/Box.js +15 -0
- package/dist/esm/box/Box.module.css +152 -0
- package/dist/esm/box/BoxContent.d.ts +9 -0
- package/dist/esm/box/BoxContent.js +7 -0
- package/dist/esm/box/BoxFooter.d.ts +10 -0
- package/dist/esm/box/BoxFooter.js +8 -0
- package/dist/esm/box/BoxHeader.d.ts +16 -0
- package/dist/esm/box/BoxHeader.js +9 -0
- package/dist/esm/box/index.d.ts +9 -0
- package/dist/esm/box/index.js +9 -0
- package/dist/esm/form/Button.d.ts +27 -0
- package/dist/esm/form/Button.js +76 -0
- package/dist/esm/form/Checkbox.d.ts +23 -0
- package/dist/esm/form/Checkbox.js +23 -0
- package/dist/esm/form/Dialog.d.ts +19 -0
- package/dist/esm/form/Dialog.js +40 -0
- package/dist/esm/form/Form.d.ts +10 -0
- package/dist/esm/form/Form.js +12 -0
- package/dist/esm/form/FormOlustur.d.ts +39 -0
- package/dist/esm/form/FormOlustur.js +51 -0
- package/dist/esm/form/Input.d.ts +62 -0
- package/dist/esm/form/Input.js +207 -0
- package/dist/esm/form/Label.d.ts +7 -0
- package/dist/esm/form/Label.js +12 -0
- package/dist/esm/form/SearchableInput.d.ts +35 -0
- package/dist/esm/form/SearchableInput.js +313 -0
- package/dist/esm/form/UploadBase.d.ts +25 -0
- package/dist/esm/form/UploadBase.js +86 -0
- package/dist/esm/form/index.d.ts +9 -0
- package/dist/esm/form/index.js +9 -0
- package/dist/esm/form/styles/Button.module.css +144 -0
- package/dist/esm/form/styles/Input.module.css +220 -0
- package/dist/esm/form/styles/Label.module.css +31 -0
- package/dist/esm/form/styles/SearchableInput.module.css +79 -0
- package/dist/esm/grid/index.d.ts +37 -0
- package/dist/esm/grid/index.js +63 -0
- package/dist/esm/grid/index.module.css +805 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/modal/index.d.ts +23 -0
- package/dist/esm/modal/index.js +66 -0
- package/dist/esm/modal/index.module.css +74 -0
- package/dist/esm/popover/index.d.ts +12 -0
- package/dist/esm/popover/index.js +142 -0
- package/dist/esm/tooltip/index.d.ts +11 -0
- package/dist/esm/tooltip/index.js +119 -0
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const isDev: boolean;
|
|
3
|
+
export declare function tumuBuyukCevir(e: React.ChangeEvent<HTMLInputElement>): void;
|
|
4
|
+
export declare function tumuKucukCevir(e: React.ChangeEvent<HTMLInputElement>): void;
|
|
5
|
+
export declare function seoCevirFunction(e: React.ChangeEvent<HTMLInputElement>): void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export var isDev = !process.env.NODE_ENV || process.env.NODE_ENV === "development";
|
|
2
|
+
export function tumuBuyukCevir(e) {
|
|
3
|
+
var _a;
|
|
4
|
+
if ((e === null || e === void 0 ? void 0 : e.target) && ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.setSelectionRange)) {
|
|
5
|
+
var start = e.target.selectionStart;
|
|
6
|
+
var end = e.target.selectionEnd;
|
|
7
|
+
e.target.value = e.target.value.toString().toLocaleUpperCase("tr");
|
|
8
|
+
e.target.setSelectionRange(start, end);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export function tumuKucukCevir(e) {
|
|
12
|
+
var _a;
|
|
13
|
+
if ((e === null || e === void 0 ? void 0 : e.target) && ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.setSelectionRange)) {
|
|
14
|
+
var start = e.target.selectionStart;
|
|
15
|
+
var end = e.target.selectionEnd;
|
|
16
|
+
e.target.value = e.target.value.toString().toLocaleLowerCase("tr");
|
|
17
|
+
e.target.setSelectionRange(start, end);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function seoCevirFunction(e) {
|
|
21
|
+
var _a;
|
|
22
|
+
if ((e === null || e === void 0 ? void 0 : e.target) && ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.setSelectionRange)) {
|
|
23
|
+
var start = e.target.selectionStart;
|
|
24
|
+
var end = e.target.selectionEnd;
|
|
25
|
+
var string = e.target.value.toString().toLocaleLowerCase("tr");
|
|
26
|
+
var turkce = [" ", "-", "ş", "Ş", "ı", "ü", "Ü", "ö", "Ö", "ç", "Ç", "ş", "Ş", "ı", "ğ", "Ğ", "İ", "ö", "Ö", "Ç", "ç", "ü", "Ü", "â", "ê", "Â", "“", "”"];
|
|
27
|
+
var duzgun = ["-", "-", "s", "S", "i", "u", "U", "o", "O", "c", "C", "s", "S", "i", "g", "G", "I", "o", "O", "C", "c", "u", "U", "a", "ê", "a", "", ""];
|
|
28
|
+
for (var i = 0; i < turkce.length; i++) {
|
|
29
|
+
string = string.split(turkce[i]).join(duzgun[i]);
|
|
30
|
+
}
|
|
31
|
+
string = string.replace(/[^a-z0-9\-_şıüğçİŞĞÜÇ]+/gi, "_");
|
|
32
|
+
string = string.replace(/_+/g, "_");
|
|
33
|
+
string = string.replace(/^-/, "_");
|
|
34
|
+
string = string.replace(/-$/, "_");
|
|
35
|
+
e.target.value = string;
|
|
36
|
+
e.target.setSelectionRange(start, end);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { isDev } from "./baseFunctions";
|
|
2
|
+
// Mask işleme core fonksiyonları
|
|
3
|
+
var createMaskCore = function () {
|
|
4
|
+
var defaultTranslation = {
|
|
5
|
+
"0": { pattern: /\d/ },
|
|
6
|
+
"9": { pattern: /\d/, optional: true },
|
|
7
|
+
"#": { pattern: /\d/, recursive: true },
|
|
8
|
+
A: { pattern: /[a-zA-Z0-9]/ },
|
|
9
|
+
S: { pattern: /[a-zA-Z]/ },
|
|
10
|
+
U: { pattern: /[a-zA-Z]/, transform: function (char) { return char.toUpperCase(); } },
|
|
11
|
+
L: { pattern: /[a-zA-Z]/, transform: function (char) { return char.toLowerCase(); } },
|
|
12
|
+
X: { pattern: /[0-9a-fA-F]/ }
|
|
13
|
+
};
|
|
14
|
+
var parseMask = function (maskString, translation) {
|
|
15
|
+
if (translation === void 0) { translation = defaultTranslation; }
|
|
16
|
+
var tokens = [];
|
|
17
|
+
var i = 0;
|
|
18
|
+
while (i < maskString.length) {
|
|
19
|
+
var char = maskString[i];
|
|
20
|
+
if (translation[char]) {
|
|
21
|
+
tokens.push({
|
|
22
|
+
type: "input",
|
|
23
|
+
pattern: translation[char].pattern,
|
|
24
|
+
optional: translation[char].optional,
|
|
25
|
+
recursive: translation[char].recursive,
|
|
26
|
+
transform: translation[char].transform
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
tokens.push({
|
|
31
|
+
type: "literal",
|
|
32
|
+
char: char
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
i++;
|
|
36
|
+
}
|
|
37
|
+
return tokens;
|
|
38
|
+
};
|
|
39
|
+
var applyMask = function (inputValue, maskTokens, reverse) {
|
|
40
|
+
if (reverse === void 0) { reverse = false; }
|
|
41
|
+
if (!maskTokens.length)
|
|
42
|
+
return inputValue;
|
|
43
|
+
var cleanValue = inputValue.replace(/[^\w\s]/g, "");
|
|
44
|
+
if (reverse) {
|
|
45
|
+
return applyReverseMask(cleanValue, maskTokens);
|
|
46
|
+
}
|
|
47
|
+
var result = "";
|
|
48
|
+
var valueIndex = 0;
|
|
49
|
+
var maskIndex = 0;
|
|
50
|
+
while (maskIndex < maskTokens.length && valueIndex < cleanValue.length) {
|
|
51
|
+
var token = maskTokens[maskIndex];
|
|
52
|
+
if (token.type === "literal") {
|
|
53
|
+
result += token.char;
|
|
54
|
+
maskIndex++;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
var char = cleanValue[valueIndex];
|
|
58
|
+
if (token.pattern.test(char)) {
|
|
59
|
+
var transformedChar = token.transform ? token.transform(char) : char;
|
|
60
|
+
result += transformedChar;
|
|
61
|
+
valueIndex++;
|
|
62
|
+
maskIndex++;
|
|
63
|
+
}
|
|
64
|
+
else if (token.optional) {
|
|
65
|
+
maskIndex++;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
valueIndex++;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
while (maskIndex < maskTokens.length) {
|
|
73
|
+
var token = maskTokens[maskIndex];
|
|
74
|
+
if (token.type === "literal") {
|
|
75
|
+
result += token.char;
|
|
76
|
+
}
|
|
77
|
+
else if (!token.optional) {
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
maskIndex++;
|
|
81
|
+
}
|
|
82
|
+
return result;
|
|
83
|
+
};
|
|
84
|
+
var applyReverseMask = function (inputValue, maskTokens) {
|
|
85
|
+
var reversedMask = maskTokens.slice().reverse();
|
|
86
|
+
var reversedValue = inputValue.split("").reverse().join("");
|
|
87
|
+
var result = "";
|
|
88
|
+
var valueIndex = 0;
|
|
89
|
+
var maskIndex = 0;
|
|
90
|
+
while (maskIndex < reversedMask.length && valueIndex < reversedValue.length) {
|
|
91
|
+
var token = reversedMask[maskIndex];
|
|
92
|
+
if (token.type === "literal") {
|
|
93
|
+
result = token.char + result;
|
|
94
|
+
maskIndex++;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
var char = reversedValue[valueIndex];
|
|
98
|
+
if (token.pattern.test(char)) {
|
|
99
|
+
var transformedChar = token.transform ? token.transform(char) : char;
|
|
100
|
+
result = transformedChar + result;
|
|
101
|
+
valueIndex++;
|
|
102
|
+
maskIndex++;
|
|
103
|
+
}
|
|
104
|
+
else if (token.optional) {
|
|
105
|
+
maskIndex++;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
valueIndex++;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return result;
|
|
113
|
+
};
|
|
114
|
+
var getCleanValue = function (maskedValue, maskTokens) {
|
|
115
|
+
if (!maskTokens.length)
|
|
116
|
+
return maskedValue;
|
|
117
|
+
var clean = "";
|
|
118
|
+
var valueIndex = 0;
|
|
119
|
+
var maskIndex = 0;
|
|
120
|
+
while (maskIndex < maskTokens.length && valueIndex < maskedValue.length) {
|
|
121
|
+
var token = maskTokens[maskIndex];
|
|
122
|
+
if (token.type === "literal") {
|
|
123
|
+
if (maskedValue[valueIndex] === token.char) {
|
|
124
|
+
valueIndex++;
|
|
125
|
+
}
|
|
126
|
+
maskIndex++;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
clean += maskedValue[valueIndex];
|
|
130
|
+
valueIndex++;
|
|
131
|
+
maskIndex++;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return clean;
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
parseMask: parseMask,
|
|
138
|
+
applyMask: applyMask,
|
|
139
|
+
getCleanValue: getCleanValue
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
// Fonksiyonel yaklaşım - herhangi bir input elementine mask uygula
|
|
143
|
+
export var applyInputMask = function (inputElement, mask, options) {
|
|
144
|
+
if (options === void 0) { options = {}; }
|
|
145
|
+
if (!inputElement || !mask)
|
|
146
|
+
return null;
|
|
147
|
+
isDev && console.log("Input mask applied:", { inputElement: inputElement, mask: mask, options: options });
|
|
148
|
+
var translation = options.translation, _a = options.reverse, reverse = _a === void 0 ? false : _a, _b = options.clearIfNotMatch, clearIfNotMatch = _b === void 0 ? true : _b, _c = options.selectOnFocus, selectOnFocus = _c === void 0 ? false : _c, onChange = options.onChange;
|
|
149
|
+
var maskCore = createMaskCore();
|
|
150
|
+
var maskTokens = maskCore.parseMask(mask, translation);
|
|
151
|
+
var applyMaskToValue = function (inputValue) { return maskCore.applyMask(inputValue, maskTokens, reverse); };
|
|
152
|
+
var getCleanValue = function (maskedValue) { return maskCore.getCleanValue(maskedValue, maskTokens); };
|
|
153
|
+
var handleInputChange = function (e) {
|
|
154
|
+
var inputValue = e.target.value;
|
|
155
|
+
var maskedValue = applyMaskToValue(inputValue);
|
|
156
|
+
var cleanValue = getCleanValue(maskedValue);
|
|
157
|
+
e.target.value = maskedValue;
|
|
158
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(maskedValue, cleanValue, e);
|
|
159
|
+
};
|
|
160
|
+
var handleKeyDown = function (e) {
|
|
161
|
+
var key = e.key, target = e.target;
|
|
162
|
+
var cursorStart = target.selectionStart;
|
|
163
|
+
var cursorEnd = target.selectionEnd;
|
|
164
|
+
if (key === "Backspace" || key === "Delete") {
|
|
165
|
+
e.preventDefault();
|
|
166
|
+
var newValue = target.value;
|
|
167
|
+
if (cursorStart !== cursorEnd) {
|
|
168
|
+
newValue = newValue.substring(0, cursorStart) + newValue.substring(cursorEnd);
|
|
169
|
+
}
|
|
170
|
+
else if (key === "Backspace" && cursorStart > 0) {
|
|
171
|
+
newValue = newValue.substring(0, cursorStart - 1) + newValue.substring(cursorStart);
|
|
172
|
+
}
|
|
173
|
+
else if (key === "Delete" && cursorStart < newValue.length) {
|
|
174
|
+
newValue = newValue.substring(0, cursorStart) + newValue.substring(cursorStart + 1);
|
|
175
|
+
}
|
|
176
|
+
var maskedValue = applyMaskToValue(newValue);
|
|
177
|
+
target.value = maskedValue;
|
|
178
|
+
var cleanValue = getCleanValue(maskedValue);
|
|
179
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(maskedValue, cleanValue, e);
|
|
180
|
+
setTimeout(function () {
|
|
181
|
+
var newPos = key === "Backspace" ? Math.max(0, cursorStart - 1) : cursorStart;
|
|
182
|
+
target.setSelectionRange(newPos, newPos);
|
|
183
|
+
}, 0);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
var handleFocus = function (e) {
|
|
187
|
+
if (selectOnFocus) {
|
|
188
|
+
setTimeout(function () {
|
|
189
|
+
e.target.select();
|
|
190
|
+
}, 0);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
var handleBlur = function (e) {
|
|
194
|
+
if (clearIfNotMatch) {
|
|
195
|
+
var cleanValue = getCleanValue(e.target.value);
|
|
196
|
+
var expectedLength = maskTokens.filter(function (t) { return t.type === "input" && !t.optional; }).length;
|
|
197
|
+
if (cleanValue.length < expectedLength) {
|
|
198
|
+
e.target.value = "";
|
|
199
|
+
onChange === null || onChange === void 0 ? void 0 : onChange("", "", e);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
// Event listener'ları ekle
|
|
204
|
+
inputElement.addEventListener("input", handleInputChange);
|
|
205
|
+
inputElement.addEventListener("keydown", handleKeyDown);
|
|
206
|
+
inputElement.addEventListener("focus", handleFocus);
|
|
207
|
+
inputElement.addEventListener("blur", handleBlur);
|
|
208
|
+
// Cleanup fonksiyonu
|
|
209
|
+
var destroy = function () {
|
|
210
|
+
inputElement.removeEventListener("input", handleInputChange);
|
|
211
|
+
inputElement.removeEventListener("keydown", handleKeyDown);
|
|
212
|
+
inputElement.removeEventListener("focus", handleFocus);
|
|
213
|
+
inputElement.removeEventListener("blur", handleBlur);
|
|
214
|
+
};
|
|
215
|
+
// Utility fonksiyonları
|
|
216
|
+
return {
|
|
217
|
+
destroy: destroy,
|
|
218
|
+
setValue: function (value) {
|
|
219
|
+
if (!value)
|
|
220
|
+
return;
|
|
221
|
+
var maskedValue = applyMaskToValue(value || "");
|
|
222
|
+
inputElement.value = maskedValue;
|
|
223
|
+
},
|
|
224
|
+
getValue: function () { return inputElement.value; },
|
|
225
|
+
getCleanValue: function () { return getCleanValue(inputElement.value); },
|
|
226
|
+
applyMask: applyMaskToValue
|
|
227
|
+
};
|
|
228
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
.sbox {
|
|
2
|
+
position: relative;
|
|
3
|
+
max-width: 100%;
|
|
4
|
+
background-color: #fff;
|
|
5
|
+
box-shadow: 0 2px 4px rgb(0 0 0 / 10%), 0 8px 16px rgb(0 0 0 / 10%);
|
|
6
|
+
border-radius: 8px;
|
|
7
|
+
overflow-y: auto;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.sbox h1,
|
|
11
|
+
.sbox h2,
|
|
12
|
+
.sbox h3,
|
|
13
|
+
.sbox h4,
|
|
14
|
+
.sbox h5,
|
|
15
|
+
.sbox h6 {
|
|
16
|
+
margin: 0;
|
|
17
|
+
padding: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.content {
|
|
21
|
+
padding: 20px;
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.header,
|
|
26
|
+
.footer {
|
|
27
|
+
z-index: 1;
|
|
28
|
+
position: sticky;
|
|
29
|
+
padding: 12px 16px;
|
|
30
|
+
background: inherit;
|
|
31
|
+
}
|
|
32
|
+
.header {
|
|
33
|
+
top: 0;
|
|
34
|
+
border-bottom: 1px solid #00000020;
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: row;
|
|
37
|
+
justify-content: flex-start;
|
|
38
|
+
align-items: center;
|
|
39
|
+
gap: 10px;
|
|
40
|
+
/* margin: 10px 0 5px 0; */
|
|
41
|
+
}
|
|
42
|
+
.footer {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: row;
|
|
45
|
+
flex-wrap: wrap;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: flex-end;
|
|
48
|
+
gap: 10px;
|
|
49
|
+
bottom: 0;
|
|
50
|
+
border-top: 1px solid #00000020;
|
|
51
|
+
background-color: #f7f7f7;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.icon {
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
flex: 0 0 auto;
|
|
58
|
+
text-align: center;
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.title {
|
|
63
|
+
flex: 1;
|
|
64
|
+
font-size: 1.1rem;
|
|
65
|
+
font-weight: 500;
|
|
66
|
+
line-height: 1.5;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.menu {
|
|
70
|
+
display: inline-flex;
|
|
71
|
+
flex: 0 0 auto;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
}
|
|
75
|
+
.menu > * {
|
|
76
|
+
margin: 0 3px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.loading {
|
|
80
|
+
position: absolute;
|
|
81
|
+
top: 0;
|
|
82
|
+
left: 0;
|
|
83
|
+
width: 100%;
|
|
84
|
+
height: 100%;
|
|
85
|
+
background-color: #f4f7faa6;
|
|
86
|
+
overflow: hidden;
|
|
87
|
+
border-radius: inherit;
|
|
88
|
+
display: flex;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
align-items: center;
|
|
91
|
+
z-index: 9999;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.loading::after {
|
|
95
|
+
position: absolute;
|
|
96
|
+
top: 0;
|
|
97
|
+
right: 0;
|
|
98
|
+
bottom: 0;
|
|
99
|
+
left: 0;
|
|
100
|
+
transform: translateX(-100%);
|
|
101
|
+
background: linear-gradient(90deg, rgb(183 190 199 / 2%) 0, rgb(182 190 198 / 19%) 20%, rgb(183 190 199 / 2%) 60%, rgb(184 192 200 / 1%));
|
|
102
|
+
animation: shimmer 2s infinite;
|
|
103
|
+
content: "";
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.loading_spinner {
|
|
107
|
+
position: relative;
|
|
108
|
+
margin: 6px;
|
|
109
|
+
width: 24px;
|
|
110
|
+
height: 24px;
|
|
111
|
+
}
|
|
112
|
+
.loading_spinner:before {
|
|
113
|
+
position: absolute;
|
|
114
|
+
display: block;
|
|
115
|
+
content: "";
|
|
116
|
+
z-index: 12;
|
|
117
|
+
top: 3px;
|
|
118
|
+
left: 3px;
|
|
119
|
+
width: 30px;
|
|
120
|
+
height: 30px;
|
|
121
|
+
border-radius: 50%;
|
|
122
|
+
background-color: #fff;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.loading_spinner:after {
|
|
126
|
+
position: absolute;
|
|
127
|
+
display: block;
|
|
128
|
+
content: "";
|
|
129
|
+
z-index: 11;
|
|
130
|
+
width: 18px;
|
|
131
|
+
height: 18px;
|
|
132
|
+
border-radius: 200px 0 0;
|
|
133
|
+
background: linear-gradient(45deg, rgba(0, 0, 0, 0) 0, rgba(69, 154, 215, 1) 50%, rgba(69, 154, 215, 1) 100%);
|
|
134
|
+
animation: loading_spinner 0.5s linear infinite;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@keyframes shimmer {
|
|
138
|
+
100% {
|
|
139
|
+
transform: translateX(100%);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
@keyframes loading_spinner {
|
|
143
|
+
0% {
|
|
144
|
+
transform-origin: 100% 100%;
|
|
145
|
+
transform: rotate(0deg);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
100% {
|
|
149
|
+
transform-origin: 100% 100%;
|
|
150
|
+
transform: rotate(360deg);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
interface Props {
|
|
3
|
+
className?: string;
|
|
4
|
+
style?: React.CSSProperties;
|
|
5
|
+
padding?: number;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const BoxContent: ({ className, style, padding, children }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface Props {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
marginTop?: number;
|
|
7
|
+
align?: "flex-start" | "center" | "flex-end" | "stretch";
|
|
8
|
+
}
|
|
9
|
+
export declare const BoxFooter: React.NamedExoticComponent<Props>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
interface Props {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
title?: string | ReactNode;
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
menu?: ReactNode;
|
|
8
|
+
mainStyle?: React.CSSProperties;
|
|
9
|
+
iconStyle?: React.CSSProperties;
|
|
10
|
+
titleStyle?: React.CSSProperties;
|
|
11
|
+
menuStyle?: React.CSSProperties;
|
|
12
|
+
component?: any;
|
|
13
|
+
marginBottom?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare const BoxHeader: React.NamedExoticComponent<Props>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
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(Comp, { 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("div", { className: styles.title, style: titleStyle, children: children || title }), menu && (_jsx("div", { className: styles.menu, style: menuStyle, children: menu }))] }));
|
|
9
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { propsDialog } from "./Dialog";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { typeTooltipPosition } from "../tooltip";
|
|
4
|
+
interface Props {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
onlyIcon?: React.ReactNode;
|
|
7
|
+
buttonClass?: "default" | "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "light" | "dark" | "link";
|
|
8
|
+
buttonSize?: "small" | "medium" | "large";
|
|
9
|
+
autoFocus?: boolean;
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
component?: "button" | "a" | "div" | any;
|
|
12
|
+
className?: string;
|
|
13
|
+
type?: "submit" | "reset" | "button";
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
fullWidth?: boolean;
|
|
16
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
17
|
+
href?: string | undefined;
|
|
18
|
+
target?: string | undefined;
|
|
19
|
+
style?: React.CSSProperties;
|
|
20
|
+
tabIndex?: number;
|
|
21
|
+
title?: string;
|
|
22
|
+
titlePosition?: typeTooltipPosition;
|
|
23
|
+
titleArrow?: boolean;
|
|
24
|
+
dialog?: propsDialog;
|
|
25
|
+
}
|
|
26
|
+
export declare const Button: React.NamedExoticComponent<Props>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
});
|