@bioturing/components 0.38.0 → 0.39.1
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/base-menu/index.js +3 -3
- package/dist/components/cmdk/index.d.ts +2 -2
- package/dist/components/combobox/component.js.map +1 -1
- package/dist/components/data-table/component.js +7 -7
- package/dist/components/data-table/component.js.map +1 -1
- package/dist/components/data-table/hooks.d.ts.map +1 -1
- package/dist/components/data-table/hooks.js +73 -61
- package/dist/components/data-table/hooks.js.map +1 -1
- package/dist/components/dropdown-menu/component.d.ts +4 -2
- package/dist/components/dropdown-menu/component.d.ts.map +1 -1
- package/dist/components/dropdown-menu/component.js +153 -154
- package/dist/components/dropdown-menu/component.js.map +1 -1
- package/dist/components/dropdown-menu/divider.js +6 -6
- package/dist/components/dropdown-menu/divider.js.map +1 -1
- package/dist/components/dropdown-menu/item.d.ts.map +1 -1
- package/dist/components/dropdown-menu/item.js +27 -26
- package/dist/components/dropdown-menu/item.js.map +1 -1
- package/dist/components/dropdown-menu/style.css +1 -1
- package/dist/components/dropdown-menu/types.d.ts +2 -2
- package/dist/components/dropdown-menu/types.d.ts.map +1 -1
- package/dist/components/dropdown-menu/useDropdownMenu.d.ts.map +1 -1
- package/dist/components/dropdown-menu/useDropdownMenu.js +72 -68
- package/dist/components/dropdown-menu/useDropdownMenu.js.map +1 -1
- package/dist/components/popup-panel/component.d.ts +13 -1
- package/dist/components/popup-panel/component.d.ts.map +1 -1
- package/dist/components/popup-panel/component.js +102 -95
- package/dist/components/popup-panel/component.js.map +1 -1
- package/dist/components/toast/function.d.ts +8 -8
- package/dist/components/toast/function.d.ts.map +1 -1
- package/dist/components/toast/function.js.map +1 -1
- package/dist/components/tree/components.d.ts.map +1 -1
- package/dist/components/tree/components.js +50 -40
- package/dist/components/tree/components.js.map +1 -1
- package/dist/components/tree/style.css +1 -1
- package/dist/components/tree/types.d.ts +4 -0
- package/dist/components/tree/types.d.ts.map +1 -1
- package/dist/components/tree/useTreeCommon.d.ts +1 -0
- package/dist/components/tree/useTreeCommon.d.ts.map +1 -1
- package/dist/components/tree/useTreeCommon.js +21 -19
- package/dist/components/tree/useTreeCommon.js.map +1 -1
- package/dist/stats.html +1 -1
- package/package.json +4 -4
|
@@ -1,176 +1,175 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
const
|
|
20
|
-
children:
|
|
21
|
-
items:
|
|
22
|
-
placement:
|
|
23
|
-
openOnHover:
|
|
24
|
-
open:
|
|
25
|
-
onOpenChange:
|
|
26
|
-
defaultOpen:
|
|
27
|
-
className:
|
|
28
|
-
itemRender:
|
|
29
|
-
classNames:
|
|
30
|
-
size:
|
|
31
|
-
showSearch:
|
|
32
|
-
inCombobox:
|
|
33
|
-
searchProps:
|
|
2
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { Menu as d } from "@base-ui-components/react/menu";
|
|
4
|
+
import { Combobox as t } from "@base-ui-components/react/combobox";
|
|
5
|
+
import { useRef as J, useState as Q, useCallback as X } from "react";
|
|
6
|
+
import { FormItemInputContext as Y } from "antd/es/form/context";
|
|
7
|
+
import { PopupPanelSize as T } from "../popup-panel/constants.js";
|
|
8
|
+
import { useDropdownMenu as Z } from "./useDropdownMenu.js";
|
|
9
|
+
import { BaseMenu as R } from "../base-menu/index.js";
|
|
10
|
+
import { parseAntdPlacement as $ } from "../utils/placement.js";
|
|
11
|
+
import { Input as ee } from "../input/component.js";
|
|
12
|
+
import { ScrollArea as A } from "../scroll-area/component.js";
|
|
13
|
+
import { DROPDOWN_COLLISION_AVOIDANCE as oe } from "../utils/constants.js";
|
|
14
|
+
import { useControlledState as re } from "../hooks/useControlledState.js";
|
|
15
|
+
import { useCls as ne } from "../utils/antdUtils.js";
|
|
16
|
+
import { useTheme as te } from "../theme-provider/context/themeStore.js";
|
|
17
|
+
import { clsx as u } from "../utils/cn.js";
|
|
18
|
+
import { reactNodeToString as ie } from "../utils/reactToString.js";
|
|
19
|
+
const Ne = ({
|
|
20
|
+
children: D,
|
|
21
|
+
items: M,
|
|
22
|
+
placement: V,
|
|
23
|
+
openOnHover: E,
|
|
24
|
+
open: j,
|
|
25
|
+
onOpenChange: k,
|
|
26
|
+
defaultOpen: B = !1,
|
|
27
|
+
className: G,
|
|
28
|
+
itemRender: L,
|
|
29
|
+
classNames: r,
|
|
30
|
+
size: P = "auto",
|
|
31
|
+
showSearch: p,
|
|
32
|
+
inCombobox: w,
|
|
33
|
+
searchProps: i = {
|
|
34
34
|
placeholder: "Search..."
|
|
35
35
|
},
|
|
36
|
-
popupMatchTriggerWidth:
|
|
37
|
-
beforeList:
|
|
38
|
-
afterList:
|
|
39
|
-
keepOpenOnSelect:
|
|
40
|
-
highlightedItemKey:
|
|
41
|
-
selectedItemKeys:
|
|
42
|
-
getItemKeywords:
|
|
43
|
-
showCheckbox:
|
|
44
|
-
itemLabelRender:
|
|
36
|
+
popupMatchTriggerWidth: _,
|
|
37
|
+
beforeList: c,
|
|
38
|
+
afterList: a,
|
|
39
|
+
keepOpenOnSelect: z,
|
|
40
|
+
highlightedItemKey: me,
|
|
41
|
+
selectedItemKeys: F,
|
|
42
|
+
getItemKeywords: K,
|
|
43
|
+
showCheckbox: C,
|
|
44
|
+
itemLabelRender: U
|
|
45
45
|
}) => {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
),
|
|
51
|
-
items:
|
|
52
|
-
keepOpenOnSelect:
|
|
53
|
-
selectedItemKeys:
|
|
54
|
-
showCheckbox:
|
|
55
|
-
getItemKeywords:
|
|
56
|
-
itemLabelRender:
|
|
57
|
-
itemRender:
|
|
58
|
-
inCombobox:
|
|
59
|
-
onOpenChange:
|
|
46
|
+
const W = typeof w == "boolean" ? w : p, [S, s] = re(
|
|
47
|
+
j,
|
|
48
|
+
k,
|
|
49
|
+
B
|
|
50
|
+
), n = ne(), { className: v } = te(), x = $(V), q = J(null), { itemGroups: f, renderGroup: g } = Z({
|
|
51
|
+
items: M,
|
|
52
|
+
keepOpenOnSelect: z,
|
|
53
|
+
selectedItemKeys: F,
|
|
54
|
+
showCheckbox: C,
|
|
55
|
+
getItemKeywords: K,
|
|
56
|
+
itemLabelRender: U,
|
|
57
|
+
itemRender: L,
|
|
58
|
+
inCombobox: W,
|
|
59
|
+
onOpenChange: s,
|
|
60
60
|
classNames: {
|
|
61
|
-
item:
|
|
62
|
-
itemIcon:
|
|
63
|
-
itemSuffix:
|
|
64
|
-
group:
|
|
65
|
-
groupLabel:
|
|
66
|
-
divider:
|
|
61
|
+
item: r?.item,
|
|
62
|
+
itemIcon: r?.itemIcon,
|
|
63
|
+
itemSuffix: r?.itemSuffix,
|
|
64
|
+
group: r?.group,
|
|
65
|
+
groupLabel: r?.groupLabel,
|
|
66
|
+
divider: r?.divider
|
|
67
67
|
}
|
|
68
|
-
}),
|
|
69
|
-
() =>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
/* @__PURE__ */ e(J.Provider, { value: {}, children: /* @__PURE__ */ W(
|
|
77
|
-
i.Input,
|
|
68
|
+
}), [h, H] = Q(""), I = X(
|
|
69
|
+
() => p ? /* @__PURE__ */ l("div", { className: n("dropdown-menu-container"), children: [
|
|
70
|
+
/* @__PURE__ */ e(Y.Provider, { value: {}, children: /* @__PURE__ */ e(
|
|
71
|
+
t.Input,
|
|
72
|
+
{
|
|
73
|
+
placeholder: i?.placeholder || "Search",
|
|
74
|
+
render: ({ ref: o, ...b }) => /* @__PURE__ */ e(
|
|
75
|
+
ee,
|
|
78
76
|
{
|
|
79
|
-
...
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
77
|
+
...b,
|
|
78
|
+
ref: (m) => {
|
|
79
|
+
if (!m || !m.input) return;
|
|
80
|
+
o(m.input);
|
|
81
|
+
},
|
|
82
|
+
allowClear: !0,
|
|
83
|
+
placeholder: i?.placeholder || "Search",
|
|
84
|
+
value: h,
|
|
85
|
+
onChange: (m) => H(m.target.value),
|
|
86
|
+
className: u(
|
|
87
|
+
n("dropdown-menu-search"),
|
|
88
|
+
i?.className
|
|
88
89
|
)
|
|
89
90
|
}
|
|
90
|
-
)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
91
|
+
),
|
|
92
|
+
...i
|
|
93
|
+
},
|
|
94
|
+
"search"
|
|
95
|
+
) }),
|
|
96
|
+
c,
|
|
97
|
+
/* @__PURE__ */ l(A, { fadeEdges: !0, children: [
|
|
98
|
+
/* @__PURE__ */ e(t.Empty, { className: n("dropdown-menu-empty"), children: "No results found." }),
|
|
99
|
+
/* @__PURE__ */ e(t.List, { className: n("dropdown-menu-list"), children: (o, b) => g(o, b) })
|
|
100
|
+
] }),
|
|
101
|
+
a
|
|
102
|
+
] }) : /* @__PURE__ */ l("div", { className: n("dropdown-menu-container"), children: [
|
|
103
|
+
c,
|
|
104
|
+
/* @__PURE__ */ e(A, { fadeEdges: !0, children: f.map(g) }),
|
|
105
|
+
a
|
|
103
106
|
] }),
|
|
104
107
|
[
|
|
105
|
-
n,
|
|
106
|
-
r,
|
|
107
|
-
l,
|
|
108
|
-
C,
|
|
109
|
-
d,
|
|
110
|
-
u,
|
|
111
108
|
p,
|
|
112
|
-
|
|
109
|
+
n,
|
|
110
|
+
i,
|
|
111
|
+
h,
|
|
112
|
+
c,
|
|
113
|
+
a,
|
|
114
|
+
f,
|
|
115
|
+
g
|
|
113
116
|
]
|
|
114
|
-
),
|
|
115
|
-
|
|
117
|
+
), N = {
|
|
118
|
+
render: D,
|
|
119
|
+
ref: q,
|
|
120
|
+
nativeButton: !1,
|
|
121
|
+
openOnHover: E,
|
|
122
|
+
className: u(
|
|
123
|
+
n("dropdown-menu-trigger"),
|
|
124
|
+
r?.trigger,
|
|
125
|
+
v
|
|
126
|
+
)
|
|
127
|
+
}, y = {
|
|
128
|
+
side: x.side,
|
|
129
|
+
align: x.align,
|
|
130
|
+
sideOffset: 4,
|
|
131
|
+
className: u(
|
|
132
|
+
n("dropdown-menu-root"),
|
|
133
|
+
v,
|
|
134
|
+
r?.root
|
|
135
|
+
),
|
|
136
|
+
collisionAvoidance: oe,
|
|
137
|
+
render: (o) => /* @__PURE__ */ e(R.Root, { ...o })
|
|
138
|
+
}, O = {
|
|
139
|
+
className: u(
|
|
140
|
+
n(
|
|
141
|
+
"dropdown-menu",
|
|
142
|
+
C && "dropdown-menu-show-checkbox",
|
|
143
|
+
_ && "dropdown-menu-match-trigger-width"
|
|
144
|
+
),
|
|
145
|
+
G,
|
|
146
|
+
r?.popup
|
|
147
|
+
),
|
|
148
|
+
style: {
|
|
149
|
+
"--size-width": P in T ? T[P] : void 0
|
|
150
|
+
},
|
|
151
|
+
render: (o) => /* @__PURE__ */ e(R.Popup, { ...o })
|
|
152
|
+
};
|
|
153
|
+
return p ? /* @__PURE__ */ l(
|
|
116
154
|
t.Root,
|
|
117
155
|
{
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
156
|
+
open: S,
|
|
157
|
+
onOpenChange: s,
|
|
158
|
+
items: f,
|
|
159
|
+
itemToStringLabel: (o) => o.type == "item" ? ie(o.label) : "",
|
|
160
|
+
itemToStringValue: (o) => o.type == "item" ? String(o.key) : "",
|
|
161
|
+
inputValue: h,
|
|
121
162
|
children: [
|
|
122
|
-
/* @__PURE__ */ e(
|
|
123
|
-
|
|
124
|
-
{
|
|
125
|
-
render: b,
|
|
126
|
-
ref: z,
|
|
127
|
-
nativeButton: !1,
|
|
128
|
-
className: s(
|
|
129
|
-
r("dropdown-menu-trigger"),
|
|
130
|
-
o?.trigger,
|
|
131
|
-
P
|
|
132
|
-
)
|
|
133
|
-
}
|
|
134
|
-
),
|
|
135
|
-
/* @__PURE__ */ e(t.Portal, { children: /* @__PURE__ */ e(
|
|
136
|
-
t.Positioner,
|
|
137
|
-
{
|
|
138
|
-
side: h.side,
|
|
139
|
-
align: h.align,
|
|
140
|
-
sideOffset: 4,
|
|
141
|
-
className: s(
|
|
142
|
-
r("dropdown-menu-root"),
|
|
143
|
-
P,
|
|
144
|
-
o?.root
|
|
145
|
-
),
|
|
146
|
-
collisionAvoidance: Z,
|
|
147
|
-
render: (c) => /* @__PURE__ */ e(x.Root, { ...c }),
|
|
148
|
-
children: /* @__PURE__ */ e(
|
|
149
|
-
t.Popup,
|
|
150
|
-
{
|
|
151
|
-
className: s(
|
|
152
|
-
r(
|
|
153
|
-
"dropdown-menu",
|
|
154
|
-
w && "dropdown-menu-show-checkbox",
|
|
155
|
-
y && "dropdown-menu-match-trigger-width"
|
|
156
|
-
),
|
|
157
|
-
R,
|
|
158
|
-
o?.popup
|
|
159
|
-
),
|
|
160
|
-
style: {
|
|
161
|
-
"--size-width": f in I ? I[f] : void 0
|
|
162
|
-
},
|
|
163
|
-
render: (c) => /* @__PURE__ */ e(x.Popup, { ...c }),
|
|
164
|
-
children: F()
|
|
165
|
-
}
|
|
166
|
-
)
|
|
167
|
-
}
|
|
168
|
-
) })
|
|
163
|
+
/* @__PURE__ */ e(t.Trigger, { ...N }),
|
|
164
|
+
/* @__PURE__ */ e(t.Portal, { children: /* @__PURE__ */ e(t.Positioner, { ...y, children: /* @__PURE__ */ e(t.Popup, { ...O, children: I() }) }) })
|
|
169
165
|
]
|
|
170
166
|
}
|
|
171
|
-
)
|
|
167
|
+
) : /* @__PURE__ */ l(d.Root, { open: S, onOpenChange: s, children: [
|
|
168
|
+
/* @__PURE__ */ e(d.Trigger, { ...N }),
|
|
169
|
+
/* @__PURE__ */ e(d.Portal, { children: /* @__PURE__ */ e(d.Positioner, { ...y, children: /* @__PURE__ */ e(d.Popup, { ...O, children: I() }) }) })
|
|
170
|
+
] });
|
|
172
171
|
};
|
|
173
172
|
export {
|
|
174
|
-
|
|
173
|
+
Ne as DropdownMenu
|
|
175
174
|
};
|
|
176
175
|
//# 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 { 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 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\";\n\nimport { DropdownMenuItemType } from \"./types\";\nimport { useDropdownMenu, UseDropdownMenuProps } from \"./useDropdownMenu\";\nimport { useControlledState } from \"../hooks\";\n\nimport { useTheme } from \"../theme-provider\";\nimport { BaseMenu } from \"../base-menu\";\n\nexport interface DropdownMenuProps\n extends Omit<UseDropdownMenuProps, \"classNames\"> {\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 * Default open state of the dropdown\n */\n defaultOpen?: boolean;\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 itemIcon?: string;\n itemText?: string;\n positioner?: string;\n } & UseDropdownMenuProps[\"classNames\"];\n\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 * 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\nexport const DropdownMenu = ({\n children,\n items,\n placement,\n openOnHover,\n open: outsideOpen,\n onOpenChange: outsideOnOpenChange,\n defaultOpen = false,\n className,\n itemRender,\n classNames,\n size = \"auto\",\n showSearch,\n inCombobox: inComboboxProp,\n searchProps = {\n placeholder: \"Search...\",\n },\n popupMatchTriggerWidth,\n beforeList,\n afterList,\n keepOpenOnSelect,\n highlightedItemKey,\n selectedItemKeys,\n getItemKeywords,\n showCheckbox,\n itemLabelRender,\n}: DropdownMenuProps) => {\n const inCombobox =\n typeof inComboboxProp === \"boolean\" ? inComboboxProp : showSearch;\n const [open, onOpenChange] = useControlledState(\n outsideOpen,\n outsideOnOpenChange,\n defaultOpen\n );\n const cls = useCls();\n const { className: themeClassName } = useTheme();\n const baseUIPlacement = parseAntdPlacement(placement);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const { itemGroups, renderGroup } = useDropdownMenu({\n items,\n keepOpenOnSelect,\n highlightedItemKey,\n selectedItemKeys,\n showCheckbox,\n getItemKeywords,\n itemLabelRender,\n itemRender,\n inCombobox,\n onOpenChange,\n classNames: {\n item: classNames?.item,\n itemIcon: classNames?.itemIcon,\n itemSuffix: classNames?.itemSuffix,\n group: classNames?.group,\n groupLabel: classNames?.groupLabel,\n divider: classNames?.divider,\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 // filter={(value, search, keywords) => {\n // console.log({ value, search, keywords });\n // const extendValue = value + \" \" + keywords.join(\" \");\n // if (extendValue.toLowerCase().includes(search.toLowerCase()))\n // return 1;\n // return 0;\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(renderGroup)}\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 afterList,\n renderGroup,\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 nativeButton={false}\n className={clsx(\n cls(\"dropdown-menu-trigger\"),\n classNames?.trigger,\n themeClassName\n )}\n />\n <BaseComponent.Portal>\n <BaseComponent.Positioner\n side={baseUIPlacement.side}\n align={baseUIPlacement.align}\n sideOffset={4}\n className={clsx(\n cls(\"dropdown-menu-root\"),\n themeClassName,\n classNames?.root\n )}\n collisionAvoidance={DROPDOWN_COLLISION_AVOIDANCE}\n render={(props) => <BaseMenu.Root {...props} />}\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 )}\n style={\n {\n \"--size-width\":\n size in PopupPanelSize ? PopupPanelSize[size] : undefined,\n } as React.CSSProperties\n }\n render={(props) => <BaseMenu.Popup {...props} />}\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","defaultOpen","className","itemRender","classNames","size","showSearch","inComboboxProp","searchProps","popupMatchTriggerWidth","beforeList","afterList","keepOpenOnSelect","highlightedItemKey","selectedItemKeys","getItemKeywords","showCheckbox","itemLabelRender","inCombobox","open","onOpenChange","useControlledState","cls","useCls","themeClassName","useTheme","baseUIPlacement","parseAntdPlacement","buttonRef","useRef","itemGroups","renderGroup","useDropdownMenu","renderMenuInner","useCallback","jsxs","Command","jsx","FormItemInputContext","createElement","Input","ScrollArea","BaseComponent","Popover","Menu","clsx","DROPDOWN_COLLISION_AVOIDANCE","props","BaseMenu","PopupPanelSize"],"mappings":";;;;;;;;;;;;;;;;;;AAuGO,MAAMA,KAAe,CAAC;AAAA,EAC3B,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAMC;AAAA,EACN,cAAcC;AAAA,EACd,aAAAC,IAAc;AAAA,EACd,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA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AuB;AAAA,cAC3BlB,GAAY;AAAA,cACZoB;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,QAEF,gBAAAa,EAACK,EAAc,QAAd,EACC,UAAA,gBAAAL;AAAA,UAACK,EAAc;AAAA,UAAd;AAAA,YACC,MAAMhB,EAAgB;AAAA,YACtB,OAAOA,EAAgB;AAAA,YACvB,YAAY;AAAA,YACZ,WAAWmB;AAAA,cACTvB,EAAI,oBAAoB;AAAA,cACxBE;AAAA,cACApB,GAAY;AAAA,YAAA;AAAA,YAEd,oBAAoB0C;AAAA,YACpB,QAAQ,CAACC,MAAU,gBAAAV,EAACW,EAAS,MAAT,EAAe,GAAGD,GAAO;AAAA,YAE7C,UAAA,gBAAAV;AAAA,cAACK,EAAc;AAAA,cAAd;AAAA,gBACC,WAAWG;AAAA,kBACTvB;AAAA,oBACE;AAAA,oBACAN,KAAgB;AAAA,oBAChBP,KAA0B;AAAA,kBAAA;AAAA,kBAE5BP;AAAA,kBACAE,GAAY;AAAA,gBAAA;AAAA,gBAEd,OACE;AAAA,kBACE,gBACEC,KAAQ4C,IAAiBA,EAAe5C,CAAI,IAAI;AAAA,gBAAA;AAAA,gBAGtD,QAAQ,CAAC0C,MAAU,gBAAAV,EAACW,EAAS,OAAT,EAAgB,GAAGD,GAAO;AAAA,gBAE7C,UAAAd,EAAA;AAAA,cAAgB;AAAA,YAAA;AAAA,UACnB;AAAA,QAAA,EACF,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
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 { Combobox } from \"@base-ui-components/react/combobox\";\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { useCallback, useRef, useState, RefCallback } from \"react\";\nimport {\n clsx,\n DROPDOWN_COLLISION_AVOIDANCE,\n parseAntdPlacement,\n reactNodeToString,\n useCls,\n} from \"../utils\";\nimport { ScrollArea } from \"../scroll-area\";\nimport { FormItemInputContext } from \"antd/es/form/context\";\n\n// Import component-specific styles\nimport { PopupPanelSize } from \"../popup-panel/constants\";\n\nimport { DropdownMenuItemType } from \"./types\";\nimport { useDropdownMenu, UseDropdownMenuProps } from \"./useDropdownMenu\";\nimport { useControlledState } from \"../hooks\";\n\nimport { useTheme } from \"../theme-provider\";\nimport { BaseMenu } from \"../base-menu\";\n\nimport { Input } from \"../input\";\n\nexport interface DropdownMenuProps\n extends Omit<UseDropdownMenuProps, \"classNames\"> {\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 * Default open state of the dropdown\n */\n defaultOpen?: boolean;\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 itemIcon?: string;\n itemText?: string;\n positioner?: string;\n } & UseDropdownMenuProps[\"classNames\"];\n\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?: {\n placeholder?: string;\n className?: string;\n };\n /**\n * Whether to match the width of the popup with the trigger\n * @default false\n */\n popupMatchTriggerWidth?: boolean;\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\nexport const DropdownMenu = ({\n children,\n items,\n placement,\n openOnHover,\n open: outsideOpen,\n onOpenChange: outsideOnOpenChange,\n defaultOpen = false,\n className,\n itemRender,\n classNames,\n size = \"auto\",\n showSearch,\n inCombobox: inComboboxProp,\n searchProps = {\n placeholder: \"Search...\",\n },\n popupMatchTriggerWidth,\n beforeList,\n afterList,\n keepOpenOnSelect,\n highlightedItemKey,\n selectedItemKeys,\n getItemKeywords,\n showCheckbox,\n itemLabelRender,\n}: DropdownMenuProps) => {\n const inCombobox =\n typeof inComboboxProp === \"boolean\" ? inComboboxProp : showSearch;\n const [open, onOpenChange] = useControlledState(\n outsideOpen,\n outsideOnOpenChange,\n defaultOpen\n );\n const cls = useCls();\n const { className: themeClassName } = useTheme();\n const baseUIPlacement = parseAntdPlacement(placement);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const { itemGroups, renderGroup } = useDropdownMenu({\n items,\n keepOpenOnSelect,\n highlightedItemKey,\n selectedItemKeys,\n showCheckbox,\n getItemKeywords,\n itemLabelRender,\n itemRender,\n inCombobox,\n onOpenChange,\n classNames: {\n item: classNames?.item,\n itemIcon: classNames?.itemIcon,\n itemSuffix: classNames?.itemSuffix,\n group: classNames?.group,\n groupLabel: classNames?.groupLabel,\n divider: classNames?.divider,\n },\n });\n\n const [searchValue, setSearchValue] = useState(\"\");\n\n const renderMenuInner = useCallback(\n () =>\n showSearch ? (\n <div className={cls(\"dropdown-menu-container\")}>\n <FormItemInputContext.Provider value={{}}>\n <Combobox.Input\n key=\"search\"\n placeholder={searchProps?.placeholder || \"Search\"}\n render={({ ref, ...props }) => (\n <Input\n {...props}\n ref={(antdInputRef) => {\n if (!antdInputRef || !antdInputRef.input) return;\n const comboboxRef = ref as RefCallback<HTMLInputElement>;\n comboboxRef(antdInputRef.input);\n }}\n allowClear\n placeholder={searchProps?.placeholder || \"Search\"}\n value={searchValue}\n onChange={(e) => setSearchValue(e.target.value)}\n className={clsx(\n cls(\"dropdown-menu-search\"),\n searchProps?.className\n )}\n />\n )}\n {...searchProps}\n />\n </FormItemInputContext.Provider>\n {beforeList}\n <ScrollArea fadeEdges>\n <Combobox.Empty className={cls(\"dropdown-menu-empty\")}>\n No results found.\n </Combobox.Empty>\n <Combobox.List className={cls(\"dropdown-menu-list\")}>\n {(group, i) => renderGroup(group, i)}\n </Combobox.List>\n </ScrollArea>\n {afterList}\n </div>\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 searchProps,\n searchValue,\n beforeList,\n afterList,\n itemGroups,\n renderGroup,\n ]\n );\n\n const commonTriggerProps = {\n render: children,\n ref: buttonRef,\n nativeButton: false,\n openOnHover,\n className: clsx(\n cls(\"dropdown-menu-trigger\"),\n classNames?.trigger,\n themeClassName\n ),\n };\n\n const commonPositionerProps = {\n side: baseUIPlacement.side,\n align: baseUIPlacement.align,\n sideOffset: 4,\n className: clsx(\n cls(\"dropdown-menu-root\"),\n themeClassName,\n classNames?.root\n ),\n collisionAvoidance: DROPDOWN_COLLISION_AVOIDANCE,\n render: (props: React.ComponentPropsWithoutRef<\"div\">) => (\n <BaseMenu.Root {...props} />\n ),\n };\n\n const commonPopupProps = {\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 ),\n style: {\n \"--size-width\": size in PopupPanelSize ? PopupPanelSize[size] : undefined,\n } as React.CSSProperties,\n render: (props: React.ComponentPropsWithoutRef<\"div\">) => (\n <BaseMenu.Popup {...props} />\n ),\n };\n\n return showSearch ? (\n <Combobox.Root<DropdownMenuItemType>\n open={open}\n onOpenChange={onOpenChange}\n items={itemGroups}\n itemToStringLabel={(item) =>\n item.type == \"item\" ? reactNodeToString(item.label) : \"\"\n }\n itemToStringValue={(item) =>\n item.type == \"item\" ? String(item.key) : \"\"\n }\n inputValue={searchValue}\n >\n <Combobox.Trigger {...commonTriggerProps} />\n <Combobox.Portal>\n <Combobox.Positioner {...commonPositionerProps}>\n <Combobox.Popup {...commonPopupProps}>\n {renderMenuInner()}\n </Combobox.Popup>\n </Combobox.Positioner>\n </Combobox.Portal>\n </Combobox.Root>\n ) : (\n <Menu.Root open={open} onOpenChange={onOpenChange}>\n <Menu.Trigger {...commonTriggerProps} />\n <Menu.Portal>\n <Menu.Positioner {...commonPositionerProps}>\n <Menu.Popup {...commonPopupProps}>{renderMenuInner()}</Menu.Popup>\n </Menu.Positioner>\n </Menu.Portal>\n </Menu.Root>\n );\n};\n"],"names":["DropdownMenu","children","items","placement","openOnHover","outsideOpen","outsideOnOpenChange","defaultOpen","className","itemRender","classNames","size","showSearch","inComboboxProp","searchProps","popupMatchTriggerWidth","beforeList","afterList","keepOpenOnSelect","highlightedItemKey","selectedItemKeys","getItemKeywords","showCheckbox","itemLabelRender","inCombobox","open","onOpenChange","useControlledState","cls","useCls","themeClassName","useTheme","baseUIPlacement","parseAntdPlacement","buttonRef","useRef","itemGroups","renderGroup","useDropdownMenu","searchValue","setSearchValue","useState","renderMenuInner","useCallback","jsxs","jsx","FormItemInputContext","Combobox","ref","props","Input","antdInputRef","e","clsx","ScrollArea","group","i","commonTriggerProps","commonPositionerProps","DROPDOWN_COLLISION_AVOIDANCE","BaseMenu","commonPopupProps","PopupPanelSize","item","reactNodeToString","Menu"],"mappings":";;;;;;;;;;;;;;;;;;AAwGO,MAAMA,KAAe,CAAC;AAAA,EAC3B,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAMC;AAAA,EACN,cAAcC;AAAA,EACd,aAAAC,IAAc;AAAA,EACd,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,YAAAC;AAAA,EACA,YAAYC;AAAA,EACZ,aAAAC,IAAc;AAAA,IACZ,aAAa;AAA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ACjB,UAAAnB,EAAA,GACH,GACF,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAGF,gBAAAE,EAACqB,EAAK,MAAL,EAAU,MAAAxC,GAAY,cAAAC,GACrB,UAAA;AAAA,IAAA,gBAAAmB,EAACoB,EAAK,SAAL,EAAc,GAAGR,EAAA,CAAoB;AAAA,sBACrCQ,EAAK,QAAL,EACC,UAAA,gBAAApB,EAACoB,EAAK,YAAL,EAAiB,GAAGP,GACnB,UAAA,gBAAAb,EAACoB,EAAK,OAAL,EAAY,GAAGJ,GAAmB,UAAAnB,EAAA,GAAkB,GACvD,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { Menu as
|
|
2
|
+
import { Combobox as n } from "@base-ui-components/react/combobox";
|
|
3
|
+
import { Menu as p } from "@base-ui-components/react/menu";
|
|
4
4
|
import { BaseMenu as s } from "../base-menu/index.js";
|
|
5
5
|
import { useCls as a } from "../utils/antdUtils.js";
|
|
6
6
|
import { clsx as d } from "../utils/cn.js";
|
|
7
|
-
const
|
|
7
|
+
const v = ({
|
|
8
8
|
inCombobox: o,
|
|
9
9
|
className: e
|
|
10
10
|
}) => {
|
|
11
|
-
const m = a(), t = o ?
|
|
11
|
+
const m = a(), t = o ? n.Separator : p.Separator;
|
|
12
12
|
return /* @__PURE__ */ r(
|
|
13
13
|
t,
|
|
14
14
|
{
|
|
15
15
|
className: d(m("dropdown-menu-divider"), e),
|
|
16
|
-
render: (
|
|
16
|
+
render: (i) => /* @__PURE__ */ r(s.Divider, { ...i })
|
|
17
17
|
}
|
|
18
18
|
);
|
|
19
19
|
};
|
|
20
20
|
export {
|
|
21
|
-
|
|
21
|
+
v as DropdownMenuDivider
|
|
22
22
|
};
|
|
23
23
|
//# sourceMappingURL=divider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divider.js","sources":["../../../src/components/dropdown-menu/divider.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"divider.js","sources":["../../../src/components/dropdown-menu/divider.tsx"],"sourcesContent":["import { Combobox } from \"@base-ui-components/react/combobox\";\nimport { Menu } from \"@base-ui-components/react/menu\";\nimport { clsx, useCls } from \"../utils\";\nimport { BaseMenu } from \"../base-menu\";\nimport { HTMLAttributes } from \"react\";\n\nexport interface DropdownMenuDividerProps {\n inCombobox?: boolean;\n className?: string;\n}\n\nexport const DropdownMenuDivider = ({\n inCombobox,\n className,\n}: DropdownMenuDividerProps) => {\n const cls = useCls();\n const MenuSeparator = inCombobox ? Combobox.Separator : Menu.Separator;\n\n return (\n <MenuSeparator\n className={clsx(cls(\"dropdown-menu-divider\"), className)}\n render={(props: HTMLAttributes<HTMLDivElement>) => (\n <BaseMenu.Divider {...props} />\n )}\n />\n );\n};\n"],"names":["DropdownMenuDivider","inCombobox","className","cls","useCls","MenuSeparator","Combobox","Menu","jsx","clsx","props","BaseMenu"],"mappings":";;;;;;AAWO,MAAMA,IAAsB,CAAC;AAAA,EAClC,YAAAC;AAAA,EACA,WAAAC;AACF,MAAgC;AAC9B,QAAMC,IAAMC,EAAA,GACNC,IAAgBJ,IAAaK,EAAS,YAAYC,EAAK;AAE7D,SACE,gBAAAC;AAAA,IAACH;AAAA,IAAA;AAAA,MACC,WAAWI,EAAKN,EAAI,uBAAuB,GAAGD,CAAS;AAAA,MACvD,QAAQ,CAACQ,MACP,gBAAAF,EAACG,EAAS,SAAT,EAAkB,GAAGD,EAAA,CAAO;AAAA,IAAA;AAAA,EAAA;AAIrC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu/item.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAOzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAKp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ACxB;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,oBAAoB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,EAAE,CAAC;CAC/E;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAsH5D,CAAC"}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useCallback as
|
|
4
|
-
import {
|
|
2
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback as g, useMemo as i } from "react";
|
|
4
|
+
import { Combobox as x } from "@base-ui-components/react/combobox";
|
|
5
5
|
import { Menu as O } from "@base-ui-components/react/menu";
|
|
6
6
|
import { BaseMenuItem as S } from "../base-menu/item.js";
|
|
7
|
-
import
|
|
8
|
-
import { reactNodeToString as
|
|
7
|
+
import y from "../utils/createSyntheticClickEvent.js";
|
|
8
|
+
import { reactNodeToString as C } from "../utils/reactToString.js";
|
|
9
9
|
import { useCls as E } from "../utils/antdUtils.js";
|
|
10
10
|
import { clsx as M } from "../utils/cn.js";
|
|
11
|
-
const
|
|
11
|
+
const q = ({
|
|
12
12
|
item: o,
|
|
13
13
|
inCombobox: e = !1,
|
|
14
14
|
selected: u = !1,
|
|
15
|
-
itemRender:
|
|
16
|
-
itemLabelRender:
|
|
15
|
+
itemRender: c,
|
|
16
|
+
itemLabelRender: d,
|
|
17
17
|
itemProps: p = {},
|
|
18
18
|
classNames: n,
|
|
19
|
-
afterSelect:
|
|
19
|
+
afterSelect: l,
|
|
20
20
|
showCheckbox: v,
|
|
21
21
|
indeterminate: k,
|
|
22
|
-
getItemKeywords:
|
|
22
|
+
getItemKeywords: a
|
|
23
23
|
}) => {
|
|
24
|
-
const t = E(), s =
|
|
24
|
+
const t = E(), s = g(
|
|
25
25
|
(r) => {
|
|
26
26
|
if (o.onSelect)
|
|
27
27
|
o.onSelect(o);
|
|
@@ -29,17 +29,17 @@ const z = ({
|
|
|
29
29
|
if (typeof r == "object")
|
|
30
30
|
o.onClick(r);
|
|
31
31
|
else {
|
|
32
|
-
const b =
|
|
32
|
+
const b = y(null);
|
|
33
33
|
o.onClick(b);
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
l && l(o);
|
|
36
36
|
},
|
|
37
|
-
[a, o]
|
|
38
|
-
), g = x(
|
|
39
|
-
() => l ? l(o) : [String(o.key), w(o.label)],
|
|
40
37
|
[l, o]
|
|
41
38
|
);
|
|
42
|
-
return
|
|
39
|
+
return i(
|
|
40
|
+
() => a ? a(o) : [String(o.key), C(o.label)],
|
|
41
|
+
[a, o]
|
|
42
|
+
), c ? c(o, {
|
|
43
43
|
className: M(
|
|
44
44
|
t("dropdown-menu-item", e && "dropdown-menu-item-combobox"),
|
|
45
45
|
n?.item,
|
|
@@ -55,7 +55,7 @@ const z = ({
|
|
|
55
55
|
onMouseOver: o.onMouseOver,
|
|
56
56
|
onMouseOut: o.onMouseOut,
|
|
57
57
|
...p
|
|
58
|
-
}) : /* @__PURE__ */
|
|
58
|
+
}) : /* @__PURE__ */ f(
|
|
59
59
|
S,
|
|
60
60
|
{
|
|
61
61
|
disabled: o.disabled,
|
|
@@ -78,7 +78,7 @@ const z = ({
|
|
|
78
78
|
text: n?.itemText,
|
|
79
79
|
suffix: n?.itemSuffix
|
|
80
80
|
},
|
|
81
|
-
labelRender:
|
|
81
|
+
labelRender: d ? (r) => d(o, r) : void 0,
|
|
82
82
|
ref: o.ref,
|
|
83
83
|
onMouseEnter: o.onMouseEnter,
|
|
84
84
|
onMouseLeave: o.onMouseLeave,
|
|
@@ -86,19 +86,20 @@ const z = ({
|
|
|
86
86
|
onMouseOut: o.onMouseOut,
|
|
87
87
|
"data-value": typeof o.label == "string" ? o.label : String(o.key),
|
|
88
88
|
"data-actual-selected": u,
|
|
89
|
-
render: e ? /* @__PURE__ */
|
|
90
|
-
|
|
89
|
+
render: e ? /* @__PURE__ */ f(
|
|
90
|
+
x.Item,
|
|
91
91
|
{
|
|
92
|
+
role: "option",
|
|
92
93
|
value: String(o.key),
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
) : /* @__PURE__ */
|
|
94
|
+
onClick: s
|
|
95
|
+
},
|
|
96
|
+
String(o.key)
|
|
97
|
+
) : /* @__PURE__ */ f(O.Item, { onClick: s }),
|
|
97
98
|
children: o.label
|
|
98
99
|
}
|
|
99
100
|
);
|
|
100
101
|
};
|
|
101
102
|
export {
|
|
102
|
-
|
|
103
|
+
q as DropdownMenuItem
|
|
103
104
|
};
|
|
104
105
|
//# sourceMappingURL=item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.js","sources":["../../../src/components/dropdown-menu/item.tsx"],"sourcesContent":["\"use client\";\nimport React, { Ref, useCallback, useMemo } from \"react\";\nimport {\n clsx,\n createSyntheticClickEvent,\n reactNodeToString,\n useCls,\n} from \"../utils\";\nimport type { DropdownMenuItemType } from \"./types\";\nimport {
|
|
1
|
+
{"version":3,"file":"item.js","sources":["../../../src/components/dropdown-menu/item.tsx"],"sourcesContent":["\"use client\";\nimport React, { Ref, useCallback, useMemo } from \"react\";\nimport {\n clsx,\n createSyntheticClickEvent,\n reactNodeToString,\n useCls,\n} from \"../utils\";\nimport type { DropdownMenuItemType } from \"./types\";\nimport { Combobox } from \"@base-ui-components/react/combobox\";\nimport { Menu } from \"@base-ui-components/react/menu\";\nimport { BaseMenuItem } from \"../base-menu\";\n\nexport interface DropdownMenuItemProps {\n /**\n * The menu item data\n */\n item: DropdownMenuItemType & { type: \"item\" };\n /**\n * Custom render function for the item\n */\n itemRender?: (\n item: DropdownMenuItemType,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /**\n * Custom render function for the item label\n */\n itemLabelRender?: (\n item: DropdownMenuItemType & { type: \"item\" },\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /**\n * Additional props to pass to the item\n */\n itemProps?: React.HTMLAttributes<HTMLElement>;\n /**\n * Class names from parent DropdownMenu\n */\n classNames?: {\n item?: string;\n itemIcon?: string;\n itemText?: string;\n itemSuffix?: string;\n };\n /**\n * Function to be called after the menu item is selected\n */\n afterSelect?: (item: DropdownMenuItemType & { type: \"item\" }) => void;\n /**\n * Whether the menu item is in a combobox\n */\n inCombobox?: boolean;\n /**\n * Whether the menu item is selected (for combobox)\n * @default false\n */\n selected?: boolean;\n /**\n * Whether to show checkbox (only for decoration purpose)\n */\n showCheckbox?: boolean;\n /**\n * Whether the menu item checkbox is indeterminate (for combobox)\n * @default false\n */\n indeterminate?: 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\nexport const DropdownMenuItem: React.FC<DropdownMenuItemProps> = ({\n item,\n inCombobox = false,\n selected = false,\n itemRender,\n itemLabelRender,\n itemProps = {},\n classNames,\n afterSelect,\n showCheckbox,\n indeterminate,\n getItemKeywords,\n}) => {\n const cls = useCls();\n\n const handler = useCallback(\n (e?: React.MouseEvent<HTMLElement, MouseEvent> | string) => {\n // onSelect has priority over onClick\n if (item.onSelect) {\n item.onSelect(item);\n } else if (item.onClick) {\n if (typeof e === \"object\") {\n item.onClick(e);\n } else {\n const event = createSyntheticClickEvent(null);\n item.onClick(event);\n }\n }\n if (afterSelect) afterSelect(item);\n },\n [afterSelect, item]\n );\n\n const keywords = useMemo(\n () =>\n getItemKeywords\n ? getItemKeywords(item)\n : [String(item.key), reactNodeToString(item.label)],\n [getItemKeywords, item]\n );\n\n // If custom render function is provided, use it\n if (itemRender) {\n return itemRender(item, {\n className: clsx(\n cls(\"dropdown-menu-item\", inCombobox && \"dropdown-menu-item-combobox\"),\n classNames?.item,\n item.className\n ),\n \"data-danger\": item.danger,\n \"data-actual-selected\": selected,\n \"data-value\":\n typeof item.label === \"string\" ? item.label : String(item.key),\n ref: item.ref as Ref<HTMLDivElement>,\n onClick: handler,\n onMouseEnter: item.onMouseEnter,\n onMouseLeave: item.onMouseLeave,\n onMouseOver: item.onMouseOver,\n onMouseOut: item.onMouseOut,\n ...itemProps,\n } as React.HTMLAttributes<HTMLElement>);\n }\n\n return (\n <BaseMenuItem\n // BaseMenuItem props\n disabled={item.disabled}\n danger={item.danger}\n selected={selected}\n showCheckbox={showCheckbox}\n indeterminate={indeterminate}\n icon={item.icon}\n suffix={!inCombobox ? item.suffix : undefined}\n classNames={{\n root: clsx(\n cls(\n \"dropdown-menu-item\",\n inCombobox && \"dropdown-menu-item-combobox\"\n ),\n classNames?.item,\n item.className\n ),\n icon: classNames?.itemIcon,\n text: classNames?.itemText,\n suffix: classNames?.itemSuffix,\n }}\n labelRender={\n itemLabelRender\n ? (props: React.HTMLAttributes<HTMLElement>) =>\n itemLabelRender(item, props)\n : undefined\n }\n ref={item.ref as Ref<HTMLDivElement>}\n onMouseEnter={item.onMouseEnter}\n onMouseLeave={item.onMouseLeave}\n onMouseOver={item.onMouseOver}\n onMouseOut={item.onMouseOut}\n data-value={\n typeof item.label === \"string\" ? item.label : String(item.key)\n }\n data-actual-selected={selected}\n // Render prop to use Base UI components\n render={\n inCombobox ? (\n <Combobox.Item\n role=\"option\"\n key={String(item.key)}\n value={String(item.key)}\n onClick={handler}\n />\n ) : (\n <Menu.Item onClick={handler} />\n )\n }\n >\n {item.label}\n </BaseMenuItem>\n );\n};\n"],"names":["DropdownMenuItem","item","inCombobox","selected","itemRender","itemLabelRender","itemProps","classNames","afterSelect","showCheckbox","indeterminate","getItemKeywords","cls","useCls","handler","useCallback","e","event","createSyntheticClickEvent","useMemo","reactNodeToString","clsx","jsx","BaseMenuItem","props","Combobox","Menu"],"mappings":";;;;;;;;;;AA0EO,MAAMA,IAAoD,CAAC;AAAA,EAChE,MAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,UAAAC,IAAW;AAAA,EACX,YAAAC;AAAA,EACA,iBAAAC;AAAA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A,eAAAC;AAAA,MACA,MAAMT,EAAK;AAAA,MACX,QAASC,IAA2B,SAAdD,EAAK;AAAA,MAC3B,YAAY;AAAA,QACV,MAAMoB;AAAA,UACJT;AAAA,YACE;AAAA,YACAV,KAAc;AAAA,UAAA;AAAA,UAEhBK,GAAY;AAAA,UACZN,EAAK;AAAA,QAAA;AAAA,QAEP,MAAMM,GAAY;AAAA,QAClB,MAAMA,GAAY;AAAA,QAClB,QAAQA,GAAY;AAAA,MAAA;AAAA,MAEtB,aACEF,IACI,CAACmB,MACCnB,EAAgBJ,GAAMuB,CAAK,IAC7B;AAAA,MAEN,KAAKvB,EAAK;AAAA,MACV,cAAcA,EAAK;AAAA,MACnB,cAAcA,EAAK;AAAA,MACnB,aAAaA,EAAK;AAAA,MAClB,YAAYA,EAAK;AAAA,MACjB,cACE,OAAOA,EAAK,SAAU,WAAWA,EAAK,QAAQ,OAAOA,EAAK,GAAG;AAAA,MAE/D,wBAAsBE;AAAA,MAEtB,QACED,IACE,gBAAAoB;AAAA,QAACG,EAAS;AAAA,QAAT;AAAA,UACC,MAAK;AAAA,UAEL,OAAO,OAAOxB,EAAK,GAAG;AAAA,UACtB,SAASa;AAAA,QAAA;AAAA,QAFJ,OAAOb,EAAK,GAAG;AAAA,MAAA,IAKtB,gBAAAqB,EAACI,EAAK,MAAL,EAAU,SAASZ,EAAA,CAAS;AAAA,MAIhC,UAAAb,EAAK;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.ds-dropdown-menu-search{margin-bottom:.25rem}.ds-dropdown-menu-header{font-size:.75rem;font-weight:500;line-height:1rem;text-transform:uppercase;color:var(--ds-color-text-tertiary);padding:.75rem .75rem .25rem}.ds-dropdown-menu-header:first-child{padding-top:.5rem}.ds-dropdown-menu-empty{padding:.375rem .75rem;color:var(--ds-color-text-tertiary)}.ds-dropdown-menu-match-trigger-width{width:min(var(--anchor-width),var(--available-width))}.ds-dropdown-menu-container{display:flex;flex-direction:column;flex-shrink:1;min-height:0}}
|
|
1
|
+
@layer components{.ds-dropdown-menu-search{margin-bottom:.25rem}.ds-dropdown-menu-header{font-size:.75rem;font-weight:500;line-height:1rem;text-transform:uppercase;color:var(--ds-color-text-tertiary);padding:.75rem .75rem .25rem}.ds-dropdown-menu-header:first-child{padding-top:.5rem}.ds-dropdown-menu-empty{padding:.375rem .75rem;color:var(--ds-color-text-tertiary)}.ds-dropdown-menu-empty:empty{display:none}.ds-dropdown-menu-match-trigger-width{width:min(var(--anchor-width),var(--available-width))}.ds-dropdown-menu-container{display:flex;flex-direction:column;flex-shrink:1;min-height:0}}
|
|
@@ -81,8 +81,8 @@ export type DropdownMenuItemType = {
|
|
|
81
81
|
*/
|
|
82
82
|
className?: string;
|
|
83
83
|
};
|
|
84
|
-
export
|
|
84
|
+
export type DropdownMenuGroup = {
|
|
85
85
|
label: React.ReactNode | null;
|
|
86
86
|
items: DropdownMenuItemType[];
|
|
87
|
-
}
|
|
87
|
+
};
|
|
88
88
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,oBAAoB,GAC5B;IACE;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;OAEG;IACH,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,oBAAoB,GAAG;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,KAAK,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;IAC9B,KAAK,EAAE,oBAAoB,EAAE,CAAC;CAC/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDropdownMenu.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu/useDropdownMenu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"useDropdownMenu.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu/useDropdownMenu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAMlE,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,KAAK,EAAE,oBAAoB,EAAE,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF;;OAEG;IACH,UAAU,CAAC,EAAE,CACX,IAAI,EAAE,oBAAoB,EAC1B,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,KACrC,KAAK,CAAC,YAAY,CAAC;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,CAChB,IAAI,EAAE,oBAAoB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAC7C,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,KACrC,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