ar-design 0.4.12 → 0.4.13

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.
@@ -4,13 +4,13 @@
4
4
  max-width: 100%;
5
5
  min-width: 100%;
6
6
  border-radius: var(--border-radius-lg);
7
- padding-bottom: 1rem;
8
7
  overflow-x: auto;
8
+ overflow-y: auto;
9
9
 
10
10
  /* width */
11
11
  &::-webkit-scrollbar {
12
- width: 0.5rem;
13
- height: 0.5rem;
12
+ width: 0.75rem;
13
+ height: 0.75rem;
14
14
  }
15
15
 
16
16
  /* Track */
@@ -29,77 +29,128 @@
29
29
  background: var(--gray-500);
30
30
  }
31
31
 
32
- > .columns {
32
+ > .buttons {
33
+ position: absolute;
34
+ top: 150px;
35
+ display: flex;
36
+ justify-content: space-between;
37
+ width: 100%;
38
+ height: 2.5rem;
39
+ z-index: 5;
40
+
41
+ > .button {
42
+ position: relative;
43
+ display: flex;
44
+ justify-content: center;
45
+ align-items: center;
46
+ background-color: rgba(var(--black-rgb), 0.1);
47
+ backdrop-filter: blur(5px);
48
+ width: 2rem;
49
+ height: 5rem;
50
+ border-radius: var(--border-radius-sm);
51
+ cursor: pointer;
52
+
53
+ &.left {
54
+ left: -10px;
55
+ }
56
+
57
+ &.right {
58
+ right: 0;
59
+ }
60
+ }
61
+ }
62
+
63
+ > .titles {
64
+ position: sticky;
65
+ top: 0;
66
+ left: auto;
67
+ right: auto;
33
68
  display: flex;
34
69
  flex-direction: row;
35
70
  flex-wrap: nowrap;
36
71
  gap: 1.5rem;
37
72
  width: 100%;
73
+ z-index: 5;
38
74
 
39
- > .column {
75
+ > .title {
40
76
  display: flex;
41
77
  flex-direction: column;
42
- flex-wrap: nowrap;
43
- gap: 0.75rem;
44
- position: relative;
45
- flex-shrink: 0;
78
+ justify-content: center;
79
+ gap: 0.5rem;
80
+ background-color: var(--white);
46
81
  max-width: 350px;
47
82
  min-width: 350px;
48
- user-select: none;
83
+ margin-bottom: 1rem;
84
+ padding: 0.5rem 1rem;
85
+ border-radius: var(--border-radius-lg);
86
+ color: var(--gray-700);
87
+ font-family: var(--system);
88
+ font-size: 0.85rem;
89
+ font-weight: 700;
90
+ box-shadow: 0px 5px 5px -2px rgba(var(--black-rgb), 0.1);
49
91
 
50
- > .title {
92
+ > h4 {
51
93
  display: flex;
52
- flex-direction: column;
53
- justify-content: center;
94
+ flex-direction: row;
95
+ align-items: center;
54
96
  gap: 0.5rem;
55
- background-color: var(--white);
56
- padding: 0.5rem 1rem;
57
- border-radius: var(--border-radius-lg);
58
- color: var(--gray-700);
59
- font-family: var(--system);
60
- font-size: 0.85rem;
61
- font-weight: 700;
62
- box-shadow: 0px 5px 5px -2px rgba(var(--black-rgb), 0.1);
63
-
64
- > h4 {
65
- display: flex;
66
- flex-direction: row;
67
- align-items: center;
68
- gap: 0.5rem;
69
- color: var(--gray-500);
97
+ color: var(--gray-500);
70
98
 
71
- > span {
72
- position: relative;
73
- width: 5px;
74
- height: 20px;
75
- border-radius: var(--border-radius-pill);
99
+ > span {
100
+ position: relative;
101
+ width: 5px;
102
+ height: 20px;
103
+ border-radius: var(--border-radius-pill);
76
104
 
77
- &::after {
78
- position: absolute;
79
- top: 50%;
80
- transform: translateY(-50%);
81
- left: 100%;
82
- content: "";
83
- border: solid 5px transparent;
84
- border-left-color: inherit;
85
- }
105
+ &::after {
106
+ position: absolute;
107
+ top: 50%;
108
+ transform: translateY(-50%);
109
+ left: 100%;
110
+ content: "";
111
+ border: solid 5px transparent;
112
+ border-left-color: inherit;
86
113
  }
87
114
  }
115
+ }
88
116
 
89
- > span {
90
- color: var(--gray-400);
91
- font-weight: 400;
92
- }
117
+ > span {
118
+ color: var(--gray-400);
119
+ font-weight: 400;
93
120
  }
121
+ }
122
+ }
123
+
124
+ > .columns {
125
+ display: flex;
126
+ flex-direction: row;
127
+ flex-wrap: nowrap;
128
+ gap: 1.5rem;
129
+ width: 100%;
130
+ height: max-content;
131
+ z-index: 4;
132
+
133
+ > .column {
134
+ position: relative;
135
+ display: flex;
136
+ flex-direction: column;
137
+ flex-wrap: nowrap;
138
+ gap: 0.75rem;
139
+ flex-shrink: 0;
140
+ max-width: 350px;
141
+ min-width: 350px;
142
+ user-select: none;
94
143
 
95
144
  > .items {
96
145
  position: relative;
97
146
  background-color: var(--white);
98
147
  padding: 1rem;
99
- height: calc(100% - 1rem);
148
+ height: 100%;
100
149
  border: dashed 0 transparent;
101
150
  border-radius: var(--border-radius-lg);
102
- transition: transform 250ms, border 250ms ease-in-out;
151
+ transition:
152
+ transform 250ms,
153
+ border 250ms ease-in-out;
103
154
 
104
155
  &:has(> .no-item) {
105
156
  display: flex;
@@ -158,3 +209,86 @@
158
209
  }
159
210
  }
160
211
  }
212
+
213
+ /* --- [KÜÇÜK MOBİL - IPHONE SE VB.] --- */
214
+ /* Çok dar ekranlar için özel düzeltmeler */
215
+ @media (max-width: 375px) {
216
+ }
217
+
218
+ /* --- [MOBİL - STANDART] --- */
219
+ /* Ekran 576px ve altına düştüğünde çalışır */
220
+ @media (max-width: 576px) {
221
+ }
222
+
223
+ /* --- [TABLET DİKEY & BÜYÜK TELEFONLAR] --- */
224
+ /* Ekran 768px ve altına düştüğünde çalışır */
225
+ @media (max-width: 768px) {
226
+ .ar-kanban-board {
227
+ /* width */
228
+ &::-webkit-scrollbar {
229
+ }
230
+
231
+ /* Track */
232
+ &::-webkit-scrollbar-track {
233
+ }
234
+
235
+ /* Handle */
236
+ &::-webkit-scrollbar-thumb {
237
+ }
238
+
239
+ /* Handle on hover */
240
+ &::-webkit-scrollbar-thumb:hover {
241
+ }
242
+
243
+ > .buttons {
244
+ display: none;
245
+
246
+ > .button {
247
+ &.left {
248
+ }
249
+
250
+ &.right {
251
+ }
252
+ }
253
+ }
254
+
255
+ > .titles {
256
+ > .title {
257
+ > h4 {
258
+ > span {
259
+ &::after {
260
+ }
261
+ }
262
+ }
263
+
264
+ > span {
265
+ }
266
+ }
267
+ }
268
+
269
+ > .columns {
270
+ > .column {
271
+ > .items {
272
+ &:has(> .no-item) {
273
+ }
274
+
275
+ &.dragging {
276
+ }
277
+
278
+ > .no-item {
279
+ &::after {
280
+ }
281
+
282
+ > span {
283
+ }
284
+ }
285
+ }
286
+ }
287
+ }
288
+ }
289
+ }
290
+
291
+ /* --- [TABLET & KÜÇÜK LAPTOP] --- */
292
+ /* Ekran 1024px ve altına düştüğünde çalışır */
293
+ @media (max-width: 1024px) {
294
+ }
@@ -74,8 +74,7 @@
74
74
  }
75
75
  }
76
76
 
77
- > .left,
78
- .right {
77
+ > .button {
79
78
  position: absolute;
80
79
  top: 50%;
81
80
  transform: translateY(-50%);
@@ -86,22 +85,20 @@
86
85
  backdrop-filter: blur(5px);
87
86
  width: 2rem;
88
87
  height: 2rem;
89
- border-radius: var(--border-radius);
90
- color: var(--blue);
91
- font-size: 1rem;
88
+ border-radius: var(--border-radius-sm);
92
89
  cursor: pointer;
93
90
  transition:
94
91
  visibility 0.25s,
95
92
  opacity 0.25s ease-in-out;
96
93
  z-index: 5;
97
- }
98
94
 
99
- > .left {
100
- left: 0;
101
- }
95
+ &.left {
96
+ left: 0;
97
+ }
102
98
 
103
- > .right {
104
- right: 0;
99
+ &.right {
100
+ right: 0;
101
+ }
105
102
  }
106
103
  }
107
104
 
@@ -191,52 +188,6 @@
191
188
  /* --- [MOBİL - STANDART] --- */
192
189
  /* Ekran 576px ve altına düştüğünde çalışır */
193
190
  @media (max-width: 576px) {
194
- .ar-tabs {
195
- > .tabs {
196
- padding: 0 2rem;
197
-
198
- > .container {
199
- > .item {
200
- &:not(:last-child) {
201
- &::after {
202
- }
203
- }
204
-
205
- &.selection {
206
- &::before {
207
- }
208
- }
209
-
210
- > .close-button {
211
- }
212
- }
213
- }
214
-
215
- > .left,
216
- .right {
217
- }
218
-
219
- > .left {
220
- }
221
-
222
- > .right {
223
- }
224
- }
225
-
226
- &.skeleton {
227
- > .tabs {
228
- > .item {
229
- > span {
230
- }
231
- }
232
- }
233
-
234
- > .content {
235
- &::before {
236
- }
237
- }
238
- }
239
- }
240
191
  }
241
192
 
242
193
  /* --- [TABLET DİKEY & BÜYÜK TELEFONLAR] --- */
@@ -263,14 +214,12 @@
263
214
  }
264
215
  }
265
216
 
266
- > .left,
267
- .right {
268
- }
269
-
270
- > .left {
271
- }
217
+ > .button {
218
+ &.left {
219
+ }
272
220
 
273
- > .right {
221
+ &.right {
222
+ }
274
223
  }
275
224
  }
276
225
 
@@ -3,5 +3,13 @@ interface IProps<T, TColumnProperties> {
3
3
  trackBy: (item: T) => string;
4
4
  columns: KanbanBoardColumnType<T, TColumnProperties>[];
5
5
  onChange?: (item: T, columnKey: string, columnProperties: TColumnProperties, hoverIndex: number) => void;
6
+ config?: {
7
+ safeAreaOffset?: {
8
+ top?: number;
9
+ right?: number;
10
+ bottom?: number;
11
+ left?: number;
12
+ };
13
+ };
6
14
  }
7
15
  export default IProps;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
2
  import IProps from "./IProps";
3
3
  import "../../../assets/css/components/data-display/kanban-board/styles.css";
4
- declare const KanbanBoard: <T, TColumnProperties>({ trackBy, columns, onChange }: IProps<T, TColumnProperties>) => React.JSX.Element;
4
+ declare const KanbanBoard: <T, TColumnProperties>({ trackBy, columns, onChange, config, }: IProps<T, TColumnProperties>) => React.JSX.Element;
5
5
  export default KanbanBoard;
@@ -2,10 +2,12 @@
2
2
  import React, { useEffect, useRef, useState } from "react";
3
3
  import "../../../assets/css/components/data-display/kanban-board/styles.css";
4
4
  import DnD from "../dnd";
5
- const KanbanBoard = function ({ trackBy, columns, onChange }) {
5
+ import { ARIcon } from "../../icons";
6
+ const KanbanBoard = function ({ trackBy, columns, onChange, config, }) {
6
7
  // refs
7
8
  const _kanbanWrapper = useRef(null);
8
9
  const _hoverItemIndex = useRef(null);
10
+ const _scrollInterval = useRef(null);
9
11
  const _scrollAnimationFrame = useRef(null);
10
12
  const _scrollSpeedRef = useRef(0); // px/frame
11
13
  // states
@@ -95,6 +97,21 @@ const KanbanBoard = function ({ trackBy, columns, onChange }) {
95
97
  if (item.classList.contains("dragging"))
96
98
  item.classList.remove("dragging");
97
99
  };
100
+ const handleStartScroll = (direction) => {
101
+ const el = _kanbanWrapper.current;
102
+ if (!el)
103
+ return;
104
+ handleStopScroll();
105
+ _scrollInterval.current = window.setInterval(() => {
106
+ el.scrollLeft += direction === "left" ? -10 : 10;
107
+ }, 16); // ~60fps
108
+ };
109
+ const handleStopScroll = () => {
110
+ if (_scrollInterval.current) {
111
+ clearInterval(_scrollInterval.current);
112
+ _scrollInterval.current = null;
113
+ }
114
+ };
98
115
  const stopScrolling = () => {
99
116
  if (_scrollAnimationFrame.current) {
100
117
  cancelAnimationFrame(_scrollAnimationFrame.current);
@@ -114,16 +131,23 @@ const KanbanBoard = function ({ trackBy, columns, onChange }) {
114
131
  };
115
132
  // useEffects
116
133
  useEffect(() => setData(columns), [columns]);
117
- return (React.createElement("div", { ref: _kanbanWrapper, className: "ar-kanban-board", onDragOver: handleBoardDragOver, onDragEnd: stopScrolling, onDrop: stopScrolling },
134
+ return (React.createElement("div", { ref: _kanbanWrapper, className: "ar-kanban-board", style: {
135
+ height: `calc(100dvh - (${_kanbanWrapper.current?.getBoundingClientRect().top}px + ${config?.safeAreaOffset?.bottom ?? 0}px))`,
136
+ }, onDragOver: handleBoardDragOver, onDragEnd: stopScrolling, onDrop: stopScrolling },
137
+ React.createElement("div", { className: "buttons" },
138
+ React.createElement("div", { className: "button left", onMouseDown: () => handleStartScroll("left"), onMouseUp: handleStopScroll, onMouseLeave: handleStopScroll },
139
+ React.createElement(ARIcon, { icon: "ArrowLeft" })),
140
+ React.createElement("div", { className: "button right", onMouseDown: () => handleStartScroll("right"), onMouseUp: handleStopScroll, onMouseLeave: handleStopScroll },
141
+ React.createElement(ARIcon, { icon: "ArrowRight" }))),
142
+ React.createElement("div", { className: "titles" }, data.map((board, index) => (React.createElement("div", { key: index, className: "title" },
143
+ React.createElement("h4", null,
144
+ React.createElement("span", { style: {
145
+ backgroundColor: darkenColor(board.titleColor ?? "", 1),
146
+ borderColor: darkenColor(board.titleColor ?? "", 1),
147
+ } }),
148
+ board.title.toLocaleUpperCase("tr")),
149
+ board.description && React.createElement("span", null, board.description))))),
118
150
  React.createElement("div", { className: "columns" }, data.map((board, index) => (React.createElement("div", { key: index, className: "column", onDrop: handleDrop(board.key) },
119
- React.createElement("div", { className: "title" },
120
- React.createElement("h4", null,
121
- React.createElement("span", { style: {
122
- backgroundColor: darkenColor(board.titleColor ?? "", 1),
123
- borderColor: darkenColor(board.titleColor ?? "", 1),
124
- } }),
125
- board.title.toLocaleUpperCase("tr")),
126
- board.description && React.createElement("span", null, board.description)),
127
151
  React.createElement("div", { className: "items", onDragOver: handleItemsDragOver, onDragLeave: handleItemsDragLeave, onDrop: handleItemsDrop },
128
152
  React.createElement(DnD, { key: board.key, data: board.items, renderItem: (item, index) => {
129
153
  return (React.createElement("div", { key: index, className: "item", onDragOver: (event) => {
@@ -80,9 +80,9 @@ const Tabs = ({ name, tabs = [], activeTab, onChange, onClose }) => {
80
80
  return React.createElement(Skeleton, { name: name, tabs: tabs });
81
81
  return (React.createElement("div", { className: "ar-tabs" },
82
82
  React.createElement("div", { className: "tabs" },
83
- scrollInfo.current > 0 && (React.createElement("div", { className: "left", onClick: () => scroll("left") },
83
+ scrollInfo.current > 0 && (React.createElement("div", { className: "button left", onClick: () => scroll("left") },
84
84
  React.createElement(ARIcon, { icon: "ArrowLeft", stroke: "var(--gray-700)" }))),
85
- !scrollInfo.isMaxRight && (React.createElement("div", { className: "right", onClick: () => scroll("right") },
85
+ !scrollInfo.isMaxRight && (React.createElement("div", { className: "button right", onClick: () => scroll("right") },
86
86
  React.createElement(ARIcon, { icon: "ArrowRight", stroke: "var(--gray-700)" }))),
87
87
  React.createElement("div", { ref: _container, className: "container", onScroll: handleScroll }, tabs.length > 0 &&
88
88
  tabs.map((tab, index) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.4.12",
3
+ "version": "0.4.13",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",