@npm_leadtech/legal-contracts-ui 0.53.1 → 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.
@@ -68,6 +68,7 @@ export type NavMenuItemProps = {
68
68
  dropdownItems: (NavMenuItemProps | NavMenuLink)[];
69
69
  hasDropdown: true;
70
70
  isNested?: boolean;
71
+ onItemClick?: () => void;
71
72
  };
72
73
 
73
74
  export type NavMenuLink = {
@@ -77,6 +78,7 @@ export type NavMenuLink = {
77
78
  hasDropdown: false;
78
79
  isNested?: boolean;
79
80
  bold?: boolean;
81
+ onItemClick?: () => void;
80
82
  };
81
83
 
82
84
  export interface NavMenuProps {
@@ -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: i, isNested: a } = 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 = a ? n.nested : n.topLevel, d = t.Icon;
24
- if (i) {
25
- const { dropdownItems: m, label: u } = 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: u }),
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: m.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
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 flex h-4.5 w-5.25 items-center justify-center rounded align-middle 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
  };