@npm_leadtech/legal-contracts-ui 0.127.0 → 0.128.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.
@@ -66,6 +66,7 @@ export interface MobileMenuSection {
66
66
  export type NavMenuItemProps = {
67
67
  id: string;
68
68
  label: string;
69
+ dataQa?: string;
69
70
  dropdownItems: (NavMenuItemProps | NavMenuLink)[];
70
71
  hasDropdown: true;
71
72
  isNested?: boolean;
@@ -84,6 +85,7 @@ export type NavMenuLink = {
84
85
  onItemClick?: () => void;
85
86
  isOpen?: boolean;
86
87
  onToggle?: (open: boolean) => void;
88
+ dataQa?: string;
87
89
  };
88
90
 
89
91
  export interface NavMenuProps {
@@ -6,6 +6,7 @@ export declare const NavMenu: FC<NavMenuProps>;
6
6
  export type NavMenuItemProps = {
7
7
  id: string;
8
8
  label: string;
9
+ dataQa?: string;
9
10
  dropdownItems: (NavMenuItemProps | NavMenuLink)[];
10
11
  hasDropdown: true;
11
12
  isNested?: boolean;
@@ -24,6 +25,7 @@ export type NavMenuLink = {
24
25
  onItemClick?: () => void;
25
26
  isOpen?: boolean;
26
27
  onToggle?: (open: boolean) => void;
28
+ dataQa?: string;
27
29
  };
28
30
 
29
31
  export declare interface NavMenuProps {
@@ -6,6 +6,7 @@ export declare const NavMenuItem: FC<NavMenuItemProps | NavMenuLink>;
6
6
  export declare type NavMenuItemProps = {
7
7
  id: string;
8
8
  label: string;
9
+ dataQa?: string;
9
10
  dropdownItems: (NavMenuItemProps | NavMenuLink)[];
10
11
  hasDropdown: true;
11
12
  isNested?: boolean;
@@ -24,5 +25,6 @@ export declare type NavMenuLink = {
24
25
  onItemClick?: () => void;
25
26
  isOpen?: boolean;
26
27
  onToggle?: (open: boolean) => void;
28
+ dataQa?: string;
27
29
  };
28
30
 
@@ -1,16 +1,16 @@
1
1
  "use client";
2
2
  import { jsxs as d, jsx as t } from "react/jsx-runtime";
3
- import { useState as p, useCallback as E, useRef as T, useEffect as $ } from "react";
4
- import { ChevronDownIcon as j } from "./ChevronDownIcon.js";
5
- import { ChevronRightIcon as P } from "./ChevronRightIcon.js";
6
- const R = (l) => {
7
- const { hasDropdown: g, isNested: w, isOpen: v, onToggle: i } = l, [x, C] = p(!1), [I, u] = p(null), s = v ?? x, n = E(
3
+ import { useState as p, useCallback as T, useRef as $, useEffect as j } from "react";
4
+ import { ChevronDownIcon as P } from "./ChevronDownIcon.js";
5
+ import { ChevronRightIcon as R } from "./ChevronRightIcon.js";
6
+ const D = (l) => {
7
+ const { hasDropdown: g, isNested: w, isOpen: v, onToggle: i, dataQa: x } = l, [C, I] = p(!1), [b, u] = p(null), s = v ?? C, n = T(
8
8
  (e) => {
9
- e || u(null), i ? i(e) : C(e);
9
+ e || u(null), i ? i(e) : I(e);
10
10
  },
11
11
  [i]
12
- ), r = T(null);
13
- $(() => {
12
+ ), r = $(null);
13
+ j(() => {
14
14
  if (!s) return;
15
15
  const e = (c) => {
16
16
  r.current && !r.current.contains(c.target) && n(!1);
@@ -24,21 +24,21 @@ const R = (l) => {
24
24
  liClass: "relative py-2",
25
25
  triggerClass: "hover:text-neutral-600",
26
26
  dropdownPosition: "top-full left-0",
27
- Icon: j
27
+ Icon: P
28
28
  },
29
29
  nested: {
30
30
  liClass: "relative",
31
31
  triggerClass: "p-1 hover:bg-primary-100 w-full rounded min-w-48.5",
32
32
  dropdownPosition: "top-0 left-full -mt-4 pl-6",
33
- Icon: P
33
+ Icon: R
34
34
  }
35
- }, o = w ? m.nested : m.topLevel, b = o.Icon, f = () => {
35
+ }, o = w ? m.nested : m.topLevel, N = o.Icon, f = () => {
36
36
  n(!1), l.onItemClick && l.onItemClick();
37
- }, N = (e) => {
37
+ }, k = (e) => {
38
38
  e.stopPropagation(), n(!s);
39
- }, k = () => {
40
- globalThis.window.matchMedia("(hover: hover)").matches && n(!0);
41
39
  }, O = () => {
40
+ globalThis.window.matchMedia("(hover: hover)").matches && n(!0);
41
+ }, y = () => {
42
42
  globalThis.window.matchMedia("(hover: hover)").matches && n(!1);
43
43
  };
44
44
  if (g) {
@@ -48,19 +48,20 @@ const R = (l) => {
48
48
  {
49
49
  ref: r,
50
50
  className: o.liClass,
51
- onMouseEnter: k,
52
- onMouseLeave: O,
51
+ onMouseEnter: O,
52
+ onMouseLeave: y,
53
53
  children: [
54
54
  /* @__PURE__ */ d(
55
55
  "button",
56
56
  {
57
+ "data-qa": x,
57
58
  className: `text-small flex w-full cursor-pointer items-center justify-between gap-1 text-nowrap text-neutral-800 transition-colors ${o.triggerClass}`,
58
59
  "aria-haspopup": "menu",
59
60
  "aria-expanded": s,
60
- onClick: N,
61
+ onClick: k,
61
62
  children: [
62
63
  /* @__PURE__ */ t("span", { className: "text-medium", children: c }),
63
- /* @__PURE__ */ t(b, { fill: "#000", width: 20, height: 20 })
64
+ /* @__PURE__ */ t(N, { fill: "#000", width: 20, height: 20 })
64
65
  ]
65
66
  }
66
67
  ),
@@ -69,14 +70,14 @@ const R = (l) => {
69
70
  {
70
71
  className: `absolute z-50 min-w-48 transition-all duration-200 ${o.dropdownPosition} ${s ? "pointer-events-auto opacity-100" : "pointer-events-none opacity-0"}`,
71
72
  children: /* @__PURE__ */ t("div", { className: "rounded-md border border-neutral-200 bg-white p-4 shadow-lg", children: /* @__PURE__ */ t("ul", { className: "flex flex-col gap-2", children: e.map((a) => /* @__PURE__ */ t(
72
- R,
73
+ D,
73
74
  {
74
75
  ...a,
75
76
  isNested: !0,
76
77
  onItemClick: f,
77
- isOpen: I === a.id,
78
- onToggle: (M) => {
79
- u(M ? a.id : null);
78
+ isOpen: b === a.id,
79
+ onToggle: (E) => {
80
+ u(E ? a.id : null);
80
81
  }
81
82
  },
82
83
  a.id
@@ -87,18 +88,18 @@ const R = (l) => {
87
88
  }
88
89
  );
89
90
  }
90
- const { link: y, tag: h, bold: L } = l;
91
+ const { link: L, tag: h, bold: M } = l;
91
92
  return /* @__PURE__ */ t("li", { className: o.liClass, onClick: f, children: /* @__PURE__ */ d(
92
93
  "span",
93
94
  {
94
95
  className: `text-small relative flex w-full items-center gap-1 text-nowrap text-neutral-800 transition-colors ${o.triggerClass} `,
95
96
  children: [
96
- /* @__PURE__ */ t("span", { className: `text-medium flex-1 ${L ? "font-bold" : ""} [&_a]:after:absolute [&_a]:after:inset-0`, children: y }),
97
+ /* @__PURE__ */ t("span", { className: `text-medium flex-1 ${M ? "font-bold" : ""} [&_a]:after:absolute [&_a]:after:inset-0`, children: L }),
97
98
  h && /* @__PURE__ */ t("span", { className: "bg-secondary-200 text-extra-small flex h-4.5 w-5.25 items-center justify-center rounded align-middle font-bold", children: h })
98
99
  ]
99
100
  }
100
101
  ) });
101
102
  };
102
103
  export {
103
- R as NavMenuItem
104
+ D as NavMenuItem
104
105
  };
@@ -1,6 +1,6 @@
1
1
  import { jsxs as r, Fragment as p, jsx as e } from "react/jsx-runtime";
2
- import { SearchIcon as f } from "./SearchIcon.js";
3
- import { CloseIcon as b } from "./CloseIcon.js";
2
+ import { SearchIcon as b } from "./SearchIcon.js";
3
+ import { CloseIcon as f } from "./CloseIcon.js";
4
4
  import { LinkWrapper as n } from "./LinkWrapper.js";
5
5
  const N = ({
6
6
  items: t,
@@ -12,7 +12,7 @@ const N = ({
12
12
  onClear: u,
13
13
  allDocumentsItem: i
14
14
  }) => {
15
- const l = o.length > 0;
15
+ const a = o.length > 0;
16
16
  return /* @__PURE__ */ r(p, { children: [
17
17
  /* @__PURE__ */ r("div", { className: "relative hidden lg:block", children: [
18
18
  /* @__PURE__ */ e(
@@ -22,13 +22,14 @@ const N = ({
22
22
  className: "hover:bg-primary-100 cursor-pointer rounded-full p-2 transition-colors",
23
23
  onClick: c,
24
24
  "aria-expanded": s,
25
- children: /* @__PURE__ */ e(f, {})
25
+ "data-qa": "search_button",
26
+ children: /* @__PURE__ */ e(b, {})
26
27
  }
27
28
  ),
28
29
  s && /* @__PURE__ */ r(p, { children: [
29
30
  /* @__PURE__ */ e("div", { className: "fixed inset-0 z-40", onClick: c, "aria-hidden": "true" }),
30
31
  /* @__PURE__ */ r("div", { className: "absolute top-full left-0 z-50 mt-4 max-h-[50dvh] w-80 animate-[slideDown_0.2s_ease-out] overflow-y-auto rounded-lg border border-neutral-200 bg-white px-4 shadow-lg", children: [
31
- /* @__PURE__ */ e("div", { className: `py-2 ${l ? "border-b border-neutral-200" : ""}`, children: /* @__PURE__ */ r("div", { className: "flex items-center gap-2 rounded-md py-2", children: [
32
+ /* @__PURE__ */ e("div", { className: `py-2 ${a ? "border-b border-neutral-200" : ""}`, children: /* @__PURE__ */ r("div", { className: "flex items-center gap-2 rounded-md py-2", children: [
32
33
  /* @__PURE__ */ e(
33
34
  "input",
34
35
  {
@@ -38,22 +39,23 @@ const N = ({
38
39
  onChange: h,
39
40
  placeholder: d,
40
41
  className: "flex-1 text-base text-neutral-800 outline-none placeholder:text-neutral-400",
41
- autoFocus: !0
42
+ autoFocus: !0,
43
+ "data-qa": "search_input"
42
44
  }
43
45
  ),
44
- l && /* @__PURE__ */ e(
46
+ a && /* @__PURE__ */ e(
45
47
  "button",
46
48
  {
47
49
  onClick: u,
48
50
  className: "cursor-pointer rounded-full p-0.5 transition-colors hover:bg-neutral-100",
49
51
  "aria-label": "Clear search",
50
- children: /* @__PURE__ */ e(b, { fill: "var(--neutral-400)", width: 20, height: 20 })
52
+ children: /* @__PURE__ */ e(f, { fill: "var(--neutral-400)", width: 20, height: 20 })
51
53
  }
52
54
  )
53
55
  ] }) }),
54
- /* @__PURE__ */ e("div", { className: "overflow-y-auto", children: /* @__PURE__ */ r("ul", { className: l ? "py-4" : "", children: [
55
- t.length > 0 && l && t.map((a) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(n, { className: "w-full justify-start", variant: "tertiary-thin", children: a.link }) }, a.id)),
56
- i && l && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(n, { className: "w-full justify-start font-bold", variant: "tertiary-thin", children: i.link }) })
56
+ /* @__PURE__ */ e("div", { className: "overflow-y-auto", children: /* @__PURE__ */ r("ul", { className: a ? "py-4" : "", children: [
57
+ t.length > 0 && a && t.map((l) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(n, { className: "w-full justify-start", variant: "tertiary-thin", children: l.link }) }, l.id)),
58
+ i && a && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(n, { className: "w-full justify-start font-bold", variant: "tertiary-thin", children: i.link }) })
57
59
  ] }) })
58
60
  ] })
59
61
  ] })
@@ -71,18 +73,18 @@ const N = ({
71
73
  className: "flex-1 bg-transparent text-base text-neutral-800 outline-none placeholder:text-neutral-400"
72
74
  }
73
75
  ),
74
- l ? /* @__PURE__ */ e(
76
+ a ? /* @__PURE__ */ e(
75
77
  "button",
76
78
  {
77
79
  onClick: u,
78
80
  className: "cursor-pointer rounded-full p-1 transition-colors hover:bg-neutral-200",
79
81
  "aria-label": "Clear search",
80
- children: /* @__PURE__ */ e(b, { fill: "var(--neutral-400)", width: 20, height: 20 })
82
+ children: /* @__PURE__ */ e(f, { fill: "var(--neutral-400)", width: 20, height: 20 })
81
83
  }
82
- ) : /* @__PURE__ */ e(f, { fill: "var(--neutral-500)", width: 20, height: 20 })
84
+ ) : /* @__PURE__ */ e(b, { fill: "var(--neutral-500)", width: 20, height: 20 })
83
85
  ] }),
84
- l && /* @__PURE__ */ e("div", { className: "absolute left-0 mt-2 w-full overflow-x-hidden overflow-y-auto bg-white", children: /* @__PURE__ */ r("ul", { className: "py-4 pl-4", children: [
85
- t.length > 0 && t.map((a) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(n, { variant: "tertiary-thin", children: a.link }) }, a.id)),
86
+ a && /* @__PURE__ */ e("div", { className: "absolute left-0 mt-2 w-full overflow-x-hidden overflow-y-auto bg-white", children: /* @__PURE__ */ r("ul", { className: "py-4 pl-4", children: [
87
+ t.length > 0 && t.map((l) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(n, { variant: "tertiary-thin", children: l.link }) }, l.id)),
86
88
  i && /* @__PURE__ */ e(n, { className: "font-bold", variant: "tertiary-thin", children: i.link })
87
89
  ] }) })
88
90
  ] })
@@ -889,6 +889,7 @@ export declare const NavMenuItem: FC<NavMenuItemProps | NavMenuLink>;
889
889
  export declare type NavMenuItemProps = {
890
890
  id: string;
891
891
  label: string;
892
+ dataQa?: string;
892
893
  dropdownItems: (NavMenuItemProps | NavMenuLink)[];
893
894
  hasDropdown: true;
894
895
  isNested?: boolean;
@@ -907,6 +908,7 @@ export declare type NavMenuLink = {
907
908
  onItemClick?: () => void;
908
909
  isOpen?: boolean;
909
910
  onToggle?: (open: boolean) => void;
911
+ dataQa?: string;
910
912
  };
911
913
 
912
914
  export declare interface NavMenuProps {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npm_leadtech/legal-contracts-ui",
3
- "version": "0.127.0",
3
+ "version": "0.128.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",