@dgshahr/ui-kit 1.0.0 → 1.0.2
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/Form/Datepicker/Days.d.ts.map +1 -1
- package/dist/Form/Datepicker/index.cjs +1 -1
- package/dist/Form/Datepicker/index.mjs +24 -24
- package/dist/Form/Select/Options.d.ts.map +1 -1
- package/dist/Form/Select/index.cjs +1 -1
- package/dist/Form/Select/index.mjs +103 -115
- package/dist/{PickerWrapper-Kka0j3TV.js → PickerWrapper-BN0-64XB.js} +1 -1
- package/dist/{PickerWrapper-lyNHGQj6.cjs → PickerWrapper-_6_IfT-v.cjs} +1 -1
- package/dist/Rate/RateStar.d.ts +10 -0
- package/dist/Rate/RateStar.d.ts.map +1 -0
- package/dist/Rate/index.cjs +1 -0
- package/dist/Rate/index.d.ts +6 -0
- package/dist/Rate/index.d.ts.map +1 -0
- package/dist/Rate/index.mjs +149 -0
- package/dist/Rate/types.d.ts +19 -0
- package/dist/Rate/types.d.ts.map +1 -0
- package/dist/Tooltip/index.cjs +1 -1
- package/dist/Tooltip/index.mjs +1 -1
- package/dist/assets/styles.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +20 -18
- package/dist/useFlipPosition-BWxiBDQ_.js +124 -0
- package/dist/useFlipPosition-CWhLgzoz.cjs +1 -0
- package/package.json +6 -1
- package/dist/useFlipPosition-CLwjhe7O.cjs +0 -1
- package/dist/useFlipPosition-pGmVUUhs.js +0 -133
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { d as S } from "./index-CzwAoGdL.js";
|
|
2
|
-
import { useRef as v, useState as B, useEffect as P, useCallback as F, useMemo as T } from "react";
|
|
3
|
-
function $(t) {
|
|
4
|
-
return t.startsWith("top") ? t.replace("top", "bottom") : t.replace("bottom", "top");
|
|
5
|
-
}
|
|
6
|
-
function j(t) {
|
|
7
|
-
return t.endsWith("left") ? t.replace("left", "right") : t.endsWith("right") ? t.replace("right", "left") : t;
|
|
8
|
-
}
|
|
9
|
-
function A(t, e) {
|
|
10
|
-
return t.endsWith("center") ? e.left && !e.right ? t.replace("center", "right") : e.right && !e.left ? t.replace("center", "left") : t : t;
|
|
11
|
-
}
|
|
12
|
-
function I(t, e) {
|
|
13
|
-
const r = RegExp(/matrix\(([^)]+)\)/).exec(t);
|
|
14
|
-
if (!r) return `scale(${e})`;
|
|
15
|
-
const n = r[1].split(",").map((l) => parseFloat(l.trim()));
|
|
16
|
-
return n.length !== 6 ? `scale(${e})` : (n[0] = e, n[3] = e, `matrix(${n.join(", ")})`);
|
|
17
|
-
}
|
|
18
|
-
function U(t, e) {
|
|
19
|
-
let r;
|
|
20
|
-
switch (t) {
|
|
21
|
-
case "top-left":
|
|
22
|
-
case "bottom-left":
|
|
23
|
-
r = e.left;
|
|
24
|
-
break;
|
|
25
|
-
case "top-center":
|
|
26
|
-
case "bottom-center":
|
|
27
|
-
r = e.left + e.width / 2;
|
|
28
|
-
break;
|
|
29
|
-
case "top-right":
|
|
30
|
-
case "bottom-right":
|
|
31
|
-
r = e.right;
|
|
32
|
-
break;
|
|
33
|
-
default:
|
|
34
|
-
r = e.left + e.width / 2;
|
|
35
|
-
}
|
|
36
|
-
const n = t.startsWith("top") ? e.top : e.bottom;
|
|
37
|
-
return { anchorX: r, anchorY: n };
|
|
38
|
-
}
|
|
39
|
-
function Y(t, e, r, n) {
|
|
40
|
-
let l = 0, f = 0;
|
|
41
|
-
switch (t) {
|
|
42
|
-
case "top-left":
|
|
43
|
-
case "bottom-left":
|
|
44
|
-
l = e;
|
|
45
|
-
break;
|
|
46
|
-
case "top-center":
|
|
47
|
-
case "bottom-center":
|
|
48
|
-
l = e - n.width / 2;
|
|
49
|
-
break;
|
|
50
|
-
case "top-right":
|
|
51
|
-
case "bottom-right":
|
|
52
|
-
l = e - n.width;
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
switch (t) {
|
|
56
|
-
case "top-left":
|
|
57
|
-
case "top-center":
|
|
58
|
-
case "top-right":
|
|
59
|
-
f = r - n.height;
|
|
60
|
-
break;
|
|
61
|
-
case "bottom-left":
|
|
62
|
-
case "bottom-center":
|
|
63
|
-
case "bottom-right":
|
|
64
|
-
f = r;
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
return { top: f, left: l };
|
|
68
|
-
}
|
|
69
|
-
function q(t, e, r, n, l, f, c) {
|
|
70
|
-
const a = t < f, p = t + r.height > l - f, h = e < f, m = e + r.width > n - f;
|
|
71
|
-
if (c == null)
|
|
72
|
-
return {
|
|
73
|
-
top: a,
|
|
74
|
-
bottom: p,
|
|
75
|
-
left: h,
|
|
76
|
-
right: m
|
|
77
|
-
};
|
|
78
|
-
const u = Math.min(r.bottom, l) - Math.max(t, 0), s = Math.min(r.right, n) - Math.max(e, 0), g = a && p ? u >= c ? { top: !1, bottom: !1 } : u < r.height / 2 ? { top: !0, bottom: !1 } : { top: !1, bottom: !0 } : a ? { top: u < c, bottom: !1 } : p ? { top: !1, bottom: u < c } : { top: !1, bottom: !1 }, o = h && m ? s >= c ? { left: !1, right: !1 } : s < r.width / 2 ? { left: !0, right: !1 } : { left: !1, right: !0 } : h ? { left: s < c, right: !1 } : m ? { left: !1, right: s < c } : { left: !1, right: !1 };
|
|
79
|
-
return {
|
|
80
|
-
top: g.top,
|
|
81
|
-
bottom: g.bottom,
|
|
82
|
-
left: o.left,
|
|
83
|
-
right: o.right
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
function J({
|
|
87
|
-
initialPosition: t,
|
|
88
|
-
onPositionChange: e,
|
|
89
|
-
padding: r = 8,
|
|
90
|
-
debounceWait: n = 50,
|
|
91
|
-
minVisible: l
|
|
92
|
-
}) {
|
|
93
|
-
const f = v(null), c = v(null), [a, p] = B(t), h = v(t);
|
|
94
|
-
P(() => {
|
|
95
|
-
h.current = t;
|
|
96
|
-
}, [t]);
|
|
97
|
-
const m = v(a);
|
|
98
|
-
P(() => {
|
|
99
|
-
m.current = a;
|
|
100
|
-
}, [a]);
|
|
101
|
-
const u = F(() => {
|
|
102
|
-
const g = f.current, o = c.current;
|
|
103
|
-
if (!g || !o) return;
|
|
104
|
-
const b = h.current, W = g.getBoundingClientRect(), { anchorX: k, anchorY: x } = U(b, W), w = window.getComputedStyle(o), E = w.display !== "none" && w.visibility !== "hidden" && w.opacity !== "0";
|
|
105
|
-
let y;
|
|
106
|
-
if (E)
|
|
107
|
-
y = o.getBoundingClientRect();
|
|
108
|
-
else {
|
|
109
|
-
const H = w.transform || "none", L = I(H, 1);
|
|
110
|
-
o.style.setProperty("opacity", "0", "important"), o.style.setProperty("transform", L, "important"), o.style.setProperty("visibility", "hidden", "important"), o.style.setProperty("position", "absolute", "important"), o.style.setProperty("transition", "none", "important"), o.offsetHeight, y = o.getBoundingClientRect(), o.style.removeProperty("opacity"), o.style.removeProperty("transform"), o.style.removeProperty("visibility"), o.style.removeProperty("position"), o.style.removeProperty("transition");
|
|
111
|
-
}
|
|
112
|
-
const M = window.innerWidth, O = window.innerHeight, { top: z, left: C } = Y(b, k, x, y), d = q(
|
|
113
|
-
z,
|
|
114
|
-
C,
|
|
115
|
-
y,
|
|
116
|
-
M,
|
|
117
|
-
O,
|
|
118
|
-
r,
|
|
119
|
-
l
|
|
120
|
-
);
|
|
121
|
-
let i = b;
|
|
122
|
-
(b.startsWith("top") && d.top || b.startsWith("bottom") && d.bottom) && (i = $(i)), (i.endsWith("left") && d.left || i.endsWith("right") && d.right) && (i = j(i)), i.endsWith("center") && (i = A(i, d)), i !== m.current && (p(i), e && e(i));
|
|
123
|
-
}, [e, r]), s = T(
|
|
124
|
-
() => S(u, n),
|
|
125
|
-
[u, n]
|
|
126
|
-
);
|
|
127
|
-
return P(() => (s(), window.addEventListener("resize", s), window.addEventListener("scroll", s), () => {
|
|
128
|
-
window.removeEventListener("resize", s), window.removeEventListener("scroll", s), s.cancel();
|
|
129
|
-
}), [s]), { anchorRef: f, popperRef: c, position: a };
|
|
130
|
-
}
|
|
131
|
-
export {
|
|
132
|
-
J as u
|
|
133
|
-
};
|