@npm_leadtech/legal-contracts-ui 0.53.2 → 0.53.3
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.
|
@@ -69,6 +69,8 @@ export type NavMenuItemProps = {
|
|
|
69
69
|
hasDropdown: true;
|
|
70
70
|
isNested?: boolean;
|
|
71
71
|
onItemClick?: () => void;
|
|
72
|
+
isOpen?: boolean;
|
|
73
|
+
onToggle?: (open: boolean) => void;
|
|
72
74
|
};
|
|
73
75
|
|
|
74
76
|
export type NavMenuLink = {
|
|
@@ -79,6 +81,8 @@ export type NavMenuLink = {
|
|
|
79
81
|
isNested?: boolean;
|
|
80
82
|
bold?: boolean;
|
|
81
83
|
onItemClick?: () => void;
|
|
84
|
+
isOpen?: boolean;
|
|
85
|
+
onToggle?: (open: boolean) => void;
|
|
82
86
|
};
|
|
83
87
|
|
|
84
88
|
export interface NavMenuProps {
|
|
@@ -10,6 +10,8 @@ export type NavMenuItemProps = {
|
|
|
10
10
|
hasDropdown: true;
|
|
11
11
|
isNested?: boolean;
|
|
12
12
|
onItemClick?: () => void;
|
|
13
|
+
isOpen?: boolean;
|
|
14
|
+
onToggle?: (open: boolean) => void;
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
export type NavMenuLink = {
|
|
@@ -20,6 +22,8 @@ export type NavMenuLink = {
|
|
|
20
22
|
isNested?: boolean;
|
|
21
23
|
bold?: boolean;
|
|
22
24
|
onItemClick?: () => void;
|
|
25
|
+
isOpen?: boolean;
|
|
26
|
+
onToggle?: (open: boolean) => void;
|
|
23
27
|
};
|
|
24
28
|
|
|
25
29
|
export declare interface NavMenuProps {
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
import "react";
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { useState as m } from "react";
|
|
4
|
+
import { NavMenuItem as n } from "./NavMenuItem.js";
|
|
5
|
+
const c = ({ navItems: l, className: o = "" }) => {
|
|
6
|
+
const [t, i] = m(null);
|
|
7
|
+
return /* @__PURE__ */ r("nav", { className: o, children: /* @__PURE__ */ r("ul", { className: "text-medium flex flex-wrap items-center gap-4 xl:gap-8", children: l.map((e) => /* @__PURE__ */ r(
|
|
8
|
+
n,
|
|
9
|
+
{
|
|
10
|
+
...e,
|
|
11
|
+
isOpen: t === e.id,
|
|
12
|
+
onToggle: (p) => {
|
|
13
|
+
i(p ? e.id : null);
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
e.id
|
|
17
|
+
)) }) });
|
|
18
|
+
};
|
|
5
19
|
export {
|
|
6
|
-
|
|
20
|
+
c as NavMenu
|
|
7
21
|
};
|
|
@@ -10,6 +10,8 @@ export declare type NavMenuItemProps = {
|
|
|
10
10
|
hasDropdown: true;
|
|
11
11
|
isNested?: boolean;
|
|
12
12
|
onItemClick?: () => void;
|
|
13
|
+
isOpen?: boolean;
|
|
14
|
+
onToggle?: (open: boolean) => void;
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
export declare type NavMenuLink = {
|
|
@@ -20,5 +22,7 @@ export declare type NavMenuLink = {
|
|
|
20
22
|
isNested?: boolean;
|
|
21
23
|
bold?: boolean;
|
|
22
24
|
onItemClick?: () => void;
|
|
25
|
+
isOpen?: boolean;
|
|
26
|
+
onToggle?: (open: boolean) => void;
|
|
23
27
|
};
|
|
24
28
|
|
|
@@ -1,68 +1,104 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { ChevronDownIcon as
|
|
5
|
-
import { ChevronRightIcon as
|
|
6
|
-
const
|
|
7
|
-
const { hasDropdown:
|
|
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(
|
|
8
|
+
(e) => {
|
|
9
|
+
e || u(null), i ? i(e) : C(e);
|
|
10
|
+
},
|
|
11
|
+
[i]
|
|
12
|
+
), r = T(null);
|
|
13
|
+
$(() => {
|
|
14
|
+
if (!s) return;
|
|
15
|
+
const e = (c) => {
|
|
16
|
+
r.current && !r.current.contains(c.target) && n(!1);
|
|
17
|
+
};
|
|
18
|
+
return document.addEventListener("mousedown", e), () => {
|
|
19
|
+
document.removeEventListener("mousedown", e);
|
|
20
|
+
};
|
|
21
|
+
}, [s, n]);
|
|
22
|
+
const m = {
|
|
8
23
|
topLevel: {
|
|
9
24
|
liClass: "relative py-2",
|
|
10
25
|
triggerClass: "hover:text-neutral-600",
|
|
11
26
|
dropdownPosition: "top-full left-0",
|
|
12
|
-
Icon:
|
|
27
|
+
Icon: j
|
|
13
28
|
},
|
|
14
29
|
nested: {
|
|
15
30
|
liClass: "relative",
|
|
16
31
|
triggerClass: "p-1 hover:bg-primary-100 w-full rounded min-w-48.5",
|
|
17
32
|
dropdownPosition: "top-0 left-full -mt-4 pl-6",
|
|
18
|
-
Icon:
|
|
33
|
+
Icon: P
|
|
19
34
|
}
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
globalThis.window.matchMedia("(hover: hover)").matches &&
|
|
26
|
-
},
|
|
27
|
-
globalThis.window.matchMedia("(hover: hover)").matches &&
|
|
35
|
+
}, o = w ? m.nested : m.topLevel, b = o.Icon, f = () => {
|
|
36
|
+
n(!1), l.onItemClick && l.onItemClick();
|
|
37
|
+
}, N = (e) => {
|
|
38
|
+
e.stopPropagation(), n(!s);
|
|
39
|
+
}, k = () => {
|
|
40
|
+
globalThis.window.matchMedia("(hover: hover)").matches && n(!0);
|
|
41
|
+
}, O = () => {
|
|
42
|
+
globalThis.window.matchMedia("(hover: hover)").matches && n(!1);
|
|
28
43
|
};
|
|
29
|
-
if (
|
|
30
|
-
const { dropdownItems:
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
if (g) {
|
|
45
|
+
const { dropdownItems: e, label: c } = l;
|
|
46
|
+
return /* @__PURE__ */ d(
|
|
47
|
+
"li",
|
|
48
|
+
{
|
|
49
|
+
ref: r,
|
|
50
|
+
className: o.liClass,
|
|
51
|
+
onMouseEnter: k,
|
|
52
|
+
onMouseLeave: O,
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ d(
|
|
55
|
+
"button",
|
|
56
|
+
{
|
|
57
|
+
className: `text-small flex w-full cursor-pointer items-center justify-between gap-1 font-medium text-nowrap text-neutral-800 transition-colors ${o.triggerClass}`,
|
|
58
|
+
"aria-haspopup": "menu",
|
|
59
|
+
"aria-expanded": s,
|
|
60
|
+
onClick: N,
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ t("span", { className: "text-medium", children: c }),
|
|
63
|
+
/* @__PURE__ */ t(b, { fill: "#000", width: 20, height: 20 })
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
/* @__PURE__ */ t(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
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
|
+
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
|
+
{
|
|
74
|
+
...a,
|
|
75
|
+
isNested: !0,
|
|
76
|
+
onItemClick: f,
|
|
77
|
+
isOpen: I === a.id,
|
|
78
|
+
onToggle: (M) => {
|
|
79
|
+
u(M ? a.id : null);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
a.id
|
|
83
|
+
)) }) })
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
);
|
|
53
89
|
}
|
|
54
|
-
const { link:
|
|
55
|
-
return /* @__PURE__ */
|
|
90
|
+
const { link: y, tag: h, bold: L } = l;
|
|
91
|
+
return /* @__PURE__ */ t("li", { className: o.liClass, onClick: f, children: /* @__PURE__ */ d(
|
|
56
92
|
"span",
|
|
57
93
|
{
|
|
58
|
-
className: `text-small relative flex w-full items-center gap-1 font-medium text-nowrap text-neutral-800 transition-colors ${
|
|
94
|
+
className: `text-small relative flex w-full items-center gap-1 font-medium text-nowrap text-neutral-800 transition-colors ${o.triggerClass} `,
|
|
59
95
|
children: [
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
|
|
96
|
+
/* @__PURE__ */ t("span", { className: `text-medium flex-1 ${L ? "font-bold" : ""} [&_a]:after:absolute [&_a]:after:inset-0`, children: y }),
|
|
97
|
+
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 })
|
|
62
98
|
]
|
|
63
99
|
}
|
|
64
100
|
) });
|
|
65
101
|
};
|
|
66
102
|
export {
|
|
67
|
-
|
|
103
|
+
R as NavMenuItem
|
|
68
104
|
};
|