ar-design 0.2.7 → 0.2.9
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/form/checkbox/core/border.css +16 -0
- package/dist/assets/css/components/form/switch/core/border.css +10 -0
- package/dist/assets/css/components/form/text-editor/styles.css +38 -0
- package/dist/assets/css/core/ar-core.css +1 -0
- package/dist/assets/css/core/variants/animation.css +15 -0
- package/dist/assets/css/core/variants/borderless/borderless.css +19 -0
- package/dist/assets/css/core/variants/dashed/dashed.css +22 -0
- package/dist/assets/css/core/variants/filled/filled.css +29 -0
- package/dist/assets/css/core/variants/outlined/outlined.css +23 -0
- package/dist/components/form/radio/index.js +1 -1
- package/dist/components/form/text-editor/index.js +24 -3
- package/dist/libs/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -14,6 +14,22 @@
|
|
|
14
14
|
/* #endregion */
|
|
15
15
|
/* Border Color -> PRIMARY */
|
|
16
16
|
|
|
17
|
+
/* #region Border Color -> PRIMARY-LIGHT */
|
|
18
|
+
.ar-checkbox-wrapper > label > :is(input[type="checkbox"], input[type="radio"]):checked + span > .ar-checkbox.filled.primary-light::before {
|
|
19
|
+
border-right-color: var(--white);
|
|
20
|
+
border-bottom-color: var(--white);
|
|
21
|
+
}
|
|
22
|
+
.ar-checkbox-wrapper > label > :is(input[type="checkbox"], input[type="radio"]):checked + span > .ar-checkbox.outlined.primary-light::before {
|
|
23
|
+
border-right-color: var(--primary-light);
|
|
24
|
+
border-bottom-color: var(--primary-light);
|
|
25
|
+
}
|
|
26
|
+
.ar-checkbox-wrapper > label > :is(input[type="checkbox"], input[type="radio"]):checked + span > .ar-checkbox.borderless.primary-light::before {
|
|
27
|
+
border-right-color: var(--primary-light);
|
|
28
|
+
border-bottom-color: var(--primary-light);
|
|
29
|
+
}
|
|
30
|
+
/* #endregion */
|
|
31
|
+
/* Border Color -> PRIMARY-LIGHT */
|
|
32
|
+
|
|
17
33
|
/* #region Border Color -> SECONDARY */
|
|
18
34
|
.ar-checkbox-wrapper > label > :is(input[type="checkbox"], input[type="radio"]):checked + span > .ar-checkbox.filled.secondary::before {
|
|
19
35
|
border-right-color: var(--white);
|
|
@@ -8,6 +8,16 @@
|
|
|
8
8
|
/* #endregion */
|
|
9
9
|
/* Border Color -> PRIMARY */
|
|
10
10
|
|
|
11
|
+
/* #region Border Color -> PRIMARY-LIGHT */
|
|
12
|
+
.ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.primary-light {
|
|
13
|
+
box-shadow: 0 0 0 2.5px rgba(var(--primary-light-rgb), .1);
|
|
14
|
+
}
|
|
15
|
+
.ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.primary-light > .handle {
|
|
16
|
+
box-shadow: 0 0 0 2px rgba(var(--primary-light-rgb), .5);
|
|
17
|
+
}
|
|
18
|
+
/* #endregion */
|
|
19
|
+
/* Border Color -> PRIMARY-LIGHT */
|
|
20
|
+
|
|
11
21
|
/* #region Border Color -> SECONDARY */
|
|
12
22
|
.ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.secondary {
|
|
13
23
|
box-shadow: 0 0 0 2.5px rgba(var(--secondary-rgb), .1);
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
.ar-text-editor {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 0;
|
|
2
5
|
width: 100%;
|
|
3
6
|
}
|
|
4
7
|
.ar-text-editor > .toolbar {
|
|
@@ -8,9 +11,44 @@
|
|
|
8
11
|
}
|
|
9
12
|
.ar-text-editor > iframe {
|
|
10
13
|
width: 100%;
|
|
14
|
+
border-bottom: none;
|
|
15
|
+
border-bottom-left-radius: 0 !important;
|
|
16
|
+
border-bottom-right-radius: 0 !important;
|
|
17
|
+
}
|
|
18
|
+
.ar-text-editor > .resize {
|
|
19
|
+
position: relative;
|
|
20
|
+
background-color: var(--gray-200);
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 1.5rem;
|
|
23
|
+
border: solid 1px transparent;
|
|
24
|
+
border-top-color: var(--gray-400);
|
|
25
|
+
border-left-color: var(--gray-300);
|
|
26
|
+
border-right-color: var(--gray-300);
|
|
27
|
+
border-bottom-color: var(--gray-300);
|
|
28
|
+
border-bottom-left-radius: var(--border-radius-sm);
|
|
29
|
+
border-bottom-right-radius: var(--border-radius-sm);
|
|
30
|
+
cursor: ns-resize;
|
|
11
31
|
}
|
|
32
|
+
.ar-text-editor > .resize::before {
|
|
33
|
+
content: "";
|
|
34
|
+
position: absolute;
|
|
35
|
+
top: 50%;
|
|
36
|
+
left: 50%;
|
|
37
|
+
transform: translate(-50%, -50%);
|
|
38
|
+
background-color: var(--gray-500);
|
|
39
|
+
width: 2rem;
|
|
40
|
+
height: 0.1rem;
|
|
41
|
+
box-shadow: 0px -5px 0 0px var(--gray-500), 0px 5px 0 0px var(--gray-500);
|
|
42
|
+
}
|
|
43
|
+
|
|
12
44
|
.ar-text-editor > .validation {
|
|
13
45
|
color: var(--danger);
|
|
14
46
|
font-size: 0.8rem;
|
|
15
47
|
font-weight: 600;
|
|
16
48
|
}
|
|
49
|
+
|
|
50
|
+
.ar-text-editor--block-item {
|
|
51
|
+
position: absolute;
|
|
52
|
+
inset: 0;
|
|
53
|
+
cursor: ns-resize;
|
|
54
|
+
}
|
|
@@ -13,6 +13,21 @@
|
|
|
13
13
|
/* #endregion */
|
|
14
14
|
/* Animation -> PRIMARY */
|
|
15
15
|
|
|
16
|
+
/* #region Animation -> PRIMARY-LIGHT */
|
|
17
|
+
@keyframes clicked-primary-light {
|
|
18
|
+
0% {
|
|
19
|
+
box-shadow: 0 0 0 0px rgba(var(--primary-light-rgb), 0);
|
|
20
|
+
}
|
|
21
|
+
25% {
|
|
22
|
+
box-shadow: 0 0 0 5px rgba(var(--primary-light-rgb), 0.25);
|
|
23
|
+
}
|
|
24
|
+
100% {
|
|
25
|
+
box-shadow: 0 0 0 7.5px rgba(var(--primary-light-rgb), 0);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/* #endregion */
|
|
29
|
+
/* Animation -> PRIMARY-LIGHT */
|
|
30
|
+
|
|
16
31
|
/* #region Animation -> SECONDARY */
|
|
17
32
|
@keyframes clicked-secondary {
|
|
18
33
|
0% {
|
|
@@ -17,6 +17,25 @@ input.borderless:not(.disabled).primary:focus {
|
|
|
17
17
|
/* #endregion */
|
|
18
18
|
/* PRIMARY */
|
|
19
19
|
|
|
20
|
+
/* #region PRIMARY-LIGHT */
|
|
21
|
+
.borderless:not(.disabled).primary-light {
|
|
22
|
+
color: var(--primary-light);
|
|
23
|
+
}
|
|
24
|
+
.borderless:not(.disabled).primary-light:hover {
|
|
25
|
+
background-color: rgba(var(--primary-light-rgb), 0.1);
|
|
26
|
+
}
|
|
27
|
+
input.borderless:not(.disabled).primary-light:focus {
|
|
28
|
+
border-color: var(--primary-light);
|
|
29
|
+
box-shadow: 0 0 0 3.5px rgba(var(--primary-light-rgb), 0.1);
|
|
30
|
+
}
|
|
31
|
+
.borderless:not(.disabled).primary-light.active {
|
|
32
|
+
background-color: transparent;
|
|
33
|
+
/* Sırasıyla; Ad, Süre, Hız, Gecikme Süresi, Tekrar Sayısı, Yön, Bitiş Süreci */
|
|
34
|
+
animation: clicked-primary-light ease-in-out 750ms 0s 1 normal both;
|
|
35
|
+
}
|
|
36
|
+
/* #endregion */
|
|
37
|
+
/* PRIMARY-LIGHT */
|
|
38
|
+
|
|
20
39
|
/* #region SECONDARY */
|
|
21
40
|
.borderless:not(.disabled).secondary {
|
|
22
41
|
color: var(--secondary);
|
|
@@ -20,6 +20,28 @@ input[type="checkbox"]:checked + span > .ar-checkbox.dashed:not(.disabled).prima
|
|
|
20
20
|
/* #endregion */
|
|
21
21
|
/* PRIMARY */
|
|
22
22
|
|
|
23
|
+
/* #region PRIMARY-LIGHT */
|
|
24
|
+
.dashed:not(.disabled).primary-light {
|
|
25
|
+
border-color: var(--primary-light);
|
|
26
|
+
color: var(--primary-light);
|
|
27
|
+
}
|
|
28
|
+
.dashed:not(.disabled).primary-light:hover {
|
|
29
|
+
border-color: rgba(var(--primary-light-rgb), 0.5);
|
|
30
|
+
}
|
|
31
|
+
input.dashed:not(.disabled).primary-light:focus{
|
|
32
|
+
border-color: var(--primary-light);
|
|
33
|
+
box-shadow: 0 0 0 3.5px rgba(var(--primary-light-rgb), 0.25);
|
|
34
|
+
}
|
|
35
|
+
input[type="checkbox"]:checked + span > .ar-checkbox.dashed:not(.disabled).primary-light{
|
|
36
|
+
box-shadow: 0 0 0 2.5px rgba(var(--primary-light-rgb), 0.1);
|
|
37
|
+
}
|
|
38
|
+
.dashed:not(.disabled).primary-light.active {
|
|
39
|
+
/* Sırasıyla; Ad, Süre, Hız, Gecikme Süresi, Tekrar Sayısı, Yön, Bitiş Süreci */
|
|
40
|
+
animation: clicked-primary-light ease-in-out 750ms 0s 1 normal both;
|
|
41
|
+
}
|
|
42
|
+
/* #endregion */
|
|
43
|
+
/* PRIMARY-LIGHT */
|
|
44
|
+
|
|
23
45
|
/* #region SECONDARY */
|
|
24
46
|
.dashed:not(.disabled).secondary {
|
|
25
47
|
border-color: var(--secondary);
|
|
@@ -27,6 +27,35 @@ button.filled:not(.disabled).primary:focus {
|
|
|
27
27
|
/* #endregion */
|
|
28
28
|
/* PRIMARY */
|
|
29
29
|
|
|
30
|
+
/* #region PRIMARY-LIGHT */
|
|
31
|
+
.filled:not(.disabled).primary-light {
|
|
32
|
+
background-color: var(--primary-light);
|
|
33
|
+
color: var(--white)
|
|
34
|
+
}
|
|
35
|
+
input.filled:not(.disabled).primary-light:hover {
|
|
36
|
+
background-color: var(--primary-light-active);
|
|
37
|
+
}
|
|
38
|
+
input.filled:not(.disabled).primary-light:focus {
|
|
39
|
+
background-color: transparent;
|
|
40
|
+
border-color: var(--primary-light);
|
|
41
|
+
box-shadow: 0 0 0 3.5px rgba(var(--primary-light-rgb), 0.25);
|
|
42
|
+
}
|
|
43
|
+
input[type="checkbox"]:checked + span > .ar-checkbox.filled:not(.disabled).primary-light{
|
|
44
|
+
box-shadow: 0 0 0 2.5px rgba(var(--primary-light-rgb), 0.25);
|
|
45
|
+
}
|
|
46
|
+
button.filled:not(.disabled).primary-light {
|
|
47
|
+
color: var(--white);
|
|
48
|
+
}
|
|
49
|
+
button.filled:not(.disabled).primary-light:focus {
|
|
50
|
+
background-color: var(--primary-light);
|
|
51
|
+
}
|
|
52
|
+
.filled:not(.disabled).primary-light.active {
|
|
53
|
+
/* Sırasıyla; Ad, Süre, Hız, Gecikme Süresi, Tekrar Sayısı, Yön, Bitiş Süreci */
|
|
54
|
+
animation: clicked-primary-light ease-in-out 750ms 0s 1 normal both;
|
|
55
|
+
}
|
|
56
|
+
/* #endregion */
|
|
57
|
+
/* PRIMARY-LIGHT */
|
|
58
|
+
|
|
30
59
|
/* #region SECONDARY */
|
|
31
60
|
.filled:not(.disabled).secondary {
|
|
32
61
|
background-color: var(--secondary);
|
|
@@ -21,6 +21,29 @@ input[type="checkbox"]:checked + span > .ar-checkbox.outlined:not(.disabled).pri
|
|
|
21
21
|
/* #endregion */
|
|
22
22
|
/* PRIMARY */
|
|
23
23
|
|
|
24
|
+
/* #region PRIMARY-LIGHT */
|
|
25
|
+
.outlined:not(.disabled).primary-light {
|
|
26
|
+
border-color: var(--primary-light);
|
|
27
|
+
/* color: var(--primary-light); */
|
|
28
|
+
}
|
|
29
|
+
.outlined:not(.disabled).primary-light:hover {
|
|
30
|
+
border-color: rgba(var(--primary-light-rgb), 0.5);
|
|
31
|
+
}
|
|
32
|
+
input.outlined:not(.disabled).primary-light:focus,
|
|
33
|
+
iframe.outlined:not(.disabled).primary-light.focused{
|
|
34
|
+
border-color: var(--primary-light);
|
|
35
|
+
box-shadow: 0 0 0 3.5px rgba(var(--primary-light-rgb), 0.25);
|
|
36
|
+
}
|
|
37
|
+
input[type="checkbox"]:checked + span > .ar-checkbox.outlined:not(.disabled).primary-light{
|
|
38
|
+
box-shadow: 0 0 0 2.5px rgba(var(--primary-light-rgb), 0.1);
|
|
39
|
+
}
|
|
40
|
+
.outlined:not(.disabled).primary-light.active {
|
|
41
|
+
/* Sırasıyla; Ad, Süre, Hız, Gecikme Süresi, Tekrar Sayısı, Yön, Bitiş Süreci */
|
|
42
|
+
animation: clicked-primary-light ease-in-out 750ms 0s 1 normal both;
|
|
43
|
+
}
|
|
44
|
+
/* #endregion */
|
|
45
|
+
/* PRIMARY-LIGHT */
|
|
46
|
+
|
|
24
47
|
/* #region SECONDARY */
|
|
25
48
|
.outlined:not(.disabled).secondary {
|
|
26
49
|
border-color: var(--secondary);
|
|
@@ -6,7 +6,7 @@ const Radio = forwardRef(({ label, size = "normal", status, border = { radius: "
|
|
|
6
6
|
// refs
|
|
7
7
|
const _checkbox = useRef(null);
|
|
8
8
|
const _checkboxClassName = ["ar-radio"];
|
|
9
|
-
_checkboxClassName.push(...Utils.GetClassName("filled",
|
|
9
|
+
_checkboxClassName.push(...Utils.GetClassName("filled", status, border, size, undefined, attributes.className));
|
|
10
10
|
return (React.createElement("div", { className: "ar-radio-wrapper" },
|
|
11
11
|
React.createElement("label", null,
|
|
12
12
|
React.createElement("input", { ref: ref, type: "radio", ...attributes, size: 0, onChange: (event) => {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
2
3
|
import React, { useEffect, useRef, useState } from "react";
|
|
3
|
-
import { ARIcon } from "../../icons";
|
|
4
4
|
import Button from "../button";
|
|
5
|
+
import { ARIcon } from "../../icons";
|
|
5
6
|
import "../../../assets/css/components/form/text-editor/styles.css";
|
|
6
|
-
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
7
7
|
const TextEditor = ({ name, value, onChange, placeholder, validation }) => {
|
|
8
8
|
// refs
|
|
9
9
|
const _firstLoad = useRef(false);
|
|
10
|
+
const _container = useRef(null);
|
|
10
11
|
const _arIframe = useRef(null);
|
|
11
12
|
// states
|
|
12
13
|
const [iframe, setIframe] = useState(null);
|
|
@@ -34,6 +35,25 @@ const TextEditor = ({ name, value, onChange, placeholder, validation }) => {
|
|
|
34
35
|
};
|
|
35
36
|
const handleFocus = () => _arIframe.current?.classList.add("focused");
|
|
36
37
|
const handleBlur = () => _arIframe.current?.classList.remove("focused");
|
|
38
|
+
const handleMouseDown = () => {
|
|
39
|
+
// Resizebar a tıklandığında iframe içerisinde bulunan window'un event listenerı olmadığı için orada resize çalışmayacaktır.
|
|
40
|
+
// Bu yüzden önüne bir duvar örüyoruz ve mevcut sayfanın window'unda işlem yapmaya devam ediyor.
|
|
41
|
+
const resizeItem = document.createElement("div");
|
|
42
|
+
resizeItem.classList.add("ar-text-editor--block-item");
|
|
43
|
+
_container.current?.appendChild(resizeItem);
|
|
44
|
+
window.addEventListener("mousemove", handleResize);
|
|
45
|
+
window.addEventListener("mouseup", () => {
|
|
46
|
+
resizeItem.remove();
|
|
47
|
+
window.removeEventListener("mousemove", handleResize);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
const handleResize = (event) => {
|
|
51
|
+
if (_arIframe.current) {
|
|
52
|
+
const rect = _arIframe.current.getBoundingClientRect();
|
|
53
|
+
const height = (rect.height += event.movementY);
|
|
54
|
+
_arIframe.current.style.height = `${height}px`;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
37
57
|
// useEffects
|
|
38
58
|
// Iframe Document yüklendikten sonra çalışacaktır. (Bir defa çalışır.)
|
|
39
59
|
useEffect(() => {
|
|
@@ -76,11 +96,12 @@ const TextEditor = ({ name, value, onChange, placeholder, validation }) => {
|
|
|
76
96
|
}
|
|
77
97
|
};
|
|
78
98
|
}, []);
|
|
79
|
-
return (React.createElement("div", { className: "ar-text-editor" },
|
|
99
|
+
return (React.createElement("div", { ref: _container, className: "ar-text-editor" },
|
|
80
100
|
React.createElement("div", { className: "toolbar" }, toolbarButtons.map(({ command, icon, tooltip }) => (React.createElement(Button, { key: command, variant: "borderless", status: "secondary", icon: { element: React.createElement(ARIcon, { icon: icon, size: 18, fill: "var(--gray-700)" }) }, tooltip: {
|
|
81
101
|
text: tooltip,
|
|
82
102
|
}, onClick: () => execCommand(command) })))),
|
|
83
103
|
React.createElement("iframe", { ref: _arIframe, name: name, className: _iframeClassName.map((c) => c).join(" ") }),
|
|
104
|
+
React.createElement("div", { className: "resize", onMouseDown: handleMouseDown }),
|
|
84
105
|
validation?.text && React.createElement("span", { className: "validation" }, validation.text)));
|
|
85
106
|
};
|
|
86
107
|
export default TextEditor;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export type Variants = "filled" | "outlined" | "dashed" | "borderless";
|
|
3
|
-
export type Status = "primary" | "secondary" | "success" | "danger" | "warning" | "information" | "dark" | "light";
|
|
3
|
+
export type Status = "primary" | "primary-light" | "secondary" | "success" | "danger" | "warning" | "information" | "dark" | "light";
|
|
4
4
|
export type ParagraphColors = "gray-100" | "gray-200" | "gray-300" | "gray-400" | "gray-500" | "gray-600" | "gray-700" | "gray-800" | "gray-900";
|
|
5
5
|
export type Border = {
|
|
6
6
|
radius: BorderRadiuses;
|