bkui-vue 2.0.1-beta.34.scrollbar.3 → 2.0.1-beta.35

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.
Files changed (45) hide show
  1. package/dist/index.cjs.js +58 -58
  2. package/dist/index.esm.js +15304 -15301
  3. package/dist/index.umd.js +59 -59
  4. package/dist/style.css +1 -1
  5. package/dist/style.variable.css +1 -1
  6. package/lib/index.js +1 -1
  7. package/lib/scrollbar/index.d.ts +12 -129
  8. package/lib/scrollbar/index.js +18490 -1338
  9. package/lib/scrollbar/scrollbar-core/can-use-dom.d.ts +2 -0
  10. package/lib/scrollbar/scrollbar-core/helpers.d.ts +5 -0
  11. package/lib/scrollbar/scrollbar-core/index.d.ts +242 -0
  12. package/lib/scrollbar/scrollbar-core/mouse-wheel.d.ts +5 -0
  13. package/lib/scrollbar/scrollbar-core/scrollbar-width.d.ts +1 -0
  14. package/lib/scrollbar/scrollbar.css +75 -91
  15. package/lib/scrollbar/scrollbar.less +91 -111
  16. package/lib/scrollbar/scrollbar.variable.css +74 -90
  17. package/lib/styles/index.d.ts +0 -1
  18. package/lib/table/hooks/use-pagination.d.ts +1 -1
  19. package/lib/table/index.js +21 -11
  20. package/lib/table/props.d.ts +5 -2
  21. package/lib/table/table.css +85 -90
  22. package/lib/table/table.less +4 -0
  23. package/lib/table/table.variable.css +85 -90
  24. package/lib/tree/index.js +31 -9
  25. package/lib/tree/tree.css +83 -91
  26. package/lib/tree/tree.variable.css +83 -91
  27. package/lib/tree/use-node-action.d.ts +2 -1
  28. package/lib/virtual-render/index.js +71 -46
  29. package/lib/virtual-render/use-scrollbar.d.ts +17 -3
  30. package/lib/virtual-render/virtual-render.css +82 -90
  31. package/lib/virtual-render/virtual-render.less +10 -1
  32. package/lib/virtual-render/virtual-render.variable.css +82 -90
  33. package/package.json +1 -1
  34. package/lib/scrollbar/handlers/click-rail.d.ts +0 -2
  35. package/lib/scrollbar/handlers/drag-thumb.d.ts +0 -1
  36. package/lib/scrollbar/handlers/keyboard.d.ts +0 -2
  37. package/lib/scrollbar/handlers/mouse-wheel.d.ts +0 -2
  38. package/lib/scrollbar/handlers/touch.d.ts +0 -4
  39. package/lib/scrollbar/helper/class-names.d.ts +0 -21
  40. package/lib/scrollbar/helper/css.d.ts +0 -3
  41. package/lib/scrollbar/helper/dom.d.ts +0 -4
  42. package/lib/scrollbar/helper/event-manager.d.ts +0 -20
  43. package/lib/scrollbar/helper/util.d.ts +0 -11
  44. package/lib/scrollbar/process-scroll-diff.d.ts +0 -1
  45. package/lib/scrollbar/update-geometry.d.ts +0 -8
@@ -0,0 +1,2 @@
1
+ declare const _default: () => boolean;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ export declare function getElementWindow(element: Element): Window & typeof globalThis;
2
+ export declare function getElementDocument(element: Element): Document;
3
+ export declare function addClasses(el: HTMLElement | null, classes: string): void;
4
+ export declare function removeClasses(el: HTMLElement | null, classes: string): void;
5
+ export declare function classNamesToQuery(classNames: string): string;
@@ -0,0 +1,242 @@
1
+ import * as helpers from './helpers';
2
+ interface DebouncedFunc<T extends (...args: any[]) => void> {
3
+ /**
4
+ * Call the original function, but applying the debounce rules.
5
+ *
6
+ * If the debounced function can be run immediately, this calls it and returns its return
7
+ * value.
8
+ *
9
+ * Otherwise, it returns the return value of the last invocation, or undefined if the debounced
10
+ * function was not invoked yet.
11
+ */
12
+ (...args: Parameters<T>): ReturnType<T> | undefined;
13
+ /**
14
+ * Throw away any pending invocation of the debounced function.
15
+ */
16
+ cancel(): void;
17
+ /**
18
+ * If there is a pending invocation of the debounced function, invoke it immediately and return
19
+ * its return value.
20
+ *
21
+ * Otherwise, return the value from the last invocation, or undefined if the debounced function
22
+ * was never invoked.
23
+ */
24
+ flush(): ReturnType<T> | undefined;
25
+ }
26
+ export interface Options {
27
+ forceVisible: Axis | boolean;
28
+ clickOnTrack: boolean;
29
+ scrollbarMinSize: number;
30
+ scrollbarMaxSize: number;
31
+ classNames: Partial<ClassNames>;
32
+ ariaLabel: string;
33
+ contentNode: HTMLElement | null;
34
+ delegateYContent: HTMLElement | null;
35
+ delegateXContent: HTMLElement | null;
36
+ wrapperNode: HTMLElement | null;
37
+ autoHide: boolean;
38
+ useSystemScrollXBehavior?: boolean;
39
+ useSystemScrollYBehavior?: boolean;
40
+ size: 'default' | 'small';
41
+ scrollDelegate: {
42
+ scrollHeight?: number;
43
+ scrollWidth?: number;
44
+ };
45
+ onScrollCallback?: (args: {
46
+ x: number;
47
+ y: number;
48
+ }) => void;
49
+ }
50
+ export type BkScrollBarOptions = Partial<Options>;
51
+ type ClassNames = {
52
+ contentEl: string;
53
+ offset: string;
54
+ mask: string;
55
+ wrapper: string;
56
+ placeholder: string;
57
+ scrollbar: string;
58
+ track: string;
59
+ visible: string;
60
+ horizontal: string;
61
+ vertical: string;
62
+ hover: string;
63
+ dragging: string;
64
+ scrolling: string;
65
+ scrollable: string;
66
+ mouseEntered: string;
67
+ };
68
+ type Axis = 'x' | 'y';
69
+ type AxisProps = {
70
+ scrollOffsetAttr: 'scrollLeft' | 'scrollTop';
71
+ sizeAttr: 'height' | 'width';
72
+ scrollSizeAttr: 'scrollHeight' | 'scrollWidth';
73
+ offsetSizeAttr: 'offsetHeight' | 'offsetWidth';
74
+ offsetAttr: 'left' | 'top';
75
+ overflowAttr: 'overflowX' | 'overflowY';
76
+ dragOffset: number;
77
+ isOverflowing: boolean;
78
+ forceVisible: boolean;
79
+ track: {
80
+ size: number;
81
+ el: HTMLElement | null;
82
+ rect: DOMRect | null;
83
+ isVisible: boolean;
84
+ };
85
+ scrollbar: {
86
+ size: number;
87
+ el: HTMLElement | null;
88
+ rect: DOMRect | null;
89
+ isVisible: boolean;
90
+ };
91
+ };
92
+ type RtlHelpers = {
93
+ isScrollOriginAtZero: boolean;
94
+ isScrollingToNegative: boolean;
95
+ } | null;
96
+ type DefaultOptions = Options & typeof BkScrollbarCore.defaultOptions;
97
+ type MouseWheelInstance = {
98
+ addWheelEvent: (target: HTMLElement) => void;
99
+ removeWheelEvent: (target: HTMLElement) => void;
100
+ };
101
+ export default class BkScrollbarCore {
102
+ static rtlHelpers: RtlHelpers;
103
+ static defaultOptions: Options;
104
+ /**
105
+ * Static functions
106
+ */
107
+ static helpers: typeof helpers;
108
+ /**
109
+ * Helper to fix browsers inconsistency on RTL:
110
+ * - Firefox inverts the scrollbar initial position
111
+ * - IE11 inverts both scrollbar position and scrolling offset
112
+ */
113
+ static getRtlHelpers(): {
114
+ isScrollOriginAtZero: boolean;
115
+ isScrollingToNegative: boolean;
116
+ };
117
+ static getOffset(el: Element): {
118
+ top: number;
119
+ left: number;
120
+ };
121
+ el: HTMLElement;
122
+ options: DefaultOptions;
123
+ classNames: ClassNames;
124
+ axis: {
125
+ x: AxisProps;
126
+ y: AxisProps;
127
+ };
128
+ draggedAxis?: Axis;
129
+ removePreventClickId: null | number;
130
+ minScrollbarWidth: number;
131
+ stopScrollDelay: number;
132
+ isScrolling: boolean;
133
+ isMouseEntering: boolean;
134
+ isDragging: boolean;
135
+ scrollXTicking: boolean;
136
+ scrollYTicking: boolean;
137
+ wrapperEl: HTMLElement | null;
138
+ contentEl: HTMLElement | null;
139
+ delegateXContent: HTMLElement | null;
140
+ delegateYContent: HTMLElement | null;
141
+ rtlHelpers: RtlHelpers;
142
+ scrollbarWidth: number;
143
+ resizeObserver: ResizeObserver | null;
144
+ mutationObserver: MutationObserver | null;
145
+ elStyles: CSSStyleDeclaration | null;
146
+ isRtl: boolean | null;
147
+ mouseX: number;
148
+ mouseY: number;
149
+ mouseWheelInstance: MouseWheelInstance;
150
+ wheelOffsetY: number;
151
+ wheelOffsetX: number;
152
+ mouseWeelTimer: any;
153
+ /**
154
+ * 最外层滚动容器滚动实际位置缓存器
155
+ */
156
+ wrapperScrollValue: {
157
+ scrollTop: number;
158
+ scrollLeft: number;
159
+ };
160
+ /**
161
+ * 模拟滚动条内部缩略滚动器滚动位置缓存器
162
+ */
163
+ wrapperScrollMap: {};
164
+ onMouseMove: (() => void) | DebouncedFunc<(...args: any[]) => void>;
165
+ onWindowResize: (() => void) | DebouncedFunc<(...args: any[]) => void>;
166
+ onStopScrolling: (() => void) | DebouncedFunc<(...args: any[]) => void>;
167
+ onMouseEntered: (() => void) | DebouncedFunc<(...args: any[]) => void>;
168
+ onMouseWheel: (() => void) | DebouncedFunc<(...args: any[]) => void>;
169
+ constructor(element: HTMLElement, options?: Partial<Options>);
170
+ getScrollbarWidth(): number;
171
+ init(): void;
172
+ initDOM(): void;
173
+ initListeners(): void;
174
+ getWrapperElScrollSize(attrName: string, target?: HTMLElement): any;
175
+ recalculate(): void;
176
+ /**
177
+ * Calculate scrollbar size
178
+ */
179
+ getScrollbarSize(axis?: Axis): any;
180
+ positionScrollbar(axis?: Axis): void;
181
+ toggleTrackVisibility(axis?: Axis): void;
182
+ showScrollbar(axis?: Axis): void;
183
+ hideScrollbar(axis?: Axis): void;
184
+ /**
185
+ * On scroll event handling
186
+ */
187
+ onScroll: () => void;
188
+ scrollX: () => void;
189
+ scrollY: () => void;
190
+ onMouseEnter: () => void;
191
+ onMouseMoveForAxis(axis?: Axis): void;
192
+ onMouseLeave: () => void;
193
+ onMouseLeaveForAxis(axis?: Axis): void;
194
+ onPointerEvent: (e: PointerEvent) => void;
195
+ /**
196
+ * on scrollbar handle drag movement starts
197
+ */
198
+ onDragStart(e: MouseEvent, axis?: Axis): void;
199
+ /**
200
+ * Drag scrollbar handle
201
+ */
202
+ drag: (e: MouseEvent) => void;
203
+ getPointerPosition: (dragPos: number, axis: Axis) => number;
204
+ scrollToAxisPosition: (scrollPos: number, axisValue: Axis) => boolean;
205
+ fixedScrollTo: (axisValue: Axis, resolvedValue: number) => void;
206
+ /**
207
+ * End scroll handle drag
208
+ */
209
+ onEndDrag: (e: MouseEvent) => void;
210
+ /**
211
+ * Handler to ignore click events during drag
212
+ */
213
+ preventClick: (e: MouseEvent) => void;
214
+ onTrackClick(e: MouseEvent, axis?: Axis): void;
215
+ /**
216
+ * Getter for content element
217
+ */
218
+ getContentElement(): HTMLElement;
219
+ /**
220
+ * Getter for original scrolling element
221
+ */
222
+ getScrollElement(): HTMLElement;
223
+ removeListeners(): void;
224
+ /**
225
+ * Remove all listeners from DOM nodes
226
+ */
227
+ unMount(): void;
228
+ /**
229
+ * Check if mouse is within bounds
230
+ */
231
+ isWithinBounds(bbox: DOMRect): boolean;
232
+ /**
233
+ * Find element children matches query
234
+ */
235
+ findChild(el: HTMLElement, query: string): any;
236
+ private mOnMouseWheel;
237
+ private mOnStopScrolling;
238
+ private mOnMouseEntered;
239
+ private mOnMouseMove;
240
+ private mOnWindowResize;
241
+ }
242
+ export {};
@@ -0,0 +1,5 @@
1
+ declare const _default: (fn: any) => {
2
+ addWheelEvent: (target: HTMLElement) => void;
3
+ removeWheelEvent: (target: HTMLElement) => void;
4
+ };
5
+ export default _default;
@@ -0,0 +1 @@
1
+ export default function scrollbarWidth(): number;
@@ -128,113 +128,97 @@
128
128
  --select-active-color: #e1ecff;
129
129
  --select-hover-color: #f5f7fa;
130
130
  }
131
- .bk-scrollbar {
132
- overflow: hidden !important;
133
- overflow-anchor: none;
134
- touch-action: auto;
135
- /*
136
- * Scrollbar rail styles
137
- */
138
- /*
139
- * Scrollbar thumb styles
140
- */
141
- }
142
- .bk-scrollbar.bk--active-x > .bk__rail-x,
143
- .bk-scrollbar.bk--active-y > .bk__rail-y {
144
- display: block;
145
- }
146
- .bk-scrollbar .bk__rail-x:hover,
147
- .bk-scrollbar .bk__rail-y:hover,
148
- .bk-scrollbar .bk__rail-x:focus,
149
- .bk-scrollbar .bk__rail-y:focus,
150
- .bk-scrollbar .bk__rail-x.bk--clicking,
151
- .bk-scrollbar .bk__rail-y.bk--clicking {
152
- background-color: #f0f1f5;
153
- }
154
- .bk-scrollbar .bk__rail-x {
155
- display: none;
156
- opacity: 0;
157
- transition: background-color 0.2s linear, opacity 0.2s linear;
158
- height: 10px;
159
- bottom: 0px;
160
- position: absolute;
161
- margin-bottom: 2px;
162
- }
163
- .bk-scrollbar .bk__rail-x.bk-scroll-size-small {
164
- height: 8px;
131
+ .bk-scrollbar-wrapper {
132
+ position: relative;
133
+ overflow: hidden;
165
134
  }
166
- .bk-scrollbar .bk__rail-x.bk-scroll-size-small .bk__thumb-x {
167
- height: 6px;
135
+ .bk-scrollbar-wrapper .bk-scrollbar-content-el {
136
+ display: inline-flex;
137
+ flex-direction: column;
138
+ width: 100%;
168
139
  }
169
- .bk-scrollbar .bk__rail-y {
170
- display: none;
171
- opacity: 0;
172
- transition: background-color 0.2s linear, opacity 0.2s linear;
173
- width: 10px;
174
- right: 0px;
140
+ .bk-scrollbar-wrapper .bk-scrollbar-track {
141
+ z-index: 1;
175
142
  position: absolute;
176
- margin-right: 2px;
177
- }
178
- .bk-scrollbar .bk__rail-y.bk-scroll-size-small {
179
- width: 8px;
143
+ right: 0;
144
+ bottom: 0;
145
+ pointer-events: none;
146
+ overflow: hidden;
180
147
  }
181
- .bk-scrollbar .bk__rail-y.bk-scroll-size-small .bk__thumb-y {
148
+ .bk-scrollbar-wrapper .bk-scrollbar-track.track-small.bk-scrollbar-vertical {
182
149
  width: 6px;
183
150
  }
184
- .bk-scrollbar:hover > .bk__rail-x,
185
- .bk-scrollbar:hover > .bk__rail-y,
186
- .bk-scrollbar.bk--focus > .bk__rail-x,
187
- .bk-scrollbar.bk--focus > .bk__rail-y,
188
- .bk-scrollbar.bk--scrolling-x > .bk__rail-x,
189
- .bk-scrollbar.bk--scrolling-y > .bk__rail-y {
190
- opacity: 0.9;
151
+ .bk-scrollbar-wrapper .bk-scrollbar-track.track-small.bk-scrollbar-vertical.bk-scrollbar-hover {
152
+ width: 8px;
153
+ }
154
+ .bk-scrollbar-wrapper .bk-scrollbar-track.track-small.bk-scrollbar-horizontal {
155
+ height: 6px;
191
156
  }
192
- .bk-scrollbar .bk__thumb-x {
193
- background-color: #dcdee5;
194
- border-radius: 8px;
195
- transition: background-color 0.2s linear, height 0.2s ease-in-out;
157
+ .bk-scrollbar-wrapper .bk-scrollbar-track.track-small.bk-scrollbar-horizontal.bk-scrollbar-hover {
196
158
  height: 8px;
197
- bottom: 0px;
198
- position: absolute;
199
159
  }
200
- .bk-scrollbar .bk__thumb-y {
201
- background-color: #dcdee5;
202
- border-radius: 8px;
203
- transition: background-color 0.2s linear, width 0.2s ease-in-out;
204
- width: 8px;
205
- right: 0px;
206
- position: absolute;
160
+ .bk-scrollbar-wrapper .bk-scrollbar-track.bk-scrollbar-hover {
161
+ background-color: #f0f1f5;
162
+ cursor: pointer;
207
163
  }
208
- .bk-scrollbar .bk__rail-x:hover > .bk__thumb-x,
209
- .bk-scrollbar .bk__rail-x:focus > .bk__thumb-x,
210
- .bk-scrollbar .bk__rail-x.bk--clicking .bk__thumb-x {
164
+ .bk-scrollbar-wrapper .bk-scrollbar-track.bk-scrollbar-hover .bk-scrollbar::before {
211
165
  background-color: #979ba5;
212
- height: 10px;
213
166
  }
214
- .bk-scrollbar .bk__rail-y:hover > .bk__thumb-y,
215
- .bk-scrollbar .bk__rail-y:focus > .bk__thumb-y,
216
- .bk-scrollbar .bk__rail-y.bk--clicking .bk__thumb-y {
217
- background-color: #979ba5;
167
+ .bk-scrollbar-wrapper .bk-scrollbar-track.bk-scrollbar-vertical {
168
+ top: 0;
169
+ width: 8px;
170
+ transform: translate(var(--scroll-offset-x), var(--scroll-offset-y));
171
+ }
172
+ .bk-scrollbar-wrapper .bk-scrollbar-track.bk-scrollbar-vertical.bk-scrollbar-hover {
218
173
  width: 10px;
219
174
  }
220
- .bk-scrollbar .bk-scroll-size-small > .bk__thumb-x,
221
- .bk-scrollbar .bk-scroll-size-small > .bk__thumb-x,
222
- .bk-scrollbar .bk-scroll-size-small.bk--clicking .bk__thumb-x {
175
+ .bk-scrollbar-wrapper .bk-scrollbar-track.bk-scrollbar-horizontal {
176
+ left: 0;
223
177
  height: 8px;
178
+ transform: translate(var(--scroll-offset-x), var(--scroll-offset-y));
224
179
  }
225
- .bk-scrollbar .bk-scroll-size-small:hover > .bk__thumb-y,
226
- .bk-scrollbar .bk-scroll-size-small:focus > .bk__thumb-y,
227
- .bk-scrollbar .bk-scroll-size-small.bk--clicking .bk__thumb-y {
228
- width: 8px;
180
+ .bk-scrollbar-wrapper .bk-scrollbar-track.bk-scrollbar-horizontal.bk-scrollbar-hover {
181
+ height: 10px;
229
182
  }
230
- /* MS supports */
231
- @supports (-ms-overflow-style: none) {
232
- .bk-scrollbar {
233
- overflow: auto !important;
234
- }
183
+ .bk-scrollbar-wrapper .bk-scrollbar-track.bk-scrollbar-horizontal.bk-scrollbar {
184
+ right: auto;
185
+ left: 0;
186
+ top: 0;
187
+ bottom: 0;
188
+ min-height: 0;
189
+ min-width: 8px;
190
+ width: auto;
191
+ }
192
+ .bk-scrollbar-wrapper .bk-scrollbar-dragging {
193
+ pointer-events: none;
194
+ -webkit-touch-callout: none;
195
+ -webkit-user-select: none;
196
+ -khtml-user-select: none;
197
+ -moz-user-select: none;
198
+ -ms-user-select: none;
199
+ user-select: none;
200
+ }
201
+ .bk-scrollbar-wrapper .bk-scrollbar {
202
+ position: absolute;
203
+ left: 0;
204
+ right: 0;
205
+ top: 0;
206
+ bottom: 0;
235
207
  }
236
- @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
237
- .bk-scrollbar {
238
- overflow: auto !important;
239
- }
208
+ .bk-scrollbar-wrapper .bk-scrollbar::before {
209
+ position: absolute;
210
+ content: '';
211
+ background: #dcdee5;
212
+ border-radius: 6px;
213
+ left: 0;
214
+ right: 0;
215
+ top: 0;
216
+ bottom: 0;
217
+ opacity: 0;
218
+ transition: opacity 0.2s 0.9s linear;
219
+ }
220
+ .bk-scrollbar-wrapper .bk-scrollbar.bk-scrollbar-visible::before {
221
+ opacity: 0.9;
222
+ transition-delay: 0s;
223
+ transition-duration: 0s;
240
224
  }
@@ -1,139 +1,119 @@
1
1
  @import '../styles/themes/themes.less';
2
2
 
3
- .@{bk-prefix}-scrollbar {
4
- overflow: hidden !important;
5
- overflow-anchor: none;
6
- touch-action: auto;
7
-
8
- &.@{bk-prefix}--active-x > .@{bk-prefix}__rail-x,
9
- &.@{bk-prefix}--active-y > .@{bk-prefix}__rail-y {
10
- display: block;
3
+ .@{bk-prefix}-scrollbar-wrapper {
4
+ position: relative;
5
+ overflow: hidden;
6
+
7
+ .@{bk-prefix}-scrollbar-content-el {
8
+ display: inline-flex;
9
+ flex-direction: column;
10
+ width: 100%;
11
11
  }
12
12
 
13
- .@{bk-prefix}__rail-x:hover,
14
- .@{bk-prefix}__rail-y:hover,
15
- .@{bk-prefix}__rail-x:focus,
16
- .@{bk-prefix}__rail-y:focus,
17
- .@{bk-prefix}__rail-x.@{bk-prefix}--clicking,
18
- .@{bk-prefix}__rail-y.@{bk-prefix}--clicking {
19
- background-color: #f0f1f5;
20
- }
21
-
22
- /*
23
- * Scrollbar rail styles
24
- */
25
- .@{bk-prefix}__rail-x {
26
- display: none;
27
- opacity: 0;
28
- transition:
29
- background-color 0.2s linear,
30
- opacity 0.2s linear;
31
- height: 10px;
32
- bottom: 0px;
13
+ .@{bk-prefix}-scrollbar-track {
14
+ z-index: 1;
33
15
  position: absolute;
34
- margin-bottom: 2px;
16
+ right: 0;
17
+ bottom: 0;
18
+ pointer-events: none;
19
+ overflow: hidden;
35
20
 
36
- &.@{bk-prefix}-scroll-size-small {
37
- height: 8px;
21
+ &.track-small {
22
+ &.@{bk-prefix}-scrollbar-vertical {
23
+ width: 6px;
24
+
25
+ &.@{bk-prefix}-scrollbar-hover {
26
+ width: 8px;
27
+ }
28
+ }
38
29
 
39
- .@{bk-prefix}__thumb-x {
30
+ &.@{bk-prefix}-scrollbar-horizontal {
40
31
  height: 6px;
32
+
33
+ &.@{bk-prefix}-scrollbar-hover {
34
+ height: 8px;
35
+ }
41
36
  }
42
37
  }
43
- }
44
38
 
45
- .@{bk-prefix}__rail-y {
46
- display: none;
47
- opacity: 0;
48
- transition:
49
- background-color 0.2s linear,
50
- opacity 0.2s linear;
51
- width: 10px;
52
- right: 0px;
53
- position: absolute;
54
- margin-right: 2px;
39
+ &.@{bk-prefix}-scrollbar-hover {
40
+ background-color: #f0f1f5;
41
+ cursor: pointer;
55
42
 
56
- &.@{bk-prefix}-scroll-size-small {
43
+ .@{bk-prefix}-scrollbar {
44
+ &::before {
45
+ background-color: #979ba5;
46
+ }
47
+ }
48
+ }
49
+
50
+ &.@{bk-prefix}-scrollbar-vertical {
51
+ top: 0;
57
52
  width: 8px;
53
+ transform: translate(var(--scroll-offset-x), var(--scroll-offset-y));
58
54
 
59
- .@{bk-prefix}__thumb-y {
60
- width: 6px;
55
+ &.@{bk-prefix}-scrollbar-hover {
56
+ width: 10px;
61
57
  }
62
58
  }
63
- }
64
59
 
65
- &:hover > .@{bk-prefix}__rail-x,
66
- &:hover > .@{bk-prefix}__rail-y,
67
- &.@{bk-prefix}--focus > .@{bk-prefix}__rail-x,
68
- &.@{bk-prefix}--focus > .@{bk-prefix}__rail-y,
69
- &.@{bk-prefix}--scrolling-x > .@{bk-prefix}__rail-x,
70
- &.@{bk-prefix}--scrolling-y > .@{bk-prefix}__rail-y {
71
- opacity: 0.9;
72
- }
73
-
74
- /*
75
- * Scrollbar thumb styles
76
- */
77
- .@{bk-prefix}__thumb-x {
78
- background-color: #dcdee5;
79
- border-radius: 8px;
80
- transition:
81
- background-color 0.2s linear,
82
- height 0.2s ease-in-out;
83
- height: 8px;
84
- bottom: 0px;
85
- position: absolute;
86
- }
60
+ &.@{bk-prefix}-scrollbar-horizontal {
61
+ left: 0;
62
+ height: 8px;
63
+ transform: translate(var(--scroll-offset-x), var(--scroll-offset-y));
87
64
 
88
- .@{bk-prefix}__thumb-y {
89
- background-color: #dcdee5;
90
- border-radius: 8px;
91
- transition:
92
- background-color 0.2s linear,
93
- width 0.2s ease-in-out;
94
- width: 8px;
95
- right: 0px;
96
- position: absolute;
97
- }
65
+ &.@{bk-prefix}-scrollbar-hover {
66
+ height: 10px;
67
+ }
98
68
 
99
- .@{bk-prefix}__rail-x:hover > .@{bk-prefix}__thumb-x,
100
- .@{bk-prefix}__rail-x:focus > .@{bk-prefix}__thumb-x,
101
- .@{bk-prefix}__rail-x.@{bk-prefix}--clicking .@{bk-prefix}__thumb-x {
102
- background-color: #979ba5;
103
- height: 10px;
69
+ &.@{bk-prefix}-scrollbar {
70
+ right: auto;
71
+ left: 0;
72
+ top: 0;
73
+ bottom: 0;
74
+ min-height: 0;
75
+ min-width: 8px;
76
+ width: auto;
77
+ }
78
+ }
104
79
  }
105
80
 
106
- .@{bk-prefix}__rail-y:hover > .@{bk-prefix}__thumb-y,
107
- .@{bk-prefix}__rail-y:focus > .@{bk-prefix}__thumb-y,
108
- .@{bk-prefix}__rail-y.@{bk-prefix}--clicking .@{bk-prefix}__thumb-y {
109
- background-color: #979ba5;
110
- width: 10px;
81
+ .@{bk-prefix}-scrollbar-dragging {
82
+ pointer-events: none;
83
+ -webkit-touch-callout: none;
84
+ -webkit-user-select: none;
85
+ -khtml-user-select: none;
86
+ -moz-user-select: none;
87
+ -ms-user-select: none;
88
+ user-select: none;
111
89
  }
112
90
 
113
- .@{bk-prefix}-scroll-size-small {
114
- > .@{bk-prefix}__thumb-x,
115
- > .@{bk-prefix}__thumb-x,
116
- &.@{bk-prefix}--clicking .@{bk-prefix}__thumb-x {
117
- height: 8px;
91
+ .@{bk-prefix}-scrollbar {
92
+ position: absolute;
93
+ left: 0;
94
+ right: 0;
95
+ top: 0;
96
+ bottom: 0;
97
+
98
+ &::before {
99
+ position: absolute;
100
+ content: '';
101
+ background: #dcdee5;
102
+ border-radius: 6px;
103
+ left: 0;
104
+ right: 0;
105
+ top: 0;
106
+ bottom: 0;
107
+ opacity: 0;
108
+ transition: opacity 0.2s 0.9s linear;
118
109
  }
119
110
 
120
- &:hover > .@{bk-prefix}__thumb-y,
121
- &:focus > .@{bk-prefix}__thumb-y,
122
- &.@{bk-prefix}--clicking .@{bk-prefix}__thumb-y {
123
- width: 8px;
111
+ &.@{bk-prefix}-scrollbar-visible {
112
+ &::before {
113
+ opacity: 0.9;
114
+ transition-delay: 0s;
115
+ transition-duration: 0s;
116
+ }
124
117
  }
125
118
  }
126
119
  }
127
-
128
- /* MS supports */
129
- @supports (-ms-overflow-style: none) {
130
- .@{bk-prefix}-scrollbar {
131
- overflow: auto !important;
132
- }
133
- }
134
-
135
- @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
136
- .@{bk-prefix}-scrollbar {
137
- overflow: auto !important;
138
- }
139
- }