@dinofront/design_system 1.20.9 → 1.20.10
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/index.js +41 -34
- package/dist/index.js.map +1 -1
- package/dist/lib/useFloatingPosition.d.ts +3 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -897,8 +897,8 @@ function Qt() {
|
|
|
897
897
|
//#endregion
|
|
898
898
|
//#region src/lib/useFloatingPosition.ts
|
|
899
899
|
var $t = 8, en = 10;
|
|
900
|
-
function tn({ anchor: e, panel: t, open: n, side: r = "top", align: i = "center", offset: a = 8, flip: o = !0, shift: s = !0, matchAnchorWidth: c = !1,
|
|
901
|
-
let [
|
|
900
|
+
function tn({ anchor: e, panel: t, open: n, side: r = "top", align: i = "center", offset: a = 8, flip: o = !0, shift: s = !0, matchAnchorWidth: c = !1, constrainToViewport: l = !1, recomputeKey: u, zIndex: f = 50 }) {
|
|
901
|
+
let [p, h] = m({
|
|
902
902
|
style: {
|
|
903
903
|
position: "fixed",
|
|
904
904
|
top: 0,
|
|
@@ -910,50 +910,54 @@ function tn({ anchor: e, panel: t, open: n, side: r = "top", align: i = "center"
|
|
|
910
910
|
});
|
|
911
911
|
return d(() => {
|
|
912
912
|
if (!n || !t) return;
|
|
913
|
-
let
|
|
913
|
+
let u = () => {
|
|
914
914
|
let n = e?.current;
|
|
915
915
|
if (!n) return;
|
|
916
|
-
let
|
|
917
|
-
if (o) if (
|
|
918
|
-
let e =
|
|
919
|
-
r === "top" && e < d.height + a && t > e ?
|
|
916
|
+
let u = n.getBoundingClientRect(), d = t.getBoundingClientRect(), p = window.innerWidth, m = window.innerHeight, g = r === "top" || r === "bottom", _ = r;
|
|
917
|
+
if (o) if (g) {
|
|
918
|
+
let e = u.top, t = m - u.bottom;
|
|
919
|
+
r === "top" && e < d.height + a && t > e ? _ = "bottom" : r === "bottom" && t < d.height + a && e > t && (_ = "top");
|
|
920
920
|
} else {
|
|
921
|
-
let e =
|
|
922
|
-
r === "left" && e < d.width + a && t > e ?
|
|
921
|
+
let e = u.left, t = p - u.right;
|
|
922
|
+
r === "left" && e < d.width + a && t > e ? _ = "right" : r === "right" && t < d.width + a && e > t && (_ = "left");
|
|
923
923
|
}
|
|
924
|
-
let
|
|
925
|
-
|
|
926
|
-
let
|
|
927
|
-
if (
|
|
928
|
-
let e =
|
|
929
|
-
|
|
930
|
-
left: Math.min(Math.max(e -
|
|
931
|
-
[
|
|
924
|
+
let v = _ === "top" || _ === "bottom", y, b;
|
|
925
|
+
v ? (y = _ === "bottom" ? u.bottom + a : u.top - d.height - a, b = i === "start" ? u.left : i === "end" ? u.right - d.width : u.left + u.width / 2 - d.width / 2) : (b = _ === "right" ? u.right + a : u.left - d.width - a, y = i === "start" ? u.top : i === "end" ? u.bottom - d.height : u.top + u.height / 2 - d.height / 2), s && (v ? b = Math.min(Math.max(b, $t), p - d.width - $t) : y = Math.min(Math.max(y, $t), m - d.height - $t));
|
|
926
|
+
let x;
|
|
927
|
+
if (v) {
|
|
928
|
+
let e = u.left + u.width / 2;
|
|
929
|
+
x = {
|
|
930
|
+
left: Math.min(Math.max(e - b, en), d.width - en),
|
|
931
|
+
[_ === "bottom" ? "top" : "bottom"]: -8 / 2
|
|
932
932
|
};
|
|
933
933
|
} else {
|
|
934
|
-
let e =
|
|
935
|
-
|
|
936
|
-
top: Math.min(Math.max(e -
|
|
937
|
-
[
|
|
934
|
+
let e = u.top + u.height / 2;
|
|
935
|
+
x = {
|
|
936
|
+
top: Math.min(Math.max(e - y, en), d.height - en),
|
|
937
|
+
[_ === "right" ? "left" : "right"]: -8 / 2
|
|
938
938
|
};
|
|
939
939
|
}
|
|
940
|
-
|
|
940
|
+
let S;
|
|
941
|
+
l && (S = v ? p - 2 * $t : _ === "right" ? p - u.right - a - $t : u.left - a - $t), h({
|
|
941
942
|
style: {
|
|
942
943
|
position: "fixed",
|
|
943
|
-
top:
|
|
944
|
-
left:
|
|
945
|
-
zIndex:
|
|
946
|
-
...c ? { minWidth:
|
|
944
|
+
top: y,
|
|
945
|
+
left: b,
|
|
946
|
+
zIndex: f,
|
|
947
|
+
...c ? { minWidth: u.width } : {},
|
|
948
|
+
...S === void 0 ? {} : { maxWidth: S }
|
|
947
949
|
},
|
|
948
|
-
arrowStyle:
|
|
949
|
-
resolvedSide:
|
|
950
|
+
arrowStyle: x,
|
|
951
|
+
resolvedSide: _
|
|
950
952
|
});
|
|
951
953
|
};
|
|
952
|
-
|
|
954
|
+
u(), window.addEventListener("resize", u), document.addEventListener("scroll", u, {
|
|
953
955
|
capture: !0,
|
|
954
956
|
passive: !0
|
|
955
|
-
})
|
|
956
|
-
|
|
957
|
+
});
|
|
958
|
+
let d = new ResizeObserver(u);
|
|
959
|
+
return d.observe(t), () => {
|
|
960
|
+
window.removeEventListener("resize", u), document.removeEventListener("scroll", u, { capture: !0 }), d.disconnect();
|
|
957
961
|
};
|
|
958
962
|
}, [
|
|
959
963
|
n,
|
|
@@ -965,8 +969,10 @@ function tn({ anchor: e, panel: t, open: n, side: r = "top", align: i = "center"
|
|
|
965
969
|
o,
|
|
966
970
|
s,
|
|
967
971
|
c,
|
|
968
|
-
l
|
|
969
|
-
|
|
972
|
+
l,
|
|
973
|
+
u,
|
|
974
|
+
f
|
|
975
|
+
]), p;
|
|
970
976
|
}
|
|
971
977
|
//#endregion
|
|
972
978
|
//#region src/components/Popover/Popover.tsx
|
|
@@ -5101,7 +5107,8 @@ var xo = a(function({ value: e, defaultValue: t = null, onChange: n, step: r = 1
|
|
|
5101
5107
|
panel: g,
|
|
5102
5108
|
open: f && !!S,
|
|
5103
5109
|
side: r,
|
|
5104
|
-
offset: 8
|
|
5110
|
+
offset: 8,
|
|
5111
|
+
constrainToViewport: !0
|
|
5105
5112
|
}), E = () => {
|
|
5106
5113
|
v.current && clearTimeout(v.current), v.current = setTimeout(() => h(!0), a);
|
|
5107
5114
|
}, D = () => {
|