@odynn/awayz-core 0.5.11 → 0.5.12

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.
@@ -44,22 +44,22 @@ const pe = (e, t) => {
44
44
  // @__NO_SIDE_EFFECTS__
45
45
  function Tt(e) {
46
46
  const t = /* @__PURE__ */ At(e), r = s.forwardRef((n, o) => {
47
- const { children: i, ...a } = n, l = s.Children.toArray(i), c = l.find(St);
48
- if (c) {
49
- const d = c.props.children, p = l.map((f) => f === c ? s.Children.count(d) > 1 ? s.Children.only(null) : s.isValidElement(d) ? d.props.children : null : f);
50
- return /* @__PURE__ */ u(t, { ...a, ref: o, children: s.isValidElement(d) ? s.cloneElement(d, void 0, p) : null });
47
+ const { children: i, ...c } = n, l = s.Children.toArray(i), a = l.find(St);
48
+ if (a) {
49
+ const d = a.props.children, p = l.map((h) => h === a ? s.Children.count(d) > 1 ? s.Children.only(null) : s.isValidElement(d) ? d.props.children : null : h);
50
+ return /* @__PURE__ */ u(t, { ...c, ref: o, children: s.isValidElement(d) ? s.cloneElement(d, void 0, p) : null });
51
51
  }
52
- return /* @__PURE__ */ u(t, { ...a, ref: o, children: i });
52
+ return /* @__PURE__ */ u(t, { ...c, ref: o, children: i });
53
53
  });
54
54
  return r.displayName = `${e}.Slot`, r;
55
55
  }
56
56
  // @__NO_SIDE_EFFECTS__
57
57
  function At(e) {
58
58
  const t = s.forwardRef((r, n) => {
59
- const { children: o, ...i } = r, a = s.isValidElement(o) ? Ot(o) : void 0, l = D(a, n);
59
+ const { children: o, ...i } = r, c = s.isValidElement(o) ? Ot(o) : void 0, l = D(c, n);
60
60
  if (s.isValidElement(o)) {
61
- const c = Nt(i, o.props);
62
- return o.type !== s.Fragment && (c.ref = l), s.cloneElement(o, c);
61
+ const a = Nt(i, o.props);
62
+ return o.type !== s.Fragment && (a.ref = l), s.cloneElement(o, a);
63
63
  }
64
64
  return s.Children.count(o) > 1 ? s.Children.only(null) : null;
65
65
  });
@@ -79,8 +79,8 @@ function Nt(e, t) {
79
79
  for (const n in t) {
80
80
  const o = e[n], i = t[n];
81
81
  /^on[A-Z]/.test(n) ? o && i ? r[n] = (...l) => {
82
- const c = i(...l);
83
- return o(...l), c;
82
+ const a = i(...l);
83
+ return o(...l), a;
84
84
  } : o && (r[n] = o) : n === "style" ? r[n] = { ...o, ...i } : n === "className" && (r[n] = [o, i].filter(Boolean).join(" "));
85
85
  }
86
86
  return { ...e, ...r };
@@ -110,8 +110,8 @@ var Dt = [
110
110
  "ul"
111
111
  ], S = Dt.reduce((e, t) => {
112
112
  const r = /* @__PURE__ */ Tt(`Primitive.${t}`), n = s.forwardRef((o, i) => {
113
- const { asChild: a, ...l } = o, c = a ? r : t;
114
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ u(c, { ...l, ref: i });
113
+ const { asChild: c, ...l } = o, a = c ? r : t;
114
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ u(a, { ...l, ref: i });
115
115
  });
116
116
  return n.displayName = `Primitive.${t}`, { ...e, [t]: n };
117
117
  }, {});
@@ -129,24 +129,24 @@ var Lt = "DismissableLayer", z = "dismissableLayer.update", It = "dismissableLay
129
129
  onEscapeKeyDown: n,
130
130
  onPointerDownOutside: o,
131
131
  onFocusOutside: i,
132
- onInteractOutside: a,
132
+ onInteractOutside: c,
133
133
  onDismiss: l,
134
- ...c
135
- } = e, d = s.useContext(ge), [p, f] = s.useState(null), h = (p == null ? void 0 : p.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, v] = s.useState({}), m = D(t, (g) => f(g)), y = Array.from(d.layers), [C] = [...d.layersWithOutsidePointerEventsDisabled].slice(-1), E = y.indexOf(C), w = p ? y.indexOf(p) : -1, x = d.layersWithOutsidePointerEventsDisabled.size > 0, P = w >= E, T = kt((g) => {
134
+ ...a
135
+ } = e, d = s.useContext(ge), [p, h] = s.useState(null), f = (p == null ? void 0 : p.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, v] = s.useState({}), y = D(t, (g) => h(g)), m = Array.from(d.layers), [C] = [...d.layersWithOutsidePointerEventsDisabled].slice(-1), E = m.indexOf(C), w = p ? m.indexOf(p) : -1, x = d.layersWithOutsidePointerEventsDisabled.size > 0, P = w >= E, T = kt((g) => {
136
136
  const N = g.target, k = [...d.branches].some((I) => I.contains(N));
137
- !P || k || (o == null || o(g), a == null || a(g), g.defaultPrevented || l == null || l());
138
- }, h), b = $t((g) => {
137
+ !P || k || (o == null || o(g), c == null || c(g), g.defaultPrevented || l == null || l());
138
+ }, f), b = $t((g) => {
139
139
  const N = g.target;
140
- [...d.branches].some((I) => I.contains(N)) || (i == null || i(g), a == null || a(g), g.defaultPrevented || l == null || l());
141
- }, h);
140
+ [...d.branches].some((I) => I.contains(N)) || (i == null || i(g), c == null || c(g), g.defaultPrevented || l == null || l());
141
+ }, f);
142
142
  return ot((g) => {
143
143
  w === d.layers.size - 1 && (n == null || n(g), !g.defaultPrevented && l && (g.preventDefault(), l()));
144
- }, h), s.useEffect(() => {
144
+ }, f), s.useEffect(() => {
145
145
  if (p)
146
- return r && (d.layersWithOutsidePointerEventsDisabled.size === 0 && (fe = h.body.style.pointerEvents, h.body.style.pointerEvents = "none"), d.layersWithOutsidePointerEventsDisabled.add(p)), d.layers.add(p), he(), () => {
147
- r && d.layersWithOutsidePointerEventsDisabled.size === 1 && (h.body.style.pointerEvents = fe);
146
+ return r && (d.layersWithOutsidePointerEventsDisabled.size === 0 && (fe = f.body.style.pointerEvents, f.body.style.pointerEvents = "none"), d.layersWithOutsidePointerEventsDisabled.add(p)), d.layers.add(p), he(), () => {
147
+ r && d.layersWithOutsidePointerEventsDisabled.size === 1 && (f.body.style.pointerEvents = fe);
148
148
  };
149
- }, [p, h, r, d]), s.useEffect(() => () => {
149
+ }, [p, f, r, d]), s.useEffect(() => () => {
150
150
  p && (d.layers.delete(p), d.layersWithOutsidePointerEventsDisabled.delete(p), he());
151
151
  }, [p, d]), s.useEffect(() => {
152
152
  const g = () => v({});
@@ -154,8 +154,8 @@ var Lt = "DismissableLayer", z = "dismissableLayer.update", It = "dismissableLay
154
154
  }, []), /* @__PURE__ */ u(
155
155
  S.div,
156
156
  {
157
- ...c,
158
- ref: m,
157
+ ...a,
158
+ ref: y,
159
159
  style: {
160
160
  pointerEvents: x ? P ? "auto" : "none" : void 0,
161
161
  ...e.style
@@ -188,7 +188,7 @@ function kt(e, t = globalThis == null ? void 0 : globalThis.document) {
188
188
  return s.useEffect(() => {
189
189
  const i = (l) => {
190
190
  if (l.target && !n.current) {
191
- let c = function() {
191
+ let a = function() {
192
192
  we(
193
193
  It,
194
194
  r,
@@ -197,15 +197,15 @@ function kt(e, t = globalThis == null ? void 0 : globalThis.document) {
197
197
  );
198
198
  };
199
199
  const d = { originalEvent: l };
200
- l.pointerType === "touch" ? (t.removeEventListener("click", o.current), o.current = c, t.addEventListener("click", o.current, { once: !0 })) : c();
200
+ l.pointerType === "touch" ? (t.removeEventListener("click", o.current), o.current = a, t.addEventListener("click", o.current, { once: !0 })) : a();
201
201
  } else
202
202
  t.removeEventListener("click", o.current);
203
203
  n.current = !1;
204
- }, a = window.setTimeout(() => {
204
+ }, c = window.setTimeout(() => {
205
205
  t.addEventListener("pointerdown", i);
206
206
  }, 0);
207
207
  return () => {
208
- window.clearTimeout(a), t.removeEventListener("pointerdown", i), t.removeEventListener("click", o.current);
208
+ window.clearTimeout(c), t.removeEventListener("pointerdown", i), t.removeEventListener("click", o.current);
209
209
  };
210
210
  }, [t, r]), {
211
211
  // ensures we check React component tree (not just DOM tree)
@@ -257,9 +257,9 @@ var Bt = Ee, K = "Popper", [Pe, be] = ve(K), [Ut, xe] = Pe(K), Te = (e) => {
257
257
  Te.displayName = K;
258
258
  var Ae = "PopperAnchor", Re = s.forwardRef(
259
259
  (e, t) => {
260
- const { __scopePopper: r, virtualRef: n, ...o } = e, i = xe(Ae, r), a = s.useRef(null), l = D(t, a);
260
+ const { __scopePopper: r, virtualRef: n, ...o } = e, i = xe(Ae, r), c = s.useRef(null), l = D(t, c);
261
261
  return s.useEffect(() => {
262
- i.onAnchorChange((n == null ? void 0 : n.current) || a.current);
262
+ i.onAnchorChange((n == null ? void 0 : n.current) || c.current);
263
263
  }), n ? null : /* @__PURE__ */ u(S.div, { ...o, ref: l });
264
264
  }
265
265
  );
@@ -272,16 +272,16 @@ var Q = "PopperContent", [Yt, Vt] = Pe(Q), Se = s.forwardRef(
272
272
  side: n = "bottom",
273
273
  sideOffset: o = 0,
274
274
  align: i = "center",
275
- alignOffset: a = 0,
275
+ alignOffset: c = 0,
276
276
  arrowPadding: l = 0,
277
- avoidCollisions: c = !0,
277
+ avoidCollisions: a = !0,
278
278
  collisionBoundary: d = [],
279
279
  collisionPadding: p = 0,
280
- sticky: f = "partial",
281
- hideWhenDetached: h = !1,
280
+ sticky: h = "partial",
281
+ hideWhenDetached: f = !1,
282
282
  updatePositionStrategy: v = "optimized",
283
- onPlaced: m,
284
- ...y
283
+ onPlaced: y,
284
+ ...m
285
285
  } = e, C = xe(Q, r), [E, w] = s.useState(null), x = D(t, (M) => w(M)), [P, T] = s.useState(null), b = st(P), g = (b == null ? void 0 : b.width) ?? 0, N = (b == null ? void 0 : b.height) ?? 0, k = n + (i !== "center" ? "-" + i : ""), I = typeof p == "number" ? p : { top: 0, right: 0, bottom: 0, left: 0, ...p }, te = Array.isArray(d) ? d : [d], Ye = te.length > 0, $ = {
286
286
  padding: I,
287
287
  boundary: te.filter(Gt),
@@ -298,14 +298,14 @@ var Q = "PopperContent", [Yt, Vt] = Pe(Q), Se = s.forwardRef(
298
298
  reference: C.anchor
299
299
  },
300
300
  middleware: [
301
- at({ mainAxis: o + N, alignmentAxis: a }),
302
- c && ct({
301
+ at({ mainAxis: o + N, alignmentAxis: c }),
302
+ a && ct({
303
303
  mainAxis: !0,
304
304
  crossAxis: !1,
305
- limiter: f === "partial" ? ft() : void 0,
305
+ limiter: h === "partial" ? ft() : void 0,
306
306
  ...$
307
307
  }),
308
- c && lt({ ...$ }),
308
+ a && lt({ ...$ }),
309
309
  ut({
310
310
  ...$,
311
311
  apply: ({ elements: M, rects: ue, availableWidth: Qe, availableHeight: Je }) => {
@@ -315,9 +315,9 @@ var Q = "PopperContent", [Yt, Vt] = Pe(Q), Se = s.forwardRef(
315
315
  }),
316
316
  P && dt({ element: P, padding: l }),
317
317
  zt({ arrowWidth: g, arrowHeight: N }),
318
- h && pt({ strategy: "referenceHidden", ...$ })
318
+ f && pt({ strategy: "referenceHidden", ...$ })
319
319
  ]
320
- }), [ne, Ge] = De(je), B = q(m);
320
+ }), [ne, Ge] = De(je), B = q(y);
321
321
  G(() => {
322
322
  W && (B == null || B());
323
323
  }, [W, B]);
@@ -362,10 +362,10 @@ var Q = "PopperContent", [Yt, Vt] = Pe(Q), Se = s.forwardRef(
362
362
  {
363
363
  "data-side": ne,
364
364
  "data-align": Ge,
365
- ...y,
365
+ ...m,
366
366
  ref: x,
367
367
  style: {
368
- ...y.style,
368
+ ...m.style,
369
369
  // if the PopperContent hasn't been placed yet (not all measurements done)
370
370
  // we prevent animations so that users's animation don't kick in too early referring wrong sides
371
371
  animation: W ? void 0 : "none"
@@ -385,7 +385,7 @@ var Ne = "PopperArrow", jt = {
385
385
  bottom: "top",
386
386
  left: "right"
387
387
  }, Oe = s.forwardRef(function(t, r) {
388
- const { __scopePopper: n, ...o } = t, i = Vt(Ne, n), a = jt[i.placedSide];
388
+ const { __scopePopper: n, ...o } = t, i = Vt(Ne, n), c = jt[i.placedSide];
389
389
  return (
390
390
  // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
391
391
  // doesn't report size as we'd expect on SVG elements.
@@ -398,7 +398,7 @@ var Ne = "PopperArrow", jt = {
398
398
  position: "absolute",
399
399
  left: i.arrowX,
400
400
  top: i.arrowY,
401
- [a]: 0,
401
+ [c]: 0,
402
402
  transformOrigin: {
403
403
  top: "",
404
404
  right: "0 0",
@@ -438,9 +438,9 @@ var zt = (e) => ({
438
438
  options: e,
439
439
  fn(t) {
440
440
  var C, E, w;
441
- const { placement: r, rects: n, middlewareData: o } = t, a = ((C = o.arrow) == null ? void 0 : C.centerOffset) !== 0, l = a ? 0 : e.arrowWidth, c = a ? 0 : e.arrowHeight, [d, p] = De(r), f = { start: "0%", center: "50%", end: "100%" }[p], h = (((E = o.arrow) == null ? void 0 : E.x) ?? 0) + l / 2, v = (((w = o.arrow) == null ? void 0 : w.y) ?? 0) + c / 2;
442
- let m = "", y = "";
443
- return d === "bottom" ? (m = a ? f : `${h}px`, y = `${-c}px`) : d === "top" ? (m = a ? f : `${h}px`, y = `${n.floating.height + c}px`) : d === "right" ? (m = `${-c}px`, y = a ? f : `${v}px`) : d === "left" && (m = `${n.floating.width + c}px`, y = a ? f : `${v}px`), { data: { x: m, y } };
441
+ const { placement: r, rects: n, middlewareData: o } = t, c = ((C = o.arrow) == null ? void 0 : C.centerOffset) !== 0, l = c ? 0 : e.arrowWidth, a = c ? 0 : e.arrowHeight, [d, p] = De(r), h = { start: "0%", center: "50%", end: "100%" }[p], f = (((E = o.arrow) == null ? void 0 : E.x) ?? 0) + l / 2, v = (((w = o.arrow) == null ? void 0 : w.y) ?? 0) + a / 2;
442
+ let y = "", m = "";
443
+ return d === "bottom" ? (y = c ? h : `${f}px`, m = `${-a}px`) : d === "top" ? (y = c ? h : `${f}px`, m = `${n.floating.height + a}px`) : d === "right" ? (y = `${-a}px`, m = c ? h : `${v}px`) : d === "left" && (y = `${n.floating.width + a}px`, m = c ? h : `${v}px`), { data: { x: y, y: m } };
444
444
  }
445
445
  });
446
446
  function De(e) {
@@ -451,8 +451,8 @@ var Xt = Te, Zt = Re, qt = Se, Kt = Oe, Qt = "Portal", _e = s.forwardRef((e, t)
451
451
  var l;
452
452
  const { container: r, ...n } = e, [o, i] = s.useState(!1);
453
453
  G(() => i(!0), []);
454
- const a = r || o && ((l = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : l.body);
455
- return a ? gt.createPortal(/* @__PURE__ */ u(S.div, { ...n, ref: t }), a) : null;
454
+ const c = r || o && ((l = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : l.body);
455
+ return c ? gt.createPortal(/* @__PURE__ */ u(S.div, { ...n, ref: t }), c) : null;
456
456
  });
457
457
  _e.displayName = Qt;
458
458
  var Jt = Object.freeze({
@@ -487,22 +487,22 @@ var tr = Le, [Y, jr] = ve("Tooltip", [
487
487
  skipDelayDuration: n = 300,
488
488
  disableHoverableContent: o = !1,
489
489
  children: i
490
- } = e, a = s.useRef(!0), l = s.useRef(!1), c = s.useRef(0);
490
+ } = e, c = s.useRef(!0), l = s.useRef(!1), a = s.useRef(0);
491
491
  return s.useEffect(() => {
492
- const d = c.current;
492
+ const d = a.current;
493
493
  return () => window.clearTimeout(d);
494
494
  }, []), /* @__PURE__ */ u(
495
495
  nr,
496
496
  {
497
497
  scope: t,
498
- isOpenDelayedRef: a,
498
+ isOpenDelayedRef: c,
499
499
  delayDuration: r,
500
500
  onOpen: s.useCallback(() => {
501
- window.clearTimeout(c.current), a.current = !1;
501
+ window.clearTimeout(a.current), c.current = !1;
502
502
  }, []),
503
503
  onClose: s.useCallback(() => {
504
- window.clearTimeout(c.current), c.current = window.setTimeout(
505
- () => a.current = !0,
504
+ window.clearTimeout(a.current), a.current = window.setTimeout(
505
+ () => c.current = !0,
506
506
  n
507
507
  );
508
508
  }, [n]),
@@ -523,13 +523,13 @@ var H = "Tooltip", [or, F] = Y(H), He = (e) => {
523
523
  open: n,
524
524
  defaultOpen: o,
525
525
  onOpenChange: i,
526
- disableHoverableContent: a,
526
+ disableHoverableContent: c,
527
527
  delayDuration: l
528
- } = e, c = J(H, e.__scopeTooltip), d = V(t), [p, f] = s.useState(null), h = vt(), v = s.useRef(0), m = a ?? c.disableHoverableContent, y = l ?? c.delayDuration, C = s.useRef(!1), [E, w] = mt({
528
+ } = e, a = J(H, e.__scopeTooltip), d = V(t), [p, h] = s.useState(null), f = vt(), v = s.useRef(0), y = c ?? a.disableHoverableContent, m = l ?? a.delayDuration, C = s.useRef(!1), [E, w] = mt({
529
529
  prop: n,
530
530
  defaultProp: o ?? !1,
531
531
  onChange: (g) => {
532
- g ? (c.onOpen(), document.dispatchEvent(new CustomEvent(X))) : c.onClose(), i == null || i(g);
532
+ g ? (a.onOpen(), document.dispatchEvent(new CustomEvent(X))) : a.onClose(), i == null || i(g);
533
533
  },
534
534
  caller: H
535
535
  }), x = s.useMemo(() => E ? C.current ? "delayed-open" : "instant-open" : "closed", [E]), P = s.useCallback(() => {
@@ -539,28 +539,28 @@ var H = "Tooltip", [or, F] = Y(H), He = (e) => {
539
539
  }, [w]), b = s.useCallback(() => {
540
540
  window.clearTimeout(v.current), v.current = window.setTimeout(() => {
541
541
  C.current = !0, w(!0), v.current = 0;
542
- }, y);
543
- }, [y, w]);
542
+ }, m);
543
+ }, [m, w]);
544
544
  return s.useEffect(() => () => {
545
545
  v.current && (window.clearTimeout(v.current), v.current = 0);
546
546
  }, []), /* @__PURE__ */ u(Xt, { ...d, children: /* @__PURE__ */ u(
547
547
  or,
548
548
  {
549
549
  scope: t,
550
- contentId: h,
550
+ contentId: f,
551
551
  open: E,
552
552
  stateAttribute: x,
553
553
  trigger: p,
554
- onTriggerChange: f,
554
+ onTriggerChange: h,
555
555
  onTriggerEnter: s.useCallback(() => {
556
- c.isOpenDelayedRef.current ? b() : P();
557
- }, [c.isOpenDelayedRef, b, P]),
556
+ a.isOpenDelayedRef.current ? b() : P();
557
+ }, [a.isOpenDelayedRef, b, P]),
558
558
  onTriggerLeave: s.useCallback(() => {
559
- m ? T() : (window.clearTimeout(v.current), v.current = 0);
560
- }, [T, m]),
559
+ y ? T() : (window.clearTimeout(v.current), v.current = 0);
560
+ }, [T, y]),
561
561
  onOpen: P,
562
562
  onClose: T,
563
- disableHoverableContent: m,
563
+ disableHoverableContent: y,
564
564
  children: r
565
565
  }
566
566
  ) });
@@ -568,22 +568,22 @@ var H = "Tooltip", [or, F] = Y(H), He = (e) => {
568
568
  He.displayName = H;
569
569
  var Z = "TooltipTrigger", Fe = s.forwardRef(
570
570
  (e, t) => {
571
- const { __scopeTooltip: r, ...n } = e, o = F(Z, r), i = J(Z, r), a = V(r), l = s.useRef(null), c = D(t, l, o.onTriggerChange), d = s.useRef(!1), p = s.useRef(!1), f = s.useCallback(() => d.current = !1, []);
572
- return s.useEffect(() => () => document.removeEventListener("pointerup", f), [f]), /* @__PURE__ */ u(Zt, { asChild: !0, ...a, children: /* @__PURE__ */ u(
571
+ const { __scopeTooltip: r, ...n } = e, o = F(Z, r), i = J(Z, r), c = V(r), l = s.useRef(null), a = D(t, l, o.onTriggerChange), d = s.useRef(!1), p = s.useRef(!1), h = s.useCallback(() => d.current = !1, []);
572
+ return s.useEffect(() => () => document.removeEventListener("pointerup", h), [h]), /* @__PURE__ */ u(Zt, { asChild: !0, ...c, children: /* @__PURE__ */ u(
573
573
  S.button,
574
574
  {
575
575
  "aria-describedby": o.open ? o.contentId : void 0,
576
576
  "data-state": o.stateAttribute,
577
577
  ...n,
578
- ref: c,
579
- onPointerMove: A(e.onPointerMove, (h) => {
580
- h.pointerType !== "touch" && !p.current && !i.isPointerInTransitRef.current && (o.onTriggerEnter(), p.current = !0);
578
+ ref: a,
579
+ onPointerMove: A(e.onPointerMove, (f) => {
580
+ f.pointerType !== "touch" && !p.current && !i.isPointerInTransitRef.current && (o.onTriggerEnter(), p.current = !0);
581
581
  }),
582
582
  onPointerLeave: A(e.onPointerLeave, () => {
583
583
  o.onTriggerLeave(), p.current = !1;
584
584
  }),
585
585
  onPointerDown: A(e.onPointerDown, () => {
586
- o.open && o.onClose(), d.current = !0, document.addEventListener("pointerup", f, { once: !0 });
586
+ o.open && o.onClose(), d.current = !0, document.addEventListener("pointerup", h, { once: !0 });
587
587
  }),
588
588
  onFocus: A(e.onFocus, () => {
589
589
  d.current || o.onOpen();
@@ -604,35 +604,35 @@ var ee = "TooltipPortal", [sr, ir] = Y(ee, {
604
604
  ke.displayName = ee;
605
605
  var L = "TooltipContent", $e = s.forwardRef(
606
606
  (e, t) => {
607
- const r = ir(L, e.__scopeTooltip), { forceMount: n = r.forceMount, side: o = "top", ...i } = e, a = F(L, e.__scopeTooltip);
608
- return /* @__PURE__ */ u(me, { present: n || a.open, children: a.disableHoverableContent ? /* @__PURE__ */ u(We, { side: o, ...i, ref: t }) : /* @__PURE__ */ u(ar, { side: o, ...i, ref: t }) });
607
+ const r = ir(L, e.__scopeTooltip), { forceMount: n = r.forceMount, side: o = "top", ...i } = e, c = F(L, e.__scopeTooltip);
608
+ return /* @__PURE__ */ u(me, { present: n || c.open, children: c.disableHoverableContent ? /* @__PURE__ */ u(We, { side: o, ...i, ref: t }) : /* @__PURE__ */ u(ar, { side: o, ...i, ref: t }) });
609
609
  }
610
610
  ), ar = s.forwardRef((e, t) => {
611
- const r = F(L, e.__scopeTooltip), n = J(L, e.__scopeTooltip), o = s.useRef(null), i = D(t, o), [a, l] = s.useState(null), { trigger: c, onClose: d } = r, p = o.current, { onPointerInTransitChange: f } = n, h = s.useCallback(() => {
612
- l(null), f(!1);
613
- }, [f]), v = s.useCallback(
614
- (m, y) => {
615
- const C = m.currentTarget, E = { x: m.clientX, y: m.clientY }, w = dr(E, C.getBoundingClientRect()), x = pr(E, w), P = fr(y.getBoundingClientRect()), T = vr([...x, ...P]);
616
- l(T), f(!0);
611
+ const r = F(L, e.__scopeTooltip), n = J(L, e.__scopeTooltip), o = s.useRef(null), i = D(t, o), [c, l] = s.useState(null), { trigger: a, onClose: d } = r, p = o.current, { onPointerInTransitChange: h } = n, f = s.useCallback(() => {
612
+ l(null), h(!1);
613
+ }, [h]), v = s.useCallback(
614
+ (y, m) => {
615
+ const C = y.currentTarget, E = { x: y.clientX, y: y.clientY }, w = dr(E, C.getBoundingClientRect()), x = pr(E, w), P = fr(m.getBoundingClientRect()), T = vr([...x, ...P]);
616
+ l(T), h(!0);
617
617
  },
618
- [f]
618
+ [h]
619
619
  );
620
- return s.useEffect(() => () => h(), [h]), s.useEffect(() => {
621
- if (c && p) {
622
- const m = (C) => v(C, p), y = (C) => v(C, c);
623
- return c.addEventListener("pointerleave", m), p.addEventListener("pointerleave", y), () => {
624
- c.removeEventListener("pointerleave", m), p.removeEventListener("pointerleave", y);
620
+ return s.useEffect(() => () => f(), [f]), s.useEffect(() => {
621
+ if (a && p) {
622
+ const y = (C) => v(C, p), m = (C) => v(C, a);
623
+ return a.addEventListener("pointerleave", y), p.addEventListener("pointerleave", m), () => {
624
+ a.removeEventListener("pointerleave", y), p.removeEventListener("pointerleave", m);
625
625
  };
626
626
  }
627
- }, [c, p, v, h]), s.useEffect(() => {
628
- if (a) {
629
- const m = (y) => {
630
- const C = y.target, E = { x: y.clientX, y: y.clientY }, w = (c == null ? void 0 : c.contains(C)) || (p == null ? void 0 : p.contains(C)), x = !hr(E, a);
631
- w ? h() : x && (h(), d());
627
+ }, [a, p, v, f]), s.useEffect(() => {
628
+ if (c) {
629
+ const y = (m) => {
630
+ const C = m.target, E = { x: m.clientX, y: m.clientY }, w = (a == null ? void 0 : a.contains(C)) || (p == null ? void 0 : p.contains(C)), x = !hr(E, c);
631
+ w ? f() : x && (f(), d());
632
632
  };
633
- return document.addEventListener("pointermove", m), () => document.removeEventListener("pointermove", m);
633
+ return document.addEventListener("pointermove", y), () => document.removeEventListener("pointermove", y);
634
634
  }
635
- }, [c, p, a, d, h]), /* @__PURE__ */ u(We, { ...e, ref: i });
635
+ }, [a, p, c, d, f]), /* @__PURE__ */ u(We, { ...e, ref: i });
636
636
  }), [cr, lr] = Y(H, { isInside: !1 }), ur = /* @__PURE__ */ Rt("TooltipContent"), We = s.forwardRef(
637
637
  (e, t) => {
638
638
  const {
@@ -640,30 +640,30 @@ var L = "TooltipContent", $e = s.forwardRef(
640
640
  children: n,
641
641
  "aria-label": o,
642
642
  onEscapeKeyDown: i,
643
- onPointerDownOutside: a,
643
+ onPointerDownOutside: c,
644
644
  ...l
645
- } = e, c = F(L, r), d = V(r), { onClose: p } = c;
645
+ } = e, a = F(L, r), d = V(r), { onClose: p } = a;
646
646
  return s.useEffect(() => (document.addEventListener(X, p), () => document.removeEventListener(X, p)), [p]), s.useEffect(() => {
647
- if (c.trigger) {
648
- const f = (h) => {
649
- const v = h.target;
650
- v != null && v.contains(c.trigger) && p();
647
+ if (a.trigger) {
648
+ const h = (f) => {
649
+ const v = f.target;
650
+ v != null && v.contains(a.trigger) && p();
651
651
  };
652
- return window.addEventListener("scroll", f, { capture: !0 }), () => window.removeEventListener("scroll", f, { capture: !0 });
652
+ return window.addEventListener("scroll", h, { capture: !0 }), () => window.removeEventListener("scroll", h, { capture: !0 });
653
653
  }
654
- }, [c.trigger, p]), /* @__PURE__ */ u(
654
+ }, [a.trigger, p]), /* @__PURE__ */ u(
655
655
  Ce,
656
656
  {
657
657
  asChild: !0,
658
658
  disableOutsidePointerEvents: !1,
659
659
  onEscapeKeyDown: i,
660
- onPointerDownOutside: a,
661
- onFocusOutside: (f) => f.preventDefault(),
660
+ onPointerDownOutside: c,
661
+ onFocusOutside: (h) => h.preventDefault(),
662
662
  onDismiss: p,
663
663
  children: /* @__PURE__ */ R(
664
664
  qt,
665
665
  {
666
- "data-state": c.stateAttribute,
666
+ "data-state": a.stateAttribute,
667
667
  ...d,
668
668
  ...l,
669
669
  ref: t,
@@ -677,7 +677,7 @@ var L = "TooltipContent", $e = s.forwardRef(
677
677
  },
678
678
  children: [
679
679
  /* @__PURE__ */ u(ur, { children: n }),
680
- /* @__PURE__ */ u(cr, { scope: r, isInside: !0, children: /* @__PURE__ */ u(tr, { id: c.contentId, role: "tooltip", children: o || n }) })
680
+ /* @__PURE__ */ u(cr, { scope: r, isInside: !0, children: /* @__PURE__ */ u(tr, { id: a.contentId, role: "tooltip", children: o || n }) })
681
681
  ]
682
682
  }
683
683
  )
@@ -753,9 +753,9 @@ function fr(e) {
753
753
  function hr(e, t) {
754
754
  const { x: r, y: n } = e;
755
755
  let o = !1;
756
- for (let i = 0, a = t.length - 1; i < t.length; a = i++) {
757
- const l = t[i], c = t[a], d = l.x, p = l.y, f = c.x, h = c.y;
758
- p > n != h > n && r < (f - d) * (n - p) / (h - p) + d && (o = !o);
756
+ for (let i = 0, c = t.length - 1; i < t.length; c = i++) {
757
+ const l = t[i], a = t[c], d = l.x, p = l.y, h = a.x, f = a.y;
758
+ p > n != f > n && r < (h - d) * (n - p) / (f - p) + d && (o = !o);
759
759
  }
760
760
  return o;
761
761
  }
@@ -769,8 +769,8 @@ function mr(e) {
769
769
  for (let n = 0; n < e.length; n++) {
770
770
  const o = e[n];
771
771
  for (; t.length >= 2; ) {
772
- const i = t[t.length - 1], a = t[t.length - 2];
773
- if ((i.x - a.x) * (o.y - a.y) >= (i.y - a.y) * (o.x - a.x)) t.pop();
772
+ const i = t[t.length - 1], c = t[t.length - 2];
773
+ if ((i.x - c.x) * (o.y - c.y) >= (i.y - c.y) * (o.x - c.x)) t.pop();
774
774
  else break;
775
775
  }
776
776
  t.push(o);
@@ -780,8 +780,8 @@ function mr(e) {
780
780
  for (let n = e.length - 1; n >= 0; n--) {
781
781
  const o = e[n];
782
782
  for (; r.length >= 2; ) {
783
- const i = r[r.length - 1], a = r[r.length - 2];
784
- if ((i.x - a.x) * (o.y - a.y) >= (i.y - a.y) * (o.x - a.x)) r.pop();
783
+ const i = r[r.length - 1], c = r[r.length - 2];
784
+ if ((i.x - c.x) * (o.y - c.y) >= (i.y - c.y) * (o.x - c.x)) r.pop();
785
785
  else break;
786
786
  }
787
787
  r.push(o);
@@ -795,30 +795,31 @@ const br = 1e3 * 60 * 60, Gr = ({
795
795
  position: r = bt.RIGHT,
796
796
  zeroDisplayOption: n = O.NA,
797
797
  customDisplay: o,
798
- decimalPlaces: i = 0
798
+ decimalPlaces: i = 0,
799
+ showConversion: c = !0
799
800
  }) => {
800
- var h, v;
801
- const { user: a } = Et(), l = ((h = a == null ? void 0 : a.preferences) == null ? void 0 : h.currency) ?? ((v = a == null ? void 0 : a.userRegion) == null ? void 0 : v.currency), c = l !== t, { data: d, isPending: p } = Ct({
802
- queryKey: [wt.CONVERT_CURRENCY, t, l],
801
+ var v, y;
802
+ const { user: l } = Et(), a = ((v = l == null ? void 0 : l.preferences) == null ? void 0 : v.currency) ?? ((y = l == null ? void 0 : l.userRegion) == null ? void 0 : y.currency), d = a !== t, { data: p, isPending: h } = Ct({
803
+ queryKey: [wt.CONVERT_CURRENCY, t, a],
803
804
  queryFn: () => Pt.convertCurrency({
804
805
  baseCurrency: t,
805
- targetCurrency: l
806
+ targetCurrency: a
806
807
  }),
807
- enabled: c,
808
+ enabled: d,
808
809
  staleTime: br
809
810
  }), f = nt(() => {
810
- if (!a)
811
+ if (!l)
811
812
  return null;
812
813
  let m = typeof e == "string" ? parseFloat(e) : e;
813
- if (c) {
814
- if (p || !d) return null;
815
- m = m * d;
814
+ if (d) {
815
+ if (h || !p) return null;
816
+ m = m * p;
816
817
  }
817
818
  return m;
818
- }, [e, a, p, c, d]);
819
- if (p && c)
819
+ }, [e, l, h, d, p]);
820
+ if (h && d)
820
821
  return /* @__PURE__ */ u("span", { className: "currency-conversion loading", children: e });
821
- if (!l || !f || f < 0)
822
+ if (!a || !f || f < 0)
822
823
  switch (n) {
823
824
  case O.NA:
824
825
  return /* @__PURE__ */ u("span", { children: "N/A" });
@@ -827,9 +828,9 @@ const br = 1e3 * 60 * 60, Gr = ({
827
828
  case O.DISPLAY_AS_ZERO:
828
829
  return /* @__PURE__ */ u("span", { children: "0" });
829
830
  case O.DISPLAY_AS_ZERO_WITH_CURRENCY:
830
- return /* @__PURE__ */ u("span", { children: pe(0, l ?? t) });
831
+ return /* @__PURE__ */ u("span", { children: pe(0, a ?? t) });
831
832
  case O.DISPLAY_AS_ZERO_WITH_CURRENCY_NO_DECIMAL:
832
- return /* @__PURE__ */ u("span", { children: xt(0, l ?? t) });
833
+ return /* @__PURE__ */ u("span", { children: xt(0, a ?? t) });
833
834
  case O.CUSTOM:
834
835
  return /* @__PURE__ */ u("span", { children: f == 0 ? o : "N/A" });
835
836
  default:
@@ -838,10 +839,10 @@ const br = 1e3 * 60 * 60, Gr = ({
838
839
  return /* @__PURE__ */ R("span", { className: "currency-conversion", children: [
839
840
  j(
840
841
  f,
841
- l,
842
+ a,
842
843
  i
843
844
  ),
844
- c && /* @__PURE__ */ u(
845
+ d && c && /* @__PURE__ */ u(
845
846
  xr,
846
847
  {
847
848
  trigger: /* @__PURE__ */ u("sup", { children: /* @__PURE__ */ u(de, {}) }),
@@ -851,13 +852,13 @@ const br = 1e3 * 60 * 60, Gr = ({
851
852
  "Converted from ",
852
853
  t,
853
854
  " to ",
854
- l
855
+ a
855
856
  ] }),
856
857
  /* @__PURE__ */ R("div", { className: "currency-conversion-amounts", children: [
857
858
  /* @__PURE__ */ u("div", { children: /* @__PURE__ */ u("p", { children: j(e, t, i) }) }),
858
859
  /* @__PURE__ */ u("div", { children: /* @__PURE__ */ u("p", { children: j(
859
860
  f,
860
- l,
861
+ a,
861
862
  i
862
863
  ) }) }),
863
864
  /* @__PURE__ */ u("span", { className: "conversion-icon", children: /* @__PURE__ */ u(de, {}) })
@@ -865,15 +866,15 @@ const br = 1e3 * 60 * 60, Gr = ({
865
866
  /* @__PURE__ */ u("div", { className: "currency-conversion-rate", children: /* @__PURE__ */ R("p", { children: [
866
867
  "Current Rate:",
867
868
  " ",
868
- d ? (
869
+ p ? (
869
870
  // only leaving 2 decimal places for the conversion rate is
870
871
  // not enough, can lead to confusion
871
872
  // use Number constructor to strip unnecessary trailing zeros
872
- `${Number((1 / d).toFixed(5))} ${t}`
873
+ `${Number((1 / p).toFixed(5))} ${t}`
873
874
  ) : "N/A",
874
875
  " ",
875
876
  "≈ ",
876
- pe(1, l)
877
+ pe(1, a)
877
878
  ] }) })
878
879
  ] })
879
880
  }
@@ -33,6 +33,11 @@ export interface ICashValueProps {
33
33
  * Number of decimal places to display. Defaults to 0.
34
34
  */
35
35
  decimalPlaces?: number;
36
+ /**
37
+ * Whether to show the conversion tooltip.
38
+ * Defaults to true, but can be set to false to hide it.
39
+ */
40
+ showConversion?: boolean;
36
41
  }
37
42
  export declare const CurrencyCallStaleTimeMs: number;
38
43
  /**
@@ -42,4 +47,4 @@ export declare const CurrencyCallStaleTimeMs: number;
42
47
  * If the original currency differs from the user's currency, it shows a conversion
43
48
  * tooltip with details about the conversion rate and original amount.
44
49
  */
45
- export declare const CashValue: ({ amount, currency, position, zeroDisplayOption, customDisplay, decimalPlaces }: ICashValueProps) => import("react/jsx-runtime").JSX.Element;
50
+ export declare const CashValue: ({ amount, currency, position, zeroDisplayOption, customDisplay, decimalPlaces, showConversion }: ICashValueProps) => import("react/jsx-runtime").JSX.Element;
@@ -2,7 +2,7 @@ import { StoryObj } from '@storybook/react';
2
2
  import { EInvalidAmountDisplayOption, EToolTipPosition } from './CashValueTypes';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ amount, currency, position, zeroDisplayOption, customDisplay, decimalPlaces }: import('./CashValue').ICashValueProps) => import("react/jsx-runtime").JSX.Element;
5
+ component: ({ amount, currency, position, zeroDisplayOption, customDisplay, decimalPlaces, showConversion }: import('./CashValue').ICashValueProps) => import("react/jsx-runtime").JSX.Element;
6
6
  parameters: {
7
7
  layout: string;
8
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-core",
3
- "version": "0.5.11",
3
+ "version": "0.5.12",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"