@baishuyun/ui-base 2.3.2 → 2.3.4

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