1 | import { CSSSelector } from '../shared';
|
2 | import Swiper from '../swiper-class';
|
3 |
|
4 | export interface ScrollbarMethods {
|
5 | /**
|
6 | * HTMLElement of Scrollbar container element
|
7 | */
|
8 | el: HTMLElement;
|
9 |
|
10 | /**
|
11 | * HTMLElement of Scrollbar draggable handler element
|
12 | */
|
13 | dragEl: HTMLElement;
|
14 |
|
15 | /**
|
16 | * Updates scrollbar track and handler sizes
|
17 | */
|
18 | updateSize(): void;
|
19 |
|
20 | /**
|
21 | * Updates scrollbar translate
|
22 | */
|
23 | setTranslate(): void;
|
24 |
|
25 | /**
|
26 | * Initialize scrollbar
|
27 | */
|
28 | init(): void;
|
29 |
|
30 | /**
|
31 | * Destroy scrollbar
|
32 | */
|
33 | destroy(): void;
|
34 | }
|
35 |
|
36 | export interface ScrollbarEvents {
|
37 | /**
|
38 | * Event will be fired on draggable scrollbar drag start
|
39 | */
|
40 | scrollbarDragStart: (swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
|
41 |
|
42 | /**
|
43 | * Event will be fired on draggable scrollbar drag move
|
44 | */
|
45 | scrollbarDragMove: (swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
|
46 |
|
47 | /**
|
48 | * Event will be fired on draggable scrollbar drag end
|
49 | */
|
50 | scrollbarDragEnd: (swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
|
51 | }
|
52 |
|
53 | /**
|
54 | * Object with scrollbar parameters.
|
55 | *
|
56 | * @example
|
57 | * ```js
|
58 | * const swiper = new Swiper('.swiper', {
|
59 | * scrollbar: {
|
60 | * el: '.swiper-scrollbar',
|
61 | * draggable: true,
|
62 | * },
|
63 | * });
|
64 | * ```
|
65 | */
|
66 | export interface ScrollbarOptions {
|
67 | /**
|
68 | * Boolean property to use with breakpoints to enable/disable scrollbar on certain breakpoints
|
69 | */
|
70 | enabled?: boolean;
|
71 | /**
|
72 | * String with CSS selector or HTML element of the container with scrollbar.
|
73 | *
|
74 | * @default null
|
75 | */
|
76 | el?: CSSSelector | HTMLElement | null;
|
77 |
|
78 | /**
|
79 | * Hide scrollbar automatically after user interaction
|
80 | *
|
81 | * @default true
|
82 | */
|
83 | hide?: boolean;
|
84 |
|
85 | /**
|
86 | * Set to `true` to enable make scrollbar draggable that allows you to control slider position
|
87 | *
|
88 | * @default false
|
89 | */
|
90 | draggable?: boolean;
|
91 |
|
92 | /**
|
93 | * Set to `true` to snap slider position to slides when you release scrollbar
|
94 | *
|
95 | * @default false
|
96 | */
|
97 | snapOnRelease?: boolean;
|
98 |
|
99 | /**
|
100 | * Size of scrollbar draggable element in px
|
101 | *
|
102 | * @default 'auto'
|
103 | */
|
104 | dragSize?: 'auto' | number;
|
105 |
|
106 | /**
|
107 | * Scrollbar element additional CSS class when it is disabled
|
108 | *
|
109 | * @default 'swiper-scrollbar-lock'
|
110 | */
|
111 | lockClass?: string;
|
112 |
|
113 | /**
|
114 | * Scrollbar draggable element CSS class
|
115 | *
|
116 | * @default 'swiper-scrollbar-drag'
|
117 | */
|
118 | dragClass?: string;
|
119 |
|
120 | /**
|
121 | * CSS class name added on swiper container and scrollbar element when scrollbar is disabled by breakpoint
|
122 | *
|
123 | * @default 'swiper-scrollbar-disabled'
|
124 | */
|
125 | scrollbarDisabledClass?: string;
|
126 |
|
127 | /**
|
128 | * CSS class name set to scrollbar in horizontal Swiper
|
129 | *
|
130 | * @default 'swiper-scrollbar-horizontal'
|
131 | */
|
132 | horizontalClass?: string;
|
133 |
|
134 | /**
|
135 | * CSS class name set to scrollbar in vertical Swiper
|
136 | *
|
137 | * @default 'swiper-scrollbar-vertical'
|
138 | */
|
139 | verticalClass?: string;
|
140 | }
|