@caseparts-org/caseblocks 0.0.105 → 0.0.106
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/atoms/Tooltip/Tooltip.js +80 -80
- package/dist/organisms/Footer/Footer.js +12 -12
- package/package.json +1 -1
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as N, Fragment as W, jsx as O } from "react/jsx-runtime";
|
|
2
2
|
import * as i from "react";
|
|
3
|
-
import { c as
|
|
4
|
-
import { r as
|
|
5
|
-
import '../../assets/Tooltip.css';const
|
|
6
|
-
tooltip:
|
|
7
|
-
content:
|
|
3
|
+
import { c as S } from "../../clsx-OuTLNxxd.js";
|
|
4
|
+
import { r as X } from "../../index-B4KbmMH3.js";
|
|
5
|
+
import '../../assets/Tooltip.css';const Y = "_tooltip_17o7a_1", A = "_content_17o7a_11", j = {
|
|
6
|
+
tooltip: Y,
|
|
7
|
+
content: A
|
|
8
8
|
};
|
|
9
|
-
function
|
|
10
|
-
return
|
|
9
|
+
function D(f) {
|
|
10
|
+
return f ? f.includes(" ") ? f : `${f} center` : "top center";
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
return { side: ["top", "right", "bottom", "left"].includes(s) ? s : "top", align:
|
|
12
|
+
function I(f) {
|
|
13
|
+
const v = D(f).toLowerCase(), [s, n] = v.split(" ");
|
|
14
|
+
return { side: ["top", "right", "bottom", "left"].includes(s) ? s : "top", align: n === "left" || n === "top" ? "start" : n === "right" || n === "bottom" ? "end" : "center" };
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
const
|
|
18
|
-
let
|
|
19
|
-
s === "top" ?
|
|
20
|
-
const
|
|
21
|
-
return
|
|
16
|
+
function $(f, v, s, n, h = 0) {
|
|
17
|
+
const o = f.getBoundingClientRect(), a = v.getBoundingClientRect(), m = window.pageXOffset || document.documentElement.scrollLeft || 0, d = window.pageYOffset || document.documentElement.scrollTop || 0;
|
|
18
|
+
let l = 0, c = 0;
|
|
19
|
+
s === "top" ? l = d + o.top - a.height - h : s === "bottom" ? l = d + o.bottom + h : s === "left" ? c = m + o.left - a.width - h : s === "right" && (c = m + o.right + h), s === "top" || s === "bottom" ? n === "start" ? c = m + o.left : n === "end" ? c = m + o.right - a.width : c = m + o.left + o.width / 2 - a.width / 2 : n === "start" ? l = d + o.top : n === "end" ? l = d + o.bottom - a.height : l = d + o.top + o.height / 2 - a.height / 2;
|
|
20
|
+
const R = window.innerWidth, t = window.innerHeight;
|
|
21
|
+
return l = Math.max(d + 4, Math.min(d + t - a.height - 4, l)), c = Math.max(m + 4, Math.min(m + R - a.width - 4, c)), { top: l, left: c };
|
|
22
22
|
}
|
|
23
|
-
const
|
|
24
|
-
tooltipClassName:
|
|
25
|
-
contentClassName:
|
|
23
|
+
const K = ({
|
|
24
|
+
tooltipClassName: f,
|
|
25
|
+
contentClassName: v,
|
|
26
26
|
children: s,
|
|
27
|
-
trigger:
|
|
28
|
-
position:
|
|
29
|
-
disabled:
|
|
30
|
-
openDelay:
|
|
31
|
-
closeDelay:
|
|
32
|
-
leaveGraceMs:
|
|
33
|
-
tooltipOffset:
|
|
27
|
+
trigger: n,
|
|
28
|
+
position: h,
|
|
29
|
+
disabled: o,
|
|
30
|
+
openDelay: a = 150,
|
|
31
|
+
closeDelay: m = 100,
|
|
32
|
+
leaveGraceMs: d = 0,
|
|
33
|
+
tooltipOffset: l = 4
|
|
34
34
|
}) => {
|
|
35
|
-
const { side:
|
|
35
|
+
const { side: c, align: R } = I(h), [t, P] = i.useState(!1), [w, C] = i.useState(null), b = i.useRef(null), T = i.useRef(null), x = i.useRef(null), L = i.useRef(null), y = i.useRef(null), E = i.useRef(!1), p = (e) => {
|
|
36
36
|
e.current && (window.clearTimeout(e.current), e.current = null);
|
|
37
37
|
}, B = () => {
|
|
38
|
-
p(x), p(
|
|
38
|
+
p(x), p(L), p(y);
|
|
39
39
|
};
|
|
40
40
|
i.useEffect(() => () => B(), []);
|
|
41
41
|
const k = () => {
|
|
42
|
-
|
|
42
|
+
o || t || (p(x), x.current = window.setTimeout(() => P(!0), a));
|
|
43
43
|
}, _ = () => {
|
|
44
|
-
|
|
45
|
-
const e =
|
|
46
|
-
e && e.matches(":hover") ||
|
|
47
|
-
},
|
|
44
|
+
t && (p(L), L.current = window.setTimeout(() => {
|
|
45
|
+
const e = b.current;
|
|
46
|
+
e && e.matches(":hover") || E.current || P(!1);
|
|
47
|
+
}, m));
|
|
48
48
|
}, z = () => {
|
|
49
|
-
if (
|
|
50
|
-
if (p(
|
|
49
|
+
if (t) {
|
|
50
|
+
if (p(y), d <= 0) {
|
|
51
51
|
_();
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
},
|
|
54
|
+
y.current = window.setTimeout(() => {
|
|
55
|
+
E.current || _();
|
|
56
|
+
}, d);
|
|
57
57
|
}
|
|
58
|
-
},
|
|
58
|
+
}, g = (e, r) => (u) => {
|
|
59
59
|
e == null || e(u), r == null || r(u);
|
|
60
|
-
},
|
|
60
|
+
}, H = i.cloneElement(n, {
|
|
61
61
|
ref: (e) => {
|
|
62
|
-
const { ref: r } =
|
|
63
|
-
typeof r == "function" ? r(e) : r && (r.current = e),
|
|
62
|
+
const { ref: r } = n;
|
|
63
|
+
typeof r == "function" ? r(e) : r && (r.current = e), b.current = e;
|
|
64
64
|
},
|
|
65
|
-
onPointerEnter:
|
|
66
|
-
p(
|
|
65
|
+
onPointerEnter: g(n.props.onPointerEnter, () => {
|
|
66
|
+
p(L), p(y), t || k();
|
|
67
67
|
}),
|
|
68
|
-
onPointerLeave:
|
|
69
|
-
onFocus:
|
|
70
|
-
onBlur:
|
|
71
|
-
"aria-describedby":
|
|
72
|
-
style: { ...
|
|
68
|
+
onPointerLeave: g(n.props.onPointerLeave, z),
|
|
69
|
+
onFocus: g(n.props.onFocus, k),
|
|
70
|
+
onBlur: g(n.props.onBlur, _),
|
|
71
|
+
"aria-describedby": t ? "tooltip-popup" : void 0,
|
|
72
|
+
style: { ...n.props.style || {}, outline: "none" }
|
|
73
73
|
});
|
|
74
74
|
return i.useEffect(() => {
|
|
75
|
-
|
|
76
|
-
}, [
|
|
77
|
-
if (!
|
|
75
|
+
o && t && (B(), P(!1));
|
|
76
|
+
}, [o]), i.useEffect(() => {
|
|
77
|
+
if (!t) return;
|
|
78
78
|
const e = (r) => {
|
|
79
|
-
r.key === "Escape" &&
|
|
79
|
+
r.key === "Escape" && P(!1);
|
|
80
80
|
};
|
|
81
81
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
82
|
-
}, [
|
|
83
|
-
if (!
|
|
82
|
+
}, [t]), i.useLayoutEffect(() => {
|
|
83
|
+
if (!t) {
|
|
84
84
|
C(null);
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
-
const e =
|
|
87
|
+
const e = b.current, r = T.current;
|
|
88
88
|
if (!e || !r) return;
|
|
89
89
|
const u = () => {
|
|
90
|
-
C(
|
|
90
|
+
C($(e, r, c, R, l));
|
|
91
91
|
};
|
|
92
92
|
return u(), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), () => {
|
|
93
93
|
window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0);
|
|
94
94
|
};
|
|
95
|
-
}, [
|
|
96
|
-
if (!
|
|
95
|
+
}, [t, c, R, s, l]), i.useEffect(() => {
|
|
96
|
+
if (!t) return;
|
|
97
97
|
const e = (r) => {
|
|
98
|
-
const u =
|
|
98
|
+
const u = b.current, F = T.current;
|
|
99
99
|
if (!u || !F) return;
|
|
100
100
|
const M = r.target;
|
|
101
|
-
!u.contains(M) && !F.contains(M) && (
|
|
101
|
+
!u.contains(M) && !F.contains(M) && (E.current = !1, z());
|
|
102
102
|
};
|
|
103
103
|
return document.addEventListener("pointermove", e), () => document.removeEventListener("pointermove", e);
|
|
104
|
-
}, [
|
|
105
|
-
|
|
106
|
-
}, [
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
/* @__PURE__ */
|
|
104
|
+
}, [t]), i.useEffect(() => {
|
|
105
|
+
t || (E.current = !1);
|
|
106
|
+
}, [t]), /* @__PURE__ */ N(W, { children: [
|
|
107
|
+
H,
|
|
108
|
+
t && typeof document < "u" && X.createPortal(
|
|
109
|
+
/* @__PURE__ */ O(
|
|
110
110
|
"div",
|
|
111
111
|
{
|
|
112
112
|
id: "tooltip-popup",
|
|
113
|
-
ref:
|
|
113
|
+
ref: T,
|
|
114
114
|
role: "tooltip",
|
|
115
|
-
"aria-hidden": !
|
|
116
|
-
"data-side":
|
|
117
|
-
"data-align":
|
|
118
|
-
className: j
|
|
115
|
+
"aria-hidden": !t,
|
|
116
|
+
"data-side": c,
|
|
117
|
+
"data-align": R,
|
|
118
|
+
className: S(j.tooltip, f),
|
|
119
119
|
style: {
|
|
120
120
|
position: "absolute",
|
|
121
|
-
top: (
|
|
122
|
-
left: (
|
|
123
|
-
visibility:
|
|
121
|
+
top: (w == null ? void 0 : w.top) ?? 0,
|
|
122
|
+
left: (w == null ? void 0 : w.left) ?? 0,
|
|
123
|
+
visibility: w ? "visible" : "hidden",
|
|
124
124
|
zIndex: 10
|
|
125
125
|
},
|
|
126
126
|
onPointerEnter: () => {
|
|
127
|
-
|
|
127
|
+
E.current = !0, p(L), p(y);
|
|
128
128
|
},
|
|
129
129
|
onPointerLeave: () => {
|
|
130
|
-
|
|
130
|
+
E.current = !1, z();
|
|
131
131
|
},
|
|
132
|
-
children: /* @__PURE__ */
|
|
132
|
+
children: /* @__PURE__ */ O("div", { className: S(j.content, v), children: s })
|
|
133
133
|
}
|
|
134
134
|
),
|
|
135
135
|
document.body
|
|
@@ -137,5 +137,5 @@ const U = ({
|
|
|
137
137
|
] });
|
|
138
138
|
};
|
|
139
139
|
export {
|
|
140
|
-
|
|
140
|
+
K as Tooltip
|
|
141
141
|
};
|
|
@@ -66,10 +66,10 @@ function M({ homeRoute: g, isOnline: d = !0, className: c, ...f }) {
|
|
|
66
66
|
/* @__PURE__ */ e("br", {}),
|
|
67
67
|
/* @__PURE__ */ e(o, { size: "xs", weight: "extra-light", colorToken: "footer", children: "Weekdays | 8:00AM – 4:30PM PT" })
|
|
68
68
|
] }),
|
|
69
|
-
position: "left",
|
|
70
|
-
openDelay:
|
|
71
|
-
closeDelay:
|
|
72
|
-
tooltipOffset:
|
|
69
|
+
position: "left center",
|
|
70
|
+
openDelay: 200,
|
|
71
|
+
closeDelay: 50,
|
|
72
|
+
tooltipOffset: 4,
|
|
73
73
|
children: /* @__PURE__ */ r("div", { children: [
|
|
74
74
|
/* @__PURE__ */ e(o, { size: "xs", weight: "semibold", children: "Case Parts - Los Angeles" }),
|
|
75
75
|
/* @__PURE__ */ e("br", {}),
|
|
@@ -94,10 +94,10 @@ function M({ homeRoute: g, isOnline: d = !0, className: c, ...f }) {
|
|
|
94
94
|
/* @__PURE__ */ e("br", {}),
|
|
95
95
|
/* @__PURE__ */ e(o, { size: "xs", weight: "extra-light", colorToken: "footer", children: "Weekdays | 8:00AM – 4:30PM CDT" })
|
|
96
96
|
] }),
|
|
97
|
-
position: "left",
|
|
98
|
-
openDelay:
|
|
99
|
-
closeDelay:
|
|
100
|
-
tooltipOffset:
|
|
97
|
+
position: "left center",
|
|
98
|
+
openDelay: 200,
|
|
99
|
+
closeDelay: 50,
|
|
100
|
+
tooltipOffset: 4,
|
|
101
101
|
children: /* @__PURE__ */ r("div", { children: [
|
|
102
102
|
/* @__PURE__ */ e(o, { size: "xs", weight: "semibold", children: "Case Parts - St. Louis" }),
|
|
103
103
|
/* @__PURE__ */ e("br", {}),
|
|
@@ -122,10 +122,10 @@ function M({ homeRoute: g, isOnline: d = !0, className: c, ...f }) {
|
|
|
122
122
|
/* @__PURE__ */ e("br", {}),
|
|
123
123
|
/* @__PURE__ */ e(o, { size: "xs", weight: "extra-light", colorToken: "footer", children: "Weekdays | 8:30AM – 5:00PM PT" })
|
|
124
124
|
] }),
|
|
125
|
-
position: "left",
|
|
126
|
-
openDelay:
|
|
127
|
-
closeDelay:
|
|
128
|
-
tooltipOffset:
|
|
125
|
+
position: "left center",
|
|
126
|
+
openDelay: 200,
|
|
127
|
+
closeDelay: 50,
|
|
128
|
+
tooltipOffset: 4,
|
|
129
129
|
children: /* @__PURE__ */ r("div", { children: [
|
|
130
130
|
/* @__PURE__ */ e(o, { size: "xs", weight: "semibold", children: "Case Parts - Seattle" }),
|
|
131
131
|
/* @__PURE__ */ e("br", {}),
|