@purpurds/tooltip 3.4.0 → 3.5.0

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.
@@ -1,4 +1,4 @@
1
- import { jsxs as Ue, jsx as I } from "react/jsx-runtime";
1
+ import { jsxs as ze, jsx as I } from "react/jsx-runtime";
2
2
  import * as N from "react";
3
3
  import { forwardRef as M, useCallback as H, createContext as Ge, useMemo as ye, createElement as _, useContext as Tt, Fragment as $n, Children as se, isValidElement as Ie, cloneElement as Je, useEffect as R, useRef as L, useState as j, useLayoutEffect as Ct, useReducer as wn } from "react";
4
4
  import * as _n from "react-dom";
@@ -205,7 +205,7 @@ const Mn = /* @__PURE__ */ Nn(Ln), re = {
205
205
  ), h = (m) => {
206
206
  o || s ? m.preventDefault() : a && a(m);
207
207
  }, g = () => l.endsWith("negative") ? "negative-disabled" : "disabled";
208
- return /* @__PURE__ */ Ue(
208
+ return /* @__PURE__ */ ze(
209
209
  "button",
210
210
  {
211
211
  className: f,
@@ -285,14 +285,14 @@ const kn = /* @__PURE__ */ Fn(Hn), Bn = {
285
285
  }
286
286
  );
287
287
  Mt.displayName = "IconInfo";
288
- const Wn = kn.bind(Bn), gt = "purpur-icon", Vn = "md", zn = (e) => e.filter((t) => Object.keys(t).length >= 1).map((t) => `${t.name}="${t.value}"`).join(" "), Un = ({ content: e = "", title: t } = {}) => {
288
+ const Wn = kn.bind(Bn), gt = "purpur-icon", Vn = "md", Un = (e) => e.filter((t) => Object.keys(t).length >= 1).map((t) => `${t.name}="${t.value}"`).join(" "), zn = ({ content: e = "", title: t } = {}) => {
289
289
  const n = [
290
290
  { name: "xmlns", value: "http://www.w3.org/2000/svg" },
291
291
  { name: "fill", value: "currentColor" },
292
292
  { name: "viewBox", value: "0 0 24 24" },
293
293
  t ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
294
294
  ], o = t ? `<title>${t}</title>` : "";
295
- return `<svg ${zn(n)}>${o}${e}</svg>`;
295
+ return `<svg ${Un(n)}>${o}${e}</svg>`;
296
296
  }, Gn = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Yn = ({
297
297
  ["data-testid"]: e,
298
298
  svg: t,
@@ -301,7 +301,7 @@ const Wn = kn.bind(Bn), gt = "purpur-icon", Vn = "md", zn = (e) => e.filter((t)
301
301
  size: i = Vn,
302
302
  ...r
303
303
  }) => {
304
- const s = Un({
304
+ const s = zn({
305
305
  content: Gn(t.svg),
306
306
  title: n
307
307
  }), a = Wn(o, gt, `${gt}--${i}`);
@@ -1349,7 +1349,7 @@ const Or = function(e) {
1349
1349
  };
1350
1350
  };
1351
1351
  function ne(e) {
1352
- return zt(e) ? (e.nodeName || "").toLowerCase() : "#document";
1352
+ return Ut(e) ? (e.nodeName || "").toLowerCase() : "#document";
1353
1353
  }
1354
1354
  function W(e) {
1355
1355
  var t;
@@ -1357,15 +1357,15 @@ function W(e) {
1357
1357
  }
1358
1358
  function K(e) {
1359
1359
  var t;
1360
- return (t = (zt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
1360
+ return (t = (Ut(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
1361
1361
  }
1362
- function zt(e) {
1362
+ function Ut(e) {
1363
1363
  return e instanceof Node || e instanceof W(e).Node;
1364
1364
  }
1365
1365
  function q(e) {
1366
1366
  return e instanceof Element || e instanceof W(e).Element;
1367
1367
  }
1368
- function U(e) {
1368
+ function z(e) {
1369
1369
  return e instanceof HTMLElement || e instanceof W(e).HTMLElement;
1370
1370
  }
1371
1371
  function wt(e) {
@@ -1377,19 +1377,19 @@ function we(e) {
1377
1377
  overflowX: n,
1378
1378
  overflowY: o,
1379
1379
  display: i
1380
- } = z(e);
1380
+ } = U(e);
1381
1381
  return /auto|scroll|overlay|hidden|clip/.test(t + o + n) && !["inline", "contents"].includes(i);
1382
1382
  }
1383
1383
  function Sr(e) {
1384
1384
  return ["table", "td", "th"].includes(ne(e));
1385
1385
  }
1386
1386
  function nt(e) {
1387
- const t = rt(), n = z(e);
1387
+ const t = rt(), n = U(e);
1388
1388
  return n.transform !== "none" || n.perspective !== "none" || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((o) => (n.willChange || "").includes(o)) || ["paint", "layout", "strict", "content"].some((o) => (n.contain || "").includes(o));
1389
1389
  }
1390
1390
  function Dr(e) {
1391
1391
  let t = fe(e);
1392
- for (; U(t) && !je(t); ) {
1392
+ for (; z(t) && !je(t); ) {
1393
1393
  if (nt(t))
1394
1394
  return t;
1395
1395
  t = fe(t);
@@ -1402,7 +1402,7 @@ function rt() {
1402
1402
  function je(e) {
1403
1403
  return ["html", "body", "#document"].includes(ne(e));
1404
1404
  }
1405
- function z(e) {
1405
+ function U(e) {
1406
1406
  return W(e).getComputedStyle(e);
1407
1407
  }
1408
1408
  function We(e) {
@@ -1426,20 +1426,20 @@ function fe(e) {
1426
1426
  );
1427
1427
  return wt(t) ? t.host : t;
1428
1428
  }
1429
- function Ut(e) {
1429
+ function zt(e) {
1430
1430
  const t = fe(e);
1431
- return je(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : U(t) && we(t) ? t : Ut(t);
1431
+ return je(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : z(t) && we(t) ? t : zt(t);
1432
1432
  }
1433
1433
  function xe(e, t) {
1434
1434
  var n;
1435
1435
  t === void 0 && (t = []);
1436
- const o = Ut(e), i = o === ((n = e.ownerDocument) == null ? void 0 : n.body), r = W(o);
1436
+ const o = zt(e), i = o === ((n = e.ownerDocument) == null ? void 0 : n.body), r = W(o);
1437
1437
  return i ? t.concat(r, r.visualViewport || [], we(o) ? o : [], r.frameElement ? xe(r.frameElement) : []) : t.concat(o, xe(o));
1438
1438
  }
1439
1439
  function Gt(e) {
1440
- const t = z(e);
1440
+ const t = U(e);
1441
1441
  let n = parseFloat(t.width) || 0, o = parseFloat(t.height) || 0;
1442
- const i = U(e), r = i ? e.offsetWidth : n, s = i ? e.offsetHeight : o, a = Fe(n) !== r || Fe(o) !== s;
1442
+ const i = z(e), r = i ? e.offsetWidth : n, s = i ? e.offsetHeight : o, a = Fe(n) !== r || Fe(o) !== s;
1443
1443
  return a && (n = r, o = s), {
1444
1444
  width: n,
1445
1445
  height: o,
@@ -1451,7 +1451,7 @@ function ot(e) {
1451
1451
  }
1452
1452
  function ue(e) {
1453
1453
  const t = ot(e);
1454
- if (!U(t))
1454
+ if (!z(t))
1455
1455
  return te(1);
1456
1456
  const n = t.getBoundingClientRect(), {
1457
1457
  width: o,
@@ -1486,7 +1486,7 @@ function ae(e, t, n, o) {
1486
1486
  const p = W(r), f = o && q(o) ? W(o) : o;
1487
1487
  let h = p.frameElement;
1488
1488
  for (; h && o && f !== p; ) {
1489
- const g = ue(h), m = h.getBoundingClientRect(), v = z(h), y = m.left + (h.clientLeft + parseFloat(v.paddingLeft)) * g.x, x = m.top + (h.clientTop + parseFloat(v.paddingTop)) * g.y;
1489
+ const g = ue(h), m = h.getBoundingClientRect(), v = U(h), y = m.left + (h.clientLeft + parseFloat(v.paddingLeft)) * g.x, x = m.top + (h.clientTop + parseFloat(v.paddingTop)) * g.y;
1490
1490
  c *= g.x, l *= g.y, d *= g.x, u *= g.y, c += y, l += x, h = W(h).frameElement;
1491
1491
  }
1492
1492
  }
@@ -1503,7 +1503,7 @@ function Mr(e) {
1503
1503
  offsetParent: n,
1504
1504
  strategy: o
1505
1505
  } = e;
1506
- const i = U(n), r = K(n);
1506
+ const i = z(n), r = K(n);
1507
1507
  if (n === r)
1508
1508
  return t;
1509
1509
  let s = {
@@ -1511,7 +1511,7 @@ function Mr(e) {
1511
1511
  scrollTop: 0
1512
1512
  }, a = te(1);
1513
1513
  const c = te(0);
1514
- if ((i || !i && o !== "fixed") && ((ne(n) !== "body" || we(r)) && (s = We(n)), U(n))) {
1514
+ if ((i || !i && o !== "fixed") && ((ne(n) !== "body" || we(r)) && (s = We(n)), z(n))) {
1515
1515
  const l = ae(n);
1516
1516
  a = ue(n), c.x = l.x + n.clientLeft, c.y = l.y + n.clientTop;
1517
1517
  }
@@ -1532,7 +1532,7 @@ function Fr(e) {
1532
1532
  const t = K(e), n = We(e), o = e.ownerDocument.body, i = B(t.scrollWidth, t.clientWidth, o.scrollWidth, o.clientWidth), r = B(t.scrollHeight, t.clientHeight, o.scrollHeight, o.clientHeight);
1533
1533
  let s = -n.scrollLeft + Xt(e);
1534
1534
  const a = -n.scrollTop;
1535
- return z(o).direction === "rtl" && (s += B(t.clientWidth, o.clientWidth) - i), {
1535
+ return U(o).direction === "rtl" && (s += B(t.clientWidth, o.clientWidth) - i), {
1536
1536
  width: i,
1537
1537
  height: r,
1538
1538
  x: s,
@@ -1555,7 +1555,7 @@ function Hr(e, t) {
1555
1555
  };
1556
1556
  }
1557
1557
  function kr(e, t) {
1558
- const n = ae(e, !0, t === "fixed"), o = n.top + e.clientTop, i = n.left + e.clientLeft, r = U(e) ? ue(e) : te(1), s = e.clientWidth * r.x, a = e.clientHeight * r.y, c = i * r.x, l = o * r.y;
1558
+ const n = ae(e, !0, t === "fixed"), o = n.top + e.clientTop, i = n.left + e.clientLeft, r = z(e) ? ue(e) : te(1), s = e.clientWidth * r.x, a = e.clientHeight * r.y, c = i * r.x, l = o * r.y;
1559
1559
  return {
1560
1560
  width: s,
1561
1561
  height: a,
@@ -1583,17 +1583,17 @@ function _t(e, t, n) {
1583
1583
  }
1584
1584
  function qt(e, t) {
1585
1585
  const n = fe(e);
1586
- return n === t || !q(n) || je(n) ? !1 : z(n).position === "fixed" || qt(n, t);
1586
+ return n === t || !q(n) || je(n) ? !1 : U(n).position === "fixed" || qt(n, t);
1587
1587
  }
1588
1588
  function Br(e, t) {
1589
1589
  const n = t.get(e);
1590
1590
  if (n)
1591
1591
  return n;
1592
1592
  let o = xe(e).filter((a) => q(a) && ne(a) !== "body"), i = null;
1593
- const r = z(e).position === "fixed";
1593
+ const r = U(e).position === "fixed";
1594
1594
  let s = r ? fe(e) : e;
1595
1595
  for (; q(s) && !je(s); ) {
1596
- const a = z(s), c = nt(s);
1596
+ const a = U(s), c = nt(s);
1597
1597
  !c && a.position === "fixed" && (i = null), (r ? !c && !i : !c && a.position === "static" && !!i && ["absolute", "fixed"].includes(i.position) || we(s) && !c && qt(e, s)) ? o = o.filter((d) => d !== s) : i = a, s = fe(s);
1598
1598
  }
1599
1599
  return t.set(e, o), o;
@@ -1620,7 +1620,7 @@ function Wr(e) {
1620
1620
  return Gt(e);
1621
1621
  }
1622
1622
  function Vr(e, t, n) {
1623
- const o = U(t), i = K(t), r = n === "fixed", s = ae(e, !0, r, t);
1623
+ const o = z(t), i = K(t), r = n === "fixed", s = ae(e, !0, r, t);
1624
1624
  let a = {
1625
1625
  scrollLeft: 0,
1626
1626
  scrollTop: 0
@@ -1640,18 +1640,18 @@ function Vr(e, t, n) {
1640
1640
  };
1641
1641
  }
1642
1642
  function At(e, t) {
1643
- return !U(e) || z(e).position === "fixed" ? null : t ? t(e) : e.offsetParent;
1643
+ return !z(e) || U(e).position === "fixed" ? null : t ? t(e) : e.offsetParent;
1644
1644
  }
1645
1645
  function Kt(e, t) {
1646
1646
  const n = W(e);
1647
- if (!U(e))
1647
+ if (!z(e))
1648
1648
  return n;
1649
1649
  let o = At(e, t);
1650
- for (; o && Sr(o) && z(o).position === "static"; )
1650
+ for (; o && Sr(o) && U(o).position === "static"; )
1651
1651
  o = At(o, t);
1652
- return o && (ne(o) === "html" || ne(o) === "body" && z(o).position === "static" && !nt(o)) ? n : o || Dr(e) || n;
1652
+ return o && (ne(o) === "html" || ne(o) === "body" && U(o).position === "static" && !nt(o)) ? n : o || Dr(e) || n;
1653
1653
  }
1654
- const zr = async function(e) {
1654
+ const Ur = async function(e) {
1655
1655
  let {
1656
1656
  reference: t,
1657
1657
  floating: n,
@@ -1667,20 +1667,20 @@ const zr = async function(e) {
1667
1667
  }
1668
1668
  };
1669
1669
  };
1670
- function Ur(e) {
1671
- return z(e).direction === "rtl";
1670
+ function zr(e) {
1671
+ return U(e).direction === "rtl";
1672
1672
  }
1673
1673
  const Gr = {
1674
1674
  convertOffsetParentRelativeRectToViewportRelativeRect: Mr,
1675
1675
  getDocumentElement: K,
1676
1676
  getClippingRect: jr,
1677
1677
  getOffsetParent: Kt,
1678
- getElementRects: zr,
1678
+ getElementRects: Ur,
1679
1679
  getClientRects: Ir,
1680
1680
  getDimensions: Wr,
1681
1681
  getScale: ue,
1682
1682
  isElement: q,
1683
- isRTL: Ur
1683
+ isRTL: zr
1684
1684
  };
1685
1685
  function Yr(e, t) {
1686
1686
  let n = null, o;
@@ -2308,7 +2308,7 @@ const _o = /* @__PURE__ */ M((e, t) => /* @__PURE__ */ _(ce.span, S({}, e, {
2308
2308
  }
2309
2309
  }))), Ao = _o, [Ve, hi] = kt("Tooltip", [
2310
2310
  en
2311
- ]), ze = en(), Po = "TooltipProvider", Eo = 700, Ze = "tooltip.open", [Oo, st] = Ve(Po), To = (e) => {
2311
+ ]), Ue = en(), Po = "TooltipProvider", Eo = 700, Ze = "tooltip.open", [Oo, st] = Ve(Po), To = (e) => {
2312
2312
  const { __scopeTooltip: t, delayDuration: n = Eo, skipDelayDuration: o = 300, disableHoverableContent: i = !1, children: r } = e, [s, a] = j(!0), c = L(!1), l = L(0);
2313
2313
  return R(() => {
2314
2314
  const d = l.current;
@@ -2335,7 +2335,7 @@ const _o = /* @__PURE__ */ M((e, t) => /* @__PURE__ */ _(ce.span, S({}, e, {
2335
2335
  disableHoverableContent: i
2336
2336
  }, r);
2337
2337
  }, at = "Tooltip", [Co, _e] = Ve(at), Ro = (e) => {
2338
- const { __scopeTooltip: t, children: n, open: o, defaultOpen: i = !1, onOpenChange: r, disableHoverableContent: s, delayDuration: a } = e, c = st(at, e.__scopeTooltip), l = ze(t), [d, u] = j(null), p = hr(), f = L(0), h = s ?? c.disableHoverableContent, g = a ?? c.delayDuration, m = L(!1), [v = !1, y] = $o({
2338
+ const { __scopeTooltip: t, children: n, open: o, defaultOpen: i = !1, onOpenChange: r, disableHoverableContent: s, delayDuration: a } = e, c = st(at, e.__scopeTooltip), l = Ue(t), [d, u] = j(null), p = hr(), f = L(0), h = s ?? c.disableHoverableContent, g = a ?? c.delayDuration, m = L(!1), [v = !1, y] = $o({
2339
2339
  prop: o,
2340
2340
  defaultProp: i,
2341
2341
  onChange: (E) => {
@@ -2384,7 +2384,7 @@ const _o = /* @__PURE__ */ M((e, t) => /* @__PURE__ */ _(ce.span, S({}, e, {
2384
2384
  disableHoverableContent: h
2385
2385
  }, n));
2386
2386
  }, Ot = "TooltipTrigger", So = /* @__PURE__ */ M((e, t) => {
2387
- const { __scopeTooltip: n, ...o } = e, i = _e(Ot, n), r = st(Ot, n), s = ze(n), a = L(null), c = pe(t, a, i.onTriggerChange), l = L(!1), d = L(!1), u = H(
2387
+ const { __scopeTooltip: n, ...o } = e, i = _e(Ot, n), r = st(Ot, n), s = Ue(n), a = L(null), c = pe(t, a, i.onTriggerChange), l = L(!1), d = L(!1), u = H(
2388
2388
  () => l.current = !1,
2389
2389
  []
2390
2390
  );
@@ -2451,7 +2451,7 @@ const _o = /* @__PURE__ */ M((e, t) => /* @__PURE__ */ _(ce.span, S({}, e, {
2451
2451
  const m = h.currentTarget, v = {
2452
2452
  x: h.clientX,
2453
2453
  y: h.clientY
2454
- }, y = jo(v, m.getBoundingClientRect()), x = Wo(v, y), $ = Vo(g.getBoundingClientRect()), b = Uo([
2454
+ }, y = jo(v, m.getBoundingClientRect()), x = Wo(v, y), $ = Vo(g.getBoundingClientRect()), b = zo([
2455
2455
  ...x,
2456
2456
  ...$
2457
2457
  ]);
@@ -2479,7 +2479,7 @@ const _o = /* @__PURE__ */ M((e, t) => /* @__PURE__ */ _(ce.span, S({}, e, {
2479
2479
  const m = g.target, v = {
2480
2480
  x: g.clientX,
2481
2481
  y: g.clientY
2482
- }, y = (c == null ? void 0 : c.contains(m)) || (d == null ? void 0 : d.contains(m)), x = !zo(v, s);
2482
+ }, y = (c == null ? void 0 : c.contains(m)) || (d == null ? void 0 : d.contains(m)), x = !Uo(v, s);
2483
2483
  y ? p() : x && (p(), l());
2484
2484
  };
2485
2485
  return document.addEventListener("pointermove", h), () => document.removeEventListener("pointermove", h);
@@ -2496,7 +2496,7 @@ const _o = /* @__PURE__ */ M((e, t) => /* @__PURE__ */ _(ce.span, S({}, e, {
2496
2496
  }), [Fo, Ho] = Ve(at, {
2497
2497
  isInside: !1
2498
2498
  }), sn = /* @__PURE__ */ M((e, t) => {
2499
- const { __scopeTooltip: n, children: o, "aria-label": i, onEscapeKeyDown: r, onPointerDownOutside: s, ...a } = e, c = _e($e, n), l = ze(n), { onClose: d } = c;
2499
+ const { __scopeTooltip: n, children: o, "aria-label": i, onEscapeKeyDown: r, onPointerDownOutside: s, ...a } = e, c = _e($e, n), l = Ue(n), { onClose: d } = c;
2500
2500
  return R(() => (document.addEventListener(Ze, d), () => document.removeEventListener(Ze, d)), [
2501
2501
  d
2502
2502
  ]), R(() => {
@@ -2541,7 +2541,7 @@ const _o = /* @__PURE__ */ M((e, t) => /* @__PURE__ */ _(ce.span, S({}, e, {
2541
2541
  role: "tooltip"
2542
2542
  }, i || o))));
2543
2543
  }), ko = "TooltipArrow", Bo = /* @__PURE__ */ M((e, t) => {
2544
- const { __scopeTooltip: n, ...o } = e, i = ze(n);
2544
+ const { __scopeTooltip: n, ...o } = e, i = Ue(n);
2545
2545
  return Ho(ko, n).isInside ? null : /* @__PURE__ */ _(vo, S({}, i, o, {
2546
2546
  ref: t
2547
2547
  }));
@@ -2624,7 +2624,7 @@ function Vo(e) {
2624
2624
  }
2625
2625
  ];
2626
2626
  }
2627
- function zo(e, t) {
2627
+ function Uo(e, t) {
2628
2628
  const { x: n, y: o } = e;
2629
2629
  let i = !1;
2630
2630
  for (let r = 0, s = t.length - 1; r < t.length; s = r++) {
@@ -2633,7 +2633,7 @@ function zo(e, t) {
2633
2633
  }
2634
2634
  return i;
2635
2635
  }
2636
- function Uo(e) {
2636
+ function zo(e) {
2637
2637
  const t = e.slice();
2638
2638
  return t.sort((n, o) => n.x < o.x ? -1 : n.x > o.x ? 1 : n.y < o.y ? -1 : n.y > o.y ? 1 : 0), Go(t);
2639
2639
  }
@@ -2765,7 +2765,7 @@ const ti = /* @__PURE__ */ Qo(ei), ni = "_slideDownAndFade_1dyp8_1", ri = "_slid
2765
2765
  children: /* @__PURE__ */ I(Mt, { size: "md" })
2766
2766
  }
2767
2767
  );
2768
- return /* @__PURE__ */ I("div", { "data-testid": e, className: p, children: /* @__PURE__ */ I(Yo, { delayDuration: parseInt(Jn), children: /* @__PURE__ */ Ue(Xo, { open: d, onOpenChange: u, ...c, children: [
2768
+ return /* @__PURE__ */ I("div", { "data-testid": e, className: p, children: /* @__PURE__ */ I(Yo, { delayDuration: parseInt(Jn), children: /* @__PURE__ */ ze(Xo, { open: d, onOpenChange: u, ...c, children: [
2769
2769
  /* @__PURE__ */ I(
2770
2770
  qo,
2771
2771
  {
@@ -2776,7 +2776,7 @@ const ti = /* @__PURE__ */ Qo(ei), ni = "_slideDownAndFade_1dyp8_1", ri = "_slid
2776
2776
  children: se.count(a) === 0 ? f : a
2777
2777
  }
2778
2778
  ),
2779
- /* @__PURE__ */ I(Ko, { children: /* @__PURE__ */ Ue(
2779
+ /* @__PURE__ */ I(Ko, { children: /* @__PURE__ */ ze(
2780
2780
  Zo,
2781
2781
  {
2782
2782
  side: i,