@bioturing/components 0.42.0 → 0.43.0
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/button/component.d.ts.map +1 -1
- package/dist/components/button/component.js +41 -34
- package/dist/components/button/component.js.map +1 -1
- package/dist/components/button/style.css +1 -1
- package/dist/components/combobox/component.d.ts.map +1 -1
- package/dist/components/combobox/component.js +136 -126
- package/dist/components/combobox/component.js.map +1 -1
- package/dist/components/command-palette/component.d.ts +7 -0
- package/dist/components/command-palette/component.d.ts.map +1 -1
- package/dist/components/command-palette/component.js +35 -33
- package/dist/components/command-palette/component.js.map +1 -1
- package/dist/components/dropdown-menu/component.d.ts +8 -1
- package/dist/components/dropdown-menu/component.d.ts.map +1 -1
- package/dist/components/dropdown-menu/component.js +165 -141
- package/dist/components/dropdown-menu/component.js.map +1 -1
- package/dist/components/dropdown-menu/style.css +1 -1
- package/dist/components/ds-root/component.d.ts +6 -1
- package/dist/components/ds-root/component.d.ts.map +1 -1
- package/dist/components/ds-root/component.js +15 -14
- package/dist/components/ds-root/component.js.map +1 -1
- package/dist/components/form/style.css +1 -1
- package/dist/components/hooks/index.d.ts +0 -1
- package/dist/components/hooks/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/label-with-help/component.d.ts +20 -0
- package/dist/components/label-with-help/component.d.ts.map +1 -0
- package/dist/components/label-with-help/component.js +39 -0
- package/dist/components/label-with-help/component.js.map +1 -0
- package/dist/components/label-with-help/index.d.ts +2 -0
- package/dist/components/label-with-help/index.d.ts.map +1 -0
- package/dist/components/label-with-help/style.css +1 -0
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +157 -133
- package/dist/components/modal/Modal.js.map +1 -1
- package/dist/components/popup-panel/component.d.ts +2 -111
- package/dist/components/popup-panel/component.d.ts.map +1 -1
- package/dist/components/popup-panel/component.js +253 -139
- package/dist/components/popup-panel/component.js.map +1 -1
- package/dist/components/popup-panel/constants.d.ts +1 -0
- package/dist/components/popup-panel/constants.d.ts.map +1 -1
- package/dist/components/popup-panel/constants.js +2 -0
- package/dist/components/popup-panel/constants.js.map +1 -1
- package/dist/components/popup-panel/index.d.ts +1 -0
- package/dist/components/popup-panel/index.d.ts.map +1 -1
- package/dist/components/popup-panel/types.d.ts +124 -0
- package/dist/components/popup-panel/types.d.ts.map +1 -0
- package/dist/components/popup-panel/utils.d.ts +1 -1
- package/dist/components/popup-panel/utils.d.ts.map +1 -1
- package/dist/components/popup-panel/utils.js +5 -5
- package/dist/components/popup-panel/utils.js.map +1 -1
- package/dist/components/resizable/component.d.ts.map +1 -1
- package/dist/components/resizable/component.js +28 -28
- package/dist/components/resizable/component.js.map +1 -1
- package/dist/components/select/component.d.ts.map +1 -1
- package/dist/components/select/component.js +130 -120
- package/dist/components/select/component.js.map +1 -1
- package/dist/components/toast/component.d.ts +2 -2
- package/dist/components/toast/component.d.ts.map +1 -1
- package/dist/components/toast/component.js +14 -20
- package/dist/components/toast/component.js.map +1 -1
- package/dist/components/toast/function.d.ts +7 -8
- package/dist/components/toast/function.d.ts.map +1 -1
- package/dist/components/toast/function.js.map +1 -1
- package/dist/components/toast/style.css +1 -1
- package/dist/components/toast/types.d.ts +4 -0
- package/dist/components/toast/types.d.ts.map +1 -1
- package/dist/components/utils/placement.d.ts +9 -2
- package/dist/components/utils/placement.d.ts.map +1 -1
- package/dist/components/utils/placement.js +29 -18
- package/dist/components/utils/placement.js.map +1 -1
- package/dist/components/utils/reactElement.d.ts +2 -0
- package/dist/components/utils/reactElement.d.ts.map +1 -1
- package/dist/components/utils/reactElement.js +10 -2
- package/dist/components/utils/reactElement.js.map +1 -1
- package/dist/components/utils/renderProp.d.ts.map +1 -1
- package/dist/components/utils/renderProp.js +9 -8
- package/dist/components/utils/renderProp.js.map +1 -1
- package/dist/index.js +191 -189
- package/dist/metadata.d.ts +8 -0
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +15 -0
- package/dist/metadata.js.map +1 -1
- package/dist/stats.html +1 -1
- package/package.json +2 -2
- package/dist/components/hooks/useBaseUIPlacement.d.ts +0 -64
- package/dist/components/hooks/useBaseUIPlacement.d.ts.map +0 -1
- package/dist/components/hooks/useBaseUIPlacement.js +0 -61
- package/dist/components/hooks/useBaseUIPlacement.js.map +0 -1
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { Menu as
|
|
2
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { Menu as l } 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 {
|
|
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";
|
|
5
|
+
import { useRef as ne, useState as te, useCallback as g, useMemo as f } from "react";
|
|
6
|
+
import { FormItemInputContext as ie } from "antd/es/form/context";
|
|
7
|
+
import { PopupPanelSize as K } from "../popup-panel/constants.js";
|
|
8
|
+
import { useDropdownMenu as pe } from "./useDropdownMenu.js";
|
|
9
|
+
import { BaseMenu as U } from "../base-menu/index.js";
|
|
10
|
+
import { parseAntdPlacement as me } from "../utils/placement.js";
|
|
11
|
+
import { ScrollArea as q } from "../scroll-area/component.js";
|
|
15
12
|
import { createRenderProp as de } from "../utils/renderProp.js";
|
|
13
|
+
import { DROPDOWN_COLLISION_AVOIDANCE as le } from "../utils/constants.js";
|
|
14
|
+
import { Input as ue } from "../input/component.js";
|
|
16
15
|
import { useControlledState as ce } from "../hooks/useControlledState.js";
|
|
17
|
-
import { useCls as
|
|
18
|
-
import { useTheme as
|
|
19
|
-
import { clsx as
|
|
20
|
-
import { reactNodeToString as
|
|
16
|
+
import { useCls as ae } from "../utils/antdUtils.js";
|
|
17
|
+
import { useTheme as se } from "../theme-provider/context/themeStore.js";
|
|
18
|
+
import { clsx as h } from "../utils/cn.js";
|
|
19
|
+
import { reactNodeToString as ge } from "../utils/reactToString.js";
|
|
21
20
|
const _e = ({
|
|
22
|
-
children:
|
|
23
|
-
items:
|
|
24
|
-
placement:
|
|
25
|
-
openOnHover:
|
|
26
|
-
open:
|
|
27
|
-
onOpenChange:
|
|
28
|
-
defaultOpen:
|
|
29
|
-
className:
|
|
30
|
-
itemRender:
|
|
21
|
+
children: y,
|
|
22
|
+
items: z,
|
|
23
|
+
placement: B,
|
|
24
|
+
openOnHover: O,
|
|
25
|
+
open: J,
|
|
26
|
+
onOpenChange: Q,
|
|
27
|
+
defaultOpen: W = !1,
|
|
28
|
+
className: N,
|
|
29
|
+
itemRender: X,
|
|
31
30
|
classNames: n,
|
|
32
|
-
size:
|
|
31
|
+
size: P = "auto",
|
|
33
32
|
showSearch: u,
|
|
34
|
-
inCombobox:
|
|
33
|
+
inCombobox: T,
|
|
35
34
|
searchProps: i = {
|
|
36
35
|
placeholder: "Search..."
|
|
37
36
|
},
|
|
38
|
-
popupMatchTriggerWidth:
|
|
39
|
-
beforeList:
|
|
40
|
-
afterList:
|
|
41
|
-
keepOpenOnSelect:
|
|
37
|
+
popupMatchTriggerWidth: A,
|
|
38
|
+
beforeList: b,
|
|
39
|
+
afterList: w,
|
|
40
|
+
keepOpenOnSelect: Y,
|
|
42
41
|
highlightedItemKey: fe,
|
|
43
|
-
selectedItemKeys:
|
|
44
|
-
getItemKeywords:
|
|
45
|
-
showCheckbox:
|
|
46
|
-
itemLabelRender:
|
|
42
|
+
selectedItemKeys: Z,
|
|
43
|
+
getItemKeywords: $,
|
|
44
|
+
showCheckbox: S,
|
|
45
|
+
itemLabelRender: ee,
|
|
46
|
+
nativeButton: D = !0
|
|
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 oe = typeof T == "boolean" ? T : u, [M, C] = ce(
|
|
49
|
+
J,
|
|
50
|
+
Q,
|
|
51
|
+
W
|
|
52
|
+
), o = ae(), { className: c } = se(), a = me(B), V = ne(null), { itemGroups: v, renderGroup: I } = pe({
|
|
53
|
+
items: z,
|
|
54
|
+
keepOpenOnSelect: Y,
|
|
55
|
+
selectedItemKeys: Z,
|
|
56
|
+
showCheckbox: S,
|
|
57
|
+
getItemKeywords: $,
|
|
58
|
+
itemLabelRender: ee,
|
|
59
|
+
itemRender: X,
|
|
60
|
+
inCombobox: oe,
|
|
61
|
+
onOpenChange: C,
|
|
62
62
|
classNames: {
|
|
63
63
|
item: n?.item,
|
|
64
64
|
itemIcon: n?.itemIcon,
|
|
@@ -67,38 +67,31 @@ const _e = ({
|
|
|
67
67
|
groupLabel: n?.groupLabel,
|
|
68
68
|
divider: n?.divider
|
|
69
69
|
}
|
|
70
|
-
}), [
|
|
71
|
-
null
|
|
72
|
-
), { currentSide: ee } = me({
|
|
73
|
-
positionerRef: Z,
|
|
74
|
-
open: h,
|
|
75
|
-
initialSide: a.side,
|
|
76
|
-
initialAlign: a.align
|
|
77
|
-
}), O = ee === "top", R = re(() => {
|
|
70
|
+
}), [x, re] = te(""), E = g(() => {
|
|
78
71
|
if (!u)
|
|
79
|
-
return /* @__PURE__ */
|
|
80
|
-
|
|
81
|
-
/* @__PURE__ */ e(
|
|
82
|
-
|
|
72
|
+
return /* @__PURE__ */ d("div", { className: o("dropdown-menu-container"), children: [
|
|
73
|
+
b,
|
|
74
|
+
/* @__PURE__ */ e(q, { fadeEdges: !0, children: v.map(I) }),
|
|
75
|
+
w
|
|
83
76
|
] });
|
|
84
|
-
const
|
|
77
|
+
const r = /* @__PURE__ */ e(ie.Provider, { value: {}, children: /* @__PURE__ */ e(
|
|
85
78
|
t.Input,
|
|
86
79
|
{
|
|
87
80
|
placeholder: i?.placeholder || "Search",
|
|
88
|
-
render: ({ ref: s, ...
|
|
89
|
-
|
|
81
|
+
render: ({ ref: s, ...p }) => /* @__PURE__ */ e(
|
|
82
|
+
ue,
|
|
90
83
|
{
|
|
91
|
-
...
|
|
92
|
-
ref: (
|
|
93
|
-
if (!
|
|
94
|
-
s(
|
|
84
|
+
...p,
|
|
85
|
+
ref: (m) => {
|
|
86
|
+
if (!m || !m.input) return;
|
|
87
|
+
s(m.input);
|
|
95
88
|
},
|
|
96
89
|
allowClear: !0,
|
|
97
90
|
placeholder: i?.placeholder || "Search",
|
|
98
|
-
value:
|
|
99
|
-
onChange: (
|
|
100
|
-
className:
|
|
101
|
-
|
|
91
|
+
value: x,
|
|
92
|
+
onChange: (m) => re(m.target.value),
|
|
93
|
+
className: h(
|
|
94
|
+
o("dropdown-menu-search"),
|
|
102
95
|
i?.className
|
|
103
96
|
)
|
|
104
97
|
}
|
|
@@ -106,92 +99,123 @@ const _e = ({
|
|
|
106
99
|
...i
|
|
107
100
|
},
|
|
108
101
|
"search"
|
|
109
|
-
) }),
|
|
110
|
-
/* @__PURE__ */ e(t.Empty, { className:
|
|
111
|
-
/* @__PURE__ */ e(t.List, { className:
|
|
102
|
+
) }), R = /* @__PURE__ */ d(q, { fadeEdges: !0, children: [
|
|
103
|
+
/* @__PURE__ */ e(t.Empty, { className: o("dropdown-menu-empty"), children: "No results found." }),
|
|
104
|
+
/* @__PURE__ */ e(t.List, { className: o("dropdown-menu-list"), children: (s, p) => I(s, p) })
|
|
112
105
|
] });
|
|
113
|
-
return /* @__PURE__ */
|
|
106
|
+
return /* @__PURE__ */ d("div", { className: o("dropdown-menu-container"), children: [
|
|
114
107
|
/* @__PURE__ */ e(
|
|
115
108
|
"div",
|
|
116
109
|
{
|
|
117
|
-
className:
|
|
118
|
-
|
|
119
|
-
O && r("dropdown-menu-search-wrapper-bottom")
|
|
120
|
-
),
|
|
121
|
-
children: o
|
|
110
|
+
className: o("dropdown-menu-search-wrapper"),
|
|
111
|
+
children: r
|
|
122
112
|
}
|
|
123
113
|
),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
114
|
+
b,
|
|
115
|
+
R,
|
|
116
|
+
w
|
|
127
117
|
] });
|
|
128
118
|
}, [
|
|
129
119
|
u,
|
|
130
|
-
|
|
120
|
+
o,
|
|
131
121
|
i,
|
|
132
|
-
|
|
133
|
-
f,
|
|
134
|
-
g,
|
|
135
|
-
w,
|
|
122
|
+
x,
|
|
136
123
|
b,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
n?.trigger,
|
|
145
|
-
N
|
|
146
|
-
),
|
|
147
|
-
render: (o, v) => {
|
|
148
|
-
const { openOnHover: s, ...m } = o;
|
|
149
|
-
return de(_, m, v);
|
|
150
|
-
}
|
|
151
|
-
}, T = {
|
|
152
|
-
ref: $,
|
|
153
|
-
side: a.side,
|
|
154
|
-
align: a.align,
|
|
155
|
-
sideOffset: 4,
|
|
156
|
-
className: c(
|
|
157
|
-
r("dropdown-menu-root"),
|
|
158
|
-
N,
|
|
159
|
-
n?.root
|
|
160
|
-
),
|
|
161
|
-
collisionAvoidance: le,
|
|
162
|
-
render: (o) => /* @__PURE__ */ e(V.Root, { ...o })
|
|
163
|
-
}, A = {
|
|
164
|
-
className: c(
|
|
165
|
-
r(
|
|
166
|
-
"dropdown-menu",
|
|
167
|
-
x && "dropdown-menu-show-checkbox",
|
|
168
|
-
F && "dropdown-menu-match-trigger-width"
|
|
169
|
-
),
|
|
170
|
-
U,
|
|
171
|
-
n?.popup
|
|
172
|
-
),
|
|
173
|
-
style: {
|
|
174
|
-
"--size-width": C in M ? M[C] : void 0
|
|
124
|
+
w,
|
|
125
|
+
v,
|
|
126
|
+
I
|
|
127
|
+
]), _ = g(
|
|
128
|
+
(r, R) => {
|
|
129
|
+
const { openOnHover: s, ...p } = r;
|
|
130
|
+
return de(y, p, R);
|
|
175
131
|
},
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
132
|
+
[y]
|
|
133
|
+
), j = f(
|
|
134
|
+
() => ({
|
|
135
|
+
ref: V,
|
|
136
|
+
openOnHover: O,
|
|
137
|
+
nativeButton: D,
|
|
138
|
+
className: h(
|
|
139
|
+
o("dropdown-menu-trigger"),
|
|
140
|
+
n?.trigger,
|
|
141
|
+
c
|
|
142
|
+
),
|
|
143
|
+
render: _
|
|
144
|
+
}),
|
|
145
|
+
[V, O, D, o, n?.trigger, c, _]
|
|
146
|
+
), G = g(
|
|
147
|
+
(r) => /* @__PURE__ */ e(U.Root, { ...r }),
|
|
148
|
+
[]
|
|
149
|
+
), L = f(
|
|
150
|
+
() => ({
|
|
151
|
+
side: a.side,
|
|
152
|
+
align: a.align,
|
|
153
|
+
sideOffset: 4,
|
|
154
|
+
className: h(
|
|
155
|
+
o("dropdown-menu-root"),
|
|
156
|
+
c,
|
|
157
|
+
n?.root
|
|
158
|
+
),
|
|
159
|
+
collisionAvoidance: le,
|
|
160
|
+
render: G
|
|
161
|
+
}),
|
|
162
|
+
[
|
|
163
|
+
a.side,
|
|
164
|
+
a.align,
|
|
165
|
+
o,
|
|
166
|
+
c,
|
|
167
|
+
n?.root,
|
|
168
|
+
G
|
|
169
|
+
]
|
|
170
|
+
), k = g(
|
|
171
|
+
(r) => /* @__PURE__ */ e(U.Popup, { ...r }),
|
|
172
|
+
[]
|
|
173
|
+
), F = f(
|
|
174
|
+
() => ({
|
|
175
|
+
"--size-width": P in K ? K[P] : void 0
|
|
176
|
+
}),
|
|
177
|
+
[P]
|
|
178
|
+
), H = f(
|
|
179
|
+
() => ({
|
|
180
|
+
className: h(
|
|
181
|
+
o(
|
|
182
|
+
"dropdown-menu",
|
|
183
|
+
S && "dropdown-menu-show-checkbox",
|
|
184
|
+
A && "dropdown-menu-match-trigger-width"
|
|
185
|
+
),
|
|
186
|
+
N,
|
|
187
|
+
n?.popup
|
|
188
|
+
),
|
|
189
|
+
style: F,
|
|
190
|
+
render: k
|
|
191
|
+
}),
|
|
192
|
+
[
|
|
193
|
+
o,
|
|
194
|
+
S,
|
|
195
|
+
A,
|
|
196
|
+
N,
|
|
197
|
+
n?.popup,
|
|
198
|
+
F,
|
|
199
|
+
k
|
|
200
|
+
]
|
|
201
|
+
);
|
|
202
|
+
return u ? /* @__PURE__ */ d(
|
|
179
203
|
t.Root,
|
|
180
204
|
{
|
|
181
|
-
open:
|
|
182
|
-
onOpenChange:
|
|
183
|
-
items:
|
|
184
|
-
itemToStringLabel: (
|
|
185
|
-
itemToStringValue: (
|
|
186
|
-
inputValue:
|
|
205
|
+
open: M,
|
|
206
|
+
onOpenChange: C,
|
|
207
|
+
items: v,
|
|
208
|
+
itemToStringLabel: (r) => r.type == "item" ? ge(r.label) : "",
|
|
209
|
+
itemToStringValue: (r) => r.type == "item" ? String(r.key) : "",
|
|
210
|
+
inputValue: x,
|
|
187
211
|
children: [
|
|
188
|
-
/* @__PURE__ */ e(t.Trigger, { ...
|
|
189
|
-
/* @__PURE__ */ e(t.Portal, { children: /* @__PURE__ */ e(t.Positioner, { ...
|
|
212
|
+
/* @__PURE__ */ e(t.Trigger, { ...j }),
|
|
213
|
+
/* @__PURE__ */ e(t.Portal, { children: /* @__PURE__ */ e(t.Positioner, { ...L, children: /* @__PURE__ */ e(t.Popup, { ...H, children: E() }) }) })
|
|
190
214
|
]
|
|
191
215
|
}
|
|
192
|
-
) : /* @__PURE__ */
|
|
193
|
-
/* @__PURE__ */ e(
|
|
194
|
-
/* @__PURE__ */ e(
|
|
216
|
+
) : /* @__PURE__ */ d(l.Root, { open: M, onOpenChange: C, children: [
|
|
217
|
+
/* @__PURE__ */ e(l.Trigger, { ...j }),
|
|
218
|
+
/* @__PURE__ */ e(l.Portal, { children: /* @__PURE__ */ e(l.Positioner, { ...L, children: /* @__PURE__ */ e(l.Popup, { ...H, children: E() }) }) })
|
|
195
219
|
] });
|
|
196
220
|
};
|
|
197
221
|
export {
|
|
@@ -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 } 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,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,kBAAA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EAAA,CAAO;AAAA,EAAA;AAI/B,SAAO5C,IACL,gBAAAqC;AAAA,IAACK,EAAS;AAAA,IAAT;AAAA,MACC,MAAA7B;AAAA,MACA,cAAAC;AAAA,MACA,OAAOU;AAAA,MACP,mBAAmB,CAACsC,MAClBA,EAAK,QAAQ,SAASC,GAAkBD,EAAK,KAAK,IAAI;AAAA,MAExD,mBAAmB,CAACA,MAClBA,EAAK,QAAQ,SAAS,OAAOA,EAAK,GAAG,IAAI;AAAA,MAE3C,YAAYnC;AAAA,MAEZ,UAAA;AAAA,QAAA,gBAAAa,EAACE,EAAS,SAAT,EAAkB,GAAGU,EAAA,CAAoB;AAAA,0BACzCV,EAAS,QAAT,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,MAAAnD,GAAY,cAAAC,GACrB,UAAA;AAAA,IAAA,gBAAA0B,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, type ComboboxTriggerState } from \"@base-ui/react/combobox\";\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { useCallback, useMemo, useRef, useState, RefCallback } from \"react\";\nimport {\n clsx,\n DROPDOWN_COLLISION_AVOIDANCE,\n parseAntdPlacement,\n reactNodeToString,\n useCls,\n createRenderProp,\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 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 * Whether the trigger should act as a native button element.\n * Set to false when using non-button elements (like Typography.Link) as trigger\n * to suppress Base UI warnings and remove native button semantics.\n * @default true\n */\n nativeButton?: boolean;\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 nativeButton = true,\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 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={cls(\"dropdown-menu-search-wrapper\")}\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 ]);\n\n // Stable trigger render — useCallback since it's called during render phase\n const triggerRender = useCallback(\n (\n props: React.HTMLProps<HTMLElement> & { openOnHover?: boolean },\n state: ComboboxTriggerState\n ) => {\n const { openOnHover: _openOnHover, ...rest } = props;\n return createRenderProp(children, rest, state);\n },\n [children]\n );\n\n const commonTriggerProps = useMemo(\n () => ({\n ref: buttonRef,\n openOnHover,\n nativeButton,\n className: clsx(\n cls(\"dropdown-menu-trigger\"),\n classNames?.trigger,\n themeClassName,\n ),\n render: triggerRender,\n }),\n [buttonRef, openOnHover, nativeButton, cls, classNames?.trigger, themeClassName, triggerRender]\n );\n\n // Stable positioner render — useCallback since it's called during render phase\n const positionerRender = useCallback(\n (props: React.ComponentPropsWithoutRef<\"div\">) => (\n <BaseMenu.Root {...props} />\n ),\n []\n );\n\n const commonPositionerProps = useMemo(\n () => ({\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: positionerRender,\n }),\n [\n baseUIPlacement.side,\n baseUIPlacement.align,\n cls,\n themeClassName,\n classNames?.root,\n positionerRender,\n ]\n );\n\n // Stable popup render — useCallback since it's called during render phase\n const popupRender = useCallback(\n (props: React.ComponentPropsWithoutRef<\"div\">) => (\n <BaseMenu.Popup {...props} />\n ),\n []\n );\n\n const popupStyle = useMemo(\n () =>\n ({\n \"--size-width\": size in PopupPanelSize ? PopupPanelSize[size] : undefined,\n }) as React.CSSProperties,\n [size]\n );\n\n const commonPopupProps = useMemo(\n () => ({\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: popupStyle,\n render: popupRender,\n }),\n [\n cls,\n showCheckbox,\n popupMatchTriggerWidth,\n className,\n classNames?.popup,\n popupStyle,\n popupRender,\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","nativeButton","inCombobox","open","onOpenChange","useControlledState","cls","useCls","themeClassName","useTheme","baseUIPlacement","parseAntdPlacement","buttonRef","useRef","itemGroups","renderGroup","useDropdownMenu","searchValue","setSearchValue","useState","renderMenuInner","useCallback","jsxs","ScrollArea","searchInput","jsx","FormItemInputContext","Combobox","ref","props","Input","antdInputRef","e","clsx","listContent","group","i","triggerRender","state","_openOnHover","rest","createRenderProp","commonTriggerProps","useMemo","positionerRender","BaseMenu","commonPositionerProps","DROPDOWN_COLLISION_AVOIDANCE","popupRender","popupStyle","PopupPanelSize","commonPopupProps","item","reactNodeToString","Menu"],"mappings":";;;;;;;;;;;;;;;;;;;AAkHO,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;AAAA,EACA,cAAAC,IAAe;AACjB,MAAyB;AACvB,QAAMC,KACJ,OAAOZ,K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-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
|
|
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-root[data-side=top] .ds-dropdown-menu-search-wrapper{order:1}}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ThemeProviderProps } from '../theme-provider/component';
|
|
2
|
+
import { ToastProviderProps } from '../toast';
|
|
2
3
|
export interface DSRootProps extends ThemeProviderProps {
|
|
3
4
|
/**
|
|
4
5
|
* Classname passed to App component
|
|
@@ -9,6 +10,10 @@ export interface DSRootProps extends ThemeProviderProps {
|
|
|
9
10
|
* @default "html"
|
|
10
11
|
*/
|
|
11
12
|
appendClassesTo?: string | HTMLElement;
|
|
13
|
+
/**
|
|
14
|
+
* Props forwarded to `Toast.Provider`
|
|
15
|
+
*/
|
|
16
|
+
toastProviderProps?: ToastProviderProps;
|
|
12
17
|
}
|
|
13
|
-
export declare const DSRoot: ({ className, appendClassesTo, children, theme, ...props }: DSRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare const DSRoot: ({ className, appendClassesTo, toastProviderProps, children, theme, ...props }: DSRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
19
|
//# sourceMappingURL=component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/ds-root/component.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/ds-root/component.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAS,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAM1D,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,WAAY,SAAQ,kBAAkB;IACrD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAEvC;;OAEG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,eAAO,MAAM,MAAM,GAAI,+EAOpB,WAAW,4CAYb,CAAC"}
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as r, jsxs as
|
|
3
|
-
import { ThemeProvider as
|
|
4
|
-
import { Modal as
|
|
5
|
-
import
|
|
2
|
+
import { jsx as r, jsxs as c } from "react/jsx-runtime";
|
|
3
|
+
import { ThemeProvider as d } from "../theme-provider/component.js";
|
|
4
|
+
import { Modal as f } from "../modal/index.js";
|
|
5
|
+
import n from "antd/es/app/App";
|
|
6
6
|
import './style.css';/* empty css */
|
|
7
7
|
import { Toast as o } from "../toast/component.js";
|
|
8
|
-
import { useCls as
|
|
9
|
-
import { clsx as
|
|
10
|
-
const
|
|
8
|
+
import { useCls as h } from "../utils/antdUtils.js";
|
|
9
|
+
import { clsx as a } from "../utils/cn.js";
|
|
10
|
+
const D = ({
|
|
11
11
|
className: m,
|
|
12
12
|
appendClassesTo: t = "html",
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
toastProviderProps: i,
|
|
14
|
+
children: e,
|
|
15
|
+
theme: s,
|
|
16
|
+
...p
|
|
16
17
|
}) => {
|
|
17
|
-
const
|
|
18
|
-
return /* @__PURE__ */ r(
|
|
18
|
+
const l = h();
|
|
19
|
+
return /* @__PURE__ */ r(d, { theme: s, ...p, appendClassesTo: t, children: /* @__PURE__ */ r(o.Provider, { ...i, children: /* @__PURE__ */ c(f.Provider, { children: [
|
|
19
20
|
/* @__PURE__ */ r(o.List, {}),
|
|
20
|
-
/* @__PURE__ */ r(
|
|
21
|
+
/* @__PURE__ */ r(n, { className: a(l("root"), m), children: e })
|
|
21
22
|
] }) }) });
|
|
22
23
|
};
|
|
23
24
|
export {
|
|
24
|
-
|
|
25
|
+
D as DSRoot
|
|
25
26
|
};
|
|
26
27
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/ds-root/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n ThemeProvider,\n type ThemeProviderProps,\n} from \"../theme-provider/component\";\nimport { Toast } from \"../toast\";\nimport { Modal } from \"../modal\";\nimport App from \"antd/es/app/App\";\nimport { useCls, clsx } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport interface DSRootProps extends ThemeProviderProps {\n /**\n * Classname passed to App component\n */\n className?: string;\n\n /**\n * Element to which the theme classes are appended\n * @default \"html\"\n */\n appendClassesTo?: string | HTMLElement;\n}\n\nexport const DSRoot = ({\n className,\n appendClassesTo = \"html\",\n children,\n theme,\n ...props\n}: DSRootProps) => {\n const cls = useCls();\n return (\n <ThemeProvider theme={theme} {...props} appendClassesTo={appendClassesTo}>\n <Toast.Provider>\n <Modal.Provider>\n <Toast.List />\n <App className={clsx(cls(\"root\"), className)}>{children}</App>\n </Modal.Provider>\n </Toast.Provider>\n </ThemeProvider>\n );\n};\n"],"names":["DSRoot","className","appendClassesTo","children","theme","props","cls","useCls","jsx","ThemeProvider","Toast","jsxs","Modal","App","clsx"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/ds-root/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n ThemeProvider,\n type ThemeProviderProps,\n} from \"../theme-provider/component\";\nimport { Toast, type ToastProviderProps } from \"../toast\";\nimport { Modal } from \"../modal\";\nimport App from \"antd/es/app/App\";\nimport { useCls, clsx } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport interface DSRootProps extends ThemeProviderProps {\n /**\n * Classname passed to App component\n */\n className?: string;\n\n /**\n * Element to which the theme classes are appended\n * @default \"html\"\n */\n appendClassesTo?: string | HTMLElement;\n\n /**\n * Props forwarded to `Toast.Provider`\n */\n toastProviderProps?: ToastProviderProps;\n}\n\nexport const DSRoot = ({\n className,\n appendClassesTo = \"html\",\n toastProviderProps,\n children,\n theme,\n ...props\n}: DSRootProps) => {\n const cls = useCls();\n return (\n <ThemeProvider theme={theme} {...props} appendClassesTo={appendClassesTo}>\n <Toast.Provider {...toastProviderProps}>\n <Modal.Provider>\n <Toast.List />\n <App className={clsx(cls(\"root\"), className)}>{children}</App>\n </Modal.Provider>\n </Toast.Provider>\n </ThemeProvider>\n );\n};\n"],"names":["DSRoot","className","appendClassesTo","toastProviderProps","children","theme","props","cls","useCls","jsx","ThemeProvider","Toast","jsxs","Modal","App","clsx"],"mappings":";;;;;;;;;AA+BO,MAAMA,IAAS,CAAC;AAAA,EACrB,WAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,oBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,MAAmB;AACjB,QAAMC,IAAMC,EAAA;AACZ,SACE,gBAAAC,EAACC,GAAA,EAAc,OAAAL,GAAe,GAAGC,GAAO,iBAAAJ,GACtC,UAAA,gBAAAO,EAACE,EAAM,UAAN,EAAgB,GAAGR,GAClB,UAAA,gBAAAS,EAACC,EAAM,UAAN,EACC,UAAA;AAAA,IAAA,gBAAAJ,EAACE,EAAM,MAAN,EAAW;AAAA,IACZ,gBAAAF,EAACK,KAAI,WAAWC,EAAKR,EAAI,MAAM,GAAGN,CAAS,GAAI,UAAAG,EAAA,CAAS;AAAA,EAAA,EAAA,CAC1D,GACF,GACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.ds-form-item-label-inner{display:inline-flex;align-items:center;gap:.25rem}.ds-form-item-label-optional-mark{color:var(--ds-color-text-tertiary)}.ds-form-item-label>label.ds-form-item-required:before{display:none}.ds-form-item-label-required-mark{display:inline-block;font-size:var(--ds-font-size);font-family:Inter,sans-serif;line-height:1;content:"*"}.ds-form-item-label-required-mark.ds-form-item-label-required-mark-asterisk{color:var(--ds-form-label-required-mark-color)}.ds-form-item-explain{margin-top:.25rem}.ds-form-item-margin-offset{margin:0!important}.ds-form-item-label{overflow:visible}.ds-form-item-row .ds-form-item-label label{width:100%}.ds-form-item .ds-form-item-label>label.ds-form-item-no-colon:after,.ds-form-item-vertical .ds-form-item-label>label:after{display:none}.ds-form-item-explaination-icon{cursor:help}}
|
|
1
|
+
@layer components{.ds-form-item-label-inner{display:inline-flex;align-items:center;gap:.25rem}.ds-form-item-label-optional-mark{color:var(--ds-color-text-tertiary)}.ds-form-item-label>label.ds-form-item-required:before{display:none}.ds-form-item-label-required-mark{display:inline-block;font-size:var(--ds-font-size);font-family:Inter,sans-serif;line-height:1;content:"*"}.ds-form-item-label-required-mark.ds-form-item-label-required-mark-asterisk{color:var(--ds-form-label-required-mark-color)}.ds-form-item-explain{margin-top:.25rem}.ds-form-item-margin-offset{margin:0!important}.ds-form-item-label{overflow:visible}.ds-form-item-row .ds-form-item-label label{width:100%}.ds-form-item .ds-form-item-label>label.ds-form-item-no-colon:after,.ds-form-item-vertical .ds-form-item-label>label:after{display:none}.ds-form-item-explaination-icon{cursor:help}.ds-form-vertical .ds-form-item:not(.ds-form-item-horizontal) .ds-form-item-label>label:after{display:none}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
|
|
@@ -52,6 +52,7 @@ export * from './select-trigger/index';
|
|
|
52
52
|
export * from './loader/index';
|
|
53
53
|
export * from './window-portal/index';
|
|
54
54
|
export * from './alert/index';
|
|
55
|
+
export * from './label-with-help/index';
|
|
55
56
|
export * from './utils/index';
|
|
56
57
|
export * from './hooks/index';
|
|
57
58
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,O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cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AAExC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IconButtonProps } from '../icon-button';
|
|
3
|
+
export interface LabelWithHelpProps extends React.ComponentPropsWithRef<"span"> {
|
|
4
|
+
/**
|
|
5
|
+
* The content to display alongside the help icon
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Tooltip content shown when hovering the question icon.
|
|
10
|
+
* When falsy, the component renders children directly without wrapper.
|
|
11
|
+
*/
|
|
12
|
+
tooltip?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Props to pass to the inner IconButton component for customization
|
|
15
|
+
* (e.g. size, tooltipProps, negativeMargin)
|
|
16
|
+
*/
|
|
17
|
+
iconButtonProps?: Partial<IconButtonProps>;
|
|
18
|
+
}
|
|
19
|
+
export declare const LabelWithHelp: React.ForwardRefExoticComponent<Omit<LabelWithHelpProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
20
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/label-with-help/component.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGlE,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,kBACf,SAAQ,KAAK,CAAC,qBAAqB,CAAC,MAAM,CAAC;IAC3C;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CAC5C;AAED,eAAO,MAAM,aAAa,yGAgCzB,CAAC"}
|