@ehfuse/overlay-scrollbar 1.2.6 → 1.3.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/README.md +55 -202
- package/dist/index.d.ts +28 -12
- package/dist/index.esm.js +679 -104
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +678 -103
- package/dist/index.js.map +1 -1
- package/dist/src/OverlayScrollbar.d.ts +28 -12
- package/dist/src/OverlayScrollbar.d.ts.map +1 -1
- package/dist/src/utils/dragScrollUtils.d.ts +40 -0
- package/dist/src/utils/dragScrollUtils.d.ts.map +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -9,91 +9,41 @@ A highly customizable React component that provides a beautiful overlay scrollba
|
|
|
9
9
|
- **[Getting Started (English)](https://github.com/ehfuse/overlay-scrollbar/blob/main/docs/getting-started-en.md)** - Complete setup and usage guide
|
|
10
10
|
- **[시작하기 (한국어)](https://github.com/ehfuse/overlay-scrollbar/blob/main/docs/getting-started-ko.md)** - 설치 및 사용법 가이드
|
|
11
11
|
|
|
12
|
-
## Features
|
|
13
|
-
|
|
14
|
-
- 🎨 **Fully Customizable** - Control colors, sizes, radius, and positioning
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
- 🏹 **화살표 내비게이션** - 정밀한
|
|
30
|
-
- ⚡ **부드러운 애니메이션** -
|
|
31
|
-
- 🔍 **스마트 자동 숨김** -
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
## Installation
|
|
12
|
+
## ✨ Key Features
|
|
13
|
+
|
|
14
|
+
- 🎨 **Fully Customizable** - Control colors, sizes, radius, and positioning
|
|
15
|
+
- 🖱️ **Drag Scroll** - Mouse drag scrolling with smart UI library exclusion
|
|
16
|
+
- 🏹 **Arrow Navigation** - Optional arrow buttons for precise control
|
|
17
|
+
- ⚡ **Smooth Animations** - Fade transitions and hover effects
|
|
18
|
+
- 🔍 **Smart Auto-hide** - Intelligent visibility management
|
|
19
|
+
- 🧠 **Smart Input Detection** - Excludes interactive elements automatically
|
|
20
|
+
- 📦 **External Container Support** - Works with virtualized lists
|
|
21
|
+
- 🔧 **TypeScript** - Complete type definitions
|
|
22
|
+
- 🪶 **Zero Dependencies** - Only requires React
|
|
23
|
+
- ♿ **Accessible** - Preserves native scroll behavior
|
|
24
|
+
|
|
25
|
+
## ✨ 주요 기능
|
|
26
|
+
|
|
27
|
+
- 🎨 **완전한 커스터마이징** - 색상, 크기, 둥근 모서리, 위치 제어
|
|
28
|
+
- 🖱️ **드래그 스크롤** - UI 라이브러리 스마트 제외 기능을 가진 마우스 드래그 스크롤
|
|
29
|
+
- 🏹 **화살표 내비게이션** - 정밀한 제어를 위한 선택적 화살표 버튼
|
|
30
|
+
- ⚡ **부드러운 애니메이션** - 페이드 전환 및 호버 효과
|
|
31
|
+
- 🔍 **스마트 자동 숨김** - 지능적인 표시 관리
|
|
32
|
+
- 🧠 **스마트 입력 감지** - 인터랙티브 요소 자동 제외
|
|
33
|
+
- 📦 **외부 컨테이너 지원** - 가상화된 리스트와 연동
|
|
34
|
+
- 🔧 **TypeScript** - 완전한 타입 정의
|
|
35
|
+
- 🪶 **의존성 없음** - React만 필요
|
|
36
|
+
- ♿ **접근성** - 기본 스크롤 동작 보존
|
|
37
|
+
|
|
38
|
+
## 🚀 Installation
|
|
41
39
|
|
|
42
40
|
```bash
|
|
43
41
|
npm install @ehfuse/overlay-scrollbar
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
or
|
|
47
|
-
|
|
48
|
-
```bash
|
|
42
|
+
# or
|
|
49
43
|
yarn add @ehfuse/overlay-scrollbar
|
|
50
44
|
```
|
|
51
45
|
|
|
52
|
-
##
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
npm install @ehfuse/overlay-scrollbar
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
또는
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
yarn add @ehfuse/overlay-scrollbar
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Quick Start
|
|
65
|
-
|
|
66
|
-
For detailed setup instructions, see the [Getting Started Guide](https://github.com/ehfuse/overlay-scrollbar/blob/main/docs/getting-started-en.md).
|
|
67
|
-
|
|
68
|
-
```tsx
|
|
69
|
-
import React from "react";
|
|
70
|
-
import { OverlayScrollbar } from "@ehfuse/overlay-scrollbar";
|
|
71
|
-
|
|
72
|
-
function App() {
|
|
73
|
-
return (
|
|
74
|
-
<div style={{ height: "400px" }}>
|
|
75
|
-
<OverlayScrollbar
|
|
76
|
-
showArrows={true}
|
|
77
|
-
thumbRadius={6}
|
|
78
|
-
trackColor="rgba(0, 0, 0, 0.1)"
|
|
79
|
-
thumbColor="rgba(100, 100, 100, 0.7)"
|
|
80
|
-
arrowColor="rgba(80, 80, 80, 0.8)"
|
|
81
|
-
hideDelay={1500} // Auto-hide after 1.5s
|
|
82
|
-
hideDelayOnWheel={700} // Quick hide after wheel scroll
|
|
83
|
-
>
|
|
84
|
-
<div style={{ height: "1000px" }}>
|
|
85
|
-
{/* Your scrollable content here */}
|
|
86
|
-
<p>Content that requires scrolling...</p>
|
|
87
|
-
</div>
|
|
88
|
-
</OverlayScrollbar>
|
|
89
|
-
</div>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## 빠른 시작
|
|
95
|
-
|
|
96
|
-
자세한 설정 지침은 [시작하기 가이드](https://github.com/ehfuse/overlay-scrollbar/blob/main/docs/getting-started-ko.md)를 참조하세요.
|
|
46
|
+
## 📖 Quick Start
|
|
97
47
|
|
|
98
48
|
```tsx
|
|
99
49
|
import React from "react";
|
|
@@ -103,17 +53,18 @@ function App() {
|
|
|
103
53
|
return (
|
|
104
54
|
<div style={{ height: "400px" }}>
|
|
105
55
|
<OverlayScrollbar
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
56
|
+
thumb={{
|
|
57
|
+
width: 8,
|
|
58
|
+
color: "rgba(100, 100, 100, 0.7)",
|
|
59
|
+
}}
|
|
60
|
+
dragScroll={{
|
|
61
|
+
enabled: true,
|
|
62
|
+
excludeClasses: ["no-drag"],
|
|
63
|
+
}}
|
|
113
64
|
>
|
|
114
65
|
<div style={{ height: "1000px" }}>
|
|
115
|
-
|
|
116
|
-
<
|
|
66
|
+
<p>Your scrollable content here...</p>
|
|
67
|
+
<input type="text" placeholder="Auto-excluded from drag" />
|
|
117
68
|
</div>
|
|
118
69
|
</OverlayScrollbar>
|
|
119
70
|
</div>
|
|
@@ -121,134 +72,36 @@ function App() {
|
|
|
121
72
|
}
|
|
122
73
|
```
|
|
123
74
|
|
|
124
|
-
## API
|
|
75
|
+
## 🎯 Main API
|
|
125
76
|
|
|
126
|
-
###
|
|
127
|
-
|
|
128
|
-
The package exports TypeScript types for better development experience:
|
|
129
|
-
|
|
130
|
-
```tsx
|
|
131
|
-
import {
|
|
132
|
-
OverlayScrollbar,
|
|
133
|
-
OverlayScrollbarProps,
|
|
134
|
-
OverlayScrollbarRef,
|
|
135
|
-
} from "@ehfuse/overlay-scrollbar";
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### OverlayScrollbarProps
|
|
139
|
-
|
|
140
|
-
Interface for the component props:
|
|
77
|
+
### Configuration Objects (v1.3.0+)
|
|
141
78
|
|
|
142
79
|
```tsx
|
|
143
80
|
interface OverlayScrollbarProps {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
thumbMinHeight?: number; // Minimum height of thumb (default: 50px)
|
|
155
|
-
|
|
156
|
-
// Colors
|
|
157
|
-
trackColor?: string; // Track background color (default: "rgba(128, 128, 128, 0.1)")
|
|
158
|
-
thumbColor?: string; // Thumb color (default: "rgba(128, 128, 128, 0.6)")
|
|
159
|
-
thumbActiveColor?: string; // Thumb color when dragging (default: "rgba(128, 128, 128, 0.9)")
|
|
160
|
-
arrowColor?: string; // Arrow color (default: "rgba(128, 128, 128, 0.8)")
|
|
161
|
-
arrowActiveColor?: string; // Arrow color on hover (default: "rgba(64, 64, 64, 1.0)")
|
|
162
|
-
|
|
163
|
-
// Arrow Navigation
|
|
164
|
-
showArrows?: boolean; // Show arrow buttons (default: false)
|
|
165
|
-
arrowStep?: number; // Scroll distance per arrow click (default: 50px)
|
|
166
|
-
|
|
167
|
-
// Auto-hide Behavior
|
|
168
|
-
hideDelay?: number; // Default auto-hide delay (default: 1500ms)
|
|
169
|
-
hideDelayOnWheel?: number; // Auto-hide delay after wheel scroll (default: 700ms)
|
|
170
|
-
}
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### OverlayScrollbarRef
|
|
174
|
-
|
|
175
|
-
Interface for component methods accessible via ref:
|
|
176
|
-
|
|
177
|
-
```tsx
|
|
178
|
-
interface OverlayScrollbarRef {
|
|
179
|
-
getScrollContainer: () => HTMLDivElement | null;
|
|
180
|
-
scrollTo: (options: ScrollToOptions) => void;
|
|
181
|
-
scrollTop: number;
|
|
182
|
-
scrollHeight: number;
|
|
183
|
-
clientHeight: number;
|
|
81
|
+
// Grouped configuration objects
|
|
82
|
+
thumb?: ThumbConfig; // Scrollbar thumb settings
|
|
83
|
+
track?: TrackConfig; // Track area settings
|
|
84
|
+
arrows?: ArrowsConfig; // Arrow buttons settings
|
|
85
|
+
dragScroll?: DragScrollConfig; // Drag scroll settings
|
|
86
|
+
|
|
87
|
+
// General settings
|
|
88
|
+
hideDelay?: number; // Auto-hide delay (default: 1500ms)
|
|
89
|
+
hideDelayOnWheel?: number; // Quick hide after wheel (default: 700ms)
|
|
90
|
+
scrollContainer?: HTMLElement; // External container support
|
|
184
91
|
}
|
|
185
92
|
```
|
|
186
93
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
```tsx
|
|
190
|
-
import React, { useRef } from "react";
|
|
191
|
-
import {
|
|
192
|
-
OverlayScrollbar,
|
|
193
|
-
OverlayScrollbarProps,
|
|
194
|
-
OverlayScrollbarRef,
|
|
195
|
-
} from "@ehfuse/overlay-scrollbar";
|
|
196
|
-
|
|
197
|
-
const MyComponent: React.FC = () => {
|
|
198
|
-
const scrollRef = useRef<OverlayScrollbarRef>(null);
|
|
199
|
-
|
|
200
|
-
const scrollbarProps: OverlayScrollbarProps = {
|
|
201
|
-
showArrows: true,
|
|
202
|
-
thumbRadius: 6,
|
|
203
|
-
trackColor: "rgba(0, 0, 0, 0.1)",
|
|
204
|
-
thumbColor: "rgba(100, 100, 100, 0.7)",
|
|
205
|
-
hideDelay: 1500,
|
|
206
|
-
onScroll: (event) => {
|
|
207
|
-
console.log("Scrolled!", scrollRef.current?.scrollTop);
|
|
208
|
-
},
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
const handleScrollToTop = () => {
|
|
212
|
-
scrollRef.current?.scrollTo({ top: 0, behavior: "smooth" });
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
return (
|
|
216
|
-
<div style={{ height: "400px" }}>
|
|
217
|
-
<button onClick={handleScrollToTop}>Scroll to Top</button>
|
|
218
|
-
<OverlayScrollbar ref={scrollRef} {...scrollbarProps}>
|
|
219
|
-
<div style={{ height: "1000px" }}>Your content here...</div>
|
|
220
|
-
</OverlayScrollbar>
|
|
221
|
-
</div>
|
|
222
|
-
);
|
|
223
|
-
};
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
## Browser Support
|
|
94
|
+
## 🌍 Browser Support
|
|
227
95
|
|
|
228
96
|
- Chrome/Edge: Full support
|
|
229
97
|
- Firefox: Full support
|
|
230
98
|
- Safari: Full support
|
|
231
|
-
- Mobile
|
|
232
|
-
|
|
233
|
-
## 브라우저 지원
|
|
99
|
+
- Mobile: Touch scrolling supported
|
|
234
100
|
|
|
235
|
-
|
|
236
|
-
- Firefox: 완전 지원
|
|
237
|
-
- Safari: 완전 지원
|
|
238
|
-
- 모바일 브라우저: 터치 스크롤 지원, 모바일에서는 오버레이 스크롤바 숨김
|
|
239
|
-
|
|
240
|
-
## License
|
|
101
|
+
## 📄 License
|
|
241
102
|
|
|
242
103
|
MIT © [KIM YOUNG JIN](mailto:ehfuse@gmail.com)
|
|
243
104
|
|
|
244
|
-
##
|
|
245
|
-
|
|
246
|
-
1. Fork the repository
|
|
247
|
-
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
248
|
-
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
249
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
250
|
-
5. Open a Pull Request
|
|
251
|
-
|
|
252
|
-
## Issues
|
|
105
|
+
## 🐛 Issues
|
|
253
106
|
|
|
254
107
|
If you find any bugs or have feature requests, please create an issue on [GitHub](https://github.com/ehfuse/overlay-scrollbar/issues).
|
package/dist/index.d.ts
CHANGED
|
@@ -24,24 +24,40 @@ import React, { ReactNode } from 'react';
|
|
|
24
24
|
* SOFTWARE.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
+
interface ThumbConfig {
|
|
28
|
+
width?: number;
|
|
29
|
+
minHeight?: number;
|
|
30
|
+
radius?: number;
|
|
31
|
+
color?: string;
|
|
32
|
+
activeColor?: string;
|
|
33
|
+
}
|
|
34
|
+
interface TrackConfig {
|
|
35
|
+
width?: number;
|
|
36
|
+
color?: string;
|
|
37
|
+
visible?: boolean;
|
|
38
|
+
}
|
|
39
|
+
interface ArrowsConfig {
|
|
40
|
+
visible?: boolean;
|
|
41
|
+
step?: number;
|
|
42
|
+
color?: string;
|
|
43
|
+
activeColor?: string;
|
|
44
|
+
}
|
|
45
|
+
interface DragScrollConfig {
|
|
46
|
+
enabled?: boolean;
|
|
47
|
+
excludeClasses?: string[];
|
|
48
|
+
excludeSelectors?: string[];
|
|
49
|
+
}
|
|
27
50
|
interface OverlayScrollbarProps {
|
|
28
51
|
className?: string;
|
|
29
52
|
style?: React.CSSProperties;
|
|
30
53
|
children: ReactNode;
|
|
31
54
|
onScroll?: (event: Event) => void;
|
|
32
|
-
|
|
33
|
-
|
|
55
|
+
scrollContainer?: HTMLElement | null;
|
|
56
|
+
thumb?: ThumbConfig;
|
|
57
|
+
track?: TrackConfig;
|
|
58
|
+
arrows?: ArrowsConfig;
|
|
59
|
+
dragScroll?: DragScrollConfig;
|
|
34
60
|
showScrollbar?: boolean;
|
|
35
|
-
showArrows?: boolean;
|
|
36
|
-
arrowStep?: number;
|
|
37
|
-
trackWidth?: number;
|
|
38
|
-
thumbWidth?: number;
|
|
39
|
-
thumbMinHeight?: number;
|
|
40
|
-
trackColor?: string;
|
|
41
|
-
thumbColor?: string;
|
|
42
|
-
thumbActiveColor?: string;
|
|
43
|
-
arrowColor?: string;
|
|
44
|
-
arrowActiveColor?: string;
|
|
45
61
|
hideDelay?: number;
|
|
46
62
|
hideDelayOnWheel?: number;
|
|
47
63
|
}
|