ar-design 0.1.57 → 0.1.58

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.
@@ -1,6 +1,14 @@
1
1
  .ar-chip {
2
- padding: 0.25rem 0.5rem;
2
+ display: flex;
3
+ justify-content: center;
4
+ align-items: center;
5
+ gap: 0 0.5rem;
6
+ height: 1.75rem;
7
+ padding: 0 0.5rem;
3
8
  font-size: 0.75rem;
4
9
  font-weight: 600;
5
10
  white-space: nowrap;
11
+ user-select: none;
12
+ -webkit-text-stroke: 0.5px var(--white);
13
+ letter-spacing: 1px;
6
14
  }
@@ -97,6 +97,7 @@
97
97
  display: flex;
98
98
  flex-direction: row;
99
99
  justify-content: flex-end;
100
+ align-items: center;
100
101
  }
101
102
 
102
103
  @import url("./scroll.css");
@@ -6,7 +6,6 @@
6
6
  position: fixed;
7
7
  inset: 0;
8
8
  background-color: rgba(var(--black-rgb), 0.5);
9
- backdrop-filter: blur(10px);
10
9
  }
11
10
 
12
11
  /* #region Open or Close */
@@ -17,19 +16,19 @@
17
16
  z-index: 100;
18
17
  }
19
18
  .ar-modal-wrapper:is(.opened) > .ar-modal {
20
- top: 4.5rem;
19
+ top: 1.75rem;
21
20
  transition: top 250ms ease-in-out;
22
21
  }
23
22
 
24
23
  .ar-modal-wrapper:is(.closed) {
25
24
  visibility: hidden;
26
25
  opacity: 0;
27
- transition: visibility 250ms 300ms, opacity 250ms 300ms ease-in-out;
26
+ transition: visibility 250ms, opacity 250ms ease-in-out;
28
27
  z-index: 99;
29
28
  }
30
29
  .ar-modal-wrapper:is(.closed) > .ar-modal {
31
30
  top: -100%;
32
- transition: top 250ms 300ms ease-in-out;
31
+ transition: top 250ms ease-in-out;
33
32
  }
34
33
  /* #endregion */
35
34
  /* Open or Close */
@@ -1,38 +1,11 @@
1
- .notification {
2
- background-color: var(--danger);
3
- position: fixed;
4
- display: flex;
5
- flex-direction: column-reverse;
6
- gap: 1.25rem 0;
7
- user-select: none;
8
- z-index: 1051;
9
- }
10
-
11
- .notification.top-left {
12
- top: 1rem;
13
- left: 1rem;
14
- }
15
- .notification.top-right {
16
- top: 1rem;
17
- right: 1rem;
18
- }
19
- .notification.bottom-left {
20
- bottom: 1rem;
21
- left: 1rem;
22
- }
23
- .notification.bottom-right {
24
- bottom: 1rem;
25
- right: 1rem;
26
- }
27
-
28
1
  .ar-notification-item {
2
+ opacity: 1;
29
3
  position: fixed;
30
4
  left: 2rem;
31
5
  display: flex;
32
6
  flex-direction: row;
33
7
  gap: 0 0.5rem;
34
- background-color: rgba(var(--white-rgb), 0.5);
35
- backdrop-filter: blur(5px);
8
+ background-color: var(--white);
36
9
  width: 350px;
37
10
  height: 7.5rem;
38
11
  border-radius: var(--border-radius-xl);
@@ -40,7 +13,16 @@
40
13
  transition: all 250ms ease-in-out;
41
14
  overflow: hidden;
42
15
  /* Sırasıyla; Ad, Süre, Hız, Gecikme Süresi, Tekrar Sayısı, Yön, Bitiş Süreci */
43
- animation: openSnackbar ease-in-out 500ms 0s 1 normal both;
16
+ animation: openedSnackbar ease-in-out 500ms 0s 1 normal both;
17
+ z-index: 1051;
18
+ }
19
+ .ar-notification-item.previous {
20
+ /* Sırasıyla; Ad, Süre, Hız, Gecikme Süresi, Tekrar Sayısı, Yön, Bitiş Süreci */
21
+ animation: previousSnackbar ease-in-out 500ms 0s 1 normal both;
22
+ }
23
+ .ar-notification-item.closed {
24
+ /* Sırasıyla; Ad, Süre, Hız, Gecikme Süresi, Tekrar Sayısı, Yön, Bitiş Süreci */
25
+ animation: closedSnackbar ease-in-out 500ms 0s 1 normal both;
44
26
  }
45
27
 
46
28
  .ar-notification-item > .icon {
@@ -147,7 +129,7 @@
147
129
  }
148
130
  }
149
131
 
150
- @keyframes openSnackbar {
132
+ @keyframes openedSnackbar {
151
133
  0% {
152
134
  transform: translateX(-500px);
153
135
  }
@@ -156,7 +138,16 @@
156
138
  }
157
139
  }
158
140
 
159
- @keyframes removeSnackbar {
141
+ @keyframes previousSnackbar {
142
+ 0% {
143
+ transform: translateX(0) translateY(0);
144
+ }
145
+ 100% {
146
+ transform: translateX(0) translateY(120px);
147
+ }
148
+ }
149
+
150
+ @keyframes closedSnackbar {
160
151
  0% {
161
152
  transform: translateX(0);
162
153
  }
@@ -2,9 +2,11 @@
2
2
  import React from "react";
3
3
  import "../../../assets/css/components/data-display/chip/chip.css";
4
4
  import Utils from "../../../libs/infrastructure/shared/Utils";
5
- const Chip = ({ variant = "outlined", status = "primary", border = { radius: "sm" }, text, }) => {
5
+ const Chip = ({ variant = "outlined", status = "primary", border = { radius: "sm" }, text, icon, }) => {
6
6
  let _chipClassName = ["ar-chip"];
7
7
  _chipClassName.push(...Utils.GetClassName(variant, status, border, undefined, undefined, undefined));
8
- return React.createElement("span", { className: _chipClassName.map((c) => c).join(" ") }, text);
8
+ return (React.createElement("div", { className: _chipClassName.map((c) => c).join(" ") },
9
+ icon?.element && React.createElement("span", null, icon?.element),
10
+ React.createElement("span", null, text)));
9
11
  };
10
12
  export default Chip;
@@ -40,12 +40,12 @@ const Confirm = ({ children, title, message, content, onConfirm }) => {
40
40
  document.addEventListener("click", handleClickOutSide);
41
41
  document.addEventListener("keydown", handleKeys);
42
42
  document.addEventListener("scroll", handleScroll);
43
+ }
44
+ else {
43
45
  // Dinleyicileri kaldır.
44
- return () => {
45
- document.removeEventListener("click", handleClickOutSide);
46
- document.removeEventListener("keydown", handleKeys);
47
- document.removeEventListener("scroll", handleScroll);
48
- };
46
+ document.removeEventListener("click", handleClickOutSide);
47
+ document.removeEventListener("keydown", handleKeys);
48
+ document.removeEventListener("scroll", handleScroll);
49
49
  }
50
50
  }, [open]);
51
51
  return (React.createElement("div", { ref: _arConfirmWrapper, className: "ar-confirm-wrapper", role: "dialog" },
@@ -25,13 +25,14 @@ const Modal = ({ children, open, title, size = "normal", footer }) => {
25
25
  // useEffects
26
26
  useEffect(() => {
27
27
  if (open.get) {
28
+ document.body.style.overflow = "hidden";
28
29
  // document.addEventListener("click", handleClickOutSide);
29
30
  document.addEventListener("keydown", handleKeys);
30
- // Dinleyicileri kaldır.
31
- return () => {
32
- // document.removeEventListener("click", handleClickOutSide);
33
- document.removeEventListener("keydown", handleKeys);
34
- };
31
+ }
32
+ else {
33
+ document.body.style.removeProperty("overflow");
34
+ // document.removeEventListener("click", handleClickOutSide);
35
+ document.removeEventListener("keydown", handleKeys);
35
36
  }
36
37
  }, [open.get]);
37
38
  return (React.createElement("div", { className: _modalWrapperClassName.map((c) => c).join(" ") },
@@ -3,40 +3,63 @@ import { useEffect, useRef, useState } from "react";
3
3
  import React from "react";
4
4
  import "../../../assets/css/components/feedback/notification/notification.css";
5
5
  const Notification = ({ title, message, status, direction = "bottom-left", trigger }) => {
6
- // useRefs
7
6
  const _firstLoad = useRef(false);
8
- // const _index = useRef<number>(0);
9
7
  const _notificationItems = useRef([]);
10
8
  const _interval = useRef();
11
- // useStates
9
+ // const _automaticRemoveInterval = useRef<NodeJS.Timeout>();
10
+ // const _closedInterval = useRef<NodeJS.Timeout>();
11
+ const _i = useRef(0);
12
12
  const [items, setItems] = useState([]);
13
- // useEffects
14
13
  useEffect(() => {
15
14
  if (!_firstLoad.current) {
16
15
  _firstLoad.current = true;
17
16
  return;
18
17
  }
19
- setItems((items) => [...items, { title, message, status, direction }]);
18
+ setItems((prevItems) => [...prevItems, { id: _i.current++, title, message, status, direction }]);
20
19
  }, [trigger]);
21
20
  useEffect(() => {
22
21
  if (items.length === 0)
23
22
  return;
24
- // Ekleme işlemi bittikten bir süre sonra tekrar kaldırma işlemi yapılmaktadır.
23
+ // const firstNotification = _notificationItems.current[0];
24
+ // _automaticRemoveInterval.current = setTimeout(() => {
25
+ // if (firstNotification) firstNotification.classList.add("closed");
26
+ // _interval.current = setTimeout(() => {
27
+ // setItems((prevItems) => prevItems.slice(1));
28
+ // if (firstNotification) firstNotification.classList.remove("closed");
29
+ // clearTimeout(_interval.current);
30
+ // }, 500);
31
+ // clearTimeout(_automaticRemoveInterval.current);
32
+ // }, 3000);
25
33
  _interval.current = setTimeout(() => {
26
- setItems((items) => items.slice(1));
34
+ setItems((prevItems) => prevItems.slice(1));
35
+ // if (firstNotification) firstNotification.classList.remove("closed");
27
36
  clearTimeout(_interval.current);
28
37
  }, 3000);
38
+ return () => {
39
+ // clearTimeout(_automaticRemoveInterval.current);
40
+ clearTimeout(_interval.current);
41
+ };
29
42
  }, [items]);
30
- return items.map((item, index) => {
31
- let bottom = 0;
32
- // Önceki öğenin yüksekliğini dikkate alarak `bottom` hesaplanıyor.
33
- if (_notificationItems.current[index - 1] && index > 0) {
43
+ const getBottomPosition = (index) => {
44
+ let bottom = 30; // Başlangıçta 30px'lik bir boşluk ekliyoruz.
45
+ // Önceki öğenin yüksekliğini dikkate alarak bottom hesaplanıyor.
46
+ if (_notificationItems.current[index - 1]) {
34
47
  bottom = _notificationItems.current.slice(0, index).reduce((acc, el) => {
35
48
  const rect = el.getBoundingClientRect();
36
- return acc + rect.height + 20; // Önceki öğelerin yüksekliğini topluyoruz.
37
- }, 0);
49
+ return acc + rect.height + 20; // +20 değeri ara boşluğu artıyor.
50
+ }, 30); // 30px'lik boşluğu başlangıçta ekliyoruz.
38
51
  }
39
- return (React.createElement("div", { key: index, ref: (element) => (_notificationItems.current[index] = element), className: "ar-notification-item", style: { bottom: `${items.length > 5 ? index * 10.5 : bottom}px` } },
52
+ return bottom;
53
+ };
54
+ return items.map((item, index) => {
55
+ const bottom = getBottomPosition(index);
56
+ return (React.createElement("div", { key: index, ref: (element) => (_notificationItems.current[index] = element), className: "ar-notification-item", style: items.length > 5
57
+ ? {
58
+ backgroundColor: `rgba(var(--white-rgb), ${index === items.length - 1 ? 1 : 0.1})`,
59
+ backdropFilter: "blur(10px)",
60
+ bottom: (index === 0 ? 30 : 10) * (index + 1),
61
+ }
62
+ : { bottom } },
40
63
  React.createElement("div", { className: "icon" },
41
64
  React.createElement("span", { className: item.status }),
42
65
  React.createElement("span", { className: item.status }),
@@ -46,7 +69,17 @@ const Notification = ({ title, message, status, direction = "bottom-left", trigg
46
69
  React.createElement("div", { className: "content" },
47
70
  React.createElement("span", { className: "title" }, item.title),
48
71
  React.createElement("span", { className: "message" }, item.message)),
49
- React.createElement("div", { className: "close", onClick: () => setItems((items) => items.filter((_, _index) => _index !== index)) })));
72
+ React.createElement("div", { className: "close", onClick: () => {
73
+ // clearTimeout(_automaticRemoveInterval.current);
74
+ clearTimeout(_interval.current);
75
+ setItems((prev) => prev.filter((_item) => _item.id !== item.id));
76
+ // if (_notificationItems.current[index]) _notificationItems.current[index]!.classList.add("closed");
77
+ // _closedInterval.current = setTimeout(() => {
78
+ // setItems((prev) => prev.filter((_item) => _item.id !== item.id));
79
+ // if (_notificationItems.current[index]) _notificationItems.current[index]!.classList.remove("closed");
80
+ // clearTimeout(_closedInterval.current);
81
+ // }, 500);
82
+ } })));
50
83
  });
51
84
  };
52
85
  export default Notification;
@@ -27,14 +27,13 @@ const ButtonAction = ({ buttons }) => {
27
27
  if (open) {
28
28
  document.addEventListener("click", handleClickOutSide);
29
29
  document.addEventListener("keydown", handleKeys);
30
- // Sayfa boyutu değiştirilmesi söz konusu olursa eğer bu kısım çalışacaktır.
31
30
  window.addEventListener("resize", handleResizeEvent);
31
+ }
32
+ else {
32
33
  // Dinleyicileri kaldır.
33
- return () => {
34
- document.removeEventListener("click", handleClickOutSide);
35
- document.removeEventListener("keydown", handleKeys);
36
- window.removeEventListener("resize", handleResizeEvent);
37
- };
34
+ document.removeEventListener("click", handleClickOutSide);
35
+ document.removeEventListener("keydown", handleKeys);
36
+ window.removeEventListener("resize", handleResizeEvent);
38
37
  }
39
38
  }, [open]);
40
39
  return (React.createElement("div", { ref: _arButtonAction, className: "ar-button-action" },
@@ -114,7 +114,7 @@ const DatePicker = ({ onChange, isClock, ...attributes }) => {
114
114
  if (isNaN(inputDate.getTime()))
115
115
  return;
116
116
  const [date, time] = inputDate.toISOString().split("T");
117
- const [clock, ms] = time.split(".");
117
+ const [clock, _] = time.split(".");
118
118
  _beginDate.current.value = !_clockOpen.current ? date : `${date}T${clock}`;
119
119
  }
120
120
  };
@@ -216,14 +216,12 @@ const DatePicker = ({ onChange, isClock, ...attributes }) => {
216
216
  document.addEventListener("click", handleClickOutSide);
217
217
  document.addEventListener("keydown", handleKeys);
218
218
  document.addEventListener("scroll", handleScroll);
219
- // Dinleyicileri kaldır ve zamanlayıcıyı temizle.
220
- return () => {
221
- document.removeEventListener("click", handleClickOutSide);
222
- document.removeEventListener("keydown", handleKeys);
223
- document.removeEventListener("scroll", handleScroll);
224
- };
225
219
  }
226
220
  else {
221
+ // Dinleyicileri kaldır ve zamanlayıcıyı temizle.
222
+ document.removeEventListener("click", handleClickOutSide);
223
+ document.removeEventListener("keydown", handleKeys);
224
+ document.removeEventListener("scroll", handleScroll);
227
225
  setCalendarClassName((prev) => [...prev, "closed"]);
228
226
  }
229
227
  }, [dateTrigger, calendarOpen]);
@@ -153,15 +153,13 @@ const Select = ({ variant = "outlined", status, border = { radius: "sm" }, optio
153
153
  document.addEventListener("click", handleClickOutSide);
154
154
  document.addEventListener("keydown", handleKeys);
155
155
  document.addEventListener("scroll", handleScroll);
156
- // Dinleyicileri kaldır ve zamanlayıcıyı temizle.
157
- return () => {
158
- clearTimeout(_otoFocus);
159
- document.removeEventListener("click", handleClickOutSide);
160
- document.removeEventListener("keydown", handleKeys);
161
- document.removeEventListener("scroll", handleScroll);
162
- };
163
156
  }
164
157
  else {
158
+ // Dinleyicileri kaldır ve zamanlayıcıyı temizle.
159
+ clearTimeout(_otoFocus);
160
+ document.removeEventListener("click", handleClickOutSide);
161
+ document.removeEventListener("keydown", handleKeys);
162
+ document.removeEventListener("scroll", handleScroll);
165
163
  // Options paneli kapanma süresi 250ms.
166
164
  // 300ms sonra temizlenmesinin sebebi kapanırken birder veriler gerliyor ve panel yüksekliği artıyor.
167
165
  setTimeout(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.1.57",
3
+ "version": "0.1.58",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",