ar-design 0.3.99 → 0.4.2
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/paper/styles.css +34 -0
- package/dist/assets/css/components/data-display/tabs/tabs.css +199 -45
- package/dist/assets/css/components/form/text-editor/styles.css +94 -59
- package/dist/components/data-display/tabs/index.js +79 -18
- package/dist/components/form/text-editor/IProps.d.ts +3 -84
- package/dist/components/form/text-editor/index.d.ts +1 -1
- package/dist/components/form/text-editor/index.js +24 -6
- package/dist/components/icons/Compiler.js +2 -2
- package/package.json +1 -1
|
@@ -13,3 +13,37 @@
|
|
|
13
13
|
margin-bottom: 0.75rem;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
/* --- [KÜÇÜK MOBİL - IPHONE SE VB.] --- */
|
|
18
|
+
/* Çok dar ekranlar için özel düzeltmeler */
|
|
19
|
+
@media (max-width: 375px) {
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* --- [MOBİL - STANDART] --- */
|
|
23
|
+
/* Ekran 576px ve altına düştüğünde çalışır */
|
|
24
|
+
@media (max-width: 576px) {
|
|
25
|
+
.ar-paper {
|
|
26
|
+
border-radius: 0;
|
|
27
|
+
box-shadow: none;
|
|
28
|
+
|
|
29
|
+
> .header {
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* --- [TABLET DİKEY & BÜYÜK TELEFONLAR] --- */
|
|
35
|
+
/* Ekran 768px ve altına düştüğünde çalışır */
|
|
36
|
+
@media (max-width: 768px) {
|
|
37
|
+
.ar-paper {
|
|
38
|
+
border-radius: 0;
|
|
39
|
+
box-shadow: none;
|
|
40
|
+
|
|
41
|
+
> .header {
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* --- [TABLET & KÜÇÜK LAPTOP] --- */
|
|
47
|
+
/* Ekran 1024px ve altına düştüğünde çalışır */
|
|
48
|
+
@media (max-width: 1024px) {
|
|
49
|
+
}
|
|
@@ -1,65 +1,107 @@
|
|
|
1
1
|
.ar-tabs {
|
|
2
2
|
> .tabs {
|
|
3
|
-
|
|
4
|
-
flex-direction: row;
|
|
5
|
-
justify-content: flex-start;
|
|
3
|
+
position: relative;
|
|
6
4
|
height: var(--input-height);
|
|
7
5
|
margin-bottom: 1.5rem;
|
|
6
|
+
padding: 0;
|
|
8
7
|
border-bottom: solid 2px var(--gray-200);
|
|
9
8
|
user-select: none;
|
|
9
|
+
overflow: hidden;
|
|
10
10
|
|
|
11
|
-
> .
|
|
12
|
-
position: relative;
|
|
11
|
+
> .container {
|
|
13
12
|
display: flex;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
gap: 1rem;
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
justify-content: flex-start;
|
|
17
15
|
height: 100%;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
overflow-x: auto;
|
|
17
|
+
scrollbar-width: none;
|
|
18
|
+
scroll-behavior: auto;
|
|
19
|
+
cursor: all-scroll !important;
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
> .item {
|
|
22
|
+
position: relative;
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: 1rem;
|
|
27
|
+
min-width: max-content;
|
|
28
|
+
height: 100%;
|
|
29
|
+
padding: 0 0.75rem;
|
|
30
|
+
color: var(--gray-700);
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
|
|
34
|
+
&:not(:last-child) {
|
|
35
|
+
&::after {
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 50%;
|
|
38
|
+
transform: translateY(-50%);
|
|
39
|
+
right: 0;
|
|
40
|
+
content: "";
|
|
41
|
+
background-color: var(--gray-200);
|
|
42
|
+
width: 2px;
|
|
43
|
+
height: 12.5px;
|
|
44
|
+
border-radius: var(--border-radius-pill);
|
|
45
|
+
}
|
|
34
46
|
}
|
|
35
|
-
}
|
|
36
47
|
|
|
37
|
-
|
|
38
|
-
|
|
48
|
+
&.selection {
|
|
49
|
+
color: var(--primary);
|
|
39
50
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
&::before {
|
|
52
|
+
position: absolute;
|
|
53
|
+
left: 0;
|
|
54
|
+
right: 0;
|
|
55
|
+
bottom: 0;
|
|
56
|
+
content: "";
|
|
57
|
+
background-color: var(--primary);
|
|
58
|
+
height: 2px;
|
|
59
|
+
border-radius: var(--border-radius-pill);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
> .close-button {
|
|
64
|
+
display: flex;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
align-items: center;
|
|
67
|
+
background-color: rgba(var(--danger-rgb), 0.25);
|
|
68
|
+
width: 1rem;
|
|
69
|
+
height: 1rem;
|
|
48
70
|
border-radius: var(--border-radius-pill);
|
|
71
|
+
color: rgba(var(--danger-rgb), 0.5);
|
|
72
|
+
font-size: 0.75rem;
|
|
49
73
|
}
|
|
50
74
|
}
|
|
75
|
+
}
|
|
51
76
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
77
|
+
> .left,
|
|
78
|
+
.right {
|
|
79
|
+
position: absolute;
|
|
80
|
+
top: 50%;
|
|
81
|
+
transform: translateY(-50%);
|
|
82
|
+
display: flex;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
align-items: center;
|
|
85
|
+
background-color: rgba(var(--black-rgb), 0.1);
|
|
86
|
+
backdrop-filter: blur(5px);
|
|
87
|
+
width: 2rem;
|
|
88
|
+
height: 2rem;
|
|
89
|
+
border-radius: var(--border-radius);
|
|
90
|
+
color: var(--blue);
|
|
91
|
+
font-size: 1rem;
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
transition:
|
|
94
|
+
visibility 0.25s,
|
|
95
|
+
opacity 0.25s ease-in-out;
|
|
96
|
+
z-index: 5;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
> .left {
|
|
100
|
+
left: 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
> .right {
|
|
104
|
+
right: 0;
|
|
63
105
|
}
|
|
64
106
|
}
|
|
65
107
|
|
|
@@ -122,3 +164,115 @@
|
|
|
122
164
|
transform: translateY(-5px);
|
|
123
165
|
}
|
|
124
166
|
}
|
|
167
|
+
|
|
168
|
+
/* --- [KÜÇÜK MOBİL - IPHONE SE VB.] --- */
|
|
169
|
+
/* Çok dar ekranlar için özel düzeltmeler */
|
|
170
|
+
@media (max-width: 375px) {
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/* --- [MOBİL - STANDART] --- */
|
|
174
|
+
/* Ekran 576px ve altına düştüğünde çalışır */
|
|
175
|
+
@media (max-width: 576px) {
|
|
176
|
+
.ar-tabs {
|
|
177
|
+
> .tabs {
|
|
178
|
+
padding: 0 2rem;
|
|
179
|
+
|
|
180
|
+
> .container {
|
|
181
|
+
> .item {
|
|
182
|
+
&:not(:last-child) {
|
|
183
|
+
&::after {
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
&.selection {
|
|
188
|
+
&::before {
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
> .close-button {
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
> .left,
|
|
198
|
+
.right {
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
> .left {
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
> .right {
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
&.skeleton {
|
|
209
|
+
> .tabs {
|
|
210
|
+
> .item {
|
|
211
|
+
> span {
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
> .content {
|
|
217
|
+
&::before {
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/* --- [TABLET DİKEY & BÜYÜK TELEFONLAR] --- */
|
|
225
|
+
/* Ekran 768px ve altına düştüğünde çalışır */
|
|
226
|
+
@media (max-width: 768px) {
|
|
227
|
+
.ar-tabs {
|
|
228
|
+
> .tabs {
|
|
229
|
+
padding: 0 2rem;
|
|
230
|
+
|
|
231
|
+
> .container {
|
|
232
|
+
> .item {
|
|
233
|
+
&:not(:last-child) {
|
|
234
|
+
&::after {
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
&.selection {
|
|
239
|
+
&::before {
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
> .close-button {
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
> .left,
|
|
249
|
+
.right {
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
> .left {
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
> .right {
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
&.skeleton {
|
|
260
|
+
> .tabs {
|
|
261
|
+
> .item {
|
|
262
|
+
> span {
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
> .content {
|
|
268
|
+
&::before {
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/* --- [TABLET & KÜÇÜK LAPTOP] --- */
|
|
276
|
+
/* Ekran 1024px ve altına düştüğünde çalışır */
|
|
277
|
+
@media (max-width: 1024px) {
|
|
278
|
+
}
|
|
@@ -3,57 +3,82 @@
|
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 0;
|
|
5
5
|
width: 100%;
|
|
6
|
-
}
|
|
7
|
-
.ar-text-editor > .toolbar {
|
|
8
|
-
display: flex;
|
|
9
|
-
flex-direction: row;
|
|
10
|
-
gap: 0.25rem;
|
|
11
|
-
margin-top: -1px;
|
|
12
|
-
border: solid 1px transparent;
|
|
13
|
-
border-left-color: var(--gray-300);
|
|
14
|
-
border-right-color: var(--gray-300);
|
|
15
|
-
border-bottom-color: var(--gray-300);
|
|
16
|
-
}
|
|
17
|
-
.ar-text-editor > iframe {
|
|
18
|
-
width: 100%;
|
|
19
|
-
border-bottom-left-radius: 0 !important;
|
|
20
|
-
border-bottom-right-radius: 0 !important;
|
|
21
|
-
}
|
|
22
|
-
.ar-text-editor > .resize {
|
|
23
|
-
position: relative;
|
|
24
|
-
background-color: var(--gray-100);
|
|
25
|
-
width: 100%;
|
|
26
|
-
height: 1.5rem;
|
|
27
|
-
border: solid 1px transparent;
|
|
28
|
-
border-left-color: var(--gray-300);
|
|
29
|
-
border-right-color: var(--gray-300);
|
|
30
|
-
border-bottom-color: var(--gray-300);
|
|
31
|
-
border-bottom-left-radius: var(--border-radius-sm);
|
|
32
|
-
border-bottom-right-radius: var(--border-radius-sm);
|
|
33
|
-
cursor: ns-resize;
|
|
34
|
-
}
|
|
35
|
-
.ar-text-editor > .resize::before {
|
|
36
|
-
content: "";
|
|
37
|
-
position: absolute;
|
|
38
|
-
top: 50%;
|
|
39
|
-
left: 50%;
|
|
40
|
-
transform: translate(-50%, -50%);
|
|
41
|
-
background-color: var(--gray-500);
|
|
42
|
-
width: 1.5rem;
|
|
43
|
-
height: 0.1rem;
|
|
44
|
-
box-shadow: 0px -5px 0 0px var(--gray-500), 0px 5px 0 0px var(--gray-500);
|
|
45
|
-
}
|
|
46
6
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
7
|
+
> label {
|
|
8
|
+
position: absolute;
|
|
9
|
+
top: 1.5rem;
|
|
10
|
+
left: 0.85rem;
|
|
11
|
+
display: block;
|
|
12
|
+
padding: 0 0.5rem;
|
|
13
|
+
color: var(--gray-500);
|
|
14
|
+
white-space: nowrap;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
text-overflow: ellipsis;
|
|
52
17
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
18
|
+
&.visible {
|
|
19
|
+
visibility: visible;
|
|
20
|
+
opacity: 1;
|
|
21
|
+
display: block;
|
|
22
|
+
top: 0.25rem;
|
|
23
|
+
left: 1.25rem;
|
|
24
|
+
padding: 0 0.5rem;
|
|
25
|
+
font-size: 0.75rem;
|
|
26
|
+
white-space: nowrap;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
text-overflow: ellipsis;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
> iframe {
|
|
33
|
+
width: 100%;
|
|
34
|
+
border-bottom-left-radius: 0 !important;
|
|
35
|
+
border-bottom-right-radius: 0 !important;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
> .toolbar {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: row;
|
|
41
|
+
gap: 0.25rem;
|
|
42
|
+
margin-top: -1px;
|
|
43
|
+
border: solid 1px transparent;
|
|
44
|
+
border-left-color: var(--gray-300);
|
|
45
|
+
border-right-color: var(--gray-300);
|
|
46
|
+
border-bottom-color: var(--gray-300);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
> .resize {
|
|
50
|
+
position: relative;
|
|
51
|
+
background-color: var(--gray-100);
|
|
52
|
+
width: 100%;
|
|
53
|
+
height: 1.5rem;
|
|
54
|
+
border: solid 1px transparent;
|
|
55
|
+
border-left-color: var(--gray-300);
|
|
56
|
+
border-right-color: var(--gray-300);
|
|
57
|
+
border-bottom-color: var(--gray-300);
|
|
58
|
+
border-bottom-left-radius: var(--border-radius-sm);
|
|
59
|
+
border-bottom-right-radius: var(--border-radius-sm);
|
|
60
|
+
cursor: ns-resize;
|
|
61
|
+
|
|
62
|
+
&::before {
|
|
63
|
+
content: "";
|
|
64
|
+
position: absolute;
|
|
65
|
+
top: 50%;
|
|
66
|
+
left: 50%;
|
|
67
|
+
transform: translate(-50%, -50%);
|
|
68
|
+
background-color: var(--gray-500);
|
|
69
|
+
width: 1.5rem;
|
|
70
|
+
height: 0.1rem;
|
|
71
|
+
box-shadow:
|
|
72
|
+
0px -5px 0 0px var(--gray-500),
|
|
73
|
+
0px 5px 0 0px var(--gray-500);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
> .validation {
|
|
78
|
+
color: var(--danger);
|
|
79
|
+
font-size: 0.8rem;
|
|
80
|
+
font-weight: 400;
|
|
81
|
+
}
|
|
57
82
|
}
|
|
58
83
|
|
|
59
84
|
.ar-alias-panel {
|
|
@@ -70,17 +95,27 @@
|
|
|
70
95
|
box-shadow: 0 10px 15px -5px rgba(var(--black-rgb), 0.1);
|
|
71
96
|
/* Sırasıyla; Ad, Süre, Hız, Gecikme Süresi, Tekrar Sayısı, Yön, Bitiş Süreci */
|
|
72
97
|
animation: opened ease-in-out 250ms 0s 1 normal both;
|
|
98
|
+
|
|
99
|
+
> ul {
|
|
100
|
+
> li {
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
gap: 0 0.5rem;
|
|
104
|
+
padding: 0 1rem;
|
|
105
|
+
height: var(--input-height);
|
|
106
|
+
cursor: pointer;
|
|
107
|
+
|
|
108
|
+
&:hover {
|
|
109
|
+
background-color: var(--gray-100);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
73
113
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
height: var(--input-height);
|
|
80
|
-
cursor: pointer;
|
|
81
|
-
}
|
|
82
|
-
.ar-alias-panel > ul > li:hover {
|
|
83
|
-
background-color: var(--gray-100);
|
|
114
|
+
|
|
115
|
+
.ar-text-editor--block-item {
|
|
116
|
+
position: absolute;
|
|
117
|
+
inset: 0;
|
|
118
|
+
cursor: ns-resize;
|
|
84
119
|
}
|
|
85
120
|
|
|
86
121
|
@keyframes opened {
|
|
@@ -1,12 +1,58 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
+
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import "../../../assets/css/components/data-display/tabs/tabs.css";
|
|
4
4
|
import Skeleton from "./skeleton";
|
|
5
|
+
import { ARIcon } from "../../icons";
|
|
5
6
|
const Tabs = ({ name, tabs = [], activeTab, onChange, onClose }) => {
|
|
7
|
+
// ref
|
|
8
|
+
const _container = useRef(null);
|
|
9
|
+
const _items = useRef([]);
|
|
10
|
+
const _itemIndex = useRef(0);
|
|
6
11
|
// states
|
|
7
12
|
const [currentTab, setCurrentTab] = useState(0);
|
|
13
|
+
const [scrollInfo, setScrollInfo] = useState({
|
|
14
|
+
isMaxLeft: true,
|
|
15
|
+
isMaxRight: false,
|
|
16
|
+
current: 0,
|
|
17
|
+
maxScrollable: 0,
|
|
18
|
+
});
|
|
8
19
|
// states -> Loading
|
|
9
20
|
const [isLoading, setIsLoading] = useState(true);
|
|
21
|
+
// methods
|
|
22
|
+
const handleScroll = () => {
|
|
23
|
+
if (_container.current) {
|
|
24
|
+
const { scrollLeft, scrollWidth, clientWidth } = _container.current;
|
|
25
|
+
// Maksimum sağ değer: Toplam genişlik - Görünür genişlik
|
|
26
|
+
const maxRight = scrollWidth - clientWidth;
|
|
27
|
+
setScrollInfo({
|
|
28
|
+
isMaxLeft: scrollLeft <= 0, // En solda mı?
|
|
29
|
+
isMaxRight: scrollLeft >= maxRight - 1, // En sağda mı?
|
|
30
|
+
current: scrollLeft, // Anlık ne kadar sağda.
|
|
31
|
+
maxScrollable: maxRight, // Gidebileceği max piksel.
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const scroll = useMemo(() => {
|
|
36
|
+
return (direction) => {
|
|
37
|
+
const container = _container.current;
|
|
38
|
+
if (!container)
|
|
39
|
+
return;
|
|
40
|
+
let nextIndex = direction === "left" ? _itemIndex.current - 1 : _itemIndex.current + 1;
|
|
41
|
+
if (nextIndex < 0)
|
|
42
|
+
nextIndex = 0;
|
|
43
|
+
if (nextIndex >= _items.current.length)
|
|
44
|
+
nextIndex = _items.current.length - 1;
|
|
45
|
+
const targetItem = _items.current[nextIndex];
|
|
46
|
+
if (targetItem) {
|
|
47
|
+
const targetLeft = targetItem.offsetLeft - container.offsetLeft;
|
|
48
|
+
container.scrollTo({
|
|
49
|
+
left: targetLeft,
|
|
50
|
+
behavior: "smooth",
|
|
51
|
+
});
|
|
52
|
+
_itemIndex.current = nextIndex;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}, []);
|
|
10
56
|
// useEffects
|
|
11
57
|
useEffect(() => setCurrentTab(activeTab ?? 0), [activeTab]);
|
|
12
58
|
useEffect(() => {
|
|
@@ -16,26 +62,41 @@ const Tabs = ({ name, tabs = [], activeTab, onChange, onClose }) => {
|
|
|
16
62
|
onChange?.(stored !== null ? Number(stored) : 0);
|
|
17
63
|
setIsLoading(false);
|
|
18
64
|
}, [name]);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
window.addEventListener("resize", handleScroll);
|
|
67
|
+
return () => {
|
|
68
|
+
window.removeEventListener("resize", handleScroll);
|
|
69
|
+
};
|
|
70
|
+
}, []);
|
|
19
71
|
if (isLoading)
|
|
20
72
|
return React.createElement(Skeleton, { name: name, tabs: tabs });
|
|
21
73
|
return (React.createElement("div", { className: "ar-tabs" },
|
|
22
|
-
React.createElement("div", { className: "tabs" },
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
74
|
+
React.createElement("div", { className: "tabs" },
|
|
75
|
+
scrollInfo.current > 0 && (React.createElement("div", { className: "left", onClick: () => scroll("left") },
|
|
76
|
+
React.createElement(ARIcon, { icon: "ArrowLeft", stroke: "var(--gray-700)" }))),
|
|
77
|
+
!scrollInfo.isMaxRight && (React.createElement("div", { className: "right", onClick: () => scroll("right") },
|
|
78
|
+
React.createElement(ARIcon, { icon: "ArrowRight", stroke: "var(--gray-700)" }))),
|
|
79
|
+
React.createElement("div", { ref: _container, className: "container", onScroll: handleScroll }, tabs.length > 0 &&
|
|
80
|
+
tabs.map((tab, index) => {
|
|
81
|
+
let className = ["item"];
|
|
82
|
+
if (currentTab === index)
|
|
83
|
+
className.push("selection");
|
|
84
|
+
return (React.createElement("div", { key: tab.title ?? index, ref: (element) => {
|
|
85
|
+
if (!element)
|
|
86
|
+
return;
|
|
87
|
+
_items.current[index] = element;
|
|
88
|
+
}, className: className.map((c) => c).join(" "), onClick: () => {
|
|
89
|
+
setCurrentTab(index);
|
|
90
|
+
onChange?.(index);
|
|
91
|
+
const key = `${window.location.pathname}::${name}`;
|
|
92
|
+
sessionStorage.setItem(key, String(index));
|
|
93
|
+
} },
|
|
94
|
+
React.createElement("span", null, tab.title),
|
|
95
|
+
tab.config?.canBeClosed && (React.createElement("span", { className: "close-button", onClick: (event) => {
|
|
96
|
+
event.stopPropagation();
|
|
97
|
+
onClose && onClose(index);
|
|
98
|
+
} }, "\u2716"))));
|
|
99
|
+
}))),
|
|
39
100
|
React.createElement("div", { className: "content" }, tabs.map((tab, index) => currentTab === index && tab.content))));
|
|
40
101
|
};
|
|
41
102
|
export default Tabs;
|
|
@@ -1,81 +1,8 @@
|
|
|
1
|
-
import { IColors, IValidation } from "../../../libs/types/IGlobalProps";
|
|
2
|
-
export interface IProps<T> extends IValidation, IColors {
|
|
3
|
-
/**
|
|
4
|
-
* Bileşenin isim (name) değeridir.
|
|
5
|
-
*
|
|
6
|
-
* Formlarda veya bileşenlerde tanımlayıcı olarak kullanılır.
|
|
7
|
-
*
|
|
8
|
-
* Örneğin;
|
|
9
|
-
*
|
|
10
|
-
* ```jsx
|
|
11
|
-
* <TextEditor name="email" />
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
1
|
+
import { IColors, IDisabled, IValidation } from "../../../libs/types/IGlobalProps";
|
|
2
|
+
export interface IProps<T> extends IValidation, IColors, IDisabled {
|
|
14
3
|
name?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Bileşenin mevcut değeridir.
|
|
17
|
-
*/
|
|
18
4
|
value?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Değer değiştiğinde çağrılan fonksiyon.
|
|
21
|
-
*
|
|
22
|
-
* - `value`: Yeni değer. `string` veya `undefined` olabilir.
|
|
23
|
-
*
|
|
24
|
-
* Örneğin;
|
|
25
|
-
*
|
|
26
|
-
* ```jsx
|
|
27
|
-
* <TextEditor onChange={(value)=> console.log(value)} />
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
5
|
onChange: (value?: string) => void;
|
|
31
|
-
/**
|
|
32
|
-
* Bileşenin yüksekliği (piksel cinsinden).
|
|
33
|
-
*/
|
|
34
|
-
height?: number;
|
|
35
|
-
/**
|
|
36
|
-
* Dinamik liste özellikleri.
|
|
37
|
-
*
|
|
38
|
-
* - `render.display`: Listede gösterilecek `T` tipindeki nesnenin hangi alanının gösterileceği.
|
|
39
|
-
* - `render.items`: Gösterilecek öğeler dizisi.
|
|
40
|
-
* - `triggerKey`: (Opsiyonel) Dinamik listenin tetiklenmesini sağlayan tuş.
|
|
41
|
-
* - `onTagged`: (Opsiyonel) Etiketlenen öğeler seçildiğinde çağrılan fonksiyon.
|
|
42
|
-
*
|
|
43
|
-
* Örnek kullanım:
|
|
44
|
-
*
|
|
45
|
-
* ```tsx
|
|
46
|
-
* interface IUser {
|
|
47
|
-
* id: number;
|
|
48
|
-
* name: string;
|
|
49
|
-
* email: string;
|
|
50
|
-
* }
|
|
51
|
-
*
|
|
52
|
-
* const users: IUser[] = [
|
|
53
|
-
* { id: 1, name: "Kaan", email: "kaan@example.com" },
|
|
54
|
-
* ];
|
|
55
|
-
*
|
|
56
|
-
* function handleTagged(taggedItems: IUser[]) {
|
|
57
|
-
* console.log("Seçilen öğeler:", taggedItems);
|
|
58
|
-
* }
|
|
59
|
-
*
|
|
60
|
-
* const dynamicListProps = {
|
|
61
|
-
* render: {
|
|
62
|
-
* display: "name" as keyof IUser,
|
|
63
|
-
* items: users,
|
|
64
|
-
* },
|
|
65
|
-
* triggerKey: "@",
|
|
66
|
-
* onTagged: handleTagged,
|
|
67
|
-
* };
|
|
68
|
-
*
|
|
69
|
-
* <TextEditor dynamicList={dynamicListProps} />
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* Açıklamalar:
|
|
73
|
-
*
|
|
74
|
-
* - `render.display`: Öğe listesinden kullanıcıya gösterilecek alanı belirtir.
|
|
75
|
-
* - `render.items`: Dinamik listede gösterilecek öğelerin dizisidir.
|
|
76
|
-
* - `triggerKey`: Bu karakter yazıldığında dinamik liste açılır.
|
|
77
|
-
* - `onTagged`: Kullanıcı bir öğeyi seçip etiketlediğinde çağrılır ve seçilen öğeleri parametre olarak alır.
|
|
78
|
-
*/
|
|
79
6
|
dynamicList?: {
|
|
80
7
|
render: {
|
|
81
8
|
display: keyof T;
|
|
@@ -84,16 +11,8 @@ export interface IProps<T> extends IValidation, IColors {
|
|
|
84
11
|
triggerKey?: string;
|
|
85
12
|
onTagged: (tagged: any[]) => void;
|
|
86
13
|
};
|
|
87
|
-
|
|
88
|
-
* Çoklu dil desteğinin aktif olup olmadığını belirtir.
|
|
89
|
-
*
|
|
90
|
-
* - `true`: Çoklu dil desteği aktif.
|
|
91
|
-
* - `false` veya belirtilmemişse: Devre dışı.
|
|
92
|
-
*/
|
|
14
|
+
height?: number;
|
|
93
15
|
multilang?: boolean;
|
|
94
|
-
/**
|
|
95
|
-
* Bileşenin placeholder (yer tutucu) metnidir.
|
|
96
|
-
*/
|
|
97
16
|
placeholder?: string;
|
|
98
17
|
}
|
|
99
18
|
export default IProps;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../../assets/css/components/form/text-editor/styles.css";
|
|
2
2
|
import IProps from "./IProps";
|
|
3
3
|
import React from "react";
|
|
4
|
-
declare const TextEditor: <T extends object>({ color, name, value, onChange, dynamicList, height, validation, }: IProps<T>) => React.JSX.Element;
|
|
4
|
+
declare const TextEditor: <T extends object>({ color, name, value, onChange, dynamicList, placeholder, height, validation, disabled, }: IProps<T>) => React.JSX.Element;
|
|
5
5
|
export default TextEditor;
|
|
@@ -6,13 +6,12 @@ import React, { useEffect, useRef, useState } from "react";
|
|
|
6
6
|
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
7
7
|
import ReactDOM from "react-dom";
|
|
8
8
|
import Tooltip from "../../feedback/tooltip";
|
|
9
|
-
const TextEditor = ({ color = "light", name, value, onChange, dynamicList,
|
|
10
|
-
// placeholder,
|
|
11
|
-
height,
|
|
9
|
+
const TextEditor = ({ color = "light", name, value, onChange, dynamicList, placeholder, height,
|
|
12
10
|
// multilang,
|
|
13
|
-
validation, }) => {
|
|
11
|
+
validation, disabled, }) => {
|
|
14
12
|
// refs
|
|
15
13
|
const _container = useRef(null);
|
|
14
|
+
const _label = useRef(null);
|
|
16
15
|
const _arIframe = useRef(null);
|
|
17
16
|
const _onChange = useRef(onChange);
|
|
18
17
|
const _onChangeTimeOut = useRef(null);
|
|
@@ -143,7 +142,8 @@ validation, }) => {
|
|
|
143
142
|
if (!_iframeDocument)
|
|
144
143
|
return;
|
|
145
144
|
setIframeDocument(_iframeDocument);
|
|
146
|
-
|
|
145
|
+
if (!disabled)
|
|
146
|
+
_iframeDocument.designMode = "on";
|
|
147
147
|
// Herhangi bir değişikliği izlemek için MutationObserver kullan
|
|
148
148
|
const observer = new MutationObserver((mutationsList) => {
|
|
149
149
|
if (_onChangeTimeOut.current)
|
|
@@ -212,7 +212,25 @@ validation, }) => {
|
|
|
212
212
|
};
|
|
213
213
|
}, []);
|
|
214
214
|
return (React.createElement("div", { ref: _container, className: "ar-text-editor" },
|
|
215
|
-
React.createElement("
|
|
215
|
+
placeholder && (React.createElement("label", { ref: _label, className: value ? "visible" : "hidden", style: { maxWidth: _arIframe.current?.getBoundingClientRect().width } },
|
|
216
|
+
validation && "* ",
|
|
217
|
+
placeholder)),
|
|
218
|
+
React.createElement("iframe", { ref: _arIframe, name: name, className: _iframeClassName.map((c) => c).join(" "), height: height, ...(value
|
|
219
|
+
? {
|
|
220
|
+
style: {
|
|
221
|
+
clipPath: `polygon(
|
|
222
|
+
-15px 0,
|
|
223
|
+
10px -5px,
|
|
224
|
+
10px 5px,
|
|
225
|
+
calc(${_label.current?.getBoundingClientRect().width}px + 7px) 5px,
|
|
226
|
+
calc(${_label.current?.getBoundingClientRect().width}px + 7px) -5px,
|
|
227
|
+
100% -70px,
|
|
228
|
+
calc(100% + 5px) calc(100% + 5px),
|
|
229
|
+
-5px calc(100% + 5px)
|
|
230
|
+
)`,
|
|
231
|
+
},
|
|
232
|
+
}
|
|
233
|
+
: {}) }),
|
|
216
234
|
React.createElement("div", { className: "toolbar" }, toolbarButtons.map(({ command, icon, tooltip }, index) => (React.createElement(Tooltip, { key: `${command}-${index}`, text: tooltip },
|
|
217
235
|
React.createElement(Button, { key: command, type: "button", variant: "borderless", color: "light", border: { radius: "none" }, icon: { element: React.createElement(ARIcon, { icon: icon }) }, onClick: () => execCommand(command) }))))),
|
|
218
236
|
React.createElement("div", { className: "resize", onMouseDown: handleMouseDown }),
|
|
@@ -11,9 +11,9 @@ class Icon {
|
|
|
11
11
|
case "Add":
|
|
12
12
|
return (React.createElement("path", { d: "M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4" }));
|
|
13
13
|
case "ArrowLeft":
|
|
14
|
-
return (React.createElement("path", { d: "M15
|
|
14
|
+
return (React.createElement("path", { fillRule: "evenodd", d: "M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeMiterlimit: "10", strokeLinecap: "round", strokeLinejoin: "round" }));
|
|
15
15
|
case "ArrowRight":
|
|
16
|
-
return (React.createElement("path", { fillRule: "evenodd", d: "M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8" }));
|
|
16
|
+
return (React.createElement("path", { fillRule: "evenodd", d: "M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeMiterlimit: "10", strokeLinecap: "round", strokeLinejoin: "round" }));
|
|
17
17
|
case "Bold":
|
|
18
18
|
return (React.createElement("path", { d: "M8.21 13c2.106 0 3.412-1.087 3.412-2.823 0-1.306-.984-2.283-2.324-2.386v-.055a2.176 2.176 0 0 0 1.852-2.14c0-1.51-1.162-2.46-3.014-2.46H3.843V13zM5.908 4.674h1.696c.963 0 1.517.451 1.517 1.244 0 .834-.629 1.32-1.73 1.32H5.908V4.673zm0 6.788V8.598h1.73c1.217 0 1.88.492 1.88 1.415 0 .943-.643 1.449-1.832 1.449H5.907z" }));
|
|
19
19
|
case "BulletList":
|