@bioturing/components 0.41.1 → 0.42.0-beta.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/base.d.ts +1 -0
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +1 -0
- package/dist/base.js.map +1 -1
- package/dist/components/dropdown-menu/component.d.ts.map +1 -1
- package/dist/components/dropdown-menu/component.js +153 -155
- package/dist/components/dropdown-menu/component.js.map +1 -1
- package/dist/components/dropdown-menu/style.css +1 -1
- package/dist/components/form/FormItem/FormItemInput.d.ts +50 -0
- package/dist/components/form/FormItem/FormItemInput.d.ts.map +1 -0
- package/dist/components/form/FormItem/FormItemInput.js +137 -0
- package/dist/components/form/FormItem/FormItemInput.js.map +1 -0
- package/dist/components/form/FormItem/FormItemLabel.d.ts +48 -0
- package/dist/components/form/FormItem/FormItemLabel.d.ts.map +1 -0
- package/dist/components/form/FormItem/FormItemLabel.js +80 -0
- package/dist/components/form/FormItem/FormItemLabel.js.map +1 -0
- package/dist/components/form/FormItem/ItemHolder.d.ts +33 -0
- package/dist/components/form/FormItem/ItemHolder.d.ts.map +1 -0
- package/dist/components/form/FormItem/ItemHolder.js +168 -0
- package/dist/components/form/FormItem/ItemHolder.js.map +1 -0
- package/dist/components/form/FormItem/index.d.ts +106 -0
- package/dist/components/form/FormItem/index.d.ts.map +1 -0
- package/dist/components/form/FormItem/index.js +234 -0
- package/dist/components/form/FormItem/index.js.map +1 -0
- package/dist/components/form/component.d.ts +7 -1
- package/dist/components/form/component.d.ts.map +1 -1
- package/dist/components/form/component.js +4 -4
- package/dist/components/form/item.d.ts +27 -23
- package/dist/components/form/item.d.ts.map +1 -1
- package/dist/components/form/label.d.ts.map +1 -1
- package/dist/components/form/label.js +33 -31
- package/dist/components/form/label.js.map +1 -1
- package/dist/components/form/style.css +1 -1
- package/dist/components/toast/function.d.ts +1 -1
- package/dist/components/toast/function.d.ts.map +1 -1
- package/dist/components/utils/renderProp.d.ts +1 -1
- package/dist/components/utils/renderProp.d.ts.map +1 -1
- package/dist/components/utils/renderProp.js +16 -10
- package/dist/components/utils/renderProp.js.map +1 -1
- package/dist/stats.html +1 -1
- package/package.json +4 -3
- package/dist/components/form/item.js +0 -43
- package/dist/components/form/item.js.map +0 -1
package/dist/base.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { isWebKit, isIOS, isFirefox, isSafari, isEdge, isAndroid, isMac, isJSDOM
|
|
|
3
3
|
export { isJSDOM, expectType, type IfEquals } from '@base-ui/utils/testUtils';
|
|
4
4
|
export * from '@base-ui/utils/empty';
|
|
5
5
|
export * from '@base-ui/utils/error';
|
|
6
|
+
export * from '@base-ui/utils/fastHooks';
|
|
6
7
|
export * from '@base-ui/utils/fastObjectShallowCompare';
|
|
7
8
|
export * from '@base-ui/utils/formatErrorMessage';
|
|
8
9
|
export * from '@base-ui/utils/generateId';
|
package/dist/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAO/B,OAAO,EACL,QAAQ,EACR,KAAK,EACL,SAAS,EACT,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,OAAO,IAAI,wBAAwB,GACpC,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAG9E,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,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;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wCAAwC,CAAC;AACvD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AAGpC,cAAc,sBAAsB,CAAC"}
|
package/dist/base.js
CHANGED
|
@@ -3,6 +3,7 @@ import { isAndroid as t, isEdge as f, isFirefox as p, isIOS as x, isJSDOM as m,
|
|
|
3
3
|
import { expectType as D, isJSDOM as M } from "@base-ui/utils/testUtils";
|
|
4
4
|
export * from "@base-ui/utils/empty";
|
|
5
5
|
export * from "@base-ui/utils/error";
|
|
6
|
+
export * from "@base-ui/utils/fastHooks";
|
|
6
7
|
export * from "@base-ui/utils/fastObjectShallowCompare";
|
|
7
8
|
export * from "@base-ui/utils/formatErrorMessage";
|
|
8
9
|
export * from "@base-ui/utils/generateId";
|
package/dist/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu/component.tsx"],"names":[],"mappings":"AAC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OAGG;IACH,UAAU,CAAC,EAAE;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAEvC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,OAAO,cAAc,CAAC;IAC5C;;OAEG;IACH,WAAW,CAAC,EAAE;QACZ,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF;;;OAGG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,eAAO,MAAM,YAAY,GAAI,sWA0B1B,iBAAiB,4CA+MnB,CAAC"}
|
|
@@ -1,202 +1,200 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { Menu as
|
|
2
|
+
import { jsxs as p, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { Menu as d } from "@base-ui/react/menu";
|
|
4
4
|
import { Combobox as t } from "@base-ui/react/combobox";
|
|
5
|
-
import { useRef as
|
|
6
|
-
import { FormItemInputContext as
|
|
7
|
-
import { PopupPanelSize as
|
|
8
|
-
import { useDropdownMenu as
|
|
9
|
-
import { BaseMenu as
|
|
10
|
-
import { parseAntdPlacement as
|
|
11
|
-
import { useBaseUIPlacement as
|
|
12
|
-
import { ScrollArea as
|
|
13
|
-
import { DROPDOWN_COLLISION_AVOIDANCE as
|
|
14
|
-
import { Input as
|
|
15
|
-
import { createRenderProp as
|
|
16
|
-
import { useControlledState as
|
|
17
|
-
import { useCls as
|
|
18
|
-
import { useTheme as
|
|
19
|
-
import { clsx as
|
|
20
|
-
import { reactNodeToString as
|
|
21
|
-
const
|
|
22
|
-
children:
|
|
23
|
-
items:
|
|
24
|
-
placement:
|
|
25
|
-
openOnHover:
|
|
26
|
-
open:
|
|
27
|
-
onOpenChange:
|
|
28
|
-
defaultOpen:
|
|
29
|
-
className:
|
|
30
|
-
itemRender:
|
|
31
|
-
classNames:
|
|
32
|
-
size:
|
|
33
|
-
showSearch:
|
|
34
|
-
inCombobox:
|
|
35
|
-
searchProps:
|
|
5
|
+
import { useRef as oe, useState as D, useCallback as re } from "react";
|
|
6
|
+
import { FormItemInputContext as ne } from "antd/es/form/context";
|
|
7
|
+
import { PopupPanelSize as M } from "../popup-panel/constants.js";
|
|
8
|
+
import { useDropdownMenu as te } from "./useDropdownMenu.js";
|
|
9
|
+
import { BaseMenu as V } from "../base-menu/index.js";
|
|
10
|
+
import { parseAntdPlacement as ie } from "../utils/placement.js";
|
|
11
|
+
import { useBaseUIPlacement as me } from "../hooks/useBaseUIPlacement.js";
|
|
12
|
+
import { ScrollArea as E } from "../scroll-area/component.js";
|
|
13
|
+
import { DROPDOWN_COLLISION_AVOIDANCE as le } from "../utils/constants.js";
|
|
14
|
+
import { Input as pe } from "../input/component.js";
|
|
15
|
+
import { createRenderProp as de } from "../utils/renderProp.js";
|
|
16
|
+
import { useControlledState as ce } from "../hooks/useControlledState.js";
|
|
17
|
+
import { useCls as ue } from "../utils/antdUtils.js";
|
|
18
|
+
import { useTheme as ae } from "../theme-provider/context/themeStore.js";
|
|
19
|
+
import { clsx as c } from "../utils/cn.js";
|
|
20
|
+
import { reactNodeToString as se } from "../utils/reactToString.js";
|
|
21
|
+
const _e = ({
|
|
22
|
+
children: _,
|
|
23
|
+
items: j,
|
|
24
|
+
placement: k,
|
|
25
|
+
openOnHover: B,
|
|
26
|
+
open: G,
|
|
27
|
+
onOpenChange: H,
|
|
28
|
+
defaultOpen: L = !1,
|
|
29
|
+
className: U,
|
|
30
|
+
itemRender: z,
|
|
31
|
+
classNames: n,
|
|
32
|
+
size: C = "auto",
|
|
33
|
+
showSearch: u,
|
|
34
|
+
inCombobox: I,
|
|
35
|
+
searchProps: i = {
|
|
36
36
|
placeholder: "Search..."
|
|
37
37
|
},
|
|
38
|
-
popupMatchTriggerWidth:
|
|
39
|
-
beforeList:
|
|
40
|
-
afterList:
|
|
41
|
-
keepOpenOnSelect:
|
|
42
|
-
highlightedItemKey:
|
|
43
|
-
selectedItemKeys:
|
|
44
|
-
getItemKeywords:
|
|
45
|
-
showCheckbox:
|
|
46
|
-
itemLabelRender:
|
|
38
|
+
popupMatchTriggerWidth: F,
|
|
39
|
+
beforeList: f,
|
|
40
|
+
afterList: g,
|
|
41
|
+
keepOpenOnSelect: K,
|
|
42
|
+
highlightedItemKey: fe,
|
|
43
|
+
selectedItemKeys: W,
|
|
44
|
+
getItemKeywords: q,
|
|
45
|
+
showCheckbox: x,
|
|
46
|
+
itemLabelRender: J
|
|
47
47
|
}) => {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
),
|
|
53
|
-
items:
|
|
54
|
-
keepOpenOnSelect:
|
|
55
|
-
selectedItemKeys:
|
|
56
|
-
showCheckbox:
|
|
57
|
-
getItemKeywords:
|
|
58
|
-
itemLabelRender:
|
|
59
|
-
itemRender:
|
|
60
|
-
inCombobox:
|
|
61
|
-
onOpenChange:
|
|
48
|
+
const Q = typeof I == "boolean" ? I : u, [h, P] = ce(
|
|
49
|
+
G,
|
|
50
|
+
H,
|
|
51
|
+
L
|
|
52
|
+
), r = ue(), { className: N } = ae(), a = ie(k), X = oe(null), { itemGroups: w, renderGroup: b } = te({
|
|
53
|
+
items: j,
|
|
54
|
+
keepOpenOnSelect: K,
|
|
55
|
+
selectedItemKeys: W,
|
|
56
|
+
showCheckbox: x,
|
|
57
|
+
getItemKeywords: q,
|
|
58
|
+
itemLabelRender: J,
|
|
59
|
+
itemRender: z,
|
|
60
|
+
inCombobox: Q,
|
|
61
|
+
onOpenChange: P,
|
|
62
62
|
classNames: {
|
|
63
|
-
item:
|
|
64
|
-
itemIcon:
|
|
65
|
-
itemSuffix:
|
|
66
|
-
group:
|
|
67
|
-
groupLabel:
|
|
68
|
-
divider:
|
|
63
|
+
item: n?.item,
|
|
64
|
+
itemIcon: n?.itemIcon,
|
|
65
|
+
itemSuffix: n?.itemSuffix,
|
|
66
|
+
group: n?.group,
|
|
67
|
+
groupLabel: n?.groupLabel,
|
|
68
|
+
divider: n?.divider
|
|
69
69
|
}
|
|
70
|
-
}), [
|
|
70
|
+
}), [S, Y] = D(""), [Z, $] = D(
|
|
71
71
|
null
|
|
72
|
-
),
|
|
73
|
-
positionerRef:
|
|
74
|
-
open:
|
|
75
|
-
initialSide:
|
|
76
|
-
initialAlign:
|
|
77
|
-
}),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return /* @__PURE__ */ c("div", { className: n("dropdown-menu-container"), children: [
|
|
84
|
-
g,
|
|
85
|
-
/* @__PURE__ */ e(_, { fadeEdges: !0, children: S.map(w) }),
|
|
86
|
-
h
|
|
72
|
+
), { currentSide: ee } = me({
|
|
73
|
+
positionerRef: Z,
|
|
74
|
+
open: h,
|
|
75
|
+
initialSide: a.side,
|
|
76
|
+
initialAlign: a.align
|
|
77
|
+
}), O = ee === "top", R = re(() => {
|
|
78
|
+
if (!u)
|
|
79
|
+
return /* @__PURE__ */ p("div", { className: r("dropdown-menu-container"), children: [
|
|
80
|
+
f,
|
|
81
|
+
/* @__PURE__ */ e(E, { fadeEdges: !0, children: w.map(b) }),
|
|
82
|
+
g
|
|
87
83
|
] });
|
|
88
|
-
const o = /* @__PURE__ */ e(
|
|
84
|
+
const o = /* @__PURE__ */ e(ne.Provider, { value: {}, children: /* @__PURE__ */ e(
|
|
89
85
|
t.Input,
|
|
90
86
|
{
|
|
91
|
-
placeholder:
|
|
92
|
-
render: ({ ref:
|
|
93
|
-
|
|
87
|
+
placeholder: i?.placeholder || "Search",
|
|
88
|
+
render: ({ ref: s, ...m }) => /* @__PURE__ */ e(
|
|
89
|
+
pe,
|
|
94
90
|
{
|
|
95
91
|
...m,
|
|
96
|
-
ref: (
|
|
97
|
-
if (!
|
|
98
|
-
|
|
92
|
+
ref: (l) => {
|
|
93
|
+
if (!l || !l.input) return;
|
|
94
|
+
s(l.input);
|
|
99
95
|
},
|
|
100
96
|
allowClear: !0,
|
|
101
|
-
placeholder:
|
|
102
|
-
value:
|
|
103
|
-
onChange: (
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
onBlur: () => {
|
|
108
|
-
x.current = !1;
|
|
109
|
-
},
|
|
110
|
-
className: f(
|
|
111
|
-
n("dropdown-menu-search"),
|
|
112
|
-
l?.className
|
|
97
|
+
placeholder: i?.placeholder || "Search",
|
|
98
|
+
value: S,
|
|
99
|
+
onChange: (l) => Y(l.target.value),
|
|
100
|
+
className: c(
|
|
101
|
+
r("dropdown-menu-search"),
|
|
102
|
+
i?.className
|
|
113
103
|
)
|
|
114
104
|
}
|
|
115
105
|
),
|
|
116
|
-
...
|
|
106
|
+
...i
|
|
117
107
|
},
|
|
118
108
|
"search"
|
|
119
|
-
) }),
|
|
120
|
-
/* @__PURE__ */ e(t.Empty, { className:
|
|
121
|
-
/* @__PURE__ */ e(t.List, { className:
|
|
109
|
+
) }), v = /* @__PURE__ */ p(E, { fadeEdges: !0, children: [
|
|
110
|
+
/* @__PURE__ */ e(t.Empty, { className: r("dropdown-menu-empty"), children: "No results found." }),
|
|
111
|
+
/* @__PURE__ */ e(t.List, { className: r("dropdown-menu-list"), children: (s, m) => b(s, m) })
|
|
122
112
|
] });
|
|
123
|
-
return /* @__PURE__ */
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
113
|
+
return /* @__PURE__ */ p("div", { className: r("dropdown-menu-container"), children: [
|
|
114
|
+
/* @__PURE__ */ e(
|
|
115
|
+
"div",
|
|
116
|
+
{
|
|
117
|
+
className: c(
|
|
118
|
+
r("dropdown-menu-search-wrapper"),
|
|
119
|
+
O && r("dropdown-menu-search-wrapper-bottom")
|
|
120
|
+
),
|
|
121
|
+
children: o
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
f,
|
|
125
|
+
v,
|
|
126
|
+
g
|
|
129
127
|
] });
|
|
130
128
|
}, [
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
C,
|
|
135
|
-
g,
|
|
136
|
-
h,
|
|
129
|
+
u,
|
|
130
|
+
r,
|
|
131
|
+
i,
|
|
137
132
|
S,
|
|
133
|
+
f,
|
|
134
|
+
g,
|
|
138
135
|
w,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
136
|
+
b,
|
|
137
|
+
O
|
|
138
|
+
]), y = {
|
|
139
|
+
ref: X,
|
|
142
140
|
// nativeButton: false,
|
|
143
|
-
openOnHover:
|
|
144
|
-
className:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
141
|
+
openOnHover: B,
|
|
142
|
+
className: c(
|
|
143
|
+
r("dropdown-menu-trigger"),
|
|
144
|
+
n?.trigger,
|
|
145
|
+
N
|
|
148
146
|
),
|
|
149
|
-
render: (o,
|
|
150
|
-
const { openOnHover:
|
|
151
|
-
return
|
|
147
|
+
render: (o, v) => {
|
|
148
|
+
const { openOnHover: s, ...m } = o;
|
|
149
|
+
return de(_, m, v);
|
|
152
150
|
}
|
|
153
|
-
},
|
|
154
|
-
ref:
|
|
155
|
-
side:
|
|
156
|
-
align:
|
|
151
|
+
}, T = {
|
|
152
|
+
ref: $,
|
|
153
|
+
side: a.side,
|
|
154
|
+
align: a.align,
|
|
157
155
|
sideOffset: 4,
|
|
158
|
-
className:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
156
|
+
className: c(
|
|
157
|
+
r("dropdown-menu-root"),
|
|
158
|
+
N,
|
|
159
|
+
n?.root
|
|
162
160
|
),
|
|
163
|
-
collisionAvoidance:
|
|
164
|
-
render: (o) => /* @__PURE__ */ e(
|
|
165
|
-
},
|
|
166
|
-
className:
|
|
167
|
-
|
|
161
|
+
collisionAvoidance: le,
|
|
162
|
+
render: (o) => /* @__PURE__ */ e(V.Root, { ...o })
|
|
163
|
+
}, A = {
|
|
164
|
+
className: c(
|
|
165
|
+
r(
|
|
168
166
|
"dropdown-menu",
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
x && "dropdown-menu-show-checkbox",
|
|
168
|
+
F && "dropdown-menu-match-trigger-width"
|
|
171
169
|
),
|
|
172
|
-
|
|
173
|
-
|
|
170
|
+
U,
|
|
171
|
+
n?.popup
|
|
174
172
|
),
|
|
175
173
|
style: {
|
|
176
|
-
"--size-width":
|
|
174
|
+
"--size-width": C in M ? M[C] : void 0
|
|
177
175
|
},
|
|
178
|
-
render: (o) => /* @__PURE__ */ e(
|
|
176
|
+
render: (o) => /* @__PURE__ */ e(V.Popup, { ...o })
|
|
179
177
|
};
|
|
180
|
-
return
|
|
178
|
+
return u ? /* @__PURE__ */ p(
|
|
181
179
|
t.Root,
|
|
182
180
|
{
|
|
183
|
-
open:
|
|
184
|
-
onOpenChange:
|
|
185
|
-
items:
|
|
186
|
-
itemToStringLabel: (o) => o.type == "item" ?
|
|
181
|
+
open: h,
|
|
182
|
+
onOpenChange: P,
|
|
183
|
+
items: w,
|
|
184
|
+
itemToStringLabel: (o) => o.type == "item" ? se(o.label) : "",
|
|
187
185
|
itemToStringValue: (o) => o.type == "item" ? String(o.key) : "",
|
|
188
|
-
inputValue:
|
|
186
|
+
inputValue: S,
|
|
189
187
|
children: [
|
|
190
|
-
/* @__PURE__ */ e(t.Trigger, { ...
|
|
191
|
-
/* @__PURE__ */ e(t.Portal, { children: /* @__PURE__ */ e(t.Positioner, { ...
|
|
188
|
+
/* @__PURE__ */ e(t.Trigger, { ...y }),
|
|
189
|
+
/* @__PURE__ */ e(t.Portal, { children: /* @__PURE__ */ e(t.Positioner, { ...T, children: /* @__PURE__ */ e(t.Popup, { ...A, children: R() }) }) })
|
|
192
190
|
]
|
|
193
191
|
}
|
|
194
|
-
) : /* @__PURE__ */
|
|
195
|
-
/* @__PURE__ */ e(
|
|
196
|
-
/* @__PURE__ */ e(
|
|
192
|
+
) : /* @__PURE__ */ p(d.Root, { open: h, onOpenChange: P, children: [
|
|
193
|
+
/* @__PURE__ */ e(d.Trigger, { ...y }),
|
|
194
|
+
/* @__PURE__ */ e(d.Portal, { children: /* @__PURE__ */ e(d.Positioner, { ...T, children: /* @__PURE__ */ e(d.Popup, { ...A, children: R() }) }) })
|
|
197
195
|
] });
|
|
198
196
|
};
|
|
199
197
|
export {
|
|
200
|
-
|
|
198
|
+
_e as DropdownMenu
|
|
201
199
|
};
|
|
202
200
|
//# 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/react/menu\";\nimport { Combobox } from \"@base-ui/react/combobox\";\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { useCallback, useRef, useState, RefCallback, useEffect } from \"react\";\nimport {\n clsx,\n DROPDOWN_COLLISION_AVOIDANCE,\n parseAntdPlacement,\n reactNodeToString,\n useCls,\n createRenderProp,\n} from \"../utils\";\nimport { useBaseUIPlacement } from \"../hooks\";\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 const [positionerRef, setPositionerRef] = useState<HTMLDivElement | null>(\n null\n );\n const inputRef = useRef<HTMLInputElement | null>(null);\n const wasFocusedRef = useRef(false);\n\n // Track placement changes to conditionally position search input\n const { currentSide } = useBaseUIPlacement({\n positionerRef,\n open,\n initialSide: baseUIPlacement.side,\n initialAlign: baseUIPlacement.align,\n });\n\n // When placement is on top, move search to bottom for better UX\n const isTopPlacement = currentSide === \"top\";\n\n // Restore focus after placement changes\n useEffect(() => {\n if (wasFocusedRef.current && inputRef.current) {\n inputRef.current.focus();\n // Don't reset wasFocusedRef - let onBlur handle it\n }\n }, [isTopPlacement]);\n\n const renderMenuInner = useCallback(() => {\n if (!showSearch) {\n return (\n <div className={cls(\"dropdown-menu-container\")}>\n {beforeList}\n <ScrollArea fadeEdges>{itemGroups.map(renderGroup)}</ScrollArea>\n {afterList}\n </div>\n );\n }\n\n const searchInput = (\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 inputRef.current = antdInputRef.input;\n }}\n allowClear\n placeholder={searchProps?.placeholder || \"Search\"}\n value={searchValue}\n onChange={(e) => setSearchValue(e.target.value)}\n onFocus={() => {\n wasFocusedRef.current = true;\n }}\n onBlur={() => {\n wasFocusedRef.current = false;\n }}\n className={clsx(\n cls(\"dropdown-menu-search\"),\n searchProps?.className\n )}\n />\n )}\n {...searchProps}\n />\n </FormItemInputContext.Provider>\n );\n\n const listContent = (\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 );\n\n return (\n <div className={cls(\"dropdown-menu-container\")}>\n {!isTopPlacement && searchInput}\n {beforeList}\n {listContent}\n {afterList}\n {isTopPlacement && searchInput}\n </div>\n );\n }, [\n showSearch,\n cls,\n searchProps,\n searchValue,\n beforeList,\n afterList,\n itemGroups,\n renderGroup,\n isTopPlacement,\n ]);\n\n const commonTriggerProps = {\n ref: buttonRef,\n // nativeButton: false,\n openOnHover,\n className: clsx(\n cls(\"dropdown-menu-trigger\"),\n classNames?.trigger,\n themeClassName\n ),\n render: (props, state) => {\n const { openOnHover: _openOnHover, ...rest } = props;\n return createRenderProp(children, rest, state);\n },\n };\n\n const commonPositionerProps = {\n ref: setPositionerRef,\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","positionerRef","setPositionerRef","inputRef","wasFocusedRef","currentSide","useBaseUIPlacement","isTopPlacement","useEffect","renderMenuInner","useCallback","jsxs","ScrollArea","searchInput","jsx","FormItemInputContext","Combobox","ref","props","Input","antdInputRef","e","clsx","listContent","group","i","commonTriggerProps","state","_openOnHover","rest","createRenderProp","commonPositionerProps","DROPDOWN_COLLISION_AVOIDANCE","BaseMenu","commonPopupProps","PopupPanelSize","item","reactNodeToString","Menu"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0GO,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;AAAA,EAAA;AAAA,EAEf,wBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,iBAAAC;AACF,MAAyB;AACvB,QAAMC,IACJ,OAAOX,KAAmB,YAAYA,IAAiBD,GACnD,CAACa,GAAMC,CAAY,IAAIC;AAAA,IAC3BtB;AAAA,IACAC;AAAA,IACAC;AAAA,EAAA,GAEIqB,IAAMC,GAAA,GACN,EAAE,WAAWC,EAAA,IAAmBC,GAAA,GAChCC,IAAkBC,GAAmB9B,CAAS,GAC9C+B,IAAYC,EAA0B,IAAI,GAC1C,EAAE,YAAAC,GAAY,aAAAC,EAAA,IAAgBC,GAAgB;AAAA,IAClD,OAAApC;AAAA,IACA,kBAAAgB;AAAA,IAEA,kBAAAE;AAAA,IACA,cAAAE;AAAA,IACA,iBAAAD;AAAA,IACA,iBAAAE;AAAA,IACA,YAAAd;AAAA,IACA,YAAAe;AAAA,IACA,cAAAE;AAAA,IACA,YAAY;AAAA,MACV,MAAMhB,GAAY;AAAA,M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T,EACC,UAAA,gBAAAF,EAACE,EAAS,YAAT,EAAqB,GAAGe,GACvB,UAAA,gBAAAjB,EAACE,EAAS,OAAT,EAAgB,GAAGkB,GACjB,UAAAzB,EAAA,GACH,GACF,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAGF,gBAAAE,EAAC2B,EAAK,MAAL,EAAU,MAAAtD,GAAY,cAAAC,GACrB,UAAA;AAAA,IAAA,gBAAA6B,EAACwB,EAAK,SAAL,EAAc,GAAGZ,EAAA,CAAoB;AAAA,sBACrCY,EAAK,QAAL,EACC,UAAA,gBAAAxB,EAACwB,EAAK,YAAL,EAAiB,GAAGP,GACnB,UAAA,gBAAAjB,EAACwB,EAAK,OAAL,EAAY,GAAGJ,GAAmB,UAAAzB,EAAA,GAAkB,GACvD,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/dropdown-menu/component.tsx"],"sourcesContent":["\"use client\";\nimport { Menu } from \"@base-ui/react/menu\";\nimport { Combobox } from \"@base-ui/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 createRenderProp,\n} from \"../utils\";\nimport { useBaseUIPlacement } from \"../hooks\";\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 extends Omit<\n UseDropdownMenuProps,\n \"classNames\"\n> {\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 const [positionerRef, setPositionerRef] = useState<HTMLDivElement | null>(\n null,\n );\n\n // Track placement changes to conditionally position search input\n const { currentSide } = useBaseUIPlacement({\n positionerRef,\n open,\n initialSide: baseUIPlacement.side,\n initialAlign: baseUIPlacement.align,\n });\n\n // When placement is on top, move search to bottom for better UX\n const isTopPlacement = currentSide === \"top\";\n\n const renderMenuInner = useCallback(() => {\n if (!showSearch) {\n return (\n <div className={cls(\"dropdown-menu-container\")}>\n {beforeList}\n <ScrollArea fadeEdges>{itemGroups.map(renderGroup)}</ScrollArea>\n {afterList}\n </div>\n );\n }\n\n const searchInput = (\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 );\n\n const listContent = (\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 );\n\n return (\n <div className={cls(\"dropdown-menu-container\")}>\n <div\n className={clsx(\n cls(\"dropdown-menu-search-wrapper\"),\n isTopPlacement && cls(\"dropdown-menu-search-wrapper-bottom\"),\n )}\n >\n {searchInput}\n </div>\n {beforeList}\n {listContent}\n {afterList}\n </div>\n );\n }, [\n showSearch,\n cls,\n searchProps,\n searchValue,\n beforeList,\n afterList,\n itemGroups,\n renderGroup,\n isTopPlacement,\n ]);\n\n const commonTriggerProps = {\n ref: buttonRef,\n // nativeButton: false,\n openOnHover,\n className: clsx(\n cls(\"dropdown-menu-trigger\"),\n classNames?.trigger,\n themeClassName,\n ),\n render: (props, state) => {\n const { openOnHover: _openOnHover, ...rest } = props;\n return createRenderProp(children, rest, state);\n },\n };\n\n const commonPositionerProps = {\n ref: setPositionerRef,\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","positionerRef","setPositionerRef","currentSide","useBaseUIPlacement","isTopPlacement","renderMenuInner","useCallback","jsxs","ScrollArea","searchInput","jsx","FormItemInputContext","Combobox","ref","props","Input","antdInputRef","e","clsx","listContent","group","i","commonTriggerProps","state","_openOnHover","rest","createRenderProp","commonPositionerProps","DROPDOWN_COLLISION_AVOIDANCE","BaseMenu","commonPopupProps","PopupPanelSize","item","reactNodeToString","Menu"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4GO,MAAMA,KAAe,CAAC;AAAA,EAC3B,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAMC;AAAA,EAC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;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.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;gap:.25rem}}
|
|
1
|
+
@layer components{.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;gap:.25rem}.ds-dropdown-menu-search-wrapper{order:-1}.ds-dropdown-menu-search-wrapper-bottom{order:1}}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { ColProps } from 'antd/es/grid/col';
|
|
3
|
+
import { ValidateStatus } from 'antd/es/form/FormItem';
|
|
4
|
+
/**
|
|
5
|
+
* This file is copied from Ant Design 5.x-stable
|
|
6
|
+
* Source: https://github.com/ant-design/ant-design/blob/5.x-stable/components/form/FormItemInput.tsx
|
|
7
|
+
*
|
|
8
|
+
* Customizations for @bioturing/components:
|
|
9
|
+
* - Added `classNames` prop for styling control, input, error, and extra elements
|
|
10
|
+
*
|
|
11
|
+
* Last synced with antd version: 5.x-stable (2025-02-04)
|
|
12
|
+
*/
|
|
13
|
+
import * as React from "react";
|
|
14
|
+
interface FormItemInputMiscProps {
|
|
15
|
+
prefixCls: string;
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
errors: React.ReactNode[];
|
|
18
|
+
warnings: React.ReactNode[];
|
|
19
|
+
marginBottom?: number | null;
|
|
20
|
+
onErrorVisibleChanged?: (visible: boolean) => void;
|
|
21
|
+
/** @internal do not use in any of your production. */
|
|
22
|
+
_internalItemRender?: {
|
|
23
|
+
mark: string;
|
|
24
|
+
render: (props: FormItemInputProps & FormItemInputMiscProps, domList: {
|
|
25
|
+
input: JSX.Element;
|
|
26
|
+
errorList: JSX.Element | null;
|
|
27
|
+
extra: JSX.Element | null;
|
|
28
|
+
}) => React.ReactNode;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface FormItemInputProps {
|
|
32
|
+
labelCol?: ColProps;
|
|
33
|
+
wrapperCol?: ColProps;
|
|
34
|
+
extra?: React.ReactNode;
|
|
35
|
+
status?: ValidateStatus;
|
|
36
|
+
help?: React.ReactNode;
|
|
37
|
+
fieldId?: string;
|
|
38
|
+
label?: React.ReactNode;
|
|
39
|
+
classNames?: {
|
|
40
|
+
control?: string;
|
|
41
|
+
controlInput?: string;
|
|
42
|
+
controlInputContent?: string;
|
|
43
|
+
additional?: string;
|
|
44
|
+
explain?: string;
|
|
45
|
+
extra?: string;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
declare const FormItemInput: React.FC<FormItemInputProps & FormItemInputMiscProps>;
|
|
49
|
+
export default FormItemInput;
|
|
50
|
+
//# sourceMappingURL=FormItemInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormItemInput.d.ts","sourceRoot":"","sources":["../../../../src/components/form/FormItem/FormItemInput.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAQjC,OAAO,KAAK,EAAE,QAA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