@dinofront/design_system 1.20.8 → 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 +60 -53
- 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
|
|
@@ -5096,34 +5102,35 @@ var xo = a(function({ value: e, defaultValue: t = null, onChange: n, step: r = 1
|
|
|
5096
5102
|
left: "border-l-fg-default border-y-transparent border-r-transparent",
|
|
5097
5103
|
right: "border-r-fg-default border-y-transparent border-l-transparent"
|
|
5098
5104
|
}, Eo = a(function({ content: e, children: t, side: r = "top", size: i = "sm", delay: a = 150, portalTarget: s, className: c, dataTestId: l }, d) {
|
|
5099
|
-
let [f, h] = m(!1), [g, _] = m(null), v = p(null), y = p(null), b = u(), { style:
|
|
5105
|
+
let [f, h] = m(!1), [g, _] = m(null), v = p(null), y = p(null), b = u(), x = Qt(), S = s === void 0 ? x : s, { style: C, arrowStyle: w, resolvedSide: T } = tn({
|
|
5100
5106
|
anchor: y,
|
|
5101
5107
|
panel: g,
|
|
5102
|
-
open: f && !!
|
|
5108
|
+
open: f && !!S,
|
|
5103
5109
|
side: r,
|
|
5104
|
-
offset: 8
|
|
5105
|
-
|
|
5110
|
+
offset: 8,
|
|
5111
|
+
constrainToViewport: !0
|
|
5112
|
+
}), E = () => {
|
|
5106
5113
|
v.current && clearTimeout(v.current), v.current = setTimeout(() => h(!0), a);
|
|
5107
|
-
},
|
|
5114
|
+
}, D = () => {
|
|
5108
5115
|
v.current && clearTimeout(v.current), h(!1);
|
|
5109
5116
|
};
|
|
5110
5117
|
if (!o(t)) return t;
|
|
5111
|
-
let
|
|
5112
|
-
onMouseEnter:
|
|
5113
|
-
onMouseLeave:
|
|
5114
|
-
onFocus:
|
|
5115
|
-
onBlur:
|
|
5116
|
-
"aria-describedby": f ? b :
|
|
5117
|
-
}),
|
|
5118
|
-
ref:
|
|
5118
|
+
let O = t.props ?? {}, k = n(t, {
|
|
5119
|
+
onMouseEnter: E,
|
|
5120
|
+
onMouseLeave: D,
|
|
5121
|
+
onFocus: E,
|
|
5122
|
+
onBlur: D,
|
|
5123
|
+
"aria-describedby": f ? b : O["aria-describedby"]
|
|
5124
|
+
}), A = /* @__PURE__ */ K("span", {
|
|
5125
|
+
ref: S ? _ : void 0,
|
|
5119
5126
|
role: "tooltip",
|
|
5120
5127
|
id: b,
|
|
5121
|
-
style:
|
|
5122
|
-
className: X("z-50 whitespace-pre-wrap w-max rounded-md bg-fg-default text-bg-default shadow-z3 pointer-events-none select-none", So[i], !
|
|
5123
|
-
children: [e,
|
|
5128
|
+
style: S ? C : void 0,
|
|
5129
|
+
className: X("z-50 whitespace-pre-wrap w-max rounded-md bg-fg-default text-bg-default shadow-z3 pointer-events-none select-none", So[i], !S && ["absolute", Co[r]], c),
|
|
5130
|
+
children: [e, S ? /* @__PURE__ */ G("span", {
|
|
5124
5131
|
"aria-hidden": !0,
|
|
5125
|
-
style:
|
|
5126
|
-
className: X("absolute h-0 w-0 border-4", To[
|
|
5132
|
+
style: w,
|
|
5133
|
+
className: X("absolute h-0 w-0 border-4", To[T])
|
|
5127
5134
|
}) : /* @__PURE__ */ G("span", {
|
|
5128
5135
|
"aria-hidden": !0,
|
|
5129
5136
|
className: X("absolute h-0 w-0 border-4", wo[r])
|
|
@@ -5132,8 +5139,8 @@ var xo = a(function({ value: e, defaultValue: t = null, onChange: n, step: r = 1
|
|
|
5132
5139
|
return /* @__PURE__ */ K("span", {
|
|
5133
5140
|
ref: Xt(d, y),
|
|
5134
5141
|
"data-test-id": l,
|
|
5135
|
-
className: X("inline-flex", !
|
|
5136
|
-
children: [
|
|
5142
|
+
className: X("inline-flex", !S && "relative"),
|
|
5143
|
+
children: [k, f && (S ? be(A, S) : A)]
|
|
5137
5144
|
});
|
|
5138
5145
|
}), Do = "We'll be back soon", Oo = "We're currently performing scheduled maintenance to make your experience even better. Please check back shortly.", ko = {
|
|
5139
5146
|
lg: "xl",
|