@cfx-dev/ui-components 4.2.8 → 4.2.10
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.
- package/dist/components/BurgerMenu/BurgerMenu.d.ts +7 -8
- package/dist/components/BurgerMenu/BurgerMenu.js +51 -48
- package/dist/components/BurgerMenu/index.d.ts +1 -0
- package/dist/components/DropdownSelect/DropdownSelect.js +1040 -802
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Slider/Slider.js +374 -294
- package/dist/index-CjTSD6zB.js +161 -0
- package/dist/{index-Bz27DCHt.js → index-DBus3GoO.js} +2 -2
- package/dist/main.d.ts +4 -2
- package/package.json +1 -1
- package/dist/index-AweK2ufS.js +0 -171
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
|
|
3
|
-
interface
|
|
3
|
+
export interface BurgerMenuItem {
|
|
4
|
+
id: string;
|
|
4
5
|
label: string;
|
|
5
6
|
highlighted?: boolean;
|
|
6
|
-
|
|
7
|
-
className?: string;
|
|
8
|
-
submenu?: MenuItem[];
|
|
7
|
+
submenu?: BurgerMenuItem[];
|
|
9
8
|
}
|
|
10
|
-
interface BurgerMenuProps {
|
|
11
|
-
items:
|
|
9
|
+
export interface BurgerMenuProps {
|
|
10
|
+
items: BurgerMenuItem[];
|
|
12
11
|
onItemClick: (item: string) => void;
|
|
12
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
13
13
|
}
|
|
14
|
-
export declare function BurgerMenu(
|
|
15
|
-
export {};
|
|
14
|
+
export declare function BurgerMenu(props: BurgerMenuProps): React.ReactElement;
|
|
@@ -1,51 +1,54 @@
|
|
|
1
1
|
import { jsxs as a, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Icon as
|
|
4
|
-
import { Interactive as
|
|
5
|
-
import { Flex as
|
|
6
|
-
import { Text as
|
|
2
|
+
import k, { useState as h, useCallback as c } from "react";
|
|
3
|
+
import { Icon as y } from "../Icon/Icon.js";
|
|
4
|
+
import { Interactive as b } from "../Interactive/Interactive.js";
|
|
5
|
+
import { Flex as i } from "../Layout/Flex/Flex.js";
|
|
6
|
+
import { Text as L } from "../Text/Text.js";
|
|
7
7
|
import "../ui.js";
|
|
8
8
|
import { clsx as t } from "../../utils/clsx.js";
|
|
9
|
-
const
|
|
10
|
-
burgerButton:
|
|
11
|
-
burgerContainerOpen:
|
|
12
|
-
burgerLine:
|
|
13
|
-
burgerLineOpen:
|
|
14
|
-
subItemContainer:
|
|
15
|
-
subItemContainerOpen:
|
|
9
|
+
const B = "cfxui__BurgerMenu__burgerButton__cc9ab", I = "cfxui__BurgerMenu__burgerContainerOpen__ed7ab", w = "cfxui__BurgerMenu__burgerLine__886ad", M = "cfxui__BurgerMenu__burgerLineOpen__af602", N = "cfxui__BurgerMenu__subItemContainer__0d64a", T = "cfxui__BurgerMenu__subItemContainerOpen__5491d", r = {
|
|
10
|
+
burgerButton: B,
|
|
11
|
+
burgerContainerOpen: I,
|
|
12
|
+
burgerLine: w,
|
|
13
|
+
burgerLineOpen: M,
|
|
14
|
+
subItemContainer: N,
|
|
15
|
+
subItemContainerOpen: T
|
|
16
16
|
};
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
function F(C) {
|
|
18
|
+
const {
|
|
19
|
+
items: O,
|
|
20
|
+
onItemClick: g,
|
|
21
|
+
onOpenChange: l
|
|
22
|
+
} = C, [u, d] = h(!1), [m, x] = h({}), _ = c(() => {
|
|
23
|
+
d((e) => !e);
|
|
24
|
+
}, []), s = c((e) => {
|
|
25
|
+
g(e), d(!1);
|
|
26
|
+
}, [g]), p = c((e) => {
|
|
27
|
+
x((o) => ({
|
|
27
28
|
...o,
|
|
28
29
|
[e]: !o[e]
|
|
29
30
|
}));
|
|
30
31
|
}, []);
|
|
31
|
-
return
|
|
32
|
-
u
|
|
32
|
+
return k.useEffect(() => {
|
|
33
|
+
l && l(u);
|
|
34
|
+
}, [u, l]), /* @__PURE__ */ a(
|
|
35
|
+
i,
|
|
33
36
|
{
|
|
34
|
-
className: t({ [r.burgerContainerOpen]:
|
|
37
|
+
className: t({ [r.burgerContainerOpen]: u }),
|
|
35
38
|
direction: "column",
|
|
36
39
|
children: [
|
|
37
|
-
/* @__PURE__ */ n(
|
|
38
|
-
|
|
40
|
+
/* @__PURE__ */ n(i, { justifyContent: "flex-end", children: /* @__PURE__ */ n(
|
|
41
|
+
b,
|
|
39
42
|
{
|
|
40
43
|
showPointer: !0,
|
|
41
44
|
"aria-label": "Toggle menu",
|
|
42
45
|
role: "button",
|
|
43
|
-
onClick:
|
|
46
|
+
onClick: _,
|
|
44
47
|
onKeyDown: (e) => {
|
|
45
|
-
(e.key === "Enter" || e.key === " ") &&
|
|
48
|
+
(e.key === "Enter" || e.key === " ") && _();
|
|
46
49
|
},
|
|
47
50
|
children: /* @__PURE__ */ a(
|
|
48
|
-
|
|
51
|
+
i,
|
|
49
52
|
{
|
|
50
53
|
justifyContent: "space-around",
|
|
51
54
|
direction: "column",
|
|
@@ -54,19 +57,19 @@ function K({
|
|
|
54
57
|
/* @__PURE__ */ n(
|
|
55
58
|
"span",
|
|
56
59
|
{
|
|
57
|
-
className: t(
|
|
60
|
+
className: t(u ? r.burgerLineOpen : r.burgerLine)
|
|
58
61
|
}
|
|
59
62
|
),
|
|
60
63
|
/* @__PURE__ */ n(
|
|
61
64
|
"span",
|
|
62
65
|
{
|
|
63
|
-
className: t(
|
|
66
|
+
className: t(u ? r.burgerLineOpen : r.burgerLine)
|
|
64
67
|
}
|
|
65
68
|
),
|
|
66
69
|
/* @__PURE__ */ n(
|
|
67
70
|
"span",
|
|
68
71
|
{
|
|
69
|
-
className: t(
|
|
72
|
+
className: t(u ? r.burgerLineOpen : r.burgerLine)
|
|
70
73
|
}
|
|
71
74
|
)
|
|
72
75
|
]
|
|
@@ -74,22 +77,22 @@ function K({
|
|
|
74
77
|
)
|
|
75
78
|
}
|
|
76
79
|
) }),
|
|
77
|
-
|
|
80
|
+
u && /* @__PURE__ */ n(i, { direction: "column", className: r.menu, children: O.map((e) => /* @__PURE__ */ a("div", { children: [
|
|
78
81
|
/* @__PURE__ */ n(
|
|
79
|
-
|
|
82
|
+
b,
|
|
80
83
|
{
|
|
81
84
|
showPointer: !0,
|
|
82
85
|
"aria-label": "Toggle item",
|
|
83
86
|
role: "button",
|
|
84
87
|
onClick: () => {
|
|
85
|
-
e.submenu ?
|
|
88
|
+
e.submenu ? p(e.id) : s(e.id);
|
|
86
89
|
},
|
|
87
90
|
onKeyDown: (o) => {
|
|
88
|
-
(o.key === "Enter" || o.key === " ") && (e.submenu ?
|
|
91
|
+
(o.key === "Enter" || o.key === " ") && (e.submenu ? p(e.id) : s(e.id));
|
|
89
92
|
},
|
|
90
|
-
children: /* @__PURE__ */ a(
|
|
93
|
+
children: /* @__PURE__ */ a(i, { p: 2, justifyContent: "space-between", children: [
|
|
91
94
|
/* @__PURE__ */ n(
|
|
92
|
-
|
|
95
|
+
L,
|
|
93
96
|
{
|
|
94
97
|
size: "xsmall",
|
|
95
98
|
weight: e.highlighted ? "bold" : "normal",
|
|
@@ -97,32 +100,32 @@ function K({
|
|
|
97
100
|
}
|
|
98
101
|
),
|
|
99
102
|
e.submenu && /* @__PURE__ */ n(
|
|
100
|
-
|
|
103
|
+
y,
|
|
101
104
|
{
|
|
102
|
-
name:
|
|
105
|
+
name: m[e.id] ? "UpChevron" : "DownChevron"
|
|
103
106
|
}
|
|
104
107
|
)
|
|
105
108
|
] })
|
|
106
109
|
}
|
|
107
110
|
),
|
|
108
111
|
e.submenu && /* @__PURE__ */ n(
|
|
109
|
-
|
|
112
|
+
i,
|
|
110
113
|
{
|
|
111
114
|
className: t(r.subItemContainer, {
|
|
112
|
-
[r.subItemContainerOpen]:
|
|
115
|
+
[r.subItemContainerOpen]: m[e.id]
|
|
113
116
|
}),
|
|
114
117
|
direction: "column",
|
|
115
118
|
children: e.submenu.map((o) => /* @__PURE__ */ n(
|
|
116
|
-
|
|
119
|
+
b,
|
|
117
120
|
{
|
|
118
121
|
showPointer: !0,
|
|
119
122
|
"aria-label": "Toggle sub item",
|
|
120
123
|
role: "button",
|
|
121
124
|
onClick: () => s(o.id),
|
|
122
|
-
onKeyDown: (
|
|
123
|
-
(
|
|
125
|
+
onKeyDown: (f) => {
|
|
126
|
+
(f.key === "Enter" || f.key === " ") && s(o.id);
|
|
124
127
|
},
|
|
125
|
-
children: /* @__PURE__ */ n(
|
|
128
|
+
children: /* @__PURE__ */ n(i, { p: 2, children: o.label })
|
|
126
129
|
},
|
|
127
130
|
o.id
|
|
128
131
|
))
|
|
@@ -134,5 +137,5 @@ function K({
|
|
|
134
137
|
);
|
|
135
138
|
}
|
|
136
139
|
export {
|
|
137
|
-
|
|
140
|
+
F as BurgerMenu
|
|
138
141
|
};
|