@hortiview/shared-components 0.0.6504 → 0.0.6829

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.
@@ -4,7 +4,7 @@ import { g as Hr } from "../../_commonjsHelpers-CT_km90n.js";
4
4
  import { _ as H, a as Tr, b as wr, c as w, d as Nr, e as Wr, f as h, h as N, j as B, k as Xr, l as zr, m as I, n as Yr, o as Zr, p as Jr, q as W, r as Qr, s as Or, t as Pr, u as kr, v as Vr } from "../../get-BRDhkfK0.js";
5
5
  import { useState as re, useMemo as k } from "react";
6
6
  import { SearchBar as ee } from "../SearchBar/SearchBar.js";
7
- import { g as ae, a as te, s as T } from "../../ListAreaService-BoNnFzrZ.js";
7
+ import { g as ae, a as te, s as T } from "../../ListAreaService-DDlsV9UD.js";
8
8
  var ne = H;
9
9
  function se() {
10
10
  this.__data__ = new ne(), this.size = 0;
@@ -2,7 +2,7 @@ import { jsx as r, Fragment as i } from "react/jsx-runtime";
2
2
  import { TypoButton as p } from "@element/react-components";
3
3
  import { r as s, s as a, f as u } from "../../react.esm-BBemCHUU.js";
4
4
  import { ListArea as c } from "./ListArea.js";
5
- import { g as h } from "../../ListAreaService-BoNnFzrZ.js";
5
+ import { g as h } from "../../ListAreaService-DDlsV9UD.js";
6
6
  import { d as m, t as n, g as t } from "../../vi.JYQecGiw-BbUbJcT8.js";
7
7
  m("ListArea Test", () => {
8
8
  const o = [
@@ -26,7 +26,7 @@ export declare const getListedItems: (items: ListElement[], pathname: string, it
26
26
  select: boolean;
27
27
  primaryText: string;
28
28
  secondaryText: import("react/jsx-runtime").JSX.Element;
29
- overlineText: string | undefined;
29
+ overlineText: import("react/jsx-runtime").JSX.Element;
30
30
  trailingBlock: string | number | boolean | JSX.Element | Iterable<import("react").ReactNode>;
31
31
  leadingBlock: string | JSX.Element | undefined;
32
32
  value: string | undefined;
@@ -55,7 +55,7 @@ export declare const mapListElement: (element: ListElement, pathname: string | u
55
55
  select: boolean;
56
56
  primaryText: string;
57
57
  secondaryText: import("react/jsx-runtime").JSX.Element;
58
- overlineText: string | undefined;
58
+ overlineText: import("react/jsx-runtime").JSX.Element;
59
59
  trailingBlock: string | number | boolean | JSX.Element | Iterable<import("react").ReactNode>;
60
60
  leadingBlock: string | JSX.Element | undefined;
61
61
  value: string | undefined;
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
2
2
  import "@element/react-components";
3
3
  import "../Iconify/Iconify.js";
4
4
  import "../../enums/AvailableCustomIcons.js";
5
- import { g as s, a as i, m as a } from "../../ListAreaService-BoNnFzrZ.js";
5
+ import { g as s, a as i, m as a } from "../../ListAreaService-DDlsV9UD.js";
6
6
  export {
7
7
  s as getGroupedItems,
8
8
  i as getListedItems,
@@ -0,0 +1,30 @@
1
+ /// <reference types="react" />
2
+ type OverflowTooltipProps = {
3
+ /**
4
+ * the id of the tooltip
5
+ */
6
+ id: string;
7
+ /**
8
+ * the full text to be displayed
9
+ */
10
+ text: string;
11
+ /**
12
+ * the children that will have the tooltip
13
+ */
14
+ children: JSX.Element;
15
+ };
16
+ /**
17
+ * A component that displays a tooltip when the text is overflowing.
18
+ * It can be wrapped around Element's Typography components (e.g. TypoDisplay).
19
+ * It clones the child element and adds the tooltip functionality.
20
+ *
21
+ * Hint: It was not written as a component that directly takes the Typography string as child,
22
+ * because then the OverflowTooltip would be nested within the Typography component and thus inherit the Typography styles.
23
+ * Furthermore, OverflowTooltip does not work on hovering ListArea items.
24
+ *
25
+ * @param id - the id of the tooltip
26
+ * @param text - the full text to be displayed
27
+ * @param children - the children that will have the tooltip
28
+ */
29
+ export declare const OverflowTooltip: ({ id, text, children }: OverflowTooltipProps) => import("react/jsx-runtime").JSX.Element;
30
+ export {};
@@ -0,0 +1,22 @@
1
+ import { jsxs as m, Fragment as p, jsx as c } from "react/jsx-runtime";
2
+ import { useState as h, useMemo as f, cloneElement as d } from "react";
3
+ import { H as x } from "../../react-tooltip.min-BzHiZW8k.js";
4
+ const a = ({ id: t, text: e, children: i }) => {
5
+ const [l, s] = h(""), n = f(
6
+ () => d(i, {
7
+ "data-tooltip-id": t,
8
+ onMouseEnter: ({ currentTarget: o }) => {
9
+ const r = o.clientWidth < o.scrollWidth || o.clientHeight < o.scrollHeight;
10
+ s(r ? e : "");
11
+ }
12
+ }),
13
+ [i, t, e]
14
+ );
15
+ return /* @__PURE__ */ m(p, { children: [
16
+ n,
17
+ /* @__PURE__ */ c(x, { id: t, noArrow: !0, place: "bottom", children: l })
18
+ ] });
19
+ };
20
+ export {
21
+ a as OverflowTooltip
22
+ };
@@ -0,0 +1,37 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { TypoDisplay as n } from "@element/react-components";
3
+ import { r as i, s as e, w as s } from "../../react.esm-BBemCHUU.js";
4
+ import { u as a } from "../../index-DfbRag7b.js";
5
+ import { OverflowTooltip as c } from "./OverflowTooltip.js";
6
+ import { d as u, t as p, g as r } from "../../vi.JYQecGiw-BbUbJcT8.js";
7
+ u("OverflowTooltip Test", () => {
8
+ p("should render OverflowTooltip on hover", async () => {
9
+ Object.defineProperty(HTMLElement.prototype, "clientWidth", {
10
+ configurable: !0,
11
+ value: 100
12
+ }), Object.defineProperty(HTMLElement.prototype, "scrollWidth", {
13
+ configurable: !0,
14
+ value: 200
15
+ });
16
+ const l = a.setup(), o = "Block name that should be truncated with an ellipsis because it is very very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong";
17
+ i(
18
+ /* @__PURE__ */ t(c, { id: o, text: o, children: /* @__PURE__ */ t(n, { children: o }) })
19
+ ), r(e.getByText(o)).toBeInTheDocument(), l.hover(e.getByText(o)), await s(() => {
20
+ r(e.getByRole("tooltip")).toBeInTheDocument();
21
+ });
22
+ }), p("should not render OverflowTooltip on hover", async () => {
23
+ Object.defineProperty(HTMLElement.prototype, "clientWidth", {
24
+ configurable: !0,
25
+ value: 200
26
+ }), Object.defineProperty(HTMLElement.prototype, "scrollWidth", {
27
+ configurable: !0,
28
+ value: 200
29
+ });
30
+ const l = a.setup(), o = "Block name that should be truncated with an ellipsis because it is very very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong";
31
+ i(
32
+ /* @__PURE__ */ t(c, { id: o, text: o, children: /* @__PURE__ */ t(n, { children: o }) })
33
+ ), r(e.getByText(o)).toBeInTheDocument(), l.hover(e.getByText(o)), await s(() => {
34
+ r(e.queryByRole("tooltip")).not.toBeInTheDocument();
35
+ });
36
+ });
37
+ });