@bioturing/components 0.28.1 → 0.29.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.
- package/dist/components/breadcrumb/style.css +1 -1
- package/dist/components/checkbox/style.css +1 -1
- package/dist/components/choice-list/component.js +137 -50
- package/dist/components/choice-list/component.js.map +1 -1
- package/dist/components/choice-list/style.css +1 -1
- package/dist/components/code-block/component.js +8 -8
- package/dist/components/color-select/style.css +1 -1
- package/dist/components/combobox/component.js +171 -141
- package/dist/components/combobox/component.js.map +1 -1
- package/dist/components/combobox/style.css +1 -1
- package/dist/components/drag-drop/style.css +1 -1
- package/dist/components/dropdown-menu/component.js +110 -100
- package/dist/components/dropdown-menu/component.js.map +1 -1
- package/dist/components/dropdown-menu/item.css +1 -1
- package/dist/components/dropdown-menu/item.js +52 -49
- package/dist/components/dropdown-menu/item.js.map +1 -1
- package/dist/components/dropdown-menu/style.css +1 -1
- package/dist/components/ds-root/component.js +22 -17
- package/dist/components/ds-root/component.js.map +1 -1
- package/dist/components/ds-root/style.css +1 -1
- package/dist/components/form/style.css +1 -1
- package/dist/components/modal/style.css +1 -1
- package/dist/components/nav/style.css +1 -1
- package/dist/components/resizable/component.js +27 -26
- package/dist/components/resizable/component.js.map +1 -1
- package/dist/components/scroll-area/component.js +70 -24
- package/dist/components/scroll-area/component.js.map +1 -1
- package/dist/components/scroll-area/style.css +1 -1
- package/dist/components/select-trigger/component.js +150 -0
- package/dist/components/select-trigger/component.js.map +1 -0
- package/dist/components/select-trigger/style.css +1 -0
- package/dist/components/switch/style.css +1 -1
- package/dist/components/table/style.css +1 -1
- package/dist/components/theme-provider/component.js.map +1 -1
- package/dist/components/theme-provider/style.css +1 -1
- package/dist/components/toast/component.js +13 -13
- package/dist/components/toast/component.js.map +1 -1
- package/dist/components/tour/style.css +1 -1
- package/dist/components/utils/WithRenderProp.js.map +1 -1
- package/dist/index.d.ts +101 -42
- package/dist/index.js +125 -125
- package/dist/tokens/and-theme/tokens.js +12 -12
- package/dist/tokens/and-theme/tokens.js.map +1 -1
- package/package.json +6 -6
- package/dist/components/combobox/trigger.js +0 -89
- package/dist/components/combobox/trigger.js.map +0 -1
|
@@ -1,218 +1,228 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as e, jsxs as b } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback as w, useRef as X, createElement as Y } from "react";
|
|
4
|
-
import { Menu as
|
|
4
|
+
import { Menu as P } from "@base-ui-components/react/menu";
|
|
5
5
|
import { useControlled as Z } from "@base-ui-components/utils/useControlled";
|
|
6
6
|
import { Popover as $ } from "@base-ui-components/react/popover";
|
|
7
7
|
import { Command as g } from "../cmdk/index.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { FormItemInputContext as O } from "antd/es/form/context";
|
|
9
|
+
import { PopupPanelSize as S } from "../popup-panel/constants.js";
|
|
10
|
+
import { DropdownMenuItem as K } from "./item.js";
|
|
10
11
|
import './style.css';/* empty css */
|
|
11
|
-
import { DropdownMenuDivider as
|
|
12
|
-
import { parseAntdPlacement as
|
|
13
|
-
import { Input as
|
|
14
|
-
import { ScrollArea as
|
|
15
|
-
import { DROPDOWN_COLLISION_AVOIDANCE as
|
|
16
|
-
import { useCls as
|
|
12
|
+
import { DropdownMenuDivider as a } from "./divider.js";
|
|
13
|
+
import { parseAntdPlacement as N } from "../utils/placement.js";
|
|
14
|
+
import { Input as s } from "../input/component.js";
|
|
15
|
+
import { ScrollArea as _ } from "../scroll-area/component.js";
|
|
16
|
+
import { DROPDOWN_COLLISION_AVOIDANCE as oo } from "../utils/constants.js";
|
|
17
|
+
import { useCls as ro, useAntdCssVarClassname as no } from "../utils/antdUtils.js";
|
|
17
18
|
import { clsx as u } from "../utils/cn.js";
|
|
18
|
-
const
|
|
19
|
-
children:
|
|
20
|
-
items:
|
|
21
|
-
placement:
|
|
22
|
-
openOnHover:
|
|
23
|
-
open:
|
|
19
|
+
const Mo = ({
|
|
20
|
+
children: j,
|
|
21
|
+
items: z,
|
|
22
|
+
placement: B,
|
|
23
|
+
openOnHover: F,
|
|
24
|
+
open: T,
|
|
24
25
|
onOpenChange: v,
|
|
25
|
-
className:
|
|
26
|
-
itemRender:
|
|
26
|
+
className: U,
|
|
27
|
+
itemRender: E,
|
|
27
28
|
classNames: o,
|
|
28
|
-
size:
|
|
29
|
-
showSearch:
|
|
30
|
-
searchProps:
|
|
29
|
+
size: k = "auto",
|
|
30
|
+
showSearch: t,
|
|
31
|
+
searchProps: y = {
|
|
31
32
|
placeholder: "Search..."
|
|
32
33
|
},
|
|
33
|
-
popupMatchTriggerWidth:
|
|
34
|
+
popupMatchTriggerWidth: W,
|
|
34
35
|
beforeList: C,
|
|
35
36
|
afterList: D,
|
|
36
|
-
keepOpenOnSelect:
|
|
37
|
+
keepOpenOnSelect: I,
|
|
37
38
|
highlightedItemKey: G,
|
|
38
|
-
selectedItemKeys:
|
|
39
|
-
showCheckbox: M
|
|
39
|
+
selectedItemKeys: h,
|
|
40
|
+
showCheckbox: M,
|
|
41
|
+
getItemKeywords: q
|
|
40
42
|
}) => {
|
|
41
|
-
const [H,
|
|
42
|
-
controlled:
|
|
43
|
+
const [H, x] = Z({
|
|
44
|
+
controlled: T,
|
|
43
45
|
default: !1,
|
|
44
46
|
name: "open"
|
|
45
47
|
}), l = w(
|
|
46
48
|
(r) => {
|
|
47
|
-
|
|
49
|
+
x(r), v == null || v(r);
|
|
48
50
|
},
|
|
49
|
-
[
|
|
50
|
-
),
|
|
51
|
+
[x, v]
|
|
52
|
+
), d = ro(), L = no(), R = N(B), J = X(null), A = z.reduce((r, n) => (r.length === 0 && n.type !== "header" && r.push({
|
|
51
53
|
label: null,
|
|
52
54
|
items: []
|
|
53
55
|
}), n.type === "header" ? r.push({
|
|
54
56
|
label: n.title,
|
|
55
57
|
items: []
|
|
56
58
|
}) : (n.type === "item" || n.type === "divider") && r.length > 0 && r[r.length - 1].items.push(n), r), []), m = w(
|
|
57
|
-
(r, n,
|
|
58
|
-
|
|
59
|
+
(r, n, p) => r.type === "item" ? /* @__PURE__ */ e(
|
|
60
|
+
K,
|
|
59
61
|
{
|
|
60
62
|
item: r,
|
|
61
|
-
inCombobox:
|
|
62
|
-
selected:
|
|
63
|
-
onSelect:
|
|
63
|
+
inCombobox: t,
|
|
64
|
+
selected: h == null ? void 0 : h.includes(r.key),
|
|
65
|
+
onSelect: t ? () => {
|
|
64
66
|
const i = new MouseEvent("click", {
|
|
65
67
|
bubbles: !0,
|
|
66
68
|
cancelable: !0
|
|
67
69
|
});
|
|
68
|
-
r.onClick(i),
|
|
70
|
+
r.onClick(i), I || l == null || l(!1);
|
|
69
71
|
} : void 0,
|
|
70
|
-
itemRender:
|
|
71
|
-
showCheckbox: M
|
|
72
|
+
itemRender: E,
|
|
73
|
+
showCheckbox: M,
|
|
74
|
+
getItemKeywords: q
|
|
72
75
|
},
|
|
73
|
-
n + "-" +
|
|
74
|
-
) : r.type === "divider" ? /* @__PURE__ */
|
|
75
|
-
|
|
76
|
+
n + "-" + p
|
|
77
|
+
) : r.type === "divider" ? /* @__PURE__ */ e(
|
|
78
|
+
a,
|
|
76
79
|
{
|
|
77
|
-
inCombobox:
|
|
80
|
+
inCombobox: t,
|
|
78
81
|
className: o == null ? void 0 : o.separator
|
|
79
82
|
},
|
|
80
|
-
n + "-" +
|
|
83
|
+
n + "-" + p
|
|
81
84
|
) : null,
|
|
82
85
|
[
|
|
83
86
|
o,
|
|
84
|
-
|
|
87
|
+
E,
|
|
85
88
|
l,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
t,
|
|
90
|
+
I,
|
|
91
|
+
h,
|
|
89
92
|
M
|
|
90
93
|
]
|
|
91
|
-
),
|
|
94
|
+
), V = w(
|
|
92
95
|
(r, n) => /* @__PURE__ */ b(
|
|
93
|
-
|
|
96
|
+
P.Group,
|
|
94
97
|
{
|
|
95
|
-
className: u(
|
|
98
|
+
className: u(d("dropdown-menu-group"), o == null ? void 0 : o.group),
|
|
96
99
|
children: [
|
|
97
|
-
r.label && /* @__PURE__ */
|
|
98
|
-
|
|
100
|
+
r.label && /* @__PURE__ */ e(
|
|
101
|
+
P.GroupLabel,
|
|
99
102
|
{
|
|
100
103
|
className: u(
|
|
101
|
-
|
|
104
|
+
d("dropdown-menu-header"),
|
|
102
105
|
o == null ? void 0 : o.groupLabel
|
|
103
106
|
),
|
|
104
|
-
children: /* @__PURE__ */
|
|
107
|
+
children: /* @__PURE__ */ e("span", { children: r.label })
|
|
105
108
|
}
|
|
106
109
|
),
|
|
107
|
-
r.items.map((
|
|
110
|
+
r.items.map((p, i) => m(p, n, i))
|
|
108
111
|
]
|
|
109
112
|
},
|
|
110
113
|
"group" + n
|
|
111
114
|
),
|
|
112
|
-
[
|
|
113
|
-
),
|
|
114
|
-
(r, n) => r.label ? /* @__PURE__ */
|
|
115
|
+
[d, o, m]
|
|
116
|
+
), c = w(
|
|
117
|
+
(r, n) => r.label ? /* @__PURE__ */ e(
|
|
115
118
|
g.Group,
|
|
116
119
|
{
|
|
117
|
-
className: u(
|
|
118
|
-
heading: /* @__PURE__ */
|
|
119
|
-
|
|
120
|
+
className: u(d("dropdown-menu-group"), o == null ? void 0 : o.group),
|
|
121
|
+
heading: /* @__PURE__ */ e(
|
|
122
|
+
P.GroupLabel,
|
|
120
123
|
{
|
|
121
124
|
className: u(
|
|
122
|
-
|
|
125
|
+
d("dropdown-menu-header"),
|
|
123
126
|
o == null ? void 0 : o.groupLabel
|
|
124
127
|
),
|
|
125
|
-
children: /* @__PURE__ */
|
|
128
|
+
children: /* @__PURE__ */ e("span", { children: r.label })
|
|
126
129
|
}
|
|
127
130
|
),
|
|
128
|
-
children: r.items.map((
|
|
131
|
+
children: r.items.map((p, i) => m(p, n, i))
|
|
129
132
|
},
|
|
130
133
|
"group" + n
|
|
131
|
-
) : r.items.map((
|
|
132
|
-
[
|
|
134
|
+
) : r.items.map((p, i) => m(p, n, i)),
|
|
135
|
+
[d, o, m]
|
|
133
136
|
), Q = w(
|
|
134
|
-
() =>
|
|
137
|
+
() => t ? /* @__PURE__ */ b(
|
|
135
138
|
g,
|
|
136
139
|
{
|
|
137
|
-
className:
|
|
138
|
-
disablePointerSelection:
|
|
140
|
+
className: d("dropdown-menu-container"),
|
|
141
|
+
disablePointerSelection: t,
|
|
139
142
|
defaultValue: G ? String(G) : void 0,
|
|
140
143
|
children: [
|
|
141
|
-
/* @__PURE__ */ Y(
|
|
144
|
+
/* @__PURE__ */ e(O.Provider, { value: {}, children: /* @__PURE__ */ Y(
|
|
142
145
|
g.Input,
|
|
143
146
|
{
|
|
144
|
-
...
|
|
147
|
+
...y,
|
|
145
148
|
key: "search",
|
|
146
|
-
render: /* @__PURE__ */
|
|
149
|
+
render: /* @__PURE__ */ e(
|
|
150
|
+
s,
|
|
151
|
+
{
|
|
152
|
+
allowClear: !0,
|
|
153
|
+
className: d("dropdown-menu-search"),
|
|
154
|
+
placeholder: "Search"
|
|
155
|
+
}
|
|
156
|
+
)
|
|
147
157
|
}
|
|
148
|
-
),
|
|
158
|
+
) }),
|
|
149
159
|
C,
|
|
150
|
-
/* @__PURE__ */
|
|
151
|
-
/* @__PURE__ */
|
|
152
|
-
A.map(
|
|
160
|
+
/* @__PURE__ */ e(_, { fadeEdges: !0, children: /* @__PURE__ */ b(g.List, { className: d("dropdown-menu-list"), children: [
|
|
161
|
+
/* @__PURE__ */ e(g.Empty, { className: d("dropdown-menu-empty"), children: "No results found." }),
|
|
162
|
+
A.map(c)
|
|
153
163
|
] }) }),
|
|
154
164
|
D
|
|
155
165
|
]
|
|
156
166
|
}
|
|
157
|
-
) : /* @__PURE__ */ b("div", { className:
|
|
167
|
+
) : /* @__PURE__ */ b("div", { className: d("dropdown-menu-container"), children: [
|
|
158
168
|
C,
|
|
159
|
-
/* @__PURE__ */
|
|
169
|
+
/* @__PURE__ */ e(_, { fadeEdges: !0, children: A.map(V) }),
|
|
160
170
|
D
|
|
161
171
|
] }),
|
|
162
172
|
[
|
|
173
|
+
t,
|
|
163
174
|
d,
|
|
164
|
-
e,
|
|
165
175
|
G,
|
|
166
|
-
|
|
176
|
+
y,
|
|
167
177
|
C,
|
|
168
178
|
A,
|
|
169
|
-
|
|
179
|
+
c,
|
|
170
180
|
D,
|
|
171
|
-
|
|
181
|
+
V
|
|
172
182
|
]
|
|
173
|
-
), f =
|
|
183
|
+
), f = t ? $ : P;
|
|
174
184
|
return /* @__PURE__ */ b(
|
|
175
185
|
f.Root,
|
|
176
186
|
{
|
|
177
|
-
openOnHover:
|
|
187
|
+
openOnHover: F,
|
|
178
188
|
open: H,
|
|
179
189
|
onOpenChange: l,
|
|
180
190
|
children: [
|
|
181
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ e(
|
|
182
192
|
f.Trigger,
|
|
183
193
|
{
|
|
184
|
-
render:
|
|
194
|
+
render: j,
|
|
185
195
|
ref: J,
|
|
186
196
|
className: u(
|
|
187
|
-
|
|
197
|
+
d("dropdown-menu-trigger"),
|
|
188
198
|
o == null ? void 0 : o.trigger,
|
|
189
|
-
|
|
199
|
+
L
|
|
190
200
|
)
|
|
191
201
|
}
|
|
192
202
|
),
|
|
193
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ e(f.Portal, { children: /* @__PURE__ */ e(
|
|
194
204
|
f.Positioner,
|
|
195
205
|
{
|
|
196
|
-
side:
|
|
197
|
-
align:
|
|
206
|
+
side: R.side,
|
|
207
|
+
align: R.align,
|
|
198
208
|
sideOffset: 4,
|
|
199
|
-
className: u(
|
|
200
|
-
collisionAvoidance:
|
|
201
|
-
children: /* @__PURE__ */
|
|
209
|
+
className: u(d("dropdown-menu-root"), o == null ? void 0 : o.root),
|
|
210
|
+
collisionAvoidance: oo,
|
|
211
|
+
children: /* @__PURE__ */ e(
|
|
202
212
|
f.Popup,
|
|
203
213
|
{
|
|
204
214
|
className: u(
|
|
205
|
-
|
|
215
|
+
d(
|
|
206
216
|
"dropdown-menu",
|
|
207
217
|
M && "dropdown-menu-show-checkbox",
|
|
208
|
-
|
|
218
|
+
W && "dropdown-menu-match-trigger-width"
|
|
209
219
|
),
|
|
210
|
-
|
|
220
|
+
U,
|
|
211
221
|
o == null ? void 0 : o.popup,
|
|
212
|
-
|
|
222
|
+
L
|
|
213
223
|
),
|
|
214
224
|
style: {
|
|
215
|
-
"--size-width":
|
|
225
|
+
"--size-width": k in S ? S[k] : void 0
|
|
216
226
|
},
|
|
217
227
|
children: Q()
|
|
218
228
|
}
|
|
@@ -224,6 +234,6 @@ const Co = ({
|
|
|
224
234
|
);
|
|
225
235
|
};
|
|
226
236
|
export {
|
|
227
|
-
|
|
237
|
+
Mo as DropdownMenu
|
|
228
238
|
};
|
|
229
239
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/dropdown-menu/component.tsx"],"sourcesContent":["\"use client\";\nimport { Menu } from \"@base-ui-components/react/menu\";\nimport { useControlled } from \"@base-ui-components/utils/useControlled\";\nimport { Popover } from \"@base-ui-components/react/popover\";\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { useCallback, useRef } from \"react\";\nimport {\n clsx,\n DROPDOWN_COLLISION_AVOIDANCE,\n parseAntdPlacement,\n useAntdCssVarClassname,\n useCls,\n} from \"../utils\";\nimport { Command } from \"../cmdk\";\nimport { ScrollArea } from \"../scroll-area\";\n\n// Import component-specific styles\nimport { Input } from \"../input\";\nimport { PopupPanelSize } from \"../popup-panel/constants\";\nimport { DropdownMenuItem } from \"./item\";\n\nimport \"./style.css\";\nimport { DropdownMenuDivider } from \"./divider\";\n\nexport type DropdownMenuItemType =\n | {\n /**\n * The type of the menu item\n */\n type: \"item\";\n /**\n * The label of the menu item\n */\n label?: React.ReactNode;\n /**\n * Whether the menu item is disabled\n */\n disabled?: boolean;\n /**\n * The icon of the menu item\n */\n icon?: React.ReactNode;\n /**\n * The key of the menu item\n */\n key: React.Key;\n /**\n * The onClick event handler of the menu item\n */\n onClick?: React.HTMLAttributes<HTMLElement>[\"onClick\"];\n /**\n * The onMouseEnter event handler of the menu item\n */\n onMouseEnter?: React.HTMLAttributes<HTMLElement>[\"onMouseEnter\"];\n /**\n * The onMouseLeave event handler of the menu item\n */\n onMouseLeave?: React.HTMLAttributes<HTMLElement>[\"onMouseLeave\"];\n /**\n * The onMouseOver event handler of the menu item\n */\n onMouseOver?: React.HTMLAttributes<HTMLElement>[\"onMouseOver\"];\n /**\n * The onMouseOut event handler of the menu item\n */\n onMouseOut?: React.HTMLAttributes<HTMLElement>[\"onMouseOut\"];\n /**\n * The className of the menu item\n */\n className?: string;\n /**\n * Whether the menu item is a danger item\n */\n danger?: boolean;\n /**\n * The ref of the menu item\n */\n ref?: React.Ref<HTMLElement>;\n }\n | {\n /**\n * The type of the menu item\n */\n type: \"divider\";\n }\n | {\n /**\n * The type of the menu item\n */\n type: \"header\";\n /**\n * The title of the menu item\n */\n title?: React.ReactNode;\n /**\n * The className of the menu item\n */\n className?: string;\n };\n\nexport interface DropdownMenuProps {\n /** Array of menu items to be displayed in the dropdown */\n items: DropdownMenuItemType[];\n /** Custom render function for the trigger element */\n children?: React.ComponentProps<typeof Menu.Trigger>[\"render\"];\n /**\n * Placement of the dropdown relative to the trigger element\n * @default \"bottomLeft\"\n */\n placement?: PopoverProps[\"placement\"];\n /**\n * Whether to open the dropdown on hover instead of click\n * @default false\n */\n openOnHover?: boolean;\n /**\n * Controlled open state of the dropdown\n */\n open?: boolean;\n /**\n * Callback fired when the dropdown open state changes\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Additional CSS class for the dropdown component\n */\n className?: string;\n /**\n * Custom class names for different parts of the dropdown\n * @default {}\n */\n classNames?: {\n root?: string;\n trigger?: string;\n popup?: string;\n group?: string;\n groupLabel?: string;\n item?: string;\n itemIcon?: string;\n itemText?: string;\n separator?: string;\n positioner?: string;\n };\n /**\n * Custom render function for menu items\n */\n itemRender?: (\n item: DropdownMenuItemType,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /**\n * Whether to show search input\n * @default false\n */\n showSearch?: boolean;\n /**\n * Size of the dropdown menu\n * @default \"auto\"\n */\n size?: \"auto\" | keyof typeof PopupPanelSize;\n /**\n * Search placeholder\n */\n searchProps?: Omit<\n React.ComponentProps<typeof Command.Input>,\n \"size\" | \"ref\"\n >;\n /**\n * Whether to match the width of the popup with the trigger\n * @default false\n */\n popupMatchTriggerWidth?: boolean;\n\n /**\n * Content to display before the list\n */\n beforeList?: React.ReactNode;\n /**\n * Content to display after the list\n */\n afterList?: React.ReactNode;\n /**\n * Whether to keep the dropdown open when an item is selected\n * @default false\n */\n keepOpenOnSelect?: boolean;\n /**\n * Control the highlighted state of the menu item\n */\n highlightedItemKey?: React.Key;\n /**\n * Control the selected state of the menu item\n */\n selectedItemKeys?: React.Key[];\n /**\n * Whether to show checkbox\n * @default false\n */\n showCheckbox?: boolean;\n}\n\ninterface DropdownMenuGroup {\n label: React.ReactNode | null;\n items: DropdownMenuItemType[];\n}\n\nexport const DropdownMenu = ({\n children,\n items,\n placement,\n openOnHover,\n open: outsideOpen,\n onOpenChange: outsideOnOpenChange,\n className,\n itemRender,\n classNames,\n size = \"auto\",\n showSearch,\n searchProps = {\n placeholder: \"Search...\",\n },\n popupMatchTriggerWidth,\n beforeList,\n afterList,\n keepOpenOnSelect,\n highlightedItemKey,\n selectedItemKeys,\n showCheckbox,\n}: DropdownMenuProps) => {\n const [open, setOpen] = useControlled({\n controlled: outsideOpen,\n default: false,\n name: \"open\",\n });\n const onOpenChange = useCallback(\n (newValue: boolean) => {\n setOpen(newValue);\n outsideOnOpenChange?.(newValue);\n },\n [setOpen, outsideOnOpenChange]\n );\n const cls = useCls();\n const antdCssVarClassname = useAntdCssVarClassname();\n const baseUIPlacement = parseAntdPlacement(placement);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const itemGroups = items.reduce<DropdownMenuGroup[]>((acc, current) => {\n // If no groups exist yet and current item is not a header, create default group\n if (acc.length === 0 && current.type !== \"header\") {\n acc.push({\n label: null,\n items: [],\n });\n }\n\n // If it's a header, create a new group\n if (current.type === \"header\") {\n acc.push({\n label: current.title,\n items: [],\n });\n }\n // If it's an item and we have at least one group, add it to the last group's items\n else if (\n (current.type === \"item\" || current.type === \"divider\") &&\n acc.length > 0\n ) {\n acc[acc.length - 1].items.push(current);\n }\n // Skip dividers\n return acc;\n }, []);\n\n const renderMenuItem = useCallback(\n (item: DropdownMenuItemType, i: number, j: number) => {\n if (item.type === \"item\") {\n return (\n <DropdownMenuItem\n key={i + \"-\" + j}\n item={item}\n inCombobox={showSearch}\n selected={selectedItemKeys?.includes(item.key)}\n onSelect={\n showSearch\n ? () => {\n const e = new MouseEvent(\"click\", {\n bubbles: true,\n cancelable: true,\n }) as unknown as React.MouseEvent<HTMLElement, MouseEvent>;\n item.onClick(e);\n if (!keepOpenOnSelect) onOpenChange?.(false);\n }\n : undefined\n }\n itemRender={itemRender}\n showCheckbox={showCheckbox}\n />\n );\n } else if (item.type === \"divider\") {\n return (\n <DropdownMenuDivider\n key={i + \"-\" + j}\n inCombobox={showSearch}\n className={classNames?.separator}\n />\n );\n }\n return null;\n },\n [\n classNames,\n itemRender,\n onOpenChange,\n showSearch,\n keepOpenOnSelect,\n selectedItemKeys,\n showCheckbox,\n ]\n );\n\n const renderGroup = useCallback(\n (group: DropdownMenuGroup, index: number) => (\n <Menu.Group\n key={\"group\" + index}\n className={clsx(cls(\"dropdown-menu-group\"), classNames?.group)}\n >\n {group.label && (\n <Menu.GroupLabel\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{group.label}</span>\n </Menu.GroupLabel>\n )}\n {group.items.map((item, j) => renderMenuItem(item, index, j))}\n </Menu.Group>\n ),\n [cls, classNames, renderMenuItem]\n );\n\n const renderGroupShowSearch = useCallback(\n (group: DropdownMenuGroup, index: number) =>\n group.label ? (\n <Command.Group\n key={\"group\" + index}\n className={clsx(cls(\"dropdown-menu-group\"), classNames?.group)}\n heading={\n <Menu.GroupLabel\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{group.label}</span>\n </Menu.GroupLabel>\n }\n >\n {group.items.map((item, j) => renderMenuItem(item, index, j))}\n </Command.Group>\n ) : (\n group.items.map((item, j) => renderMenuItem(item, index, j))\n ),\n [cls, classNames, renderMenuItem]\n );\n\n const renderMenuInner = useCallback(\n () =>\n showSearch ? (\n <Command\n className={cls(\"dropdown-menu-container\")}\n disablePointerSelection={showSearch}\n defaultValue={\n highlightedItemKey ? String(highlightedItemKey) : undefined\n }\n >\n <Command.Input\n {...searchProps}\n key=\"search\"\n render={\n <Input allowClear className={cls(\"dropdown-menu-search\")} />\n }\n />\n {beforeList}\n <ScrollArea>\n <Command.List className={cls(\"dropdown-menu-list\")}>\n <Command.Empty className={cls(\"dropdown-menu-empty\")}>\n No results found.\n </Command.Empty>\n {itemGroups.map(renderGroupShowSearch)}\n </Command.List>\n </ScrollArea>\n {afterList}\n </Command>\n ) : (\n <div className={cls(\"dropdown-menu-container\")}>\n {beforeList}\n <ScrollArea>{itemGroups.map(renderGroup)}</ScrollArea>\n {afterList}\n </div>\n ),\n [\n showSearch,\n cls,\n highlightedItemKey,\n searchProps,\n beforeList,\n itemGroups,\n renderGroupShowSearch,\n afterList,\n renderGroup,\n ]\n );\n\n const BaseComponent = showSearch ? Popover : Menu;\n\n return (\n <BaseComponent.Root\n openOnHover={openOnHover}\n open={open}\n onOpenChange={onOpenChange}\n >\n <BaseComponent.Trigger\n render={children}\n ref={buttonRef}\n className={clsx(\n cls(\"dropdown-menu-trigger\"),\n classNames?.trigger,\n antdCssVarClassname\n )}\n />\n <BaseComponent.Portal>\n <BaseComponent.Positioner\n side={baseUIPlacement.side}\n align={baseUIPlacement.align}\n sideOffset={4}\n className={clsx(cls(\"dropdown-menu-root\"), classNames?.root)}\n collisionAvoidance={DROPDOWN_COLLISION_AVOIDANCE}\n >\n <BaseComponent.Popup\n className={clsx(\n cls(\n \"dropdown-menu\",\n showCheckbox && \"dropdown-menu-show-checkbox\",\n popupMatchTriggerWidth && \"dropdown-menu-match-trigger-width\"\n ),\n className,\n classNames?.popup,\n antdCssVarClassname\n )}\n style={\n {\n \"--size-width\":\n size in PopupPanelSize ? PopupPanelSize[size] : undefined,\n } as React.CSSProperties\n }\n >\n {renderMenuInner()}\n </BaseComponent.Popup>\n </BaseComponent.Positioner>\n </BaseComponent.Portal>\n </BaseComponent.Root>\n );\n};\n"],"names":["DropdownMenu","children","items","placement","openOnHover","outsideOpen","outsideOnOpenChange","className","itemRender","classNames","size","showSearch","searchProps","popupMatchTriggerWidth","beforeList","afterList","keepOpenOnSelect","highlightedItemKey","selectedItemKeys","showCheckbox","open","setOpen","useControlled","onOpenChange","useCallback","newValue","cls","useCls","antdCssVarClassname","useAntdCssVarClassname","baseUIPlacement","parseAntdPlacement","buttonRef","useRef","itemGroups","acc","current","renderMenuItem","item","i","j","jsx","DropdownMenuItem","e","DropdownMenuDivider","renderGroup","group","index","jsxs","Menu","clsx","renderGroupShowSearch","Command","renderMenuInner","createElement","Input","ScrollArea","BaseComponent","Popover","DROPDOWN_COLLISION_AVOIDANCE","PopupPanelSize"],"mappings":";;;;;;;;;;;;;;;;;AA8MO,MAAMA,KAAe,CAAC;AAAA,EAC3B,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAMC;AAAA,EACN,cAAcC;AAAA,EACd,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,YAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,IACZ,aAAa;AAAA,EACf;AAAA,EACA,wBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,cAAAC;AACF,MAAyB;AAC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BACpD;AAAA,gBAGD,UAAgB2C,EAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACnB;AAAA,QAAA,EAEJ,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/dropdown-menu/component.tsx"],"sourcesContent":["\"use client\";\nimport { Menu } from \"@base-ui-components/react/menu\";\nimport { useControlled } from \"@base-ui-components/utils/useControlled\";\nimport { Popover } from \"@base-ui-components/react/popover\";\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { useCallback, useRef } from \"react\";\nimport {\n clsx,\n DROPDOWN_COLLISION_AVOIDANCE,\n parseAntdPlacement,\n useAntdCssVarClassname,\n useCls,\n} from \"../utils\";\nimport { Command } from \"../cmdk\";\nimport { ScrollArea } from \"../scroll-area\";\nimport { FormItemInputContext } from \"antd/es/form/context\";\n\n// Import component-specific styles\nimport { Input } from \"../input\";\nimport { PopupPanelSize } from \"../popup-panel/constants\";\nimport { DropdownMenuItem } from \"./item\";\n\nimport \"./style.css\";\nimport { DropdownMenuDivider } from \"./divider\";\n\nexport type DropdownMenuItemType =\n | {\n /**\n * The type of the menu item\n */\n type: \"item\";\n /**\n * The label of the menu item\n */\n label?: React.ReactNode;\n /**\n * Whether the menu item is disabled\n */\n disabled?: boolean;\n /**\n * The icon of the menu item\n */\n icon?: React.ReactNode;\n /**\n * The key of the menu item\n */\n key: React.Key;\n /**\n * The onClick event handler of the menu item\n */\n onClick?: React.HTMLAttributes<HTMLElement>[\"onClick\"];\n /**\n * The onMouseEnter event handler of the menu item\n */\n onMouseEnter?: React.HTMLAttributes<HTMLElement>[\"onMouseEnter\"];\n /**\n * The onMouseLeave event handler of the menu item\n */\n onMouseLeave?: React.HTMLAttributes<HTMLElement>[\"onMouseLeave\"];\n /**\n * The onMouseOver event handler of the menu item\n */\n onMouseOver?: React.HTMLAttributes<HTMLElement>[\"onMouseOver\"];\n /**\n * The onMouseOut event handler of the menu item\n */\n onMouseOut?: React.HTMLAttributes<HTMLElement>[\"onMouseOut\"];\n /**\n * The className of the menu item\n */\n className?: string;\n /**\n * Whether the menu item is a danger item\n */\n danger?: boolean;\n /**\n * The ref of the menu item\n */\n ref?: React.Ref<HTMLElement>;\n }\n | {\n /**\n * The type of the menu item\n */\n type: \"divider\";\n }\n | {\n /**\n * The type of the menu item\n */\n type: \"header\";\n /**\n * The title of the menu item\n */\n title?: React.ReactNode;\n /**\n * The className of the menu item\n */\n className?: string;\n };\n\nexport interface DropdownMenuProps {\n /** Array of menu items to be displayed in the dropdown */\n items: DropdownMenuItemType[];\n /** Custom render function for the trigger element */\n children?: React.ComponentProps<typeof Menu.Trigger>[\"render\"];\n /**\n * Placement of the dropdown relative to the trigger element\n * @default \"bottomLeft\"\n */\n placement?: PopoverProps[\"placement\"];\n /**\n * Whether to open the dropdown on hover instead of click\n * @default false\n */\n openOnHover?: boolean;\n /**\n * Controlled open state of the dropdown\n */\n open?: boolean;\n /**\n * Callback fired when the dropdown open state changes\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Additional CSS class for the dropdown component\n */\n className?: string;\n /**\n * Custom class names for different parts of the dropdown\n * @default {}\n */\n classNames?: {\n root?: string;\n trigger?: string;\n popup?: string;\n group?: string;\n groupLabel?: string;\n item?: string;\n itemIcon?: string;\n itemText?: string;\n separator?: string;\n positioner?: string;\n };\n /**\n * Custom render function for menu items\n */\n itemRender?: (\n item: DropdownMenuItemType,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /**\n * Whether to show search input\n * @default false\n */\n showSearch?: boolean;\n /**\n * Size of the dropdown menu\n * @default \"auto\"\n */\n size?: \"auto\" | keyof typeof PopupPanelSize;\n /**\n * Search placeholder\n */\n searchProps?: Omit<\n React.ComponentProps<typeof Command.Input>,\n \"size\" | \"ref\"\n >;\n /**\n * Whether to match the width of the popup with the trigger\n * @default false\n */\n popupMatchTriggerWidth?: boolean;\n\n /**\n * Content to display before the list\n */\n beforeList?: React.ReactNode;\n /**\n * Content to display after the list\n */\n afterList?: React.ReactNode;\n /**\n * Whether to keep the dropdown open when an item is selected\n * @default false\n */\n keepOpenOnSelect?: boolean;\n /**\n * Control the highlighted state of the menu item\n */\n highlightedItemKey?: React.Key;\n /**\n * Control the selected state of the menu item\n */\n selectedItemKeys?: React.Key[];\n /**\n * Whether to show checkbox\n * @default false\n */\n showCheckbox?: boolean;\n /**\n * Function to extract keywords from the item for search filtering\n * @default (item) => [String(item.key), reactNodeToString(item.label)]\n */\n getItemKeywords?: (item: DropdownMenuItemType & { type: \"item\" }) => string[];\n}\n\ninterface DropdownMenuGroup {\n label: React.ReactNode | null;\n items: DropdownMenuItemType[];\n}\n\nexport const DropdownMenu = ({\n children,\n items,\n placement,\n openOnHover,\n open: outsideOpen,\n onOpenChange: outsideOnOpenChange,\n className,\n itemRender,\n classNames,\n size = \"auto\",\n showSearch,\n searchProps = {\n placeholder: \"Search...\",\n },\n popupMatchTriggerWidth,\n beforeList,\n afterList,\n keepOpenOnSelect,\n highlightedItemKey,\n selectedItemKeys,\n showCheckbox,\n getItemKeywords,\n}: DropdownMenuProps) => {\n const [open, setOpen] = useControlled({\n controlled: outsideOpen,\n default: false,\n name: \"open\",\n });\n const onOpenChange = useCallback(\n (newValue: boolean) => {\n setOpen(newValue);\n outsideOnOpenChange?.(newValue);\n },\n [setOpen, outsideOnOpenChange]\n );\n const cls = useCls();\n const antdCssVarClassname = useAntdCssVarClassname();\n const baseUIPlacement = parseAntdPlacement(placement);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const itemGroups = items.reduce<DropdownMenuGroup[]>((acc, current) => {\n // If no groups exist yet and current item is not a header, create default group\n if (acc.length === 0 && current.type !== \"header\") {\n acc.push({\n label: null,\n items: [],\n });\n }\n\n // If it's a header, create a new group\n if (current.type === \"header\") {\n acc.push({\n label: current.title,\n items: [],\n });\n }\n // If it's an item and we have at least one group, add it to the last group's items\n else if (\n (current.type === \"item\" || current.type === \"divider\") &&\n acc.length > 0\n ) {\n acc[acc.length - 1].items.push(current);\n }\n // Skip dividers\n return acc;\n }, []);\n\n const renderMenuItem = useCallback(\n (item: DropdownMenuItemType, i: number, j: number) => {\n if (item.type === \"item\") {\n return (\n <DropdownMenuItem\n key={i + \"-\" + j}\n item={item}\n inCombobox={showSearch}\n selected={selectedItemKeys?.includes(item.key)}\n onSelect={\n showSearch\n ? () => {\n const e = new MouseEvent(\"click\", {\n bubbles: true,\n cancelable: true,\n }) as unknown as React.MouseEvent<HTMLElement, MouseEvent>;\n item.onClick(e);\n if (!keepOpenOnSelect) onOpenChange?.(false);\n }\n : undefined\n }\n itemRender={itemRender}\n showCheckbox={showCheckbox}\n getItemKeywords={getItemKeywords}\n />\n );\n } else if (item.type === \"divider\") {\n return (\n <DropdownMenuDivider\n key={i + \"-\" + j}\n inCombobox={showSearch}\n className={classNames?.separator}\n />\n );\n }\n return null;\n },\n [\n classNames,\n itemRender,\n onOpenChange,\n showSearch,\n keepOpenOnSelect,\n selectedItemKeys,\n showCheckbox,\n ]\n );\n\n const renderGroup = useCallback(\n (group: DropdownMenuGroup, index: number) => (\n <Menu.Group\n key={\"group\" + index}\n className={clsx(cls(\"dropdown-menu-group\"), classNames?.group)}\n >\n {group.label && (\n <Menu.GroupLabel\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{group.label}</span>\n </Menu.GroupLabel>\n )}\n {group.items.map((item, j) => renderMenuItem(item, index, j))}\n </Menu.Group>\n ),\n [cls, classNames, renderMenuItem]\n );\n\n const renderGroupShowSearch = useCallback(\n (group: DropdownMenuGroup, index: number) =>\n group.label ? (\n <Command.Group\n key={\"group\" + index}\n className={clsx(cls(\"dropdown-menu-group\"), classNames?.group)}\n heading={\n <Menu.GroupLabel\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{group.label}</span>\n </Menu.GroupLabel>\n }\n >\n {group.items.map((item, j) => renderMenuItem(item, index, j))}\n </Command.Group>\n ) : (\n group.items.map((item, j) => renderMenuItem(item, index, j))\n ),\n [cls, classNames, renderMenuItem]\n );\n\n const renderMenuInner = useCallback(\n () =>\n showSearch ? (\n <Command\n className={cls(\"dropdown-menu-container\")}\n disablePointerSelection={showSearch}\n defaultValue={\n highlightedItemKey ? String(highlightedItemKey) : undefined\n }\n >\n <FormItemInputContext.Provider value={{}}>\n <Command.Input\n {...searchProps}\n key=\"search\"\n render={\n <Input\n allowClear\n className={cls(\"dropdown-menu-search\")}\n placeholder=\"Search\"\n />\n }\n />\n </FormItemInputContext.Provider>\n {beforeList}\n <ScrollArea fadeEdges>\n <Command.List className={cls(\"dropdown-menu-list\")}>\n <Command.Empty className={cls(\"dropdown-menu-empty\")}>\n No results found.\n </Command.Empty>\n {itemGroups.map(renderGroupShowSearch)}\n </Command.List>\n </ScrollArea>\n {afterList}\n </Command>\n ) : (\n <div className={cls(\"dropdown-menu-container\")}>\n {beforeList}\n <ScrollArea fadeEdges>{itemGroups.map(renderGroup)}</ScrollArea>\n {afterList}\n </div>\n ),\n [\n showSearch,\n cls,\n highlightedItemKey,\n searchProps,\n beforeList,\n itemGroups,\n renderGroupShowSearch,\n afterList,\n renderGroup,\n ]\n );\n\n const BaseComponent = showSearch ? Popover : Menu;\n\n return (\n <BaseComponent.Root\n openOnHover={openOnHover}\n open={open}\n onOpenChange={onOpenChange}\n >\n <BaseComponent.Trigger\n render={children}\n ref={buttonRef}\n className={clsx(\n cls(\"dropdown-menu-trigger\"),\n classNames?.trigger,\n antdCssVarClassname\n )}\n />\n <BaseComponent.Portal>\n <BaseComponent.Positioner\n side={baseUIPlacement.side}\n align={baseUIPlacement.align}\n sideOffset={4}\n className={clsx(cls(\"dropdown-menu-root\"), classNames?.root)}\n collisionAvoidance={DROPDOWN_COLLISION_AVOIDANCE}\n >\n <BaseComponent.Popup\n className={clsx(\n cls(\n \"dropdown-menu\",\n showCheckbox && \"dropdown-menu-show-checkbox\",\n popupMatchTriggerWidth && \"dropdown-menu-match-trigger-width\"\n ),\n className,\n classNames?.popup,\n antdCssVarClassname\n )}\n style={\n {\n \"--size-width\":\n size in PopupPanelSize ? PopupPanelSize[size] : undefined,\n } as React.CSSProperties\n }\n >\n {renderMenuInner()}\n </BaseComponent.Popup>\n </BaseComponent.Positioner>\n </BaseComponent.Portal>\n </BaseComponent.Root>\n );\n};\n"],"names":["DropdownMenu","children","items","placement","openOnHover","outsideOpen","outsideOnOpenChange","className","itemRender","classNames","size","showSearch","searchProps","popupMatchTriggerWidth","beforeList","afterList","keepOpenOnSelect","highlightedItemKey","selectedItemKeys","showCheckbox","getItemKeywords","open","setOpen","useControlled","onOpenChange","useCallback","newValue","cls","useCls","antdCssVarClassname","useAntdCssVarClassname","baseUIPlacement","parseAntdPlacement","buttonRef","useRef","itemGroups","acc","current","renderMenuItem","item","i","j","jsx","DropdownMenuItem","e","DropdownMenuDivider","renderGroup","group","index","jsxs","Menu","clsx","renderGroupShowSearch","Command","renderMenuInner","FormItemInputContext","createElement","Input","ScrollArea","BaseComponent","Popover","DROPDOWN_COLLISION_AVOIDANCE","PopupPanelSize"],"mappings":";;;;;;;;;;;;;;;;;;AAoNO,MAAMA,KAAe,CAAC;AAAA,EAC3B,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAMC;AAAA,EACN,cAAcC;AAAA,EACd,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,YAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,IACZ,aAAa;AAAA,EACf;AAAA,EACA,wBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,iBAAAC;AACF,MAAyB;AACvB,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAc;AAAA,IACpC,YAAYlB;AAAA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AY;AAAA,kBACZoB;AAAA,gBACF;AAAA,gBACA,OACE;AAAA,kBACE,gBACEnB,KAAQoD,IAAiBA,EAAepD,CAAI,IAAI;AAAA,gBACpD;AAAA,gBAGD,UAAgB4C,EAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACnB;AAAA,QAAA,EAEJ,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.ds-dropdown-menu-item{padding:.375rem .75rem;border-radius:var(--ds-border-radius-sm);cursor:pointer;display:flex;align-items:center;transition:all .3s var(--ds-motion-ease-out)}.ds-dropdown-menu-item:focus{outline:none}.ds-dropdown-menu-item:hover,.ds-dropdown-menu-item[data-active=true],.ds-dropdown-menu-item[data-selected=true],.ds-dropdown-menu-item[data-highlighted=true]{background:var(--ds-control-item-bg-hover)}.ds-dropdown-menu-item:active,.ds-dropdown-menu-item:focus,.ds-dropdown-menu-item[data-focus=true]{background:var(--ds-control-item-bg-active);font-weight:500}.ds-dropdown-menu:not(.ds-dropdown-menu-show-checkbox) .ds-dropdown-menu-item[data-actual-selected=true]{background:var(--ds-control-item-bg-active);font-weight:500}.ds-dropdown-menu-item[data-disabled=true]{pointer-events:none;color:var(--ds-color-text-disabled)}.ds-dropdown-menu-item[data-danger=true]{color:var(--ds-color-error)}.ds-dropdown-menu-item[data-danger=true]:hover{background:var(--ds-color-error-bg)}.ds-dropdown-menu-item[data-danger=true]:active,.ds-dropdown-menu-item[data-danger=true]:focus,.ds-dropdown-menu-item[data-danger=true][data-focus=true]{background:var(--ds-color-error-bg-hover)}.ds-dropdown-menu-item .ds-checkbox-wrapper{margin-right:.5rem}.ds-dropdown-menu-item .ds-dropdown-menu-item-icon{display:flex;align-items:center;justify-content:center;margin-right:.5rem;font-size:1rem;color:var(--ds-color-icon)}[data-danger=true]
|
|
1
|
+
@layer components{.ds-dropdown-menu-item{padding:.375rem .75rem;border-radius:var(--ds-border-radius-sm);cursor:pointer;display:flex;align-items:center;transition:all .3s var(--ds-motion-ease-out)}.ds-dropdown-menu-item:focus{outline:none}.ds-dropdown-menu-item:hover,.ds-dropdown-menu-item[data-active=true],.ds-dropdown-menu-item[data-selected=true],.ds-dropdown-menu-item[data-highlighted=true]{background:var(--ds-control-item-bg-hover)}.ds-dropdown-menu-item:active,.ds-dropdown-menu-item:focus,.ds-dropdown-menu-item[data-focus=true]{background:var(--ds-control-item-bg-active);font-weight:500}.ds-dropdown-menu:not(.ds-dropdown-menu-show-checkbox) .ds-dropdown-menu-item[data-actual-selected=true]{background:var(--ds-control-item-bg-active);font-weight:500}.ds-dropdown-menu-item[data-disabled=true]{pointer-events:none;color:var(--ds-color-text-disabled)}.ds-dropdown-menu-item[data-danger=true]{color:var(--ds-color-error)}.ds-dropdown-menu-item[data-danger=true]:hover{background:var(--ds-color-error-bg)}.ds-dropdown-menu-item[data-danger=true]:active,.ds-dropdown-menu-item[data-danger=true]:focus,.ds-dropdown-menu-item[data-danger=true][data-focus=true]{background:var(--ds-color-error-bg-hover)}.ds-dropdown-menu-item .ds-checkbox-wrapper{margin-right:.5rem}.ds-dropdown-menu-item .ds-dropdown-menu-item-icon{display:flex;align-items:center;justify-content:center;margin-right:.5rem;font-size:1rem;color:var(--ds-color-icon)}[data-danger=true] .ds-dropdown-menu-item .ds-dropdown-menu-item-icon{color:var(--ds-color-error)}}
|
|
@@ -1,36 +1,38 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { Command as
|
|
5
|
-
import { Menu as
|
|
2
|
+
import { jsxs as I, Fragment as x, jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as h } from "react";
|
|
4
|
+
import { Command as j } from "../cmdk/index.js";
|
|
5
|
+
import { Menu as E } from "@base-ui-components/react/menu";
|
|
6
6
|
import './item.css';/* empty css */
|
|
7
|
-
import { Checkbox as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
7
|
+
import { Checkbox as w } from "antd";
|
|
8
|
+
import { reactNodeToString as L } from "../utils/reactToString.js";
|
|
9
|
+
import { useCls as D } from "../utils/antdUtils.js";
|
|
10
|
+
import { clsx as t } from "../utils/cn.js";
|
|
11
|
+
const J = ({
|
|
11
12
|
item: o,
|
|
12
13
|
inCombobox: u = !1,
|
|
13
|
-
selected:
|
|
14
|
-
itemRender:
|
|
15
|
-
itemProps:
|
|
14
|
+
selected: f = !1,
|
|
15
|
+
itemRender: p,
|
|
16
|
+
itemProps: y = {},
|
|
16
17
|
classNames: n,
|
|
17
|
-
onSelect:
|
|
18
|
-
showCheckbox:
|
|
19
|
-
indeterminate:
|
|
20
|
-
renderAsNativeElement: O
|
|
18
|
+
onSelect: k,
|
|
19
|
+
showCheckbox: M,
|
|
20
|
+
indeterminate: e,
|
|
21
|
+
renderAsNativeElement: O,
|
|
22
|
+
getItemKeywords: g
|
|
21
23
|
}) => {
|
|
22
|
-
const d =
|
|
23
|
-
() => u ?
|
|
24
|
+
const d = D(), T = h(
|
|
25
|
+
() => u ? j.Item : E.Item,
|
|
24
26
|
[u]
|
|
25
|
-
),
|
|
26
|
-
className:
|
|
27
|
+
), i = h(() => ({
|
|
28
|
+
className: t(
|
|
27
29
|
d("dropdown-menu-item", u && "dropdown-menu-item-combobox"),
|
|
28
30
|
n == null ? void 0 : n.item,
|
|
29
31
|
o.className
|
|
30
32
|
),
|
|
31
33
|
disabled: o.disabled,
|
|
32
34
|
"data-danger": o.danger,
|
|
33
|
-
"data-actual-selected":
|
|
35
|
+
"data-actual-selected": f,
|
|
34
36
|
ref: o.ref,
|
|
35
37
|
onClick: o.onClick,
|
|
36
38
|
onMouseEnter: o.onMouseEnter,
|
|
@@ -38,20 +40,20 @@ const C = ({
|
|
|
38
40
|
onMouseOver: o.onMouseOver,
|
|
39
41
|
onMouseOut: o.onMouseOut,
|
|
40
42
|
"data-value": typeof o.label == "string" ? o.label : String(o.key),
|
|
41
|
-
render:
|
|
42
|
-
children: u ? /* @__PURE__ */
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
render: p ? (b) => p(o, b) : void 0,
|
|
44
|
+
children: u ? /* @__PURE__ */ I(x, { children: [
|
|
45
|
+
M && /* @__PURE__ */ r(
|
|
46
|
+
w,
|
|
45
47
|
{
|
|
46
|
-
checked:
|
|
48
|
+
checked: f,
|
|
47
49
|
tabIndex: -1,
|
|
48
|
-
indeterminate:
|
|
50
|
+
indeterminate: e
|
|
49
51
|
}
|
|
50
52
|
),
|
|
51
53
|
o.icon && /* @__PURE__ */ r(
|
|
52
54
|
"span",
|
|
53
55
|
{
|
|
54
|
-
className:
|
|
56
|
+
className: t(
|
|
55
57
|
d("dropdown-menu-item-icon"),
|
|
56
58
|
n == null ? void 0 : n.itemIcon
|
|
57
59
|
),
|
|
@@ -61,26 +63,26 @@ const C = ({
|
|
|
61
63
|
/* @__PURE__ */ r(
|
|
62
64
|
"span",
|
|
63
65
|
{
|
|
64
|
-
className:
|
|
66
|
+
className: t(
|
|
65
67
|
d("dropdown-menu-item-text"),
|
|
66
68
|
n == null ? void 0 : n.itemText
|
|
67
69
|
),
|
|
68
70
|
children: o.label
|
|
69
71
|
}
|
|
70
72
|
)
|
|
71
|
-
] }) : /* @__PURE__ */
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
] }) : /* @__PURE__ */ I(x, { children: [
|
|
74
|
+
M && /* @__PURE__ */ r(
|
|
75
|
+
w,
|
|
74
76
|
{
|
|
75
|
-
checked:
|
|
77
|
+
checked: f,
|
|
76
78
|
tabIndex: -1,
|
|
77
|
-
indeterminate:
|
|
79
|
+
indeterminate: e
|
|
78
80
|
}
|
|
79
81
|
),
|
|
80
82
|
o.icon && /* @__PURE__ */ r(
|
|
81
83
|
"span",
|
|
82
84
|
{
|
|
83
|
-
className:
|
|
85
|
+
className: t(
|
|
84
86
|
d("dropdown-menu-item-icon"),
|
|
85
87
|
n == null ? void 0 : n.itemIcon
|
|
86
88
|
),
|
|
@@ -90,7 +92,7 @@ const C = ({
|
|
|
90
92
|
/* @__PURE__ */ r(
|
|
91
93
|
"span",
|
|
92
94
|
{
|
|
93
|
-
className:
|
|
95
|
+
className: t(
|
|
94
96
|
d("dropdown-menu-item-text"),
|
|
95
97
|
n == null ? void 0 : n.itemText
|
|
96
98
|
),
|
|
@@ -104,28 +106,29 @@ const C = ({
|
|
|
104
106
|
n == null ? void 0 : n.itemText,
|
|
105
107
|
d,
|
|
106
108
|
u,
|
|
107
|
-
|
|
109
|
+
e,
|
|
108
110
|
o,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
p,
|
|
112
|
+
f,
|
|
113
|
+
M
|
|
112
114
|
]);
|
|
113
|
-
if (
|
|
114
|
-
return
|
|
115
|
-
...
|
|
116
|
-
...
|
|
115
|
+
if (p)
|
|
116
|
+
return p(o, {
|
|
117
|
+
...i,
|
|
118
|
+
...y
|
|
117
119
|
});
|
|
118
|
-
const { render: v, ...
|
|
119
|
-
return O ? v ? v(
|
|
120
|
-
|
|
120
|
+
const { render: v, ...S } = i;
|
|
121
|
+
return O ? v ? v(i) : /* @__PURE__ */ r("div", { onClick: k, ...S }) : /* @__PURE__ */ r(
|
|
122
|
+
T,
|
|
121
123
|
{
|
|
122
124
|
value: String(o.key),
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
keywords: g ? g(o) : [String(o.key), L(o.label)],
|
|
126
|
+
onSelect: k,
|
|
127
|
+
...i
|
|
125
128
|
}
|
|
126
129
|
);
|
|
127
130
|
};
|
|
128
131
|
export {
|
|
129
|
-
|
|
132
|
+
J as DropdownMenuItem
|
|
130
133
|
};
|
|
131
134
|
//# sourceMappingURL=item.js.map
|