@bioturing/components 0.15.5 → 0.17.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/Badge/component.js +9 -17
- package/dist/components/Badge/component.js.map +1 -1
- package/dist/components/Breadcrumb/component.js +4 -3
- package/dist/components/Breadcrumb/component.js.map +1 -1
- package/dist/components/Button/component.js +30 -3
- package/dist/components/Button/component.js.map +1 -1
- package/dist/components/Button/style.css +1 -1
- package/dist/components/CodeBlock/component.js +7 -6
- package/dist/components/CodeBlock/component.js.map +1 -1
- package/dist/components/CodeBlock/style.css +1 -1
- package/dist/components/Collapse/component.js +11 -10
- package/dist/components/Collapse/component.js.map +1 -1
- package/dist/components/ColorSelect/component.js +138 -0
- package/dist/components/ColorSelect/component.js.map +1 -0
- package/dist/components/ColorSelect/style.css +1 -0
- package/dist/components/DSRoot/component.js +8 -7
- package/dist/components/DSRoot/component.js.map +1 -1
- package/dist/components/DSRoot/context.js +5 -4
- package/dist/components/DSRoot/context.js.map +1 -1
- package/dist/components/DragDrop/context.js +18 -0
- package/dist/components/DragDrop/context.js.map +1 -0
- package/dist/components/DragDrop/draggable.js +64 -0
- package/dist/components/DragDrop/draggable.js.map +1 -0
- package/dist/components/DragDrop/droppable.js +48 -0
- package/dist/components/DragDrop/droppable.js.map +1 -0
- package/dist/components/DragDrop/hooks.js +139 -0
- package/dist/components/DragDrop/hooks.js.map +1 -0
- package/dist/components/DragDrop/index.js +45 -0
- package/dist/components/DragDrop/index.js.map +1 -0
- package/dist/components/DragDrop/style.css +1 -0
- package/dist/components/DropdownMenu/component.js +1 -0
- package/dist/components/DropdownMenu/component.js.map +1 -1
- package/dist/components/Field/component.js +13 -12
- package/dist/components/Field/component.js.map +1 -1
- package/dist/components/Form/component.js +4 -3
- package/dist/components/Form/component.js.map +1 -1
- package/dist/components/Form/item.js +1 -0
- package/dist/components/Form/item.js.map +1 -1
- package/dist/components/IconButton/component.js +55 -43
- package/dist/components/IconButton/component.js.map +1 -1
- package/dist/components/IconButton/style.css +1 -1
- package/dist/components/Modal/Modal.js +1 -0
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Modal/ModalProvider.js +1 -0
- package/dist/components/Modal/ModalProvider.js.map +1 -1
- package/dist/components/Modal/index.js +11 -10
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Nav/context.js +7 -0
- package/dist/components/Nav/context.js.map +1 -0
- package/dist/components/Nav/group.js +16 -0
- package/dist/components/Nav/group.js.map +1 -0
- package/dist/components/Nav/heading.js +16 -0
- package/dist/components/Nav/heading.js.map +1 -0
- package/dist/components/Nav/index.js +13 -0
- package/dist/components/Nav/index.js.map +1 -0
- package/dist/components/Nav/item.js +36 -0
- package/dist/components/Nav/item.js.map +1 -0
- package/dist/components/Nav/style.css +1 -0
- package/dist/components/Popover/component.js +6 -5
- package/dist/components/Popover/component.js.map +1 -1
- package/dist/components/PopupPanel/component.js +100 -99
- package/dist/components/PopupPanel/component.js.map +1 -1
- package/dist/components/ScrollArea/component.js +10 -9
- package/dist/components/ScrollArea/component.js.map +1 -1
- package/dist/components/Slider/component.js +9 -8
- package/dist/components/Slider/component.js.map +1 -1
- package/dist/components/Splitter/component.js +12 -11
- package/dist/components/Splitter/component.js.map +1 -1
- package/dist/components/Stack/Stack.js +40 -34
- package/dist/components/Stack/Stack.js.map +1 -1
- package/dist/components/Stack/StackChild.js +62 -54
- package/dist/components/Stack/StackChild.js.map +1 -1
- package/dist/components/Stack/style.css +1 -1
- package/dist/components/Table/component.js +54 -50
- package/dist/components/Table/component.js.map +1 -1
- package/dist/components/Table/style.css +1 -1
- package/dist/components/Tag/component.js +60 -24
- package/dist/components/Tag/component.js.map +1 -1
- package/dist/components/Tag/style.css +1 -1
- package/dist/components/ThemeProvider/component.js +27 -26
- package/dist/components/ThemeProvider/component.js.map +1 -1
- package/dist/components/ThemeProvider/style.css +1 -1
- package/dist/components/Toast/component.js +24 -29
- package/dist/components/Toast/component.js.map +1 -1
- package/dist/components/Toast/function.js +5 -4
- package/dist/components/Toast/function.js.map +1 -1
- package/dist/components/Tooltip/component.js +4 -21
- package/dist/components/Tooltip/component.js.map +1 -1
- package/dist/components/Tour/component.js +5 -4
- package/dist/components/Tour/component.js.map +1 -1
- package/dist/components/Transition/component.js +45 -32
- package/dist/components/Transition/component.js.map +1 -1
- package/dist/components/Tree/components.js +9 -8
- package/dist/components/Tree/components.js.map +1 -1
- package/dist/components/Tree/helpers.js +1 -0
- package/dist/components/Tree/helpers.js.map +1 -1
- package/dist/components/Tree/useTreeCommon.js +12 -11
- package/dist/components/Tree/useTreeCommon.js.map +1 -1
- package/dist/components/Truncate/component.js +1 -0
- package/dist/components/Truncate/component.js.map +1 -1
- package/dist/components/Upload/component.js +13 -11
- package/dist/components/Upload/component.js.map +1 -1
- package/dist/components/Upload/dragger.js +3 -2
- package/dist/components/Upload/dragger.js.map +1 -1
- package/dist/components/Upload/hooks.js +3 -2
- package/dist/components/Upload/hooks.js.map +1 -1
- package/dist/components/Upload/style.css +1 -0
- package/dist/components/VerticalCollapsiblePanel/component.js +39 -36
- package/dist/components/VerticalCollapsiblePanel/component.js.map +1 -1
- package/dist/components/hooks/antd.js +4 -3
- package/dist/components/hooks/antd.js.map +1 -1
- package/dist/components/hooks/base-ui.js +34 -28
- package/dist/components/hooks/base-ui.js.map +1 -1
- package/dist/components/hooks/useCharts.js +19 -17
- package/dist/components/hooks/useCharts.js.map +1 -1
- package/dist/components/hooks/useControlledState.js +17 -9
- package/dist/components/hooks/useControlledState.js.map +1 -1
- package/dist/components/utils/WithAntdTokens.js +14 -13
- package/dist/components/utils/WithAntdTokens.js.map +1 -1
- package/dist/components/utils/antdUtils.js +1 -0
- package/dist/components/utils/antdUtils.js.map +1 -1
- package/dist/components/utils/colors.js +5 -0
- package/dist/components/utils/colors.js.map +1 -0
- package/dist/index.d.ts +819 -65
- package/dist/index.js +191 -159
- package/dist/index.js.map +1 -1
- package/dist/metadata.js +124 -92
- package/dist/metadata.js.map +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/tokens/and-theme/tokens.js +13 -7
- package/dist/tokens/and-theme/tokens.js.map +1 -1
- package/dist/tokens/charts/{tokens.js → palettes/cloudscape.js} +22 -12
- package/dist/tokens/charts/palettes/cloudscape.js.map +1 -0
- package/dist/tokens/charts/palettes/colorbrewer.js +1525 -0
- package/dist/tokens/charts/palettes/colorbrewer.js.map +1 -0
- package/dist/tokens/charts/palettes/index.js +61 -0
- package/dist/tokens/charts/palettes/index.js.map +1 -0
- package/dist/tokens/charts/palettes/tableau.js +112 -0
- package/dist/tokens/charts/palettes/tableau.js.map +1 -0
- package/dist/tokens/utils.js.map +1 -1
- package/package.json +7 -7
- package/dist/tokens/charts/index.js +0 -18
- package/dist/tokens/charts/index.js.map +0 -1
- package/dist/tokens/charts/tokens.js.map +0 -1
|
@@ -1,165 +1,166 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import N from "
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as r, jsxs as d, Fragment as a } from "react/jsx-runtime";
|
|
3
|
+
import { Popover as i } from "@base-ui-components/react/popover";
|
|
4
|
+
import { useState as f, useCallback as k, useEffect as C, useMemo as N } from "react";
|
|
5
|
+
import s from "antd/es/flex";
|
|
6
|
+
import { X as ee } from "@bioturing/assets";
|
|
7
|
+
import { PopupPanelSize as te } from "./constants.js";
|
|
8
|
+
import { useResizable as re } from "react-use-resizable";
|
|
8
9
|
import ne from "merge-refs";
|
|
9
10
|
import './style.css';/* empty css */
|
|
10
|
-
import { useControlledState as
|
|
11
|
-
import { useCls as
|
|
11
|
+
import { useControlledState as oe } from "../hooks/useControlledState.js";
|
|
12
|
+
import { useCls as pe, parseAntdPlacement as ie } from "../utils/antdUtils.js";
|
|
12
13
|
import { clsx as o } from "../utils/cn.js";
|
|
13
14
|
import { IconButton as de } from "../IconButton/component.js";
|
|
14
|
-
const
|
|
15
|
-
children:
|
|
16
|
-
placement:
|
|
17
|
-
openOnHover:
|
|
15
|
+
const we = ({
|
|
16
|
+
children: O,
|
|
17
|
+
placement: S,
|
|
18
|
+
openOnHover: I = !1,
|
|
18
19
|
open: D,
|
|
19
20
|
onOpenChange: W,
|
|
20
21
|
content: j,
|
|
21
|
-
title:
|
|
22
|
-
trigger:
|
|
23
|
-
className:
|
|
24
|
-
anchor:
|
|
22
|
+
title: h,
|
|
23
|
+
trigger: E = "click",
|
|
24
|
+
className: F,
|
|
25
|
+
anchor: V,
|
|
25
26
|
beforeCloseButton: P,
|
|
26
|
-
afterCloseButton:
|
|
27
|
-
afterTitle:
|
|
28
|
-
size:
|
|
29
|
-
footer:
|
|
27
|
+
afterCloseButton: H,
|
|
28
|
+
afterTitle: g,
|
|
29
|
+
size: c = "medium",
|
|
30
|
+
footer: l,
|
|
30
31
|
defaultOpen: $,
|
|
31
|
-
resizable:
|
|
32
|
-
classNames: e
|
|
32
|
+
resizable: A = !1,
|
|
33
|
+
classNames: e,
|
|
34
|
+
modal: M = !1,
|
|
35
|
+
closeOnClickOutside: T = !0
|
|
33
36
|
}) => {
|
|
34
|
-
const [
|
|
37
|
+
const [U, y] = oe(
|
|
35
38
|
D,
|
|
36
39
|
W,
|
|
37
40
|
$ ?? !1
|
|
38
41
|
// Always provide a default value to prevent undefined
|
|
39
|
-
), t =
|
|
40
|
-
|
|
42
|
+
), t = pe(), b = ie(S), [v, X] = f(null), [q, G] = f(), [J, K] = f(), L = k((n) => {
|
|
43
|
+
X(n);
|
|
41
44
|
}, []);
|
|
42
|
-
|
|
43
|
-
if (!
|
|
44
|
-
const
|
|
45
|
-
for (const
|
|
46
|
-
|
|
45
|
+
C(() => {
|
|
46
|
+
if (!v) return;
|
|
47
|
+
const n = new ResizeObserver((u) => {
|
|
48
|
+
for (const p of u)
|
|
49
|
+
G(p.contentRect.width), K(p.contentRect.height);
|
|
47
50
|
});
|
|
48
|
-
return
|
|
49
|
-
|
|
51
|
+
return n.observe(v), () => {
|
|
52
|
+
n.disconnect();
|
|
50
53
|
};
|
|
51
|
-
}, [
|
|
52
|
-
const w =
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
|
|
54
|
+
}, [v]);
|
|
55
|
+
const w = N(() => /* @__PURE__ */ r(ee, { size: 16 }), []), Q = k(() => /* @__PURE__ */ d("div", { className: o(t("popup-panel-header"), e == null ? void 0 : e.header), children: [
|
|
56
|
+
/* @__PURE__ */ d(
|
|
57
|
+
s,
|
|
55
58
|
{
|
|
56
59
|
align: "center",
|
|
57
60
|
gap: 8,
|
|
58
61
|
className: t("popup-panel-title-wrapper"),
|
|
59
62
|
children: [
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
|
|
63
|
+
/* @__PURE__ */ r(
|
|
64
|
+
i.Title,
|
|
62
65
|
{
|
|
63
|
-
render: /* @__PURE__ */
|
|
66
|
+
render: /* @__PURE__ */ r("div", { className: o(t("grow", "truncate"), e == null ? void 0 : e.title), children: h })
|
|
64
67
|
}
|
|
65
68
|
),
|
|
66
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
67
70
|
P,
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
|
|
71
|
+
/* @__PURE__ */ r(
|
|
72
|
+
i.Close,
|
|
70
73
|
{
|
|
71
|
-
render: /* @__PURE__ */
|
|
74
|
+
render: /* @__PURE__ */ r(de, { children: w })
|
|
72
75
|
}
|
|
73
76
|
),
|
|
74
|
-
|
|
77
|
+
H
|
|
75
78
|
] })
|
|
76
79
|
]
|
|
77
80
|
}
|
|
78
81
|
),
|
|
79
|
-
|
|
82
|
+
g || null
|
|
80
83
|
] }), [
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
H,
|
|
85
|
+
g,
|
|
83
86
|
P,
|
|
84
87
|
t,
|
|
85
88
|
e == null ? void 0 : e.header,
|
|
86
89
|
e == null ? void 0 : e.title,
|
|
87
90
|
w,
|
|
88
|
-
|
|
89
|
-
]), [
|
|
90
|
-
initialWidth:
|
|
91
|
-
initialHeight:
|
|
91
|
+
h
|
|
92
|
+
]), [z, x] = f(!1), { getRootProps: Y, getHandleProps: R, rootRef: Z } = re({
|
|
93
|
+
initialWidth: q,
|
|
94
|
+
initialHeight: J,
|
|
92
95
|
onDragStart: () => x(!0),
|
|
93
96
|
onDragEnd: () => x(!1)
|
|
94
97
|
});
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}, [
|
|
98
|
-
const { ref:
|
|
99
|
-
if (!
|
|
100
|
-
const { widthDiff:
|
|
101
|
-
|
|
98
|
+
C(() => {
|
|
99
|
+
z ? document.body.style.userSelect = "none" : document.body.style.userSelect = "";
|
|
100
|
+
}, [z]);
|
|
101
|
+
const { ref: _, ...B } = Y(), m = (n, u) => {
|
|
102
|
+
if (!n.current) return;
|
|
103
|
+
const { widthDiff: p } = u;
|
|
104
|
+
n.current.style.left = `${parseInt(n.current.style.left || "0") - p}px`;
|
|
102
105
|
};
|
|
103
|
-
return /* @__PURE__ */
|
|
104
|
-
|
|
106
|
+
return /* @__PURE__ */ d(
|
|
107
|
+
i.Root,
|
|
105
108
|
{
|
|
106
|
-
openOnHover:
|
|
107
|
-
open:
|
|
108
|
-
onOpenChange:
|
|
109
|
+
openOnHover: E === "hover" ? !0 : I,
|
|
110
|
+
open: U,
|
|
111
|
+
onOpenChange: (n, u, p) => {
|
|
112
|
+
p === "outside-press" && !T || y(n, u, p);
|
|
113
|
+
},
|
|
114
|
+
modal: M,
|
|
109
115
|
children: [
|
|
110
|
-
/* @__PURE__ */
|
|
111
|
-
|
|
116
|
+
/* @__PURE__ */ r(
|
|
117
|
+
i.Trigger,
|
|
112
118
|
{
|
|
113
|
-
render:
|
|
119
|
+
render: O,
|
|
114
120
|
className: o(t("popup-panel-trigger"), e == null ? void 0 : e.trigger)
|
|
115
121
|
}
|
|
116
122
|
),
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
|
|
123
|
+
/* @__PURE__ */ r(i.Portal, { children: /* @__PURE__ */ r(
|
|
124
|
+
i.Positioner,
|
|
119
125
|
{
|
|
120
|
-
className: o(
|
|
121
|
-
t("popup-panel-root"),
|
|
122
|
-
e == null ? void 0 : e.root,
|
|
123
|
-
y
|
|
124
|
-
),
|
|
126
|
+
className: o(t("popup-panel-root"), e == null ? void 0 : e.root),
|
|
125
127
|
side: b.placement,
|
|
126
128
|
align: b.align,
|
|
127
129
|
sideOffset: 4,
|
|
128
|
-
anchor:
|
|
130
|
+
anchor: V,
|
|
129
131
|
style: {
|
|
130
|
-
"--size-width":
|
|
132
|
+
"--size-width": c ? te[c] : void 0
|
|
131
133
|
},
|
|
132
|
-
children: /* @__PURE__ */
|
|
133
|
-
|
|
134
|
+
children: /* @__PURE__ */ d(
|
|
135
|
+
i.Popup,
|
|
134
136
|
{
|
|
135
137
|
className: o(
|
|
136
138
|
t("popup-panel"),
|
|
137
|
-
t(`popup-panel-size-${
|
|
138
|
-
|
|
139
|
-
e == null ? void 0 : e.popup
|
|
140
|
-
y
|
|
139
|
+
t(`popup-panel-size-${c}`),
|
|
140
|
+
F,
|
|
141
|
+
e == null ? void 0 : e.popup
|
|
141
142
|
),
|
|
142
|
-
ref: ne(
|
|
143
|
-
...
|
|
144
|
-
...
|
|
143
|
+
ref: ne(_, L),
|
|
144
|
+
...B,
|
|
145
|
+
...z ? { "data-resizing": !0 } : {},
|
|
145
146
|
children: [
|
|
146
|
-
|
|
147
|
-
/* @__PURE__ */
|
|
147
|
+
h && Q(),
|
|
148
|
+
/* @__PURE__ */ r(
|
|
148
149
|
"div",
|
|
149
150
|
{
|
|
150
151
|
className: o(t("popup-panel-content"), e == null ? void 0 : e.content),
|
|
151
|
-
children: /* @__PURE__ */
|
|
152
|
+
children: /* @__PURE__ */ r("div", { className: t("popup-panel-content-inner"), children: j })
|
|
152
153
|
}
|
|
153
154
|
),
|
|
154
|
-
|
|
155
|
+
l && /* @__PURE__ */ r(
|
|
155
156
|
"div",
|
|
156
157
|
{
|
|
157
158
|
className: o(t("popup-panel-footer"), e == null ? void 0 : e.footer),
|
|
158
|
-
children: typeof
|
|
159
|
+
children: typeof l == "function" ? l({ close: () => y(!1) }) : l
|
|
159
160
|
}
|
|
160
161
|
),
|
|
161
|
-
|
|
162
|
-
/* @__PURE__ */
|
|
162
|
+
A && /* @__PURE__ */ d(a, { children: [
|
|
163
|
+
/* @__PURE__ */ r(
|
|
163
164
|
"div",
|
|
164
165
|
{
|
|
165
166
|
className: o(
|
|
@@ -167,12 +168,12 @@ const be = ({
|
|
|
167
168
|
e == null ? void 0 : e.resizeHandle
|
|
168
169
|
),
|
|
169
170
|
"data-placement": "bottom-left",
|
|
170
|
-
...
|
|
171
|
+
...R({
|
|
171
172
|
lockHorizontal: !0
|
|
172
173
|
})
|
|
173
174
|
}
|
|
174
175
|
),
|
|
175
|
-
/* @__PURE__ */
|
|
176
|
+
/* @__PURE__ */ r(
|
|
176
177
|
"div",
|
|
177
178
|
{
|
|
178
179
|
className: o(
|
|
@@ -180,14 +181,14 @@ const be = ({
|
|
|
180
181
|
e == null ? void 0 : e.resizeHandle
|
|
181
182
|
),
|
|
182
183
|
"data-placement": "top-left",
|
|
183
|
-
...
|
|
184
|
+
...R({
|
|
184
185
|
reverse: !0,
|
|
185
186
|
lockVertical: !0,
|
|
186
|
-
onResize: (
|
|
187
|
+
onResize: (n) => m(Z, n)
|
|
187
188
|
})
|
|
188
189
|
}
|
|
189
190
|
),
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ r(
|
|
191
192
|
"div",
|
|
192
193
|
{
|
|
193
194
|
className: o(
|
|
@@ -195,7 +196,7 @@ const be = ({
|
|
|
195
196
|
e == null ? void 0 : e.resizeHandle
|
|
196
197
|
),
|
|
197
198
|
"data-placement": "top-right",
|
|
198
|
-
...
|
|
199
|
+
...R({
|
|
199
200
|
lockVertical: !0
|
|
200
201
|
})
|
|
201
202
|
}
|
|
@@ -211,6 +212,6 @@ const be = ({
|
|
|
211
212
|
);
|
|
212
213
|
};
|
|
213
214
|
export {
|
|
214
|
-
|
|
215
|
+
we as PopupPanel
|
|
215
216
|
};
|
|
216
217
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/PopupPanel/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n useCls,\n clsx,\n useAntdCssVarClassname,\n parseAntdPlacement,\n} from \"../utils\";\nimport { Popover } from \"@base-ui-components/react/popover\";\n\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport Flex from \"antd/es/flex\";\nimport { IconButton } from \"../IconButton\";\nimport { X } from \"@bioturing/assets\";\nimport { PopupPanelSize } from \"./constants\";\nimport { useControlledState } from \"../hooks\";\nimport { useResizable, type MoveValues } from \"react-use-resizable\";\nimport mergeRefs from \"merge-refs\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport interface PopupPanelProps\n extends Omit<\n React.ComponentPropsWithRef<\"div\">,\n \"title\" | \"content\" | \"children\"\n > {\n /** The trigger element that opens the popup panel */\n children?: React.ComponentProps<typeof Popover.Trigger>[\"render\"];\n /** Placement of the popup panel relative to its trigger */\n placement?: PopoverProps[\"placement\"];\n /** Whether to open the popup panel on hover */\n openOnHover?: boolean;\n /** Controls the open state of the popup panel */\n open?: boolean;\n /** Callback fired when the open state changes */\n onOpenChange?: (open: boolean) => void;\n /** Content to display inside the popup panel */\n content?: React.ReactNode;\n /** Title text or element to display in the panel header */\n title?: React.ReactNode;\n /** The event that triggers the popup panel */\n /**\n * @default \"click\"\n */\n trigger?: \"click\" | \"hover\";\n /** Custom anchor element for positioning the panel */\n anchor?: Popover.Positioner.Props[\"anchor\"];\n /** Content to display before the close button */\n beforeCloseButton?: React.ReactNode;\n /** Content to display after the close button */\n afterCloseButton?: React.ReactNode;\n /** Content to display after the title */\n afterTitle?: React.ReactNode;\n /**\n * Predefined sizes for the popup panel\n * - xsmall: 320px\n * - small: 400px\n * - medium: 480px (default)\n * - large: 640px\n * - xlarge: 840px\n * @default \"medium\" for default type, \"xsmall\" for other types\n */\n size?: keyof typeof PopupPanelSize;\n /**\n * Footer content for the popup panel\n * Can be a React node or a function that returns a React node\n */\n footer?:\n | React.ReactNode\n | ((props: { close: () => void }) => React.ReactNode);\n /**\n * Whether the panel should be open by default when uncontrolled\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * Whether the panel should be resizable\n * @default false\n */\n resizable?: boolean;\n /**\n * Custom class names for different parts of the popup panel\n * @default {}\n */\n classNames?: {\n root?: string;\n trigger?: string;\n popup?: string;\n header?: string;\n title?: string;\n content?: string;\n footer?: string;\n resizeHandle?: string;\n };\n}\n\nexport const PopupPanel = ({\n children,\n placement,\n openOnHover = false,\n open: outsideOpen,\n onOpenChange: outsideOnOpenChange,\n content,\n title,\n trigger = \"click\",\n className,\n anchor,\n beforeCloseButton,\n afterCloseButton,\n afterTitle,\n size = \"medium\",\n footer,\n defaultOpen,\n resizable = false,\n classNames,\n}: PopupPanelProps) => {\n // Use controlled state with proper initialization to prevent switching between controlled/uncontrolled\n const [open, setOpen] = useControlledState(\n outsideOpen,\n outsideOnOpenChange,\n defaultOpen ?? false // Always provide a default value to prevent undefined\n );\n\n const cls = useCls();\n const antdCssVarClassname = useAntdCssVarClassname();\n const headlessUIPlacement = parseAntdPlacement(placement);\n // We don't need triggerRef since we're using callbackRef for the popup\n const [popupRef, setPopupRef] = useState<HTMLDivElement | null>(null);\n const [width, setWidth] = useState<number>();\n const [height, setHeight] = useState<number>();\n const callbackRef = useCallback((node: HTMLDivElement) => {\n setPopupRef(node);\n }, []);\n useEffect(() => {\n if (!popupRef) return;\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n setWidth(entry.contentRect.width);\n setHeight(entry.contentRect.height);\n }\n });\n observer.observe(popupRef);\n return () => {\n observer.disconnect();\n };\n }, [popupRef]);\n\n const defaultCloseIcon = useMemo(() => <X size={16} />, []);\n const renderTitle = useCallback(() => {\n return (\n <div className={clsx(cls(\"popup-panel-header\"), classNames?.header)}>\n <Flex\n align=\"center\"\n gap={8}\n className={cls(\"popup-panel-title-wrapper\")}\n >\n <Popover.Title\n render={\n <div className={clsx(cls(\"grow\", \"truncate\"), classNames?.title)}>\n {title}\n </div>\n }\n ></Popover.Title>\n <div className=\"flex items-center gap-2\">\n {beforeCloseButton}\n <Popover.Close\n render={<IconButton>{defaultCloseIcon}</IconButton>}\n />\n {afterCloseButton}\n </div>\n </Flex>\n {afterTitle ? afterTitle : null}\n </div>\n );\n }, [\n afterCloseButton,\n afterTitle,\n beforeCloseButton,\n cls,\n classNames?.header,\n classNames?.title,\n defaultCloseIcon,\n title,\n ]);\n const [resizing, setResizing] = useState(false);\n const { getRootProps, getHandleProps, rootRef } = useResizable({\n initialWidth: width,\n initialHeight: height,\n onDragStart: () => setResizing(true),\n onDragEnd: () => setResizing(false),\n });\n useEffect(() => {\n if (resizing) {\n document.body.style.userSelect = \"none\";\n } else {\n document.body.style.userSelect = \"\";\n }\n }, [resizing]);\n const { ref: rootRefProp, ...rootPropsWithoutRef } = getRootProps();\n // Handle reverse handle change for vertical resizing\n // Currently not used but kept for future implementation\n const _onReverseHandleChangeVertical = (\n parent: React.RefObject<HTMLDivElement>,\n values: MoveValues\n ) => {\n if (!parent.current) return;\n const { heightDiff } = values;\n parent.current.style.top = `${\n parseInt(parent.current.style.top || \"0\") - heightDiff\n }px`;\n };\n\n // Handle reverse handle change\n const onReverseHandleChangeHorizontal = (\n parent: React.RefObject<HTMLDivElement>,\n values: MoveValues\n ) => {\n if (!parent.current) return;\n const { widthDiff } = values;\n parent.current.style.left = `${\n parseInt(parent.current.style.left || \"0\") - widthDiff\n }px`;\n };\n\n return (\n <Popover.Root\n openOnHover={trigger === \"hover\" ? true : openOnHover}\n open={open}\n onOpenChange={setOpen}\n >\n <Popover.Trigger\n render={children}\n className={clsx(cls(\"popup-panel-trigger\"), classNames?.trigger)}\n ></Popover.Trigger>\n <Popover.Portal>\n <Popover.Positioner\n className={clsx(\n cls(\"popup-panel-root\"),\n classNames?.root,\n antdCssVarClassname\n )}\n side={headlessUIPlacement.placement}\n align={headlessUIPlacement.align}\n sideOffset={4}\n anchor={anchor}\n style={\n {\n \"--size-width\": size ? PopupPanelSize[size] : undefined,\n } as React.CSSProperties\n }\n >\n <Popover.Popup\n className={clsx(\n cls(\"popup-panel\"),\n cls(`popup-panel-size-${size}`),\n className,\n classNames?.popup,\n antdCssVarClassname\n )}\n ref={mergeRefs(rootRefProp, callbackRef)}\n {...rootPropsWithoutRef}\n {...(resizing ? { \"data-resizing\": true } : {})}\n >\n {/* <div ref={popupRef}> */}\n {title && renderTitle()}\n <div\n className={clsx(cls(\"popup-panel-content\"), classNames?.content)}\n >\n <div className={cls(\"popup-panel-content-inner\")}>{content}</div>\n </div>\n {footer && (\n <div\n className={clsx(cls(\"popup-panel-footer\"), classNames?.footer)}\n >\n {typeof footer === \"function\"\n ? footer({ close: () => setOpen(false) })\n : footer}\n </div>\n )}\n {resizable && (\n <>\n <div\n className={clsx(\n cls(\"popup-panel-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"bottom-left\"\n {...getHandleProps({\n lockHorizontal: true,\n })}\n />\n <div\n className={clsx(\n cls(\"popup-panel-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-left\"\n {...getHandleProps({\n reverse: true,\n lockVertical: true,\n onResize: (values) =>\n onReverseHandleChangeHorizontal(rootRef, values),\n })}\n />\n <div\n className={clsx(\n cls(\"popup-panel-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-right\"\n {...getHandleProps({\n lockVertical: true,\n })}\n />\n </>\n )}\n </Popover.Popup>\n </Popover.Positioner>\n </Popover.Portal>\n </Popover.Root>\n );\n};\n"],"names":["PopupPanel","children","placement","openOnHover","outsideOpen","outsideOnOpenChange","content","title","trigger","className","anchor","beforeCloseButton","afterCloseButton","afterTitle","size","footer","defaultOpen","resizable","classNames","open","setOpen","useControlledState","cls","useCls","antdCssVarClassname","useAntdCssVarClassname","headlessUIPlacement","parseAntdPlacement","popupRef","setPopupRef","useState","width","setWidth","height","setHeight","callbackRef","useCallback","node","useEffect","observer","entries","entry","defaultCloseIcon","useMemo","jsx","X","renderTitle","jsxs","clsx","Flex","Popover","IconButton","resizing","setResizing","getRootProps","getHandleProps","rootRef","useResizable","rootRefProp","rootPropsWithoutRef","onReverseHandleChangeHorizontal","parent","values","widthDiff","PopupPanelSize","mergeRefs","Fragment"],"mappings":";;;;;;;;;;;;;AAiGO,MAAMA,KAAa,CAAC;AAAA,EACzB,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,MAAMC;AAAA,EACN,cAAcC;AAAA,EACd,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,YAAAC;AACF,MAAuB;AAEf,QAAA,CAACC,GAAMC,CAAO,IAAIC;AAAA,IACtBjB;AAAA,IACAC;AAAA,IACAW,KAAe;AAAA;AAAA,EACjB,GAEMM,IAAMC,GAAO,GACbC,IAAsBC,GAAuB,GAC7CC,IAAsBC,GAAmBzB,CAAS,GAElD,CAAC0B,GAAUC,CAAW,IAAIC,EAAgC,IAAI,GAC9D,CAACC,GAAOC,CAAQ,IAAIF,EAAiB,GACrC,CAACG,GAAQC,CAAS,IAAIJ,EAAiB,GACvCK,IAAcC,EAAY,CAACC,MAAyB;AACxD,IAAAR,EAAYQ,CAAI;AAAA,EAClB,GAAG,EAAE;AACL,EAAAC,EAAU,MAAM;AACd,QAAI,CAACV,EAAU;AACf,UAAMW,IAAW,IAAI,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;AAAA,wBACd,GAAGqC,EAAe;AAAA,0BACjB,gBAAgB;AAAA,wBACjB,CAAA;AAAA,sBAAA;AAAA,oBACH;AAAA,oBACA,gBAAAX;AAAA,sBAAC;AAAA,sBAAA;AAAA,wBACC,WAAWI;AAAA,0BACT1B,EAAI,2BAA2B;AAAA,0BAC/BJ,KAAA,gBAAAA,EAAY;AAAA,wBACd;AAAA,wBACA,kBAAe;AAAA,wBACd,GAAGqC,EAAe;AAAA,0BACjB,SAAS;AAAA,0BACT,cAAc;AAAA,0BACd,UAAU,CAACO,MACTF,EAAgCJ,GAASM,CAAM;AAAA,wBAClD,CAAA;AAAA,sBAAA;AAAA,oBACH;AAAA,oBACA,gBAAAlB;AAAA,sBAAC;AAAA,sBAAA;AAAA,wBACC,WAAWI;AAAA,0BACT1B,EAAI,2BAA2B;AAAA,0BAC/BJ,KAAA,gBAAAA,EAAY;AAAA,wBACd;AAAA,wBACA,kBAAe;AAAA,wBACd,GAAGqC,EAAe;AAAA,0BACjB,cAAc;AAAA,wBACf,CAAA;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACH,EACF,CAAA;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UAEJ;AAAA,QAAA,EAEJ,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/PopupPanel/component.tsx"],"sourcesContent":["\"use client\";\nimport { useCls, clsx, parseAntdPlacement } from \"../utils\";\nimport { Popover } from \"@base-ui-components/react/popover\";\n\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport Flex from \"antd/es/flex\";\nimport { IconButton } from \"../IconButton\";\nimport { X } from \"@bioturing/assets\";\nimport { PopupPanelSize } from \"./constants\";\nimport { useControlledState } from \"../hooks\";\nimport { useResizable, type MoveValues } from \"react-use-resizable\";\nimport mergeRefs from \"merge-refs\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport interface PopupPanelProps\n extends Omit<\n React.ComponentPropsWithRef<\"div\">,\n \"title\" | \"content\" | \"children\"\n > {\n /** The trigger element that opens the popup panel */\n children?: React.ComponentProps<typeof Popover.Trigger>[\"render\"];\n /** Placement of the popup panel relative to its trigger */\n placement?: PopoverProps[\"placement\"];\n /** Whether to open the popup panel on hover */\n openOnHover?: boolean;\n /** Controls the open state of the popup panel */\n open?: boolean;\n /** Callback fired when the open state changes */\n onOpenChange?: Popover.Root.Props[\"onOpenChange\"];\n /** Content to display inside the popup panel */\n content?: React.ReactNode;\n /** Title text or element to display in the panel header */\n title?: React.ReactNode;\n /** The event that triggers the popup panel */\n /**\n * @default \"click\"\n */\n trigger?: \"click\" | \"hover\";\n /** Custom anchor element for positioning the panel */\n anchor?: Popover.Positioner.Props[\"anchor\"];\n /** Content to display before the close button */\n beforeCloseButton?: React.ReactNode;\n /** Content to display after the close button */\n afterCloseButton?: React.ReactNode;\n /** Content to display after the title */\n afterTitle?: React.ReactNode;\n /**\n * Predefined sizes for the popup panel\n * - xsmall: 320px\n * - small: 400px\n * - medium: 480px (default)\n * - large: 640px\n * - xlarge: 840px\n * @default \"medium\" for default type, \"xsmall\" for other types\n */\n size?: keyof typeof PopupPanelSize;\n /**\n * Footer content for the popup panel\n * Can be a React node or a function that returns a React node\n */\n footer?:\n | React.ReactNode\n | ((props: { close: () => void }) => React.ReactNode);\n /**\n * Whether the panel should be open by default when uncontrolled\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * Whether the panel should be resizable\n * @default false\n */\n resizable?: boolean;\n /**\n * Custom class names for different parts of the popup panel\n * @default {}\n */\n classNames?: {\n root?: string;\n trigger?: string;\n popup?: string;\n header?: string;\n title?: string;\n content?: string;\n footer?: string;\n resizeHandle?: string;\n };\n /**\n * Whether to close the panel when clicking outside\n * @default true\n */\n closeOnClickOutside?: boolean;\n /**\n * Whether to use modal mode\n * @default false\n */\n modal?: Popover.Root.Props[\"modal\"];\n}\n\nexport const PopupPanel = ({\n children,\n placement,\n openOnHover = false,\n open: outsideOpen,\n onOpenChange: outsideOnOpenChange,\n content,\n title,\n trigger = \"click\",\n className,\n anchor,\n beforeCloseButton,\n afterCloseButton,\n afterTitle,\n size = \"medium\",\n footer,\n defaultOpen,\n resizable = false,\n classNames,\n modal = false,\n closeOnClickOutside = true,\n}: PopupPanelProps) => {\n // Use controlled state with proper initialization to prevent switching between controlled/uncontrolled\n const [open, setOpen] = useControlledState(\n outsideOpen,\n outsideOnOpenChange,\n defaultOpen ?? false // Always provide a default value to prevent undefined\n );\n\n const cls = useCls();\n const headlessUIPlacement = parseAntdPlacement(placement);\n // We don't need triggerRef since we're using callbackRef for the popup\n const [popupRef, setPopupRef] = useState<HTMLDivElement | null>(null);\n const [width, setWidth] = useState<number>();\n const [height, setHeight] = useState<number>();\n const callbackRef = useCallback((node: HTMLDivElement) => {\n setPopupRef(node);\n }, []);\n useEffect(() => {\n if (!popupRef) return;\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n setWidth(entry.contentRect.width);\n setHeight(entry.contentRect.height);\n }\n });\n observer.observe(popupRef);\n return () => {\n observer.disconnect();\n };\n }, [popupRef]);\n\n const defaultCloseIcon = useMemo(() => <X size={16} />, []);\n const renderTitle = useCallback(() => {\n return (\n <div className={clsx(cls(\"popup-panel-header\"), classNames?.header)}>\n <Flex\n align=\"center\"\n gap={8}\n className={cls(\"popup-panel-title-wrapper\")}\n >\n <Popover.Title\n render={\n <div className={clsx(cls(\"grow\", \"truncate\"), classNames?.title)}>\n {title}\n </div>\n }\n ></Popover.Title>\n <div className=\"flex items-center gap-2\">\n {beforeCloseButton}\n <Popover.Close\n render={<IconButton>{defaultCloseIcon}</IconButton>}\n />\n {afterCloseButton}\n </div>\n </Flex>\n {afterTitle ? afterTitle : null}\n </div>\n );\n }, [\n afterCloseButton,\n afterTitle,\n beforeCloseButton,\n cls,\n classNames?.header,\n classNames?.title,\n defaultCloseIcon,\n title,\n ]);\n const [resizing, setResizing] = useState(false);\n const { getRootProps, getHandleProps, rootRef } = useResizable({\n initialWidth: width,\n initialHeight: height,\n onDragStart: () => setResizing(true),\n onDragEnd: () => setResizing(false),\n });\n useEffect(() => {\n if (resizing) {\n document.body.style.userSelect = \"none\";\n } else {\n document.body.style.userSelect = \"\";\n }\n }, [resizing]);\n const { ref: rootRefProp, ...rootPropsWithoutRef } = getRootProps();\n // Handle reverse handle change for vertical resizing\n // Currently not used but kept for future implementation\n // const _onReverseHandleChangeVertical = (\n // parent: React.RefObject<HTMLDivElement>,\n // values: MoveValues\n // ) => {\n // if (!parent.current) return;\n // const { heightDiff } = values;\n // parent.current.style.top = `${\n // parseInt(parent.current.style.top || \"0\") - heightDiff\n // }px`;\n // };\n\n // Handle reverse handle change\n const onReverseHandleChangeHorizontal = (\n parent: React.RefObject<HTMLDivElement>,\n values: MoveValues\n ) => {\n if (!parent.current) return;\n const { widthDiff } = values;\n parent.current.style.left = `${\n parseInt(parent.current.style.left || \"0\") - widthDiff\n }px`;\n };\n\n return (\n <Popover.Root\n openOnHover={trigger === \"hover\" ? true : openOnHover}\n open={open}\n onOpenChange={(open, event, reason) => {\n if (reason === \"outside-press\" && !closeOnClickOutside) return;\n setOpen(open, event, reason);\n }}\n modal={modal}\n >\n <Popover.Trigger\n render={children}\n className={clsx(cls(\"popup-panel-trigger\"), classNames?.trigger)}\n ></Popover.Trigger>\n <Popover.Portal>\n <Popover.Positioner\n className={clsx(cls(\"popup-panel-root\"), classNames?.root)}\n side={headlessUIPlacement.placement}\n align={headlessUIPlacement.align}\n sideOffset={4}\n anchor={anchor}\n style={\n {\n \"--size-width\": size ? PopupPanelSize[size] : undefined,\n } as React.CSSProperties\n }\n >\n <Popover.Popup\n className={clsx(\n cls(\"popup-panel\"),\n cls(`popup-panel-size-${size}`),\n className,\n classNames?.popup\n )}\n ref={mergeRefs(rootRefProp, callbackRef)}\n {...rootPropsWithoutRef}\n {...(resizing ? { \"data-resizing\": true } : {})}\n >\n {/* <div ref={popupRef}> */}\n {title && renderTitle()}\n <div\n className={clsx(cls(\"popup-panel-content\"), classNames?.content)}\n >\n <div className={cls(\"popup-panel-content-inner\")}>{content}</div>\n </div>\n {footer && (\n <div\n className={clsx(cls(\"popup-panel-footer\"), classNames?.footer)}\n >\n {typeof footer === \"function\"\n ? footer({ close: () => setOpen(false) })\n : footer}\n </div>\n )}\n {resizable && (\n <>\n <div\n className={clsx(\n cls(\"popup-panel-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"bottom-left\"\n {...getHandleProps({\n lockHorizontal: true,\n })}\n />\n <div\n className={clsx(\n cls(\"popup-panel-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-left\"\n {...getHandleProps({\n reverse: true,\n lockVertical: true,\n onResize: (values) =>\n onReverseHandleChangeHorizontal(rootRef, values),\n })}\n />\n <div\n className={clsx(\n cls(\"popup-panel-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-right\"\n {...getHandleProps({\n lockVertical: true,\n })}\n />\n </>\n )}\n </Popover.Popup>\n </Popover.Positioner>\n </Popover.Portal>\n </Popover.Root>\n );\n};\n"],"names":["PopupPanel","children","placement","openOnHover","outsideOpen","outsideOnOpenChange","content","title","trigger","className","anchor","beforeCloseButton","afterCloseButton","afterTitle","size","footer","defaultOpen","resizable","classNames","modal","closeOnClickOutside","open","setOpen","useControlledState","cls","useCls","headlessUIPlacement","parseAntdPlacement","popupRef","setPopupRef","useState","width","setWidth","height","setHeight","callbackRef","useCallback","node","useEffect","observer","entries","entry","defaultCloseIcon","useMemo","jsx","X","renderTitle","jsxs","clsx","Flex","Popover","IconButton","resizing","setResizing","getRootProps","getHandleProps","rootRef","useResizable","rootRefProp","rootPropsWithoutRef","onReverseHandleChangeHorizontal","parent","values","widthDiff","event","reason","PopupPanelSize","mergeRefs","Fragment"],"mappings":";;;;;;;;;;;;;;AAsGO,MAAMA,KAAa,CAAC;AAAA,EACzB,UAAAC;AAAA,EACA,WAAAC;AAAA,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,UAAU,CAACO,MACTF,EAAgCJ,GAASM,CAAM;AAAA,wBAClD,CAAA;AAAA,sBAAA;AAAA,oBACH;AAAA,oBACA,gBAAAlB;AAAA,sBAAC;AAAA,sBAAA;AAAA,wBACC,WAAWI;AAAA,0BACTxB,EAAI,2BAA2B;AAAA,0BAC/BN,KAAA,gBAAAA,EAAY;AAAA,wBACd;AAAA,wBACA,kBAAe;AAAA,wBACd,GAAGqC,EAAe;AAAA,0BACjB,cAAc;AAAA,wBACf,CAAA;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACH,EACF,CAAA;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UAEJ;AAAA,QAAA,EAEJ,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as p, jsx as e } from "react/jsx-runtime";
|
|
2
3
|
import { ScrollArea as t } from "@base-ui-components/react";
|
|
3
4
|
import './style.css';/* empty css */
|
|
4
5
|
import { useCls as b } from "../utils/antdUtils.js";
|
|
5
6
|
import { clsx as l } from "../utils/cn.js";
|
|
6
7
|
const S = ({
|
|
7
|
-
children:
|
|
8
|
+
children: c,
|
|
8
9
|
className: n,
|
|
9
10
|
classNames: r = {},
|
|
10
|
-
orientation:
|
|
11
|
+
orientation: i = "vertical"
|
|
11
12
|
}) => {
|
|
12
13
|
const o = b();
|
|
13
14
|
return /* @__PURE__ */ p(t.Root, { className: l(o("scroll-area"), n), children: [
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
+
/* @__PURE__ */ e(
|
|
15
16
|
t.Viewport,
|
|
16
17
|
{
|
|
17
18
|
className: l(o("scroll-area-viewport"), r == null ? void 0 : r.viewport),
|
|
18
|
-
children: /* @__PURE__ */
|
|
19
|
+
children: /* @__PURE__ */ e(t.Content, { className: l(o("scroll-area-content")), children: c })
|
|
19
20
|
}
|
|
20
21
|
),
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
+
/* @__PURE__ */ e(
|
|
22
23
|
t.Scrollbar,
|
|
23
24
|
{
|
|
24
25
|
className: l(o("scroll-area-scrollbar"), r == null ? void 0 : r.scrollbar),
|
|
25
|
-
orientation:
|
|
26
|
-
"data-orientation":
|
|
27
|
-
children: /* @__PURE__ */
|
|
26
|
+
orientation: i,
|
|
27
|
+
"data-orientation": i,
|
|
28
|
+
children: /* @__PURE__ */ e(
|
|
28
29
|
t.Thumb,
|
|
29
30
|
{
|
|
30
31
|
className: l(o("scroll-area-thumb"), r == null ? void 0 : r.thumb)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/ScrollArea/component.tsx"],"sourcesContent":["\"use client\";\nimport { type ReactNode } from \"react\";\nimport { ScrollArea as BaseScrollArea } from \"@base-ui-components/react\";\nimport { clsx, useCls } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport interface ScrollAreaProps {\n children: ReactNode;\n /**\n * Additional class name for the root component\n */\n className?: string;\n /**\n * Custom class names for each part of the scroll area\n */\n classNames?: {\n /**\n * Class name for the viewport element\n */\n viewport?: string;\n /**\n * Class name for the scrollbar element\n */\n scrollbar?: string;\n /**\n * Class name for the thumb element\n */\n thumb?: string;\n };\n /**\n * Orientation of the scrollbar\n * @default \"vertical\"\n */\n orientation?: \"vertical\" | \"horizontal\";\n}\n\nexport const ScrollArea = ({\n children,\n className,\n classNames = {},\n orientation = \"vertical\",\n}: ScrollAreaProps) => {\n const cls = useCls();\n return (\n <BaseScrollArea.Root className={clsx(cls(\"scroll-area\"), className)}>\n <BaseScrollArea.Viewport\n className={clsx(cls(\"scroll-area-viewport\"), classNames?.viewport)}\n >\n <BaseScrollArea.Content className={clsx(cls(\"scroll-area-content\"))}>\n {children}\n </BaseScrollArea.Content>\n </BaseScrollArea.Viewport>\n <BaseScrollArea.Scrollbar\n className={clsx(cls(\"scroll-area-scrollbar\"), classNames?.scrollbar)}\n orientation={orientation}\n data-orientation={orientation}\n >\n <BaseScrollArea.Thumb\n className={clsx(cls(\"scroll-area-thumb\"), classNames?.thumb)}\n />\n </BaseScrollArea.Scrollbar>\n </BaseScrollArea.Root>\n );\n};\n"],"names":["ScrollArea","children","className","classNames","orientation","cls","useCls","jsxs","BaseScrollArea","clsx","jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/ScrollArea/component.tsx"],"sourcesContent":["\"use client\";\nimport { type ReactNode } from \"react\";\nimport { ScrollArea as BaseScrollArea } from \"@base-ui-components/react\";\nimport { clsx, useCls } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport interface ScrollAreaProps {\n children: ReactNode;\n /**\n * Additional class name for the root component\n */\n className?: string;\n /**\n * Custom class names for each part of the scroll area\n */\n classNames?: {\n /**\n * Class name for the viewport element\n */\n viewport?: string;\n /**\n * Class name for the scrollbar element\n */\n scrollbar?: string;\n /**\n * Class name for the thumb element\n */\n thumb?: string;\n };\n /**\n * Orientation of the scrollbar\n * @default \"vertical\"\n */\n orientation?: \"vertical\" | \"horizontal\";\n}\n\nexport const ScrollArea = ({\n children,\n className,\n classNames = {},\n orientation = \"vertical\",\n}: ScrollAreaProps) => {\n const cls = useCls();\n return (\n <BaseScrollArea.Root className={clsx(cls(\"scroll-area\"), className)}>\n <BaseScrollArea.Viewport\n className={clsx(cls(\"scroll-area-viewport\"), classNames?.viewport)}\n >\n <BaseScrollArea.Content className={clsx(cls(\"scroll-area-content\"))}>\n {children}\n </BaseScrollArea.Content>\n </BaseScrollArea.Viewport>\n <BaseScrollArea.Scrollbar\n className={clsx(cls(\"scroll-area-scrollbar\"), classNames?.scrollbar)}\n orientation={orientation}\n data-orientation={orientation}\n >\n <BaseScrollArea.Thumb\n className={clsx(cls(\"scroll-area-thumb\"), classNames?.thumb)}\n />\n </BaseScrollArea.Scrollbar>\n </BaseScrollArea.Root>\n );\n};\n"],"names":["ScrollArea","children","className","classNames","orientation","cls","useCls","jsxs","BaseScrollArea","clsx","jsx"],"mappings":";;;;;;AAsCO,MAAMA,IAAa,CAAC;AAAA,EACzB,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC,IAAa,CAAC;AAAA,EACd,aAAAC,IAAc;AAChB,MAAuB;AACrB,QAAMC,IAAMC,EAAO;AAEjB,SAAA,gBAAAC,EAACC,EAAe,MAAf,EAAoB,WAAWC,EAAKJ,EAAI,aAAa,GAAGH,CAAS,GAChE,UAAA;AAAA,IAAA,gBAAAQ;AAAA,MAACF,EAAe;AAAA,MAAf;AAAA,QACC,WAAWC,EAAKJ,EAAI,sBAAsB,GAAGF,KAAA,gBAAAA,EAAY,QAAQ;AAAA,QAEjE,UAAA,gBAAAO,EAACF,EAAe,SAAf,EAAuB,WAAWC,EAAKJ,EAAI,qBAAqB,CAAC,GAC/D,UAAAJ,EACH,CAAA;AAAA,MAAA;AAAA,IACF;AAAA,IACA,gBAAAS;AAAA,MAACF,EAAe;AAAA,MAAf;AAAA,QACC,WAAWC,EAAKJ,EAAI,uBAAuB,GAAGF,KAAA,gBAAAA,EAAY,SAAS;AAAA,QACnE,aAAAC;AAAA,QACA,oBAAkBA;AAAA,QAElB,UAAA,gBAAAM;AAAA,UAACF,EAAe;AAAA,UAAf;AAAA,YACC,WAAWC,EAAKJ,EAAI,mBAAmB,GAAGF,KAAA,gBAAAA,EAAY,KAAK;AAAA,UAAA;AAAA,QAAA;AAAA,MAC7D;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
3
|
+
import i from "antd/es/slider";
|
|
4
|
+
import { useCls as m } from "../utils/antdUtils.js";
|
|
5
|
+
import { clsx as c } from "../utils/cn.js";
|
|
5
6
|
const d = ({ className: r, tooltip: o = {}, style: s, ...t }) => {
|
|
6
|
-
const
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
-
|
|
7
|
+
const e = m();
|
|
8
|
+
return /* @__PURE__ */ l(
|
|
9
|
+
i,
|
|
9
10
|
{
|
|
10
|
-
className:
|
|
11
|
+
className: c(e("slider"), r),
|
|
11
12
|
style: s,
|
|
12
13
|
...t,
|
|
13
14
|
tooltip: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/Slider/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n default as AntSlider,\n type SliderSingleProps,\n type SliderRangeProps,\n} from \"antd/es/slider\";\nimport { useCls, clsx } from \"../utils\";\n\n// Define props interface extending Ant Design's SliderProps\nexport type SliderProps = SliderSingleProps | SliderRangeProps;\n\nexport type { SliderSingleProps, SliderRangeProps };\n\n// Create Slider component\nconst Slider = ({ className, tooltip = {}, style, ...rest }: SliderProps) => {\n const cls = useCls();\n return (\n <AntSlider\n className={clsx(cls(\"slider\"), className)}\n style={style}\n {...rest}\n tooltip={{\n arrow: false,\n ...tooltip,\n }}\n />\n );\n};\n\nexport { Slider };\n"],"names":["Slider","className","tooltip","style","rest","cls","useCls","jsx","AntSlider","clsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/Slider/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n default as AntSlider,\n type SliderSingleProps,\n type SliderRangeProps,\n} from \"antd/es/slider\";\nimport { useCls, clsx } from \"../utils\";\n\n// Define props interface extending Ant Design's SliderProps\nexport type SliderProps = SliderSingleProps | SliderRangeProps;\n\nexport type { SliderSingleProps, SliderRangeProps };\n\n// Create Slider component\nconst Slider = ({ className, tooltip = {}, style, ...rest }: SliderProps) => {\n const cls = useCls();\n return (\n <AntSlider\n className={clsx(cls(\"slider\"), className)}\n style={style}\n {...rest}\n tooltip={{\n arrow: false,\n ...tooltip,\n }}\n />\n );\n};\n\nexport { Slider };\n"],"names":["Slider","className","tooltip","style","rest","cls","useCls","jsx","AntSlider","clsx"],"mappings":";;;;;AAcM,MAAAA,IAAS,CAAC,EAAE,WAAAC,GAAW,SAAAC,IAAU,CAAA,GAAI,OAAAC,GAAO,GAAGC,QAAwB;AAC3E,QAAMC,IAAMC,EAAO;AAEjB,SAAA,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAKJ,EAAI,QAAQ,GAAGJ,CAAS;AAAA,MACxC,OAAAE;AAAA,MACC,GAAGC;AAAA,MACJ,SAAS;AAAA,QACP,OAAO;AAAA,QACP,GAAGF;AAAA,MAAA;AAAA,IACL;AAAA,EACF;AAEJ;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import n from "antd/es/splitter/
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
3
|
+
import n from "antd/es/splitter/Splitter";
|
|
4
|
+
import p from "antd/es/splitter/Panel";
|
|
4
5
|
import './style.css';/* empty css */
|
|
5
6
|
import { useCls as m } from "../utils/antdUtils.js";
|
|
6
7
|
import { clsx as c } from "../utils/cn.js";
|
|
@@ -9,24 +10,24 @@ const a = ({
|
|
|
9
10
|
className: r,
|
|
10
11
|
style: e,
|
|
11
12
|
...i
|
|
12
|
-
}) => /* @__PURE__ */
|
|
13
|
+
}) => /* @__PURE__ */ l(p, { className: r, style: e, ...i, children: t }), S = ({
|
|
13
14
|
children: t,
|
|
14
15
|
className: r = "",
|
|
15
16
|
style: e = {},
|
|
16
17
|
showSplitBar: i = !0,
|
|
17
|
-
...
|
|
18
|
+
...o
|
|
18
19
|
}) => {
|
|
19
|
-
const
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
|
|
20
|
+
const s = m();
|
|
21
|
+
return /* @__PURE__ */ l(
|
|
22
|
+
n,
|
|
22
23
|
{
|
|
23
24
|
className: c(
|
|
24
|
-
|
|
25
|
-
!i &&
|
|
25
|
+
s("splitter"),
|
|
26
|
+
!i && s("splitter-hidden-split-bar"),
|
|
26
27
|
r
|
|
27
28
|
),
|
|
28
29
|
style: e,
|
|
29
|
-
...
|
|
30
|
+
...o,
|
|
30
31
|
children: t
|
|
31
32
|
}
|
|
32
33
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/Splitter/component.tsx"],"sourcesContent":["\"use client\";\nimport React from \"react\";\nimport { default as AntdSplitter } from \"antd/es/splitter/Splitter\";\nimport { default as AntdSplitterPanel } from \"antd/es/splitter/Panel\";\nimport type {\n SplitterProps as AntdSplitterProps,\n PanelProps as AntdSplitterPanelProps,\n} from \"antd/es/splitter/interface\";\nimport { useCls, clsx } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport type SplitterProps = React.PropsWithChildren<AntdSplitterProps> & {\n showSplitBar?: boolean;\n};\n\nexport type SplitterPanelProps =\n React.PropsWithChildren<AntdSplitterPanelProps>;\n\nconst SplitterPanel: React.FC<SplitterPanelProps> = ({\n children,\n className,\n style,\n ...rest\n}) => {\n return (\n <AntdSplitterPanel className={className} style={style} {...rest}>\n {children}\n </AntdSplitterPanel>\n );\n};\n\nconst MainSplitter: React.FC<SplitterProps> = ({\n children,\n className = \"\",\n style = {},\n showSplitBar = true,\n ...rest\n}) => {\n const cls = useCls();\n return (\n <AntdSplitter\n className={clsx(\n cls(\"splitter\"),\n !showSplitBar && cls(\"splitter-hidden-split-bar\"),\n className\n )}\n style={style}\n {...rest}\n >\n {children}\n </AntdSplitter>\n );\n};\n\nexport const Splitter = Object.assign(MainSplitter, {\n Panel: SplitterPanel,\n});\n\n// For backward compatibility\nexport const Split = Splitter;\n"],"names":["SplitterPanel","children","className","style","rest","AntdSplitterPanel","MainSplitter","showSplitBar","cls","useCls","jsx","AntdSplitter","clsx","Splitter","Split"],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/Splitter/component.tsx"],"sourcesContent":["\"use client\";\nimport React from \"react\";\nimport { default as AntdSplitter } from \"antd/es/splitter/Splitter\";\nimport { default as AntdSplitterPanel } from \"antd/es/splitter/Panel\";\nimport type {\n SplitterProps as AntdSplitterProps,\n PanelProps as AntdSplitterPanelProps,\n} from \"antd/es/splitter/interface\";\nimport { useCls, clsx } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport type SplitterProps = React.PropsWithChildren<AntdSplitterProps> & {\n showSplitBar?: boolean;\n};\n\nexport type SplitterPanelProps =\n React.PropsWithChildren<AntdSplitterPanelProps>;\n\nconst SplitterPanel: React.FC<SplitterPanelProps> = ({\n children,\n className,\n style,\n ...rest\n}) => {\n return (\n <AntdSplitterPanel className={className} style={style} {...rest}>\n {children}\n </AntdSplitterPanel>\n );\n};\n\nconst MainSplitter: React.FC<SplitterProps> = ({\n children,\n className = \"\",\n style = {},\n showSplitBar = true,\n ...rest\n}) => {\n const cls = useCls();\n return (\n <AntdSplitter\n className={clsx(\n cls(\"splitter\"),\n !showSplitBar && cls(\"splitter-hidden-split-bar\"),\n className\n )}\n style={style}\n {...rest}\n >\n {children}\n </AntdSplitter>\n );\n};\n\nexport const Splitter = Object.assign(MainSplitter, {\n Panel: SplitterPanel,\n});\n\n// For backward compatibility\nexport const Split = Splitter;\n"],"names":["SplitterPanel","children","className","style","rest","AntdSplitterPanel","MainSplitter","showSplitBar","cls","useCls","jsx","AntdSplitter","clsx","Splitter","Split"],"mappings":";;;;;;;AAoBA,MAAMA,IAA8C,CAAC;AAAA,EACnD,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,wBAEKC,GAAkB,EAAA,WAAAH,GAAsB,OAAAC,GAAe,GAAGC,GACxD,UAAAH,GACH,GAIEK,IAAwC,CAAC;AAAA,EAC7C,UAAAL;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,OAAAC,IAAQ,CAAC;AAAA,EACT,cAAAI,IAAe;AAAA,EACf,GAAGH;AACL,MAAM;AACJ,QAAMI,IAAMC,EAAO;AAEjB,SAAA,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACTJ,EAAI,UAAU;AAAA,QACd,CAACD,KAAgBC,EAAI,2BAA2B;AAAA,QAChDN;AAAA,MACF;AAAA,MACA,OAAAC;AAAA,MACC,GAAGC;AAAA,MAEH,UAAAH;AAAA,IAAA;AAAA,EACH;AAEJ,GAEaY,IAAW,OAAO,OAAOP,GAAc;AAAA,EAClD,OAAON;AACT,CAAC,GAGYc,IAAQD;"}
|
|
@@ -1,37 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as p } from "react";
|
|
4
|
+
import { cn as n } from "../utils/cn.js";
|
|
5
|
+
import { useCls as u } from "../utils/antdUtils.js";
|
|
6
|
+
const x = p(
|
|
7
|
+
({
|
|
8
|
+
hug: a = !1,
|
|
9
|
+
align: s = "flex-start",
|
|
10
|
+
justify: c = "flex-start",
|
|
11
|
+
vertical: r = !1,
|
|
12
|
+
gap: l = 0,
|
|
13
|
+
wrap: e = !1,
|
|
14
|
+
className: o,
|
|
15
|
+
children: f,
|
|
16
|
+
...i
|
|
17
|
+
}, k) => {
|
|
18
|
+
const t = u();
|
|
19
|
+
return /* @__PURE__ */ m(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
ref: k,
|
|
23
|
+
className: n(
|
|
24
|
+
t("stack"),
|
|
25
|
+
t(a ? "stack-hug" : "stack-fill"),
|
|
26
|
+
t(`stack-gap-${l}`),
|
|
27
|
+
t(r ? "stack-vertical" : "stack-horizontal"),
|
|
28
|
+
e && t("stack-wrap"),
|
|
29
|
+
t(`stack-align-${s}`),
|
|
30
|
+
t(`stack-justify-${c}`),
|
|
31
|
+
o
|
|
32
|
+
),
|
|
33
|
+
...i,
|
|
34
|
+
children: f
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
x.displayName = "Stack";
|
|
34
40
|
export {
|
|
35
|
-
|
|
41
|
+
x as Stack
|
|
36
42
|
};
|
|
37
43
|
//# sourceMappingURL=Stack.js.map
|