@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 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, recomputeKey: l, zIndex: u = 50 }) {
901
- let [f, p] = m({
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 l = () => {
913
+ let u = () => {
914
914
  let n = e?.current;
915
915
  if (!n) return;
916
- let l = n.getBoundingClientRect(), d = t.getBoundingClientRect(), f = window.innerWidth, m = window.innerHeight, h = r === "top" || r === "bottom", g = r;
917
- if (o) if (h) {
918
- let e = l.top, t = m - l.bottom;
919
- r === "top" && e < d.height + a && t > e ? g = "bottom" : r === "bottom" && t < d.height + a && e > t && (g = "top");
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 = l.left, t = f - l.right;
922
- r === "left" && e < d.width + a && t > e ? g = "right" : r === "right" && t < d.width + a && e > t && (g = "left");
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 _ = g === "top" || g === "bottom", v, y;
925
- _ ? (v = g === "bottom" ? l.bottom + a : l.top - d.height - a, y = i === "start" ? l.left : i === "end" ? l.right - d.width : l.left + l.width / 2 - d.width / 2) : (y = g === "right" ? l.right + a : l.left - d.width - a, v = i === "start" ? l.top : i === "end" ? l.bottom - d.height : l.top + l.height / 2 - d.height / 2), s && (_ ? y = Math.min(Math.max(y, $t), f - d.width - $t) : v = Math.min(Math.max(v, $t), m - d.height - $t));
926
- let b;
927
- if (_) {
928
- let e = l.left + l.width / 2;
929
- b = {
930
- left: Math.min(Math.max(e - y, en), d.width - en),
931
- [g === "bottom" ? "top" : "bottom"]: -8 / 2
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 = l.top + l.height / 2;
935
- b = {
936
- top: Math.min(Math.max(e - v, en), d.height - en),
937
- [g === "right" ? "left" : "right"]: -8 / 2
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
- p({
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: v,
944
- left: y,
945
- zIndex: u,
946
- ...c ? { minWidth: l.width } : {}
944
+ top: y,
945
+ left: b,
946
+ zIndex: f,
947
+ ...c ? { minWidth: u.width } : {},
948
+ ...S === void 0 ? {} : { maxWidth: S }
947
949
  },
948
- arrowStyle: b,
949
- resolvedSide: g
950
+ arrowStyle: x,
951
+ resolvedSide: _
950
952
  });
951
953
  };
952
- return l(), window.addEventListener("resize", l), document.addEventListener("scroll", l, {
954
+ u(), window.addEventListener("resize", u), document.addEventListener("scroll", u, {
953
955
  capture: !0,
954
956
  passive: !0
955
- }), () => {
956
- window.removeEventListener("resize", l), document.removeEventListener("scroll", l, { capture: !0 });
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
- ]), f;
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 = () => {