@baishuyun/ui-base 2.3.1 → 2.3.3
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/dist/Card/Card-F2t4Rv_v.js +69 -0
- package/dist/Card/index.js +3 -4
- package/dist/CheckBox/CheckBox-DFoMXJZz.js +67 -0
- package/dist/CheckBox/CheckBox-q2vu7qf7.js +33 -0
- package/dist/CheckBox/index.js +4 -39
- package/dist/ColorPicker/ColorPicker-Bh4KTHxh.js +168 -0
- package/dist/ColorPicker/index.js +6 -5
- package/dist/DropDown/DropDown-BEzloRRM.js +162 -0
- package/dist/DropDown/index.js +7 -4
- package/dist/Editor/Buttons-ClWtl3G-.js +595 -0
- package/dist/Editor/ToolbarPlugin/Buttons/index.js +14 -8
- package/dist/Editor/constants/index.js +53 -20
- package/dist/Editor/index.js +518 -576
- package/dist/Icon/Icon-DXmPqVzg.js +19 -0
- package/dist/Icon/index.js +2 -4
- package/dist/InputTag/InputTag-DbiyuWo9.js +139 -0
- package/dist/InputTag/index.js +3 -4
- package/dist/Loading/Loading-Bi5NO-Ky.js +15 -0
- package/dist/Loading/index.js +2 -4
- package/dist/Modal/Modal-BO1s8pJe.js +81 -0
- package/dist/Modal/index.js +3 -4
- package/dist/NotFoundContent/NotFoundContent-CTPpcZOt.js +9 -0
- package/dist/NotFoundContent/index.js +2 -4
- package/dist/Radio/Radio-dyoBNiKF.js +85 -0
- package/dist/Radio/index.js +2 -105
- package/dist/Segmented/Segmented-Dd8glDXI.js +62 -0
- package/dist/Segmented/index.js +2 -4
- package/dist/Select/Select-DoQO-Xi5.js +729 -0
- package/dist/Select/SelectInputSearch-gp6gcY3x.js +46 -0
- package/dist/Select/index.js +11 -6
- package/dist/Tabs/Tabs-Dsxn_7gF.js +410 -0
- package/dist/Tabs/index.js +6 -7
- package/dist/Tree/index.js +5 -4
- package/dist/Tree/utils/index.js +24 -39
- package/dist/components/Editor/context/EditorContainerContext.d.ts +8 -0
- package/dist/index.js +103 -81
- package/dist/style.css +2 -1
- package/dist/vendors/Tree-DgwG7Unx.js +231 -0
- package/dist/vendors/animations-C5JKFkz4.js +38 -0
- package/dist/vendors/clsx-DNOE4Gl8.js +16 -0
- package/dist/vendors/color-BPWy9DvT.js +12 -0
- package/dist/vendors/fuse.js-BKtvbTjL.js +877 -0
- package/dist/vendors/lexical-hZliMgDv.js +6439 -0
- package/dist/vendors/lodash-es-Bu9xU1fK.js +334 -0
- package/dist/vendors/simplebar-react-CFlS-Nm9.js +370 -0
- package/dist/vendors/tinycolor2-DToeAEPD.js +726 -0
- package/dist/vendors/useFloatingPortal-BA6P5GxV.js +45 -0
- package/dist/vendors/useLocale-BfT0V1j4.js +75 -0
- package/package.json +4 -4
- package/dist/Card/Card-Y1ISqAp9.js +0 -86
- package/dist/CheckBox/CheckBox-C9sXWSA5.js +0 -84
- package/dist/ColorPicker/ColorPicker-uPJOs52x.js +0 -215
- package/dist/DropDown/DropDown-DGkSeXQT.js +0 -166
- package/dist/Editor/index-D7tFsaxU.js +0 -846
- package/dist/Icon/Icon-CBlIwtp2.js +0 -24
- package/dist/InputTag/InputTag-C-rQUJnF.js +0 -155
- package/dist/Loading/Loading-CEB4PLUE.js +0 -9
- package/dist/Modal/Modal-z3TvEXwN.js +0 -80
- package/dist/NotFoundContent/NotFoundContent-h0-oIXlk.js +0 -6
- package/dist/Segmented/Segmented-UgzW78Ey.js +0 -75
- package/dist/Select/Select-hwXXDuLU.js +0 -820
- package/dist/Select/SelectInputSearch-ChUpUgxa.js +0 -34
- package/dist/Tabs/TabSelect-DL8Bhehc.js +0 -445
- package/dist/vendors/Tree-CLEy-xqz.js +0 -235
- package/dist/vendors/clsx-OuTLNxxd.js +0 -16
- package/dist/vendors/color-VzwvCPhF.js +0 -21
- package/dist/vendors/fuse.js-D1DCbUBb.js +0 -1022
- package/dist/vendors/index-MTmG1Ezy.js +0 -15
- package/dist/vendors/lexical-DO7eMeC2.js +0 -5891
- package/dist/vendors/lodash-es-DFpaJB4Y.js +0 -305
- package/dist/vendors/simplebar-react-D68KzE44.js +0 -408
- package/dist/vendors/tinycolor2-Begv3Jc8.js +0 -711
- package/dist/vendors/useFloatingPortal-9VUFOAOG.js +0 -45
- package/dist/vendors/useLocale-DgqW9M3h.js +0 -47
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
import * as f from "react";
|
|
2
|
-
import { t as j, d as M } from "./lodash-es-DFpaJB4Y.js";
|
|
3
|
-
var w = function() {
|
|
4
|
-
return w = Object.assign || function(t) {
|
|
5
|
-
for (var i, e = 1, r = arguments.length; e < r; e++) {
|
|
6
|
-
i = arguments[e];
|
|
7
|
-
for (var l in i) Object.prototype.hasOwnProperty.call(i, l) && (t[l] = i[l]);
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
}, w.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
function T(s) {
|
|
13
|
-
return !s || !s.ownerDocument || !s.ownerDocument.defaultView ? window : s.ownerDocument.defaultView;
|
|
14
|
-
}
|
|
15
|
-
function P(s) {
|
|
16
|
-
return !s || !s.ownerDocument ? document : s.ownerDocument;
|
|
17
|
-
}
|
|
18
|
-
var V = function(s) {
|
|
19
|
-
var t = {}, i = Array.prototype.reduce.call(s, function(e, r) {
|
|
20
|
-
var l = r.name.match(/data-simplebar-(.+)/);
|
|
21
|
-
if (l) {
|
|
22
|
-
var o = l[1].replace(/\W+(.)/g, function(a, u) {
|
|
23
|
-
return u.toUpperCase();
|
|
24
|
-
});
|
|
25
|
-
switch (r.value) {
|
|
26
|
-
case "true":
|
|
27
|
-
e[o] = !0;
|
|
28
|
-
break;
|
|
29
|
-
case "false":
|
|
30
|
-
e[o] = !1;
|
|
31
|
-
break;
|
|
32
|
-
case void 0:
|
|
33
|
-
e[o] = !0;
|
|
34
|
-
break;
|
|
35
|
-
default:
|
|
36
|
-
e[o] = r.value;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return e;
|
|
40
|
-
}, t);
|
|
41
|
-
return i;
|
|
42
|
-
};
|
|
43
|
-
function H(s, t) {
|
|
44
|
-
var i;
|
|
45
|
-
s && (i = s.classList).add.apply(i, t.split(" "));
|
|
46
|
-
}
|
|
47
|
-
function B(s, t) {
|
|
48
|
-
s && t.split(" ").forEach(function(i) {
|
|
49
|
-
s.classList.remove(i);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
function X(s) {
|
|
53
|
-
return ".".concat(s.split(" ").join("."));
|
|
54
|
-
}
|
|
55
|
-
var _ = !!(typeof window < "u" && window.document && window.document.createElement), I = /* @__PURE__ */ Object.freeze({
|
|
56
|
-
__proto__: null,
|
|
57
|
-
addClasses: H,
|
|
58
|
-
canUseDOM: _,
|
|
59
|
-
classNamesToQuery: X,
|
|
60
|
-
getElementDocument: P,
|
|
61
|
-
getElementWindow: T,
|
|
62
|
-
getOptions: V,
|
|
63
|
-
removeClasses: B
|
|
64
|
-
}), O = null, R = null;
|
|
65
|
-
_ && window.addEventListener("resize", function() {
|
|
66
|
-
R !== window.devicePixelRatio && (R = window.devicePixelRatio, O = null);
|
|
67
|
-
});
|
|
68
|
-
function D() {
|
|
69
|
-
if (O === null) {
|
|
70
|
-
if (typeof document > "u")
|
|
71
|
-
return O = 0, O;
|
|
72
|
-
var s = document.body, t = document.createElement("div");
|
|
73
|
-
t.classList.add("simplebar-hide-scrollbar"), s.appendChild(t);
|
|
74
|
-
var i = t.getBoundingClientRect().right;
|
|
75
|
-
s.removeChild(t), O = i;
|
|
76
|
-
}
|
|
77
|
-
return O;
|
|
78
|
-
}
|
|
79
|
-
var g = T, C = P, $ = V, b = H, y = B, d = X, k = (
|
|
80
|
-
/** @class */
|
|
81
|
-
(function() {
|
|
82
|
-
function s(t, i) {
|
|
83
|
-
i === void 0 && (i = {});
|
|
84
|
-
var e = this;
|
|
85
|
-
if (this.removePreventClickId = null, this.minScrollbarWidth = 20, this.stopScrollDelay = 175, this.isScrolling = !1, this.isMouseEntering = !1, this.isDragging = !1, this.scrollXTicking = !1, this.scrollYTicking = !1, this.wrapperEl = null, this.contentWrapperEl = null, this.contentEl = null, this.offsetEl = null, this.maskEl = null, this.placeholderEl = null, this.heightAutoObserverWrapperEl = null, this.heightAutoObserverEl = null, this.rtlHelpers = null, this.scrollbarWidth = 0, this.resizeObserver = null, this.mutationObserver = null, this.elStyles = null, this.isRtl = null, this.mouseX = 0, this.mouseY = 0, this.onMouseMove = function() {
|
|
86
|
-
}, this.onWindowResize = function() {
|
|
87
|
-
}, this.onStopScrolling = function() {
|
|
88
|
-
}, this.onMouseEntered = function() {
|
|
89
|
-
}, this.onScroll = function() {
|
|
90
|
-
var r = g(e.el);
|
|
91
|
-
e.scrollXTicking || (r.requestAnimationFrame(e.scrollX), e.scrollXTicking = !0), e.scrollYTicking || (r.requestAnimationFrame(e.scrollY), e.scrollYTicking = !0), e.isScrolling || (e.isScrolling = !0, b(e.el, e.classNames.scrolling)), e.showScrollbar("x"), e.showScrollbar("y"), e.onStopScrolling();
|
|
92
|
-
}, this.scrollX = function() {
|
|
93
|
-
e.axis.x.isOverflowing && e.positionScrollbar("x"), e.scrollXTicking = !1;
|
|
94
|
-
}, this.scrollY = function() {
|
|
95
|
-
e.axis.y.isOverflowing && e.positionScrollbar("y"), e.scrollYTicking = !1;
|
|
96
|
-
}, this._onStopScrolling = function() {
|
|
97
|
-
y(e.el, e.classNames.scrolling), e.options.autoHide && (e.hideScrollbar("x"), e.hideScrollbar("y")), e.isScrolling = !1;
|
|
98
|
-
}, this.onMouseEnter = function() {
|
|
99
|
-
e.isMouseEntering || (b(e.el, e.classNames.mouseEntered), e.showScrollbar("x"), e.showScrollbar("y"), e.isMouseEntering = !0), e.onMouseEntered();
|
|
100
|
-
}, this._onMouseEntered = function() {
|
|
101
|
-
y(e.el, e.classNames.mouseEntered), e.options.autoHide && (e.hideScrollbar("x"), e.hideScrollbar("y")), e.isMouseEntering = !1;
|
|
102
|
-
}, this._onMouseMove = function(r) {
|
|
103
|
-
e.mouseX = r.clientX, e.mouseY = r.clientY, (e.axis.x.isOverflowing || e.axis.x.forceVisible) && e.onMouseMoveForAxis("x"), (e.axis.y.isOverflowing || e.axis.y.forceVisible) && e.onMouseMoveForAxis("y");
|
|
104
|
-
}, this.onMouseLeave = function() {
|
|
105
|
-
e.onMouseMove.cancel(), (e.axis.x.isOverflowing || e.axis.x.forceVisible) && e.onMouseLeaveForAxis("x"), (e.axis.y.isOverflowing || e.axis.y.forceVisible) && e.onMouseLeaveForAxis("y"), e.mouseX = -1, e.mouseY = -1;
|
|
106
|
-
}, this._onWindowResize = function() {
|
|
107
|
-
e.scrollbarWidth = e.getScrollbarWidth(), e.hideNativeScrollbar();
|
|
108
|
-
}, this.onPointerEvent = function(r) {
|
|
109
|
-
if (!(!e.axis.x.track.el || !e.axis.y.track.el || !e.axis.x.scrollbar.el || !e.axis.y.scrollbar.el)) {
|
|
110
|
-
var l, o;
|
|
111
|
-
e.axis.x.track.rect = e.axis.x.track.el.getBoundingClientRect(), e.axis.y.track.rect = e.axis.y.track.el.getBoundingClientRect(), (e.axis.x.isOverflowing || e.axis.x.forceVisible) && (l = e.isWithinBounds(e.axis.x.track.rect)), (e.axis.y.isOverflowing || e.axis.y.forceVisible) && (o = e.isWithinBounds(e.axis.y.track.rect)), (l || o) && (r.stopPropagation(), r.type === "pointerdown" && r.pointerType !== "touch" && (l && (e.axis.x.scrollbar.rect = e.axis.x.scrollbar.el.getBoundingClientRect(), e.isWithinBounds(e.axis.x.scrollbar.rect) ? e.onDragStart(r, "x") : e.onTrackClick(r, "x")), o && (e.axis.y.scrollbar.rect = e.axis.y.scrollbar.el.getBoundingClientRect(), e.isWithinBounds(e.axis.y.scrollbar.rect) ? e.onDragStart(r, "y") : e.onTrackClick(r, "y"))));
|
|
112
|
-
}
|
|
113
|
-
}, this.drag = function(r) {
|
|
114
|
-
var l, o, a, u, h, v, n, p, c, W, E;
|
|
115
|
-
if (!(!e.draggedAxis || !e.contentWrapperEl)) {
|
|
116
|
-
var x, S = e.axis[e.draggedAxis].track, A = (o = (l = S.rect) === null || l === void 0 ? void 0 : l[e.axis[e.draggedAxis].sizeAttr]) !== null && o !== void 0 ? o : 0, L = e.axis[e.draggedAxis].scrollbar, Y = (u = (a = e.contentWrapperEl) === null || a === void 0 ? void 0 : a[e.axis[e.draggedAxis].scrollSizeAttr]) !== null && u !== void 0 ? u : 0, q = parseInt((v = (h = e.elStyles) === null || h === void 0 ? void 0 : h[e.axis[e.draggedAxis].sizeAttr]) !== null && v !== void 0 ? v : "0px", 10);
|
|
117
|
-
r.preventDefault(), r.stopPropagation(), e.draggedAxis === "y" ? x = r.pageY : x = r.pageX;
|
|
118
|
-
var N = x - ((p = (n = S.rect) === null || n === void 0 ? void 0 : n[e.axis[e.draggedAxis].offsetAttr]) !== null && p !== void 0 ? p : 0) - e.axis[e.draggedAxis].dragOffset;
|
|
119
|
-
N = e.draggedAxis === "x" && e.isRtl ? ((W = (c = S.rect) === null || c === void 0 ? void 0 : c[e.axis[e.draggedAxis].sizeAttr]) !== null && W !== void 0 ? W : 0) - L.size - N : N;
|
|
120
|
-
var F = N / (A - L.size), z = F * (Y - q);
|
|
121
|
-
e.draggedAxis === "x" && e.isRtl && (z = !((E = s.getRtlHelpers()) === null || E === void 0) && E.isScrollingToNegative ? -z : z), e.contentWrapperEl[e.axis[e.draggedAxis].scrollOffsetAttr] = z;
|
|
122
|
-
}
|
|
123
|
-
}, this.onEndDrag = function(r) {
|
|
124
|
-
e.isDragging = !1;
|
|
125
|
-
var l = C(e.el), o = g(e.el);
|
|
126
|
-
r.preventDefault(), r.stopPropagation(), y(e.el, e.classNames.dragging), e.onStopScrolling(), l.removeEventListener("mousemove", e.drag, !0), l.removeEventListener("mouseup", e.onEndDrag, !0), e.removePreventClickId = o.setTimeout(function() {
|
|
127
|
-
l.removeEventListener("click", e.preventClick, !0), l.removeEventListener("dblclick", e.preventClick, !0), e.removePreventClickId = null;
|
|
128
|
-
});
|
|
129
|
-
}, this.preventClick = function(r) {
|
|
130
|
-
r.preventDefault(), r.stopPropagation();
|
|
131
|
-
}, this.el = t, this.options = w(w({}, s.defaultOptions), i), this.classNames = w(w({}, s.defaultOptions.classNames), i.classNames), this.axis = {
|
|
132
|
-
x: {
|
|
133
|
-
scrollOffsetAttr: "scrollLeft",
|
|
134
|
-
sizeAttr: "width",
|
|
135
|
-
scrollSizeAttr: "scrollWidth",
|
|
136
|
-
offsetSizeAttr: "offsetWidth",
|
|
137
|
-
offsetAttr: "left",
|
|
138
|
-
overflowAttr: "overflowX",
|
|
139
|
-
dragOffset: 0,
|
|
140
|
-
isOverflowing: !0,
|
|
141
|
-
forceVisible: !1,
|
|
142
|
-
track: { size: null, el: null, rect: null, isVisible: !1 },
|
|
143
|
-
scrollbar: { size: null, el: null, rect: null, isVisible: !1 }
|
|
144
|
-
},
|
|
145
|
-
y: {
|
|
146
|
-
scrollOffsetAttr: "scrollTop",
|
|
147
|
-
sizeAttr: "height",
|
|
148
|
-
scrollSizeAttr: "scrollHeight",
|
|
149
|
-
offsetSizeAttr: "offsetHeight",
|
|
150
|
-
offsetAttr: "top",
|
|
151
|
-
overflowAttr: "overflowY",
|
|
152
|
-
dragOffset: 0,
|
|
153
|
-
isOverflowing: !0,
|
|
154
|
-
forceVisible: !1,
|
|
155
|
-
track: { size: null, el: null, rect: null, isVisible: !1 },
|
|
156
|
-
scrollbar: { size: null, el: null, rect: null, isVisible: !1 }
|
|
157
|
-
}
|
|
158
|
-
}, typeof this.el != "object" || !this.el.nodeName)
|
|
159
|
-
throw new Error("Argument passed to SimpleBar must be an HTML element instead of ".concat(this.el));
|
|
160
|
-
this.onMouseMove = j(this._onMouseMove, 64), this.onWindowResize = M(this._onWindowResize, 64, { leading: !0 }), this.onStopScrolling = M(this._onStopScrolling, this.stopScrollDelay), this.onMouseEntered = M(this._onMouseEntered, this.stopScrollDelay), this.init();
|
|
161
|
-
}
|
|
162
|
-
return s.getRtlHelpers = function() {
|
|
163
|
-
if (s.rtlHelpers)
|
|
164
|
-
return s.rtlHelpers;
|
|
165
|
-
var t = document.createElement("div");
|
|
166
|
-
t.innerHTML = '<div class="simplebar-dummy-scrollbar-size"><div></div></div>';
|
|
167
|
-
var i = t.firstElementChild, e = i == null ? void 0 : i.firstElementChild;
|
|
168
|
-
if (!e)
|
|
169
|
-
return null;
|
|
170
|
-
document.body.appendChild(i), i.scrollLeft = 0;
|
|
171
|
-
var r = s.getOffset(i), l = s.getOffset(e);
|
|
172
|
-
i.scrollLeft = -999;
|
|
173
|
-
var o = s.getOffset(e);
|
|
174
|
-
return document.body.removeChild(i), s.rtlHelpers = {
|
|
175
|
-
// determines if the scrolling is responding with negative values
|
|
176
|
-
isScrollOriginAtZero: r.left !== l.left,
|
|
177
|
-
// determines if the origin scrollbar position is inverted or not (positioned on left or right)
|
|
178
|
-
isScrollingToNegative: l.left !== o.left
|
|
179
|
-
}, s.rtlHelpers;
|
|
180
|
-
}, s.prototype.getScrollbarWidth = function() {
|
|
181
|
-
try {
|
|
182
|
-
return this.contentWrapperEl && getComputedStyle(this.contentWrapperEl, "::-webkit-scrollbar").display === "none" || "scrollbarWidth" in document.documentElement.style || "-ms-overflow-style" in document.documentElement.style ? 0 : D();
|
|
183
|
-
} catch {
|
|
184
|
-
return D();
|
|
185
|
-
}
|
|
186
|
-
}, s.getOffset = function(t) {
|
|
187
|
-
var i = t.getBoundingClientRect(), e = C(t), r = g(t);
|
|
188
|
-
return {
|
|
189
|
-
top: i.top + (r.pageYOffset || e.documentElement.scrollTop),
|
|
190
|
-
left: i.left + (r.pageXOffset || e.documentElement.scrollLeft)
|
|
191
|
-
};
|
|
192
|
-
}, s.prototype.init = function() {
|
|
193
|
-
_ && (this.initDOM(), this.rtlHelpers = s.getRtlHelpers(), this.scrollbarWidth = this.getScrollbarWidth(), this.recalculate(), this.initListeners());
|
|
194
|
-
}, s.prototype.initDOM = function() {
|
|
195
|
-
var t, i;
|
|
196
|
-
this.wrapperEl = this.el.querySelector(d(this.classNames.wrapper)), this.contentWrapperEl = this.options.scrollableNode || this.el.querySelector(d(this.classNames.contentWrapper)), this.contentEl = this.options.contentNode || this.el.querySelector(d(this.classNames.contentEl)), this.offsetEl = this.el.querySelector(d(this.classNames.offset)), this.maskEl = this.el.querySelector(d(this.classNames.mask)), this.placeholderEl = this.findChild(this.wrapperEl, d(this.classNames.placeholder)), this.heightAutoObserverWrapperEl = this.el.querySelector(d(this.classNames.heightAutoObserverWrapperEl)), this.heightAutoObserverEl = this.el.querySelector(d(this.classNames.heightAutoObserverEl)), this.axis.x.track.el = this.findChild(this.el, "".concat(d(this.classNames.track)).concat(d(this.classNames.horizontal))), this.axis.y.track.el = this.findChild(this.el, "".concat(d(this.classNames.track)).concat(d(this.classNames.vertical))), this.axis.x.scrollbar.el = ((t = this.axis.x.track.el) === null || t === void 0 ? void 0 : t.querySelector(d(this.classNames.scrollbar))) || null, this.axis.y.scrollbar.el = ((i = this.axis.y.track.el) === null || i === void 0 ? void 0 : i.querySelector(d(this.classNames.scrollbar))) || null, this.options.autoHide || (b(this.axis.x.scrollbar.el, this.classNames.visible), b(this.axis.y.scrollbar.el, this.classNames.visible));
|
|
197
|
-
}, s.prototype.initListeners = function() {
|
|
198
|
-
var t = this, i, e = g(this.el);
|
|
199
|
-
if (this.el.addEventListener("mouseenter", this.onMouseEnter), this.el.addEventListener("pointerdown", this.onPointerEvent, !0), this.el.addEventListener("mousemove", this.onMouseMove), this.el.addEventListener("mouseleave", this.onMouseLeave), (i = this.contentWrapperEl) === null || i === void 0 || i.addEventListener("scroll", this.onScroll), e.addEventListener("resize", this.onWindowResize), !!this.contentEl) {
|
|
200
|
-
if (window.ResizeObserver) {
|
|
201
|
-
var r = !1, l = e.ResizeObserver || ResizeObserver;
|
|
202
|
-
this.resizeObserver = new l(function() {
|
|
203
|
-
r && e.requestAnimationFrame(function() {
|
|
204
|
-
t.recalculate();
|
|
205
|
-
});
|
|
206
|
-
}), this.resizeObserver.observe(this.el), this.resizeObserver.observe(this.contentEl), e.requestAnimationFrame(function() {
|
|
207
|
-
r = !0;
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
this.mutationObserver = new e.MutationObserver(function() {
|
|
211
|
-
e.requestAnimationFrame(function() {
|
|
212
|
-
t.recalculate();
|
|
213
|
-
});
|
|
214
|
-
}), this.mutationObserver.observe(this.contentEl, {
|
|
215
|
-
childList: !0,
|
|
216
|
-
subtree: !0,
|
|
217
|
-
characterData: !0
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
}, s.prototype.recalculate = function() {
|
|
221
|
-
if (!(!this.heightAutoObserverEl || !this.contentEl || !this.contentWrapperEl || !this.wrapperEl || !this.placeholderEl)) {
|
|
222
|
-
var t = g(this.el);
|
|
223
|
-
this.elStyles = t.getComputedStyle(this.el), this.isRtl = this.elStyles.direction === "rtl";
|
|
224
|
-
var i = this.contentEl.offsetWidth, e = this.heightAutoObserverEl.offsetHeight <= 1, r = this.heightAutoObserverEl.offsetWidth <= 1 || i > 0, l = this.contentWrapperEl.offsetWidth, o = this.elStyles.overflowX, a = this.elStyles.overflowY;
|
|
225
|
-
this.contentEl.style.padding = "".concat(this.elStyles.paddingTop, " ").concat(this.elStyles.paddingRight, " ").concat(this.elStyles.paddingBottom, " ").concat(this.elStyles.paddingLeft), this.wrapperEl.style.margin = "-".concat(this.elStyles.paddingTop, " -").concat(this.elStyles.paddingRight, " -").concat(this.elStyles.paddingBottom, " -").concat(this.elStyles.paddingLeft);
|
|
226
|
-
var u = this.contentEl.scrollHeight, h = this.contentEl.scrollWidth;
|
|
227
|
-
this.contentWrapperEl.style.height = e ? "auto" : "100%", this.placeholderEl.style.width = r ? "".concat(i || h, "px") : "auto", this.placeholderEl.style.height = "".concat(u, "px");
|
|
228
|
-
var v = this.contentWrapperEl.offsetHeight;
|
|
229
|
-
this.axis.x.isOverflowing = i !== 0 && h > i, this.axis.y.isOverflowing = u > v, this.axis.x.isOverflowing = o === "hidden" ? !1 : this.axis.x.isOverflowing, this.axis.y.isOverflowing = a === "hidden" ? !1 : this.axis.y.isOverflowing, this.axis.x.forceVisible = this.options.forceVisible === "x" || this.options.forceVisible === !0, this.axis.y.forceVisible = this.options.forceVisible === "y" || this.options.forceVisible === !0, this.hideNativeScrollbar();
|
|
230
|
-
var n = this.axis.x.isOverflowing ? this.scrollbarWidth : 0, p = this.axis.y.isOverflowing ? this.scrollbarWidth : 0;
|
|
231
|
-
this.axis.x.isOverflowing = this.axis.x.isOverflowing && h > l - p, this.axis.y.isOverflowing = this.axis.y.isOverflowing && u > v - n, this.axis.x.scrollbar.size = this.getScrollbarSize("x"), this.axis.y.scrollbar.size = this.getScrollbarSize("y"), this.axis.x.scrollbar.el && (this.axis.x.scrollbar.el.style.width = "".concat(this.axis.x.scrollbar.size, "px")), this.axis.y.scrollbar.el && (this.axis.y.scrollbar.el.style.height = "".concat(this.axis.y.scrollbar.size, "px")), this.positionScrollbar("x"), this.positionScrollbar("y"), this.toggleTrackVisibility("x"), this.toggleTrackVisibility("y");
|
|
232
|
-
}
|
|
233
|
-
}, s.prototype.getScrollbarSize = function(t) {
|
|
234
|
-
var i, e;
|
|
235
|
-
if (t === void 0 && (t = "y"), !this.axis[t].isOverflowing || !this.contentEl)
|
|
236
|
-
return 0;
|
|
237
|
-
var r = this.contentEl[this.axis[t].scrollSizeAttr], l = (e = (i = this.axis[t].track.el) === null || i === void 0 ? void 0 : i[this.axis[t].offsetSizeAttr]) !== null && e !== void 0 ? e : 0, o = l / r, a;
|
|
238
|
-
return a = Math.max(~~(o * l), this.options.scrollbarMinSize), this.options.scrollbarMaxSize && (a = Math.min(a, this.options.scrollbarMaxSize)), a;
|
|
239
|
-
}, s.prototype.positionScrollbar = function(t) {
|
|
240
|
-
var i, e, r;
|
|
241
|
-
t === void 0 && (t = "y");
|
|
242
|
-
var l = this.axis[t].scrollbar;
|
|
243
|
-
if (!(!this.axis[t].isOverflowing || !this.contentWrapperEl || !l.el || !this.elStyles)) {
|
|
244
|
-
var o = this.contentWrapperEl[this.axis[t].scrollSizeAttr], a = ((i = this.axis[t].track.el) === null || i === void 0 ? void 0 : i[this.axis[t].offsetSizeAttr]) || 0, u = parseInt(this.elStyles[this.axis[t].sizeAttr], 10), h = this.contentWrapperEl[this.axis[t].scrollOffsetAttr];
|
|
245
|
-
h = t === "x" && this.isRtl && (!((e = s.getRtlHelpers()) === null || e === void 0) && e.isScrollOriginAtZero) ? -h : h, t === "x" && this.isRtl && (h = !((r = s.getRtlHelpers()) === null || r === void 0) && r.isScrollingToNegative ? h : -h);
|
|
246
|
-
var v = h / (o - u), n = ~~((a - l.size) * v);
|
|
247
|
-
n = t === "x" && this.isRtl ? -n + (a - l.size) : n, l.el.style.transform = t === "x" ? "translate3d(".concat(n, "px, 0, 0)") : "translate3d(0, ".concat(n, "px, 0)");
|
|
248
|
-
}
|
|
249
|
-
}, s.prototype.toggleTrackVisibility = function(t) {
|
|
250
|
-
t === void 0 && (t = "y");
|
|
251
|
-
var i = this.axis[t].track.el, e = this.axis[t].scrollbar.el;
|
|
252
|
-
!i || !e || !this.contentWrapperEl || (this.axis[t].isOverflowing || this.axis[t].forceVisible ? (i.style.visibility = "visible", this.contentWrapperEl.style[this.axis[t].overflowAttr] = "scroll", this.el.classList.add("".concat(this.classNames.scrollable, "-").concat(t))) : (i.style.visibility = "hidden", this.contentWrapperEl.style[this.axis[t].overflowAttr] = "hidden", this.el.classList.remove("".concat(this.classNames.scrollable, "-").concat(t))), this.axis[t].isOverflowing ? e.style.display = "block" : e.style.display = "none");
|
|
253
|
-
}, s.prototype.showScrollbar = function(t) {
|
|
254
|
-
t === void 0 && (t = "y"), this.axis[t].isOverflowing && !this.axis[t].scrollbar.isVisible && (b(this.axis[t].scrollbar.el, this.classNames.visible), this.axis[t].scrollbar.isVisible = !0);
|
|
255
|
-
}, s.prototype.hideScrollbar = function(t) {
|
|
256
|
-
t === void 0 && (t = "y"), !this.isDragging && this.axis[t].isOverflowing && this.axis[t].scrollbar.isVisible && (y(this.axis[t].scrollbar.el, this.classNames.visible), this.axis[t].scrollbar.isVisible = !1);
|
|
257
|
-
}, s.prototype.hideNativeScrollbar = function() {
|
|
258
|
-
this.offsetEl && (this.offsetEl.style[this.isRtl ? "left" : "right"] = this.axis.y.isOverflowing || this.axis.y.forceVisible ? "-".concat(this.scrollbarWidth, "px") : "0px", this.offsetEl.style.bottom = this.axis.x.isOverflowing || this.axis.x.forceVisible ? "-".concat(this.scrollbarWidth, "px") : "0px");
|
|
259
|
-
}, s.prototype.onMouseMoveForAxis = function(t) {
|
|
260
|
-
t === void 0 && (t = "y");
|
|
261
|
-
var i = this.axis[t];
|
|
262
|
-
!i.track.el || !i.scrollbar.el || (i.track.rect = i.track.el.getBoundingClientRect(), i.scrollbar.rect = i.scrollbar.el.getBoundingClientRect(), this.isWithinBounds(i.track.rect) ? (this.showScrollbar(t), b(i.track.el, this.classNames.hover), this.isWithinBounds(i.scrollbar.rect) ? b(i.scrollbar.el, this.classNames.hover) : y(i.scrollbar.el, this.classNames.hover)) : (y(i.track.el, this.classNames.hover), this.options.autoHide && this.hideScrollbar(t)));
|
|
263
|
-
}, s.prototype.onMouseLeaveForAxis = function(t) {
|
|
264
|
-
t === void 0 && (t = "y"), y(this.axis[t].track.el, this.classNames.hover), y(this.axis[t].scrollbar.el, this.classNames.hover), this.options.autoHide && this.hideScrollbar(t);
|
|
265
|
-
}, s.prototype.onDragStart = function(t, i) {
|
|
266
|
-
var e;
|
|
267
|
-
i === void 0 && (i = "y"), this.isDragging = !0;
|
|
268
|
-
var r = C(this.el), l = g(this.el), o = this.axis[i].scrollbar, a = i === "y" ? t.pageY : t.pageX;
|
|
269
|
-
this.axis[i].dragOffset = a - (((e = o.rect) === null || e === void 0 ? void 0 : e[this.axis[i].offsetAttr]) || 0), this.draggedAxis = i, b(this.el, this.classNames.dragging), r.addEventListener("mousemove", this.drag, !0), r.addEventListener("mouseup", this.onEndDrag, !0), this.removePreventClickId === null ? (r.addEventListener("click", this.preventClick, !0), r.addEventListener("dblclick", this.preventClick, !0)) : (l.clearTimeout(this.removePreventClickId), this.removePreventClickId = null);
|
|
270
|
-
}, s.prototype.onTrackClick = function(t, i) {
|
|
271
|
-
var e = this, r, l, o, a;
|
|
272
|
-
i === void 0 && (i = "y");
|
|
273
|
-
var u = this.axis[i];
|
|
274
|
-
if (!(!this.options.clickOnTrack || !u.scrollbar.el || !this.contentWrapperEl)) {
|
|
275
|
-
t.preventDefault();
|
|
276
|
-
var h = g(this.el);
|
|
277
|
-
this.axis[i].scrollbar.rect = u.scrollbar.el.getBoundingClientRect();
|
|
278
|
-
var v = this.axis[i].scrollbar, n = (l = (r = v.rect) === null || r === void 0 ? void 0 : r[this.axis[i].offsetAttr]) !== null && l !== void 0 ? l : 0, p = parseInt((a = (o = this.elStyles) === null || o === void 0 ? void 0 : o[this.axis[i].sizeAttr]) !== null && a !== void 0 ? a : "0px", 10), c = this.contentWrapperEl[this.axis[i].scrollOffsetAttr], W = i === "y" ? this.mouseY - n : this.mouseX - n, E = W < 0 ? -1 : 1, x = E === -1 ? c - p : c + p, S = 40, A = function() {
|
|
279
|
-
e.contentWrapperEl && (E === -1 ? c > x && (c -= S, e.contentWrapperEl[e.axis[i].scrollOffsetAttr] = c, h.requestAnimationFrame(A)) : c < x && (c += S, e.contentWrapperEl[e.axis[i].scrollOffsetAttr] = c, h.requestAnimationFrame(A)));
|
|
280
|
-
};
|
|
281
|
-
A();
|
|
282
|
-
}
|
|
283
|
-
}, s.prototype.getContentElement = function() {
|
|
284
|
-
return this.contentEl;
|
|
285
|
-
}, s.prototype.getScrollElement = function() {
|
|
286
|
-
return this.contentWrapperEl;
|
|
287
|
-
}, s.prototype.removeListeners = function() {
|
|
288
|
-
var t = g(this.el);
|
|
289
|
-
this.el.removeEventListener("mouseenter", this.onMouseEnter), this.el.removeEventListener("pointerdown", this.onPointerEvent, !0), this.el.removeEventListener("mousemove", this.onMouseMove), this.el.removeEventListener("mouseleave", this.onMouseLeave), this.contentWrapperEl && this.contentWrapperEl.removeEventListener("scroll", this.onScroll), t.removeEventListener("resize", this.onWindowResize), this.mutationObserver && this.mutationObserver.disconnect(), this.resizeObserver && this.resizeObserver.disconnect(), this.onMouseMove.cancel(), this.onWindowResize.cancel(), this.onStopScrolling.cancel(), this.onMouseEntered.cancel();
|
|
290
|
-
}, s.prototype.unMount = function() {
|
|
291
|
-
this.removeListeners();
|
|
292
|
-
}, s.prototype.isWithinBounds = function(t) {
|
|
293
|
-
return this.mouseX >= t.left && this.mouseX <= t.left + t.width && this.mouseY >= t.top && this.mouseY <= t.top + t.height;
|
|
294
|
-
}, s.prototype.findChild = function(t, i) {
|
|
295
|
-
var e = t.matches || t.webkitMatchesSelector || t.mozMatchesSelector || t.msMatchesSelector;
|
|
296
|
-
return Array.prototype.filter.call(t.children, function(r) {
|
|
297
|
-
return e.call(r, i);
|
|
298
|
-
})[0];
|
|
299
|
-
}, s.rtlHelpers = null, s.defaultOptions = {
|
|
300
|
-
forceVisible: !1,
|
|
301
|
-
clickOnTrack: !0,
|
|
302
|
-
scrollbarMinSize: 25,
|
|
303
|
-
scrollbarMaxSize: 0,
|
|
304
|
-
ariaLabel: "scrollable content",
|
|
305
|
-
tabIndex: 0,
|
|
306
|
-
classNames: {
|
|
307
|
-
contentEl: "simplebar-content",
|
|
308
|
-
contentWrapper: "simplebar-content-wrapper",
|
|
309
|
-
offset: "simplebar-offset",
|
|
310
|
-
mask: "simplebar-mask",
|
|
311
|
-
wrapper: "simplebar-wrapper",
|
|
312
|
-
placeholder: "simplebar-placeholder",
|
|
313
|
-
scrollbar: "simplebar-scrollbar",
|
|
314
|
-
track: "simplebar-track",
|
|
315
|
-
heightAutoObserverWrapperEl: "simplebar-height-auto-observer-wrapper",
|
|
316
|
-
heightAutoObserverEl: "simplebar-height-auto-observer",
|
|
317
|
-
visible: "simplebar-visible",
|
|
318
|
-
horizontal: "simplebar-horizontal",
|
|
319
|
-
vertical: "simplebar-vertical",
|
|
320
|
-
hover: "simplebar-hover",
|
|
321
|
-
dragging: "simplebar-dragging",
|
|
322
|
-
scrolling: "simplebar-scrolling",
|
|
323
|
-
scrollable: "simplebar-scrollable",
|
|
324
|
-
mouseEntered: "simplebar-mouse-entered"
|
|
325
|
-
},
|
|
326
|
-
scrollableNode: null,
|
|
327
|
-
contentNode: null,
|
|
328
|
-
autoHide: !0
|
|
329
|
-
}, s.getOptions = $, s.helpers = I, s;
|
|
330
|
-
})()
|
|
331
|
-
), m = function() {
|
|
332
|
-
return m = Object.assign || function(t) {
|
|
333
|
-
for (var i, e = 1, r = arguments.length; e < r; e++) {
|
|
334
|
-
i = arguments[e];
|
|
335
|
-
for (var l in i) Object.prototype.hasOwnProperty.call(i, l) && (t[l] = i[l]);
|
|
336
|
-
}
|
|
337
|
-
return t;
|
|
338
|
-
}, m.apply(this, arguments);
|
|
339
|
-
};
|
|
340
|
-
function Q(s, t) {
|
|
341
|
-
var i = {};
|
|
342
|
-
for (var e in s) Object.prototype.hasOwnProperty.call(s, e) && t.indexOf(e) < 0 && (i[e] = s[e]);
|
|
343
|
-
if (s != null && typeof Object.getOwnPropertySymbols == "function")
|
|
344
|
-
for (var r = 0, e = Object.getOwnPropertySymbols(s); r < e.length; r++)
|
|
345
|
-
t.indexOf(e[r]) < 0 && Object.prototype.propertyIsEnumerable.call(s, e[r]) && (i[e[r]] = s[e[r]]);
|
|
346
|
-
return i;
|
|
347
|
-
}
|
|
348
|
-
var U = f.forwardRef(function(s, t) {
|
|
349
|
-
var i = s.children, e = s.scrollableNodeProps, r = e === void 0 ? {} : e, l = Q(s, ["children", "scrollableNodeProps"]), o = f.useRef(), a = f.useRef(), u = f.useRef(), h = {}, v = {};
|
|
350
|
-
Object.keys(l).forEach(function(c) {
|
|
351
|
-
Object.prototype.hasOwnProperty.call(k.defaultOptions, c) ? h[c] = l[c] : v[c] = l[c];
|
|
352
|
-
});
|
|
353
|
-
var n = m(m({}, k.defaultOptions.classNames), h.classNames), p = m(m({}, r), { className: "".concat(n.contentWrapper).concat(r.className ? " ".concat(r.className) : ""), tabIndex: h.tabIndex || k.defaultOptions.tabIndex, role: "region", "aria-label": h.ariaLabel || k.defaultOptions.ariaLabel });
|
|
354
|
-
return f.useEffect(function() {
|
|
355
|
-
var c;
|
|
356
|
-
return a.current = p.ref ? p.ref.current : a.current, o.current && (c = new k(o.current, m(m(m({}, h), a.current && {
|
|
357
|
-
scrollableNode: a.current
|
|
358
|
-
}), u.current && {
|
|
359
|
-
contentNode: u.current
|
|
360
|
-
})), typeof t == "function" ? t(c) : t && (t.current = c)), function() {
|
|
361
|
-
c == null || c.unMount(), c = null, typeof t == "function" && t(null);
|
|
362
|
-
};
|
|
363
|
-
}, []), f.createElement(
|
|
364
|
-
"div",
|
|
365
|
-
m({ "data-simplebar": "init", ref: o }, v),
|
|
366
|
-
f.createElement(
|
|
367
|
-
"div",
|
|
368
|
-
{ className: n.wrapper },
|
|
369
|
-
f.createElement(
|
|
370
|
-
"div",
|
|
371
|
-
{ className: n.heightAutoObserverWrapperEl },
|
|
372
|
-
f.createElement("div", { className: n.heightAutoObserverEl })
|
|
373
|
-
),
|
|
374
|
-
f.createElement(
|
|
375
|
-
"div",
|
|
376
|
-
{ className: n.mask },
|
|
377
|
-
f.createElement("div", { className: n.offset }, typeof i == "function" ? i({
|
|
378
|
-
scrollableNodeRef: a,
|
|
379
|
-
scrollableNodeProps: m(m({}, p), { ref: a }),
|
|
380
|
-
contentNodeRef: u,
|
|
381
|
-
contentNodeProps: {
|
|
382
|
-
className: n.contentEl,
|
|
383
|
-
ref: u
|
|
384
|
-
}
|
|
385
|
-
}) : f.createElement(
|
|
386
|
-
"div",
|
|
387
|
-
m({}, p),
|
|
388
|
-
f.createElement("div", { className: n.contentEl }, i)
|
|
389
|
-
))
|
|
390
|
-
),
|
|
391
|
-
f.createElement("div", { className: n.placeholder })
|
|
392
|
-
),
|
|
393
|
-
f.createElement(
|
|
394
|
-
"div",
|
|
395
|
-
{ className: "".concat(n.track, " ").concat(n.horizontal) },
|
|
396
|
-
f.createElement("div", { className: n.scrollbar })
|
|
397
|
-
),
|
|
398
|
-
f.createElement(
|
|
399
|
-
"div",
|
|
400
|
-
{ className: "".concat(n.track, " ").concat(n.vertical) },
|
|
401
|
-
f.createElement("div", { className: n.scrollbar })
|
|
402
|
-
)
|
|
403
|
-
);
|
|
404
|
-
});
|
|
405
|
-
U.displayName = "SimpleBar";
|
|
406
|
-
export {
|
|
407
|
-
U as S
|
|
408
|
-
};
|