ar-design 0.2.95 → 0.2.97
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/data-display/dnd/animations.css +3 -3
- package/dist/assets/css/components/data-display/dnd/dnd.css +3 -21
- package/dist/assets/css/components/form/radio/radio.css +18 -0
- package/dist/components/data-display/dnd/index.js +28 -28
- package/dist/components/form/radio/IProps.d.ts +3 -0
- package/dist/components/form/radio/index.js +7 -2
- package/dist/components/form/upload/index.js +13 -6
- package/dist/components/icons/Compiler.js +2 -0
- package/dist/libs/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
@keyframes endItem {
|
|
2
2
|
0% {
|
|
3
|
-
|
|
3
|
+
box-shadow: 0 0 0 0px var(--blue-500);
|
|
4
4
|
}
|
|
5
5
|
50% {
|
|
6
|
-
|
|
6
|
+
box-shadow: 0 0 0 5px var(--blue-100);
|
|
7
7
|
}
|
|
8
8
|
100% {
|
|
9
|
-
|
|
9
|
+
box-shadow: 0 0 0 7.5px transparent;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -3,26 +3,24 @@
|
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 1rem 0;
|
|
5
5
|
}
|
|
6
|
+
|
|
6
7
|
.ar-dnd > div {
|
|
7
8
|
position: relative;
|
|
8
9
|
display: flex;
|
|
9
10
|
flex-direction: row;
|
|
11
|
+
justify-content: center;
|
|
10
12
|
align-items: center;
|
|
11
13
|
gap: 0 0.5rem;
|
|
12
14
|
width: 100%;
|
|
13
|
-
border-radius: var(--border-radius-lg);
|
|
14
15
|
cursor: move;
|
|
15
16
|
overflow: hidden;
|
|
17
|
+
transition: transform 0.3s ease, opacity 0.3s ease;
|
|
16
18
|
}
|
|
17
19
|
.ar-dnd > div.drag-item {
|
|
18
20
|
opacity: 0.5;
|
|
19
21
|
}
|
|
20
22
|
.ar-dnd > div.over-item {
|
|
21
23
|
position: relative;
|
|
22
|
-
/* padding-bottom: 1rem; */
|
|
23
|
-
/* border-bottom: solid 2px var(--gray-500); */
|
|
24
|
-
/* box-shadow: 0 0 0 1.5px rgba(var(--success-rgb), 0.25), 0 0 0 5px rgba(var(--success-rgb), 0.15); */
|
|
25
|
-
/* transition: box-shadow 250ms ease-in-out; */
|
|
26
24
|
}
|
|
27
25
|
.ar-dnd > div.over-item::after {
|
|
28
26
|
position: absolute;
|
|
@@ -39,26 +37,10 @@
|
|
|
39
37
|
animation: endItem ease-in-out 1s 0s 1 normal both;
|
|
40
38
|
}
|
|
41
39
|
|
|
42
|
-
.ar-dnd > div > .move {
|
|
43
|
-
flex: 1rem;
|
|
44
|
-
width: 100%;
|
|
45
|
-
height: 1.5rem;
|
|
46
|
-
border-right: transparent;
|
|
47
|
-
}
|
|
48
40
|
.ar-dnd > div > .move {
|
|
49
41
|
display: flex;
|
|
50
|
-
flex-direction: column;
|
|
51
42
|
justify-content: center;
|
|
52
43
|
align-items: center;
|
|
53
|
-
gap: 0.25rem 0;
|
|
54
|
-
cursor: move;
|
|
55
|
-
}
|
|
56
|
-
.ar-dnd > div > .move > span {
|
|
57
|
-
display: block;
|
|
58
|
-
background-color: var(--gray-500);
|
|
59
|
-
width: 90%;
|
|
60
|
-
height: 2px;
|
|
61
|
-
border-radius: var(--border-radius-pill);
|
|
62
44
|
}
|
|
63
45
|
|
|
64
46
|
.ar-dnd > div > .content {
|
|
@@ -47,5 +47,23 @@
|
|
|
47
47
|
border-radius: var(--border-radius-pill);
|
|
48
48
|
z-index: 1;
|
|
49
49
|
}
|
|
50
|
+
.ar-radio-wrapper > label > span > .past-trace {
|
|
51
|
+
position: absolute;
|
|
52
|
+
top: 50%;
|
|
53
|
+
left: 50%;
|
|
54
|
+
transform: translate(-50%, -50%);
|
|
55
|
+
display: inline-block;
|
|
56
|
+
content: "";
|
|
57
|
+
width: 1rem;
|
|
58
|
+
height: 1rem;
|
|
59
|
+
border-radius: var(--border-radius-pill);
|
|
60
|
+
z-index: 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.ar-radio-wrapper > label > .validation {
|
|
64
|
+
color: var(--danger);
|
|
65
|
+
font-size: 0.8rem;
|
|
66
|
+
font-weight: 400;
|
|
67
|
+
}
|
|
50
68
|
|
|
51
69
|
@import url("./core/border.css");
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import React, { useEffect, useRef } from "react";
|
|
3
3
|
import "../../../assets/css/components/data-display/dnd/dnd.css";
|
|
4
|
+
import { ARIcon } from "../../icons";
|
|
4
5
|
const DnD = function ({ data, renderItem, onChange }) {
|
|
5
6
|
// refs
|
|
6
7
|
const _arDnD = useRef(null);
|
|
7
8
|
const _dragItem = useRef();
|
|
9
|
+
// useEffects
|
|
8
10
|
useEffect(() => {
|
|
9
11
|
if (!_arDnD.current || data.length === 0)
|
|
10
12
|
return;
|
|
11
13
|
_arDnD.current.childNodes.forEach((item) => {
|
|
12
|
-
const
|
|
14
|
+
const _item = item;
|
|
13
15
|
// Events
|
|
14
|
-
|
|
16
|
+
_item.ondragstart = (event) => {
|
|
15
17
|
const dragItem = event.currentTarget;
|
|
16
18
|
_dragItem.current = dragItem;
|
|
17
19
|
dragItem.classList.add("drag-item");
|
|
@@ -26,7 +28,7 @@ const DnD = function ({ data, renderItem, onChange }) {
|
|
|
26
28
|
});
|
|
27
29
|
}
|
|
28
30
|
};
|
|
29
|
-
|
|
31
|
+
_item.ondragover = (event) => {
|
|
30
32
|
event.preventDefault();
|
|
31
33
|
const overItem = event.currentTarget;
|
|
32
34
|
const rect = overItem.getBoundingClientRect();
|
|
@@ -34,53 +36,51 @@ const DnD = function ({ data, renderItem, onChange }) {
|
|
|
34
36
|
window.scrollBy(0, -20);
|
|
35
37
|
if (rect.bottom > window.innerHeight - 150)
|
|
36
38
|
window.scrollBy(0, 20);
|
|
37
|
-
if (!overItem.classList.contains("over-item")) {
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
targetItem.ondragleave = (event) => {
|
|
42
|
-
const leaveItem = event.currentTarget;
|
|
43
|
-
leaveItem.classList.remove("over-item");
|
|
44
|
-
};
|
|
45
|
-
targetItem.ondrop = (event) => {
|
|
46
|
-
event.preventDefault();
|
|
47
|
-
const dropItem = event.currentTarget;
|
|
48
|
-
// Cleaner...
|
|
49
|
-
dropItem.classList.remove("over-item");
|
|
39
|
+
// if (!overItem.classList.contains("over-item")) {
|
|
40
|
+
// overItem.classList.add("over-item");
|
|
41
|
+
// }
|
|
50
42
|
const nodes = document.querySelectorAll("[data-id='ar-firewall']");
|
|
51
43
|
nodes.forEach((node) => node.remove());
|
|
52
|
-
if (_dragItem.current !==
|
|
44
|
+
if (_dragItem.current !== overItem) {
|
|
53
45
|
if (_arDnD.current && _dragItem.current) {
|
|
54
46
|
const dragItemIndex = [..._arDnD.current.children].indexOf(_dragItem.current);
|
|
55
|
-
const dropItemIndex = [..._arDnD.current.children].indexOf(
|
|
47
|
+
const dropItemIndex = [..._arDnD.current.children].indexOf(overItem);
|
|
56
48
|
if (dragItemIndex < dropItemIndex) {
|
|
57
|
-
|
|
58
|
-
_arDnD.current.insertBefore(_dragItem.current, dropItem.nextSibling);
|
|
49
|
+
_arDnD.current.insertBefore(_dragItem.current, overItem.nextSibling);
|
|
59
50
|
}
|
|
60
51
|
else {
|
|
61
|
-
|
|
62
|
-
_arDnD.current.insertBefore(_dragItem.current, dropItem);
|
|
52
|
+
_arDnD.current.insertBefore(_dragItem.current, overItem);
|
|
63
53
|
}
|
|
64
|
-
// Data Order
|
|
65
54
|
data.splice(dropItemIndex, 0, data.splice(dragItemIndex, 1)[0]);
|
|
66
55
|
}
|
|
67
56
|
onChange(data);
|
|
68
57
|
}
|
|
69
58
|
};
|
|
70
|
-
|
|
59
|
+
// _item.ondragleave = (event) => {
|
|
60
|
+
// const leaveItem = event.currentTarget as HTMLElement;
|
|
61
|
+
// leaveItem.classList.remove("over-item");
|
|
62
|
+
// };
|
|
63
|
+
// _item.ondrop = (event) => {
|
|
64
|
+
// // const dropItem = event.currentTarget as HTMLElement;
|
|
65
|
+
// // Temizlik...
|
|
66
|
+
// // dropItem.classList.remove("over-item");
|
|
67
|
+
// };
|
|
68
|
+
_item.ondragend = (event) => {
|
|
71
69
|
const item = event.currentTarget;
|
|
72
70
|
item.classList.remove("drag-item");
|
|
73
71
|
item.classList.add("end-item");
|
|
74
|
-
setTimeout(() =>
|
|
72
|
+
setTimeout(() => {
|
|
73
|
+
item.classList.remove("end-item");
|
|
74
|
+
if (item.classList.length === 0)
|
|
75
|
+
item.removeAttribute("class");
|
|
76
|
+
}, 1000);
|
|
75
77
|
};
|
|
76
78
|
});
|
|
77
79
|
_arDnD.current.ondragover = (event) => event.preventDefault();
|
|
78
80
|
}, [data]);
|
|
79
81
|
return (React.createElement("div", { ref: _arDnD, className: "ar-dnd" }, data.map((item, index) => (React.createElement("div", { key: index, draggable: true },
|
|
80
82
|
React.createElement("div", { className: "move" },
|
|
81
|
-
React.createElement("
|
|
82
|
-
React.createElement("span", null),
|
|
83
|
-
React.createElement("span", null)),
|
|
83
|
+
React.createElement(ARIcon, { icon: "GripVertical", fill: "var(--blue-500)", size: 18 })),
|
|
84
84
|
React.createElement("div", { className: "content" }, renderItem(item, index)))))));
|
|
85
85
|
};
|
|
86
86
|
export default DnD;
|
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
import React, { forwardRef, useRef } from "react";
|
|
3
3
|
import "../../../assets/css/components/form/radio/radio.css";
|
|
4
4
|
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
5
|
-
const Radio = forwardRef(({ label, size = "normal", color = "blue", border = { radius: "pill" }, trace, upperCase, ...attributes }, ref) => {
|
|
5
|
+
const Radio = forwardRef(({ label, size = "normal", color = "blue", border = { radius: "pill" }, trace, pastTrace, upperCase, validation, ...attributes }, ref) => {
|
|
6
6
|
// refs
|
|
7
7
|
const _checkbox = useRef(null);
|
|
8
8
|
const _checkboxClassName = ["ar-radio"];
|
|
9
9
|
const _traceClassName = ["trace", "filled"];
|
|
10
|
+
const _pastTraceClassName = ["past-trace", "filled"];
|
|
10
11
|
_checkboxClassName.push(...Utils.GetClassName("filled", undefined, attributes.checked ? color : "light", border, size, undefined, attributes.className));
|
|
11
12
|
if (trace && Object.keys(trace).length > 0)
|
|
12
13
|
_traceClassName.push(trace.color);
|
|
14
|
+
if (pastTrace && Object.keys(pastTrace).length > 0)
|
|
15
|
+
_pastTraceClassName.push(pastTrace.color);
|
|
13
16
|
return (React.createElement("div", { className: "ar-radio-wrapper" },
|
|
14
17
|
React.createElement("label", null,
|
|
15
18
|
React.createElement("input", { ref: ref, type: "radio", ...attributes, size: 0, onChange: (event) => {
|
|
@@ -23,7 +26,9 @@ const Radio = forwardRef(({ label, size = "normal", color = "blue", border = { r
|
|
|
23
26
|
React.createElement("span", null,
|
|
24
27
|
React.createElement("span", { ref: _checkbox, className: _checkboxClassName.map((c) => c).join(" ") }),
|
|
25
28
|
trace && Object.keys(trace).length > 0 && (React.createElement("span", { className: _traceClassName.map((c) => c).join(" ") })),
|
|
26
|
-
|
|
29
|
+
pastTrace && Object.keys(pastTrace).length > 0 && (React.createElement("span", { className: _pastTraceClassName.map((c) => c).join(" ") })),
|
|
30
|
+
label && React.createElement("span", { className: "label" }, upperCase ? label.toUpperCase() : label)),
|
|
31
|
+
validation?.text && React.createElement("span", { className: "validation" }, validation.text))));
|
|
27
32
|
});
|
|
28
33
|
Radio.displayName = "Radio";
|
|
29
34
|
export default Radio;
|
|
@@ -130,8 +130,10 @@ const Upload = ({ text, file, onChange, allowedTypes, maxSize, type = "list", mu
|
|
|
130
130
|
_validationErrors.current = [];
|
|
131
131
|
if (_input.current) {
|
|
132
132
|
if (multiple) {
|
|
133
|
-
if (selectedFiles.length === 0)
|
|
133
|
+
if (selectedFiles.length === 0) {
|
|
134
|
+
onChange(fileFormData, [], [], false);
|
|
134
135
|
return;
|
|
136
|
+
}
|
|
135
137
|
// Seçilmiş olan dosyalar validasyona gönderiliyor.
|
|
136
138
|
selectedFiles.forEach((f) => handleValidationFile(f));
|
|
137
139
|
const inValidFiles = Array.from(new Set(_validationErrors.current));
|
|
@@ -161,22 +163,27 @@ const Upload = ({ text, file, onChange, allowedTypes, maxSize, type = "list", mu
|
|
|
161
163
|
dataTransfer.items.add(selectedFile);
|
|
162
164
|
_input.current.files = dataTransfer.files;
|
|
163
165
|
}
|
|
166
|
+
else {
|
|
167
|
+
onChange(undefined, null, "");
|
|
168
|
+
}
|
|
164
169
|
}
|
|
165
170
|
}
|
|
166
171
|
})();
|
|
167
172
|
}, [selectedFiles, selectedFile]);
|
|
168
173
|
useEffect(() => {
|
|
169
|
-
if (_firstLoad.current)
|
|
174
|
+
if (_firstLoad.current) {
|
|
175
|
+
// if (multiple && file.length === 0) {
|
|
176
|
+
// setSelectedFiles([]);
|
|
177
|
+
// } else {
|
|
178
|
+
// if (!file) setSelectedFile(undefined);
|
|
179
|
+
// }
|
|
170
180
|
return;
|
|
181
|
+
}
|
|
171
182
|
if (multiple) {
|
|
172
|
-
if (file.length === 0)
|
|
173
|
-
return;
|
|
174
183
|
setSelectedFiles(file);
|
|
175
184
|
_firstLoad.current = true;
|
|
176
185
|
}
|
|
177
186
|
else {
|
|
178
|
-
if (!file)
|
|
179
|
-
return;
|
|
180
187
|
setSelectedFile(file);
|
|
181
188
|
_firstLoad.current = true;
|
|
182
189
|
}
|
|
@@ -72,6 +72,8 @@ class Icon {
|
|
|
72
72
|
case "Filter":
|
|
73
73
|
return (React.createElement(React.Fragment, null,
|
|
74
74
|
React.createElement("path", { d: "M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5m-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5m-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5" })));
|
|
75
|
+
case "GripVertical":
|
|
76
|
+
return (React.createElement("path", { d: "M7 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0M7 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0M7 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m-3 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m-3 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0" }));
|
|
75
77
|
case "Import":
|
|
76
78
|
return (React.createElement(React.Fragment, null,
|
|
77
79
|
React.createElement("path", { d: "M3 15C3 17.8284 3 19.2426 3.87868 20.1213C4.75736 21 6.17157 21 9 21H15C17.8284 21 19.2426 21 20.1213 20.1213C21 19.2426 21 17.8284 21 15", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
@@ -71,7 +71,7 @@ export type Errors<TData> = Partial<{
|
|
|
71
71
|
export type MimeTypes = "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";
|
|
72
72
|
export type FileCategory = "image" | "document" | "spreadsheet" | "presentation" | "archive" | "text" | "video" | "audio" | "json" | "xml" | "binary" | "other";
|
|
73
73
|
export type IconVariants = "linear" | "fill";
|
|
74
|
-
export type Icons = "Add" | "ArrowLeft" | "ArrowRight" | "Bold" | "BulletList" | "CameraReels" | "CheckAll" | "CloseCircle" | "CloseSquare" | "CloudUpload" | "Document" | "Download" | "ExclamationCircle" | "ExclamationDiamond" | "Eye" | "File" | "FileEarmark" | "FileTypeCsv" | "FileTypeDoc" | "FileTypeDocx" | "FileTypeHtml" | "FileTypeJson" | "FileTypePdf" | "FileTypePptx" | "FileTypeTxt" | "FileTypeXls" | "FileTypeXlsx" | "FileTypeXml" | "FileTypeZip" | "Filter" | "Folder" | "Import" | "Italic" | "NumberList" | "Strikethrough" | "TextAlingCenter" | "TextAlingLeft" | "TextAlingRight" | "TickCircle" | "Trash" | "Underline" | "Upload" | "Warning" | "XCircle";
|
|
74
|
+
export type Icons = "Add" | "ArrowLeft" | "ArrowRight" | "Bold" | "BulletList" | "CameraReels" | "CheckAll" | "CloseCircle" | "CloseSquare" | "CloudUpload" | "Document" | "Download" | "ExclamationCircle" | "ExclamationDiamond" | "Eye" | "File" | "FileEarmark" | "FileTypeCsv" | "FileTypeDoc" | "FileTypeDocx" | "FileTypeHtml" | "FileTypeJson" | "FileTypePdf" | "FileTypePptx" | "FileTypeTxt" | "FileTypeXls" | "FileTypeXlsx" | "FileTypeXml" | "FileTypeZip" | "Filter" | "Folder" | "GripVertical" | "Import" | "Italic" | "NumberList" | "Strikethrough" | "TextAlingCenter" | "TextAlingLeft" | "TextAlingRight" | "TickCircle" | "Trash" | "Underline" | "Upload" | "Warning" | "XCircle";
|
|
75
75
|
export type PieChartDataType = {
|
|
76
76
|
value: number;
|
|
77
77
|
text: string;
|