@ehfuse/overlay-scrollbar 1.0.0
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/LICENSE +21 -0
- package/README.md +223 -0
- package/dist/OverlayScrollbar.d.ts +43 -0
- package/dist/OverlayScrollbar.d.ts.map +1 -0
- package/dist/core/OverlayScrollbar.d.ts +43 -0
- package/dist/core/OverlayScrollbar.d.ts.map +1 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +392 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +397 -0
- package/dist/index.js.map +1 -0
- package/dist/src/OverlayScrollbar.d.ts +43 -0
- package/dist/src/OverlayScrollbar.d.ts.map +1 -0
- package/package.json +56 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
|
|
8
|
+
const OverlayScrollbar = react.forwardRef(({ children, onScroll, className, style }, ref) => {
|
|
9
|
+
const containerRef = react.useRef(null);
|
|
10
|
+
const contentRef = react.useRef(null);
|
|
11
|
+
const scrollbarRef = react.useRef(null);
|
|
12
|
+
const thumbRef = react.useRef(null);
|
|
13
|
+
// 웹킷 스크롤바 숨김을 위한 스타일
|
|
14
|
+
react.useEffect(() => {
|
|
15
|
+
const style = document.createElement("style");
|
|
16
|
+
style.textContent = `
|
|
17
|
+
.overlay-scrollbar-container::-webkit-scrollbar {
|
|
18
|
+
display: none !important;
|
|
19
|
+
width: 0 !important;
|
|
20
|
+
height: 0 !important;
|
|
21
|
+
background: transparent !important;
|
|
22
|
+
}
|
|
23
|
+
.overlay-scrollbar-container::-webkit-scrollbar-track {
|
|
24
|
+
display: none !important;
|
|
25
|
+
}
|
|
26
|
+
.overlay-scrollbar-container::-webkit-scrollbar-thumb {
|
|
27
|
+
display: none !important;
|
|
28
|
+
}
|
|
29
|
+
.overlay-scrollbar-container::-webkit-scrollbar-corner {
|
|
30
|
+
display: none !important;
|
|
31
|
+
}
|
|
32
|
+
.overlay-scrollbar-container * {
|
|
33
|
+
scrollbar-width: none;
|
|
34
|
+
-ms-overflow-style: none;
|
|
35
|
+
}
|
|
36
|
+
.overlay-scrollbar-container *::-webkit-scrollbar {
|
|
37
|
+
display: none !important;
|
|
38
|
+
width: 0 !important;
|
|
39
|
+
height: 0 !important;
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
document.head.appendChild(style);
|
|
43
|
+
return () => {
|
|
44
|
+
document.head.removeChild(style);
|
|
45
|
+
};
|
|
46
|
+
}, []);
|
|
47
|
+
const [scrollbarVisible, setScrollbarVisible] = react.useState(false);
|
|
48
|
+
const [trackVisible, setTrackVisible] = react.useState(false); // 트랙 표시 상태 추가
|
|
49
|
+
const [isDragging, setIsDragging] = react.useState(false);
|
|
50
|
+
const [dragStart, setDragStart] = react.useState({ y: 0, scrollTop: 0 });
|
|
51
|
+
const [thumbHeight, setThumbHeight] = react.useState(0);
|
|
52
|
+
const [thumbTop, setThumbTop] = react.useState(0);
|
|
53
|
+
// 스크롤바 표시/숨김 타이머
|
|
54
|
+
const hideTimeoutRef = react.useRef(null);
|
|
55
|
+
// ref를 통해 외부에서 스크롤 컨테이너에 접근할 수 있도록 함
|
|
56
|
+
react.useImperativeHandle(ref, () => ({
|
|
57
|
+
getScrollContainer: () => containerRef.current,
|
|
58
|
+
scrollTo: (options) => {
|
|
59
|
+
if (containerRef.current) {
|
|
60
|
+
containerRef.current.scrollTo(options);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
get scrollTop() {
|
|
64
|
+
var _a;
|
|
65
|
+
return ((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTop) || 0;
|
|
66
|
+
},
|
|
67
|
+
get scrollHeight() {
|
|
68
|
+
var _a;
|
|
69
|
+
return ((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.scrollHeight) || 0;
|
|
70
|
+
},
|
|
71
|
+
get clientHeight() {
|
|
72
|
+
var _a;
|
|
73
|
+
return ((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight) || 0;
|
|
74
|
+
},
|
|
75
|
+
}), []);
|
|
76
|
+
// 스크롤바 숨김 타이머 취소
|
|
77
|
+
const clearHideTimer = react.useCallback(() => {
|
|
78
|
+
if (hideTimeoutRef.current) {
|
|
79
|
+
clearTimeout(hideTimeoutRef.current);
|
|
80
|
+
hideTimeoutRef.current = null;
|
|
81
|
+
}
|
|
82
|
+
}, []);
|
|
83
|
+
// 스크롤바 숨김 타이머 설정
|
|
84
|
+
const setHideTimer = react.useCallback((delay) => {
|
|
85
|
+
clearHideTimer(); // 기존 타이머 취소
|
|
86
|
+
hideTimeoutRef.current = setTimeout(() => {
|
|
87
|
+
if (!isDragging) {
|
|
88
|
+
setScrollbarVisible(false);
|
|
89
|
+
setTrackVisible(false);
|
|
90
|
+
}
|
|
91
|
+
hideTimeoutRef.current = null;
|
|
92
|
+
}, delay);
|
|
93
|
+
}, [isDragging, clearHideTimer]);
|
|
94
|
+
// 스크롤 가능 여부 체크 함수
|
|
95
|
+
const isScrollable = react.useCallback(() => {
|
|
96
|
+
if (!containerRef.current || !contentRef.current)
|
|
97
|
+
return false;
|
|
98
|
+
const container = containerRef.current;
|
|
99
|
+
const content = contentRef.current;
|
|
100
|
+
return content.scrollHeight > container.clientHeight + 2;
|
|
101
|
+
}, []);
|
|
102
|
+
// 스크롤바 크기 및 위치 계산
|
|
103
|
+
const updateScrollbar = react.useCallback(() => {
|
|
104
|
+
if (!containerRef.current || !contentRef.current)
|
|
105
|
+
return;
|
|
106
|
+
const container = containerRef.current;
|
|
107
|
+
const content = contentRef.current;
|
|
108
|
+
const containerHeight = container.clientHeight;
|
|
109
|
+
const contentHeight = content.scrollHeight;
|
|
110
|
+
const scrollTop = container.scrollTop;
|
|
111
|
+
// console.log("스크롤바 업데이트:", {
|
|
112
|
+
// containerHeight,
|
|
113
|
+
// contentHeight,
|
|
114
|
+
// scrollTop,
|
|
115
|
+
// hasScrollableContent: contentHeight > containerHeight,
|
|
116
|
+
// });
|
|
117
|
+
// 스크롤 가능한 콘텐츠가 있는지 확인 (여유분 2px 추가로 더 정확한 판단)
|
|
118
|
+
if (contentHeight <= containerHeight + 2) {
|
|
119
|
+
// console.log("스크롤 불가능한 콘텐츠, 스크롤바 숨김");
|
|
120
|
+
setScrollbarVisible(false);
|
|
121
|
+
setTrackVisible(false);
|
|
122
|
+
clearHideTimer(); // 타이머도 정리
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
// 썸 높이 계산 (최소 20px, 최대 컨테이너의 90%)
|
|
126
|
+
const thumbHeightRatio = containerHeight / contentHeight;
|
|
127
|
+
const calculatedThumbHeight = Math.max(20, Math.min(containerHeight * 0.9, containerHeight * thumbHeightRatio));
|
|
128
|
+
// 썸 위치 계산
|
|
129
|
+
const scrollRatio = scrollTop / (contentHeight - containerHeight);
|
|
130
|
+
const maxThumbTop = containerHeight - calculatedThumbHeight;
|
|
131
|
+
const calculatedThumbTop = scrollRatio * maxThumbTop;
|
|
132
|
+
// console.log("썸 계산:", {
|
|
133
|
+
// thumbHeightRatio,
|
|
134
|
+
// calculatedThumbHeight,
|
|
135
|
+
// scrollRatio,
|
|
136
|
+
// calculatedThumbTop,
|
|
137
|
+
// maxThumbTop,
|
|
138
|
+
// });
|
|
139
|
+
setThumbHeight(calculatedThumbHeight);
|
|
140
|
+
setThumbTop(calculatedThumbTop);
|
|
141
|
+
}, []);
|
|
142
|
+
// 썸 드래그 시작
|
|
143
|
+
const handleThumbMouseDown = react.useCallback((event) => {
|
|
144
|
+
event.preventDefault();
|
|
145
|
+
event.stopPropagation();
|
|
146
|
+
if (!containerRef.current)
|
|
147
|
+
return;
|
|
148
|
+
setIsDragging(true);
|
|
149
|
+
setDragStart({
|
|
150
|
+
y: event.clientY,
|
|
151
|
+
scrollTop: containerRef.current.scrollTop,
|
|
152
|
+
});
|
|
153
|
+
setScrollbarVisible(true);
|
|
154
|
+
setTrackVisible(true); // 드래그 시 트랙 표시
|
|
155
|
+
clearHideTimer(); // 드래그 중에는 타이머 취소
|
|
156
|
+
}, [clearHideTimer]);
|
|
157
|
+
// 썸 드래그 중
|
|
158
|
+
const handleMouseMove = react.useCallback((event) => {
|
|
159
|
+
if (!isDragging || !containerRef.current || !contentRef.current)
|
|
160
|
+
return;
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
const container = containerRef.current;
|
|
163
|
+
const content = contentRef.current;
|
|
164
|
+
const containerHeight = container.clientHeight;
|
|
165
|
+
const contentHeight = content.scrollHeight;
|
|
166
|
+
const deltaY = event.clientY - dragStart.y;
|
|
167
|
+
const scrollableHeight = contentHeight - containerHeight;
|
|
168
|
+
const maxThumbTop = containerHeight - thumbHeight;
|
|
169
|
+
// 드래그 거리를 스크롤 거리로 변환
|
|
170
|
+
const scrollDelta = (deltaY / maxThumbTop) * scrollableHeight;
|
|
171
|
+
const newScrollTop = Math.max(0, Math.min(scrollableHeight, dragStart.scrollTop + scrollDelta));
|
|
172
|
+
container.scrollTop = newScrollTop;
|
|
173
|
+
updateScrollbar();
|
|
174
|
+
}, [isDragging, dragStart, thumbHeight, updateScrollbar]);
|
|
175
|
+
// 썸 드래그 종료
|
|
176
|
+
const handleMouseUp = react.useCallback(() => {
|
|
177
|
+
setIsDragging(false);
|
|
178
|
+
setTrackVisible(false); // 드래그 종료 시 트랙 숨김
|
|
179
|
+
setHideTimer(2000); // 2초 후 숨김
|
|
180
|
+
}, [setHideTimer]);
|
|
181
|
+
// 스크롤바 트랙 클릭
|
|
182
|
+
const handleTrackClick = react.useCallback((event) => {
|
|
183
|
+
if (!containerRef.current ||
|
|
184
|
+
!contentRef.current ||
|
|
185
|
+
!scrollbarRef.current)
|
|
186
|
+
return;
|
|
187
|
+
const scrollbar = scrollbarRef.current;
|
|
188
|
+
const rect = scrollbar.getBoundingClientRect();
|
|
189
|
+
const clickY = event.clientY - rect.top;
|
|
190
|
+
const container = containerRef.current;
|
|
191
|
+
const content = contentRef.current;
|
|
192
|
+
const containerHeight = container.clientHeight;
|
|
193
|
+
const contentHeight = content.scrollHeight;
|
|
194
|
+
const scrollRatio = clickY / containerHeight;
|
|
195
|
+
const newScrollTop = scrollRatio * (contentHeight - containerHeight);
|
|
196
|
+
container.scrollTop = Math.max(0, Math.min(contentHeight - containerHeight, newScrollTop));
|
|
197
|
+
updateScrollbar();
|
|
198
|
+
setScrollbarVisible(true);
|
|
199
|
+
setTrackVisible(true); // 클릭 시 트랙 표시
|
|
200
|
+
setHideTimer(2000); // 클릭 후 2초간 유지
|
|
201
|
+
}, [updateScrollbar, setHideTimer]);
|
|
202
|
+
// 이벤트 리스너 등록
|
|
203
|
+
react.useEffect(() => {
|
|
204
|
+
const container = containerRef.current;
|
|
205
|
+
if (!container)
|
|
206
|
+
return;
|
|
207
|
+
// 휠 이벤트 핸들러 (마우스 휠 스크롤 감지)
|
|
208
|
+
const handleWheel = () => {
|
|
209
|
+
clearHideTimer(); // 먼저 기존 타이머 취소
|
|
210
|
+
setScrollbarVisible(true);
|
|
211
|
+
// 휠 스크롤 시에는 트랙 숨김 (thumb만 표시)
|
|
212
|
+
updateScrollbar();
|
|
213
|
+
setHideTimer(700); // 0.7초 후 숨김
|
|
214
|
+
};
|
|
215
|
+
// 스크롤 이벤트 디바운스
|
|
216
|
+
const debouncedScroll = (event) => {
|
|
217
|
+
clearHideTimer(); // 먼저 기존 타이머 취소
|
|
218
|
+
setScrollbarVisible(true);
|
|
219
|
+
// 스크롤 시에도 트랙 숨김 (thumb만 표시)
|
|
220
|
+
updateScrollbar();
|
|
221
|
+
setHideTimer(700); // 0.7초 후 숨김
|
|
222
|
+
if (onScroll) {
|
|
223
|
+
onScroll(event);
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
container.addEventListener("scroll", debouncedScroll, {
|
|
227
|
+
passive: true,
|
|
228
|
+
});
|
|
229
|
+
container.addEventListener("wheel", handleWheel, { passive: true });
|
|
230
|
+
return () => {
|
|
231
|
+
container.removeEventListener("scroll", debouncedScroll);
|
|
232
|
+
container.removeEventListener("wheel", handleWheel);
|
|
233
|
+
};
|
|
234
|
+
}, [updateScrollbar, isDragging, onScroll, clearHideTimer, setHideTimer]);
|
|
235
|
+
// 마우스 이벤트 리스너 등록 (드래그)
|
|
236
|
+
react.useEffect(() => {
|
|
237
|
+
if (isDragging) {
|
|
238
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
239
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
240
|
+
return () => {
|
|
241
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
242
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
246
|
+
// 초기 스크롤바 계산 및 스크롤 감지
|
|
247
|
+
react.useEffect(() => {
|
|
248
|
+
const checkAndUpdateScrollbar = () => {
|
|
249
|
+
updateScrollbar();
|
|
250
|
+
// 초기에 스크롤 가능한 콘텐츠가 있는지 확인
|
|
251
|
+
const container = containerRef.current;
|
|
252
|
+
const content = contentRef.current;
|
|
253
|
+
if (container && content) {
|
|
254
|
+
const hasScrollableContent = content.scrollHeight > container.clientHeight + 2; // 여유분 2px 추가
|
|
255
|
+
// console.log("초기 스크롤바 체크:", {
|
|
256
|
+
// hasScrollableContent,
|
|
257
|
+
// contentScrollHeight: content.scrollHeight,
|
|
258
|
+
// containerClientHeight: container.clientHeight,
|
|
259
|
+
// });
|
|
260
|
+
if (hasScrollableContent) {
|
|
261
|
+
// 초기에는 스크롤바를 숨김 상태로 유지 (스크롤이나 hover 시에만 표시)
|
|
262
|
+
setScrollbarVisible(false);
|
|
263
|
+
setTrackVisible(false);
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
// 스크롤이 필요 없으면 확실히 숨김
|
|
267
|
+
setScrollbarVisible(false);
|
|
268
|
+
setTrackVisible(false);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
// 차트 렌더링을 고려하여 더 긴 지연시간 적용
|
|
273
|
+
const timeoutId = setTimeout(checkAndUpdateScrollbar, 200);
|
|
274
|
+
return () => clearTimeout(timeoutId);
|
|
275
|
+
}, [updateScrollbar, children, isDragging]);
|
|
276
|
+
// 리사이즈 옵저버
|
|
277
|
+
react.useEffect(() => {
|
|
278
|
+
const container = containerRef.current;
|
|
279
|
+
const content = contentRef.current;
|
|
280
|
+
if (!container || !content)
|
|
281
|
+
return;
|
|
282
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
283
|
+
// 차트 렌더링 지연을 고려하여 디바운스 적용
|
|
284
|
+
setTimeout(() => {
|
|
285
|
+
updateScrollbar();
|
|
286
|
+
}, 100);
|
|
287
|
+
});
|
|
288
|
+
resizeObserver.observe(container);
|
|
289
|
+
resizeObserver.observe(content);
|
|
290
|
+
return () => {
|
|
291
|
+
resizeObserver.disconnect();
|
|
292
|
+
};
|
|
293
|
+
}, [updateScrollbar]);
|
|
294
|
+
// 컴포넌트 언마운트 시 타이머 정리
|
|
295
|
+
react.useEffect(() => {
|
|
296
|
+
return () => {
|
|
297
|
+
if (hideTimeoutRef.current) {
|
|
298
|
+
clearTimeout(hideTimeoutRef.current);
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
}, []);
|
|
302
|
+
return (jsxRuntime.jsxs("div", { className: `overlay-scrollbar ${className || ""}`, style: Object.assign({ position: "relative", overflow: "hidden", display: "flex", flexGrow: 1, width: "100%" }, style), children: [jsxRuntime.jsx("div", { ref: containerRef, className: "overlay-scrollbar-container", style: {
|
|
303
|
+
display: "flex",
|
|
304
|
+
flexGrow: 1,
|
|
305
|
+
overflow: "auto",
|
|
306
|
+
scrollbarWidth: "none", // Firefox
|
|
307
|
+
msOverflowStyle: "none", // IE/Edge
|
|
308
|
+
}, children: jsxRuntime.jsx("div", { ref: contentRef, style: { height: "100%", width: "100%" }, children: children }) }), jsxRuntime.jsx("div", { style: {
|
|
309
|
+
position: "absolute",
|
|
310
|
+
top: 0,
|
|
311
|
+
right: 0,
|
|
312
|
+
width: 20, // 20px 넓은 hover 영역
|
|
313
|
+
height: "100%",
|
|
314
|
+
zIndex: 5,
|
|
315
|
+
pointerEvents: "auto",
|
|
316
|
+
}, onMouseEnter: () => {
|
|
317
|
+
// 스크롤 가능한 경우에만 스크롤바 표시
|
|
318
|
+
if (isScrollable()) {
|
|
319
|
+
clearHideTimer();
|
|
320
|
+
setScrollbarVisible(true);
|
|
321
|
+
setTrackVisible(true); // hover 시 트랙까지 표시
|
|
322
|
+
}
|
|
323
|
+
}, onMouseLeave: () => {
|
|
324
|
+
// 스크롤바 hover 영역에서 벗어남 시
|
|
325
|
+
if (!isDragging && isScrollable()) {
|
|
326
|
+
setTrackVisible(false); // 트랙 숨김
|
|
327
|
+
setHideTimer(1000); // 1초 후 숨김
|
|
328
|
+
}
|
|
329
|
+
} }), jsxRuntime.jsx("div", { ref: scrollbarRef, onClick: handleTrackClick, onMouseEnter: () => {
|
|
330
|
+
// 스크롤 가능한 경우에만 스크롤바 영역에 hover 시 타이머 취소하고 표시 유지
|
|
331
|
+
if (isScrollable()) {
|
|
332
|
+
clearHideTimer();
|
|
333
|
+
setScrollbarVisible(true);
|
|
334
|
+
setTrackVisible(true);
|
|
335
|
+
}
|
|
336
|
+
}, onMouseLeave: () => {
|
|
337
|
+
// 스크롤바 영역에서 벗어나면 일정 시간 후 숨김
|
|
338
|
+
if (!isDragging && isScrollable()) {
|
|
339
|
+
setHideTimer(1000);
|
|
340
|
+
}
|
|
341
|
+
}, className: `overlay-scrollbar-track ${scrollbarVisible ? "visible" : ""}`, style: {
|
|
342
|
+
position: "absolute",
|
|
343
|
+
top: 0,
|
|
344
|
+
right: 2,
|
|
345
|
+
width: 8,
|
|
346
|
+
height: "100%",
|
|
347
|
+
opacity: scrollbarVisible ? 1 : 0,
|
|
348
|
+
transition: "opacity 0.3s ease-in-out",
|
|
349
|
+
pointerEvents: scrollbarVisible ? "auto" : "none",
|
|
350
|
+
zIndex: 10,
|
|
351
|
+
cursor: "pointer",
|
|
352
|
+
borderRadius: "4px",
|
|
353
|
+
// trackVisible 상태에 따라 트랙 배경 표시
|
|
354
|
+
backgroundColor: trackVisible
|
|
355
|
+
? "rgba(200, 200, 200, 0.3)"
|
|
356
|
+
: "transparent",
|
|
357
|
+
}, onMouseOver: (e) => {
|
|
358
|
+
e.target.style.backgroundColor =
|
|
359
|
+
"rgba(0, 0, 0, 0.1)";
|
|
360
|
+
}, onMouseOut: (e) => {
|
|
361
|
+
e.target.style.backgroundColor =
|
|
362
|
+
trackVisible
|
|
363
|
+
? "rgba(200, 200, 200, 0.3)"
|
|
364
|
+
: "transparent";
|
|
365
|
+
}, children: jsxRuntime.jsx("div", { ref: thumbRef, onMouseDown: handleThumbMouseDown, style: {
|
|
366
|
+
position: "absolute",
|
|
367
|
+
top: `${thumbTop}px`,
|
|
368
|
+
left: 0,
|
|
369
|
+
width: "100%",
|
|
370
|
+
height: `${Math.max(thumbHeight, 30)}px`, // 최소 30px 보장
|
|
371
|
+
backgroundColor: isDragging
|
|
372
|
+
? "rgba(0, 0, 0, 0.7)"
|
|
373
|
+
: "rgba(0, 0, 0, 0.5)",
|
|
374
|
+
borderRadius: "4px",
|
|
375
|
+
cursor: "pointer",
|
|
376
|
+
minHeight: "30px", // CSS로도 최소 높이 보장
|
|
377
|
+
transition: isDragging
|
|
378
|
+
? "none"
|
|
379
|
+
: "background-color 0.2s ease, transform 0.1s ease",
|
|
380
|
+
transform: isDragging ? "scaleX(1.2)" : "scaleX(1)",
|
|
381
|
+
opacity: isDragging ? 1 : 0.4,
|
|
382
|
+
}, onMouseOver: (e) => {
|
|
383
|
+
e.target.style.opacity = "1";
|
|
384
|
+
e.target.style.transform =
|
|
385
|
+
"scaleX(1.1)";
|
|
386
|
+
}, onMouseOut: (e) => {
|
|
387
|
+
if (!isDragging) {
|
|
388
|
+
e.target.style.opacity = "0.4";
|
|
389
|
+
e.target.style.transform =
|
|
390
|
+
"scaleX(1)";
|
|
391
|
+
}
|
|
392
|
+
} }) })] }));
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
exports.OverlayScrollbar = OverlayScrollbar;
|
|
396
|
+
exports.default = OverlayScrollbar;
|
|
397
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/OverlayScrollbar.tsx"],"sourcesContent":[null],"names":["forwardRef","useRef","useEffect","useState","useImperativeHandle","useCallback","_jsxs","_jsx"],"mappings":";;;;;;;AAqDO,MAAM,gBAAgB,GAAGA,gBAAU,CAGxC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,GAAG,KAAI;AAChD,IAAA,MAAM,YAAY,GAAGC,YAAM,CAAiB,IAAI,CAAC;AACjD,IAAA,MAAM,UAAU,GAAGA,YAAM,CAAiB,IAAI,CAAC;AAC/C,IAAA,MAAM,YAAY,GAAGA,YAAM,CAAiB,IAAI,CAAC;AACjD,IAAA,MAAM,QAAQ,GAAGA,YAAM,CAAiB,IAAI,CAAC;;IAG7CC,eAAS,CAAC,MAAK;QACX,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;QAC7C,KAAK,CAAC,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;aAyBf;AACL,QAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAEhC,QAAA,OAAO,MAAK;AACR,YAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AACpC,QAAA,CAAC;IACL,CAAC,EAAE,EAAE,CAAC;IAEN,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAGC,cAAQ,CAAC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,WAAW;wBACnB;AACJ,oBAAA,CAAC,EAAA,CACH,EAAA,CACA,CAAA,EAAA,CACJ;AAEd,CAAC;;;;;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OverlayScrollbar.tsx
|
|
3
|
+
*
|
|
4
|
+
* A React component that provides a custom overlay scrollbar with smooth animations and auto-hide functionality
|
|
5
|
+
*
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @copyright 2025 KIM YOUNG JIN (ehfuse@gmail.com)
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
* in the Software without restriction, including without limitation the rights
|
|
12
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
* furnished to do so, subject to the following conditions:
|
|
15
|
+
*
|
|
16
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
* copies or substantial portions of the Software.
|
|
18
|
+
*
|
|
19
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
* SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
import React, { ReactNode } from "react";
|
|
28
|
+
interface OverlayScrollbarProps {
|
|
29
|
+
className?: string;
|
|
30
|
+
style?: React.CSSProperties;
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
onScroll?: (event: Event) => void;
|
|
33
|
+
}
|
|
34
|
+
export interface OverlayScrollbarRef {
|
|
35
|
+
getScrollContainer: () => HTMLDivElement | null;
|
|
36
|
+
scrollTo: (options: ScrollToOptions) => void;
|
|
37
|
+
scrollTop: number;
|
|
38
|
+
scrollHeight: number;
|
|
39
|
+
clientHeight: number;
|
|
40
|
+
}
|
|
41
|
+
export declare const OverlayScrollbar: React.ForwardRefExoticComponent<OverlayScrollbarProps & React.RefAttributes<OverlayScrollbarRef>>;
|
|
42
|
+
export default OverlayScrollbar;
|
|
43
|
+
//# sourceMappingURL=OverlayScrollbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverlayScrollbar.d.ts","sourceRoot":"","sources":["../../src/OverlayScrollbar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,EAKV,SAAS,EAGZ,MAAM,OAAO,CAAC;AAEf,UAAU,qBAAqB;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACrC;AAGD,MAAM,WAAW,mBAAmB;IAChC,kBAAkB,EAAE,MAAM,cAAc,GAAG,IAAI,CAAC;IAChD,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,gBAAgB,mGAogB3B,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ehfuse/overlay-scrollbar",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A React component that provides a custom overlay scrollbar with smooth animations and auto-hide functionality",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.esm.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "rollup -c",
|
|
16
|
+
"prepublishOnly": "npm run build",
|
|
17
|
+
"dev": "rollup -c -w",
|
|
18
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"react",
|
|
22
|
+
"scrollbar",
|
|
23
|
+
"overlay",
|
|
24
|
+
"custom-scrollbar",
|
|
25
|
+
"typescript",
|
|
26
|
+
"ui-component",
|
|
27
|
+
"smooth-scrolling",
|
|
28
|
+
"auto-hide"
|
|
29
|
+
],
|
|
30
|
+
"author": "KIM YOUNG JIN <ehfuse@gmail.com>",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/ehfuse/overlay-scrollbar.git"
|
|
35
|
+
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/ehfuse/overlay-scrollbar/issues"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/ehfuse/overlay-scrollbar#readme",
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"react": ">=16.8.0",
|
|
42
|
+
"react-dom": ">=16.8.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
46
|
+
"@rollup/plugin-typescript": "^11.1.5",
|
|
47
|
+
"@types/node": "^20.19.17",
|
|
48
|
+
"@types/react": "^18.2.31",
|
|
49
|
+
"@types/react-dom": "^18.2.14",
|
|
50
|
+
"rollup": "^4.1.4",
|
|
51
|
+
"rollup-plugin-dts": "^6.1.0",
|
|
52
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
53
|
+
"tslib": "^2.6.2",
|
|
54
|
+
"typescript": "^5.2.2"
|
|
55
|
+
}
|
|
56
|
+
}
|