Skip to content

Commit afda5bb

Browse files
committed
Release: 8.0.0
1 parent e5d70a6 commit afda5bb

16 files changed

+176
-185
lines changed

README.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
MDB5
2-
Version: FREE 7.3.2
2+
Version: FREE 8.0.0
33

44
Documentation:
55
https://mdbootstrap.com/docs/standard/

css/mdb.dark.min.css

-26
This file was deleted.

css/mdb.dark.min.css.map

-1
This file was deleted.

css/mdb.dark.rtl.min.css

-26
This file was deleted.

css/mdb.min.css

+2-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/mdb.min.css.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/mdb.rtl.min.css

+2-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/mdb.umd.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mdb-ui-kit",
3-
"version": "7.3.2",
3+
"version": "8.0.0",
44
"type": "module",
55
"main": "./js/mdb.umd.min.js",
66
"module": "./js/mdb.es.min.js",
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,9 @@
1-
/* eslint-disable */
2-
3-
import * as CSS from '../lib/css';
4-
import * as DOM from '../lib/dom';
51
import cls, { addScrollingClass, removeScrollingClass } from '../lib/class-names';
62
import updateGeometry from '../update-geometry';
7-
import { toInt } from '../lib/util';
83

9-
export default function (i) {
10-
bindMouseScrollHandler(i, [
11-
'containerWidth',
12-
'contentWidth',
13-
'pageX',
14-
'railXWidth',
15-
'scrollbarX',
16-
'scrollbarXWidth',
17-
'scrollLeft',
18-
'x',
19-
'scrollbarXRail',
20-
]);
4+
let activeSlider = null; // Variable to track the currently active slider
5+
6+
export default function setupScrollHandlers(i) {
217
bindMouseScrollHandler(i, [
228
'containerHeight',
239
'contentHeight',
@@ -29,70 +15,96 @@ export default function (i) {
2915
'y',
3016
'scrollbarYRail',
3117
]);
18+
19+
bindMouseScrollHandler(i, [
20+
'containerWidth',
21+
'contentWidth',
22+
'pageX',
23+
'railXWidth',
24+
'scrollbarX',
25+
'scrollbarXWidth',
26+
'scrollLeft',
27+
'x',
28+
'scrollbarXRail',
29+
]);
3230
}
3331

3432
function bindMouseScrollHandler(
3533
i,
3634
[
37-
containerHeight,
38-
contentHeight,
39-
pageY,
40-
railYHeight,
41-
scrollbarY,
42-
scrollbarYHeight,
43-
scrollTop,
44-
y,
45-
scrollbarYRail,
35+
containerDimension,
36+
contentDimension,
37+
pageAxis,
38+
railDimension,
39+
scrollbarAxis,
40+
scrollbarDimension,
41+
scrollAxis,
42+
axis,
43+
scrollbarRail,
4644
]
4745
) {
4846
const element = i.element;
49-
50-
let startingScrollTop = null;
51-
let startingMousePageY = null;
47+
let startingScrollPosition = null;
48+
let startingMousePagePosition = null;
5249
let scrollBy = null;
5350

54-
function mouseMoveHandler(e) {
51+
function moveHandler(e) {
5552
if (e.touches && e.touches[0]) {
56-
e[pageY] = e.touches[0].pageY;
53+
e[pageAxis] = e.touches[0][`page${axis.toUpperCase()}`];
5754
}
58-
element[scrollTop] = startingScrollTop + scrollBy * (e[pageY] - startingMousePageY);
59-
addScrollingClass(i, y);
60-
updateGeometry(i);
6155

62-
e.stopPropagation();
63-
e.preventDefault();
56+
// Only move if the active slider is the one we started with
57+
if (activeSlider === scrollbarAxis) {
58+
element[scrollAxis] =
59+
startingScrollPosition + scrollBy * (e[pageAxis] - startingMousePagePosition);
60+
addScrollingClass(i, axis);
61+
updateGeometry(i);
62+
63+
e.stopPropagation();
64+
e.preventDefault();
65+
}
6466
}
6567

66-
function mouseUpHandler() {
67-
removeScrollingClass(i, y);
68-
i[scrollbarYRail].classList.remove(cls.state.clicking);
69-
i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler);
68+
function endHandler() {
69+
removeScrollingClass(i, axis);
70+
i[scrollbarRail].classList.remove(cls.state.clicking);
71+
document.removeEventListener('mousemove', moveHandler);
72+
document.removeEventListener('mouseup', endHandler);
73+
document.removeEventListener('touchmove', moveHandler);
74+
document.removeEventListener('touchend', endHandler);
75+
activeSlider = null; // Reset active slider when interaction ends
7076
}
7177

72-
function bindMoves(e, touchMode) {
73-
startingScrollTop = element[scrollTop];
74-
if (touchMode && e.touches) {
75-
e[pageY] = e.touches[0].pageY;
76-
}
77-
startingMousePageY = e[pageY];
78-
scrollBy = (i[contentHeight] - i[containerHeight]) / (i[railYHeight] - i[scrollbarYHeight]);
79-
if (!touchMode) {
80-
i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler);
81-
i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler);
82-
e.preventDefault();
83-
} else {
84-
i.event.bind(i.ownerDocument, 'touchmove', mouseMoveHandler);
85-
}
78+
function bindMoves(e) {
79+
if (activeSlider === null) {
80+
// Only bind if no slider is currently active
81+
activeSlider = scrollbarAxis; // Set current slider as active
82+
83+
startingScrollPosition = element[scrollAxis];
84+
if (e.touches) {
85+
e[pageAxis] = e.touches[0][`page${axis.toUpperCase()}`];
86+
}
87+
startingMousePagePosition = e[pageAxis];
88+
scrollBy =
89+
(i[contentDimension] - i[containerDimension]) / (i[railDimension] - i[scrollbarDimension]);
8690

87-
i[scrollbarYRail].classList.add(cls.state.clicking);
91+
if (!e.touches) {
92+
document.addEventListener('mousemove', moveHandler);
93+
document.addEventListener('mouseup', endHandler);
94+
} else {
95+
document.addEventListener('touchmove', moveHandler, { passive: false });
96+
document.addEventListener('touchend', endHandler);
97+
}
98+
99+
i[scrollbarRail].classList.add(cls.state.clicking);
100+
}
88101

89102
e.stopPropagation();
103+
if (e.cancelable) {
104+
e.preventDefault();
105+
}
90106
}
91107

92-
i.event.bind(i[scrollbarY], 'mousedown', (e) => {
93-
bindMoves(e);
94-
});
95-
i.event.bind(i[scrollbarY], 'touchstart', (e) => {
96-
bindMoves(e, true);
97-
});
108+
i[scrollbarAxis].addEventListener('mousedown', bindMoves);
109+
i[scrollbarAxis].addEventListener('touchstart', bindMoves);
98110
}

src/js/mdb/perfect-scrollbar/handlers/touch.js

+39-37
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable */
21
import updateGeometry from '../update-geometry';
32
import cls from '../lib/class-names';
43
import * as CSS from '../lib/css';
@@ -11,25 +10,27 @@ export default function (i) {
1110

1211
const element = i.element;
1312

13+
const state = {
14+
startOffset: {},
15+
startTime: 0,
16+
speed: {},
17+
easingLoop: null,
18+
};
19+
1420
function shouldPrevent(deltaX, deltaY) {
1521
const scrollTop = Math.floor(element.scrollTop);
1622
const scrollLeft = element.scrollLeft;
1723
const magnitudeX = Math.abs(deltaX);
1824
const magnitudeY = Math.abs(deltaY);
1925

2026
if (magnitudeY > magnitudeX) {
21-
// user is perhaps trying to swipe up/down the page
22-
2327
if (
2428
(deltaY < 0 && scrollTop === i.contentHeight - i.containerHeight) ||
2529
(deltaY > 0 && scrollTop === 0)
2630
) {
27-
// set prevent for mobile Chrome refresh
2831
return window.scrollY === 0 && deltaY > 0 && env.isChrome;
2932
}
3033
} else if (magnitudeX > magnitudeY) {
31-
// user is perhaps trying to swipe left/right across the page
32-
3334
if (
3435
(deltaX < 0 && scrollLeft === i.contentWidth - i.containerWidth) ||
3536
(deltaX > 0 && scrollLeft === 0)
@@ -48,21 +49,18 @@ export default function (i) {
4849
updateGeometry(i);
4950
}
5051

51-
let startOffset = {};
52-
let startTime = 0;
53-
let speed = {};
54-
let easingLoop = null;
55-
5652
function getTouch(e) {
5753
if (e.targetTouches) {
5854
return e.targetTouches[0];
59-
} else {
60-
// Maybe IE pointer
61-
return e;
6255
}
56+
// Maybe IE pointer
57+
return e;
6358
}
6459

6560
function shouldHandle(e) {
61+
if (e.target === i.scrollbarX || e.target === i.scrollbarY) {
62+
return false;
63+
}
6664
if (e.pointerType && e.pointerType === 'pen' && e.buttons === 0) {
6765
return false;
6866
}
@@ -82,13 +80,13 @@ export default function (i) {
8280

8381
const touch = getTouch(e);
8482

85-
startOffset.pageX = touch.pageX;
86-
startOffset.pageY = touch.pageY;
83+
state.startOffset.pageX = touch.pageX;
84+
state.startOffset.pageY = touch.pageY;
8785

88-
startTime = new Date().getTime();
86+
state.startTime = new Date().getTime();
8987

90-
if (easingLoop !== null) {
91-
clearInterval(easingLoop);
88+
if (state.easingLoop !== null) {
89+
clearInterval(state.easingLoop);
9290
}
9391
}
9492

@@ -143,53 +141,57 @@ export default function (i) {
143141

144142
const currentOffset = { pageX: touch.pageX, pageY: touch.pageY };
145143

146-
const differenceX = currentOffset.pageX - startOffset.pageX;
147-
const differenceY = currentOffset.pageY - startOffset.pageY;
144+
const differenceX = currentOffset.pageX - state.startOffset.pageX;
145+
const differenceY = currentOffset.pageY - state.startOffset.pageY;
148146

149147
if (shouldBeConsumedByChild(e.target, differenceX, differenceY)) {
150148
return;
151149
}
152150

153151
applyTouchMove(differenceX, differenceY);
154-
startOffset = currentOffset;
152+
state.startOffset = currentOffset;
155153

156154
const currentTime = new Date().getTime();
157155

158-
const timeGap = currentTime - startTime;
156+
const timeGap = currentTime - state.startTime;
159157
if (timeGap > 0) {
160-
speed.x = differenceX / timeGap;
161-
speed.y = differenceY / timeGap;
162-
startTime = currentTime;
158+
state.speed.x = differenceX / timeGap;
159+
state.speed.y = differenceY / timeGap;
160+
state.startTime = currentTime;
163161
}
164162

165163
if (shouldPrevent(differenceX, differenceY)) {
166-
e.preventDefault();
164+
// Prevent the default behavior if the event is cancelable
165+
if (e.cancelable) {
166+
e.preventDefault();
167+
}
167168
}
168169
}
169170
}
171+
170172
function touchEnd() {
171173
if (i.settings.swipeEasing) {
172-
clearInterval(easingLoop);
173-
easingLoop = setInterval(function () {
174+
clearInterval(state.easingLoop);
175+
state.easingLoop = setInterval(() => {
174176
if (i.isInitialized) {
175-
clearInterval(easingLoop);
177+
clearInterval(state.easingLoop);
176178
return;
177179
}
178180

179-
if (!speed.x && !speed.y) {
180-
clearInterval(easingLoop);
181+
if (!state.speed.x && !state.speed.y) {
182+
clearInterval(state.easingLoop);
181183
return;
182184
}
183185

184-
if (Math.abs(speed.x) < 0.01 && Math.abs(speed.y) < 0.01) {
185-
clearInterval(easingLoop);
186+
if (Math.abs(state.speed.x) < 0.01 && Math.abs(state.speed.y) < 0.01) {
187+
clearInterval(state.easingLoop);
186188
return;
187189
}
188190

189-
applyTouchMove(speed.x * 30, speed.y * 30);
191+
applyTouchMove(state.speed.x * 30, state.speed.y * 30);
190192

191-
speed.x *= 0.8;
192-
speed.y *= 0.8;
193+
state.speed.x *= 0.8;
194+
state.speed.y *= 0.8;
193195
}, 10);
194196
}
195197
}

src/scss/free/_flag.scss

-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
/*!
2-
* # Semantic UI 2.4.2 - Flag
3-
* http://github.com/semantic-org/semantic-ui/
4-
*
5-
*
6-
* Released under the MIT license
7-
* http://opensource.org/licenses/MIT
8-
*
9-
*/
10-
111
/*******************************
122
Flag
133
*******************************/

src/scss/free/_nav.scss

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454

5555
.nav-pills {
5656
margin-left: -$nav-pills-margin;
57+
margin-right: -$nav-pills-margin;
5758

5859
.nav-link {
5960
--#{$prefix}nav-pills-link-border-radius: #{$nav-pills-link-border-radius};

0 commit comments

Comments
 (0)