kelt-ui-kit-react 2.1.4 → 2.1.5
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 +39 -36
- package/dist/overlayPanel/OverlayPanel.d.ts +1 -0
- package/dist/overlayPanel/overlayPanelStyled/OverlayPanelStyled.d.ts +1 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/overlayPanel/OverlayPanel.tsx +13 -7
- package/src/overlayPanel/overlayPanelStyled/OverlayPanelStyled.tsx +11 -0
- package/src/select/Select.tsx +1 -0
- package/src/select/select.css +0 -2
package/dist/index.js
CHANGED
|
@@ -1602,20 +1602,21 @@ var wr = Sr.div`
|
|
|
1602
1602
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
1603
1603
|
border-radius: 2px;
|
|
1604
1604
|
border: 1px solid #ede;
|
|
1605
|
-
|
|
1606
|
-
|
|
1605
|
+
${({ $bare: e }) => e ? "\n background-color: transparent;\n padding: 0;\n box-shadow: none;\n border: none;\n border-radius: 0;\n " : ""}
|
|
1606
|
+
`, Tr = a(({ referenceElement: e, position: t, coordonnees: n, children: r, show: i, className: a, id: s, closeOverlay: c, usePortal: l = !0, matchReferenceWidth: m = !1, bare: _ = !1 }, v) => {
|
|
1607
|
+
let { activeOverlayId: S, setActiveOverlay: C } = Ce(), [w, T] = g(i || !1), [E, D] = g(n ?? {
|
|
1607
1608
|
top: 0,
|
|
1608
1609
|
left: 0
|
|
1609
|
-
}), [
|
|
1610
|
-
f(
|
|
1611
|
-
|
|
1610
|
+
}), [O, k] = g(), [A, j] = g(!1), M = h(null), N = d();
|
|
1611
|
+
f(v, () => ({ setCoords: (e) => {
|
|
1612
|
+
D(e), j(!0);
|
|
1612
1613
|
} })), u(() => {
|
|
1613
|
-
|
|
1614
|
-
}, [
|
|
1614
|
+
S !== N && T(!1);
|
|
1615
|
+
}, [S, N]), p(() => {
|
|
1615
1616
|
let r = () => {
|
|
1616
|
-
if (!t && n)
|
|
1617
|
+
if (!t && n) D(n), j(!0);
|
|
1617
1618
|
else if (e) {
|
|
1618
|
-
let n = e.getBoundingClientRect(), r =
|
|
1619
|
+
let n = e.getBoundingClientRect(), r = M.current?.getBoundingClientRect(), { innerWidth: i, innerHeight: a } = window;
|
|
1619
1620
|
if (r) {
|
|
1620
1621
|
let e, o, s = {
|
|
1621
1622
|
topRight: () => ({
|
|
@@ -1648,56 +1649,57 @@ var wr = Sr.div`
|
|
|
1648
1649
|
})
|
|
1649
1650
|
};
|
|
1650
1651
|
t && s[t] ? ({top: e, left: o} = s[t](), (t === "bottom" || t === "bottomLeft" || t === "bottomRight") && e + r.height > a && n.top - r.height >= 0 && (e = n.top - r.height)) : (o = n.right, e = n.bottom, n.right + r.width > i && (o = n.left - r.width), n.bottom + r.height > a && (e = n.top - r.height));
|
|
1651
|
-
let c = l ? null :
|
|
1652
|
-
|
|
1652
|
+
let c = l ? null : M.current?.offsetParent, u = c instanceof HTMLElement ? c.getBoundingClientRect() : null;
|
|
1653
|
+
D({
|
|
1653
1654
|
top: u && c instanceof HTMLElement ? e - u.top + c.scrollTop - c.clientTop : e + window.scrollY,
|
|
1654
1655
|
left: u && c instanceof HTMLElement ? Math.max(0, o) - u.left + c.scrollLeft - c.clientLeft : Math.max(0, o) + window.scrollX
|
|
1655
|
-
}), m &&
|
|
1656
|
+
}), m && k(n.width), j(!0);
|
|
1656
1657
|
}
|
|
1657
1658
|
}
|
|
1658
1659
|
};
|
|
1659
|
-
return
|
|
1660
|
+
return w || j(!1), w && (r(), window.addEventListener("resize", r), window.addEventListener("scroll", r, !0)), () => {
|
|
1660
1661
|
window.removeEventListener("resize", r), window.removeEventListener("scroll", r, !0);
|
|
1661
1662
|
};
|
|
1662
1663
|
}, [
|
|
1663
1664
|
e,
|
|
1664
|
-
|
|
1665
|
+
w,
|
|
1665
1666
|
t,
|
|
1666
1667
|
m,
|
|
1667
1668
|
l,
|
|
1668
1669
|
n
|
|
1669
1670
|
]);
|
|
1670
|
-
let
|
|
1671
|
-
|
|
1672
|
-
},
|
|
1673
|
-
e.stopPropagation(),
|
|
1674
|
-
}, [c,
|
|
1671
|
+
let P = () => {
|
|
1672
|
+
T(!0), C(N);
|
|
1673
|
+
}, F = o((e) => {
|
|
1674
|
+
e.stopPropagation(), T(!1), C(null), c && c(!1);
|
|
1675
|
+
}, [c, C]);
|
|
1675
1676
|
if (u(() => {
|
|
1676
1677
|
let e = (e) => {
|
|
1677
|
-
|
|
1678
|
+
M.current && !M.current.contains(e.target) && (T(!1), C(null), c && c(!1));
|
|
1678
1679
|
};
|
|
1679
|
-
return
|
|
1680
|
+
return w && document.addEventListener("mousedown", e, !0), () => {
|
|
1680
1681
|
document.removeEventListener("mousedown", e, !0);
|
|
1681
1682
|
};
|
|
1682
1683
|
}, [
|
|
1683
|
-
|
|
1684
|
+
w,
|
|
1684
1685
|
c,
|
|
1685
|
-
|
|
1686
|
+
C
|
|
1686
1687
|
]), u(() => {
|
|
1687
|
-
i &&
|
|
1688
|
-
}, [i]), !
|
|
1689
|
-
let
|
|
1690
|
-
ref:
|
|
1691
|
-
$top:
|
|
1692
|
-
$left:
|
|
1693
|
-
$minWidth:
|
|
1694
|
-
$visible:
|
|
1688
|
+
i && P();
|
|
1689
|
+
}, [i]), !w) return null;
|
|
1690
|
+
let ee = /* @__PURE__ */ y(wr, {
|
|
1691
|
+
ref: M,
|
|
1692
|
+
$top: E.top,
|
|
1693
|
+
$left: E.left,
|
|
1694
|
+
$minWidth: O,
|
|
1695
|
+
$visible: A,
|
|
1696
|
+
$bare: _,
|
|
1695
1697
|
children: /* @__PURE__ */ b("div", {
|
|
1696
|
-
className: `overlayPanel ${a || ""} ${
|
|
1697
|
-
children: [/* @__PURE__ */ y("button", {
|
|
1698
|
+
className: `overlayPanel ${a || ""} ${E.top > 0 || E.left > 0 ? "visible" : "hide"}`,
|
|
1699
|
+
children: [!_ && /* @__PURE__ */ y("button", {
|
|
1698
1700
|
id: s ?? "",
|
|
1699
1701
|
className: "toggle-btn",
|
|
1700
|
-
onClick:
|
|
1702
|
+
onClick: F,
|
|
1701
1703
|
children: /* @__PURE__ */ y(B, { classIcon: "bi-x-lg" })
|
|
1702
1704
|
}), /* @__PURE__ */ y("div", {
|
|
1703
1705
|
onClick: (e) => e.stopPropagation(),
|
|
@@ -1705,9 +1707,9 @@ var wr = Sr.div`
|
|
|
1705
1707
|
})]
|
|
1706
1708
|
})
|
|
1707
1709
|
});
|
|
1708
|
-
return l ? x.createPortal(
|
|
1710
|
+
return l ? x.createPortal(ee, document.body) : /* @__PURE__ */ y("div", {
|
|
1709
1711
|
className: "overlayPanel overlayPanel--no-portal ",
|
|
1710
|
-
ref:
|
|
1712
|
+
ref: M,
|
|
1711
1713
|
children: /* @__PURE__ */ y("div", {
|
|
1712
1714
|
onClick: (e) => e.stopPropagation(),
|
|
1713
1715
|
children: r
|
|
@@ -1960,6 +1962,7 @@ var wr = Sr.div`
|
|
|
1960
1962
|
referenceElement: O,
|
|
1961
1963
|
usePortal: d,
|
|
1962
1964
|
matchReferenceWidth: d,
|
|
1965
|
+
bare: !0,
|
|
1963
1966
|
children: /* @__PURE__ */ b(v, { children: [f && /* @__PURE__ */ y("div", {
|
|
1964
1967
|
className: "select-overlay-search",
|
|
1965
1968
|
children: /* @__PURE__ */ y("input", {
|
|
@@ -14,6 +14,7 @@ export type OverlayPanelProps = {
|
|
|
14
14
|
closeOverlay?: (close: boolean) => void;
|
|
15
15
|
usePortal?: boolean;
|
|
16
16
|
matchReferenceWidth?: boolean;
|
|
17
|
+
bare?: boolean;
|
|
17
18
|
};
|
|
18
19
|
export declare const OverlayPanel: React.ForwardRefExoticComponent<OverlayPanelProps & React.RefAttributes<{
|
|
19
20
|
setCoords?: (coords: {
|
|
@@ -3,6 +3,7 @@ interface OverlayPanelStyledProps {
|
|
|
3
3
|
$left?: number;
|
|
4
4
|
$minWidth?: number;
|
|
5
5
|
$visible?: boolean;
|
|
6
|
+
$bare?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare const OverlayPanelStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, OverlayPanelStyledProps>> & string;
|
|
8
9
|
export {};
|