ar-design 0.2.67 → 0.2.69
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/dist/assets/css/components/feedback/popup/popup.css +10 -34
- package/dist/assets/css/components/form/upload/styles.css +62 -0
- package/dist/components/feedback/popup/index.js +32 -2
- package/dist/components/form/text-editor/index.js +3 -3
- package/dist/components/form/upload/Props.d.ts +2 -2
- package/dist/components/form/upload/index.js +81 -45
- package/dist/components/icons/Compiler.js +14 -0
- package/dist/components/icons/index.js +1 -1
- package/dist/libs/core/application/hooks/index.d.ts +2 -3
- package/dist/libs/core/application/hooks/index.js +1 -1
- package/dist/libs/core/service/Api.d.ts +4 -1
- package/dist/libs/core/service/Api.js +4 -2
- package/dist/libs/core/service/index.js +2 -2
- package/dist/libs/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -50,15 +50,15 @@
|
|
|
50
50
|
border-radius: var(--border-radius-pill);
|
|
51
51
|
box-shadow: 0 0 0 5px rgba(var(--success-rgb), 0.25);
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
border-
|
|
61
|
-
|
|
53
|
+
|
|
54
|
+
.ar-notification-popup > .icon.warning {
|
|
55
|
+
position: relative;
|
|
56
|
+
display: flex;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
align-items: center;
|
|
59
|
+
background-color: var(--warning);
|
|
60
|
+
border-radius: var(--border-radius-pill);
|
|
61
|
+
box-shadow: 0 0 0 5px rgba(var(--warning-rgb), 0.25);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
.ar-notification-popup > .icon.error {
|
|
@@ -70,24 +70,6 @@
|
|
|
70
70
|
border-radius: var(--border-radius-pill);
|
|
71
71
|
box-shadow: 0 0 0 5px rgba(var(--danger-rgb), 0.25);
|
|
72
72
|
}
|
|
73
|
-
.ar-notification-popup > .icon.error::before {
|
|
74
|
-
position: absolute;
|
|
75
|
-
content: "";
|
|
76
|
-
background-color: var(--white);
|
|
77
|
-
width: 10.5px;
|
|
78
|
-
height: 3.5rem;
|
|
79
|
-
transform: rotate(-45deg);
|
|
80
|
-
border-radius: var(--border-radius-sm);
|
|
81
|
-
}
|
|
82
|
-
.ar-notification-popup > .icon.error::after {
|
|
83
|
-
position: absolute;
|
|
84
|
-
content: "";
|
|
85
|
-
background-color: var(--white);
|
|
86
|
-
width: 10.5px;
|
|
87
|
-
height: 3.5rem;
|
|
88
|
-
transform: rotate(45deg);
|
|
89
|
-
border-radius: var(--border-radius-sm);
|
|
90
|
-
}
|
|
91
73
|
|
|
92
74
|
.ar-notification-popup > .content {
|
|
93
75
|
display: flex;
|
|
@@ -99,17 +81,11 @@
|
|
|
99
81
|
color: var(--gray-700);
|
|
100
82
|
}
|
|
101
83
|
.ar-notification-popup > .content > .title {
|
|
84
|
+
color: var(--gray-700);
|
|
102
85
|
font-size: 1.75rem;
|
|
103
86
|
text-align: center;
|
|
104
87
|
}
|
|
105
88
|
|
|
106
|
-
.ar-notification-popup > .content > .title.success {
|
|
107
|
-
color: var(--success);
|
|
108
|
-
}
|
|
109
|
-
.ar-notification-popup > .content > .title.error {
|
|
110
|
-
color: var(--danger);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
89
|
.ar-notification-popup > .content > .message {
|
|
114
90
|
color: var(--gray-600);
|
|
115
91
|
text-align: center;
|
|
@@ -17,6 +17,38 @@
|
|
|
17
17
|
font-size: 0.15rem;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
.ar-upload-button > .button {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
align-items: center;
|
|
25
|
+
gap: 1rem;
|
|
26
|
+
padding: 1rem 0;
|
|
27
|
+
border: dashed 1px var(--gray-300);
|
|
28
|
+
border-radius: var(--border-radius-sm);
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
user-select: none;
|
|
31
|
+
}
|
|
32
|
+
.ar-upload-button > .button > .information {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
align-items: center;
|
|
37
|
+
gap: 0.5rem;
|
|
38
|
+
}
|
|
39
|
+
.ar-upload-button > .button > .information > .properies {
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: row;
|
|
42
|
+
gap: 0.5rem;
|
|
43
|
+
font-size: 0.85rem;
|
|
44
|
+
}
|
|
45
|
+
.ar-upload-button > .button > .information > .properies > .max-size {
|
|
46
|
+
color: var(--gray-500);
|
|
47
|
+
}
|
|
48
|
+
.ar-upload-button > .button > .information > .properies > .allow-types {
|
|
49
|
+
color: var(--gray-500);
|
|
50
|
+
}
|
|
51
|
+
|
|
20
52
|
.ar-upload-button > .ar-upload-files {
|
|
21
53
|
width: 100%;
|
|
22
54
|
transition: top 250ms ease-in-out;
|
|
@@ -69,4 +101,34 @@
|
|
|
69
101
|
cursor: pointer;
|
|
70
102
|
}
|
|
71
103
|
|
|
104
|
+
.ar-upload-button > .ar-upload-files > .file {
|
|
105
|
+
display: flex;
|
|
106
|
+
flex-direction: row;
|
|
107
|
+
justify-content: space-between;
|
|
108
|
+
align-items: center;
|
|
109
|
+
background-color: var(--gray-200);
|
|
110
|
+
margin-top: 0.5rem;
|
|
111
|
+
padding: 0.5rem;
|
|
112
|
+
border-radius: var(--border-radius-sm);
|
|
113
|
+
}
|
|
114
|
+
.ar-upload-button > .ar-upload-files > .file > .information {
|
|
115
|
+
display: flex;
|
|
116
|
+
flex-direction: row;
|
|
117
|
+
gap: 0.5rem;
|
|
118
|
+
}
|
|
119
|
+
.ar-upload-button > .ar-upload-files > .file > .information > span {
|
|
120
|
+
display: inline-block;
|
|
121
|
+
}
|
|
122
|
+
.ar-upload-button > .ar-upload-files > .file > .information > span:last-child {
|
|
123
|
+
background-color: var(--primary);
|
|
124
|
+
padding: 0 0.25rem;
|
|
125
|
+
border-radius: var(--border-radius-sm);
|
|
126
|
+
color: var(--white);
|
|
127
|
+
font-size: 0.75rem;
|
|
128
|
+
line-height: 2;
|
|
129
|
+
}
|
|
130
|
+
.ar-upload-button > .ar-upload-files > .file > .delete {
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
}
|
|
133
|
+
|
|
72
134
|
@import url("./animations.css");
|
|
@@ -4,6 +4,7 @@ import "../../../assets/css/components/feedback/popup/popup.css";
|
|
|
4
4
|
import Button from "../../form/button";
|
|
5
5
|
import ReactDOM from "react-dom";
|
|
6
6
|
import { NotificationContext } from "../../../libs/core/application/contexts/Notification";
|
|
7
|
+
import { ARIcon } from "../../icons";
|
|
7
8
|
const Popup = ({ title, message, status, isOpen, buttons }) => {
|
|
8
9
|
// contexts
|
|
9
10
|
const { setIsPopupOpen } = useContext(NotificationContext);
|
|
@@ -13,6 +14,35 @@ const Popup = ({ title, message, status, isOpen, buttons }) => {
|
|
|
13
14
|
// states
|
|
14
15
|
const _notificaitonPopupWrapperClassName = ["ar-notification-popup-wrapper"];
|
|
15
16
|
const [className, setClassName] = useState(["ar-notification-popup", ""]);
|
|
17
|
+
// methods
|
|
18
|
+
const buttonStatus = () => {
|
|
19
|
+
switch (status) {
|
|
20
|
+
case "success":
|
|
21
|
+
return "success";
|
|
22
|
+
case "warning":
|
|
23
|
+
return "warning";
|
|
24
|
+
case "information":
|
|
25
|
+
return "information";
|
|
26
|
+
case "error":
|
|
27
|
+
return "danger";
|
|
28
|
+
default:
|
|
29
|
+
return "light";
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const buttonIcons = () => {
|
|
33
|
+
switch (status) {
|
|
34
|
+
case "success":
|
|
35
|
+
return React.createElement(ARIcon, { icon: "Success", fill: "transparent", stroke: "var(--white)", size: 48 });
|
|
36
|
+
case "warning":
|
|
37
|
+
return React.createElement(ARIcon, { icon: "Warning", fill: "transparent", stroke: "var(--white)", size: 48 });
|
|
38
|
+
case "information":
|
|
39
|
+
return "information";
|
|
40
|
+
case "error":
|
|
41
|
+
return React.createElement(ARIcon, { icon: "CloseCircle", fill: "transparent", stroke: "var(--white)", size: 48 });
|
|
42
|
+
default:
|
|
43
|
+
return "light";
|
|
44
|
+
}
|
|
45
|
+
};
|
|
16
46
|
// useEffects
|
|
17
47
|
useEffect(() => {
|
|
18
48
|
setClassName((prev) => {
|
|
@@ -38,13 +68,13 @@ const Popup = ({ title, message, status, isOpen, buttons }) => {
|
|
|
38
68
|
}
|
|
39
69
|
} }),
|
|
40
70
|
React.createElement("div", { ref: _arNotificationPopup, className: className.map((c) => c).join(" ") },
|
|
41
|
-
React.createElement("div", { className: `icon ${status}` }),
|
|
71
|
+
React.createElement("div", { className: `icon ${status}` }, buttonIcons()),
|
|
42
72
|
React.createElement("div", { className: "content" },
|
|
43
73
|
React.createElement("span", { className: `title ${status}` },
|
|
44
74
|
title,
|
|
45
75
|
"!"),
|
|
46
76
|
React.createElement("span", { className: "message" }, message)),
|
|
47
|
-
React.createElement(Button, { variant: "filled", status:
|
|
77
|
+
React.createElement(Button, { variant: "filled", status: buttonStatus(), onClick: () => {
|
|
48
78
|
(() => buttons?.okay?.onClick && buttons.okay?.onClick())();
|
|
49
79
|
(() => {
|
|
50
80
|
setIsPopupOpen && setIsPopupOpen((prev) => !prev);
|
|
@@ -29,8 +29,8 @@ validation, }) => {
|
|
|
29
29
|
// variables
|
|
30
30
|
const toolbarButtons = [
|
|
31
31
|
{ command: "bold", icon: "Bold", tooltip: `Bold (${Utils.GetOSShortCutIcons()} + B)` },
|
|
32
|
-
{ command: "italic", icon: "Italic", tooltip: `
|
|
33
|
-
{ command: "underline", icon: "Underline", tooltip: `
|
|
32
|
+
{ command: "italic", icon: "Italic", tooltip: `Italic (${Utils.GetOSShortCutIcons()} + I)` },
|
|
33
|
+
{ command: "underline", icon: "Underline", tooltip: `Underline (${Utils.GetOSShortCutIcons()} + U)` },
|
|
34
34
|
{ command: "insertUnorderedList", icon: "BulletList", tooltip: "Bulleted List" },
|
|
35
35
|
{ command: "insertOrderedList", icon: "NumberList", tooltip: "Numbered List" },
|
|
36
36
|
{ command: "justifyLeft", icon: "TextAlingLeft", tooltip: "Align Left" },
|
|
@@ -212,7 +212,7 @@ validation, }) => {
|
|
|
212
212
|
}, []);
|
|
213
213
|
return (React.createElement("div", { ref: _container, className: "ar-text-editor" },
|
|
214
214
|
React.createElement("iframe", { ref: _arIframe, name: name, className: _iframeClassName.map((c) => c).join(" "), height: height }),
|
|
215
|
-
React.createElement("div", { className: "toolbar" }, toolbarButtons.map(({ command, icon, tooltip }) => (React.createElement(Button, { key: command, type: "button", variant: "borderless", status: "secondary", border: { radius: "none" }, icon: { element: React.createElement(ARIcon, { icon: icon, size: 18, fill: "
|
|
215
|
+
React.createElement("div", { className: "toolbar" }, toolbarButtons.map(({ command, icon, tooltip }) => (React.createElement(Button, { key: command, type: "button", variant: "borderless", status: "secondary", border: { radius: "none" }, icon: { element: React.createElement(ARIcon, { icon: icon, size: 18, fill: "transparent" }) }, tooltip: {
|
|
216
216
|
text: tooltip,
|
|
217
217
|
}, onClick: () => execCommand(command) })))),
|
|
218
218
|
React.createElement("div", { className: "resize", onMouseDown: handleMouseDown }),
|
|
@@ -32,7 +32,7 @@ interface IMultiple {
|
|
|
32
32
|
* />
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
|
-
onChange: (formData: FormData, files: File[], isInvalidFileExist: boolean) => void;
|
|
35
|
+
onChange: (formData: FormData, files: File[], base64: string[], isInvalidFileExist: boolean) => void;
|
|
36
36
|
/**
|
|
37
37
|
* Çoklu dosya seçiminin aktif olduğunu belirtir.
|
|
38
38
|
*
|
|
@@ -66,7 +66,7 @@ interface ISingle {
|
|
|
66
66
|
* <Upload onChange={(formData, file) => console.log(file)} />
|
|
67
67
|
* ```
|
|
68
68
|
*/
|
|
69
|
-
onChange: (formData: FormData | undefined, files: File | null) => void;
|
|
69
|
+
onChange: (formData: FormData | undefined, files: File | null, base64: string) => void;
|
|
70
70
|
/**
|
|
71
71
|
* Çoklu dosya seçiminin devre dışı olduğunu belirtir.
|
|
72
72
|
*
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from "react";
|
|
2
2
|
import "../../../assets/css/components/form/upload/styles.css";
|
|
3
|
-
import { ARIcon } from "../../icons";
|
|
4
|
-
import Button from "../button";
|
|
5
3
|
import Tooltip from "../../feedback/tooltip";
|
|
4
|
+
import { ARIcon } from "../../icons";
|
|
6
5
|
const Upload = ({ text, file, onChange, allowedTypes, maxSize, multiple }) => {
|
|
7
6
|
// refs
|
|
8
7
|
const _firstLoad = useRef(false);
|
|
@@ -39,6 +38,9 @@ const Upload = ({ text, file, onChange, allowedTypes, maxSize, multiple }) => {
|
|
|
39
38
|
return newList;
|
|
40
39
|
});
|
|
41
40
|
}
|
|
41
|
+
else {
|
|
42
|
+
setSelectedFile(undefined);
|
|
43
|
+
}
|
|
42
44
|
};
|
|
43
45
|
const handleValidationFile = (file) => {
|
|
44
46
|
const newErrors = [];
|
|
@@ -49,7 +51,7 @@ const Upload = ({ text, file, onChange, allowedTypes, maxSize, multiple }) => {
|
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
if (maxSize) {
|
|
52
|
-
const _maxSize = maxSize * 1024 * 1024; //
|
|
54
|
+
const _maxSize = maxSize * 1024 * 1024; // MB
|
|
53
55
|
if (file.size > _maxSize) {
|
|
54
56
|
newErrors.push({ [file.name]: "Dosya boyutu çok büyük." });
|
|
55
57
|
_validationErrors.current.push(file.name);
|
|
@@ -57,36 +59,55 @@ const Upload = ({ text, file, onChange, allowedTypes, maxSize, multiple }) => {
|
|
|
57
59
|
}
|
|
58
60
|
setValidationErrors((prev) => [...prev, ...newErrors]);
|
|
59
61
|
};
|
|
62
|
+
function handleFileToBase64(file) {
|
|
63
|
+
return new Promise((resolve, reject) => {
|
|
64
|
+
const reader = new FileReader();
|
|
65
|
+
reader.onload = () => {
|
|
66
|
+
if (reader.result && typeof reader.result === "string") {
|
|
67
|
+
resolve(reader.result);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
reject(new Error("Failed to read the file"));
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
reader.onerror = reject;
|
|
74
|
+
reader.readAsDataURL(file);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
60
77
|
// useEffects
|
|
61
78
|
useEffect(() => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
selectedFiles.forEach((f) => dataTransfer.items.add(f));
|
|
73
|
-
_input.current.files = dataTransfer.files;
|
|
74
|
-
// Geçerli olan dosyalar alındı...
|
|
75
|
-
const validFiles = [...selectedFiles.filter((x) => !inValidFiles.includes(x.name))];
|
|
76
|
-
validFiles.forEach((f) => fileFormData.append("file", f));
|
|
77
|
-
onChange(fileFormData, validFiles, _validationErrors.current.length === 0);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
if (selectedFile) {
|
|
81
|
-
handleValidationFile(selectedFile);
|
|
82
|
-
fileFormData.append("file", selectedFile);
|
|
83
|
-
onChange(fileFormData, selectedFile);
|
|
79
|
+
(async () => {
|
|
80
|
+
const dataTransfer = new DataTransfer();
|
|
81
|
+
const fileFormData = new FormData();
|
|
82
|
+
setValidationErrors([]);
|
|
83
|
+
_validationErrors.current = [];
|
|
84
|
+
if (_input.current) {
|
|
85
|
+
if (multiple) {
|
|
86
|
+
// Seçilmiş olan dosyalar validasyona gönderiliyor.
|
|
87
|
+
selectedFiles.forEach((f) => handleValidationFile(f));
|
|
88
|
+
const inValidFiles = Array.from(new Set(_validationErrors.current));
|
|
84
89
|
// Input içerisine dosyalar aktarılıyor.
|
|
85
|
-
dataTransfer.items.add(
|
|
90
|
+
selectedFiles.forEach((f) => dataTransfer.items.add(f));
|
|
86
91
|
_input.current.files = dataTransfer.files;
|
|
92
|
+
// Geçerli olan dosyalar alındı...
|
|
93
|
+
const validFiles = [...selectedFiles.filter((x) => !inValidFiles.includes(x.name))];
|
|
94
|
+
validFiles.forEach((f) => fileFormData.append("file", f));
|
|
95
|
+
// Geçerli olan dosyalar base64'e dönüştürülüyor...
|
|
96
|
+
const base64Array = await Promise.all(validFiles.map((validFile) => handleFileToBase64(validFile)));
|
|
97
|
+
onChange(fileFormData, validFiles, base64Array, _validationErrors.current.length === 0);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
if (selectedFile) {
|
|
101
|
+
handleValidationFile(selectedFile);
|
|
102
|
+
fileFormData.append("file", selectedFile);
|
|
103
|
+
onChange(fileFormData, selectedFile, await handleFileToBase64(selectedFile));
|
|
104
|
+
// Input içerisine dosyalar aktarılıyor.
|
|
105
|
+
dataTransfer.items.add(selectedFile);
|
|
106
|
+
_input.current.files = dataTransfer.files;
|
|
107
|
+
}
|
|
87
108
|
}
|
|
88
109
|
}
|
|
89
|
-
}
|
|
110
|
+
})();
|
|
90
111
|
}, [selectedFiles, selectedFile]);
|
|
91
112
|
useEffect(() => {
|
|
92
113
|
if (_firstLoad.current)
|
|
@@ -97,25 +118,40 @@ const Upload = ({ text, file, onChange, allowedTypes, maxSize, multiple }) => {
|
|
|
97
118
|
return (React.createElement("div", { ref: _arUplaod, className: "ar-upload" },
|
|
98
119
|
React.createElement("input", { ref: _input, type: "file", onChange: (event) => handleFileChange(event.target.files), multiple: multiple }),
|
|
99
120
|
React.createElement("div", { className: "ar-upload-button" },
|
|
100
|
-
React.createElement(
|
|
121
|
+
React.createElement("div", { className: "button", onClick: () => {
|
|
101
122
|
if (_input.current)
|
|
102
123
|
_input.current.click();
|
|
103
|
-
} },
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
124
|
+
} },
|
|
125
|
+
React.createElement("div", { className: "information" },
|
|
126
|
+
React.createElement(ARIcon, { variant: "linear", icon: "Upload", stroke: "var(--gray-600)", fill: "transparent" }),
|
|
127
|
+
React.createElement("div", { className: "properies" },
|
|
128
|
+
allowedTypes && (React.createElement("div", { className: "allow-types" }, allowedTypes?.map((allowedType) => allowedType.split("/")[1].toLocaleUpperCase()).join(", "))),
|
|
129
|
+
maxSize && React.createElement("div", { className: "max-size" },
|
|
130
|
+
"up to ",
|
|
131
|
+
maxSize,
|
|
132
|
+
"MB"))),
|
|
133
|
+
text && React.createElement("span", null, text)),
|
|
134
|
+
React.createElement("div", { className: "ar-upload-files" }, multiple ? (React.createElement("ul", null, selectedFiles.map((selectedFile, index) => {
|
|
135
|
+
let _className = [];
|
|
136
|
+
const errorMessages = validationErrors
|
|
137
|
+
.filter((error) => Object.keys(error).includes(selectedFile.name))
|
|
138
|
+
.map((error) => error[selectedFile.name]);
|
|
139
|
+
if (errorMessages.length > 0)
|
|
140
|
+
_className.push("error");
|
|
141
|
+
const content = (React.createElement("div", { className: "content" },
|
|
142
|
+
React.createElement("span", { className: _className.map((c) => c).join(" ") }, selectedFile.name),
|
|
143
|
+
React.createElement("span", { onClick: (event) => {
|
|
144
|
+
event.stopPropagation();
|
|
145
|
+
handleFileRemove(selectedFile);
|
|
146
|
+
} }, "x")));
|
|
147
|
+
return (React.createElement("li", { key: index, className: _className.map((c) => c).join(" ") }, errorMessages.length === 0 ? (content) : (React.createElement(Tooltip, { text: errorMessages.map((message) => message ?? "") }, content))));
|
|
148
|
+
}))) : (selectedFile && (React.createElement("div", { className: "file" },
|
|
149
|
+
React.createElement("div", { className: "information" },
|
|
150
|
+
React.createElement("span", null, selectedFile.name),
|
|
151
|
+
React.createElement("span", null,
|
|
152
|
+
(selectedFile.size / 1024).toFixed(3),
|
|
153
|
+
"KB")),
|
|
154
|
+
React.createElement("div", { className: "delete", onClick: () => handleFileRemove(selectedFile) },
|
|
155
|
+
React.createElement(ARIcon, { icon: "CloseCircle", fill: "transparent", size: 20 })))))))));
|
|
120
156
|
};
|
|
121
157
|
export default Upload;
|
|
@@ -48,11 +48,21 @@ class Icon {
|
|
|
48
48
|
return (React.createElement(React.Fragment, null,
|
|
49
49
|
React.createElement("path", { d: "M6 4v6a6 6 0 0 0 12 0V4", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
50
50
|
React.createElement("line", { x1: "4", y1: "20", x2: "20", y2: "20", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" })));
|
|
51
|
+
case "Upload":
|
|
52
|
+
return (React.createElement(React.Fragment, null,
|
|
53
|
+
React.createElement("path", { d: "M9 17v-6l-2 2M9 11l2 2", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
54
|
+
React.createElement("path", { d: "M22 10v5c0 5-2 7-7 7H9c-5 0-7-2-7-7V9c0-5 2-7 7-7h5", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
55
|
+
React.createElement("path", { d: "M22 10h-4c-3 0-4-1-4-4V2l8 8Z", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" })));
|
|
51
56
|
case "Strikethrough":
|
|
52
57
|
return (React.createElement(React.Fragment, null,
|
|
53
58
|
React.createElement("line", { x1: "4", y1: "12", x2: "20", y2: "12", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
54
59
|
React.createElement("path", { d: "M6 4h12", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
55
60
|
React.createElement("path", { d: "M6 20h12", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" })));
|
|
61
|
+
case "Success":
|
|
62
|
+
return (React.createElement(React.Fragment, null,
|
|
63
|
+
React.createElement("path", { d: "M22 11.1V6.9C22 3.4 20.6 2 17.1 2h-4.2C9.4 2 8 3.4 8 6.9V8h3.1c3.5 0 4.9 1.4 4.9 4.9V16h1.1c3.5 0 4.9-1.4 4.9-4.9z", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
64
|
+
React.createElement("path", { d: "M16 17.1v-4.2C16 9.4 14.6 8 11.1 8H6.9C3.4 8 2 9.4 2 12.9v4.2C2 20.6 3.4 22 6.9 22h4.2c3.5 0 4.9-1.4 4.9-4.9z", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
65
|
+
React.createElement("path", { d: "M6.08 15l1.95 1.95 3.89-3.9", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" })));
|
|
56
66
|
case "BulletList":
|
|
57
67
|
return (React.createElement(React.Fragment, null,
|
|
58
68
|
React.createElement("circle", { cx: 3, cy: this._startIndex, r: 2, fill: "currentColor" }),
|
|
@@ -91,6 +101,10 @@ class Icon {
|
|
|
91
101
|
return (React.createElement(React.Fragment, null,
|
|
92
102
|
React.createElement("path", { d: "M12 22c5.5 0 10-4.5 10-10S17.5 2 12 2 2 6.5 2 12s4.5 10 10 10Z", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
93
103
|
React.createElement("path", { d: "m7.75 12 2.83 2.83 5.67-5.66", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" })));
|
|
104
|
+
case "Warning":
|
|
105
|
+
return (React.createElement(React.Fragment, null,
|
|
106
|
+
React.createElement("path", { d: "M12 7.75V13M2.92 8.58c0-1.12.6-2.16 1.57-2.73l5.94-3.43c.97-.56 2.17-.56 3.15 0l5.94 3.43c.97.56 1.57 1.6 1.57 2.73v6.84c0 1.12-.6 2.16-1.57 2.73l-5.94 3.43c-.97.56-2.17.56-3.15 0l-5.94-3.43a3.15 3.15 0 0 1-1.57-2.73v-2.76", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
107
|
+
React.createElement("path", { d: "M12 16.2v.1", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" })));
|
|
94
108
|
default:
|
|
95
109
|
return null;
|
|
96
110
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Svg from "./Svg";
|
|
3
3
|
import Icon from "./Compiler";
|
|
4
|
-
export const ARIcon = ({ viewBox, size, variant = "linear", icon, fill = "var(--dark)", stroke = "var(--dark)", strokeWidth =
|
|
4
|
+
export const ARIcon = ({ viewBox, size, variant = "linear", icon, fill = "var(--dark)", stroke = "var(--dark)", strokeWidth = 1, style, }) => {
|
|
5
5
|
const { Compiler } = new Icon(fill, stroke, strokeWidth);
|
|
6
6
|
return (React.createElement(Svg, { viewBox: viewBox, fill: fill, width: size, height: size, style: style }, Compiler(variant, icon)));
|
|
7
7
|
};
|
|
@@ -50,12 +50,11 @@ export declare const useNotification: () => {
|
|
|
50
50
|
message?: string;
|
|
51
51
|
status: Status | number;
|
|
52
52
|
}) => void;
|
|
53
|
-
popup: ({ title, message, status,
|
|
53
|
+
popup: ({ title, message, status, }: {
|
|
54
54
|
title: string;
|
|
55
55
|
message?: string;
|
|
56
56
|
status: Status | number;
|
|
57
|
-
|
|
58
|
-
}) => void;
|
|
57
|
+
}, buttons?: PopupButtonProps | null) => void;
|
|
59
58
|
};
|
|
60
59
|
export declare const useValidation: <TData extends object>(data: TData, params: ValidationProperties<TData>[], step?: number) => {
|
|
61
60
|
onSubmit: (callback: (result: boolean) => void) => void;
|
|
@@ -33,7 +33,7 @@ export const useNotification = () => {
|
|
|
33
33
|
setStatus && setStatus(status);
|
|
34
34
|
setTrigger && setTrigger((trigger) => !trigger);
|
|
35
35
|
};
|
|
36
|
-
const popup = ({ title, message, status,
|
|
36
|
+
const popup = ({ title, message, status, }, buttons) => {
|
|
37
37
|
setTitle && setTitle(title);
|
|
38
38
|
setMessage && setMessage(message ?? "");
|
|
39
39
|
setStatus && setStatus(status);
|
|
@@ -20,7 +20,10 @@ declare class Api {
|
|
|
20
20
|
data?: any;
|
|
21
21
|
headers?: HeadersInit;
|
|
22
22
|
init?: Omit<RequestInit | undefined, "body">;
|
|
23
|
-
}): Promise<
|
|
23
|
+
}): Promise<{
|
|
24
|
+
p_response: Promise<Response>;
|
|
25
|
+
response: Response;
|
|
26
|
+
}>;
|
|
24
27
|
PostWithFormData(values: {
|
|
25
28
|
input?: RequestInfo;
|
|
26
29
|
data?: FormData;
|
|
@@ -29,13 +29,15 @@ class Api {
|
|
|
29
29
|
if (values.input && values.input.toString().includes("?")) {
|
|
30
30
|
values.input = values.input.toString().replace(/\/(?=\?)/, "");
|
|
31
31
|
}
|
|
32
|
-
const
|
|
32
|
+
const p_response = this.CustomFetch(`${this._url}${values.input}`, {
|
|
33
33
|
method: "POST",
|
|
34
34
|
headers: { ...this.HeaderProperties(), ...values.headers },
|
|
35
35
|
body: JSON.stringify(values.data),
|
|
36
36
|
...values.init,
|
|
37
37
|
});
|
|
38
|
-
|
|
38
|
+
const clone = (await p_response).clone();
|
|
39
|
+
const response = await clone;
|
|
40
|
+
return { p_response, response };
|
|
39
41
|
}
|
|
40
42
|
async PostWithFormData(values) {
|
|
41
43
|
if (values.input && values.input.toString().includes("?")) {
|
|
@@ -26,13 +26,13 @@ class Service {
|
|
|
26
26
|
let endPoint = `${this._endPoint}`;
|
|
27
27
|
if (values?.input)
|
|
28
28
|
endPoint += `/${values.input}`;
|
|
29
|
-
const response = await this._api.Post({
|
|
29
|
+
const { p_response, response } = await this._api.Post({
|
|
30
30
|
input: endPoint,
|
|
31
31
|
data: values?.data,
|
|
32
32
|
headers: values?.headers,
|
|
33
33
|
init: values?.init,
|
|
34
34
|
});
|
|
35
|
-
return await this.Response(
|
|
35
|
+
return await this.Response(p_response, response);
|
|
36
36
|
}
|
|
37
37
|
catch (error) {
|
|
38
38
|
throw new Error(error instanceof Error ? error.message : "Beklenmeyen bir hata oluştu.");
|
|
@@ -69,7 +69,7 @@ export type Errors<TData> = Partial<{
|
|
|
69
69
|
}>;
|
|
70
70
|
export type AllowedTypes = "image/jpeg" | "image/png" | "image/gif" | "image/webp" | "image/svg+xml" | "image/bmp" | "image/tiff" | "application/pdf" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/zip" | "application/x-rar-compressed" | "application/x-7z-compressed" | "application/gzip" | "application/json" | "application/xml" | "text/plain" | "text/csv" | "text/html" | "video/mp4" | "video/quicktime" | "video/x-msvideo" | "video/x-matroska" | "video/webm" | "video/x-flv" | "audio/mpeg" | "audio/wav" | "audio/ogg" | "audio/aac" | "audio/flac" | "application/octet-stream";
|
|
71
71
|
export type IconVariants = "linear" | "bulk";
|
|
72
|
-
export type Icons = "Add" | "ArrowLeft" | "ArrowRight" | "CloseCircle" | "CloseSquare" | "Drive" | "Document" | "Folder" | "Trash" | "Upload" | "Image" | "Import" | "Bold" | "Italic" | "Underline" | "Strikethrough" | "BulletList" | "NumberList" | "TextAlingLeft" | "TextAlingCenter" | "TextAlingRight" | "Filter" | "TickCircle" | "File";
|
|
72
|
+
export type Icons = "Add" | "ArrowLeft" | "ArrowRight" | "CloseCircle" | "CloseSquare" | "Drive" | "Document" | "Folder" | "Trash" | "Upload" | "Image" | "Import" | "Bold" | "Italic" | "Underline" | "Success" | "Strikethrough" | "BulletList" | "NumberList" | "TextAlingLeft" | "TextAlingCenter" | "TextAlingRight" | "Filter" | "TickCircle" | "File" | "Warning";
|
|
73
73
|
export type PieChartDataType = {
|
|
74
74
|
value: number;
|
|
75
75
|
text: string;
|