@bynder/compact-view 5.2.2 → 5.2.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.
- package/AccessToken2.js +1 -1
- package/ActiveFilters.js +49 -50
- package/AddMedia.js +19 -18
- package/Advanced.js +13 -13
- package/App.js +60 -59
- package/Arrow.js +1 -1
- package/AssetFilter.js +38 -38
- package/AssetItem.js +10 -17
- package/AssetList.js +5 -5
- package/AssetTypeItem.js +21 -21
- package/AssetsView.js +13 -13
- package/Axios2.js +82 -76
- package/AxiosError.js +36 -35
- package/ButtonAction.js +1 -1
- package/CanceledError.js +15 -8
- package/Card.js +1 -1
- package/Chip.js +1 -1
- package/CollectionCard.js +22 -22
- package/CollectionItem.js +9 -9
- package/CollectionList.js +5 -5
- package/CollectionView.js +11 -11
- package/ColorPicker.js +1 -1
- package/ColorPickerSolid.js +3 -3
- package/ColorPickerWithOpacity.js +3 -3
- package/Component.js +158 -0
- package/Component2.js +4 -0
- package/ConfigContext.js +7 -8
- package/Container.js +1 -1
- package/ContextAction.js +1 -1
- package/ControlGroup.js +6 -6
- package/Dat.js +33 -32
- package/DatDropdownItem.js +1 -1
- package/DesignSystemProvider.js +7 -7
- package/DirectionSelect.js +11 -10
- package/DomainInput.js +19 -11
- package/Draggable.js +337 -0
- package/Draggable2.js +4 -0
- package/DraggableCore.js +312 -0
- package/DraggableCore2.js +4 -0
- package/Dropdown.js +37 -37
- package/Dropdown2.js +1 -1
- package/DropdownListItem.js +1 -1
- package/FieldSelect.js +19 -17
- package/FileSelector.js +38 -37
- package/FontPicker.js +1 -1
- package/Form.js +1 -1
- package/Header.js +5 -4
- package/HttpStatusCode.js +7 -1
- package/InfiniteScroll.js +1 -1
- package/InlineBanner.js +1 -1
- package/Input.js +1 -1
- package/InterceptorManager.js +2 -1
- package/Item.js +8 -8
- package/Item4.js +2 -2
- package/LeftArrow.js +1 -1
- package/ListItem2.js +1 -1
- package/ModalBase.js +15 -15
- package/NoResults.js +1 -1
- package/Option_new.js +36 -29
- package/ReactPropTypesSecret.js +10 -0
- package/RightArrow.js +1 -1
- package/SearchInput.js +1 -1
- package/SearchInput2.js +1 -1
- package/SelectionFooter.js +41 -31
- package/Shield.js +2 -2
- package/Smartfilters_new.js +107 -98
- package/StatefulAssetList.js +50 -50
- package/StoreInitializer.js +32 -16
- package/SwitchNLS.js +1 -1
- package/TagItem.js +15 -15
- package/Tags.js +1 -1
- package/Toolbar.js +23 -20
- package/Tooltip2.js +1 -1
- package/ViewSwitch.js +17 -15
- package/_commonjsHelpers.js +28 -3
- package/adapters.js +54 -42
- package/api/filterAssets.d.ts +1 -1
- package/api/getAssets.d.ts +1 -1
- package/api/getFilters.d.ts +1 -1
- package/api/rest/index.d.ts +1 -1
- package/api/rest/types.d.ts +1 -1
- package/api2.js +1 -1
- package/asset.type.js +1 -1
- package/axios.js +1 -1
- package/bodyScrollLock.esm.js +68 -0
- package/buildURL.js +13 -15
- package/checkGlobals.js +1 -1
- package/cjs.js +7 -0
- package/cjs2.js +15 -0
- package/cjs3.js +4 -0
- package/clsx.m.js +6 -0
- package/clsx.m2.js +15 -0
- package/combineMetaproperties.js +3 -1
- package/composeSignals.js +1 -1
- package/cookieStore.js +1 -1
- package/cookies.js +13 -11
- package/currentScopes.js +1 -1
- package/data.js +1 -1
- package/devUtils.js +1 -1
- package/dispatchRequest.js +5 -5
- package/domFns.js +151 -0
- package/domFns2.js +4 -0
- package/factoryWithThrowingShims.js +52 -0
- package/fetch2.js +156 -128
- package/filter/AssetFilterContext.d.ts +3 -3
- package/getPrefix.js +35 -0
- package/getPrefix2.js +4 -0
- package/goober.modern.js +75 -0
- package/handlers.js +1 -1
- package/iconBase.js +56 -0
- package/iconContext.js +12 -0
- package/iconsManifest.js +222 -0
- package/index-esm.js +1 -4
- package/index.browser.js +1 -1
- package/index.m.js +9 -0
- package/index.m2.js +17 -0
- package/index10.js +1 -1
- package/index11.js +181 -15
- package/index112.js +1 -1
- package/index12.js +313 -36
- package/index13.js +5 -2430
- package/index14.js +3 -557
- package/index15.js +15 -55
- package/index16.js +3 -2
- package/index17.js +3 -87
- package/index18.js +36 -7
- package/index19.js +3 -60
- package/index20.js +2429 -12
- package/index21.js +557 -10
- package/index22.js +1 -1
- package/index23.js +119 -6
- package/index24.js +39 -7
- package/index25.js +2 -5
- package/index26.js +86 -9
- package/index27.js +55 -8
- package/index28.js +6 -636
- package/index29.js +8692 -74
- package/index3.js +1684 -5
- package/index30.js +2 -5
- package/index31.js +4 -20
- package/index310.js +2 -0
- package/index32.js +11 -2
- package/index33.js +5083 -4
- package/index34.js +2 -18
- package/index35.js +59 -5
- package/index36.js +2 -2
- package/index37.js +13 -11
- package/index38.js +46 -10
- package/index39.js +6 -12
- package/index4.js +5 -1684
- package/index40.js +8 -11
- package/index41.js +26 -18
- package/index42.js +2 -64
- package/index43.js +63 -5
- package/index44.js +9 -55
- package/index45.js +7 -67
- package/index46.js +8 -31
- package/index47.js +5 -11
- package/index48.js +10 -121
- package/index49.js +9 -86
- package/index5.js +215 -23
- package/index50.js +636 -7
- package/index51.js +74 -11
- package/index52.js +4 -13
- package/index53.js +19 -13
- package/index54.js +4 -6
- package/index55.js +18 -7
- package/index56.js +5 -14
- package/index57.js +10 -28
- package/index58.js +10 -15
- package/index59.js +15 -0
- package/index6.js +250 -299
- package/index60.js +13 -0
- package/index61.js +21 -0
- package/index62.js +8 -0
- package/index63.js +57 -0
- package/index64.js +4 -0
- package/index65.js +69 -0
- package/index66.js +33 -0
- package/index67.js +13 -0
- package/index68.js +123 -0
- package/index69.js +88 -0
- package/index7.js +25 -2
- package/index70.js +10 -0
- package/index71.js +13 -0
- package/index72.js +13 -225
- package/index73.js +16 -0
- package/index74.js +9 -0
- package/index75.js +228 -0
- package/index76.js +9 -0
- package/index77.js +17 -0
- package/index78.js +31 -0
- package/index79.js +18 -0
- package/index8.js +1537 -1536
- package/index9.js +1 -1
- package/isAbsoluteURL.js +1 -1
- package/isURLSameOrigin.js +1 -1
- package/localization.js +15 -15
- package/log.js +14 -0
- package/log2.js +4 -0
- package/matchRequestUrl.js +1 -1
- package/mergeConfig.js +37 -32
- package/notify.js +2 -2
- package/package.json +1 -1
- package/positionFns.js +101 -0
- package/positionFns2.js +4 -0
- package/react-laag.esm.js +957 -0
- package/react.js +8 -8
- package/react2.js +9 -9
- package/resolveConfig.js +23 -23
- package/select/add-media/AddMedia.d.ts +3 -1
- package/select/current-selection/SelectedItems.d.ts +1 -1
- package/shims.js +29 -0
- package/shims2.js +4 -0
- package/store/StoreInitializer.d.ts +5 -1
- package/store/useAssetFilterStore.d.ts +55 -0
- package/store/useSelectionStore.d.ts +47 -0
- package/styled-components.browser.esm.js +2 -2
- package/throttle.js +1 -1
- package/toURLEncodedForm.js +11 -10
- package/tokenExpirationHelper.js +1 -1
- package/transformData.js +1 -1
- package/transitional.js +4 -3
- package/useAssetFilterStore.js +152 -0
- package/useDatStore.js +1 -1
- package/useEffectEvent.js +7 -7
- package/useFonts.js +1 -1
- package/useOrderingStore.js +1 -1
- package/useRouterStore.js +1 -1
- package/useSearchStore.js +1 -1
- package/useSelectionStore.js +131 -0
- package/useSimilaritySearchStore.js +1 -1
- package/useTranslate.js +1 -1
- package/utils/combineMetaproperties.d.ts +2 -0
- package/utils6.js +160 -118
- package/xhr.js +47 -46
- package/AssetFilterContext.js +0 -161
- package/Middleware.js +0 -49
- package/SelectionContext.js +0 -143
- package/middleware2.js +0 -177
- package/select/SelectionContext.d.ts +0 -30
|
@@ -0,0 +1,957 @@
|
|
|
1
|
+
import { useState as Le, useRef as L, useCallback as W, useEffect as V, useLayoutEffect as Je, useContext as Ke, createContext as Qe, createElement as He, useMemo as Re } from "react";
|
|
2
|
+
import { createPortal as Ze } from "react-dom";
|
|
3
|
+
function et(e, i) {
|
|
4
|
+
for (var r = 0; r < i.length; r++) {
|
|
5
|
+
var t = i[r];
|
|
6
|
+
t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(e, t.key, t);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function ie(e, i, r) {
|
|
10
|
+
return i && et(e.prototype, i), e;
|
|
11
|
+
}
|
|
12
|
+
function H() {
|
|
13
|
+
return H = Object.assign || function(e) {
|
|
14
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
15
|
+
var r = arguments[i];
|
|
16
|
+
for (var t in r)
|
|
17
|
+
Object.prototype.hasOwnProperty.call(r, t) && (e[t] = r[t]);
|
|
18
|
+
}
|
|
19
|
+
return e;
|
|
20
|
+
}, H.apply(this, arguments);
|
|
21
|
+
}
|
|
22
|
+
function tt(e, i) {
|
|
23
|
+
e.prototype = Object.create(i.prototype), e.prototype.constructor = e, ue(e, i);
|
|
24
|
+
}
|
|
25
|
+
function ue(e, i) {
|
|
26
|
+
return ue = Object.setPrototypeOf || function(t, n) {
|
|
27
|
+
return t.__proto__ = n, t;
|
|
28
|
+
}, ue(e, i);
|
|
29
|
+
}
|
|
30
|
+
function rt(e, i) {
|
|
31
|
+
if (e) {
|
|
32
|
+
if (typeof e == "string") return me(e, i);
|
|
33
|
+
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
34
|
+
if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set") return Array.from(e);
|
|
35
|
+
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return me(e, i);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function me(e, i) {
|
|
39
|
+
(i == null || i > e.length) && (i = e.length);
|
|
40
|
+
for (var r = 0, t = new Array(i); r < i; r++) t[r] = e[r];
|
|
41
|
+
return t;
|
|
42
|
+
}
|
|
43
|
+
function K(e, i) {
|
|
44
|
+
var r = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
45
|
+
if (r) return (r = r.call(e)).next.bind(r);
|
|
46
|
+
if (Array.isArray(e) || (r = rt(e)) || i) {
|
|
47
|
+
r && (e = r);
|
|
48
|
+
var t = 0;
|
|
49
|
+
return function() {
|
|
50
|
+
return t >= e.length ? {
|
|
51
|
+
done: !0
|
|
52
|
+
} : {
|
|
53
|
+
done: !1,
|
|
54
|
+
value: e[t++]
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
59
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
60
|
+
}
|
|
61
|
+
function we(e) {
|
|
62
|
+
var i = L(null);
|
|
63
|
+
function r(t) {
|
|
64
|
+
!t || t === i.current || (i.current = t, e(t));
|
|
65
|
+
}
|
|
66
|
+
return r;
|
|
67
|
+
}
|
|
68
|
+
function nt(e) {
|
|
69
|
+
var i = L(e);
|
|
70
|
+
return Re(function() {
|
|
71
|
+
function r(n) {
|
|
72
|
+
typeof n == "function" ? i.current = n(i.current) : i.current = n;
|
|
73
|
+
}
|
|
74
|
+
function t() {
|
|
75
|
+
return i.current;
|
|
76
|
+
}
|
|
77
|
+
return [t, r];
|
|
78
|
+
}, []);
|
|
79
|
+
}
|
|
80
|
+
function it() {
|
|
81
|
+
var e = L([]);
|
|
82
|
+
return Re(function() {
|
|
83
|
+
function i() {
|
|
84
|
+
return e.current.length > 0;
|
|
85
|
+
}
|
|
86
|
+
function r() {
|
|
87
|
+
for (var n = K(e.current), o; !(o = n()).done; ) {
|
|
88
|
+
var s = o.value;
|
|
89
|
+
s();
|
|
90
|
+
}
|
|
91
|
+
e.current = [];
|
|
92
|
+
}
|
|
93
|
+
function t(n) {
|
|
94
|
+
e.current.push(n);
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
hasEventSubscriptions: i,
|
|
98
|
+
removeAllEventSubscriptions: r,
|
|
99
|
+
addEventSubscription: t
|
|
100
|
+
};
|
|
101
|
+
}, []);
|
|
102
|
+
}
|
|
103
|
+
var ae = typeof window < "u" ? Je : V;
|
|
104
|
+
function ot(e, i) {
|
|
105
|
+
var r = L(e);
|
|
106
|
+
return i ? (r.current = e, r) : (r.current = null, r);
|
|
107
|
+
}
|
|
108
|
+
function Z(e) {
|
|
109
|
+
return parseFloat(e.replace("px", ""));
|
|
110
|
+
}
|
|
111
|
+
function le(e, i, r) {
|
|
112
|
+
return e < i ? i : e > r ? r : e;
|
|
113
|
+
}
|
|
114
|
+
function be(e) {
|
|
115
|
+
return e != null;
|
|
116
|
+
}
|
|
117
|
+
function Se() {
|
|
118
|
+
for (var e = arguments.length, i = new Array(e), r = 0; r < e; r++)
|
|
119
|
+
i[r] = arguments[r];
|
|
120
|
+
return function(t) {
|
|
121
|
+
for (var n = K(i), o; !(o = n()).done; ) {
|
|
122
|
+
var s = o.value;
|
|
123
|
+
s && (typeof s == "function" ? s(t) : s.current = t);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function st(e, i) {
|
|
128
|
+
if (!(typeof e > "u"))
|
|
129
|
+
return i || e.ResizeObserver;
|
|
130
|
+
}
|
|
131
|
+
function je(e, i) {
|
|
132
|
+
var r = [];
|
|
133
|
+
if (!e || !i || e === document.body)
|
|
134
|
+
return r;
|
|
135
|
+
var t = i.getComputedStyle(e), n = t.overflow, o = t.overflowX, s = t.overflowY;
|
|
136
|
+
return [n, o, s].some(function(a) {
|
|
137
|
+
return ["auto", "scroll"].includes(a);
|
|
138
|
+
}) && r.push(e), [].concat(r, je(e.parentElement, i));
|
|
139
|
+
}
|
|
140
|
+
function re(e) {
|
|
141
|
+
return "react-laag: Could not find a valid reference for the " + e + ` element. There might be 2 causes:
|
|
142
|
+
- Make sure that the 'ref' is set correctly on the ` + e + ` element when isOpen: true. Also make sure your component forwards the ref with "forwardRef()".
|
|
143
|
+
- Make sure that you are actually rendering the ` + e + " when the isOpen prop is set to true";
|
|
144
|
+
}
|
|
145
|
+
function at(e) {
|
|
146
|
+
var i = e.enabled, r = e.onChange, t = e.environment, n = e.ResizeObserverPolyfill, o = e.overflowContainer, s = e.triggerOption, a = st(t, n);
|
|
147
|
+
V(function() {
|
|
148
|
+
}, [a]);
|
|
149
|
+
var c = L(null), u = !!s, f = nt({
|
|
150
|
+
scrollContainers: [],
|
|
151
|
+
trigger: null,
|
|
152
|
+
layer: null
|
|
153
|
+
}), l = f[0], d = f[1], p = it(), v = p.hasEventSubscriptions, h = p.addEventSubscription, w = p.removeAllEventSubscriptions, m = W(function() {
|
|
154
|
+
var b = l(), C = b.layer, O = b.trigger, j = b.scrollContainers, T = j[0];
|
|
155
|
+
if (!C)
|
|
156
|
+
throw new Error(re("layer"));
|
|
157
|
+
if (!O && !u)
|
|
158
|
+
throw new Error(re("trigger"));
|
|
159
|
+
var Y = {
|
|
160
|
+
top: 0,
|
|
161
|
+
left: 0
|
|
162
|
+
};
|
|
163
|
+
if (T) {
|
|
164
|
+
var M = T.scrollLeft, G = T.scrollTop;
|
|
165
|
+
Y = {
|
|
166
|
+
top: G,
|
|
167
|
+
left: M
|
|
168
|
+
};
|
|
169
|
+
} else {
|
|
170
|
+
var U = t.scrollX, z = t.scrollY;
|
|
171
|
+
Y = {
|
|
172
|
+
top: z,
|
|
173
|
+
left: U
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
var X = {
|
|
177
|
+
left: 0,
|
|
178
|
+
top: 0
|
|
179
|
+
};
|
|
180
|
+
if (T) {
|
|
181
|
+
var D = t.getComputedStyle(T), Q = D.borderLeftWidth, _ = D.borderTopWidth;
|
|
182
|
+
X = {
|
|
183
|
+
left: Z(Q) || 0,
|
|
184
|
+
top: Z(_) || 0
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
r({
|
|
188
|
+
layer: C,
|
|
189
|
+
trigger: O,
|
|
190
|
+
scrollContainers: j,
|
|
191
|
+
arrow: c.current
|
|
192
|
+
}, Y, X);
|
|
193
|
+
}, [l, r, t, c, u]), g = W(function() {
|
|
194
|
+
var b = l(), C = b.trigger, O = b.layer, j = b.scrollContainers;
|
|
195
|
+
if (!O)
|
|
196
|
+
throw new Error(re("layer"));
|
|
197
|
+
if (!C && !u)
|
|
198
|
+
throw new Error(re("trigger"));
|
|
199
|
+
if (a) {
|
|
200
|
+
for (var T = !1, Y = function() {
|
|
201
|
+
if (!T) {
|
|
202
|
+
T = !0;
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
m();
|
|
206
|
+
}, M = new a(Y), G = 0, U = [C, O, document.body]; G < U.length; G++) {
|
|
207
|
+
var z = U[G];
|
|
208
|
+
z && M.observe(z);
|
|
209
|
+
}
|
|
210
|
+
h(function() {
|
|
211
|
+
for (var N = 0, x = [C, O, document.body]; N < x.length; N++) {
|
|
212
|
+
var ee = x[N];
|
|
213
|
+
ee && M.unobserve(ee);
|
|
214
|
+
}
|
|
215
|
+
M.disconnect();
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
for (var X = [t].concat(j), D = function() {
|
|
219
|
+
var x = _.value;
|
|
220
|
+
x.addEventListener("scroll", m), h(function() {
|
|
221
|
+
return x.removeEventListener("scroll", m);
|
|
222
|
+
});
|
|
223
|
+
}, Q = K(X), _; !(_ = Q()).done; )
|
|
224
|
+
D();
|
|
225
|
+
}, [l, h, m, t, a, u]), P = W(function(y, b) {
|
|
226
|
+
i && y && y !== b && (w(), g(), m());
|
|
227
|
+
}, [w, g, m, i]), F = we(W(function(y) {
|
|
228
|
+
var b = l(), C = b.layer;
|
|
229
|
+
d(function(O) {
|
|
230
|
+
return H({}, O, {
|
|
231
|
+
layer: y
|
|
232
|
+
});
|
|
233
|
+
}), P(C, y);
|
|
234
|
+
}, [l, d, P])), B = W(function(b) {
|
|
235
|
+
var C = je(b, t), O = C[0];
|
|
236
|
+
if (O) {
|
|
237
|
+
var j = t.getComputedStyle(O).position, T = ["relative", "absolute", "fixed"].includes(j) || o;
|
|
238
|
+
T || (O.style.position = "relative");
|
|
239
|
+
}
|
|
240
|
+
return C;
|
|
241
|
+
}, [t, o]), R = we(W(function(y) {
|
|
242
|
+
var b = B(y), C = l(), O = C.trigger;
|
|
243
|
+
d(function(j) {
|
|
244
|
+
return H({}, j, {
|
|
245
|
+
trigger: y,
|
|
246
|
+
scrollContainers: b
|
|
247
|
+
});
|
|
248
|
+
}), P(O, y);
|
|
249
|
+
}, [l, d, P, B])), k = s == null || s.getParent == null ? void 0 : s.getParent();
|
|
250
|
+
return ae(function() {
|
|
251
|
+
k && d(function(y) {
|
|
252
|
+
return H({}, y, {
|
|
253
|
+
scrollContainers: B(k)
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
}, [k, d, B]), ae(function() {
|
|
257
|
+
return i && (v() || g()), function() {
|
|
258
|
+
v() && w();
|
|
259
|
+
};
|
|
260
|
+
}, [i, v, g, w]), ae(function() {
|
|
261
|
+
i && m();
|
|
262
|
+
}), {
|
|
263
|
+
triggerRef: R,
|
|
264
|
+
layerRef: F,
|
|
265
|
+
arrowRef: c,
|
|
266
|
+
closestScrollContainer: l().scrollContainers[0] || null
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
var ze = /* @__PURE__ */ Qe({});
|
|
270
|
+
function ut(e) {
|
|
271
|
+
var i = e.children, r = e.registrations, t = W(function(o) {
|
|
272
|
+
return r.current.add(o), function() {
|
|
273
|
+
return r.current.delete(o);
|
|
274
|
+
};
|
|
275
|
+
}, [r]);
|
|
276
|
+
return He(ze.Provider, {
|
|
277
|
+
value: t
|
|
278
|
+
}, i);
|
|
279
|
+
}
|
|
280
|
+
function lt(e, i) {
|
|
281
|
+
for (var r = K(e), t; !(t = r()).done; ) {
|
|
282
|
+
var n = t.value.shouldCloseWhenClickedOutside;
|
|
283
|
+
if (!n(i))
|
|
284
|
+
return !1;
|
|
285
|
+
}
|
|
286
|
+
return !0;
|
|
287
|
+
}
|
|
288
|
+
function ft(e) {
|
|
289
|
+
var i = e.isOpen, r = e.onOutsideClick, t = e.onParentClose, n = L(null), o = L(null), s = L(/* @__PURE__ */ new Set()), a = Ke(ze), c = W(function(f) {
|
|
290
|
+
var l = f.target, d = n.current && n.current.contains(l), p = o.current && o.current.contains(l), v = lt(s.current, f);
|
|
291
|
+
return p && v && s.current.forEach(function(h) {
|
|
292
|
+
var w = h.closeChild;
|
|
293
|
+
return w();
|
|
294
|
+
}), !d && !p && v;
|
|
295
|
+
}, [n, o, s]);
|
|
296
|
+
return V(function() {
|
|
297
|
+
if (typeof a == "function")
|
|
298
|
+
return a({
|
|
299
|
+
shouldCloseWhenClickedOutside: c,
|
|
300
|
+
closeChild: function() {
|
|
301
|
+
t && t();
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}, [a, c, t, s]), V(function() {
|
|
305
|
+
var u = typeof a == "function", f = !i || !r || u;
|
|
306
|
+
if (f)
|
|
307
|
+
return;
|
|
308
|
+
function l(d) {
|
|
309
|
+
c(d) && r();
|
|
310
|
+
}
|
|
311
|
+
return document.addEventListener("click", l, !0), function() {
|
|
312
|
+
return document.removeEventListener("click", l, !0);
|
|
313
|
+
};
|
|
314
|
+
}, [i, r, c, a]), V(function() {
|
|
315
|
+
i || s.current.forEach(function(u) {
|
|
316
|
+
var f = u.closeChild;
|
|
317
|
+
return f();
|
|
318
|
+
});
|
|
319
|
+
}, [i]), {
|
|
320
|
+
closeOnOutsideClickRefs: {
|
|
321
|
+
trigger: n,
|
|
322
|
+
layer: o
|
|
323
|
+
},
|
|
324
|
+
registrations: s
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
var ct = ["bottom-start", "bottom-end", "bottom-center", "top-start", "top-center", "top-end", "left-end", "left-center", "left-start", "right-end", "right-center", "right-start", "center"], dt = {
|
|
328
|
+
top: "bottom",
|
|
329
|
+
left: "right",
|
|
330
|
+
bottom: "top",
|
|
331
|
+
right: "left",
|
|
332
|
+
center: "center"
|
|
333
|
+
}, vt = /* @__PURE__ */ (function() {
|
|
334
|
+
function e(r, t, n, o, s, a, c, u, f) {
|
|
335
|
+
this.prop = void 0, this.opposite = void 0, this.isHorizontal = void 0, this.sizeProp = void 0, this.oppositeSizeProp = void 0, this.cssProp = void 0, this.oppositeCssProp = void 0, this.isCenter = void 0, this.isPush = void 0, this.prop = r, this.opposite = t, this.isHorizontal = n, this.sizeProp = o, this.oppositeSizeProp = s, this.cssProp = a, this.oppositeCssProp = c, this.isCenter = u, this.isPush = f;
|
|
336
|
+
}
|
|
337
|
+
var i = e.prototype;
|
|
338
|
+
return i.factor = function(t) {
|
|
339
|
+
return t * (this.isPush ? 1 : -1);
|
|
340
|
+
}, i.isOppositeDirection = function(t) {
|
|
341
|
+
return this.isHorizontal !== t.isHorizontal;
|
|
342
|
+
}, e;
|
|
343
|
+
})();
|
|
344
|
+
function J(e, i) {
|
|
345
|
+
i === void 0 && (i = !0);
|
|
346
|
+
var r = ["left", "right"].includes(e);
|
|
347
|
+
return new vt(e, i ? J(dt[e], !1) : null, r, r ? "width" : "height", r ? "height" : "width", r ? "left" : "top", r ? "top" : "left", e === "center", !["right", "bottom"].includes(e));
|
|
348
|
+
}
|
|
349
|
+
var E = {
|
|
350
|
+
top: /* @__PURE__ */ J("top"),
|
|
351
|
+
bottom: /* @__PURE__ */ J("bottom"),
|
|
352
|
+
left: /* @__PURE__ */ J("left"),
|
|
353
|
+
right: /* @__PURE__ */ J("right")
|
|
354
|
+
}, S = /* @__PURE__ */ H({}, E, {
|
|
355
|
+
center: /* @__PURE__ */ J("center")
|
|
356
|
+
}), ne = ["top", "left", "bottom", "right"], ce = /* @__PURE__ */ (function() {
|
|
357
|
+
function e(i) {
|
|
358
|
+
return this.top = void 0, this.left = void 0, this.right = void 0, this.bottom = void 0, Object.assign(this, i);
|
|
359
|
+
}
|
|
360
|
+
return e.mergeSmallestSides = function(r) {
|
|
361
|
+
var t = r[0], n = r.slice(1);
|
|
362
|
+
if (!t)
|
|
363
|
+
throw new Error("Please provide at least 1 bounds objects in order to merge");
|
|
364
|
+
for (var o = Object.fromEntries(ne.map(function(d) {
|
|
365
|
+
return [d, t[d]];
|
|
366
|
+
})), s = K(n), a; !(a = s()).done; )
|
|
367
|
+
for (var c = a.value, u = K(ne), f; !(f = u()).done; ) {
|
|
368
|
+
var l = f.value;
|
|
369
|
+
o[l] = Math.min(o[l], c[l]);
|
|
370
|
+
}
|
|
371
|
+
return new e(o);
|
|
372
|
+
}, ie(e, [{
|
|
373
|
+
key: "allSidesArePositive",
|
|
374
|
+
get: function() {
|
|
375
|
+
var r = this;
|
|
376
|
+
return ne.every(function(t) {
|
|
377
|
+
return r[t] >= 0;
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Returns a partial IBoundsOffsets with sides that are negative, meaning sides aren't entirely
|
|
382
|
+
* visible in respect to a parent Bounds instance
|
|
383
|
+
*/
|
|
384
|
+
}, {
|
|
385
|
+
key: "negativeSides",
|
|
386
|
+
get: function() {
|
|
387
|
+
var r = this;
|
|
388
|
+
return Object.fromEntries(ne.filter(function(t) {
|
|
389
|
+
return r[t] < 0;
|
|
390
|
+
}).map(function(t) {
|
|
391
|
+
return [t, r[t]];
|
|
392
|
+
}));
|
|
393
|
+
}
|
|
394
|
+
}]), e;
|
|
395
|
+
})();
|
|
396
|
+
function Oe() {
|
|
397
|
+
for (var e = arguments.length, i = new Array(e), r = 0; r < e; r++)
|
|
398
|
+
i[r] = arguments[r];
|
|
399
|
+
return i.reduce(function(t, n) {
|
|
400
|
+
return t + (n ? Z(n) : 0);
|
|
401
|
+
}, 0);
|
|
402
|
+
}
|
|
403
|
+
function fe(e) {
|
|
404
|
+
var i = e.top, r = e.left, t = e.right, n = e.bottom, o = e.width, s = e.height;
|
|
405
|
+
return {
|
|
406
|
+
top: i,
|
|
407
|
+
left: r,
|
|
408
|
+
right: t,
|
|
409
|
+
bottom: n,
|
|
410
|
+
width: o,
|
|
411
|
+
height: s
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
var pt = {
|
|
415
|
+
top: 0,
|
|
416
|
+
left: 0,
|
|
417
|
+
right: 0,
|
|
418
|
+
bottom: 0,
|
|
419
|
+
width: 0,
|
|
420
|
+
height: 0
|
|
421
|
+
}, $ = /* @__PURE__ */ (function() {
|
|
422
|
+
e.create = function(t) {
|
|
423
|
+
return new e(t);
|
|
424
|
+
}, e.fromElement = function(t, n) {
|
|
425
|
+
n === void 0 && (n = {});
|
|
426
|
+
var o = n, s = o.withTransform, a = s === void 0 ? !0 : s, c = o.environment, u = c === void 0 ? window : c, f = o.withScrollbars, l = f === void 0 ? !0 : f, d = fe(t.getBoundingClientRect()), p = new e(d);
|
|
427
|
+
if (!a) {
|
|
428
|
+
var v = u.getComputedStyle(t), h = v.width, w = v.height, m = v.boxSizing, g = v.borderLeft, P = v.borderRight, F = v.borderTop, B = v.borderBottom, R = v.paddingLeft, k = v.paddingRight, y = v.paddingTop, b = v.paddingBottom, C = m === "border-box" ? Z(h) : Oe(h, g, P, R, k), O = m === "border-box" ? Z(w) : Oe(w, F, B, y, b);
|
|
429
|
+
p = new e(H({}, p, {
|
|
430
|
+
width: C,
|
|
431
|
+
height: O
|
|
432
|
+
}));
|
|
433
|
+
}
|
|
434
|
+
if (!l) {
|
|
435
|
+
var j = p.width - t.clientWidth, T = p.height - t.clientHeight;
|
|
436
|
+
return p.substract({
|
|
437
|
+
right: j,
|
|
438
|
+
bottom: T
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
return p;
|
|
442
|
+
}, e.empty = function() {
|
|
443
|
+
return new e();
|
|
444
|
+
}, e.fromWindow = function(t) {
|
|
445
|
+
var n, o = (n = t?.document.scrollingElement) != null ? n : t?.document.documentElement, s = o ?? {}, a = s.clientWidth, c = a === void 0 ? 0 : a, u = s.clientHeight, f = u === void 0 ? 0 : u;
|
|
446
|
+
return new e({
|
|
447
|
+
width: c,
|
|
448
|
+
height: f,
|
|
449
|
+
right: c,
|
|
450
|
+
bottom: f
|
|
451
|
+
});
|
|
452
|
+
};
|
|
453
|
+
function e(r) {
|
|
454
|
+
return r === void 0 && (r = {}), this.top = void 0, this.left = void 0, this.right = void 0, this.bottom = void 0, this.width = void 0, this.height = void 0, Object.assign(this, pt, r);
|
|
455
|
+
}
|
|
456
|
+
var i = e.prototype;
|
|
457
|
+
return i.toObject = function() {
|
|
458
|
+
return fe(this);
|
|
459
|
+
}, i.merge = function(t) {
|
|
460
|
+
var n = this.toObject();
|
|
461
|
+
return new e(H({}, n, typeof t == "function" ? t(n) : t));
|
|
462
|
+
}, i.substract = function(t) {
|
|
463
|
+
for (var n = this.toObject(), o = Object.entries(t), s = 0, a = o; s < a.length; s++) {
|
|
464
|
+
var c = a[s], u = c[0], f = c[1];
|
|
465
|
+
if (u in E) {
|
|
466
|
+
var l = E[u];
|
|
467
|
+
n[u] += l.factor(f), n[l.isHorizontal ? "width" : "height"] -= f;
|
|
468
|
+
} else
|
|
469
|
+
n[u] -= f || 0;
|
|
470
|
+
}
|
|
471
|
+
return new e(n);
|
|
472
|
+
}, i.offsetsTo = function(t) {
|
|
473
|
+
return new ce({
|
|
474
|
+
top: t.top - this.top,
|
|
475
|
+
bottom: this.bottom - t.bottom,
|
|
476
|
+
left: t.left - this.left,
|
|
477
|
+
right: this.right - t.right
|
|
478
|
+
});
|
|
479
|
+
}, i.mapSides = function(t) {
|
|
480
|
+
for (var n = this.toObject(), o = Object.values(E), s = 0, a = o; s < a.length; s++) {
|
|
481
|
+
var c = a[s];
|
|
482
|
+
n[c.prop] = t(c, n[c.prop]);
|
|
483
|
+
}
|
|
484
|
+
return new e(n);
|
|
485
|
+
}, ie(e, [{
|
|
486
|
+
key: "surface",
|
|
487
|
+
get: function() {
|
|
488
|
+
return this.width * this.height;
|
|
489
|
+
}
|
|
490
|
+
}]), e;
|
|
491
|
+
})(), Ae = /* @__PURE__ */ (function() {
|
|
492
|
+
function e(r, t, n, o, s) {
|
|
493
|
+
this.primary = void 0, this.secondary = void 0, this.offsets = void 0, this.subjectsBounds = void 0, this._cachedLayerBounds = null, this._cachedContainerOffsets = null, this.primary = r, this.secondary = t, this.offsets = s, this.setSubjectsBounds(n, o);
|
|
494
|
+
}
|
|
495
|
+
var i = e.prototype;
|
|
496
|
+
return i.setSubjectsBounds = function(t, n) {
|
|
497
|
+
if (!n) {
|
|
498
|
+
this.subjectsBounds = t;
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
var o = (
|
|
502
|
+
// if the user passed a callback, call it with the layerSide corresponding to
|
|
503
|
+
// the placement
|
|
504
|
+
typeof n == "function" ? n(this.primary.prop) : n
|
|
505
|
+
);
|
|
506
|
+
this.subjectsBounds = t.merge({
|
|
507
|
+
layer: H({}, t.layer, o)
|
|
508
|
+
});
|
|
509
|
+
}, i.getLayerBounds = function(t) {
|
|
510
|
+
if (t === void 0 && (t = 0), this._cachedLayerBounds && t === 0)
|
|
511
|
+
return this._cachedLayerBounds;
|
|
512
|
+
var n = this.primary, o = this.secondary, s = this.subjectsBounds, a = s.trigger, c = s.layer, u = s.arrow, f = n.isHorizontal, l = n.oppositeCssProp, d = n.oppositeSizeProp, p = n.prop, v = n.opposite, h = $.empty();
|
|
513
|
+
h[v.prop] = a[p] - n.factor(this.offsets.trigger), h[p] = h[v.prop] - n.factor(c[n.sizeProp]);
|
|
514
|
+
var w = this.offsets.arrow * 2, m = a[l] - (c[d] - u[d]) + w, g = a[l] + (a[d] - u[d]) - w;
|
|
515
|
+
if (o.isPush || (m += c[d], g += c[d]), o.isCenter) {
|
|
516
|
+
var P = (f ? E.top : E.left).prop, F = (f ? E.bottom : E.right).prop;
|
|
517
|
+
h[P] = le(a[P] + a[d] / 2 - c[d] / 2 + t, m, g), h[F] = h[P] + c[d];
|
|
518
|
+
} else {
|
|
519
|
+
var B = o, R = a[B.prop], k = R < m ? m - R : R > g ? g - R : 0;
|
|
520
|
+
h[B.prop] = le(R + t + k, m, g), h[B.opposite.prop] = h[B.prop] + o.factor(c[d]);
|
|
521
|
+
}
|
|
522
|
+
h.width = h.right - h.left, h.height = h.bottom - h.top;
|
|
523
|
+
var y = $.create(h);
|
|
524
|
+
return t === 0 && (this._cachedLayerBounds = y), y;
|
|
525
|
+
}, i.getLayerCollisionBounds = function() {
|
|
526
|
+
var t = this.offsets.container;
|
|
527
|
+
return this.getLayerBounds().mapSides(function(n, o) {
|
|
528
|
+
return o -= n.factor(t);
|
|
529
|
+
}).merge(function(n) {
|
|
530
|
+
var o = n.width, s = n.height;
|
|
531
|
+
return {
|
|
532
|
+
width: o + t * 2,
|
|
533
|
+
height: s + t * 2
|
|
534
|
+
};
|
|
535
|
+
});
|
|
536
|
+
}, i.getContainerOffsets = function(t) {
|
|
537
|
+
if (this._cachedContainerOffsets && !t)
|
|
538
|
+
return this._cachedContainerOffsets;
|
|
539
|
+
var n = this.subjectsBounds.merge({
|
|
540
|
+
layer: t || this.getLayerCollisionBounds()
|
|
541
|
+
}), o = ce.mergeSmallestSides(n.layerOffsetsToScrollContainers);
|
|
542
|
+
return t || (this._cachedContainerOffsets = o), o;
|
|
543
|
+
}, ie(e, [{
|
|
544
|
+
key: "type",
|
|
545
|
+
get: function() {
|
|
546
|
+
return this.primary.prop + "-" + (this.secondary.prop === "center" ? "center" : ["bottom", "right"].includes(this.secondary.prop) ? "end" : "start");
|
|
547
|
+
}
|
|
548
|
+
}, {
|
|
549
|
+
key: "triggerIsBigger",
|
|
550
|
+
get: function() {
|
|
551
|
+
var t = this.secondary.isHorizontal, n = this.subjectsBounds, o = n.triggerHasBiggerWidth, s = n.triggerHasBiggerHeight;
|
|
552
|
+
return t && o || !t && s;
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Checks whether the placement fits within all it's container (including container-offset)
|
|
556
|
+
*/
|
|
557
|
+
}, {
|
|
558
|
+
key: "fitsContainer",
|
|
559
|
+
get: function() {
|
|
560
|
+
return this.getContainerOffsets().allSidesArePositive;
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Returns the surface in square pixels of the visible part of the layer
|
|
564
|
+
*/
|
|
565
|
+
}, {
|
|
566
|
+
key: "visibleSurface",
|
|
567
|
+
get: function() {
|
|
568
|
+
var t = this.getLayerBounds(), n = this.getContainerOffsets(t), o = n.negativeSides;
|
|
569
|
+
for (var s in o)
|
|
570
|
+
o[s] = -o[s];
|
|
571
|
+
return t.substract(o).surface;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Returns a BoundSide by looking at the most negative offset that is the opposite direction
|
|
575
|
+
*/
|
|
576
|
+
}, {
|
|
577
|
+
key: "secondaryOffsetSide",
|
|
578
|
+
get: function() {
|
|
579
|
+
var t, n, o = this, s = this.getContainerOffsets(), a = (t = (n = Object.entries(s.negativeSides).map(function(u) {
|
|
580
|
+
var f = u[0], l = u[1];
|
|
581
|
+
return [E[f], l];
|
|
582
|
+
}).filter(function(u) {
|
|
583
|
+
var f = u[0];
|
|
584
|
+
return o.primary.isOppositeDirection(f);
|
|
585
|
+
}).sort(function(u, f) {
|
|
586
|
+
var l = u[1], d = f[1];
|
|
587
|
+
return d - l;
|
|
588
|
+
})) == null ? void 0 : n[0]) != null ? t : [], c = a[0];
|
|
589
|
+
return c || null;
|
|
590
|
+
}
|
|
591
|
+
}]), e;
|
|
592
|
+
})(), Ce = /* @__PURE__ */ (function(e) {
|
|
593
|
+
tt(i, e);
|
|
594
|
+
function i() {
|
|
595
|
+
return e.apply(this, arguments) || this;
|
|
596
|
+
}
|
|
597
|
+
var r = i.prototype;
|
|
598
|
+
return r.getLayerBounds = function() {
|
|
599
|
+
var n = this.subjectsBounds, o = n.trigger, s = n.layer, a = $.empty();
|
|
600
|
+
return a.top = o.top + o.height / 2 - s.height / 2, a.bottom = a.top + s.height, a.left = o.left + o.width / 2 - s.width / 2, a.right = a.left + s.width, a.width = a.right - a.left, a.height = a.bottom - a.top, a;
|
|
601
|
+
}, i;
|
|
602
|
+
})(Ae);
|
|
603
|
+
function ht(e, i, r) {
|
|
604
|
+
var t = e.layer, n = e.trigger, o = e.arrow, s = i.primary.oppositeSizeProp, a = i.primary.isHorizontal ? ["top", "bottom"] : ["left", "right"], c = a[0], u = a[1], f = t[c] + t[s] / 2 - n[c] - o[s] / 2 - r, l = t[u] - t[s] / 2 - n[u] + o[s] / 2 + r;
|
|
605
|
+
return (f < 0 ? -f : 0) + (l > 0 ? -l : 0);
|
|
606
|
+
}
|
|
607
|
+
var Ee = {
|
|
608
|
+
position: "absolute",
|
|
609
|
+
willChange: "top, left",
|
|
610
|
+
left: null,
|
|
611
|
+
right: null,
|
|
612
|
+
top: null,
|
|
613
|
+
bottom: null
|
|
614
|
+
};
|
|
615
|
+
function gt(e, i, r) {
|
|
616
|
+
var t;
|
|
617
|
+
if (i.primary.isCenter)
|
|
618
|
+
return Ee;
|
|
619
|
+
var n = e.layer, o = e.trigger, s = e.arrow, a = i.primary.oppositeSizeProp, c = o[a] > n[a], u = r + s[a] / 2, f = n[a] - s[a] / 2 - r, l = ht(e, i, r), d = i.primary.prop, p = i.primary.oppositeCssProp, v = c ? n[a] / 2 + l : o[p] + o[a] / 2 - n[p];
|
|
620
|
+
return H({}, Ee, (t = {}, t[d] = "100%", t[p] = le(v, u, f), t));
|
|
621
|
+
}
|
|
622
|
+
var Pe = /* @__PURE__ */ (function() {
|
|
623
|
+
function e(r, t, n) {
|
|
624
|
+
this.placements = void 0, this.config = void 0, this.subjectsBounds = void 0, this.placements = r, this.config = t, this.subjectsBounds = n;
|
|
625
|
+
}
|
|
626
|
+
e.getSidesFromPlacementType = function(t) {
|
|
627
|
+
var n = t.split("-"), o = n[0], s = n[1], a = E[o], c;
|
|
628
|
+
return s === "center" ? c = S.center : a.isHorizontal ? c = s === "start" ? S.top : S.bottom : c = s === "start" ? S.left : S.right, [a, c];
|
|
629
|
+
}, e.create = function(t, n) {
|
|
630
|
+
var o = {
|
|
631
|
+
arrow: n.arrowOffset,
|
|
632
|
+
container: n.containerOffset,
|
|
633
|
+
trigger: n.triggerOffset
|
|
634
|
+
};
|
|
635
|
+
function s(a) {
|
|
636
|
+
a === void 0 && (a = n.placement);
|
|
637
|
+
var c = e.getSidesFromPlacementType(a), u = c[0], f = c[1], l = E[u.isHorizontal ? n.preferY : n.preferX], d = !u.isHorizontal && t.triggerHasBiggerWidth || u.isHorizontal && t.triggerHasBiggerHeight;
|
|
638
|
+
function p(h, w) {
|
|
639
|
+
return new Ae(h, w, t, n.layerDimensions, o);
|
|
640
|
+
}
|
|
641
|
+
var v = [];
|
|
642
|
+
return v[0] = p(u, f), v[1] = p(u, f.isCenter ? l : S.center), v[2] = p(u, S[(f.opposite.isCenter ? l.opposite : f.opposite).prop]), v[3] = p(l, d ? u : S[u.opposite.prop]), v[4] = p(l, S.center), v[5] = p(l, d ? S[u.opposite.prop] : u), v[6] = p(E[l.opposite.prop], d ? u : S[u.opposite.prop]), v[7] = p(E[l.opposite.prop], S.center), v[8] = p(E[l.opposite.prop], d ? S[u.opposite.prop] : u), v[9] = p(E[u.opposite.prop], f), v[10] = p(E[u.opposite.prop], f.isCenter ? l : S.center), v[11] = p(E[u.opposite.prop], S[(f.opposite.isCenter ? l.opposite : f.opposite).prop]), v = v.filter(function(h) {
|
|
643
|
+
return h.type === n.placement || n.possiblePlacements.includes(h.type);
|
|
644
|
+
}), v;
|
|
645
|
+
}
|
|
646
|
+
return n.placement === "center" ? new e([new Ce(S.center, S.center, t, n.layerDimensions, o)].concat(s(n.preferY + "-" + n.preferX)), n, t) : new e(s(), n, t);
|
|
647
|
+
};
|
|
648
|
+
var i = e.prototype;
|
|
649
|
+
return i.filterPlacementsBySide = function(t) {
|
|
650
|
+
return this.placements.filter(function(n) {
|
|
651
|
+
return n.primary === t;
|
|
652
|
+
});
|
|
653
|
+
}, i.findFirstPlacementThatFits = function() {
|
|
654
|
+
return this.placements.find(function(t) {
|
|
655
|
+
return t.fitsContainer;
|
|
656
|
+
});
|
|
657
|
+
}, i.placementWithBiggestVisibleSurface = function() {
|
|
658
|
+
var t = this.placements.map(function(o) {
|
|
659
|
+
return {
|
|
660
|
+
placement: o,
|
|
661
|
+
surface: o.visibleSurface
|
|
662
|
+
};
|
|
663
|
+
}).sort(function(o, s) {
|
|
664
|
+
return s.surface - o.surface;
|
|
665
|
+
}), n = t[0].placement;
|
|
666
|
+
return n;
|
|
667
|
+
}, i.findSuitablePlacement = function() {
|
|
668
|
+
return this.config.auto ? this.findFirstPlacementThatFits() || this.placementWithBiggestVisibleSurface() : this.placements[0];
|
|
669
|
+
}, i.getSecondaryOffset = function(t) {
|
|
670
|
+
var n = this.config, o = n.auto, s = n.snap;
|
|
671
|
+
if (!o || s || t instanceof Ce)
|
|
672
|
+
return 0;
|
|
673
|
+
var a = this.filterPlacementsBySide(t.primary), c = a.indexOf(t) === 0;
|
|
674
|
+
if (c && t.fitsContainer)
|
|
675
|
+
return 0;
|
|
676
|
+
var u = a.find(function(h) {
|
|
677
|
+
return !h.fitsContainer;
|
|
678
|
+
});
|
|
679
|
+
if (!u)
|
|
680
|
+
return 0;
|
|
681
|
+
var f = u.secondaryOffsetSide;
|
|
682
|
+
if (!f)
|
|
683
|
+
return 0;
|
|
684
|
+
var l = t.getContainerOffsets(), d = t.secondary, p;
|
|
685
|
+
t.triggerIsBigger || u === t ? p = f.isPush ? -1 : 1 : p = d === S.left || [S.top, S.center].includes(d) && f.isPush ? -1 : 1;
|
|
686
|
+
var v = l[f.prop];
|
|
687
|
+
return v * p;
|
|
688
|
+
}, i.getStyles = function(t, n, o, s) {
|
|
689
|
+
var a = {
|
|
690
|
+
willChange: "top, left, width, height"
|
|
691
|
+
}, c = gt(this.subjectsBounds.merge({
|
|
692
|
+
layer: t
|
|
693
|
+
}), n, this.config.arrowOffset), u = this.config.overflowContainer ? H({}, a, {
|
|
694
|
+
position: "fixed",
|
|
695
|
+
top: t.top,
|
|
696
|
+
left: t.left
|
|
697
|
+
}) : H({}, a, {
|
|
698
|
+
position: "absolute",
|
|
699
|
+
top: t.top - this.subjectsBounds.parent.top + o.top - s.top,
|
|
700
|
+
left: t.left - this.subjectsBounds.parent.left + o.left - s.left
|
|
701
|
+
});
|
|
702
|
+
return {
|
|
703
|
+
arrow: c,
|
|
704
|
+
layer: u
|
|
705
|
+
};
|
|
706
|
+
}, i.getHasDisappeared = function(t) {
|
|
707
|
+
var n = this.config.overflowContainer ? this.subjectsBounds.trigger : t, o = ce.mergeSmallestSides(this.subjectsBounds.offsetsToScrollContainers(n, !0)), s = Object.entries(o.negativeSides), a = s.some(function(c) {
|
|
708
|
+
var u = c[0], f = c[1], l = E[u];
|
|
709
|
+
return f <= -n[l.sizeProp];
|
|
710
|
+
});
|
|
711
|
+
return a ? "full" : o.allSidesArePositive ? null : "partial";
|
|
712
|
+
}, i.result = function(t, n) {
|
|
713
|
+
var o = this.findSuitablePlacement(), s = this.getSecondaryOffset(o), a = o.getLayerBounds(s), c = this.getStyles(a, o, t, n), u = o.primary.prop;
|
|
714
|
+
return {
|
|
715
|
+
styles: c,
|
|
716
|
+
layerSide: u,
|
|
717
|
+
placement: o,
|
|
718
|
+
layerBounds: a,
|
|
719
|
+
hasDisappeared: this.getHasDisappeared(a)
|
|
720
|
+
};
|
|
721
|
+
}, e;
|
|
722
|
+
})(), yt = /* @__PURE__ */ (function() {
|
|
723
|
+
function e(r, t) {
|
|
724
|
+
this.overflowContainer = void 0, this.trigger = void 0, this.layer = void 0, this.arrow = void 0, this.parent = void 0, this.window = void 0, this.scrollContainers = void 0, this.overflowContainer = t, Object.assign(this, r);
|
|
725
|
+
}
|
|
726
|
+
e.create = function(t, n, o, s, a, c, u, f) {
|
|
727
|
+
var l = $.fromWindow(t);
|
|
728
|
+
return new e({
|
|
729
|
+
layer: $.fromElement(n, {
|
|
730
|
+
environment: t,
|
|
731
|
+
withTransform: !1
|
|
732
|
+
}),
|
|
733
|
+
trigger: f ? $.create(fe(f())) : $.fromElement(o),
|
|
734
|
+
arrow: a ? $.fromElement(a) : $.empty(),
|
|
735
|
+
parent: s ? $.fromElement(s) : l,
|
|
736
|
+
window: l,
|
|
737
|
+
scrollContainers: [l].concat(c.map(function(d) {
|
|
738
|
+
return $.fromElement(d, {
|
|
739
|
+
withScrollbars: !1
|
|
740
|
+
});
|
|
741
|
+
}))
|
|
742
|
+
}, u);
|
|
743
|
+
};
|
|
744
|
+
var i = e.prototype;
|
|
745
|
+
return i.merge = function(t) {
|
|
746
|
+
return new e(H({}, this, t), this.overflowContainer);
|
|
747
|
+
}, i.offsetsToScrollContainers = function(t, n) {
|
|
748
|
+
n === void 0 && (n = !1);
|
|
749
|
+
var o = this.overflowContainer && !n ? [this.window] : this.scrollContainers;
|
|
750
|
+
return o.map(function(s) {
|
|
751
|
+
return s.offsetsTo(t);
|
|
752
|
+
});
|
|
753
|
+
}, ie(e, [{
|
|
754
|
+
key: "layerOffsetsToScrollContainers",
|
|
755
|
+
get: function() {
|
|
756
|
+
return this.offsetsToScrollContainers(this.layer);
|
|
757
|
+
}
|
|
758
|
+
}, {
|
|
759
|
+
key: "triggerHasBiggerWidth",
|
|
760
|
+
get: function() {
|
|
761
|
+
return this.trigger.width > this.layer.width;
|
|
762
|
+
}
|
|
763
|
+
}, {
|
|
764
|
+
key: "triggerHasBiggerHeight",
|
|
765
|
+
get: function() {
|
|
766
|
+
return this.trigger.height > this.layer.height;
|
|
767
|
+
}
|
|
768
|
+
}]), e;
|
|
769
|
+
})(), Te = null, A = {
|
|
770
|
+
auto: !1,
|
|
771
|
+
arrowOffset: 0,
|
|
772
|
+
containerOffset: 10,
|
|
773
|
+
triggerOffset: 0,
|
|
774
|
+
overflowContainer: !0,
|
|
775
|
+
placement: "top-center",
|
|
776
|
+
possiblePlacements: ct,
|
|
777
|
+
preferX: "right",
|
|
778
|
+
preferY: "bottom",
|
|
779
|
+
snap: !1,
|
|
780
|
+
container: void 0
|
|
781
|
+
};
|
|
782
|
+
function Ot(e) {
|
|
783
|
+
var i, r = e.isOpen, t = r === void 0 ? !1 : r, n = e.overflowContainer, o = n === void 0 ? A.overflowContainer : n, s = e.environment, a = s === void 0 ? typeof window < "u" ? window : void 0 : s, c = e.ResizeObserver, u = e.placement, f = u === void 0 ? A.placement : u, l = e.possiblePlacements, d = l === void 0 ? A.possiblePlacements : l, p = e.preferX, v = p === void 0 ? A.preferX : p, h = e.preferY, w = h === void 0 ? A.preferY : h, m = e.auto, g = m === void 0 ? A.auto : m, P = e.snap, F = P === void 0 ? A.snap : P, B = e.triggerOffset, R = B === void 0 ? A.triggerOffset : B, k = e.containerOffset, y = k === void 0 ? A.containerOffset : k, b = e.arrowOffset, C = b === void 0 ? A.arrowOffset : b, O = e.container, j = O === void 0 ? A.container : O, T = e.layerDimensions, Y = T === void 0 ? null : T, M = e.onDisappear, G = e.onOutsideClick, U = e.onParentClose, z = e.trigger, X = Le(function() {
|
|
784
|
+
return {
|
|
785
|
+
layerSide: f === "center" ? "center" : Pe.getSidesFromPlacementType(f)[0].prop,
|
|
786
|
+
styles: {
|
|
787
|
+
layer: {
|
|
788
|
+
position: o ? "fixed" : "absolute",
|
|
789
|
+
top: 0,
|
|
790
|
+
left: 0
|
|
791
|
+
},
|
|
792
|
+
arrow: {
|
|
793
|
+
position: "absolute",
|
|
794
|
+
top: 0,
|
|
795
|
+
left: 0
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
};
|
|
799
|
+
}), D = X[0], Q = X[1], _ = L(null), N = ot(D, t), x = L({
|
|
800
|
+
cancelled: !1
|
|
801
|
+
});
|
|
802
|
+
V(function() {
|
|
803
|
+
return function() {
|
|
804
|
+
x.current.cancelled = !0;
|
|
805
|
+
};
|
|
806
|
+
}, []);
|
|
807
|
+
var ee = W(function(q, Me, xe) {
|
|
808
|
+
var Fe = q.arrow, Ye = q.layer, he = q.scrollContainers, Ge = q.trigger, Xe = he[0], _e = yt.create(a, Ye, Ge, Xe, Fe, he, o, z?.getBounds), Ve = {
|
|
809
|
+
placement: f,
|
|
810
|
+
possiblePlacements: d,
|
|
811
|
+
auto: g,
|
|
812
|
+
layerDimensions: Y,
|
|
813
|
+
arrowOffset: C,
|
|
814
|
+
containerOffset: y,
|
|
815
|
+
triggerOffset: R,
|
|
816
|
+
preferX: v,
|
|
817
|
+
preferY: w,
|
|
818
|
+
snap: F,
|
|
819
|
+
overflowContainer: o
|
|
820
|
+
}, oe = Pe.create(_e, Ve).result(Me, xe), ge = oe.hasDisappeared, Ue = oe.layerSide, qe = oe.styles, se = {
|
|
821
|
+
layerSide: Ue,
|
|
822
|
+
styles: qe
|
|
823
|
+
};
|
|
824
|
+
if (!N.current || mt(N.current, se)) {
|
|
825
|
+
N.current = se, x.current.cancelled = !0;
|
|
826
|
+
var ye = {
|
|
827
|
+
cancelled: !1
|
|
828
|
+
};
|
|
829
|
+
x.current = ye, Promise.resolve().then(function() {
|
|
830
|
+
ye.cancelled || Q(se);
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
be(ge) && be(M) && M(ge);
|
|
834
|
+
}, [C, g, y, a, Y, M, o, f, d, v, w, F, R, N, z]), te = at({
|
|
835
|
+
ResizeObserverPolyfill: c,
|
|
836
|
+
environment: a,
|
|
837
|
+
enabled: t,
|
|
838
|
+
overflowContainer: o,
|
|
839
|
+
onChange: ee,
|
|
840
|
+
triggerOption: z
|
|
841
|
+
}), Ie = te.triggerRef, $e = te.layerRef, ke = te.arrowRef, de = te.closestScrollContainer, ve = ft({
|
|
842
|
+
isOpen: t,
|
|
843
|
+
onOutsideClick: G,
|
|
844
|
+
onParentClose: U
|
|
845
|
+
}), pe = ve.closeOnOutsideClickRefs, De = ve.registrations, Ne = {
|
|
846
|
+
triggerProps: z ? {} : {
|
|
847
|
+
ref: Se(Ie, pe.trigger, _)
|
|
848
|
+
},
|
|
849
|
+
layerProps: {
|
|
850
|
+
ref: Se($e, pe.layer),
|
|
851
|
+
style: D.styles.layer
|
|
852
|
+
},
|
|
853
|
+
arrowProps: {
|
|
854
|
+
ref: ke,
|
|
855
|
+
style: D.styles.arrow,
|
|
856
|
+
layerSide: D.layerSide
|
|
857
|
+
},
|
|
858
|
+
layerSide: D.layerSide,
|
|
859
|
+
triggerBounds: t ? z ? z.getBounds() : (i = _.current) == null ? void 0 : i.getBoundingClientRect() : null,
|
|
860
|
+
renderLayer: function(q) {
|
|
861
|
+
return typeof document < "u" ? Ze(He(ut, {
|
|
862
|
+
registrations: De,
|
|
863
|
+
children: q
|
|
864
|
+
}), o || !de ? wt(j) : de) : null;
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
return Ne;
|
|
868
|
+
}
|
|
869
|
+
function mt(e, i) {
|
|
870
|
+
if (e.layerSide !== i.layerSide)
|
|
871
|
+
return !0;
|
|
872
|
+
for (var r = ["position", "top", "left", "right", "bottom"], t = 0, n = r; t < n.length; t++) {
|
|
873
|
+
var o = n[t];
|
|
874
|
+
if (e.styles.layer[o] !== i.styles.layer[o] || e.styles.arrow[o] !== i.styles.arrow[o])
|
|
875
|
+
return !0;
|
|
876
|
+
}
|
|
877
|
+
return !1;
|
|
878
|
+
}
|
|
879
|
+
var Be = "layers";
|
|
880
|
+
function wt(e) {
|
|
881
|
+
var i;
|
|
882
|
+
if (typeof e == "function") {
|
|
883
|
+
if (i = e(), !i || !(i instanceof HTMLElement))
|
|
884
|
+
throw new Error("react-laag: You've passed a function to the 'container' prop, but it returned no valid HTMLElement");
|
|
885
|
+
} else if (e instanceof HTMLElement)
|
|
886
|
+
i = e;
|
|
887
|
+
else if (typeof e == "string") {
|
|
888
|
+
if (i = document.getElementById(e), !i)
|
|
889
|
+
throw new Error("react-laag: You've passed element with id '" + e + "' to the 'container' prop, but it returned no valid HTMLElement");
|
|
890
|
+
} else {
|
|
891
|
+
if (Te instanceof HTMLElement)
|
|
892
|
+
return Te;
|
|
893
|
+
i = document.getElementById(Be), i || (i = document.createElement("div"), i.id = Be, i.style.cssText = `
|
|
894
|
+
position: absolute;
|
|
895
|
+
top: 0px;
|
|
896
|
+
left: 0px;
|
|
897
|
+
right: 0px;
|
|
898
|
+
`, document.body.appendChild(i));
|
|
899
|
+
}
|
|
900
|
+
return i;
|
|
901
|
+
}
|
|
902
|
+
var I;
|
|
903
|
+
(function(e) {
|
|
904
|
+
e[e.ENTERING = 0] = "ENTERING", e[e.LEAVING = 1] = "LEAVING", e[e.IDLE = 2] = "IDLE";
|
|
905
|
+
})(I || (I = {}));
|
|
906
|
+
function Ct(e) {
|
|
907
|
+
var i = e === void 0 ? {} : e, r = i.delayEnter, t = r === void 0 ? 0 : r, n = i.delayLeave, o = n === void 0 ? 0 : n, s = i.hideOnScroll, a = s === void 0 ? !0 : s, c = Le(!1), u = c[0], f = c[1], l = L(null), d = L(I.IDLE), p = L(!1), v = W(function() {
|
|
908
|
+
clearTimeout(l.current), l.current = null, d.current = I.IDLE;
|
|
909
|
+
}, []);
|
|
910
|
+
function h() {
|
|
911
|
+
d.current === I.LEAVING && l.current && v(), !u && (d.current = I.ENTERING, l.current = window.setTimeout(function() {
|
|
912
|
+
f(!0), l.current = null, d.current = I.IDLE;
|
|
913
|
+
}, t));
|
|
914
|
+
}
|
|
915
|
+
function w(g, P) {
|
|
916
|
+
if (d.current === I.ENTERING && l.current && v(), !!u) {
|
|
917
|
+
if (P) {
|
|
918
|
+
f(!1), l.current = null, d.current = I.IDLE;
|
|
919
|
+
return;
|
|
920
|
+
}
|
|
921
|
+
d.current = I.LEAVING, l.current = window.setTimeout(function() {
|
|
922
|
+
f(!1), l.current = null, d.current = I.IDLE;
|
|
923
|
+
}, o);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
V(function() {
|
|
927
|
+
function g() {
|
|
928
|
+
u && a && (v(), f(!1));
|
|
929
|
+
}
|
|
930
|
+
return window.addEventListener("scroll", g, !0), function() {
|
|
931
|
+
window.removeEventListener("scroll", g, !0), l.current && clearTimeout(l.current);
|
|
932
|
+
};
|
|
933
|
+
}, [u, a, v]);
|
|
934
|
+
var m = {
|
|
935
|
+
onMouseEnter: h,
|
|
936
|
+
onMouseLeave: w,
|
|
937
|
+
onTouchStart: function() {
|
|
938
|
+
p.current = !1;
|
|
939
|
+
},
|
|
940
|
+
onTouchMove: function() {
|
|
941
|
+
p.current = !0;
|
|
942
|
+
},
|
|
943
|
+
onTouchEnd: function() {
|
|
944
|
+
!p.current && !u && f(!0), p.current = !1;
|
|
945
|
+
}
|
|
946
|
+
};
|
|
947
|
+
return [u, m, function() {
|
|
948
|
+
return w(null, !0);
|
|
949
|
+
}];
|
|
950
|
+
}
|
|
951
|
+
export {
|
|
952
|
+
A as DEFAULT_OPTIONS,
|
|
953
|
+
ct as PLACEMENT_TYPES,
|
|
954
|
+
Se as mergeRefs,
|
|
955
|
+
Ct as useHover,
|
|
956
|
+
Ot as useLayer
|
|
957
|
+
};
|