@bioturing/components 0.20.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/dropdown-menu/component.js +120 -105
- package/dist/components/dropdown-menu/component.js.map +1 -1
- package/dist/components/icon-button/component.js +38 -35
- package/dist/components/icon-button/component.js.map +1 -1
- package/dist/components/utils/WithRenderProp.js +10 -9
- package/dist/components/utils/WithRenderProp.js.map +1 -1
- package/dist/components/utils/constants.js +10 -0
- package/dist/components/utils/constants.js.map +1 -0
- package/dist/index.d.ts +45 -45
- package/dist/index.js +163 -160
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,94 +1,107 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useControlled as
|
|
2
|
+
import { jsx as t, jsxs as v } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback as m, useRef as j, createElement as q } from "react";
|
|
4
|
+
import { Menu as f } from "@base-ui-components/react/menu";
|
|
5
|
+
import { useControlled as F } from "@base-ui-components/react/utils";
|
|
6
|
+
import { Popover as H } from "@base-ui-components/react/popover";
|
|
6
7
|
import { Command as i } from "../cmdk/index.js";
|
|
8
|
+
import { PopupPanelSize as S } from "../popup-panel/constants.js";
|
|
7
9
|
import './style.css';/* empty css */
|
|
8
|
-
import {
|
|
9
|
-
import { PopupPanelSize as A } from "../popup-panel/constants.js";
|
|
10
|
-
import { useCls as K, useAntdCssVarClassname as Q, parseAntdPlacement as W } from "../utils/antdUtils.js";
|
|
10
|
+
import { useCls as J, useAntdCssVarClassname as K, parseAntdPlacement as Q } from "../utils/antdUtils.js";
|
|
11
11
|
import { Input as X } from "../input/component.js";
|
|
12
|
+
import { DROPDOWN_COLLISION_AVOIDANCE as Y } from "../utils/constants.js";
|
|
12
13
|
import { clsx as p } from "../utils/cn.js";
|
|
13
|
-
const
|
|
14
|
-
children:
|
|
15
|
-
items:
|
|
16
|
-
placement:
|
|
17
|
-
openOnHover:
|
|
18
|
-
open:
|
|
19
|
-
onOpenChange:
|
|
20
|
-
className:
|
|
21
|
-
itemRender:
|
|
14
|
+
const uo = ({
|
|
15
|
+
children: V,
|
|
16
|
+
items: _,
|
|
17
|
+
placement: x,
|
|
18
|
+
openOnHover: z,
|
|
19
|
+
open: B,
|
|
20
|
+
onOpenChange: g,
|
|
21
|
+
className: O,
|
|
22
|
+
itemRender: I,
|
|
22
23
|
classNames: r,
|
|
23
|
-
size:
|
|
24
|
-
showSearch:
|
|
25
|
-
searchProps:
|
|
24
|
+
size: w = "auto",
|
|
25
|
+
showSearch: u,
|
|
26
|
+
searchProps: L = {
|
|
26
27
|
placeholder: "Search..."
|
|
27
28
|
}
|
|
28
29
|
}) => {
|
|
29
|
-
const [T,
|
|
30
|
-
controlled:
|
|
30
|
+
const [T, P] = F({
|
|
31
|
+
controlled: B,
|
|
31
32
|
default: !1,
|
|
32
33
|
name: "open"
|
|
33
|
-
}),
|
|
34
|
+
}), b = m(
|
|
34
35
|
(o) => {
|
|
35
|
-
|
|
36
|
+
P(o), g == null || g(o);
|
|
36
37
|
},
|
|
37
|
-
[
|
|
38
|
-
), n =
|
|
38
|
+
[P, g]
|
|
39
|
+
), n = J(), k = K(), G = Q(x), U = j(null), y = _.reduce((o, e) => (o.length === 0 && e.type !== "header" && o.push({
|
|
39
40
|
label: null,
|
|
40
41
|
items: []
|
|
41
42
|
}), e.type === "header" ? o.push({
|
|
42
43
|
label: e.title,
|
|
43
44
|
items: []
|
|
44
|
-
}) : (e.type === "item" || e.type === "divider") && o.length > 0 && o[o.length - 1].items.push(e), o), []),
|
|
45
|
-
(o, e, d) =>
|
|
46
|
-
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
45
|
+
}) : (e.type === "item" || e.type === "divider") && o.length > 0 && o[o.length - 1].items.push(e), o), []), E = u ? i.Separator : f.Separator, h = m(
|
|
46
|
+
(o, e, d) => {
|
|
47
|
+
const l = u ? i.Item : f.Item;
|
|
48
|
+
if (o.type === "item") {
|
|
49
|
+
const R = {
|
|
50
|
+
className: p(n("dropdown-menu-item"), r == null ? void 0 : r.item),
|
|
51
|
+
disabled: o.disabled,
|
|
52
|
+
"data-danger": o.danger,
|
|
53
|
+
ref: o.ref,
|
|
54
|
+
onClick: o.onClick,
|
|
55
|
+
onMouseEnter: o.onMouseEnter,
|
|
56
|
+
onMouseLeave: o.onMouseLeave,
|
|
57
|
+
onMouseOver: o.onMouseOver,
|
|
58
|
+
onMouseOut: o.onMouseOut,
|
|
59
|
+
onSelect: u ? () => {
|
|
60
|
+
const C = new MouseEvent("click", {
|
|
61
|
+
bubbles: !0,
|
|
62
|
+
cancelable: !0
|
|
63
|
+
});
|
|
64
|
+
o.onClick(C), b == null || b(!1);
|
|
65
|
+
} : void 0,
|
|
66
|
+
render: I ? (C) => I(o, C) : void 0,
|
|
67
|
+
children: [
|
|
68
|
+
o.icon && /* @__PURE__ */ t(
|
|
69
|
+
"span",
|
|
70
|
+
{
|
|
71
|
+
className: p(
|
|
72
|
+
n("dropdown-menu-item-icon"),
|
|
73
|
+
r == null ? void 0 : r.itemIcon
|
|
74
|
+
),
|
|
75
|
+
children: o.icon
|
|
76
|
+
},
|
|
77
|
+
"icon"
|
|
78
|
+
),
|
|
79
|
+
/* @__PURE__ */ t("span", { children: o.label }, "label")
|
|
80
|
+
]
|
|
81
|
+
};
|
|
82
|
+
return u ? /* @__PURE__ */ t(i.Item, { ...R }, e + "-" + d) : /* @__PURE__ */ t(l, { ...R }, e + "-" + d);
|
|
83
|
+
} else if (o.type === "divider")
|
|
84
|
+
return /* @__PURE__ */ t(
|
|
85
|
+
E,
|
|
86
|
+
{
|
|
87
|
+
className: p(
|
|
88
|
+
n("dropdown-menu-divider"),
|
|
89
|
+
r == null ? void 0 : r.separator
|
|
90
|
+
)
|
|
91
|
+
},
|
|
92
|
+
e + "-" + d
|
|
93
|
+
);
|
|
94
|
+
return null;
|
|
95
|
+
},
|
|
96
|
+
[n, r, I, b, u, E]
|
|
97
|
+
), A = m(
|
|
98
|
+
(o, e) => /* @__PURE__ */ v(
|
|
99
|
+
f.Group,
|
|
87
100
|
{
|
|
88
101
|
className: p(n("dropdown-menu-group"), r == null ? void 0 : r.group),
|
|
89
102
|
children: [
|
|
90
103
|
o.label && /* @__PURE__ */ t(
|
|
91
|
-
|
|
104
|
+
f.GroupLabel,
|
|
92
105
|
{
|
|
93
106
|
className: p(
|
|
94
107
|
n("dropdown-menu-header"),
|
|
@@ -97,19 +110,19 @@ const no = ({
|
|
|
97
110
|
children: /* @__PURE__ */ t("span", { children: o.label })
|
|
98
111
|
}
|
|
99
112
|
),
|
|
100
|
-
o.items.map((d,
|
|
113
|
+
o.items.map((d, l) => h(d, e, l))
|
|
101
114
|
]
|
|
102
115
|
},
|
|
103
116
|
"group" + e
|
|
104
117
|
),
|
|
105
118
|
[n, r, h]
|
|
106
|
-
),
|
|
119
|
+
), D = m(
|
|
107
120
|
(o, e) => o.label ? /* @__PURE__ */ t(
|
|
108
121
|
i.Group,
|
|
109
122
|
{
|
|
110
123
|
className: p(n("dropdown-menu-group"), r == null ? void 0 : r.group),
|
|
111
124
|
heading: /* @__PURE__ */ t(
|
|
112
|
-
|
|
125
|
+
f.GroupLabel,
|
|
113
126
|
{
|
|
114
127
|
className: p(
|
|
115
128
|
n("dropdown-menu-header"),
|
|
@@ -118,73 +131,75 @@ const no = ({
|
|
|
118
131
|
children: /* @__PURE__ */ t("span", { children: o.label })
|
|
119
132
|
}
|
|
120
133
|
),
|
|
121
|
-
children: o.items.map((d,
|
|
134
|
+
children: o.items.map((d, l) => h(d, e, l))
|
|
122
135
|
},
|
|
123
136
|
"group" + e
|
|
124
|
-
) : o.items.map((d,
|
|
137
|
+
) : o.items.map((d, l) => h(d, e, l)),
|
|
125
138
|
[n, r, h]
|
|
126
|
-
),
|
|
127
|
-
() =>
|
|
128
|
-
/* @__PURE__ */
|
|
139
|
+
), W = m(
|
|
140
|
+
() => u ? /* @__PURE__ */ v(i, { children: [
|
|
141
|
+
/* @__PURE__ */ q(
|
|
129
142
|
i.Input,
|
|
130
143
|
{
|
|
131
|
-
...
|
|
144
|
+
...L,
|
|
145
|
+
key: "search",
|
|
132
146
|
render: /* @__PURE__ */ t(X, { allowClear: !0, className: n("dropdown-menu-search") })
|
|
133
147
|
}
|
|
134
148
|
),
|
|
135
|
-
/* @__PURE__ */
|
|
149
|
+
/* @__PURE__ */ v(i.List, { children: [
|
|
136
150
|
/* @__PURE__ */ t(i.Empty, { className: n("dropdown-menu-empty"), children: "No results found." }),
|
|
137
|
-
|
|
151
|
+
y.map(D)
|
|
138
152
|
] })
|
|
139
|
-
] }) :
|
|
153
|
+
] }) : y.map(A),
|
|
140
154
|
[
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
155
|
+
u,
|
|
156
|
+
y,
|
|
157
|
+
D,
|
|
158
|
+
A,
|
|
159
|
+
L,
|
|
146
160
|
n
|
|
147
161
|
]
|
|
148
|
-
),
|
|
149
|
-
return /* @__PURE__ */
|
|
150
|
-
|
|
162
|
+
), M = u ? H : f;
|
|
163
|
+
return /* @__PURE__ */ v(
|
|
164
|
+
M.Root,
|
|
151
165
|
{
|
|
152
|
-
openOnHover:
|
|
166
|
+
openOnHover: z,
|
|
153
167
|
open: T,
|
|
154
|
-
onOpenChange:
|
|
168
|
+
onOpenChange: b,
|
|
155
169
|
children: [
|
|
156
170
|
/* @__PURE__ */ t(
|
|
157
|
-
|
|
171
|
+
M.Trigger,
|
|
158
172
|
{
|
|
159
|
-
render:
|
|
160
|
-
ref:
|
|
173
|
+
render: V,
|
|
174
|
+
ref: U,
|
|
161
175
|
className: p(
|
|
162
176
|
n("dropdown-menu-trigger"),
|
|
163
177
|
r == null ? void 0 : r.trigger,
|
|
164
|
-
|
|
178
|
+
k
|
|
165
179
|
)
|
|
166
180
|
}
|
|
167
181
|
),
|
|
168
|
-
/* @__PURE__ */ t(
|
|
169
|
-
|
|
182
|
+
/* @__PURE__ */ t(M.Portal, { children: /* @__PURE__ */ t(
|
|
183
|
+
M.Positioner,
|
|
170
184
|
{
|
|
171
|
-
side:
|
|
172
|
-
align:
|
|
185
|
+
side: G.placement,
|
|
186
|
+
align: G.align,
|
|
173
187
|
sideOffset: 4,
|
|
174
188
|
className: p(n("dropdown-menu-root"), r == null ? void 0 : r.root),
|
|
189
|
+
collisionAvoidance: Y,
|
|
175
190
|
children: /* @__PURE__ */ t(
|
|
176
|
-
|
|
191
|
+
M.Popup,
|
|
177
192
|
{
|
|
178
193
|
className: p(
|
|
179
194
|
n("dropdown-menu"),
|
|
180
|
-
|
|
195
|
+
O,
|
|
181
196
|
r == null ? void 0 : r.popup,
|
|
182
|
-
|
|
197
|
+
k
|
|
183
198
|
),
|
|
184
199
|
style: {
|
|
185
|
-
"--size-width":
|
|
200
|
+
"--size-width": w in S ? S[w] : void 0
|
|
186
201
|
},
|
|
187
|
-
children:
|
|
202
|
+
children: W()
|
|
188
203
|
}
|
|
189
204
|
)
|
|
190
205
|
}
|
|
@@ -194,6 +209,6 @@ const no = ({
|
|
|
194
209
|
);
|
|
195
210
|
};
|
|
196
211
|
export {
|
|
197
|
-
|
|
212
|
+
uo as DropdownMenu
|
|
198
213
|
};
|
|
199
214
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/dropdown-menu/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n useCls,\n clsx,\n useAntdCssVarClassname,\n parseAntdPlacement,\n WithRenderPropProps,\n} from \"../utils\";\nimport { Menu } from \"@base-ui-components/react/menu\";\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { Ref, useCallback, useRef } from \"react\";\nimport { useControlled } from \"@base-ui-components/react/utils\";\nimport { Command } from \"../cmdk\";\n\n// Import component-specific styles\nimport \"./style.css\";\nimport { Popover } from \"@base-ui-components/react\";\nimport { PopupPanelSize } from \"../popup-panel/constants\";\nimport { Input } from \"../input\";\n\nexport type DropdownMenuItemType =\n | {\n type: \"item\";\n label?: React.ReactNode;\n disabled?: boolean;\n icon?: React.ReactNode;\n key: React.Key;\n onClick?: React.HTMLAttributes<HTMLElement>[\"onClick\"];\n onMouseEnter?: React.HTMLAttributes<HTMLElement>[\"onMouseEnter\"];\n onMouseLeave?: React.HTMLAttributes<HTMLElement>[\"onMouseLeave\"];\n onMouseOver?: React.HTMLAttributes<HTMLElement>[\"onMouseOver\"];\n onMouseOut?: React.HTMLAttributes<HTMLElement>[\"onMouseOut\"];\n danger?: boolean;\n ref?: React.Ref<HTMLElement>;\n }\n | {\n type: \"divider\";\n }\n | {\n type: \"header\";\n title?: React.ReactNode;\n };\n\nexport interface DropdownMenuProps {\n /** Array of menu items to be displayed in the dropdown */\n items: DropdownMenuItemType[];\n /** Custom render function for the trigger element */\n children?: React.ComponentProps<typeof Menu.Trigger>[\"render\"];\n /**\n * Placement of the dropdown relative to the trigger element\n * @default \"bottomLeft\"\n */\n placement?: PopoverProps[\"placement\"];\n /**\n * Whether to open the dropdown on hover instead of click\n * @default false\n */\n openOnHover?: boolean;\n /**\n * Controlled open state of the dropdown\n */\n open?: boolean;\n /**\n * Callback fired when the dropdown open state changes\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Additional CSS class for the dropdown component\n */\n className?: string;\n /**\n * Custom class names for different parts of the dropdown\n * @default {}\n */\n classNames?: {\n root?: string;\n trigger?: string;\n popup?: string;\n group?: string;\n groupLabel?: string;\n item?: string;\n itemIcon?: string;\n itemText?: string;\n separator?: string;\n positioner?: string;\n };\n /**\n * Custom render function for menu items\n */\n itemRender?: (\n item: DropdownMenuItemType,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /**\n * Whether to show search input\n * @default false\n */\n showSearch?: boolean;\n /**\n * Size of the dropdown menu\n * @default \"auto\"\n */\n size?: \"auto\" | keyof typeof PopupPanelSize;\n /**\n * Search placeholder\n */\n searchProps?: Omit<\n React.ComponentProps<typeof Command.Input>,\n \"size\" | \"ref\"\n >;\n}\n\ninterface DropdownMenuGroup {\n label: React.ReactNode | null;\n items: DropdownMenuItemType[];\n}\n\nexport const DropdownMenu = ({\n children,\n items,\n placement,\n openOnHover,\n open: outsideOpen,\n onOpenChange: outsideOnOpenChange,\n className,\n itemRender,\n classNames,\n size = \"auto\",\n showSearch,\n searchProps = {\n placeholder: \"Search...\",\n },\n}: DropdownMenuProps) => {\n const [open, setOpen] = useControlled({\n controlled: outsideOpen,\n default: false,\n name: \"open\",\n });\n const onOpenChange = useCallback(\n (newValue: boolean) => {\n setOpen(newValue);\n outsideOnOpenChange?.(newValue);\n },\n [setOpen, outsideOnOpenChange]\n );\n const cls = useCls();\n const antdCssVarClassname = useAntdCssVarClassname();\n const headlessUIPlacement = parseAntdPlacement(placement);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const itemGroups = items.reduce<DropdownMenuGroup[]>((acc, current) => {\n // If no groups exist yet and current item is not a header, create default group\n if (acc.length === 0 && current.type !== \"header\") {\n acc.push({\n label: null,\n items: [],\n });\n }\n\n // If it's a header, create a new group\n if (current.type === \"header\") {\n acc.push({\n label: current.title,\n items: [],\n });\n }\n // If it's an item and we have at least one group, add it to the last group's items\n else if (\n (current.type === \"item\" || current.type === \"divider\") &&\n acc.length > 0\n ) {\n acc[acc.length - 1].items.push(current);\n }\n // Skip dividers\n return acc;\n }, []);\n\n const MenuItem = showSearch ? Command.Item : Menu.Item;\n const MenuSeparator = showSearch ? Command.Separator : Menu.Separator;\n\n const renderMenuItem = useCallback(\n (item: DropdownMenuItemType, i: number, j: number) => {\n if (item.type === \"item\") {\n return (\n <MenuItem\n key={i + \"-\" + j}\n className={clsx(cls(\"dropdown-menu-item\"), classNames?.item)}\n disabled={item.disabled}\n data-danger={item.danger}\n ref={item.ref as Ref<HTMLDivElement>}\n onClick={item.onClick}\n onMouseEnter={item.onMouseEnter}\n onMouseLeave={item.onMouseLeave}\n onMouseOver={item.onMouseOver}\n onMouseOut={item.onMouseOut}\n render={\n itemRender\n ? (itemProps) => itemRender(item, itemProps)\n : undefined\n }\n >\n {item.icon && (\n <span\n className={clsx(\n cls(\"dropdown-menu-item-icon\"),\n classNames?.itemIcon\n )}\n >\n {item.icon}\n </span>\n )}\n <span>{item.label}</span>\n </MenuItem>\n );\n } else if (item.type === \"divider\") {\n return (\n <MenuSeparator\n key={i + \"-\" + j}\n className={clsx(\n cls(\"dropdown-menu-divider\"),\n classNames?.separator\n )}\n />\n );\n }\n\n // else if (item.type === \"header\") {\n // return (\n // <Menu.GroupLabel\n // key={i + \"-\" + j}\n // className={clsx(\n // cls(\"dropdown-menu-header\"),\n // classNames?.groupLabel\n // )}\n // >\n // <span>{item.title}</span>\n // </Menu.GroupLabel>\n // );\n // }\n return null;\n },\n [cls, classNames, itemRender, MenuItem, MenuSeparator]\n );\n\n const renderGroup = useCallback(\n (group: DropdownMenuGroup, index: number) => (\n <Menu.Group\n key={\"group\" + index}\n className={clsx(cls(\"dropdown-menu-group\"), classNames?.group)}\n >\n {group.label && (\n <Menu.GroupLabel\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{group.label}</span>\n </Menu.GroupLabel>\n )}\n {group.items.map((item, j) => renderMenuItem(item, index, j))}\n </Menu.Group>\n ),\n [cls, classNames, renderMenuItem]\n );\n\n const renderGroupShowSearch = useCallback(\n (group: DropdownMenuGroup, index: number) =>\n group.label ? (\n <Command.Group\n key={\"group\" + index}\n className={clsx(cls(\"dropdown-menu-group\"), classNames?.group)}\n heading={\n <Menu.GroupLabel\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{group.label}</span>\n </Menu.GroupLabel>\n }\n >\n {group.items.map((item, j) => renderMenuItem(item, index, j))}\n </Command.Group>\n ) : (\n group.items.map((item, j) => renderMenuItem(item, index, j))\n ),\n [cls, classNames, renderMenuItem]\n );\n\n const renderMenuInner = useCallback(\n () =>\n showSearch ? (\n <Command>\n <Command.Input\n {...searchProps}\n render={\n <Input allowClear className={cls(\"dropdown-menu-search\")} />\n }\n />\n <Command.List>\n <Command.Empty className={cls(\"dropdown-menu-empty\")}>\n No results found.\n </Command.Empty>\n {itemGroups.map(renderGroupShowSearch)}\n </Command.List>\n </Command>\n ) : (\n itemGroups.map(renderGroup)\n ),\n [\n showSearch,\n itemGroups,\n renderGroupShowSearch,\n renderGroup,\n searchProps,\n cls,\n ]\n );\n\n const BaseComponent = showSearch ? Popover : Menu;\n\n return (\n <BaseComponent.Root\n openOnHover={openOnHover}\n open={open}\n onOpenChange={onOpenChange}\n >\n <BaseComponent.Trigger\n render={children}\n ref={buttonRef}\n className={clsx(\n cls(\"dropdown-menu-trigger\"),\n classNames?.trigger,\n antdCssVarClassname\n )}\n />\n <BaseComponent.Portal>\n <BaseComponent.Positioner\n side={headlessUIPlacement.placement}\n align={headlessUIPlacement.align}\n sideOffset={4}\n className={clsx(cls(\"dropdown-menu-root\"), classNames?.root)}\n >\n <BaseComponent.Popup\n className={clsx(\n cls(\"dropdown-menu\"),\n className,\n classNames?.popup,\n antdCssVarClassname\n )}\n style={\n {\n \"--size-width\":\n size in PopupPanelSize ? PopupPanelSize[size] : undefined,\n } as React.CSSProperties\n }\n >\n {renderMenuInner()}\n </BaseComponent.Popup>\n </BaseComponent.Positioner>\n </BaseComponent.Portal>\n </BaseComponent.Root>\n );\n};\n"],"names":["DropdownMenu","children","items","placement","openOnHover","outsideOpen","outsideOnOpenChange","className","itemRender","classNames","size","showSearch","searchProps","open","setOpen","useControlled","onOpenChange","useCallback","newValue","cls","useCls","antdCssVarClassname","useAntdCssVarClassname","headlessUIPlacement","parseAntdPlacement","buttonRef","useRef","itemGroups","acc","current","MenuItem","Command","Menu","MenuSeparator","renderMenuItem","item","i","j","jsxs","clsx","itemProps","jsx","renderGroup","group","index","renderGroupShowSearch","renderMenuInner","Input","BaseComponent","Popover","PopupPanelSize"],"mappings":";;;;;;;;;;;;AAqHO,MAAMA,KAAe,CAAC;AAAA,EAC3B,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAMC;AAAA,EACN,cAAcC;AAAA,EACd,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,YAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,IACZ,aAAa;AAAA,EAAA;AAEjB,MAAyB;AACvB,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAc;AAAA,IACpC,YAAYV;AAAA,IACZ,SAAS;AAAA,IACT,MAAM;AAAA,EAAA,CACP,GACKW,IAAeC;AAAA,IACnB,CAACC,MAAsB;AACrB,MAAAJ,EAAQI,CAAQ,GAChBZ,KAAA,QAAAA,EAAsBY;AAAA,IACxB;AAAA,IACA,CAACJ,GAASR,CAAmB;AAAA,EAC/B,GACMa,IAAMC,EAAO,GACbC,IAAsBC,EAAuB,GAC7CC,IAAsBC,EAAmBrB,CAAS,GAClDsB,IAAYC,EAA0B,IAAI,GAC1CC,IAAazB,EAAM,OAA4B,CAAC0B,GAAKC,OAErDD,EAAI,WAAW,KAAKC,EAAQ,SAAS,YACvCD,EAAI,KAAK;AAAA,I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AA,cAC3BV,KAAA,gBAAAA,EAAY;AAAA,cACZY;AAAA,YAAA;AAAA,UACF;AAAA,QACF;AAAA,QACA,gBAAAoB,EAACO,EAAc,QAAd,EACC,UAAA,gBAAAP;AAAA,UAACO,EAAc;AAAA,UAAd;AAAA,YACC,MAAMzB,EAAoB;AAAA,YAC1B,OAAOA,EAAoB;AAAA,YAC3B,YAAY;AAAA,YACZ,WAAWgB,EAAKpB,EAAI,oBAAoB,GAAGV,KAAA,gBAAAA,EAAY,IAAI;AAAA,YAE3D,UAAA,gBAAAgC;AAAA,cAACO,EAAc;AAAA,cAAd;AAAA,gBACC,WAAWT;AAAA,kBACTpB,EAAI,eAAe;AAAA,kBACnBZ;AAAA,kBACAE,KAAA,gBAAAA,EAAY;AAAA,kBACZY;AAAA,gBACF;AAAA,gBACA,OACE;AAAA,kBACE,gBACEX,KAAQwC,IAAiBA,EAAexC,CAAI,IAAI;AAAA,gBACpD;AAAA,gBAGD,UAAgBoC,EAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACnB;AAAA,QAAA,EAEJ,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/dropdown-menu/component.tsx"],"sourcesContent":["\"use client\";\nimport { Menu } from \"@base-ui-components/react/menu\";\nimport { useControlled } from \"@base-ui-components/react/utils\";\nimport { Popover } from \"@base-ui-components/react/popover\";\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { Ref, useCallback, useRef } from \"react\";\nimport {\n clsx,\n DROPDOWN_COLLISION_AVOIDANCE,\n parseAntdPlacement,\n useAntdCssVarClassname,\n useCls,\n} from \"../utils\";\nimport { Command } from \"../cmdk\";\n\n// Import component-specific styles\nimport { Input } from \"../input\";\nimport { PopupPanelSize } from \"../popup-panel/constants\";\n\nimport \"./style.css\";\n\nexport type DropdownMenuItemType =\n | {\n type: \"item\";\n label?: React.ReactNode;\n disabled?: boolean;\n icon?: React.ReactNode;\n key: React.Key;\n onClick?: React.HTMLAttributes<HTMLElement>[\"onClick\"];\n onMouseEnter?: React.HTMLAttributes<HTMLElement>[\"onMouseEnter\"];\n onMouseLeave?: React.HTMLAttributes<HTMLElement>[\"onMouseLeave\"];\n onMouseOver?: React.HTMLAttributes<HTMLElement>[\"onMouseOver\"];\n onMouseOut?: React.HTMLAttributes<HTMLElement>[\"onMouseOut\"];\n danger?: boolean;\n ref?: React.Ref<HTMLElement>;\n }\n | {\n type: \"divider\";\n }\n | {\n type: \"header\";\n title?: React.ReactNode;\n };\n\nexport interface DropdownMenuProps {\n /** Array of menu items to be displayed in the dropdown */\n items: DropdownMenuItemType[];\n /** Custom render function for the trigger element */\n children?: React.ComponentProps<typeof Menu.Trigger>[\"render\"];\n /**\n * Placement of the dropdown relative to the trigger element\n * @default \"bottomLeft\"\n */\n placement?: PopoverProps[\"placement\"];\n /**\n * Whether to open the dropdown on hover instead of click\n * @default false\n */\n openOnHover?: boolean;\n /**\n * Controlled open state of the dropdown\n */\n open?: boolean;\n /**\n * Callback fired when the dropdown open state changes\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Additional CSS class for the dropdown component\n */\n className?: string;\n /**\n * Custom class names for different parts of the dropdown\n * @default {}\n */\n classNames?: {\n root?: string;\n trigger?: string;\n popup?: string;\n group?: string;\n groupLabel?: string;\n item?: string;\n itemIcon?: string;\n itemText?: string;\n separator?: string;\n positioner?: string;\n };\n /**\n * Custom render function for menu items\n */\n itemRender?: (\n item: DropdownMenuItemType,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /**\n * Whether to show search input\n * @default false\n */\n showSearch?: boolean;\n /**\n * Size of the dropdown menu\n * @default \"auto\"\n */\n size?: \"auto\" | keyof typeof PopupPanelSize;\n /**\n * Search placeholder\n */\n searchProps?: Omit<\n React.ComponentProps<typeof Command.Input>,\n \"size\" | \"ref\"\n >;\n /**\n *\n */\n}\n\ninterface DropdownMenuGroup {\n label: React.ReactNode | null;\n items: DropdownMenuItemType[];\n}\n\nexport const DropdownMenu = ({\n children,\n items,\n placement,\n openOnHover,\n open: outsideOpen,\n onOpenChange: outsideOnOpenChange,\n className,\n itemRender,\n classNames,\n size = \"auto\",\n showSearch,\n searchProps = {\n placeholder: \"Search...\",\n },\n}: DropdownMenuProps) => {\n const [open, setOpen] = useControlled({\n controlled: outsideOpen,\n default: false,\n name: \"open\",\n });\n const onOpenChange = useCallback(\n (newValue: boolean) => {\n setOpen(newValue);\n outsideOnOpenChange?.(newValue);\n },\n [setOpen, outsideOnOpenChange]\n );\n const cls = useCls();\n const antdCssVarClassname = useAntdCssVarClassname();\n const headlessUIPlacement = parseAntdPlacement(placement);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const itemGroups = items.reduce<DropdownMenuGroup[]>((acc, current) => {\n // If no groups exist yet and current item is not a header, create default group\n if (acc.length === 0 && current.type !== \"header\") {\n acc.push({\n label: null,\n items: [],\n });\n }\n\n // If it's a header, create a new group\n if (current.type === \"header\") {\n acc.push({\n label: current.title,\n items: [],\n });\n }\n // If it's an item and we have at least one group, add it to the last group's items\n else if (\n (current.type === \"item\" || current.type === \"divider\") &&\n acc.length > 0\n ) {\n acc[acc.length - 1].items.push(current);\n }\n // Skip dividers\n return acc;\n }, []);\n\n const MenuSeparator = showSearch ? Command.Separator : Menu.Separator;\n\n const renderMenuItem = useCallback(\n (item: DropdownMenuItemType, i: number, j: number) => {\n const MenuItem = showSearch ? Command.Item : Menu.Item;\n\n if (item.type === \"item\") {\n const props = {\n className: clsx(cls(\"dropdown-menu-item\"), classNames?.item),\n disabled: item.disabled,\n \"data-danger\": item.danger,\n ref: item.ref as Ref<HTMLDivElement>,\n onClick: item.onClick,\n onMouseEnter: item.onMouseEnter,\n onMouseLeave: item.onMouseLeave,\n onMouseOver: item.onMouseOver,\n onMouseOut: item.onMouseOut,\n onSelect: showSearch\n ? () => {\n const e = new MouseEvent(\"click\", {\n bubbles: true,\n cancelable: true,\n }) as unknown as React.MouseEvent<HTMLElement, MouseEvent>;\n item.onClick(e);\n onOpenChange?.(false);\n }\n : undefined,\n render: itemRender\n ? (itemProps: React.HTMLAttributes<HTMLElement>) =>\n itemRender(item, itemProps)\n : undefined,\n children: [\n item.icon && (\n <span\n key=\"icon\"\n className={clsx(\n cls(\"dropdown-menu-item-icon\"),\n classNames?.itemIcon\n )}\n >\n {item.icon}\n </span>\n ),\n <span key=\"label\">{item.label}</span>,\n ],\n };\n return showSearch ? (\n <Command.Item key={i + \"-\" + j} {...props}></Command.Item>\n ) : (\n <MenuItem key={i + \"-\" + j} {...props}></MenuItem>\n );\n } else if (item.type === \"divider\") {\n return (\n <MenuSeparator\n key={i + \"-\" + j}\n className={clsx(\n cls(\"dropdown-menu-divider\"),\n classNames?.separator\n )}\n />\n );\n }\n return null;\n },\n [cls, classNames, itemRender, onOpenChange, showSearch, MenuSeparator]\n );\n\n const renderGroup = useCallback(\n (group: DropdownMenuGroup, index: number) => (\n <Menu.Group\n key={\"group\" + index}\n className={clsx(cls(\"dropdown-menu-group\"), classNames?.group)}\n >\n {group.label && (\n <Menu.GroupLabel\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{group.label}</span>\n </Menu.GroupLabel>\n )}\n {group.items.map((item, j) => renderMenuItem(item, index, j))}\n </Menu.Group>\n ),\n [cls, classNames, renderMenuItem]\n );\n\n const renderGroupShowSearch = useCallback(\n (group: DropdownMenuGroup, index: number) =>\n group.label ? (\n <Command.Group\n key={\"group\" + index}\n className={clsx(cls(\"dropdown-menu-group\"), classNames?.group)}\n heading={\n <Menu.GroupLabel\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{group.label}</span>\n </Menu.GroupLabel>\n }\n >\n {group.items.map((item, j) => renderMenuItem(item, index, j))}\n </Command.Group>\n ) : (\n group.items.map((item, j) => renderMenuItem(item, index, j))\n ),\n [cls, classNames, renderMenuItem]\n );\n\n const renderMenuInner = useCallback(\n () =>\n showSearch ? (\n <Command>\n <Command.Input\n {...searchProps}\n key=\"search\"\n render={\n <Input allowClear className={cls(\"dropdown-menu-search\")} />\n }\n />\n <Command.List>\n <Command.Empty className={cls(\"dropdown-menu-empty\")}>\n No results found.\n </Command.Empty>\n {itemGroups.map(renderGroupShowSearch)}\n </Command.List>\n </Command>\n ) : (\n itemGroups.map(renderGroup)\n ),\n [\n showSearch,\n itemGroups,\n renderGroupShowSearch,\n renderGroup,\n searchProps,\n cls,\n ]\n );\n\n const BaseComponent = showSearch ? Popover : Menu;\n\n return (\n <BaseComponent.Root\n openOnHover={openOnHover}\n open={open}\n onOpenChange={onOpenChange}\n >\n <BaseComponent.Trigger\n render={children}\n ref={buttonRef}\n className={clsx(\n cls(\"dropdown-menu-trigger\"),\n classNames?.trigger,\n antdCssVarClassname\n )}\n />\n <BaseComponent.Portal>\n <BaseComponent.Positioner\n side={headlessUIPlacement.placement}\n align={headlessUIPlacement.align}\n sideOffset={4}\n className={clsx(cls(\"dropdown-menu-root\"), classNames?.root)}\n collisionAvoidance={DROPDOWN_COLLISION_AVOIDANCE}\n >\n <BaseComponent.Popup\n className={clsx(\n cls(\"dropdown-menu\"),\n className,\n classNames?.popup,\n antdCssVarClassname\n )}\n style={\n {\n \"--size-width\":\n size in PopupPanelSize ? PopupPanelSize[size] : undefined,\n } as React.CSSProperties\n }\n >\n {renderMenuInner()}\n </BaseComponent.Popup>\n </BaseComponent.Positioner>\n </BaseComponent.Portal>\n </BaseComponent.Root>\n );\n};\n"],"names":["DropdownMenu","children","items","placement","openOnHover","outsideOpen","outsideOnOpenChange","className","itemRender","classNames","size","showSearch","searchProps","open","setOpen","useControlled","onOpenChange","useCallback","newValue","cls","useCls","antdCssVarClassname","useAntdCssVarClassname","headlessUIPlacement","parseAntdPlacement","buttonRef","useRef","itemGroups","acc","current","MenuSeparator","Command","Menu","renderMenuItem","item","i","j","MenuItem","props","clsx","e","itemProps","jsx","renderGroup","group","index","jsxs","renderGroupShowSearch","renderM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AQlD;AAAA,YACR,KAAKwB;AAAA,YACL,WAAWc;AAAA,cACTpB,EAAI,uBAAuB;AAAA,cAC3BV,KAAA,gBAAAA,EAAY;AAAA,cACZY;AAAA,YAAA;AAAA,UACF;AAAA,QACF;AAAA,QACA,gBAAAqB,EAACS,EAAc,QAAd,EACC,UAAA,gBAAAT;AAAA,UAACS,EAAc;AAAA,UAAd;AAAA,YACC,MAAM5B,EAAoB;AAAA,YAC1B,OAAOA,EAAoB;AAAA,YAC3B,YAAY;AAAA,YACZ,WAAWgB,EAAKpB,EAAI,oBAAoB,GAAGV,KAAA,gBAAAA,EAAY,IAAI;AAAA,YAC3D,oBAAoB4C;AAAA,YAEpB,UAAA,gBAAAX;AAAA,cAACS,EAAc;AAAA,cAAd;AAAA,gBACC,WAAWZ;AAAA,kBACTpB,EAAI,eAAe;AAAA,kBACnBZ;AAAA,kBACAE,KAAA,gBAAAA,EAAY;AAAA,kBACZY;AAAA,gBACF;AAAA,gBACA,OACE;AAAA,kBACE,gBACEX,KAAQ4C,IAAiBA,EAAe5C,CAAI,IAAI;AAAA,gBACpD;AAAA,gBAGD,UAAgBsC,EAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACnB;AAAA,QAAA,EAEJ,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1,62 +1,65 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as m } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef as w } from "react";
|
|
4
|
-
import { useRender as N } from "@base-ui-components/react/use-render";
|
|
5
4
|
import './style.css';/* empty css */
|
|
6
|
-
import { Tooltip as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
5
|
+
import { Tooltip as N } from "../tooltip/component.js";
|
|
6
|
+
import { WithRenderProp as P } from "../utils/WithRenderProp.js";
|
|
7
|
+
import { Spin as S } from "../spin/component.js";
|
|
8
|
+
import { useCls as T } from "../utils/antdUtils.js";
|
|
9
|
+
import { clsx as W } from "../utils/cn.js";
|
|
10
|
+
const $ = ({
|
|
11
11
|
label: s,
|
|
12
|
-
size:
|
|
13
|
-
negativeMargin:
|
|
14
|
-
children:
|
|
12
|
+
size: d = "medium",
|
|
13
|
+
negativeMargin: l = !0,
|
|
14
|
+
children: b,
|
|
15
15
|
className: f,
|
|
16
|
-
tooltipProps:
|
|
17
|
-
as:
|
|
18
|
-
href:
|
|
16
|
+
tooltipProps: v = {},
|
|
17
|
+
as: x,
|
|
18
|
+
href: t,
|
|
19
19
|
// Extract anchor-specific props
|
|
20
20
|
target: r,
|
|
21
21
|
rel: e,
|
|
22
22
|
download: c,
|
|
23
23
|
hrefLang: p,
|
|
24
24
|
referrerPolicy: u,
|
|
25
|
-
loading:
|
|
26
|
-
render:
|
|
27
|
-
...
|
|
28
|
-
},
|
|
29
|
-
const n =
|
|
25
|
+
loading: o,
|
|
26
|
+
render: C,
|
|
27
|
+
...I
|
|
28
|
+
}, B) => {
|
|
29
|
+
const n = T(), R = W(
|
|
30
30
|
n("icon-button"),
|
|
31
|
-
n(`icon-button-${
|
|
32
|
-
n(
|
|
31
|
+
n(`icon-button-${d}`),
|
|
32
|
+
n(l ? "icon-button-negative-margin" : ""),
|
|
33
33
|
f
|
|
34
|
-
), i =
|
|
35
|
-
ref:
|
|
34
|
+
), i = x || (t ? "a" : "button"), j = {
|
|
35
|
+
ref: B,
|
|
36
36
|
className: R,
|
|
37
37
|
...i === "button" && { type: "button" },
|
|
38
38
|
...i === "a" ? {
|
|
39
|
-
...
|
|
39
|
+
...t && { href: t },
|
|
40
40
|
...r !== void 0 && { target: r },
|
|
41
41
|
...e !== void 0 && { rel: e },
|
|
42
42
|
...c !== void 0 && { download: c },
|
|
43
43
|
...p !== void 0 && { hrefLang: p },
|
|
44
44
|
...u !== void 0 && { referrerPolicy: u }
|
|
45
45
|
} : {},
|
|
46
|
-
"data-loading":
|
|
47
|
-
children:
|
|
48
|
-
...
|
|
49
|
-
}, a =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
"data-loading": o,
|
|
47
|
+
children: o ? /* @__PURE__ */ m(S, {}) : b,
|
|
48
|
+
...I
|
|
49
|
+
}, a = /* @__PURE__ */ m(
|
|
50
|
+
P,
|
|
51
|
+
{
|
|
52
|
+
as: i,
|
|
53
|
+
render: C,
|
|
54
|
+
...j,
|
|
55
|
+
state: {
|
|
56
|
+
loading: o
|
|
57
|
+
}
|
|
55
58
|
}
|
|
56
|
-
|
|
57
|
-
return s ? /* @__PURE__ */ m(
|
|
58
|
-
},
|
|
59
|
+
);
|
|
60
|
+
return s ? /* @__PURE__ */ m(N, { title: s, arrow: !1, ...v, children: a }) : a;
|
|
61
|
+
}, F = w($);
|
|
59
62
|
export {
|
|
60
|
-
|
|
63
|
+
F as IconButton
|
|
61
64
|
};
|
|
62
65
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/icon-button/component.tsx"],"sourcesContent":["\"use client\";\nimport React, {\n forwardRef,\n type ElementType,\n type
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/icon-button/component.tsx"],"sourcesContent":["\"use client\";\nimport React, {\n forwardRef,\n type ElementType,\n type ReactElement,\n type Ref,\n ComponentPropsWithRef,\n} from \"react\";\nimport { Tooltip, TooltipProps } from \"../tooltip\";\nimport {\n useCls,\n clsx,\n WithRenderPropProps,\n WithRenderProp,\n ElementTypeToDOMType,\n} from \"../utils\";\nimport { Spin } from \"../spin\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\n// Base props without href/as handling\nexport type IconButtonProps<E extends ElementType = \"button\"> =\n WithRenderPropProps<E, { loading: boolean }> & {\n /**\n * Label text or element to display within tooltip\n * @default undefined\n */\n label?: React.ReactNode;\n /**\n * Size of the icon button: small (1.25rem) or medium (1.5rem)\n * @default medium\n */\n size?: \"small\" | \"medium\";\n /**\n * Whether to apply negative margin for better visual alignment\n * @default true\n */\n negativeMargin?: boolean;\n /**\n * Whether to show loading state\n * @default false\n */\n loading?: boolean;\n /**\n * Props to pass to the Tooltip component when wrapping the button\n */\n tooltipProps?: TooltipProps;\n };\n\n/**\n * Implementation of the IconButton component\n */\nconst IconButtonImpl = <E extends ElementType = \"button\">(\n {\n label,\n size = \"medium\",\n negativeMargin = true,\n children,\n className,\n tooltipProps = {},\n as,\n href,\n // Extract anchor-specific props\n target,\n rel,\n download,\n hrefLang,\n referrerPolicy,\n loading,\n render,\n ...rest\n }: IconButtonProps<E>,\n ref: Ref<ElementTypeToDOMType<E>>\n) => {\n const cls = useCls();\n const buttonClasses = clsx(\n cls(\"icon-button\"),\n cls(`icon-button-${size}`),\n cls(negativeMargin ? \"icon-button-negative-margin\" : \"\"),\n className\n );\n\n // Use a type assertion for the component to avoid TypeScript errors\n const Component = (as || (href ? \"a\" : \"button\")) as ElementType;\n\n const elementProps = {\n ref,\n className: buttonClasses,\n ...(Component === \"button\" && { type: \"button\" }),\n ...(Component === \"a\"\n ? {\n ...(href && { href }),\n ...(target !== undefined && { target }),\n ...(rel !== undefined && { rel }),\n ...(download !== undefined && { download }),\n ...(hrefLang !== undefined && { hrefLang }),\n ...(referrerPolicy !== undefined && { referrerPolicy }),\n }\n : {}),\n \"data-loading\": loading,\n children: loading ? <Spin /> : children,\n ...rest,\n };\n\n const element = (\n <WithRenderProp\n as={Component}\n render={render}\n {...elementProps}\n state={{\n loading,\n }}\n />\n );\n\n return label ? (\n <Tooltip title={label} arrow={false} {...tooltipProps}>\n {element}\n </Tooltip>\n ) : (\n element\n );\n};\n\n// Export with correct typing\nexport const IconButton = forwardRef(IconButtonImpl) as <\n E extends ElementType = \"button\"\n>(\n props: IconButtonProps<E> & { ref?: ComponentPropsWithRef<E>[\"ref\"] }\n) => ReturnType<typeof IconButtonImpl>;\n"],"names":["IconButtonImpl","label","size","negativeMargin","children","className","tooltipProps","as","href","target","rel","download","hrefLang","referrerPolicy","loading","render","rest","ref","cls","useCls","buttonClasses","clsx","Component","elementProps","jsx","Spin","element","WithRenderProp","Tooltip","IconButton","forwardRef"],"mappings":";;;;;;;;;AAqDA,MAAMA,IAAiB,CACrB;AAAA,EACE,OAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,gBAAAC,IAAiB;AAAA,EACjB,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC,IAAe,CAAC;AAAA,EAChB,IAAAC;AAAA,EACA,MAAAC;AAAA;AAAA,EAEA,QAAAC;AAAA,EACA,KAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,GAAGC;AACL,GACAC,MACG;AACH,QAAMC,IAAMC,EAAO,GACbC,IAAgBC;AAAA,IACpBH,EAAI,aAAa;AAAA,IACjBA,EAAI,eAAehB,CAAI,EAAE;AAAA,IACzBgB,EAAIf,IAAiB,gCAAgC,EAAE;AAAA,IACvDE;AAAA,EACF,GAGMiB,IAAaf,MAAOC,IAAO,MAAM,WAEjCe,IAAe;AAAA,IACnB,KAAAN;AAAA,IACA,WAAWG;AAAA,IACX,GAAIE,MAAc,YAAY,EAAE,MAAM,SAAS;AAAA,IAC/C,GAAIA,MAAc,MACd;AAAA,MACE,GAAId,KAAQ,EAAE,MAAAA,EAAK;AAAA,MACnB,GAAIC,MAAW,UAAa,EAAE,QAAAA,EAAO;AAAA,MACrC,GAAIC,MAAQ,UAAa,EAAE,KAAAA,EAAI;AAAA,MAC/B,GAAIC,MAAa,UAAa,EAAE,UAAAA,EAAS;AAAA,MACzC,GAAIC,MAAa,UAAa,EAAE,UAAAA,EAAS;AAAA,MACzC,GAAIC,MAAmB,UAAa,EAAE,gBAAAA,EAAe;AAAA,IAAA,IAEvD,CAAC;AAAA,IACL,gBAAgBC;AAAA,IAChB,UAAUA,IAAW,gBAAAU,EAAAC,GAAA,CAAA,CAAK,IAAKrB;AAAA,IAC/B,GAAGY;AAAA,EACL,GAEMU,IACJ,gBAAAF;AAAA,IAACG;AAAA,IAAA;AAAA,MACC,IAAIL;AAAA,MACJ,QAAAP;AAAA,MACC,GAAGQ;AAAA,MACJ,OAAO;AAAA,QACL,SAAAT;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAGK,SAAAb,IACJ,gBAAAuB,EAAAI,GAAA,EAAQ,OAAO3B,GAAO,OAAO,IAAQ,GAAGK,GACtC,UAAAoB,EAAA,CACH,IAEAA;AAEJ,GAGaG,IAAaC,EAAW9B,CAAc;"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { useRender as
|
|
4
|
-
const
|
|
5
|
-
const { render:
|
|
6
|
-
return
|
|
7
|
-
render:
|
|
8
|
-
props:
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as m } from "react";
|
|
3
|
+
import { useRender as i } from "@base-ui-components/react/use-render";
|
|
4
|
+
const p = (e, r) => {
|
|
5
|
+
const { render: t, as: n = "div", ...o } = e;
|
|
6
|
+
return i({
|
|
7
|
+
render: t || ((d) => /* @__PURE__ */ s(n, { ...d })),
|
|
8
|
+
props: o,
|
|
9
|
+
state: e.state,
|
|
9
10
|
ref: r
|
|
10
11
|
});
|
|
11
|
-
}, h = p
|
|
12
|
+
}, h = m(p);
|
|
12
13
|
export {
|
|
13
14
|
h as WithRenderProp
|
|
14
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WithRenderProp.js","sources":["../../../src/components/utils/WithRenderProp.tsx"],"sourcesContent":["import React, { forwardRef
|
|
1
|
+
{"version":3,"file":"WithRenderProp.js","sources":["../../../src/components/utils/WithRenderProp.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\nimport { useRender } from \"@base-ui-components/react/use-render\";\nimport { ElementTypeToDOMType } from \"./types\";\n\nexport type WithRenderPropProps<\n T extends React.ElementType = \"div\",\n State extends Record<string, unknown> = Record<string, unknown>\n> = React.ComponentPropsWithoutRef<T> & {\n render?: useRender.RenderProp<State>;\n as?: T;\n state?: State;\n};\n\nconst WithRenderPropInner = <\n T extends React.ElementType = \"div\",\n State extends Record<string, unknown> = Record<string, unknown>\n>(\n props: WithRenderPropProps<T, State>,\n ref: React.ForwardedRef<T>\n) => {\n const { render, as: Tag = \"div\", ...etc } = props;\n const renderedElement = useRender({\n render: render || ((props) => <Tag {...props} />),\n props: etc,\n state: props.state,\n ref: ref as unknown as React.Ref<ElementTypeToDOMType<T>>,\n });\n return renderedElement;\n};\n\nexport const WithRenderProp = forwardRef(WithRenderPropInner) as <\n T extends React.ElementType = \"div\",\n State extends Record<string, unknown> = Record<string, unknown>\n>(\n props: WithRenderPropProps<T, State> & {\n ref?: React.Ref<ElementTypeToDOMType<T>>;\n }\n) => ReturnType<typeof WithRenderPropInner>;\n"],"names":["WithRenderPropInner","props","ref","render","Tag","etc","useRender","jsx","WithRenderProp","forwardRef"],"mappings":";;;AAaA,MAAMA,IAAsB,CAI1BC,GACAC,MACG;AACH,QAAM,EAAE,QAAAC,GAAQ,IAAIC,IAAM,OAAO,GAAGC,MAAQJ;AAOrC,SANiBK,EAAU;AAAA,IAChC,QAAQH,MAAW,CAACF,MAAW,gBAAAM,EAAAH,GAAA,EAAK,GAAGH,EAAO,CAAA;AAAA,IAC9C,OAAOI;AAAA,IACP,OAAOJ,EAAM;AAAA,IACb,KAAAC;AAAA,EAAA,CACD;AAEH,GAEaM,IAAiBC,EAAWT,CAAmB;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../src/components/utils/constants.ts"],"sourcesContent":["/**\n * Used for dropdowns that usually strictly prefer top/bottom placements and\n * use `var(--available-height)` to limit their height.\n */\nexport const DROPDOWN_COLLISION_AVOIDANCE = {\n fallbackAxisSide: \"none\",\n} as const;\n\n/**\n * Used by regular popups that usually aren't scrollable and are allowed to\n * freely flip to any axis of placement.\n */\nexport const POPUP_COLLISION_AVOIDANCE = {\n fallbackAxisSide: \"end\",\n} as const;\n"],"names":["DROPDOWN_COLLISION_AVOIDANCE","POPUP_COLLISION_AVOIDANCE"],"mappings":"AAIO,MAAMA,IAA+B;AAAA,EAC1C,kBAAkB;AACpB,GAMaC,IAA4B;AAAA,EACvC,kBAAkB;AACpB;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { Alert } from 'antd';
|
|
|
5
5
|
import { AlertProps } from 'antd';
|
|
6
6
|
import { AliasToken } from 'antd/es/theme/internal';
|
|
7
7
|
import { Anchor } from 'antd';
|
|
8
|
-
import { AnchorHTMLAttributes } from 'react';
|
|
9
8
|
import { AnchorLinkProps } from 'antd';
|
|
10
9
|
import { AnchorProps } from 'antd';
|
|
11
10
|
import { App } from 'antd';
|
|
@@ -265,8 +264,6 @@ export { AnchorLinkProps }
|
|
|
265
264
|
|
|
266
265
|
export { AnchorProps }
|
|
267
266
|
|
|
268
|
-
declare type AnchorSpecificProps = Pick<AnchorHTMLAttributes<HTMLAnchorElement>, "target" | "rel" | "download" | "hrefLang" | "referrerPolicy">;
|
|
269
|
-
|
|
270
267
|
export declare const antdColorTokens: ColorTokens;
|
|
271
268
|
|
|
272
269
|
declare type AnyFunction = (...args: any[]) => any;
|
|
@@ -1556,6 +1553,14 @@ export { DrawerProps }
|
|
|
1556
1553
|
|
|
1557
1554
|
export { Dropdown }
|
|
1558
1555
|
|
|
1556
|
+
/**
|
|
1557
|
+
* Used for dropdowns that usually strictly prefer top/bottom placements and
|
|
1558
|
+
* use `var(--available-height)` to limit their height.
|
|
1559
|
+
*/
|
|
1560
|
+
export declare const DROPDOWN_COLLISION_AVOIDANCE: {
|
|
1561
|
+
readonly fallbackAxisSide: "none";
|
|
1562
|
+
};
|
|
1563
|
+
|
|
1559
1564
|
export declare const DropdownMenu: ({ children, items, placement, openOnHover, open: outsideOpen, onOpenChange: outsideOnOpenChange, className, itemRender, classNames, size, showSearch, searchProps, }: DropdownMenuProps) => JSX.Element;
|
|
1560
1565
|
|
|
1561
1566
|
export declare type DropdownMenuItemType = {
|
|
@@ -1663,7 +1668,7 @@ export declare interface DSRootProps extends ThemeProviderProps {
|
|
|
1663
1668
|
appendClassesTo?: string | HTMLElement;
|
|
1664
1669
|
}
|
|
1665
1670
|
|
|
1666
|
-
declare type ElementTypeToDOMType<T extends
|
|
1671
|
+
export declare type ElementTypeToDOMType<T extends React.ElementType> = T extends keyof JSX_2.IntrinsicElements ? JSX_2.IntrinsicElements[T] extends React.DetailedHTMLProps<infer _Props, infer Element> ? Element : never : never;
|
|
1667
1672
|
|
|
1668
1673
|
export declare const Empty: ({ image, size, className, ...rest }: EmptyProps) => JSX.Element;
|
|
1669
1674
|
|
|
@@ -1770,9 +1775,18 @@ export { GlobalToken }
|
|
|
1770
1775
|
|
|
1771
1776
|
export { Grid }
|
|
1772
1777
|
|
|
1773
|
-
export declare const IconButton:
|
|
1778
|
+
export declare const IconButton: <E extends ElementType = "button">(props: IconButtonProps<E> & {
|
|
1779
|
+
ref?: ComponentPropsWithRef<E>["ref"];
|
|
1780
|
+
}) => ReturnType<typeof IconButtonImpl>;
|
|
1781
|
+
|
|
1782
|
+
/**
|
|
1783
|
+
* Implementation of the IconButton component
|
|
1784
|
+
*/
|
|
1785
|
+
declare const IconButtonImpl: <E extends ElementType = "button">({ label, size, negativeMargin, children, className, tooltipProps, as, href, target, rel, download, hrefLang, referrerPolicy, loading, render, ...rest }: IconButtonProps<E>, ref: Ref<ElementTypeToDOMType<E>>) => JSX.Element;
|
|
1774
1786
|
|
|
1775
|
-
declare type
|
|
1787
|
+
export declare type IconButtonProps<E extends ElementType = "button"> = WithRenderPropProps<E, {
|
|
1788
|
+
loading: boolean;
|
|
1789
|
+
}> & {
|
|
1776
1790
|
/**
|
|
1777
1791
|
* Label text or element to display within tooltip
|
|
1778
1792
|
* @default undefined
|
|
@@ -1797,25 +1811,8 @@ declare type IconButtonBaseProps = {
|
|
|
1797
1811
|
* Props to pass to the Tooltip component when wrapping the button
|
|
1798
1812
|
*/
|
|
1799
1813
|
tooltipProps?: TooltipProps;
|
|
1800
|
-
/**
|
|
1801
|
-
* Custom render function for the button
|
|
1802
|
-
*/
|
|
1803
|
-
render?: useRender.RenderProp<{
|
|
1804
|
-
loading: boolean;
|
|
1805
|
-
}>;
|
|
1806
1814
|
};
|
|
1807
1815
|
|
|
1808
|
-
/**
|
|
1809
|
-
* Type for wrapping the forwardRef implementation
|
|
1810
|
-
*/
|
|
1811
|
-
declare type IconButtonComponent = <E extends ElementType = "button">(props: IconButtonProps<E> & {
|
|
1812
|
-
ref?: ComponentPropsWithRef<E>["ref"];
|
|
1813
|
-
}) => ReactElement;
|
|
1814
|
-
|
|
1815
|
-
declare type IconButtonOwnProps<E extends ElementType = ElementType> = WithHrefProps<E> | WithoutHrefProps<E>;
|
|
1816
|
-
|
|
1817
|
-
export declare type IconButtonProps<E extends ElementType = "button"> = IconButtonOwnProps<E> & Omit<ComponentPropsWithoutRef<E>, keyof IconButtonOwnProps<E>>;
|
|
1818
|
-
|
|
1819
1816
|
declare const InnerInternalTable: <RecordType extends object = object>({ columns, locale, emptyDescription, loading, virtual, scroll: scrollProp, className, variant, ...rest }: TableProps<RecordType>, ref: Ref<TableRef>) => JSX.Element;
|
|
1820
1817
|
|
|
1821
1818
|
declare function InnerToast({ toast, }: {
|
|
@@ -2090,8 +2087,9 @@ export declare interface PasswordProps extends PasswordProps_2 {
|
|
|
2090
2087
|
}
|
|
2091
2088
|
|
|
2092
2089
|
declare const pkg: default_2.ForwardRefExoticComponent<Children & Omit<default_2.DetailedHTMLProps<default_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
2093
|
-
render?: useRender_2.RenderProp
|
|
2090
|
+
render?: useRender_2.RenderProp<Record<string, unknown>>;
|
|
2094
2091
|
as?: "div";
|
|
2092
|
+
state?: Record<string, unknown>;
|
|
2095
2093
|
} & {
|
|
2096
2094
|
/**
|
|
2097
2095
|
* Accessible label for this command menu. Not shown visibly.
|
|
@@ -2134,8 +2132,9 @@ declare const pkg: default_2.ForwardRefExoticComponent<Children & Omit<default_2
|
|
|
2134
2132
|
vimBindings?: boolean;
|
|
2135
2133
|
} & default_2.RefAttributes<HTMLDivElement>> & {
|
|
2136
2134
|
List: default_2.ForwardRefExoticComponent<Children & Omit<default_2.DetailedHTMLProps<default_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
2137
|
-
render?: useRender_2.RenderProp
|
|
2135
|
+
render?: useRender_2.RenderProp<Record<string, unknown>>;
|
|
2138
2136
|
as?: "div";
|
|
2137
|
+
state?: Record<string, unknown>;
|
|
2139
2138
|
} & {
|
|
2140
2139
|
/**
|
|
2141
2140
|
* Accessible label for this List of suggestions. Not shown visibly.
|
|
@@ -2176,15 +2175,17 @@ declare const pkg: default_2.ForwardRefExoticComponent<Children & Omit<default_2
|
|
|
2176
2175
|
forceMount?: boolean;
|
|
2177
2176
|
} & default_2.RefAttributes<HTMLDivElement>>;
|
|
2178
2177
|
Separator: default_2.ForwardRefExoticComponent<Omit<default_2.DetailedHTMLProps<default_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
2179
|
-
render?: useRender_2.RenderProp
|
|
2178
|
+
render?: useRender_2.RenderProp<Record<string, unknown>>;
|
|
2180
2179
|
as?: "div";
|
|
2180
|
+
state?: Record<string, unknown>;
|
|
2181
2181
|
} & {
|
|
2182
2182
|
/** Whether this separator should always be rendered. Useful if you disable automatic filtering. */
|
|
2183
2183
|
alwaysRender?: boolean;
|
|
2184
2184
|
} & default_2.RefAttributes<HTMLDivElement>>;
|
|
2185
2185
|
Dialog: default_2.ForwardRefExoticComponent<Dialog.Root.Props & Children & Omit<default_2.DetailedHTMLProps<default_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
2186
|
-
render?: useRender_2.RenderProp
|
|
2186
|
+
render?: useRender_2.RenderProp<Record<string, unknown>>;
|
|
2187
2187
|
as?: "div";
|
|
2188
|
+
state?: Record<string, unknown>;
|
|
2188
2189
|
} & {
|
|
2189
2190
|
/**
|
|
2190
2191
|
* Accessible label for this command menu. Not shown visibly.
|
|
@@ -2234,12 +2235,14 @@ declare const pkg: default_2.ForwardRefExoticComponent<Children & Omit<default_2
|
|
|
2234
2235
|
container?: HTMLElement;
|
|
2235
2236
|
} & default_2.RefAttributes<HTMLDivElement>>;
|
|
2236
2237
|
Empty: default_2.ForwardRefExoticComponent<Children & Omit<default_2.DetailedHTMLProps<default_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
2237
|
-
render?: useRender_2.RenderProp
|
|
2238
|
+
render?: useRender_2.RenderProp<Record<string, unknown>>;
|
|
2238
2239
|
as?: "div";
|
|
2240
|
+
state?: Record<string, unknown>;
|
|
2239
2241
|
} & default_2.RefAttributes<HTMLDivElement>>;
|
|
2240
2242
|
Loading: default_2.ForwardRefExoticComponent<Children & Omit<default_2.DetailedHTMLProps<default_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
2241
|
-
render?: useRender_2.RenderProp
|
|
2243
|
+
render?: useRender_2.RenderProp<Record<string, unknown>>;
|
|
2242
2244
|
as?: "div";
|
|
2245
|
+
state?: Record<string, unknown>;
|
|
2243
2246
|
} & {
|
|
2244
2247
|
/** Estimated progress of loading asynchronous options. */
|
|
2245
2248
|
progress?: number;
|
|
@@ -2264,6 +2267,14 @@ export declare interface PopoverProps extends PopoverProps_2 {
|
|
|
2264
2267
|
arrow?: PopoverProps_2["arrow"];
|
|
2265
2268
|
}
|
|
2266
2269
|
|
|
2270
|
+
/**
|
|
2271
|
+
* Used by regular popups that usually aren't scrollable and are allowed to
|
|
2272
|
+
* freely flip to any axis of placement.
|
|
2273
|
+
*/
|
|
2274
|
+
export declare const POPUP_COLLISION_AVOIDANCE: {
|
|
2275
|
+
readonly fallbackAxisSide: "end";
|
|
2276
|
+
};
|
|
2277
|
+
|
|
2267
2278
|
export declare const PopupPanel: ({ children, placement, openOnHover, open: outsideOpen, onOpenChange: outsideOnOpenChange, content, title, trigger, className, anchor, beforeCloseButton, afterCloseButton, afterTitle, size, footer, defaultOpen, resizable, classNames, modal, closeOnClickOutside, }: PopupPanelProps) => JSX.Element;
|
|
2268
2279
|
|
|
2269
2280
|
export declare interface PopupPanelProps extends Omit<React.ComponentPropsWithRef<"div">, "title" | "content" | "children"> {
|
|
@@ -3567,27 +3578,16 @@ export declare type WidthAntdTokensProps<T extends IntrinsicElement> = {
|
|
|
3567
3578
|
|
|
3568
3579
|
export declare const WithAntdTokens: <T extends IntrinsicElement = "div">({ as: Tag, ref, className, ...rest }: WidthAntdTokensProps<T>) => null;
|
|
3569
3580
|
|
|
3570
|
-
declare
|
|
3571
|
-
href: string;
|
|
3572
|
-
as?: E;
|
|
3573
|
-
} & AnchorSpecificProps;
|
|
3574
|
-
|
|
3575
|
-
declare type WithoutHrefProps<E extends ElementType = "button"> = IconButtonBaseProps & {
|
|
3576
|
-
href?: undefined;
|
|
3577
|
-
as?: E;
|
|
3578
|
-
} & {
|
|
3579
|
-
[K in keyof AnchorSpecificProps]?: never;
|
|
3580
|
-
};
|
|
3581
|
-
|
|
3582
|
-
export declare const WithRenderProp: <T extends default_2.ElementType = "div">(props: WithRenderPropProps<T> & {
|
|
3581
|
+
export declare const WithRenderProp: <T extends default_2.ElementType = "div", State extends Record<string, unknown> = Record<string, unknown>>(props: WithRenderPropProps<T, State> & {
|
|
3583
3582
|
ref?: default_2.Ref<ElementTypeToDOMType<T>>;
|
|
3584
3583
|
}) => ReturnType<typeof WithRenderPropInner>;
|
|
3585
3584
|
|
|
3586
|
-
declare const WithRenderPropInner: <T extends default_2.ElementType = "div">(props: WithRenderPropProps<T>, ref: default_2.ForwardedRef<T>) => null;
|
|
3585
|
+
declare const WithRenderPropInner: <T extends default_2.ElementType = "div", State extends Record<string, unknown> = Record<string, unknown>>(props: WithRenderPropProps<T, State>, ref: default_2.ForwardedRef<T>) => null;
|
|
3587
3586
|
|
|
3588
|
-
export declare type WithRenderPropProps<T extends default_2.ElementType = "div"> = default_2.ComponentPropsWithoutRef<T> & {
|
|
3589
|
-
render?: useRender.RenderProp
|
|
3587
|
+
export declare type WithRenderPropProps<T extends default_2.ElementType = "div", State extends Record<string, unknown> = Record<string, unknown>> = default_2.ComponentPropsWithoutRef<T> & {
|
|
3588
|
+
render?: useRender.RenderProp<State>;
|
|
3590
3589
|
as?: T;
|
|
3590
|
+
state?: State;
|
|
3591
3591
|
};
|
|
3592
3592
|
|
|
3593
3593
|
export { }
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { componentMetadata as e, getComponentsByCategory as t } from "./metadata.js";
|
|
2
|
-
import { Affix as p, Alert as m, Anchor as s, App as f, AutoComplete as l, Avatar as n, BackTop as x, Calendar as i, Card as C, Carousel as c, Cascader as T, Col as u, ColorPicker as d, ConfigProvider as
|
|
2
|
+
import { Affix as p, Alert as m, Anchor as s, App as f, AutoComplete as l, Avatar as n, BackTop as x, Calendar as i, Card as C, Carousel as c, Cascader as T, Col as u, ColorPicker as d, ConfigProvider as S, DatePicker as g, Descriptions as h, Divider as A, Drawer as E, Dropdown as P, Flex as k, FloatButton as D, Grid as R, InputNumber as L, Layout as I, List as b, Mentions as O, Menu as y, Pagination as B, Popconfirm as N, Progress as v, QRCode as M, Rate as _, Result as U, Row as F, Skeleton as W, Space as w, Statistic as V, Steps as q, Tabs as G, TimePicker as K, Timeline as Q, Transfer as H, TreeSelect as j, Typography as z, Watermark as J, message as X, notification as Y, theme as Z, unstableSetRender as $, version as oo } from "antd";
|
|
3
3
|
import { Select as eo } from "./components/select/component.js";
|
|
4
4
|
import { Modal as ao } from "./components/modal/index.js";
|
|
5
5
|
import { IconButton as mo } from "./components/icon-button/component.js";
|
|
@@ -8,66 +8,67 @@ import { Checkbox as no } from "./components/checkbox/component.js";
|
|
|
8
8
|
import { Segmented as io } from "./components/segmented/component.js";
|
|
9
9
|
import { Table as co } from "./components/table/component.js";
|
|
10
10
|
import { Tag as uo } from "./components/tag/component.js";
|
|
11
|
-
import { ThemeProvider as
|
|
11
|
+
import { ThemeProvider as go } from "./components/theme-provider/component.js";
|
|
12
12
|
import { Split as Ao, Splitter as Eo } from "./components/splitter/component.js";
|
|
13
|
-
import { Truncate as
|
|
14
|
-
import { DropdownMenu as
|
|
15
|
-
import { clsx as
|
|
16
|
-
import { reactNodeToString as
|
|
17
|
-
import { isTracebackError as
|
|
18
|
-
import { isValidHexColor as
|
|
19
|
-
import { WithRenderProp as
|
|
20
|
-
import { parseAntdPlacement as
|
|
13
|
+
import { Truncate as ko } from "./components/truncate/component.js";
|
|
14
|
+
import { DropdownMenu as Ro } from "./components/dropdown-menu/component.js";
|
|
15
|
+
import { clsx as Io, cn as bo, cx as Oo } from "./components/utils/cn.js";
|
|
16
|
+
import { reactNodeToString as Bo } from "./components/utils/reactToString.js";
|
|
17
|
+
import { isTracebackError as vo } from "./components/utils/isTracebackError.js";
|
|
18
|
+
import { isValidHexColor as _o } from "./components/utils/colors.js";
|
|
19
|
+
import { WithRenderProp as Fo } from "./components/utils/WithRenderProp.js";
|
|
20
|
+
import { parseAntdPlacement as wo, useAntdCssVarClassname as Vo, useCls as qo, useGetPrefixCls as Go } from "./components/utils/antdUtils.js";
|
|
21
21
|
import { WithAntdTokens as Qo } from "./components/utils/WithAntdTokens.js";
|
|
22
22
|
import { changeThemeWithoutTransition as jo } from "./components/utils/theme.js";
|
|
23
23
|
import { moveTypingCursorToEnd as Jo } from "./components/utils/selectionRange.js";
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
24
|
+
import { DROPDOWN_COLLISION_AVOIDANCE as Yo, POPUP_COLLISION_AVOIDANCE as Zo } from "./components/utils/constants.js";
|
|
25
|
+
import { Transition as or } from "./components/transition/component.js";
|
|
26
|
+
import { DefaultUpload as er, Upload as tr } from "./components/upload/component.js";
|
|
27
|
+
import { useUploadItemRender as pr } from "./components/upload/hooks.js";
|
|
28
|
+
import { ScrollArea as sr } from "./components/scroll-area/component.js";
|
|
29
|
+
import { Popover as lr } from "./components/popover/component.js";
|
|
30
|
+
import { Slider as xr } from "./components/slider/component.js";
|
|
31
|
+
import { Tooltip as Cr } from "./components/tooltip/component.js";
|
|
32
|
+
import { Breadcrumb as Tr } from "./components/breadcrumb/component.js";
|
|
33
|
+
import { useUniqueKeysTree as dr } from "./components/tree/useUniqueKeysTree.js";
|
|
34
|
+
import { getUniqueKeysFromOriginals as gr, processTreeData as hr } from "./components/tree/helpers.js";
|
|
35
|
+
import { Tree as Er } from "./components/tree/components.js";
|
|
36
|
+
import { Spin as kr } from "./components/spin/component.js";
|
|
37
|
+
import { Empty as Rr, EmptyIcon as Lr } from "./components/empty/component.js";
|
|
37
38
|
import { Form as br } from "./components/form/component.js";
|
|
38
39
|
import { Field as yr } from "./components/field/component.js";
|
|
39
|
-
import { Tour as
|
|
40
|
-
import { Toast as
|
|
41
|
-
import { toast as
|
|
40
|
+
import { Tour as Nr } from "./components/tour/component.js";
|
|
41
|
+
import { Toast as Mr } from "./components/toast/component.js";
|
|
42
|
+
import { toast as Ur, toastManager as Fr } from "./components/toast/function.js";
|
|
42
43
|
import { VerticalCollapsiblePanel as wr } from "./components/vertical-collapsible-panel/component.js";
|
|
43
|
-
import { PopupPanel as
|
|
44
|
-
import { CodeBlock as
|
|
45
|
-
import { StackChild as
|
|
46
|
-
import { Stack as
|
|
47
|
-
import { Collapse as
|
|
48
|
-
import { Input as
|
|
49
|
-
import { Badge as
|
|
50
|
-
import { Radio as
|
|
51
|
-
import { Button as
|
|
52
|
-
import { DSRoot as
|
|
53
|
-
import { DSRootContextProvider as
|
|
54
|
-
import { DragDrop as
|
|
55
|
-
import { ColorSelect as
|
|
56
|
-
import { Nav as
|
|
57
|
-
import { ChoiceList as
|
|
58
|
-
import { useForm as
|
|
59
|
-
import { useBreakpoint as
|
|
44
|
+
import { PopupPanel as qr } from "./components/popup-panel/component.js";
|
|
45
|
+
import { CodeBlock as Kr } from "./components/code-block/component.js";
|
|
46
|
+
import { StackChild as Hr } from "./components/stack/StackChild.js";
|
|
47
|
+
import { Stack as zr } from "./components/stack/index.js";
|
|
48
|
+
import { Collapse as Xr } from "./components/collapse/component.js";
|
|
49
|
+
import { Input as Zr } from "./components/input/component.js";
|
|
50
|
+
import { Badge as oe, InternalBadge as re } from "./components/badge/component.js";
|
|
51
|
+
import { Radio as te } from "./components/radio/component.js";
|
|
52
|
+
import { Button as pe } from "./components/button/component.js";
|
|
53
|
+
import { DSRoot as se } from "./components/ds-root/component.js";
|
|
54
|
+
import { DSRootContextProvider as le, useDS as ne } from "./components/ds-root/context.js";
|
|
55
|
+
import { DragDrop as ie, DragDropRoot as Ce } from "./components/drag-drop/index.js";
|
|
56
|
+
import { ColorSelect as Te } from "./components/color-select/component.js";
|
|
57
|
+
import { Nav as de } from "./components/nav/index.js";
|
|
58
|
+
import { ChoiceList as ge } from "./components/choice-list/component.js";
|
|
59
|
+
import { useForm as Ae, useWatch as Ee } from "antd/es/form/Form";
|
|
60
|
+
import { useBreakpoint as ke, useMessage as De, useModal as Re, useToken as Le } from "./components/hooks/antd.js";
|
|
60
61
|
import { default as be } from "antd/es/app/useApp";
|
|
61
|
-
import { useAnimationsFinished as ye, useEnhancedEffect as Be, useEventCallback as
|
|
62
|
-
import { useControlledState as
|
|
63
|
-
import { useCharts as
|
|
62
|
+
import { useAnimationsFinished as ye, useEnhancedEffect as Be, useEventCallback as Ne, useLatestRef as ve } from "./components/hooks/base-ui.js";
|
|
63
|
+
import { useControlledState as _e } from "./components/hooks/useControlledState.js";
|
|
64
|
+
import { useCharts as Fe } from "./components/hooks/useCharts.js";
|
|
64
65
|
import { useCSSVariables as we } from "./components/hooks/useCSSVariables.js";
|
|
65
|
-
import { antdColorTokens as
|
|
66
|
-
import { categoricalChartColorKeys as
|
|
67
|
-
import { COLORBREWER as
|
|
68
|
-
import { tab10 as
|
|
69
|
-
import { CATEGORICAL_PALETTES as
|
|
70
|
-
import { getColorsByTheme as
|
|
66
|
+
import { antdColorTokens as qe, darkTheme as Ge, lightTheme as Ke } from "./tokens/and-theme/tokens.js";
|
|
67
|
+
import { categoricalChartColorKeys as He, categoricalChartColorTokens as je, categoricalChartsColors as ze, chartColorTokens as Je, rawChartColorTokens as Xe } from "./tokens/charts/palettes/cloudscape.js";
|
|
68
|
+
import { COLORBREWER as Ze } from "./tokens/charts/palettes/colorbrewer.js";
|
|
69
|
+
import { tab10 as ot, tab20 as rt, tab20b as et, tab20c as tt } from "./tokens/charts/palettes/tableau.js";
|
|
70
|
+
import { CATEGORICAL_PALETTES as pt, CATEGORICAL_PALETTE_NAMES as mt, SEQUENTIAL_PALETTES as st, SEQUENTIAL_PALETTE_NAMES as ft, getAllCategoricalChartColors as lt, getAllSequentialChartColors as nt, getCategoricalChartColors as xt, getSequentialChartColors as it } from "./tokens/charts/palettes/index.js";
|
|
71
|
+
import { getColorsByTheme as ct, getTokensByTheme as Tt, resolveColorTokens as ut } from "./tokens/utils.js";
|
|
71
72
|
export {
|
|
72
73
|
p as Affix,
|
|
73
74
|
m as Alert,
|
|
@@ -76,156 +77,158 @@ export {
|
|
|
76
77
|
l as AutoComplete,
|
|
77
78
|
n as Avatar,
|
|
78
79
|
x as BackTop,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
oe as Badge,
|
|
81
|
+
Tr as Breadcrumb,
|
|
82
|
+
pe as Button,
|
|
83
|
+
pt as CATEGORICAL_PALETTES,
|
|
84
|
+
mt as CATEGORICAL_PALETTE_NAMES,
|
|
85
|
+
Ze as COLORBREWER,
|
|
85
86
|
i as Calendar,
|
|
86
87
|
C as Card,
|
|
87
88
|
c as Carousel,
|
|
88
89
|
T as Cascader,
|
|
89
90
|
no as Checkbox,
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
ge as ChoiceList,
|
|
92
|
+
Kr as CodeBlock,
|
|
92
93
|
u as Col,
|
|
93
|
-
|
|
94
|
+
Xr as Collapse,
|
|
94
95
|
d as ColorPicker,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
Te as ColorSelect,
|
|
97
|
+
S as ConfigProvider,
|
|
98
|
+
Yo as DROPDOWN_COLLISION_AVOIDANCE,
|
|
99
|
+
se as DSRoot,
|
|
100
|
+
le as DSRootContextProvider,
|
|
101
|
+
g as DatePicker,
|
|
102
|
+
er as DefaultUpload,
|
|
101
103
|
h as Descriptions,
|
|
102
104
|
A as Divider,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
ie as DragDrop,
|
|
106
|
+
Ce as DragDropRoot,
|
|
105
107
|
E as Drawer,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
P as Dropdown,
|
|
109
|
+
Ro as DropdownMenu,
|
|
110
|
+
Rr as Empty,
|
|
111
|
+
Lr as EmptyIcon,
|
|
110
112
|
yr as Field,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
k as Flex,
|
|
114
|
+
D as FloatButton,
|
|
113
115
|
br as Form,
|
|
114
|
-
|
|
116
|
+
R as Grid,
|
|
115
117
|
mo as IconButton,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
118
|
+
Zr as Input,
|
|
119
|
+
L as InputNumber,
|
|
120
|
+
re as InternalBadge,
|
|
121
|
+
I as Layout,
|
|
122
|
+
b as List,
|
|
123
|
+
O as Mentions,
|
|
124
|
+
y as Menu,
|
|
123
125
|
ao as Modal,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
126
|
+
de as Nav,
|
|
127
|
+
Zo as POPUP_COLLISION_AVOIDANCE,
|
|
128
|
+
B as Pagination,
|
|
129
|
+
N as Popconfirm,
|
|
130
|
+
lr as Popover,
|
|
131
|
+
qr as PopupPanel,
|
|
132
|
+
v as Progress,
|
|
133
|
+
M as QRCode,
|
|
134
|
+
te as Radio,
|
|
135
|
+
_ as Rate,
|
|
136
|
+
U as Result,
|
|
137
|
+
F as Row,
|
|
138
|
+
st as SEQUENTIAL_PALETTES,
|
|
139
|
+
ft as SEQUENTIAL_PALETTE_NAMES,
|
|
140
|
+
sr as ScrollArea,
|
|
138
141
|
io as Segmented,
|
|
139
142
|
eo as Select,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
W as Skeleton,
|
|
144
|
+
xr as Slider,
|
|
145
|
+
w as Space,
|
|
146
|
+
kr as Spin,
|
|
144
147
|
Ao as Split,
|
|
145
148
|
Eo as Splitter,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
149
|
+
zr as Stack,
|
|
150
|
+
Hr as StackChild,
|
|
151
|
+
V as Statistic,
|
|
152
|
+
q as Steps,
|
|
150
153
|
fo as Switch,
|
|
151
154
|
co as Table,
|
|
152
|
-
|
|
155
|
+
G as Tabs,
|
|
153
156
|
uo as Tag,
|
|
154
|
-
|
|
157
|
+
go as ThemeProvider,
|
|
155
158
|
K as TimePicker,
|
|
156
159
|
Q as Timeline,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
+
Mr as Toast,
|
|
161
|
+
Cr as Tooltip,
|
|
162
|
+
Nr as Tour,
|
|
160
163
|
H as Transfer,
|
|
161
|
-
|
|
162
|
-
|
|
164
|
+
or as Transition,
|
|
165
|
+
Er as Tree,
|
|
163
166
|
j as TreeSelect,
|
|
164
|
-
|
|
167
|
+
ko as Truncate,
|
|
165
168
|
z as Typography,
|
|
166
|
-
|
|
169
|
+
tr as Upload,
|
|
167
170
|
wr as VerticalCollapsiblePanel,
|
|
168
171
|
J as Watermark,
|
|
169
172
|
Qo as WithAntdTokens,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
Fo as WithRenderProp,
|
|
174
|
+
qe as antdColorTokens,
|
|
175
|
+
He as categoricalChartColorKeys,
|
|
176
|
+
je as categoricalChartColorTokens,
|
|
177
|
+
ze as categoricalChartsColors,
|
|
175
178
|
jo as changeThemeWithoutTransition,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
+
Je as chartColorTokens,
|
|
180
|
+
Io as clsx,
|
|
181
|
+
bo as cn,
|
|
179
182
|
e as componentMetadata,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
183
|
+
Oo as cx,
|
|
184
|
+
Ge as darkTheme,
|
|
185
|
+
lt as getAllCategoricalChartColors,
|
|
186
|
+
nt as getAllSequentialChartColors,
|
|
187
|
+
xt as getCategoricalChartColors,
|
|
188
|
+
ct as getColorsByTheme,
|
|
186
189
|
t as getComponentsByCategory,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
it as getSequentialChartColors,
|
|
191
|
+
Tt as getTokensByTheme,
|
|
192
|
+
gr as getUniqueKeysFromOriginals,
|
|
193
|
+
vo as isTracebackError,
|
|
194
|
+
_o as isValidHexColor,
|
|
195
|
+
Ke as lightTheme,
|
|
193
196
|
X as message,
|
|
194
197
|
Jo as moveTypingCursorToEnd,
|
|
195
198
|
Y as notification,
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
199
|
+
wo as parseAntdPlacement,
|
|
200
|
+
hr as processTreeData,
|
|
201
|
+
Xe as rawChartColorTokens,
|
|
202
|
+
Bo as reactNodeToString,
|
|
203
|
+
ut as resolveColorTokens,
|
|
204
|
+
ot as tab10,
|
|
205
|
+
rt as tab20,
|
|
206
|
+
et as tab20b,
|
|
207
|
+
tt as tab20c,
|
|
205
208
|
Z as theme,
|
|
206
|
-
|
|
207
|
-
|
|
209
|
+
Ur as toast,
|
|
210
|
+
Fr as toastManager,
|
|
208
211
|
$ as unstableSetRender,
|
|
209
212
|
ye as useAnimationsFinished,
|
|
210
|
-
|
|
213
|
+
Vo as useAntdCssVarClassname,
|
|
211
214
|
be as useApp,
|
|
212
|
-
|
|
215
|
+
ke as useBreakpoint,
|
|
213
216
|
we as useCSSVariables,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
217
|
+
Fe as useCharts,
|
|
218
|
+
qo as useCls,
|
|
219
|
+
_e as useControlledState,
|
|
220
|
+
ne as useDS,
|
|
218
221
|
Be as useEnhancedEffect,
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
+
Ne as useEventCallback,
|
|
223
|
+
Ae as useForm,
|
|
224
|
+
Go as useGetPrefixCls,
|
|
222
225
|
ve as useLatestRef,
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
226
|
+
De as useMessage,
|
|
227
|
+
Re as useModal,
|
|
228
|
+
Le as useToken,
|
|
229
|
+
dr as useUniqueKeysTree,
|
|
230
|
+
pr as useUploadItemRender,
|
|
231
|
+
Ee as useWatch,
|
|
229
232
|
oo as version
|
|
230
233
|
};
|
|
231
234
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|