@caseparts-org/caseblocks 0.0.103 → 0.0.105

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.
@@ -6,22 +6,22 @@ import '../../assets/Tooltip.css';const I = "_tooltip_17o7a_1", O = "_content_17
6
6
  tooltip: I,
7
7
  content: O
8
8
  };
9
- function $(u) {
10
- return u ? u.includes(" ") ? u : `${u} center` : "top center";
9
+ function $(l) {
10
+ return l ? l.includes(" ") ? l : `${l} center` : "top center";
11
11
  }
12
- function q(u) {
13
- const w = $(u).toLowerCase(), [s, t] = w.split(" ");
12
+ function q(l) {
13
+ const w = $(l).toLowerCase(), [s, t] = w.split(" ");
14
14
  return { side: ["top", "right", "bottom", "left"].includes(s) ? s : "top", align: t === "left" || t === "top" ? "start" : t === "right" || t === "bottom" ? "end" : "center" };
15
15
  }
16
- function G(u, w, s, t, d = 0) {
17
- const n = u.getBoundingClientRect(), f = w.getBoundingClientRect();
16
+ function G(l, w, s, t, d = 0) {
17
+ const n = l.getBoundingClientRect(), f = w.getBoundingClientRect();
18
18
  let a = 0, c = 0;
19
19
  s === "top" ? a = n.top - f.height - d : s === "bottom" ? a = n.bottom + d : s === "left" ? c = n.left - f.width - d : s === "right" && (c = n.right + d), s === "top" || s === "bottom" ? t === "start" ? c = n.left : t === "end" ? c = n.right - f.width : c = n.left + n.width / 2 - f.width / 2 : t === "start" ? a = n.top : t === "end" ? a = n.bottom - f.height : a = n.top + n.height / 2 - f.height / 2;
20
- const E = window.innerWidth, v = window.innerHeight;
21
- return a = Math.max(4, Math.min(v - f.height - 4, a)), c = Math.max(4, Math.min(E - f.width - 4, c)), { top: a, left: c };
20
+ const y = window.innerWidth, v = window.innerHeight;
21
+ return a = Math.max(4, Math.min(v - f.height - 4, a)), c = Math.max(4, Math.min(y - f.width - 4, c)), { top: a, left: c };
22
22
  }
23
23
  const U = ({
24
- tooltipClassName: u,
24
+ tooltipClassName: l,
25
25
  contentClassName: w,
26
26
  children: s,
27
27
  trigger: t,
@@ -30,50 +30,53 @@ const U = ({
30
30
  openDelay: f = 150,
31
31
  closeDelay: a = 100,
32
32
  leaveGraceMs: c = 0,
33
- tooltipOffset: E = 4
33
+ tooltipOffset: y = 4
34
34
  }) => {
35
- const { side: v, align: b } = q(d), [o, R] = i.useState(!1), [m, C] = i.useState(null), T = i.useRef(null), g = i.useRef(null), x = i.useRef(null), y = i.useRef(null), L = i.useRef(null), h = i.useRef(!1), p = (e) => {
35
+ const { side: v, align: T } = q(d), [o, L] = i.useState(!1), [m, C] = i.useState(null), P = i.useRef(null), g = i.useRef(null), x = i.useRef(null), E = i.useRef(null), R = i.useRef(null), h = i.useRef(!1), p = (e) => {
36
36
  e.current && (window.clearTimeout(e.current), e.current = null);
37
37
  }, B = () => {
38
- p(x), p(y), p(L);
38
+ p(x), p(E), p(R);
39
39
  };
40
40
  i.useEffect(() => () => B(), []);
41
41
  const k = () => {
42
- n || o || (p(x), x.current = window.setTimeout(() => R(!0), f));
42
+ n || o || (p(x), x.current = window.setTimeout(() => L(!0), f));
43
43
  }, _ = () => {
44
- o && (p(y), y.current = window.setTimeout(() => {
45
- h.current || R(!1);
44
+ o && (p(E), E.current = window.setTimeout(() => {
45
+ const e = P.current;
46
+ e && e.matches(":hover") || h.current || L(!1);
46
47
  }, a));
47
48
  }, z = () => {
48
49
  if (o) {
49
- if (p(L), c <= 0) {
50
+ if (p(R), c <= 0) {
50
51
  _();
51
52
  return;
52
53
  }
53
- L.current = window.setTimeout(() => {
54
+ R.current = window.setTimeout(() => {
54
55
  h.current || _();
55
56
  }, c);
56
57
  }
57
- }, P = (e, r) => (l) => {
58
- e == null || e(l), r == null || r(l);
58
+ }, b = (e, r) => (u) => {
59
+ e == null || e(u), r == null || r(u);
59
60
  }, N = i.cloneElement(t, {
60
61
  ref: (e) => {
61
62
  const { ref: r } = t;
62
- typeof r == "function" ? r(e) : r && (r.current = e), T.current = e;
63
+ typeof r == "function" ? r(e) : r && (r.current = e), P.current = e;
63
64
  },
64
- onPointerEnter: P(t.props.onPointerEnter, k),
65
- onPointerLeave: P(t.props.onPointerLeave, z),
66
- onFocus: P(t.props.onFocus, k),
67
- onBlur: P(t.props.onBlur, _),
65
+ onPointerEnter: b(t.props.onPointerEnter, () => {
66
+ p(E), p(R), o || k();
67
+ }),
68
+ onPointerLeave: b(t.props.onPointerLeave, z),
69
+ onFocus: b(t.props.onFocus, k),
70
+ onBlur: b(t.props.onBlur, _),
68
71
  "aria-describedby": o ? "tooltip-popup" : void 0,
69
72
  style: { ...t.props.style || {}, outline: "none" }
70
73
  });
71
74
  return i.useEffect(() => {
72
- n && o && (B(), R(!1));
75
+ n && o && (B(), L(!1));
73
76
  }, [n]), i.useEffect(() => {
74
77
  if (!o) return;
75
78
  const e = (r) => {
76
- r.key === "Escape" && R(!1);
79
+ r.key === "Escape" && L(!1);
77
80
  };
78
81
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
79
82
  }, [o]), i.useLayoutEffect(() => {
@@ -81,21 +84,21 @@ const U = ({
81
84
  C(null);
82
85
  return;
83
86
  }
84
- const e = T.current, r = g.current;
87
+ const e = P.current, r = g.current;
85
88
  if (!e || !r) return;
86
- const l = () => {
87
- C(G(e, r, v, b, E));
89
+ const u = () => {
90
+ C(G(e, r, v, T, y));
88
91
  };
89
- return l(), window.addEventListener("resize", l), window.addEventListener("scroll", l, !0), () => {
90
- window.removeEventListener("resize", l), window.removeEventListener("scroll", l, !0);
92
+ return u(), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), () => {
93
+ window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0);
91
94
  };
92
- }, [o, v, b, s, E]), i.useEffect(() => {
95
+ }, [o, v, T, s, y]), i.useEffect(() => {
93
96
  if (!o) return;
94
97
  const e = (r) => {
95
- const l = T.current, F = g.current;
96
- if (!l || !F) return;
98
+ const u = P.current, F = g.current;
99
+ if (!u || !F) return;
97
100
  const M = r.target;
98
- !l.contains(M) && !F.contains(M) && (h.current = !1, z());
101
+ !u.contains(M) && !F.contains(M) && (h.current = !1, z());
99
102
  };
100
103
  return document.addEventListener("pointermove", e), () => document.removeEventListener("pointermove", e);
101
104
  }, [o]), i.useEffect(() => {
@@ -111,8 +114,8 @@ const U = ({
111
114
  role: "tooltip",
112
115
  "aria-hidden": !o,
113
116
  "data-side": v,
114
- "data-align": b,
115
- className: j(H.tooltip, u),
117
+ "data-align": T,
118
+ className: j(H.tooltip, l),
116
119
  style: {
117
120
  position: "absolute",
118
121
  top: (m == null ? void 0 : m.top) ?? 0,
@@ -121,7 +124,7 @@ const U = ({
121
124
  zIndex: 10
122
125
  },
123
126
  onPointerEnter: () => {
124
- h.current = !0, p(y), p(L);
127
+ h.current = !0, p(E), p(R);
125
128
  },
126
129
  onPointerLeave: () => {
127
130
  h.current = !1, z();
@@ -3,12 +3,12 @@ import { Grid as m, Column as s } from "../../atoms/Grid/Grid.js";
3
3
  import { Flex as l } from "../../atoms/Flex/Flex.js";
4
4
  import { Link as i } from "../../atoms/Link/Link.js";
5
5
  import { Icon as n } from "../../atoms/Icon/Icon.js";
6
- import { Logo as y } from "../../molecules/Logo/Logo.js";
6
+ import { Logo as p } from "../../molecules/Logo/Logo.js";
7
7
  import { Text as o } from "../../atoms/Text/Text.js";
8
8
  import { Tooltip as a } from "../../atoms/Tooltip/Tooltip.js";
9
9
  import { c as h } from "../../clsx-OuTLNxxd.js";
10
- import '../../assets/Footer.css';const p = "_footer_ttcme_2", x = "_grid_ttcme_18", C = "_title_ttcme_31", _ = "_columnContent_ttcme_40", b = "_history_ttcme_48", w = "_logo_ttcme_62", k = "_location_ttcme_72", t = {
11
- footer: p,
10
+ import '../../assets/Footer.css';const y = "_footer_ttcme_2", x = "_grid_ttcme_18", C = "_title_ttcme_31", _ = "_columnContent_ttcme_40", b = "_history_ttcme_48", w = "_logo_ttcme_62", k = "_location_ttcme_72", t = {
11
+ footer: y,
12
12
  grid: x,
13
13
  "bottom-grid": "_bottom-grid_ttcme_19",
14
14
  title: C,
@@ -26,7 +26,7 @@ function M({ homeRoute: g, isOnline: d = !0, className: c, ...f }) {
26
26
  return /* @__PURE__ */ r("footer", { className: u, ...f, children: [
27
27
  /* @__PURE__ */ r(m, { gridWrapperClassName: h(c, t.grid), children: [
28
28
  /* @__PURE__ */ r(s, { span: [4, 6, 3], className: t.gridColumn, children: [
29
- /* @__PURE__ */ e(i, { href: g, children: /* @__PURE__ */ e(y, { variant: "white", className: t.logo }) }),
29
+ /* @__PURE__ */ e(i, { href: g, children: /* @__PURE__ */ e(p, { variant: "white", className: t.logo }) }),
30
30
  /* @__PURE__ */ e("div", { className: t.history, children: /* @__PURE__ */ e(o, { size: "sm", weight: "extra-light", colorToken: "footer", className: t["history-text"], children: "CaseParts has been a leading distributor of commercial refrigeration parts since 1972. Our team of experts are dedicated to helping every customer source parts at great prices." }) })
31
31
  ] }),
32
32
  /* @__PURE__ */ r(s, { span: [4, 6, 3], className: t.gridColumn, children: [
@@ -67,8 +67,9 @@ function M({ homeRoute: g, isOnline: d = !0, className: c, ...f }) {
67
67
  /* @__PURE__ */ e(o, { size: "xs", weight: "extra-light", colorToken: "footer", children: "Weekdays | 8:00AM – 4:30PM PT" })
68
68
  ] }),
69
69
  position: "left",
70
- openDelay: 200,
70
+ openDelay: 250,
71
71
  closeDelay: 0,
72
+ tooltipOffset: 0,
72
73
  children: /* @__PURE__ */ r("div", { children: [
73
74
  /* @__PURE__ */ e(o, { size: "xs", weight: "semibold", children: "Case Parts - Los Angeles" }),
74
75
  /* @__PURE__ */ e("br", {}),
@@ -94,8 +95,9 @@ function M({ homeRoute: g, isOnline: d = !0, className: c, ...f }) {
94
95
  /* @__PURE__ */ e(o, { size: "xs", weight: "extra-light", colorToken: "footer", children: "Weekdays | 8:00AM – 4:30PM CDT" })
95
96
  ] }),
96
97
  position: "left",
97
- openDelay: 200,
98
+ openDelay: 250,
98
99
  closeDelay: 0,
100
+ tooltipOffset: 0,
99
101
  children: /* @__PURE__ */ r("div", { children: [
100
102
  /* @__PURE__ */ e(o, { size: "xs", weight: "semibold", children: "Case Parts - St. Louis" }),
101
103
  /* @__PURE__ */ e("br", {}),
@@ -121,8 +123,9 @@ function M({ homeRoute: g, isOnline: d = !0, className: c, ...f }) {
121
123
  /* @__PURE__ */ e(o, { size: "xs", weight: "extra-light", colorToken: "footer", children: "Weekdays | 8:30AM – 5:00PM PT" })
122
124
  ] }),
123
125
  position: "left",
124
- openDelay: 200,
126
+ openDelay: 250,
125
127
  closeDelay: 0,
128
+ tooltipOffset: 0,
126
129
  children: /* @__PURE__ */ r("div", { children: [
127
130
  /* @__PURE__ */ e(o, { size: "xs", weight: "semibold", children: "Case Parts - Seattle" }),
128
131
  /* @__PURE__ */ e("br", {}),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.103",
4
+ "version": "0.0.105",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",