ar-design 0.1.60 → 0.1.62
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/confirm/confirm.css +1 -1
- package/dist/assets/css/components/form/upload/animations.css +14 -0
- package/dist/assets/css/components/form/upload/styles.css +102 -0
- package/dist/assets/css/components/navigation/menu/core/open-or-close.css +5 -4
- package/dist/assets/css/components/navigation/menu/menu.css +13 -13
- package/dist/assets/icons/linear/CloseSquare.svg +1 -0
- package/dist/components/feedback/confirm/index.js +0 -1
- package/dist/components/feedback/progress/IProps.d.ts +1 -0
- package/dist/components/feedback/progress/index.js +4 -5
- package/dist/components/form/upload/Props.d.ts +15 -0
- package/dist/components/form/upload/Props.js +1 -0
- package/dist/components/form/upload/index.d.ts +5 -0
- package/dist/components/form/upload/index.js +119 -0
- package/dist/components/icons/index.d.ts +2 -0
- package/dist/components/icons/index.js +5 -0
- package/dist/components/navigation/menu/index.js +6 -10
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/libs/core/service/Api.d.ts +12 -2
- package/dist/libs/core/service/Api.js +32 -14
- package/dist/libs/core/service/index.d.ts +10 -1
- package/dist/libs/core/service/index.js +39 -29
- package/dist/libs/infrastructure/shared/Icons.d.ts +9 -0
- package/dist/libs/infrastructure/shared/Icons.js +16 -0
- package/package.json +2 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
@keyframes count {
|
|
2
|
+
0% {
|
|
3
|
+
transform: scale(1);
|
|
4
|
+
}
|
|
5
|
+
50% {
|
|
6
|
+
box-shadow: 0 0 0 2.5px rgba(var(--warning-rgb), 0.25);
|
|
7
|
+
color: var(--warning);
|
|
8
|
+
-webkit-text-stroke: 1px var(--warning);
|
|
9
|
+
transform: scale(1.25);
|
|
10
|
+
}
|
|
11
|
+
100% {
|
|
12
|
+
transform: scale(1);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
.ar-upload {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 8.5rem;
|
|
4
|
+
}
|
|
5
|
+
.ar-upload > input {
|
|
6
|
+
display: none;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.ar-upload > .ar-upload-button > .count {
|
|
10
|
+
position: absolute;
|
|
11
|
+
top: 8px;
|
|
12
|
+
left: 42.5px;
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: row;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
align-items: center;
|
|
17
|
+
background-color: var(--white);
|
|
18
|
+
width: 1.25rem;
|
|
19
|
+
height: 1.25rem;
|
|
20
|
+
border-radius: var(--border-radius-pill);
|
|
21
|
+
box-shadow: 0 0 0 2.5px rgba(var(--black-rgb), 0.1);
|
|
22
|
+
color: var(--success);
|
|
23
|
+
font-size: 0.75rem;
|
|
24
|
+
-webkit-text-stroke: 1px var(--success);
|
|
25
|
+
user-select: none;
|
|
26
|
+
}
|
|
27
|
+
.ar-upload > .ar-upload-button > .count.changed {
|
|
28
|
+
animation: count cubic-bezier(0.23, 1, 0.32, 1) 250ms 0s 1 normal both;
|
|
29
|
+
}
|
|
30
|
+
.ar-upload > .ar-upload-button > button {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
align-items: center;
|
|
35
|
+
gap: 0.5rem 0;
|
|
36
|
+
background-color: rgba(var(--success-rgb), 0.1);
|
|
37
|
+
width: 100%;
|
|
38
|
+
padding: 0.75rem 1rem;
|
|
39
|
+
border: dashed 2px rgba(var(--success-rgb), 0.5);
|
|
40
|
+
border-radius: var(--border-radius-sm);
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
color: var(--success);
|
|
43
|
+
box-shadow: 0 0 0 2.5px rgba(var(--success-rgb), 0.1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ar-upload > .ar-upload-button .selected-files {
|
|
47
|
+
list-style: none;
|
|
48
|
+
}
|
|
49
|
+
.ar-upload > .ar-upload-button .selected-files > li {
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: row;
|
|
52
|
+
gap: 0 0.5rem;
|
|
53
|
+
}
|
|
54
|
+
.ar-upload > .ar-upload-button .selected-files > li > span:first-child {
|
|
55
|
+
font-size: 0.15rem;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.ar-upload-files {
|
|
59
|
+
position: absolute;
|
|
60
|
+
background-color: var(--white);
|
|
61
|
+
width: 250px;
|
|
62
|
+
border-radius: var(--border-radius-sm);
|
|
63
|
+
box-shadow: 0 0 15px -2.5px rgba(var(--black-rgb), 0.1);
|
|
64
|
+
z-index: 5;
|
|
65
|
+
transition: top 250ms ease-in-out;
|
|
66
|
+
}
|
|
67
|
+
.ar-upload-files::after {
|
|
68
|
+
position: absolute;
|
|
69
|
+
top: 10px;
|
|
70
|
+
left: 100%;
|
|
71
|
+
content: "";
|
|
72
|
+
border: solid 5px transparent;
|
|
73
|
+
border-left-color: var(--white);
|
|
74
|
+
}
|
|
75
|
+
.ar-upload-files > ul {
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
list-style-type: none;
|
|
79
|
+
}
|
|
80
|
+
.ar-upload-files > ul > li {
|
|
81
|
+
display: flex;
|
|
82
|
+
flex-direction: row;
|
|
83
|
+
justify-content: space-between;
|
|
84
|
+
align-items: center;
|
|
85
|
+
padding: 0.5rem;
|
|
86
|
+
border-bottom: solid 1px var(--gray-200);
|
|
87
|
+
}
|
|
88
|
+
.ar-upload-files > ul > li:last-child {
|
|
89
|
+
border-bottom: none;
|
|
90
|
+
}
|
|
91
|
+
.ar-upload-files > ul > li > span:first-child {
|
|
92
|
+
width: 90%;
|
|
93
|
+
font-size: 0.75rem;
|
|
94
|
+
text-overflow: ellipsis;
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
white-space: nowrap;
|
|
97
|
+
}
|
|
98
|
+
.ar-upload-files > ul > li > span:last-child {
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@import url("./animations.css");
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
.ar-menu ul li ul {
|
|
2
|
-
opacity: 0;
|
|
1
|
+
.ar-menu > ul li ul {
|
|
3
2
|
max-height: 0;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
transition: max-height 750ms 0s, margin 250ms 750ms ease-in-out;
|
|
4
5
|
}
|
|
5
6
|
|
|
6
|
-
.ar-menu ul li ul.opened {
|
|
7
|
-
opacity: 1;
|
|
7
|
+
.ar-menu > ul li ul.opened {
|
|
8
8
|
max-height: 100rem;
|
|
9
9
|
margin: 0.5rem 0 0.5rem 1rem;
|
|
10
|
+
transition: max-height 750ms ease-in-out;
|
|
10
11
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
.ar-menu {
|
|
1
|
+
.ar-menu > {
|
|
2
2
|
padding: 0 0.25rem;
|
|
3
3
|
font-family: var(--system);
|
|
4
4
|
}
|
|
5
|
-
.ar-menu ul,
|
|
6
|
-
.ar-menu ul li ul {
|
|
5
|
+
.ar-menu > ul,
|
|
6
|
+
.ar-menu > ul li ul {
|
|
7
7
|
display: flex;
|
|
8
8
|
flex-direction: column;
|
|
9
9
|
gap: 0.5rem 0;
|
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
padding: 0;
|
|
12
12
|
list-style: none;
|
|
13
13
|
}
|
|
14
|
-
.ar-menu ul li {
|
|
14
|
+
.ar-menu > ul li {
|
|
15
15
|
letter-spacing: 1px;
|
|
16
16
|
}
|
|
17
|
-
.ar-menu ul li .item-render {
|
|
17
|
+
.ar-menu > ul li .item-render {
|
|
18
18
|
display: flex;
|
|
19
19
|
flex-direction: row;
|
|
20
20
|
align-items: center;
|
|
21
21
|
}
|
|
22
|
-
.ar-menu ul li .item-render > a {
|
|
22
|
+
.ar-menu > ul li .item-render > a {
|
|
23
23
|
display: block;
|
|
24
24
|
width: 100%;
|
|
25
25
|
height: 2rem;
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
text-decoration: none;
|
|
28
28
|
line-height: 2rem;
|
|
29
29
|
}
|
|
30
|
-
.ar-menu ul li .item-render > span {
|
|
30
|
+
.ar-menu > ul li .item-render > span {
|
|
31
31
|
display: flex;
|
|
32
32
|
justify-content: center;
|
|
33
33
|
align-items: center;
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
margin-right: 0.75rem;
|
|
37
37
|
border-radius: var(--border-radius-pill);
|
|
38
38
|
}
|
|
39
|
-
.ar-menu ul li .item-render > span svg {
|
|
39
|
+
.ar-menu > ul li .item-render > span svg {
|
|
40
40
|
color: var(--light);
|
|
41
41
|
}
|
|
42
|
-
.ar-menu ul li .item-render > span > .no-icon::before {
|
|
42
|
+
.ar-menu > ul li .item-render > span > .no-icon::before {
|
|
43
43
|
display: inline-block;
|
|
44
44
|
content: "";
|
|
45
45
|
width: 0.75rem;
|
|
@@ -53,17 +53,17 @@
|
|
|
53
53
|
transform: rotate(45deg);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
.ar-menu ul li.selected {
|
|
56
|
+
.ar-menu > ul li.selected {
|
|
57
57
|
color: var(--primary);
|
|
58
58
|
}
|
|
59
|
-
.ar-menu ul li.selected .item-render > span {
|
|
59
|
+
.ar-menu > ul li.selected .item-render > span {
|
|
60
60
|
background-color: var(--primary);
|
|
61
61
|
box-shadow: 0 0 0 5px rgba(var(--primary-rgb), 0.1);
|
|
62
62
|
}
|
|
63
|
-
.ar-menu ul li.selected .item-render > span svg {
|
|
63
|
+
.ar-menu > ul li.selected .item-render > span svg {
|
|
64
64
|
color: var(--white);
|
|
65
65
|
}
|
|
66
|
-
.ar-menu ul li.selected .item-render > span > .no-icon::before {
|
|
66
|
+
.ar-menu > ul li.selected .item-render > span > .no-icon::before {
|
|
67
67
|
display: inline-block;
|
|
68
68
|
content: "";
|
|
69
69
|
width: 0.75rem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none"><path d="m9.17 14.83 5.66-5.66M14.83 14.83 9.17 9.17M9 22h6c5 0 7-2 7-7V9c0-5-2-7-7-7H9C4 2 2 4 2 9v6c0 5 2 7 7 7Z" stroke="#FF8A65" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg>
|
|
@@ -31,7 +31,6 @@ const Confirm = ({ children, title, message, content, onConfirm }) => {
|
|
|
31
31
|
const screenCenter = window.innerHeight / 2;
|
|
32
32
|
const sx = window.scrollX || document.documentElement.scrollLeft;
|
|
33
33
|
const sy = window.scrollY || document.documentElement.scrollTop;
|
|
34
|
-
console.log(screenCenter, elementRect.top);
|
|
35
34
|
_arConfirm.current.style.top = `${(elementRect.top > screenCenter
|
|
36
35
|
? elementRect.top - confirmRect.height + elementRect.height
|
|
37
36
|
: elementRect.top) + sy}px`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
3
3
|
import "../../../assets/css/components/feedback/progress/progress.css";
|
|
4
|
-
const Progress = ({ value, reverse }) => {
|
|
4
|
+
const Progress = ({ value, reverse, isVisibleValue = false }) => {
|
|
5
5
|
// variable/s
|
|
6
6
|
let _status = undefined;
|
|
7
7
|
const _arProgressClassName = [];
|
|
@@ -18,9 +18,8 @@ const Progress = ({ value, reverse }) => {
|
|
|
18
18
|
React.createElement("div", { className: `ar-progress-bar ${_arProgressClassName.map((c) => c).join(" ")}` }),
|
|
19
19
|
React.createElement("div", { className: `ar-progress-value ${_arProgressClassName.map((c) => c).join(" ")}`, style: {
|
|
20
20
|
width: `${value}%`,
|
|
21
|
-
} },
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
value))));
|
|
21
|
+
} }, !isVisibleValue && React.createElement("span", null,
|
|
22
|
+
"%",
|
|
23
|
+
value))));
|
|
25
24
|
};
|
|
26
25
|
export default Progress;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IValidation } from "../../../libs/types/IGlobalProps";
|
|
2
|
+
interface IMultiple {
|
|
3
|
+
file: FormData[];
|
|
4
|
+
onChange: (files: FormData) => void;
|
|
5
|
+
multiple: true;
|
|
6
|
+
}
|
|
7
|
+
interface ISingle {
|
|
8
|
+
file: FormData | undefined;
|
|
9
|
+
onChange: (file: FormData | undefined) => void;
|
|
10
|
+
multiple?: false;
|
|
11
|
+
}
|
|
12
|
+
type Props = {
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
} & (IMultiple | ISingle) & IValidation;
|
|
15
|
+
export default Props;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import "../../../assets/css/components/form/upload/styles.css";
|
|
3
|
+
import Icons from "../../../libs/infrastructure/shared/Icons";
|
|
4
|
+
import ReactDOM from "react-dom";
|
|
5
|
+
const Upload = ({ file, onChange, multiple }) => {
|
|
6
|
+
// refs
|
|
7
|
+
const _input = useRef(null);
|
|
8
|
+
const _arUplaod = useRef(null);
|
|
9
|
+
const _arUplaodFiles = useRef(null);
|
|
10
|
+
const _count = useRef(null);
|
|
11
|
+
const _countInterval = useRef();
|
|
12
|
+
// states
|
|
13
|
+
const [open, setOpen] = useState(false);
|
|
14
|
+
const [selectedFiles, setSelectedFiles] = useState([]);
|
|
15
|
+
// methods
|
|
16
|
+
const handleClickOutSide = (event) => {
|
|
17
|
+
const target = event.target;
|
|
18
|
+
if (_arUplaodFiles.current && !_arUplaodFiles.current.contains(target))
|
|
19
|
+
setOpen(false);
|
|
20
|
+
};
|
|
21
|
+
const handleKeys = (event) => {
|
|
22
|
+
const key = event.key;
|
|
23
|
+
if (key === "Escape")
|
|
24
|
+
setOpen(false);
|
|
25
|
+
};
|
|
26
|
+
const handlePosition = () => {
|
|
27
|
+
if (_arUplaod.current && _arUplaodFiles.current) {
|
|
28
|
+
const wRect = _arUplaod.current.getBoundingClientRect(); // Wrapper
|
|
29
|
+
const ufRect = _arUplaodFiles.current.getBoundingClientRect(); // Popup
|
|
30
|
+
const screenCenter = window.innerHeight / 2;
|
|
31
|
+
const sx = window.scrollX || document.documentElement.scrollLeft;
|
|
32
|
+
const sy = window.scrollY || document.documentElement.scrollTop;
|
|
33
|
+
if (multiple) {
|
|
34
|
+
_arUplaodFiles.current.style.top = `${(wRect.top > screenCenter ? wRect.top - ufRect.height + wRect.height : wRect.top) + sy}px`;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
_arUplaodFiles.current.style.top = `${wRect.top + sy}px`;
|
|
38
|
+
}
|
|
39
|
+
_arUplaodFiles.current.style.left = `${wRect.left - ufRect.width + sx - 10}px`;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const handleFileChange = (event) => {
|
|
43
|
+
const filesArray = Array.from(event.target.files ?? []);
|
|
44
|
+
setSelectedFiles(filesArray);
|
|
45
|
+
if (filesArray.length > 0) {
|
|
46
|
+
const formData = new FormData();
|
|
47
|
+
if (multiple) {
|
|
48
|
+
filesArray.forEach((file) => formData.append("file", file));
|
|
49
|
+
onChange(formData);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
formData.append("file", filesArray[0]);
|
|
53
|
+
onChange(formData);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const handleFileRemove = (fileToRemove) => {
|
|
58
|
+
setSelectedFiles((prev) => prev.filter((x) => x.name !== fileToRemove.name));
|
|
59
|
+
// Dosyayı input'tan kaldırmak için input'un value'sunu sıfırla
|
|
60
|
+
if (_input.current) {
|
|
61
|
+
const inputFiles = Array.from(_input.current.files ?? []);
|
|
62
|
+
const updatedFiles = inputFiles.filter((file) => file.name !== fileToRemove.name);
|
|
63
|
+
const dataTransfer = new DataTransfer();
|
|
64
|
+
updatedFiles.forEach((file) => dataTransfer.items.add(file));
|
|
65
|
+
// input'un files özelliğini güncelle
|
|
66
|
+
_input.current.files = dataTransfer.files;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
// useEffects
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
handlePosition();
|
|
72
|
+
if (_count.current) {
|
|
73
|
+
_count.current.classList.add("changed");
|
|
74
|
+
_countInterval.current = setTimeout(() => {
|
|
75
|
+
_count.current?.classList.remove("changed");
|
|
76
|
+
clearTimeout(_countInterval.current);
|
|
77
|
+
}, 250);
|
|
78
|
+
}
|
|
79
|
+
}, [selectedFiles]);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (_input.current) {
|
|
82
|
+
const dataTransfer = new DataTransfer();
|
|
83
|
+
_input.current.files = dataTransfer.files;
|
|
84
|
+
}
|
|
85
|
+
}, [file]);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (open) {
|
|
88
|
+
handlePosition();
|
|
89
|
+
// window.addEventListener("blur", () => setOpen(false));
|
|
90
|
+
document.addEventListener("click", handleClickOutSide);
|
|
91
|
+
document.addEventListener("keydown", handleKeys);
|
|
92
|
+
}
|
|
93
|
+
return () => {
|
|
94
|
+
window.removeEventListener("blur", () => setOpen(false));
|
|
95
|
+
document.removeEventListener("click", handleClickOutSide);
|
|
96
|
+
document.removeEventListener("keydown", handleKeys);
|
|
97
|
+
};
|
|
98
|
+
}, [open]);
|
|
99
|
+
return (React.createElement("div", { ref: _arUplaod, className: "ar-upload" },
|
|
100
|
+
React.createElement("input", { ref: _input, type: "file", onChange: handleFileChange, multiple: multiple }),
|
|
101
|
+
React.createElement("div", { className: "ar-upload-button" },
|
|
102
|
+
React.createElement("span", { ref: _count, className: "count", onClick: () => setOpen((prev) => !prev) }, selectedFiles.length),
|
|
103
|
+
React.createElement("button", { onClick: () => {
|
|
104
|
+
if (_input.current)
|
|
105
|
+
_input.current.click();
|
|
106
|
+
} },
|
|
107
|
+
Icons.Upload,
|
|
108
|
+
React.createElement("span", null, "Dosya Y\u00FCkle"))),
|
|
109
|
+
open &&
|
|
110
|
+
selectedFiles.length > 0 &&
|
|
111
|
+
ReactDOM.createPortal(React.createElement("div", { ref: _arUplaodFiles, className: "ar-upload-files" },
|
|
112
|
+
React.createElement("ul", null, selectedFiles.map((selectedFile, index) => (React.createElement("li", { key: index },
|
|
113
|
+
React.createElement("span", null, selectedFile.name),
|
|
114
|
+
React.createElement("span", { onClick: (event) => {
|
|
115
|
+
event.stopPropagation();
|
|
116
|
+
handleFileRemove(selectedFile);
|
|
117
|
+
} }, Icons.CrudProcesses.Trash)))))), document.body)));
|
|
118
|
+
};
|
|
119
|
+
export default Upload;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export const CloseSquare = () => {
|
|
3
|
+
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "32", height: "32", viewBox: "0 0 24 24", fill: "none" },
|
|
4
|
+
React.createElement("path", { d: "m9.17 14.83 5.66-5.66M14.83 14.83 9.17 9.17M9 22h6c5 0 7-2 7-7V9c0-5-2-7-7-7H9C4 2 2 4 2 9v6c0 5 2 7 7 7Z", stroke: "#FF8A65", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" })));
|
|
5
|
+
};
|
|
@@ -24,11 +24,8 @@ const handleOnClick = (event) => {
|
|
|
24
24
|
const SubMenu = ({ items, variant, setSelectedMenu, selectedMenu, setSelectedItem, selectedItem }) => {
|
|
25
25
|
if (!items)
|
|
26
26
|
return null;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (item.type === "group")
|
|
30
|
-
className.push("opened");
|
|
31
|
-
return (React.createElement("li", { key: index, className: "item", onClick: handleOnClick },
|
|
27
|
+
return (React.createElement("ul", null, items.map((item, index) => {
|
|
28
|
+
return (React.createElement("li", { key: index, onClick: handleOnClick },
|
|
32
29
|
React.createElement("div", { className: "item-render" },
|
|
33
30
|
React.createElement("span", null, item.icon ? item.icon : React.createElement("span", { className: "no-icon" })),
|
|
34
31
|
item.render),
|
|
@@ -40,11 +37,10 @@ const Menu = ({ data, variant = "vertical", ...attributes }) => {
|
|
|
40
37
|
const [selectedMenu, setSelectedMenu] = useState([]);
|
|
41
38
|
const [selectedItem, setSelectedItem] = useState(null);
|
|
42
39
|
return (React.createElement("nav", { className: "ar-menu", ...attributes },
|
|
43
|
-
React.createElement("ul",
|
|
44
|
-
let className_li = ["item"];
|
|
45
|
-
if (item.type === "group")
|
|
46
|
-
|
|
47
|
-
return (React.createElement("li", { key: index, className: className_li.map((c) => c).join(" "), onClick: handleOnClick },
|
|
40
|
+
React.createElement("ul", null, data.map((item, index) => {
|
|
41
|
+
// let className_li: string[] = ["item"];
|
|
42
|
+
// if (item.type === "group") className_li.push("opened");
|
|
43
|
+
return (React.createElement("li", { key: index, onClick: handleOnClick },
|
|
48
44
|
React.createElement("div", { className: "item-render" },
|
|
49
45
|
React.createElement("span", null, item.icon ? item.icon : React.createElement("span", { className: "no-icon" })),
|
|
50
46
|
item.type === "divider" ? React.createElement(Divider, null) : item.render),
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import DatePicker from "./components/form/date-picker";
|
|
|
7
7
|
import Select from "./components/form/select";
|
|
8
8
|
import Checkbox from "./components/form/checkbox";
|
|
9
9
|
import Switch from "./components/form/switch";
|
|
10
|
+
import Upload from "./components/form/upload";
|
|
10
11
|
import Radio from "./components/form/radio";
|
|
11
12
|
import Card from "./components/data-display/card";
|
|
12
13
|
import Chip from "./components/data-display/chip";
|
|
@@ -25,4 +26,4 @@ import Menu from "./components/navigation/menu";
|
|
|
25
26
|
import Steps from "./components/navigation/steps";
|
|
26
27
|
import Grid from "./components/layout/grid-system";
|
|
27
28
|
import Layout from "./components/layout";
|
|
28
|
-
export { Button, ButtonAction, ButtonGroup, Input, DatePicker, Select, Switch, Checkbox, Radio, Card, Chip, Divider, DnD, Paper, SyntaxHighlighter, Table, Tabs, Typography, Alert, Confirm, Modal, Progress, Menu, Steps, Grid, Layout, };
|
|
29
|
+
export { Button, ButtonAction, ButtonGroup, Input, DatePicker, Select, Switch, Upload, Checkbox, Radio, Card, Chip, Divider, DnD, Paper, SyntaxHighlighter, Table, Tabs, Typography, Alert, Confirm, Modal, Progress, Menu, Steps, Grid, Layout, };
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import DatePicker from "./components/form/date-picker";
|
|
|
8
8
|
import Select from "./components/form/select";
|
|
9
9
|
import Checkbox from "./components/form/checkbox";
|
|
10
10
|
import Switch from "./components/form/switch";
|
|
11
|
+
import Upload from "./components/form/upload";
|
|
11
12
|
import Radio from "./components/form/radio";
|
|
12
13
|
// Data Display
|
|
13
14
|
import Card from "./components/data-display/card";
|
|
@@ -32,7 +33,7 @@ import Grid from "./components/layout/grid-system";
|
|
|
32
33
|
import Layout from "./components/layout";
|
|
33
34
|
export {
|
|
34
35
|
// Form Elements
|
|
35
|
-
Button, ButtonAction, ButtonGroup, Input, DatePicker, Select, Switch, Checkbox, Radio,
|
|
36
|
+
Button, ButtonAction, ButtonGroup, Input, DatePicker, Select, Switch, Upload, Checkbox, Radio,
|
|
36
37
|
// Data Display
|
|
37
38
|
Card, Chip, Divider, DnD, Paper, SyntaxHighlighter, Table, Tabs, Typography,
|
|
38
39
|
// Feedback
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
declare class Api {
|
|
2
2
|
private _host?;
|
|
3
3
|
private _core?;
|
|
4
|
+
private _token?;
|
|
5
|
+
private _url;
|
|
4
6
|
constructor(values: {
|
|
5
7
|
host?: string;
|
|
6
8
|
core?: string;
|
|
9
|
+
token?: string;
|
|
7
10
|
});
|
|
8
11
|
Get(values: {
|
|
9
12
|
input?: RequestInfo | undefined;
|
|
@@ -11,14 +14,21 @@ declare class Api {
|
|
|
11
14
|
}): Promise<Response>;
|
|
12
15
|
Post(values: {
|
|
13
16
|
input?: RequestInfo;
|
|
14
|
-
data
|
|
17
|
+
data?: any;
|
|
18
|
+
headers?: HeadersInit;
|
|
19
|
+
init?: Omit<RequestInit | undefined, "body">;
|
|
20
|
+
}): Promise<Response>;
|
|
21
|
+
PostWithFormData(values: {
|
|
22
|
+
input?: RequestInfo;
|
|
23
|
+
data?: FormData;
|
|
15
24
|
headers?: HeadersInit;
|
|
16
|
-
init?: RequestInit | undefined
|
|
25
|
+
init?: Omit<RequestInit | undefined, "body">;
|
|
17
26
|
}): Promise<Response>;
|
|
18
27
|
Put(values: {
|
|
19
28
|
input?: RequestInfo;
|
|
20
29
|
data?: any;
|
|
21
30
|
headers?: HeadersInit;
|
|
31
|
+
init?: Omit<RequestInit | undefined, "body">;
|
|
22
32
|
}): Promise<Response>;
|
|
23
33
|
Delete(values: {
|
|
24
34
|
input?: RequestInfo;
|
|
@@ -1,47 +1,62 @@
|
|
|
1
1
|
class Api {
|
|
2
2
|
_host;
|
|
3
3
|
_core;
|
|
4
|
+
_token;
|
|
5
|
+
_url;
|
|
4
6
|
constructor(values) {
|
|
5
7
|
this._host = values.host || (typeof window !== "undefined" ? window.location.origin : "");
|
|
6
8
|
this._core = values.core || "";
|
|
9
|
+
this._token = values.token;
|
|
10
|
+
// Url
|
|
11
|
+
this._url = `${this._host}/${this._core ? this._core + "/" : ""}`;
|
|
7
12
|
}
|
|
8
13
|
async Get(values) {
|
|
9
|
-
const response = await this.CustomFetch(`${this.
|
|
14
|
+
const response = await this.CustomFetch(`${this._url}${values.input}`, {
|
|
15
|
+
method: "GET",
|
|
10
16
|
headers: {
|
|
11
|
-
...this.HeaderProperties,
|
|
17
|
+
...this.HeaderProperties(),
|
|
12
18
|
...values.headers,
|
|
13
19
|
},
|
|
14
|
-
method: "GET",
|
|
15
20
|
});
|
|
16
21
|
return response;
|
|
17
22
|
}
|
|
18
23
|
async Post(values) {
|
|
19
|
-
const response = await this.CustomFetch(`${this.
|
|
20
|
-
headers: { ...this.HeaderProperties, ...values.headers },
|
|
24
|
+
const response = await this.CustomFetch(`${this._url}${values.input}`, {
|
|
21
25
|
method: "POST",
|
|
26
|
+
headers: { ...this.HeaderProperties(), ...values.headers },
|
|
22
27
|
body: JSON.stringify(values.data),
|
|
23
28
|
...values.init,
|
|
24
29
|
});
|
|
25
30
|
return response;
|
|
26
31
|
}
|
|
32
|
+
async PostWithFormData(values) {
|
|
33
|
+
const response = await this.CustomFetch(`${this._url}${values.input}`, {
|
|
34
|
+
method: "POST",
|
|
35
|
+
headers: { ...values.headers },
|
|
36
|
+
body: values.data,
|
|
37
|
+
...values.init,
|
|
38
|
+
});
|
|
39
|
+
return response;
|
|
40
|
+
}
|
|
27
41
|
async Put(values) {
|
|
28
|
-
const response = await this.CustomFetch(`${this.
|
|
42
|
+
const response = await this.CustomFetch(`${this._url}${values.input}`, {
|
|
43
|
+
method: "PUT",
|
|
29
44
|
headers: {
|
|
30
|
-
...this.HeaderProperties,
|
|
45
|
+
...this.HeaderProperties(),
|
|
31
46
|
...values.headers,
|
|
32
47
|
},
|
|
33
|
-
method: "PUT",
|
|
34
48
|
body: JSON.stringify(values.data),
|
|
49
|
+
...values.init,
|
|
35
50
|
});
|
|
36
51
|
return response;
|
|
37
52
|
}
|
|
38
53
|
async Delete(values) {
|
|
39
|
-
const response = await this.CustomFetch(`${this.
|
|
54
|
+
const response = await this.CustomFetch(`${this._url}${values.input}`, {
|
|
55
|
+
method: "DELETE",
|
|
40
56
|
headers: {
|
|
41
|
-
...this.HeaderProperties,
|
|
57
|
+
...this.HeaderProperties(),
|
|
42
58
|
...values.headers,
|
|
43
59
|
},
|
|
44
|
-
method: "DELETE",
|
|
45
60
|
});
|
|
46
61
|
return response;
|
|
47
62
|
}
|
|
@@ -79,9 +94,12 @@ class Api {
|
|
|
79
94
|
throw error;
|
|
80
95
|
}
|
|
81
96
|
}
|
|
82
|
-
HeaderProperties = {
|
|
83
|
-
|
|
84
|
-
|
|
97
|
+
HeaderProperties = () => {
|
|
98
|
+
return {
|
|
99
|
+
Accept: "application/json",
|
|
100
|
+
"Content-Type": "application/json",
|
|
101
|
+
...(this._token && { Authorization: `Bearer ${this._token}` }),
|
|
102
|
+
};
|
|
85
103
|
};
|
|
86
104
|
}
|
|
87
105
|
export default Api;
|
|
@@ -11,6 +11,7 @@ declare class Service {
|
|
|
11
11
|
host?: string;
|
|
12
12
|
core?: string;
|
|
13
13
|
endPoint: string;
|
|
14
|
+
token?: string;
|
|
14
15
|
});
|
|
15
16
|
Get<TResponse>(values?: {
|
|
16
17
|
input?: string;
|
|
@@ -18,18 +19,26 @@ declare class Service {
|
|
|
18
19
|
}): Promise<Result<TResponse>>;
|
|
19
20
|
Post<TResponse, TData>(values?: {
|
|
20
21
|
input?: RequestInfo;
|
|
21
|
-
data
|
|
22
|
+
data?: TData;
|
|
22
23
|
headers?: HeadersInit;
|
|
23
24
|
init?: RequestInit | undefined;
|
|
24
25
|
}): Promise<Result<TResponse>>;
|
|
26
|
+
PostWithFormData<TResponse>(values?: {
|
|
27
|
+
input?: RequestInfo;
|
|
28
|
+
data?: FormData;
|
|
29
|
+
headers?: HeadersInit;
|
|
30
|
+
init?: Omit<RequestInit | undefined, "body">;
|
|
31
|
+
}): Promise<Result<TResponse>>;
|
|
25
32
|
Put<TResponse, TData>(values?: {
|
|
26
33
|
input?: RequestInfo;
|
|
27
34
|
data?: TData;
|
|
28
35
|
headers?: HeadersInit;
|
|
36
|
+
init?: Omit<RequestInit | undefined, "body">;
|
|
29
37
|
}): Promise<Result<TResponse>>;
|
|
30
38
|
Delete<TResponse>(values?: {
|
|
31
39
|
input?: RequestInfo;
|
|
32
40
|
headers?: HeadersInit;
|
|
33
41
|
}): Promise<Result<TResponse>>;
|
|
42
|
+
private Response;
|
|
34
43
|
}
|
|
35
44
|
export default Service;
|
|
@@ -3,7 +3,7 @@ class Service {
|
|
|
3
3
|
_api;
|
|
4
4
|
_endPoint;
|
|
5
5
|
constructor(values) {
|
|
6
|
-
this._api = new Api({ host: values.host, core: values.core });
|
|
6
|
+
this._api = new Api({ host: values.host, core: values.core, token: values.token });
|
|
7
7
|
this._endPoint = values.endPoint;
|
|
8
8
|
}
|
|
9
9
|
async Get(values) {
|
|
@@ -15,13 +15,7 @@ class Service {
|
|
|
15
15
|
input: endPoint,
|
|
16
16
|
headers: values?.headers,
|
|
17
17
|
});
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
response: text.length > 0 ? JSON.parse(text) : null,
|
|
21
|
-
__ok__: response.ok,
|
|
22
|
-
__statusCode__: response.status,
|
|
23
|
-
__statusText__: response.statusText,
|
|
24
|
-
};
|
|
18
|
+
return await this.Response(response);
|
|
25
19
|
}
|
|
26
20
|
catch (error) {
|
|
27
21
|
throw new Error(error instanceof Error ? error.message : "Beklenmeyen bir hata oluştu.");
|
|
@@ -38,13 +32,24 @@ class Service {
|
|
|
38
32
|
headers: values?.headers,
|
|
39
33
|
init: values?.init,
|
|
40
34
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
35
|
+
return await this.Response(response);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
throw new Error(error instanceof Error ? error.message : "Beklenmeyen bir hata oluştu.");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async PostWithFormData(values) {
|
|
42
|
+
try {
|
|
43
|
+
let endPoint = `${this._endPoint}`;
|
|
44
|
+
if (values?.input)
|
|
45
|
+
endPoint += `/${values.input}`;
|
|
46
|
+
const response = await this._api.PostWithFormData({
|
|
47
|
+
input: endPoint,
|
|
48
|
+
data: values?.data,
|
|
49
|
+
headers: values?.headers,
|
|
50
|
+
init: values?.init,
|
|
51
|
+
});
|
|
52
|
+
return await this.Response(response);
|
|
48
53
|
}
|
|
49
54
|
catch (error) {
|
|
50
55
|
throw new Error(error instanceof Error ? error.message : "Beklenmeyen bir hata oluştu.");
|
|
@@ -59,14 +64,9 @@ class Service {
|
|
|
59
64
|
input: endPoint,
|
|
60
65
|
data: values?.data,
|
|
61
66
|
headers: values?.headers,
|
|
67
|
+
init: values?.init,
|
|
62
68
|
});
|
|
63
|
-
|
|
64
|
-
return {
|
|
65
|
-
response: text.length > 0 ? JSON.parse(text) : null,
|
|
66
|
-
__ok__: response.ok,
|
|
67
|
-
__statusCode__: response.status,
|
|
68
|
-
__statusText__: response.statusText,
|
|
69
|
-
};
|
|
69
|
+
return await this.Response(response);
|
|
70
70
|
}
|
|
71
71
|
catch (error) {
|
|
72
72
|
throw new Error(error instanceof Error ? error.message : "Beklenmeyen bir hata oluştu.");
|
|
@@ -81,17 +81,27 @@ class Service {
|
|
|
81
81
|
input: endPoint,
|
|
82
82
|
headers: values?.headers,
|
|
83
83
|
});
|
|
84
|
-
|
|
85
|
-
return {
|
|
86
|
-
response: text.length > 0 ? JSON.parse(text) : null,
|
|
87
|
-
__ok__: response.ok,
|
|
88
|
-
__statusCode__: response.status,
|
|
89
|
-
__statusText__: response.statusText,
|
|
90
|
-
};
|
|
84
|
+
return await this.Response(response);
|
|
91
85
|
}
|
|
92
86
|
catch (error) {
|
|
93
87
|
throw new Error(error instanceof Error ? error.message : "Beklenmeyen bir hata oluştu.");
|
|
94
88
|
}
|
|
95
89
|
}
|
|
90
|
+
Response = async (response) => {
|
|
91
|
+
const text = (await response.text()).trim();
|
|
92
|
+
let _response;
|
|
93
|
+
try {
|
|
94
|
+
_response = JSON.parse(text);
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
_response = text;
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
response: _response,
|
|
101
|
+
__ok__: response.ok,
|
|
102
|
+
__statusCode__: response.status,
|
|
103
|
+
__statusText__: response.statusText,
|
|
104
|
+
};
|
|
105
|
+
};
|
|
96
106
|
}
|
|
97
107
|
export default Service;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
const Icons = {
|
|
3
|
+
CrudProcesses: {
|
|
4
|
+
Trash: (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none" },
|
|
5
|
+
React.createElement("path", { d: "M21.07 5.23c-1.61-.16-3.22-.28-4.84-.37v-.01l-.22-1.3c-.15-.92-.37-2.3-2.71-2.3h-2.62c-2.33 0-2.55 1.32-2.71 2.29l-.21 1.28c-.93.06-1.86.12-2.79.21l-2.04.2c-.42.04-.72.41-.68.82.04.41.4.71.82.67l2.04-.2c5.24-.52 10.52-.32 15.82.21h.08c.38 0 .71-.29.75-.68a.766.766 0 0 0-.69-.82Z", fill: "var(--gray-500)" }),
|
|
6
|
+
React.createElement("path", { opacity: ".399", d: "M19.23 8.14c-.24-.25-.57-.39-.91-.39H5.68c-.34 0-.68.14-.91.39-.23.25-.36.59-.34.94l.62 10.26c.11 1.52.25 3.42 3.74 3.42h6.42c3.49 0 3.63-1.89 3.74-3.42l.62-10.25c.02-.36-.11-.7-.34-.95Z", fill: "var(--gray-500)" }),
|
|
7
|
+
React.createElement("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M9.58 17a.75.75 0 0 1 .75-.75h3.33a.75.75 0 0 1 0 1.5h-3.33a.75.75 0 0 1-.75-.75ZM8.75 13a.75.75 0 0 1 .75-.75h5a.75.75 0 0 1 0 1.5h-5a.75.75 0 0 1-.75-.75Z", fill: "var(--gray-500)" }))),
|
|
8
|
+
},
|
|
9
|
+
Close: (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "32", height: "32", viewBox: "0 0 24 24", fill: "none" },
|
|
10
|
+
React.createElement("path", { opacity: ".4", d: "M16.19 2H7.81C4.17 2 2 4.17 2 7.81v8.37C2 19.83 4.17 22 7.81 22h8.37c3.64 0 5.81-2.17 5.81-5.81V7.81C22 4.17 19.83 2 16.19 2Z", fill: "#FF8A65" }),
|
|
11
|
+
React.createElement("path", { d: "m13.06 12 2.3-2.3c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-2.3 2.3-2.3-2.3a.754.754 0 0 0-1.06 0c-.29.29-.29.77 0 1.06l2.3 2.3-2.3 2.3c-.29.29-.29.77 0 1.06.15.15.34.22.53.22s.38-.07.53-.22l2.3-2.3 2.3 2.3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-2.3-2.3Z", fill: "#FF8A65" }))),
|
|
12
|
+
Upload: (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "32", height: "32", viewBox: "0 0 24 24", fill: "none" },
|
|
13
|
+
React.createElement("path", { opacity: ".4", d: "M20.5 10.19h-2.89c-2.37 0-4.3-1.93-4.3-4.3V3c0-.55-.45-1-1-1H8.07C4.99 2 2.5 4 2.5 7.57v8.86C2.5 20 4.99 22 8.07 22h7.86c3.08 0 5.57-2 5.57-5.57v-5.24c0-.55-.45-1-1-1Z", fill: "var(--success)" }),
|
|
14
|
+
React.createElement("path", { d: "M15.8 2.21c-.41-.41-1.12-.13-1.12.44v3.49c0 1.46 1.24 2.67 2.75 2.67.95.01 2.27.01 3.4.01.57 0 .87-.67.47-1.07-1.44-1.45-4.02-4.06-5.5-5.54ZM11.53 12.47l-2-2c-.01-.01-.02-.01-.02-.02a.855.855 0 0 0-.22-.15h-.02c-.08-.03-.16-.04-.24-.05h-.08c-.06 0-.13.02-.19.04-.03.01-.05.02-.07.03-.08.04-.16.08-.22.15l-2 2c-.29.29-.29.77 0 1.06.29.29.77.29 1.06 0l.72-.72V17c0 .41.34.75.75.75s.75-.34.75-.75v-4.19l.72.72c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06Z", fill: "var(--success)" }))),
|
|
15
|
+
};
|
|
16
|
+
export default Icons;
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ar-design",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.62",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./dist/index.js",
|
|
9
9
|
"./@charts": "./dist/components/charts/index.js",
|
|
10
|
+
"./@icons": "./dist/components/icons/index.js",
|
|
10
11
|
"./@service": "./dist/libs/core/service/index.js",
|
|
11
12
|
"./@config": "./dist/libs/core/application/contexts/index.js",
|
|
12
13
|
"./@hooks": "./dist/libs/core/application/hooks/index.js",
|