@npm_leadtech/legal-contracts-ui 0.53.0 → 0.53.2

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.
@@ -56,6 +56,7 @@ export interface MobileMenuSection {
56
56
  items?: {
57
57
  id: string;
58
58
  link: ReactNode;
59
+ tag?: string;
59
60
  }[];
60
61
  seeAll?: ReactNode | null;
61
62
  content?: ReactNode | null;
@@ -67,6 +68,7 @@ export type NavMenuItemProps = {
67
68
  dropdownItems: (NavMenuItemProps | NavMenuLink)[];
68
69
  hasDropdown: true;
69
70
  isNested?: boolean;
71
+ onItemClick?: () => void;
70
72
  };
71
73
 
72
74
  export type NavMenuLink = {
@@ -76,6 +78,7 @@ export type NavMenuLink = {
76
78
  hasDropdown: false;
77
79
  isNested?: boolean;
78
80
  bold?: boolean;
81
+ onItemClick?: () => void;
79
82
  };
80
83
 
81
84
  export interface NavMenuProps {
@@ -30,6 +30,7 @@ export declare interface MobileMenuSection {
30
30
  items?: {
31
31
  id: string;
32
32
  link: ReactNode;
33
+ tag?: string;
33
34
  }[];
34
35
  seeAll?: ReactNode | null;
35
36
  content?: ReactNode | null;
@@ -1,28 +1,28 @@
1
1
  import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
2
  import "react";
3
- import { SearchBar as x } from "./SearchBar.js";
3
+ import { SearchBar as u } from "./SearchBar.js";
4
4
  import { PhoneTalkIcon as f } from "./PhoneTalkIcon.js";
5
5
  import { CloseIcon as h } from "./CloseIcon.js";
6
6
  const j = ({
7
- isOpen: m,
8
- onClose: n,
9
- logo: c,
10
- userActions: d,
11
- searchBarProps: p,
12
- sections: o = [],
7
+ isOpen: n,
8
+ onClose: m,
9
+ logo: d,
10
+ userActions: c,
11
+ searchBarProps: o,
12
+ sections: p = [],
13
13
  contactInfo: t,
14
- closeText: u
15
- }) => m ? /* @__PURE__ */ l("div", { className: "fixed inset-0 z-50 flex flex-col overflow-y-auto bg-white text-neutral-800 lg:hidden", children: [
14
+ closeText: x
15
+ }) => n ? /* @__PURE__ */ l("div", { className: "fixed inset-0 z-50 flex flex-col overflow-y-auto bg-white text-neutral-800 lg:hidden", children: [
16
16
  /* @__PURE__ */ l("div", { className: "flex items-center justify-between px-6 py-4", children: [
17
- c,
17
+ d,
18
18
  /* @__PURE__ */ l(
19
19
  "button",
20
20
  {
21
21
  className: "text-small text-primary-500 flex cursor-pointer items-center justify-center gap-1 rounded border border-neutral-400 px-2 py-1",
22
- onClick: n,
22
+ onClick: m,
23
23
  "aria-label": "Close menu",
24
24
  children: [
25
- u,
25
+ x,
26
26
  /* @__PURE__ */ r(h, { fill: "var(--primary-500)" })
27
27
  ]
28
28
  }
@@ -30,27 +30,31 @@ const j = ({
30
30
  ] }),
31
31
  /* @__PURE__ */ l("div", { className: "flex flex-1 flex-col pb-6", children: [
32
32
  /* @__PURE__ */ l("div", { className: "flex flex-col gap-6 px-6", children: [
33
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4", children: d }),
34
- /* @__PURE__ */ r(x, { ...p })
33
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-4", children: c }),
34
+ /* @__PURE__ */ r(u, { ...o })
35
35
  ] }),
36
- /* @__PURE__ */ r("nav", { className: "flex flex-col gap-0", children: o.map((e, i) => {
37
- const a = e.icon != null;
38
- return e.content != null ? /* @__PURE__ */ r("div", { className: "flex items-center px-6 pb-8", children: e.content }, e.id ?? `custom-${i.toString()}`) : /* @__PURE__ */ l(
36
+ /* @__PURE__ */ r("nav", { className: "flex flex-col gap-0", children: p.map((e, s) => {
37
+ const i = e.icon != null;
38
+ return e.content != null ? /* @__PURE__ */ r("div", { className: "flex items-center px-6 pb-8", children: e.content }, e.id ?? `custom-${s.toString()}`) : /* @__PURE__ */ l(
39
39
  "div",
40
40
  {
41
- className: e.title !== "" && !a ? "border-t border-b border-neutral-200 pt-4" : "",
41
+ className: e.title !== "" && !i ? "border-t border-b border-neutral-200 pt-4" : "",
42
42
  children: [
43
- e.title && /* @__PURE__ */ l("div", { className: `flex items-center gap-2 px-6 ${a ? "bg-neutral-50 py-4" : ""}`, children: [
43
+ e.title && /* @__PURE__ */ l("div", { className: `flex items-center gap-2 px-6 ${i ? "bg-neutral-50 py-4" : ""}`, children: [
44
44
  e.icon != null && /* @__PURE__ */ r("span", { className: "text-primary-700", children: e.icon }),
45
45
  /* @__PURE__ */ r("h4", { className: "text-medium font-semibold", children: e.title })
46
46
  ] }),
47
- e.items != null && /* @__PURE__ */ l("ul", { className: `flex flex-col gap-4 ${a ? "p-6" : "px-6 py-4"}`, children: [
48
- e.items.map((s) => /* @__PURE__ */ r("li", { className: "text-medium", children: s.link }, s.id)),
47
+ e.items != null && /* @__PURE__ */ l("ul", { className: `flex flex-col gap-4 ${i ? "p-6" : "px-6 py-4"}`, children: [
48
+ e.items.map((a) => /* @__PURE__ */ l("li", { className: "text-medium flex items-center gap-1", children: [
49
+ a.link,
50
+ " ",
51
+ a.tag && /* @__PURE__ */ r("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: a.tag })
52
+ ] }, a.id)),
49
53
  e.seeAll != null && /* @__PURE__ */ r("li", { className: "font-semibold", children: e.seeAll })
50
54
  ] })
51
55
  ]
52
56
  },
53
- e.id ?? e.title ?? i.toString()
57
+ e.id ?? e.title ?? s.toString()
54
58
  );
55
59
  }) }),
56
60
  t && /* @__PURE__ */ l("div", { className: "mt-auto flex flex-col items-center justify-center border-t border-neutral-100 p-6", children: [
@@ -9,6 +9,7 @@ export type NavMenuItemProps = {
9
9
  dropdownItems: (NavMenuItemProps | NavMenuLink)[];
10
10
  hasDropdown: true;
11
11
  isNested?: boolean;
12
+ onItemClick?: () => void;
12
13
  };
13
14
 
14
15
  export type NavMenuLink = {
@@ -18,6 +19,7 @@ export type NavMenuLink = {
18
19
  hasDropdown: false;
19
20
  isNested?: boolean;
20
21
  bold?: boolean;
22
+ onItemClick?: () => void;
21
23
  };
22
24
 
23
25
  export declare interface NavMenuProps {
@@ -9,6 +9,7 @@ export declare type NavMenuItemProps = {
9
9
  dropdownItems: (NavMenuItemProps | NavMenuLink)[];
10
10
  hasDropdown: true;
11
11
  isNested?: boolean;
12
+ onItemClick?: () => void;
12
13
  };
13
14
 
14
15
  export declare type NavMenuLink = {
@@ -18,5 +19,6 @@ export declare type NavMenuLink = {
18
19
  hasDropdown: false;
19
20
  isNested?: boolean;
20
21
  bold?: boolean;
22
+ onItemClick?: () => void;
21
23
  };
22
24
 
@@ -1,61 +1,68 @@
1
- import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
- import "react";
3
- import { ChevronDownIcon as g } from "./ChevronDownIcon.js";
4
- import { ChevronRightIcon as f } from "./ChevronRightIcon.js";
5
- const h = (o) => {
6
- const { hasDropdown: a, isNested: i } = o, n = {
1
+ "use client";
2
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
3
+ import { useState as C } from "react";
4
+ import { ChevronDownIcon as b } from "./ChevronDownIcon.js";
5
+ import { ChevronRightIcon as I } from "./ChevronRightIcon.js";
6
+ const N = (n) => {
7
+ const { hasDropdown: m, isNested: u } = n, i = {
7
8
  topLevel: {
8
- liClass: "group relative py-2",
9
+ liClass: "relative py-2",
9
10
  triggerClass: "hover:text-neutral-600",
10
11
  dropdownPosition: "top-full left-0",
11
- dropdownTrigger: "group-hover:pointer-events-auto group-hover:opacity-100",
12
- Icon: g,
13
- iconClass: "transition-transform duration-200 group-hover:rotate-180"
12
+ Icon: b
14
13
  },
15
14
  nested: {
16
- liClass: "group/nested relative",
15
+ liClass: "relative",
17
16
  triggerClass: "p-1 hover:bg-primary-100 w-full rounded min-w-48.5",
18
17
  dropdownPosition: "top-0 left-full -mt-4 pl-6",
19
- dropdownTrigger: "group-hover/nested:pointer-events-auto group-hover/nested:opacity-100",
20
- Icon: f,
21
- iconClass: ""
18
+ Icon: I
22
19
  }
23
- }, t = i ? n.nested : n.topLevel, d = t.Icon;
24
- if (a) {
25
- const { dropdownItems: u, label: m } = o;
26
- return /* @__PURE__ */ r("li", { className: t.liClass, children: [
27
- /* @__PURE__ */ r(
20
+ }, t = u ? i.nested : i.topLevel, h = t.Icon, [l, o] = C(!1), r = () => {
21
+ o(!1), n.onItemClick && n.onItemClick();
22
+ }, f = (s) => {
23
+ s.stopPropagation(), o(!l);
24
+ }, p = () => {
25
+ globalThis.window.matchMedia("(hover: hover)").matches && o(!0);
26
+ }, g = () => {
27
+ globalThis.window.matchMedia("(hover: hover)").matches && o(!1);
28
+ };
29
+ if (m) {
30
+ const { dropdownItems: s, label: v } = n;
31
+ return /* @__PURE__ */ a("li", { className: t.liClass, onMouseEnter: p, onMouseLeave: g, children: [
32
+ /* @__PURE__ */ a(
28
33
  "button",
29
34
  {
30
- className: `text-small flex w-full cursor-pointer items-center justify-between gap-1 font-medium text-nowrap text-neutral-800 transition-colors ${t.triggerClass} `,
35
+ className: `text-small flex w-full cursor-pointer items-center justify-between gap-1 font-medium text-nowrap text-neutral-800 transition-colors ${t.triggerClass}`,
31
36
  "aria-haspopup": "menu",
37
+ "aria-expanded": l,
38
+ onClick: f,
32
39
  children: [
33
- /* @__PURE__ */ e("span", { className: "text-medium", children: m }),
34
- /* @__PURE__ */ e(d, { className: t.iconClass, fill: "#000", width: 20, height: 20 })
40
+ /* @__PURE__ */ e("span", { className: "text-medium", children: v }),
41
+ /* @__PURE__ */ e(h, { fill: "#000", width: 20, height: 20 })
35
42
  ]
36
43
  }
37
44
  ),
38
45
  /* @__PURE__ */ e(
39
46
  "div",
40
47
  {
41
- className: `pointer-events-none absolute z-50 min-w-48 opacity-0 transition-opacity duration-200 ${t.dropdownPosition} ${t.dropdownTrigger} `,
42
- children: /* @__PURE__ */ e("div", { className: "rounded-md border border-neutral-200 bg-white p-4 shadow-lg", children: /* @__PURE__ */ e("ul", { className: "flex flex-col gap-2", children: u.map((l) => /* @__PURE__ */ e(h, { ...l, isNested: !0 }, l.id)) }) })
48
+ className: `absolute z-50 min-w-48 transition-all duration-200 ${t.dropdownPosition} ${l ? "pointer-events-auto opacity-100" : "pointer-events-none opacity-0"}`,
49
+ children: /* @__PURE__ */ e("div", { className: "rounded-md border border-neutral-200 bg-white p-4 shadow-lg", children: /* @__PURE__ */ e("ul", { className: "flex flex-col gap-2", children: s.map((d) => /* @__PURE__ */ e(N, { ...d, isNested: !0, onItemClick: r }, d.id)) }) })
43
50
  }
44
51
  )
45
52
  ] });
46
53
  }
47
- const { link: c, tag: s, bold: p } = o;
48
- return /* @__PURE__ */ e("li", { className: t.liClass, children: /* @__PURE__ */ r(
54
+ const { link: w, tag: c, bold: x } = n;
55
+ return /* @__PURE__ */ e("li", { className: t.liClass, onClick: r, children: /* @__PURE__ */ a(
49
56
  "span",
50
57
  {
51
- className: `text-small relative flex w-full items-center justify-between gap-1 font-medium text-nowrap text-neutral-800 transition-colors ${t.triggerClass} `,
58
+ className: `text-small relative flex w-full items-center gap-1 font-medium text-nowrap text-neutral-800 transition-colors ${t.triggerClass} `,
52
59
  children: [
53
- /* @__PURE__ */ e("span", { className: `text-medium flex-1 ${p ? "font-bold" : ""} [&_a]:after:absolute [&_a]:after:inset-0`, children: c }),
54
- s && /* @__PURE__ */ e("span", { className: "bg-secondary-200 text-extra-small rounded px-1 font-bold", children: s })
60
+ /* @__PURE__ */ e("span", { className: `text-medium flex-1 ${x ? "font-bold" : ""} [&_a]:after:absolute [&_a]:after:inset-0`, children: w }),
61
+ c && /* @__PURE__ */ e("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: c })
55
62
  ]
56
63
  }
57
64
  ) });
58
65
  };
59
66
  export {
60
- h as NavMenuItem
67
+ N as NavMenuItem
61
68
  };