@bioturing/components 0.39.1 → 0.41.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.
Files changed (139) hide show
  1. package/dist/base.d.ts +35 -1
  2. package/dist/base.d.ts.map +1 -1
  3. package/dist/base.js +47 -1
  4. package/dist/base.js.map +1 -1
  5. package/dist/components/alert/component.d.ts +61 -0
  6. package/dist/components/alert/component.d.ts.map +1 -0
  7. package/dist/components/alert/component.js +76 -0
  8. package/dist/components/alert/component.js.map +1 -0
  9. package/dist/components/alert/index.d.ts +2 -0
  10. package/dist/components/alert/index.d.ts.map +1 -0
  11. package/dist/components/alert/style.css +1 -0
  12. package/dist/components/base-menu/component.d.ts +1 -1
  13. package/dist/components/base-menu/index.d.ts +1 -1
  14. package/dist/components/base-menu/index.d.ts.map +1 -1
  15. package/dist/components/base-menu/item.d.ts +1 -1
  16. package/dist/components/base-menu/item.d.ts.map +1 -1
  17. package/dist/components/base-menu/item.js +1 -1
  18. package/dist/components/base-menu/item.js.map +1 -1
  19. package/dist/components/button/component.d.ts +1 -1
  20. package/dist/components/button/component.d.ts.map +1 -1
  21. package/dist/components/button/component.js +18 -17
  22. package/dist/components/button/component.js.map +1 -1
  23. package/dist/components/button/style.css +1 -1
  24. package/dist/components/checkbox/component.d.ts.map +1 -1
  25. package/dist/components/choice-list/component.d.ts +8 -4
  26. package/dist/components/choice-list/component.d.ts.map +1 -1
  27. package/dist/components/choice-list/component.js +89 -94
  28. package/dist/components/choice-list/component.js.map +1 -1
  29. package/dist/components/color-select/component.js +6 -6
  30. package/dist/components/combobox/component.js +1 -1
  31. package/dist/components/combobox/component.js.map +1 -1
  32. package/dist/components/command-palette/component.d.ts +6 -0
  33. package/dist/components/command-palette/component.d.ts.map +1 -1
  34. package/dist/components/command-palette/component.js +182 -63
  35. package/dist/components/command-palette/component.js.map +1 -1
  36. package/dist/components/command-palette/index.d.ts +3 -1
  37. package/dist/components/command-palette/index.d.ts.map +1 -1
  38. package/dist/components/command-palette/style.css +1 -1
  39. package/dist/components/drag-drop/draggable.js +1 -1
  40. package/dist/components/drag-drop/draggable.js.map +1 -1
  41. package/dist/components/drag-drop/droppable.js +1 -1
  42. package/dist/components/drag-drop/droppable.js.map +1 -1
  43. package/dist/components/drag-drop/types.d.ts +1 -1
  44. package/dist/components/drag-drop/types.d.ts.map +1 -1
  45. package/dist/components/drag-drop/value.js +13 -13
  46. package/dist/components/dropdown-menu/component.d.ts +1 -1
  47. package/dist/components/dropdown-menu/component.d.ts.map +1 -1
  48. package/dist/components/dropdown-menu/component.js +162 -135
  49. package/dist/components/dropdown-menu/component.js.map +1 -1
  50. package/dist/components/dropdown-menu/divider.js +2 -2
  51. package/dist/components/dropdown-menu/divider.js.map +1 -1
  52. package/dist/components/dropdown-menu/item.js +2 -2
  53. package/dist/components/dropdown-menu/item.js.map +1 -1
  54. package/dist/components/dropdown-menu/style.css +1 -1
  55. package/dist/components/dropdown-menu/useDropdownMenu.js +1 -1
  56. package/dist/components/dropdown-menu/useDropdownMenu.js.map +1 -1
  57. package/dist/components/hooks/antd.d.ts.map +1 -1
  58. package/dist/components/hooks/index.d.ts +1 -0
  59. package/dist/components/hooks/index.d.ts.map +1 -1
  60. package/dist/components/hooks/useBaseUIPlacement.d.ts +64 -0
  61. package/dist/components/hooks/useBaseUIPlacement.d.ts.map +1 -0
  62. package/dist/components/hooks/useBaseUIPlacement.js +61 -0
  63. package/dist/components/hooks/useBaseUIPlacement.js.map +1 -0
  64. package/dist/components/hooks/useControlledState.d.ts +1 -0
  65. package/dist/components/hooks/useControlledState.d.ts.map +1 -1
  66. package/dist/components/hooks/useControlledState.js +16 -16
  67. package/dist/components/hooks/useControlledState.js.map +1 -1
  68. package/dist/components/hooks/useTransitionStatus.js +2 -2
  69. package/dist/components/hooks/useTransitionStatus.js.map +1 -1
  70. package/dist/components/icon-button/style.css +1 -1
  71. package/dist/components/index.d.ts +3 -2
  72. package/dist/components/index.d.ts.map +1 -1
  73. package/dist/components/nav/index.d.ts.map +1 -1
  74. package/dist/components/nav/item.d.ts +1 -1
  75. package/dist/components/nav/item.d.ts.map +1 -1
  76. package/dist/components/nav/item.js +1 -1
  77. package/dist/components/nav/item.js.map +1 -1
  78. package/dist/components/popup-panel/component.d.ts +4 -4
  79. package/dist/components/popup-panel/component.d.ts.map +1 -1
  80. package/dist/components/popup-panel/component.js +142 -152
  81. package/dist/components/popup-panel/component.js.map +1 -1
  82. package/dist/components/resizable/component.js +1 -1
  83. package/dist/components/resizable/component.js.map +1 -1
  84. package/dist/components/scroll-area/component.d.ts +1 -1
  85. package/dist/components/scroll-area/component.d.ts.map +1 -1
  86. package/dist/components/scroll-area/component.js +1 -1
  87. package/dist/components/scroll-area/component.js.map +1 -1
  88. package/dist/components/select/component.d.ts.map +1 -1
  89. package/dist/components/select/component.js +153 -138
  90. package/dist/components/select/component.js.map +1 -1
  91. package/dist/components/select/item.js +13 -13
  92. package/dist/components/select-trigger/component.js +19 -19
  93. package/dist/components/splitter/splitter.d.ts.map +1 -1
  94. package/dist/components/splitter/splitter.js +53 -51
  95. package/dist/components/splitter/splitter.js.map +1 -1
  96. package/dist/components/stack/StackChild.js +2 -2
  97. package/dist/components/stack/StackChild.js.map +1 -1
  98. package/dist/components/toast/component.d.ts +1 -1
  99. package/dist/components/toast/component.d.ts.map +1 -1
  100. package/dist/components/toast/component.js +1 -1
  101. package/dist/components/toast/component.js.map +1 -1
  102. package/dist/components/toast/function.d.ts +2 -2
  103. package/dist/components/toast/function.d.ts.map +1 -1
  104. package/dist/components/toast/function.js +1 -1
  105. package/dist/components/toast/function.js.map +1 -1
  106. package/dist/components/transition/component.d.ts +1 -1
  107. package/dist/components/transition/component.d.ts.map +1 -1
  108. package/dist/components/transition/component.js +2 -2
  109. package/dist/components/transition/component.js.map +1 -1
  110. package/dist/components/tree/useTreeCommon.d.ts.map +1 -1
  111. package/dist/components/utils/WithRenderProp.d.ts +1 -1
  112. package/dist/components/utils/WithRenderProp.d.ts.map +1 -1
  113. package/dist/components/utils/WithRenderProp.js +1 -1
  114. package/dist/components/utils/WithRenderProp.js.map +1 -1
  115. package/dist/components/utils/index.d.ts +1 -0
  116. package/dist/components/utils/index.d.ts.map +1 -1
  117. package/dist/components/utils/renderProp.d.ts +24 -0
  118. package/dist/components/utils/renderProp.d.ts.map +1 -0
  119. package/dist/components/utils/renderProp.js +19 -0
  120. package/dist/components/utils/renderProp.js.map +1 -0
  121. package/dist/components/vertical-collapsible-panel/component.js +1 -1
  122. package/dist/components/vertical-collapsible-panel/component.js.map +1 -1
  123. package/dist/index.js +271 -266
  124. package/dist/index.js.map +1 -1
  125. package/dist/metadata.d.ts +9 -0
  126. package/dist/metadata.d.ts.map +1 -1
  127. package/dist/metadata.js +29 -14
  128. package/dist/metadata.js.map +1 -1
  129. package/dist/stats.html +1 -1
  130. package/dist/tailwind.css +125 -1
  131. package/package.json +4 -4
  132. package/dist/components/cmdk/command-score.d.ts +0 -2
  133. package/dist/components/cmdk/command-score.d.ts.map +0 -1
  134. package/dist/components/cmdk/command-score.js +0 -48
  135. package/dist/components/cmdk/command-score.js.map +0 -1
  136. package/dist/components/cmdk/index.d.ts +0 -440
  137. package/dist/components/cmdk/index.d.ts.map +0 -1
  138. package/dist/components/cmdk/index.js +0 -595
  139. package/dist/components/cmdk/index.js.map +0 -1
@@ -1,196 +1,186 @@
1
1
  "use client";
2
- import { jsx as e, jsxs as c } from "react/jsx-runtime";
3
- import { Popover as a } from "@base-ui-components/react/popover";
4
- import { mergeProps as S } from "@base-ui-components/react";
5
- import { X as re } from "@bioturing/assets";
6
- import { useMemo as te, useRef as A, useState as x, useEffect as ne, useCallback as oe } from "react";
7
- import { Stack as ie } from "../stack/index.js";
8
- import { PopupPanelSize as ae } from "./constants.js";
2
+ import { jsx as r, jsxs as t } from "react/jsx-runtime";
3
+ import { Popover as n } from "@base-ui/react/popover";
4
+ import { mergeProps as y } from "@base-ui/react";
5
+ import { X as Y } from "@bioturing/assets";
6
+ import { useMemo as z, useState as Z, useCallback as _ } from "react";
7
+ import { Stack as ee } from "../stack/index.js";
8
+ import { PopupPanelSize as re } from "./constants.js";
9
9
  import './style.css';/* empty css */
10
- import { anchorToResizeHandles as pe } from "./utils.js";
11
- import { parseAntdPlacement as se, buildAntdPlacement as le } from "../utils/placement.js";
12
- import { useDraggable as ce } from "../hooks/useDraggable.js";
13
- import { Resizable as ue } from "../resizable/component.js";
14
- import { useControlledState as de } from "../hooks/useControlledState.js";
15
- import { useCls as me } from "../utils/antdUtils.js";
16
- import { useTheme as fe } from "../theme-provider/context/themeStore.js";
10
+ import { anchorToResizeHandles as oe } from "./utils.js";
11
+ import { useDraggable as ne } from "../hooks/useDraggable.js";
12
+ import { Resizable as pe } from "../resizable/component.js";
13
+ import { useControlledState as ie } from "../hooks/useControlledState.js";
14
+ import { useCls as te } from "../utils/antdUtils.js";
15
+ import { useTheme as le } from "../theme-provider/context/themeStore.js";
16
+ import { parseAntdPlacement as ae } from "../utils/placement.js";
17
+ import { useBaseUIPlacement as se } from "../hooks/useBaseUIPlacement.js";
17
18
  import { clsx as p } from "../utils/cn.js";
18
- import { IconButton as ge } from "../icon-button/component.js";
19
- const Ie = ({
20
- children: z,
21
- placement: H,
22
- openOnHover: k = !1,
23
- open: E,
24
- onOpenChange: I,
25
- content: K,
26
- title: h,
27
- trigger: T = "click",
28
- className: j,
29
- anchor: M,
30
- beforeCloseButton: N,
31
- afterCloseButton: w,
32
- afterTitle: b,
33
- size: P = "medium",
34
- footer: u,
35
- defaultOpen: D = !1,
36
- resizable: y = !1,
37
- draggable: F = !1,
19
+ import { IconButton as ce } from "../icon-button/component.js";
20
+ const we = ({
21
+ children: H,
22
+ placement: I,
23
+ openOnHover: b = !1,
24
+ open: k,
25
+ onOpenChange: w,
26
+ content: f,
27
+ title: l,
28
+ trigger: A = "click",
29
+ className: h,
30
+ anchor: T,
31
+ beforeCloseButton: g,
32
+ afterCloseButton: P,
33
+ afterTitle: m,
34
+ size: a = "medium",
35
+ footer: i,
36
+ defaultOpen: j = !1,
37
+ resizable: v = !1,
38
+ draggable: K = !1,
38
39
  maintainAspectRatio: U = !1,
39
- classNames: n,
40
- modal: V = !1,
41
- closeOnClickOutside: X = !0,
42
- onPlacementChange: v,
43
- positionerProps: $ = {},
44
- triggerProps: q = {},
45
- portalProps: G = {},
46
- ...J
40
+ classNames: e,
41
+ modal: D = !1,
42
+ closeOnClickOutside: E = !0,
43
+ onPlacementChange: M,
44
+ positionerProps: X = {},
45
+ triggerProps: $ = {},
46
+ portalProps: q = {},
47
+ ...B
47
48
  }) => {
48
- const [R, C] = de(
49
- E,
50
- I,
51
- D
49
+ const [C, u] = ie(
50
+ k,
51
+ w,
52
+ j
52
53
  // Always provide a default value to prevent undefined
53
- ), r = me(), { className: L } = fe(), d = se(H), O = te(() => /* @__PURE__ */ e(re, { size: 16 }), []), m = A(d.side), f = A(d.align), [Q, W] = x(0), [l, Y] = x(
54
+ ), o = te(), { className: F } = le(), s = ae(I), S = z(() => /* @__PURE__ */ r(Y, { size: 16 }), []), [G, J] = Z(
54
55
  null
55
- );
56
- ne(() => {
57
- if (!l || !R) return;
58
- const i = new MutationObserver((s) => {
59
- let g = !1;
60
- if (s.forEach((t) => {
61
- if (t.type === "attributes" && t.attributeName === "data-side") {
62
- const o = l.getAttribute(t.attributeName);
63
- o && o !== m.current && (m.current = o, g = !0);
64
- }
65
- if (t.type === "attributes" && t.attributeName === "data-align") {
66
- const o = l.getAttribute(t.attributeName);
67
- o && o !== f.current && (f.current = o, g = !0);
68
- }
69
- }), g) {
70
- const t = le({
71
- side: m.current,
72
- align: f.current
73
- });
74
- W((o) => o + 1), v && v(t);
75
- }
76
- });
77
- return i.observe(l, {
78
- attributes: !0,
79
- attributeFilter: ["data-side", "data-align"],
80
- attributeOldValue: !0
81
- }), () => {
82
- i.disconnect();
83
- };
84
- }, [v, R, l]);
85
- const Z = oe(() => /* @__PURE__ */ c("div", { className: p(r("popup-panel-header"), n?.header), children: [
86
- /* @__PURE__ */ c(
87
- ie,
56
+ ), { currentSide: L, currentAlign: N, placementChangeKey: Q } = se({
57
+ positionerRef: G,
58
+ open: C,
59
+ initialSide: s.side,
60
+ initialAlign: s.align,
61
+ onPlacementChange: M
62
+ }), R = _(() => /* @__PURE__ */ t("div", { className: p(o("popup-panel-header"), e?.header), children: [
63
+ /* @__PURE__ */ t(
64
+ ee,
88
65
  {
89
66
  align: "center",
90
67
  gap: 8,
91
- className: r("popup-panel-title-wrapper"),
68
+ className: o("popup-panel-title-wrapper"),
92
69
  children: [
93
- /* @__PURE__ */ e(
94
- a.Title,
70
+ /* @__PURE__ */ r(
71
+ n.Title,
95
72
  {
96
- render: /* @__PURE__ */ e("div", { className: p(r("grow", "truncate"), n?.title), children: h })
73
+ render: /* @__PURE__ */ r("div", { className: p(o("grow", "truncate"), e?.title), children: l })
97
74
  }
98
75
  ),
99
- /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
100
- N,
101
- /* @__PURE__ */ e(
102
- a.Close,
76
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
77
+ g,
78
+ /* @__PURE__ */ r(
79
+ n.Close,
103
80
  {
104
- render: /* @__PURE__ */ e(ge, { children: O })
81
+ render: /* @__PURE__ */ r(ce, { children: S })
105
82
  }
106
83
  ),
107
- w
84
+ P
108
85
  ] })
109
86
  ]
110
87
  }
111
88
  ),
112
- b || null
89
+ m || null
113
90
  ] }), [
114
- w,
115
- b,
116
- N,
117
- r,
118
- n?.header,
119
- n?.title,
120
- O,
121
- h
122
- ]), { ref: _ } = ce(F), B = /* @__PURE__ */ c(
123
- a.Popup,
124
- {
125
- className: p(
126
- r("popup-panel"),
127
- r(`popup-panel-size-${P}`),
128
- j,
129
- n?.popup
130
- ),
131
- ref: _,
132
- children: [
133
- h && Z(),
134
- /* @__PURE__ */ e("div", { className: p(r("popup-panel-content"), n?.content), children: /* @__PURE__ */ e("div", { className: r("popup-panel-content-inner"), children: K }) }),
135
- u && /* @__PURE__ */ e("div", { className: p(r("popup-panel-footer"), n?.footer), children: typeof u == "function" ? u({ close: () => C(!1) }) : u })
136
- ]
137
- }
138
- ), ee = {
139
- ref: Y,
140
- className: p(r("popup-panel-root"), L, n?.root),
141
- side: d.side,
142
- align: d.align,
91
+ P,
92
+ m,
93
+ g,
94
+ o,
95
+ e?.header,
96
+ e?.title,
97
+ S,
98
+ l
99
+ ]), { ref: x } = ne(K), V = z(
100
+ () => /* @__PURE__ */ t(
101
+ n.Popup,
102
+ {
103
+ className: p(
104
+ o("popup-panel"),
105
+ o(`popup-panel-size-${a}`),
106
+ h,
107
+ e?.popup
108
+ ),
109
+ ref: x,
110
+ children: [
111
+ l && R(),
112
+ /* @__PURE__ */ r("div", { className: p(o("popup-panel-content"), e?.content), children: /* @__PURE__ */ r("div", { className: o("popup-panel-content-inner"), children: f }) }),
113
+ i && /* @__PURE__ */ r("div", { className: p(o("popup-panel-footer"), e?.footer), children: typeof i == "function" ? i({ close: () => u(!1) }) : i })
114
+ ]
115
+ }
116
+ ),
117
+ [
118
+ h,
119
+ e?.content,
120
+ e?.footer,
121
+ e?.popup,
122
+ o,
123
+ f,
124
+ x,
125
+ i,
126
+ R,
127
+ u,
128
+ a,
129
+ l
130
+ ]
131
+ ), W = {
132
+ ref: J,
133
+ className: p(o("popup-panel-root"), F, e?.root),
134
+ side: s.side,
135
+ align: s.align,
143
136
  sideOffset: 4,
144
- anchor: M,
137
+ anchor: T,
145
138
  style: {
146
- "--size-width": P ? ae[P] : void 0
139
+ "--size-width": a ? re[a] : void 0
147
140
  },
148
- render: ({ children: i, onDragEnd: s, onDragStart: g, ...t }) => y ? /* @__PURE__ */ e(
149
- ue,
141
+ render: ({ children: c, onDragEnd: d, onDragStart: de, ...O }) => v ? /* @__PURE__ */ r(
142
+ pe,
150
143
  {
151
- resizable: y,
144
+ resizable: v,
152
145
  resetKey: Q,
153
146
  maintainAspectRatio: U,
154
147
  classNames: {
155
- resizeHandle: n?.resizeHandle
148
+ resizeHandle: e?.resizeHandle
156
149
  },
157
- handles: pe(
158
- m.current,
159
- f.current
160
- ),
161
- ...t,
162
- children: i
150
+ handles: oe(L, N),
151
+ ...O,
152
+ children: c
163
153
  }
164
- ) : /* @__PURE__ */ e("div", { ...t, children: i })
154
+ ) : /* @__PURE__ */ r("div", { ...O, children: c })
165
155
  };
166
- return /* @__PURE__ */ c(
167
- a.Root,
156
+ return /* @__PURE__ */ t(
157
+ n.Root,
168
158
  {
169
- open: R,
170
- onOpenChange: (i, s) => {
171
- (s.reason === "outside-press" || s.reason === "focus-out") && !X || C(i, s);
159
+ open: C,
160
+ onOpenChange: (c, d) => {
161
+ (d.reason === "outside-press" || d.reason === "focus-out") && !E || u(c, d);
172
162
  },
173
- modal: V,
174
- ...J,
163
+ modal: D,
164
+ ...B,
175
165
  children: [
176
- /* @__PURE__ */ e(
177
- a.Trigger,
166
+ /* @__PURE__ */ r(
167
+ n.Trigger,
178
168
  {
179
- ...S(
169
+ ...y(
180
170
  {
181
- render: z,
182
- className: p(r("popup-panel-trigger"), n?.trigger),
183
- openOnHover: T === "hover" ? !0 : k
171
+ render: H,
172
+ className: p(o("popup-panel-trigger"), e?.trigger),
173
+ openOnHover: A === "hover" ? !0 : b
184
174
  },
185
- q
175
+ $
186
176
  )
187
177
  }
188
178
  ),
189
- /* @__PURE__ */ e(a.Portal, { ...G, children: /* @__PURE__ */ e(
190
- a.Positioner,
179
+ /* @__PURE__ */ r(n.Portal, { ...q, children: /* @__PURE__ */ r(
180
+ n.Positioner,
191
181
  {
192
- ...S(ee, $),
193
- children: B
182
+ ...y(W, X),
183
+ children: V
194
184
  }
195
185
  ) })
196
186
  ]
@@ -198,6 +188,6 @@ const Ie = ({
198
188
  );
199
189
  };
200
190
  export {
201
- Ie as PopupPanel
191
+ we as PopupPanel
202
192
  };
203
193
  //# sourceMappingURL=component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sources":["../../../src/components/popup-panel/component.tsx"],"sourcesContent":["\"use client\";\nimport { Popover } from \"@base-ui-components/react/popover\";\nimport {\n BaseUIAlign,\n BaseUISide,\n buildAntdPlacement,\n clsx,\n parseAntdPlacement,\n useCls,\n} from \"../utils\";\n\nimport { mergeProps } from \"@base-ui-components/react\";\nimport { X } from \"@bioturing/assets\";\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { useControlledState, useDraggable } from \"../hooks\";\nimport { IconButton } from \"../icon-button\";\nimport { Resizable } from \"../resizable\";\nimport { Stack } from \"../stack\";\nimport { PopupPanelSize } from \"./constants\";\n\n// Import component-specific styles\nimport { useRef } from \"react\";\nimport { useTheme } from \"../theme-provider\";\nimport \"./style.css\";\nimport { anchorToResizeHandles } from \"./utils\";\n\nexport interface PopupPanelProps\n extends Omit<\n React.ComponentPropsWithRef<\"div\">,\n \"title\" | \"content\" | \"children\"\n >,\n Omit<Popover.Root.Props, \"children\"> {\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 * Whether the panel should be draggable\n * @default false\n */\n draggable?: boolean;\n /**\n * Whether to maintain aspect ratio when resizing\n * Only applies when resizable is true\n * @default false\n */\n maintainAspectRatio?: 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 * Callback function when the placement changes\n */\n onPlacementChange?: (placement: PopoverProps[\"placement\"]) => void;\n /**\n * Props to pass to the positioner\n */\n positionerProps?: Popover.Positioner.Props;\n /**\n * Props to pass to the trigger\n */\n triggerProps?: Popover.Trigger.Props;\n /**\n * Props to pass to the portal\n */\n portalProps?: Popover.Portal.Props;\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 = false,\n resizable = false,\n draggable = false,\n maintainAspectRatio = false,\n classNames,\n modal = false,\n closeOnClickOutside = true,\n onPlacementChange,\n positionerProps = {},\n triggerProps = {},\n portalProps = {},\n ...rest\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 // Always provide a default value to prevent undefined\n );\n\n const cls = useCls();\n const { className: themeClassName } = useTheme();\n const baseUIPlacement = parseAntdPlacement(placement);\n\n const defaultCloseIcon = useMemo(() => <X size={16} />, []);\n\n // const positionerRef = useRef<HTMLDivElement>(null);\n\n const currentSideRef = useRef<BaseUISide>(baseUIPlacement.side);\n const currentAlignRef = useRef<BaseUIAlign>(baseUIPlacement.align);\n const [placementChangeKey, setPlacementChangeKey] = useState(0);\n const [positionerRef, setPositionerRef] = useState<HTMLDivElement | null>(\n null\n );\n\n useEffect(() => {\n if (!positionerRef || !open) return; // Only observe when popup is open\n\n // Create MutationObserver to watch for data-side changes\n const observer = new MutationObserver((mutations) => {\n let hasPlacementChanged = false;\n mutations.forEach((mutation) => {\n if (\n mutation.type === \"attributes\" &&\n mutation.attributeName === \"data-side\"\n ) {\n const newSide = positionerRef.getAttribute(mutation.attributeName);\n if (newSide && newSide !== currentSideRef.current) {\n currentSideRef.current = newSide as BaseUISide;\n hasPlacementChanged = true;\n }\n }\n if (\n mutation.type === \"attributes\" &&\n mutation.attributeName === \"data-align\"\n ) {\n const newAlign = positionerRef.getAttribute(mutation.attributeName);\n if (newAlign && newAlign !== currentAlignRef.current) {\n currentAlignRef.current = newAlign as BaseUIAlign;\n hasPlacementChanged = true;\n }\n }\n });\n\n // Only trigger callbacks if placement actually changed\n if (hasPlacementChanged) {\n const newPlacement = buildAntdPlacement({\n side: currentSideRef.current,\n align: currentAlignRef.current,\n });\n\n // Trigger resizable dimensions reset when placement changes\n setPlacementChangeKey((prev) => prev + 1);\n\n if (onPlacementChange) {\n onPlacementChange(newPlacement);\n }\n }\n });\n\n // Start observing\n observer.observe(positionerRef, {\n attributes: true,\n attributeFilter: [\"data-side\", \"data-align\"],\n attributeOldValue: true,\n });\n\n return () => {\n observer.disconnect();\n };\n }, [onPlacementChange, open, positionerRef]);\n\n const renderTitle = useCallback(() => {\n return (\n <div className={clsx(cls(\"popup-panel-header\"), classNames?.header)}>\n <Stack\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 </Stack>\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\n const { ref: draggableRef } = useDraggable(draggable);\n\n const popup = (\n <Popover.Popup\n className={clsx(\n cls(\"popup-panel\"),\n cls(`popup-panel-size-${size}`),\n className,\n classNames?.popup\n )}\n ref={draggableRef}\n >\n {title && renderTitle()}\n <div className={clsx(cls(\"popup-panel-content\"), classNames?.content)}>\n <div className={cls(\"popup-panel-content-inner\")}>{content}</div>\n </div>\n {footer && (\n <div className={clsx(cls(\"popup-panel-footer\"), classNames?.footer)}>\n {typeof footer === \"function\"\n ? footer({ close: () => setOpen(false) })\n : footer}\n </div>\n )}\n </Popover.Popup>\n );\n\n const defaultPositionerProps = {\n ref: setPositionerRef,\n className: clsx(cls(\"popup-panel-root\"), themeClassName, classNames?.root),\n side: baseUIPlacement.side,\n align: baseUIPlacement.align,\n sideOffset: 4,\n anchor,\n style: {\n \"--size-width\": size ? PopupPanelSize[size] : undefined,\n } as React.CSSProperties,\n render: ({ children, onDragEnd, onDragStart, ...props }) => {\n return resizable ? (\n <Resizable\n resizable={resizable}\n resetKey={placementChangeKey}\n maintainAspectRatio={maintainAspectRatio}\n classNames={{\n resizeHandle: classNames?.resizeHandle,\n }}\n handles={anchorToResizeHandles(\n currentSideRef.current,\n currentAlignRef.current\n )}\n {...props}\n >\n {children}\n </Resizable>\n ) : (\n <div {...props}>{children}</div>\n );\n },\n };\n\n return (\n <Popover.Root\n open={open}\n onOpenChange={(open, eventDetails) => {\n if (\n (eventDetails.reason === \"outside-press\" ||\n eventDetails.reason === \"focus-out\") &&\n !closeOnClickOutside\n )\n return;\n setOpen(open, eventDetails);\n }}\n modal={modal}\n {...rest}\n >\n <Popover.Trigger\n {...mergeProps(\n {\n render: children,\n className: clsx(cls(\"popup-panel-trigger\"), classNames?.trigger),\n openOnHover: trigger === \"hover\" ? true : openOnHover,\n },\n triggerProps\n )}\n ></Popover.Trigger>\n <Popover.Portal {...portalProps}>\n <Popover.Positioner\n {...mergeProps(defaultPositionerProps, positionerProps)}\n >\n {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","draggable","maintainAspectRatio","classNames","modal","closeOnClickOutside","onPlacementChange","positionerProps","triggerProps","portalProps","rest","open","setOpen","useControlledState","cls","useCls","themeClassName","useTheme","baseUIPlacement","parseAntdPlacement","defaultCloseIcon","useMemo","jsx","X","currentSideRef","useRef","currentAlignRef","placementChangeKey","setPlacementChangeKey","useState","positionerRef","setPositionerRef","useEffect","observer","mutations","hasPlacementChanged","mutation","newSide","newAlign","newPlacement","buildAntdPlacement","prev","renderTitle","useCallback","jsxs","clsx","Stack","Popover","IconButton","draggableRef","useDraggable","popup","defaultPositionerProps","PopupPanelSize","onDragEnd","onDragStart","props","Resizable","anchorToResizeHandles","eventDetails","mergeProps"],"mappings":";;;;;;;;;;;;;;;;;;AA4IO,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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sx"],"sourcesContent":["\"use client\";\nimport { Popover } from \"@base-ui/react/popover\";\nimport { clsx, parseAntdPlacement, useCls } from \"../utils\";\n\nimport { mergeProps } from \"@base-ui/react\";\nimport { X } from \"@bioturing/assets\";\nimport { useCallback, useMemo, useState } from \"react\";\nimport { useControlledState, useDraggable, useBaseUIPlacement } from \"../hooks\";\nimport { IconButton } from \"../icon-button\";\nimport { Resizable } from \"../resizable\";\nimport { Stack } from \"../stack\";\nimport { PopupPanelSize } from \"./constants\";\n\n// Import component-specific styles\nimport { useTheme } from \"../theme-provider\";\nimport \"./style.css\";\nimport { anchorToResizeHandles } from \"./utils\";\n\nexport type PopupPanelPlacement =\n | \"top\"\n | \"left\"\n | \"right\"\n | \"bottom\"\n | \"topLeft\"\n | \"topRight\"\n | \"bottomLeft\"\n | \"bottomRight\"\n | \"leftTop\"\n | \"leftBottom\"\n | \"rightTop\"\n | \"rightBottom\";\n\nexport interface PopupPanelProps\n extends Omit<\n React.ComponentPropsWithRef<\"div\">,\n \"title\" | \"content\" | \"children\"\n >,\n Omit<Popover.Root.Props, \"children\"> {\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?: PopupPanelPlacement;\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 * Whether the panel should be draggable\n * @default false\n */\n draggable?: boolean;\n /**\n * Whether to maintain aspect ratio when resizing\n * Only applies when resizable is true\n * @default false\n */\n maintainAspectRatio?: 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 * Callback function when the placement changes\n */\n onPlacementChange?: (placement: PopupPanelPlacement) => void;\n /**\n * Props to pass to the positioner\n */\n positionerProps?: Popover.Positioner.Props;\n /**\n * Props to pass to the trigger\n */\n triggerProps?: Popover.Trigger.Props;\n /**\n * Props to pass to the portal\n */\n portalProps?: Popover.Portal.Props;\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 = false,\n resizable = false,\n draggable = false,\n maintainAspectRatio = false,\n classNames,\n modal = false,\n closeOnClickOutside = true,\n onPlacementChange,\n positionerProps = {},\n triggerProps = {},\n portalProps = {},\n ...rest\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 // Always provide a default value to prevent undefined\n );\n\n const cls = useCls();\n const { className: themeClassName } = useTheme();\n const baseUIPlacement = parseAntdPlacement(placement);\n\n const defaultCloseIcon = useMemo(() => <X size={16} />, []);\n\n const [positionerRef, setPositionerRef] = useState<HTMLDivElement | null>(\n null\n );\n\n // Track Base UI placement changes\n const { currentSide, currentAlign, placementChangeKey } = useBaseUIPlacement({\n positionerRef,\n open,\n initialSide: baseUIPlacement.side,\n initialAlign: baseUIPlacement.align,\n onPlacementChange,\n });\n\n const renderTitle = useCallback(() => {\n return (\n <div className={clsx(cls(\"popup-panel-header\"), classNames?.header)}>\n <Stack\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 </Stack>\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\n const { ref: draggableRef } = useDraggable(draggable);\n\n const popup = useMemo(\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={draggableRef}\n >\n {title && renderTitle()}\n <div className={clsx(cls(\"popup-panel-content\"), classNames?.content)}>\n <div className={cls(\"popup-panel-content-inner\")}>{content}</div>\n </div>\n {footer && (\n <div className={clsx(cls(\"popup-panel-footer\"), classNames?.footer)}>\n {typeof footer === \"function\"\n ? footer({ close: () => setOpen(false) })\n : footer}\n </div>\n )}\n </Popover.Popup>\n ),\n [\n className,\n classNames?.content,\n classNames?.footer,\n classNames?.popup,\n cls,\n content,\n draggableRef,\n footer,\n renderTitle,\n setOpen,\n size,\n title,\n ]\n );\n\n const defaultPositionerProps = {\n ref: setPositionerRef,\n className: clsx(cls(\"popup-panel-root\"), themeClassName, classNames?.root),\n side: baseUIPlacement.side,\n align: baseUIPlacement.align,\n sideOffset: 4,\n anchor,\n style: {\n \"--size-width\": size ? PopupPanelSize[size] : undefined,\n } as React.CSSProperties,\n render: ({ children, onDragEnd, onDragStart, ...props }) => {\n return resizable ? (\n <Resizable\n resizable={resizable}\n resetKey={placementChangeKey}\n maintainAspectRatio={maintainAspectRatio}\n classNames={{\n resizeHandle: classNames?.resizeHandle,\n }}\n handles={anchorToResizeHandles(currentSide, currentAlign)}\n {...props}\n >\n {children}\n </Resizable>\n ) : (\n <div {...props}>{children}</div>\n );\n },\n };\n\n return (\n <Popover.Root\n open={open}\n onOpenChange={(open, eventDetails) => {\n if (\n (eventDetails.reason === \"outside-press\" ||\n eventDetails.reason === \"focus-out\") &&\n !closeOnClickOutside\n )\n return;\n setOpen(open, eventDetails);\n }}\n modal={modal}\n {...rest}\n >\n <Popover.Trigger\n {...mergeProps(\n {\n render: children,\n className: clsx(cls(\"popup-panel-trigger\"), classNames?.trigger),\n openOnHover: trigger === \"hover\" ? true : openOnHover,\n },\n triggerProps\n )}\n ></Popover.Trigger>\n <Popover.Portal {...portalProps}>\n <Popover.Positioner\n {...mergeProps(defaultPositionerProps, positionerProps)}\n >\n {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","draggable","maintainAspectRatio","classNames","modal","closeOnClickOutside","onPlacementChange","positionerProps","triggerProps","portalProps","rest","open","setOpen","useControlledState","cls","useCls","themeClassName","useTheme","baseUIPlacement","parseAntdPlacement","defaultCloseIcon","useMemo","jsx","X","positionerRef","setPositionerRef","useState","currentSide","currentAlign","placementChangeKey","useBaseUIPlacement","renderTitle","useCallback","jsxs","clsx","Stack","Popover","IconButton","draggableRef","useDraggable","popup","defaultPositionerProps","PopupPanelSize","onDragEnd","onDragStart","props","Resizable","anchorToResizeHandles","eventDetails","mergeProps"],"mappings":";;;;;;;;;;;;;;;;;;;AAiJO,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,IAAc;AAAA,EACd,WAAAC,IAAY;AAAA,EACZ,WAAAC,IAAY;AAAA,EACZ,qBAAAC,IAAsB;AAAA,EACtB,YAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,qBAAAC,IAAsB;AAAA,EACtB,mBAAAC;AAAA,EACA,iBAAAC,IAAkB,CAAA;AAAA,EAClB,cAAAC,IAAe,CAAA;AAAA,EACf,aAAAC,IAAc,CAAA;AAAA,EACd,GAAGC;AACL,MAAuB;AAErB,QAAM,CAACC,GAAMC,CAAO,IAAIC;AAAA,IACtB1B;AAAA,IACAC;AAAA,IACAW;AAAA;AAAA,EAAA,GAGIe,IAAMC,GAAA,GACN,EAAE,WAAWC,EAAA,IAAmBC,GAAA,GAChCC,IAAkBC,GAAmBlC,CAAS,GAE9CmC,IAAmBC,EAAQ,MAAM,gBAAAC,EAACC,KAAE,MAAM,IAAI,GAAI,EAAE,GAEpD,CAACC,GAAeC,CAAgB,IAAIC;AAAA,IACxC;AAAA,EAAA,GAII,EAAE,aAAAC,GAAa,cAAAC,GA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,SAAS4C,GAAsBpB,GAAaC,CAAY;AAAA,QACvD,GAAGiB;AAAA,QAEH,UAAA7D;AAAAA,MAAA;AAAA,IAAA,IAGH,gBAAAsC,EAAC,OAAA,EAAK,GAAGuB,GAAQ,UAAA7D,GAAS;AAAA,EAE9B;AAGF,SACE,gBAAAiD;AAAA,IAACG,EAAQ;AAAA,IAAR;AAAA,MACC,MAAAzB;AAAA,MACA,cAAc,CAACA,GAAMqC,MAAiB;AACpC,SACGA,EAAa,WAAW,mBACvBA,EAAa,WAAW,gBAC1B,CAAC3C,KAGHO,EAAQD,GAAMqC,CAAY;AAAA,MAC5B;AAAA,MACA,OAAA5C;AAAA,MACC,GAAGM;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAAY;AAAA,UAACc,EAAQ;AAAA,UAAR;AAAA,YACE,GAAGa;AAAA,cACF;AAAA,gBACE,QAAQjE;AAAA,gBACR,WAAWkD,EAAKpB,EAAI,qBAAqB,GAAGX,GAAY,OAAO;AAAA,gBAC/D,aAAaZ,MAAY,UAAU,KAAOL;AAAA,cAAA;AAAA,cAE5CsB;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,QAEF,gBAAAc,EAACc,EAAQ,QAAR,EAAgB,GAAG3B,GAClB,UAAA,gBAAAa;AAAA,UAACc,EAAQ;AAAA,UAAR;AAAA,YACE,GAAGa,EAAWR,GAAwBlC,CAAe;AAAA,YAErD,UAAAiC;AAAA,UAAA;AAAA,QAAA,EACH,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -3,7 +3,7 @@ import { jsx as i } from "react/jsx-runtime";
3
3
  import Y, { forwardRef as Z, useState as b, useCallback as $, useEffect as C, isValidElement as K } from "react";
4
4
  import { useResizable as A } from "../hooks/useResizable.js";
5
5
  import ee from "merge-refs";
6
- import { mergeProps as te } from "@base-ui-components/react";
6
+ import { mergeProps as te } from "@base-ui/react";
7
7
  import './style.css';/* empty css */
8
8
  import { getReactElementProp as v } from "../utils/reactElement.js";
9
9
  import { useCls as re } from "../utils/antdUtils.js";
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sources":["../../../src/components/resizable/component.tsx"],"sourcesContent":["\"use client\";\nimport React, {\n useCallback,\n useEffect,\n useState,\n isValidElement,\n forwardRef,\n} from \"react\";\nimport {\n useResizable,\n type MoveValues,\n ResizableProps as UseResizableProps,\n} from \"../hooks/useResizable\";\nimport mergeRefs from \"merge-refs\";\nimport {\n useCls,\n clsx,\n WithRenderProp,\n WithRenderPropProps,\n cn,\n getReactElementProp,\n} from \"../utils\";\nimport { mergeProps } from \"@base-ui-components/react\";\n\nimport \"./style.css\";\n// import { on } from \"node:stream\";\n\nexport interface ResizableProps\n extends Omit<WithRenderPropProps, keyof UseResizableProps>,\n UseResizableProps {\n /**\n * Single React element child that will be enhanced with resize handles\n */\n children: React.ReactNode;\n /**\n * Whether the component should be resizable\n * @default false\n */\n resizable?: boolean;\n /**\n * Configure which resize handles to show\n * @default { bottom: true, right: true, left: true, top: true }\n */\n handles?: {\n bottom?: boolean;\n right?: boolean;\n left?: boolean;\n top?: boolean;\n };\n // /**\n // * Whether to use absolute positioning for left handle resizing\n // * Set to true when used in absolutely positioned containers like PopupPanel\n // * @default false\n // */\n // absolutePositioning?: boolean;\n /**\n * Custom class names for different parts of the resizable component\n */\n classNames?: {\n root?: string;\n resizeHandle?: string;\n };\n /**\n * Key to reset dimensions to current element size\n * When this value changes, the component will recalculate its dimensions\n * Similar to React's key prop pattern for forcing component resets\n */\n resetKey?: React.Key;\n /**\n * Maximum width the component can be resized to\n */\n maxWidth?: number;\n /**\n * Maximum height the component can be resized to\n */\n maxHeight?: number;\n /**\n * Minimum width the component can be resized to\n */\n minWidth?: number;\n /**\n * Minimum height the component can be resized to\n */\n minHeight?: number;\n /**\n * Callback fired during resize operations\n */\n onResize?: (values: MoveValues) => void;\n /**\n * Whether to maintain aspect ratio during resize\n * @default false\n */\n maintainAspectRatio?: boolean;\n}\n\nexport const Resizable = forwardRef<HTMLDivElement, ResizableProps>(\n (\n {\n children,\n resizable = false,\n handles = { bottom: true, right: true, left: true, top: true },\n classNames,\n className: containerClassName,\n style: containerStyle,\n resetKey,\n\n // Use Resizable Props\n maxHeight,\n maxWidth,\n minHeight,\n minWidth,\n lockHorizontal,\n lockVertical,\n onResize,\n onDragEnd: onDragEndProp,\n onDragStart: onDragStartProp,\n disabled,\n maintainAspectRatio = false,\n interval,\n initialHeight: initialHeightProp,\n initialWidth: initialWidthProp,\n // other With Render Props\n ...rest\n },\n ref\n ) => {\n // Validate that children is a single React element\n // if (!isValidElement(children)) {\n // throw new Error(\n // \"Resizable component expects a single React element as children\"\n // );\n // }\n\n const cls = useCls();\n const [panelRef, setPanelRef] = useState<HTMLDivElement | null>(null);\n const [width, setWidth] = useState<number>();\n const [height, setHeight] = useState<number>();\n const [resizing, setResizing] = useState(false);\n\n const callbackRef = useCallback(\n (node: HTMLDivElement) => {\n setPanelRef(node);\n\n // Get initial dimensions only once when ref is set\n // For aspect ratio maintenance, we need initial dimensions immediately\n // Otherwise, preserve natural width/height behavior\n if (node && !width && !height) {\n const rect = node.getBoundingClientRect();\n if (rect.width > 0 && rect.height > 0) {\n if (maintainAspectRatio) {\n // Need dimensions for aspect ratio calculation\n setWidth(rect.width);\n setHeight(rect.height);\n }\n // For non-aspect-ratio cases, don't set dimensions to preserve natural behavior\n }\n }\n },\n [width, height, maintainAspectRatio]\n );\n\n // Reset dimensions when resetKey changes\n useEffect(() => {\n if (resetKey !== undefined && panelRef) {\n // Clear the hook's inline styles to reset to natural size\n panelRef.style.width = \"\";\n panelRef.style.height = \"\";\n\n // Force a reflow to get natural dimensions\n const rect = panelRef.getBoundingClientRect();\n\n if (rect.width > 0 && rect.height > 0) {\n if (maintainAspectRatio) {\n // For aspect ratio maintenance, re-measure and set dimensions\n setWidth(rect.width);\n setHeight(rect.height);\n } else {\n // Reset state to allow natural dimensions again\n setWidth(undefined);\n setHeight(undefined);\n }\n\n // Don't apply any explicit dimensions - let them remain natural\n // panelRef.style.width = `${rect.width}px`;\n // panelRef.style.height = `${rect.height}px`;\n }\n }\n }, [resetKey, panelRef, maintainAspectRatio]);\n\n // Initialize useResizable with current dimensions (or undefined if not ready)\n // For aspect ratio maintenance, we need initial dimensions\n // Otherwise, preserve natural width/height behavior until user starts resizing\n const resizableHook = useResizable({\n initialWidth: maintainAspectRatio ? width : initialWidthProp,\n initialHeight: maintainAspectRatio ? height : initialHeightProp,\n maxHeight,\n maxWidth,\n minHeight,\n minWidth,\n lockHorizontal,\n lockVertical,\n onResize,\n disabled,\n maintainAspectRatio,\n interval,\n onDragStart: (values) => {\n setResizing(true);\n // Capture natural dimensions when user starts resizing\n if (panelRef) {\n const rect = panelRef.getBoundingClientRect();\n if (rect.width > 0 && !width) {\n setWidth(rect.width);\n }\n if (rect.height > 0 && !height) {\n setHeight(rect.height);\n }\n }\n if (onDragStartProp) onDragStartProp(values);\n },\n onDragEnd: (values) => {\n setResizing(false);\n if (onDragEndProp) onDragEndProp(values);\n },\n });\n\n const isChildrenValidElement = isValidElement(children);\n\n useEffect(() => {\n if (resizing) {\n document.body.style.userSelect = \"none\";\n } else {\n document.body.style.userSelect = \"\";\n }\n }, [resizing]);\n\n // Get resizable props - useResizable hook handles cases where dimensions aren't ready\n const { ref: rootRefProp, ...rootPropsWithoutRef } =\n resizableHook.getRootProps();\n const getHandleProps = resizableHook.getHandleProps;\n\n // // Handle reverse handle change for horizontal resizing (only for absolute positioning)\n // const onReverseHandleChangeHorizontal = (\n // parent: React.RefObject<HTMLDivElement>,\n // values: MoveValues\n // ) => {\n // if (!parent.current || !absolutePositioning) return;\n // const { widthDiff } = values;\n // parent.current.style.left = `${\n // parseInt(parent.current.style.left || \"0\") - widthDiff\n // }px`;\n // };\n\n // // Handle reverse handle change for vertical resizing (only for absolute positioning)\n // const onReverseHandleChangeVertical = (\n // parent: React.RefObject<HTMLDivElement>,\n // values: MoveValues\n // ) => {\n // if (!parent.current || !absolutePositioning) return;\n // const { heightDiff } = values;\n // console.log({\n // parentStyleTop: parent.current.style.top,\n // computedStyleTop: window.getComputedStyle(parent.current).top,\n // });\n // parent.current.style.top = `${\n // parseInt(parent.current.style.top || \"0\") - heightDiff\n // }px`;\n // };\n\n const resizeHandles = resizable\n ? [\n handles.top && !maintainAspectRatio && (\n <div\n key=\"top\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-center\"\n {...getHandleProps({\n reverse: true,\n lockHorizontal: true,\n // onResize: (values) =>\n // onReverseHandleChangeVertical(rootRef, values),\n })}\n />\n ),\n handles.bottom && !maintainAspectRatio && (\n <div\n key=\"bottom\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"bottom-left\"\n {...getHandleProps({\n lockHorizontal: true,\n })}\n />\n ),\n handles.left && !maintainAspectRatio && (\n <div\n key=\"left\"\n className={clsx(\n cls(\"resizable-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 ),\n handles.right && !maintainAspectRatio && (\n <div\n key=\"right\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-right\"\n {...getHandleProps({\n lockVertical: true,\n })}\n />\n ),\n handles.right && handles.bottom && (\n <div\n key=\"bottom-right-corner\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"bottom-right-corner\"\n {...getHandleProps({\n // No locks - allow both horizontal and vertical resizing\n corner: \"bottom-right\",\n })}\n />\n ),\n handles.left && handles.top && (\n <div\n key=\"top-left-corner\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-left-corner\"\n {...getHandleProps({\n corner: \"top-left\",\n // onResize: (values) => {\n // onReverseHandleChangeHorizontal(rootRef, values);\n // onReverseHandleChangeVertical(rootRef, values);\n // },\n })}\n />\n ),\n handles.right && handles.top && (\n <div\n key=\"top-right-corner\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-right-corner\"\n {...getHandleProps({\n corner: \"top-right\",\n // onResize: (values) => {\n // onReverseHandleChangeVertical(rootRef, values);\n // },\n })}\n />\n ),\n handles.left && handles.bottom && (\n <div\n key=\"bottom-left-corner\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"bottom-left-corner\"\n {...getHandleProps({\n corner: \"bottom-left\",\n // onResize: (values) => {\n // onReverseHandleChangeHorizontal(rootRef, values);\n // onReverseHandleChangeVertical(rootRef, values);\n // },\n })}\n />\n ),\n ]\n : [];\n\n const childElement = children as React.ReactElement & {\n ref?: React.Ref<HTMLDivElement>;\n };\n\n const childElementProps = {\n className: getReactElementProp<string>(childElement, \"className\"),\n style: getReactElementProp<React.CSSProperties>(childElement, \"style\"),\n children: getReactElementProp<React.ReactNode>(childElement, \"children\"),\n ref: childElement.ref,\n };\n\n const childProps = {\n className: cn(\n resizable && cls(\"resizable\"),\n classNames?.root,\n childElementProps.className,\n containerClassName\n ),\n ref: mergeRefs(\n resizable ? rootRefProp : undefined,\n callbackRef, // Always need this for dimension measurement\n childElement?.ref,\n ref\n ),\n style: { ...childElementProps.style, ...containerStyle },\n ...(resizing ? { \"data-resizing\": true } : {}),\n ...(resizable ? { \"data-resizable\": true } : {}),\n children: isChildrenValidElement\n ? [\n ...(Array.isArray(childElementProps.children)\n ? childElementProps.children\n : [childElementProps.children]),\n ...resizeHandles.filter(Boolean),\n ]\n : children,\n };\n\n return (\n <WithRenderProp\n render={(props) => {\n // Merge the props from WithRenderProp with our childProps\n const mergedProps = mergeProps(\n props,\n childProps,\n resizable ? rootPropsWithoutRef : {}\n );\n if (isChildrenValidElement) {\n return React.cloneElement(childElement, mergedProps);\n } else {\n return <div {...mergedProps}>{children}</div>;\n }\n }}\n {...rest}\n />\n );\n }\n);\n"],"names":["Resizable","forwardRef","children","resizable","handles","classNames","containerClassName","containerStyle","resetKey","maxHeight","maxWidth","minHeight","minWidth","lockHorizontal","lockVertical","onResize","onDragEndProp","onDragStartProp","disabled","maintainAspectRatio","interval","initialHeightProp","initialWidthProp","rest","ref","cls","useCls","panelRef","setPanelRef","useState","width","setWidth","height","setHeight","resizing","setResizing","callbackRef","useCallback","node","rect","useEffect","resizableHook","useResizable","values","isChildrenValidElement","isValidElement","rootRefProp","rootPropsWithoutRef","getHandleProps","resizeHandles","jsx","clsx","childElement","childElementProps","getReactElementProp","childProps","cn","mergeRefs","WithRenderProp","props","mergedProps","mergeProps","React"],"mappings":";;;;;;;;;;;AA+FO,MAAMA,KAAYC;AAAA,EACvB,CACE;AAAA,IACE,UAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,SAAAC,IAAU,EAAE,QAAQ,IAAM,OAAO,IAAM,MAAM,IAAM,KAAK,GAAA;AAAA,IACxD,YAAAC;AAAA,IACA,WAAWC;AAAA,IACX,OAAOC;AAAA,IACP,UAAAC;AAAA;AAAA,IAGA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAWC;AAAA,IACX,aAAaC;AAAA,IACb,UAAAC;AAAA,IACA,qBAAAC,IAAsB;AAAA,IACtB,UAAAC;AAAA,IACA,eAAeC;AAAA,IACf,cAAcC;AAAA;AAAA,IAEd,GAAGC;AAAA,EAAA,GAELC,MACG;AAQH,UAAMC,IAAMC,GAAA,GACN,CAACC,GAAUC,CAAW,IAAIC,EAAgC,IAAI,GAC9D,CAACC,GAAOC,CAAQ,IAAIF,EAAA,GACpB,CAACG,GAAQC,CAAS,IAAIJ,EAAA,GACtB,CAACK,GAAUC,CAAW,IAAIN,EAAS,EAAK,GAExCO,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,iBAAIH,IACKkB,EAAM,aAAaV,GAAcQ,CAAW,IAE5C,gBAAAV,EAAC,OAAA,EAAK,GAAGU,GAAc,UAAA1D,EAAA,CAAS;AAAA,QAE3C;AAAA,QACC,GAAGqB;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;"}
1
+ {"version":3,"file":"component.js","sources":["../../../src/components/resizable/component.tsx"],"sourcesContent":["\"use client\";\nimport React, {\n useCallback,\n useEffect,\n useState,\n isValidElement,\n forwardRef,\n} from \"react\";\nimport {\n useResizable,\n type MoveValues,\n ResizableProps as UseResizableProps,\n} from \"../hooks/useResizable\";\nimport mergeRefs from \"merge-refs\";\nimport {\n useCls,\n clsx,\n WithRenderProp,\n WithRenderPropProps,\n cn,\n getReactElementProp,\n} from \"../utils\";\nimport { mergeProps } from \"@base-ui/react\";\n\nimport \"./style.css\";\n// import { on } from \"node:stream\";\n\nexport interface ResizableProps\n extends Omit<WithRenderPropProps, keyof UseResizableProps>,\n UseResizableProps {\n /**\n * Single React element child that will be enhanced with resize handles\n */\n children: React.ReactNode;\n /**\n * Whether the component should be resizable\n * @default false\n */\n resizable?: boolean;\n /**\n * Configure which resize handles to show\n * @default { bottom: true, right: true, left: true, top: true }\n */\n handles?: {\n bottom?: boolean;\n right?: boolean;\n left?: boolean;\n top?: boolean;\n };\n // /**\n // * Whether to use absolute positioning for left handle resizing\n // * Set to true when used in absolutely positioned containers like PopupPanel\n // * @default false\n // */\n // absolutePositioning?: boolean;\n /**\n * Custom class names for different parts of the resizable component\n */\n classNames?: {\n root?: string;\n resizeHandle?: string;\n };\n /**\n * Key to reset dimensions to current element size\n * When this value changes, the component will recalculate its dimensions\n * Similar to React's key prop pattern for forcing component resets\n */\n resetKey?: React.Key;\n /**\n * Maximum width the component can be resized to\n */\n maxWidth?: number;\n /**\n * Maximum height the component can be resized to\n */\n maxHeight?: number;\n /**\n * Minimum width the component can be resized to\n */\n minWidth?: number;\n /**\n * Minimum height the component can be resized to\n */\n minHeight?: number;\n /**\n * Callback fired during resize operations\n */\n onResize?: (values: MoveValues) => void;\n /**\n * Whether to maintain aspect ratio during resize\n * @default false\n */\n maintainAspectRatio?: boolean;\n}\n\nexport const Resizable = forwardRef<HTMLDivElement, ResizableProps>(\n (\n {\n children,\n resizable = false,\n handles = { bottom: true, right: true, left: true, top: true },\n classNames,\n className: containerClassName,\n style: containerStyle,\n resetKey,\n\n // Use Resizable Props\n maxHeight,\n maxWidth,\n minHeight,\n minWidth,\n lockHorizontal,\n lockVertical,\n onResize,\n onDragEnd: onDragEndProp,\n onDragStart: onDragStartProp,\n disabled,\n maintainAspectRatio = false,\n interval,\n initialHeight: initialHeightProp,\n initialWidth: initialWidthProp,\n // other With Render Props\n ...rest\n },\n ref\n ) => {\n // Validate that children is a single React element\n // if (!isValidElement(children)) {\n // throw new Error(\n // \"Resizable component expects a single React element as children\"\n // );\n // }\n\n const cls = useCls();\n const [panelRef, setPanelRef] = useState<HTMLDivElement | null>(null);\n const [width, setWidth] = useState<number>();\n const [height, setHeight] = useState<number>();\n const [resizing, setResizing] = useState(false);\n\n const callbackRef = useCallback(\n (node: HTMLDivElement) => {\n setPanelRef(node);\n\n // Get initial dimensions only once when ref is set\n // For aspect ratio maintenance, we need initial dimensions immediately\n // Otherwise, preserve natural width/height behavior\n if (node && !width && !height) {\n const rect = node.getBoundingClientRect();\n if (rect.width > 0 && rect.height > 0) {\n if (maintainAspectRatio) {\n // Need dimensions for aspect ratio calculation\n setWidth(rect.width);\n setHeight(rect.height);\n }\n // For non-aspect-ratio cases, don't set dimensions to preserve natural behavior\n }\n }\n },\n [width, height, maintainAspectRatio]\n );\n\n // Reset dimensions when resetKey changes\n useEffect(() => {\n if (resetKey !== undefined && panelRef) {\n // Clear the hook's inline styles to reset to natural size\n panelRef.style.width = \"\";\n panelRef.style.height = \"\";\n\n // Force a reflow to get natural dimensions\n const rect = panelRef.getBoundingClientRect();\n\n if (rect.width > 0 && rect.height > 0) {\n if (maintainAspectRatio) {\n // For aspect ratio maintenance, re-measure and set dimensions\n setWidth(rect.width);\n setHeight(rect.height);\n } else {\n // Reset state to allow natural dimensions again\n setWidth(undefined);\n setHeight(undefined);\n }\n\n // Don't apply any explicit dimensions - let them remain natural\n // panelRef.style.width = `${rect.width}px`;\n // panelRef.style.height = `${rect.height}px`;\n }\n }\n }, [resetKey, panelRef, maintainAspectRatio]);\n\n // Initialize useResizable with current dimensions (or undefined if not ready)\n // For aspect ratio maintenance, we need initial dimensions\n // Otherwise, preserve natural width/height behavior until user starts resizing\n const resizableHook = useResizable({\n initialWidth: maintainAspectRatio ? width : initialWidthProp,\n initialHeight: maintainAspectRatio ? height : initialHeightProp,\n maxHeight,\n maxWidth,\n minHeight,\n minWidth,\n lockHorizontal,\n lockVertical,\n onResize,\n disabled,\n maintainAspectRatio,\n interval,\n onDragStart: (values) => {\n setResizing(true);\n // Capture natural dimensions when user starts resizing\n if (panelRef) {\n const rect = panelRef.getBoundingClientRect();\n if (rect.width > 0 && !width) {\n setWidth(rect.width);\n }\n if (rect.height > 0 && !height) {\n setHeight(rect.height);\n }\n }\n if (onDragStartProp) onDragStartProp(values);\n },\n onDragEnd: (values) => {\n setResizing(false);\n if (onDragEndProp) onDragEndProp(values);\n },\n });\n\n const isChildrenValidElement = isValidElement(children);\n\n useEffect(() => {\n if (resizing) {\n document.body.style.userSelect = \"none\";\n } else {\n document.body.style.userSelect = \"\";\n }\n }, [resizing]);\n\n // Get resizable props - useResizable hook handles cases where dimensions aren't ready\n const { ref: rootRefProp, ...rootPropsWithoutRef } =\n resizableHook.getRootProps();\n const getHandleProps = resizableHook.getHandleProps;\n\n // // Handle reverse handle change for horizontal resizing (only for absolute positioning)\n // const onReverseHandleChangeHorizontal = (\n // parent: React.RefObject<HTMLDivElement>,\n // values: MoveValues\n // ) => {\n // if (!parent.current || !absolutePositioning) return;\n // const { widthDiff } = values;\n // parent.current.style.left = `${\n // parseInt(parent.current.style.left || \"0\") - widthDiff\n // }px`;\n // };\n\n // // Handle reverse handle change for vertical resizing (only for absolute positioning)\n // const onReverseHandleChangeVertical = (\n // parent: React.RefObject<HTMLDivElement>,\n // values: MoveValues\n // ) => {\n // if (!parent.current || !absolutePositioning) return;\n // const { heightDiff } = values;\n // console.log({\n // parentStyleTop: parent.current.style.top,\n // computedStyleTop: window.getComputedStyle(parent.current).top,\n // });\n // parent.current.style.top = `${\n // parseInt(parent.current.style.top || \"0\") - heightDiff\n // }px`;\n // };\n\n const resizeHandles = resizable\n ? [\n handles.top && !maintainAspectRatio && (\n <div\n key=\"top\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-center\"\n {...getHandleProps({\n reverse: true,\n lockHorizontal: true,\n // onResize: (values) =>\n // onReverseHandleChangeVertical(rootRef, values),\n })}\n />\n ),\n handles.bottom && !maintainAspectRatio && (\n <div\n key=\"bottom\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"bottom-left\"\n {...getHandleProps({\n lockHorizontal: true,\n })}\n />\n ),\n handles.left && !maintainAspectRatio && (\n <div\n key=\"left\"\n className={clsx(\n cls(\"resizable-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 ),\n handles.right && !maintainAspectRatio && (\n <div\n key=\"right\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-right\"\n {...getHandleProps({\n lockVertical: true,\n })}\n />\n ),\n handles.right && handles.bottom && (\n <div\n key=\"bottom-right-corner\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"bottom-right-corner\"\n {...getHandleProps({\n // No locks - allow both horizontal and vertical resizing\n corner: \"bottom-right\",\n })}\n />\n ),\n handles.left && handles.top && (\n <div\n key=\"top-left-corner\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-left-corner\"\n {...getHandleProps({\n corner: \"top-left\",\n // onResize: (values) => {\n // onReverseHandleChangeHorizontal(rootRef, values);\n // onReverseHandleChangeVertical(rootRef, values);\n // },\n })}\n />\n ),\n handles.right && handles.top && (\n <div\n key=\"top-right-corner\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-right-corner\"\n {...getHandleProps({\n corner: \"top-right\",\n // onResize: (values) => {\n // onReverseHandleChangeVertical(rootRef, values);\n // },\n })}\n />\n ),\n handles.left && handles.bottom && (\n <div\n key=\"bottom-left-corner\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"bottom-left-corner\"\n {...getHandleProps({\n corner: \"bottom-left\",\n // onResize: (values) => {\n // onReverseHandleChangeHorizontal(rootRef, values);\n // onReverseHandleChangeVertical(rootRef, values);\n // },\n })}\n />\n ),\n ]\n : [];\n\n const childElement = children as React.ReactElement & {\n ref?: React.Ref<HTMLDivElement>;\n };\n\n const childElementProps = {\n className: getReactElementProp<string>(childElement, \"className\"),\n style: getReactElementProp<React.CSSProperties>(childElement, \"style\"),\n children: getReactElementProp<React.ReactNode>(childElement, \"children\"),\n ref: childElement.ref,\n };\n\n const childProps = {\n className: cn(\n resizable && cls(\"resizable\"),\n classNames?.root,\n childElementProps.className,\n containerClassName\n ),\n ref: mergeRefs(\n resizable ? rootRefProp : undefined,\n callbackRef, // Always need this for dimension measurement\n childElement?.ref,\n ref\n ),\n style: { ...childElementProps.style, ...containerStyle },\n ...(resizing ? { \"data-resizing\": true } : {}),\n ...(resizable ? { \"data-resizable\": true } : {}),\n children: isChildrenValidElement\n ? [\n ...(Array.isArray(childElementProps.children)\n ? childElementProps.children\n : [childElementProps.children]),\n ...resizeHandles.filter(Boolean),\n ]\n : children,\n };\n\n return (\n <WithRenderProp\n render={(props) => {\n // Merge the props from WithRenderProp with our childProps\n const mergedProps = mergeProps(\n props,\n childProps,\n resizable ? rootPropsWithoutRef : {}\n );\n if (isChildrenValidElement) {\n return React.cloneElement(childElement, mergedProps);\n } else {\n return <div {...mergedProps}>{children}</div>;\n }\n }}\n {...rest}\n />\n );\n }\n);\n"],"names":["Resizable","forwardRef","children","resizable","handles","classNames","containerClassName","containerStyle","resetKey","maxHeight","maxWidth","minHeight","minWidth","lockHorizontal","lockVertical","onResize","onDragEndProp","onDragStartProp","disabled","maintainAspectRatio","interval","initialHeightProp","initialWidthProp","rest","ref","cls","useCls","panelRef","setPanelRef","useState","width","setWidth","height","setHeight","resizing","setResizing","callbackRef","useCallback","node","rect","useEffect","resizableHook","useResizable","values","isChildrenValidElement","isValidElement","rootRefProp","rootPropsWithoutRef","getHandleProps","resizeHandles","jsx","clsx","childElement","childElementProps","getReactElementProp","childProps","cn","mergeRefs","WithRenderProp","props","mergedProps","mergeProps","React"],"mappings":";;;;;;;;;;;AA+FO,MAAMA,KAAYC;AAAA,EACvB,CACE;AAAA,IACE,UAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,SAAAC,IAAU,EAAE,QAAQ,IAAM,OAAO,IAAM,MAAM,IAAM,KAAK,GAAA;AAAA,IACxD,YAAAC;AAAA,IACA,WAAWC;AAAA,IACX,OAAOC;AAAA,IACP,UAAAC;AAAA;AAAA,IAGA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAWC;AAAA,IACX,aAAaC;AAAA,IACb,UAAAC;AAAA,IACA,qBAAAC,IAAsB;AAAA,IACtB,UAAAC;AAAA,IACA,eAAeC;AAAA,IACf,cAAcC;AAAA;AAAA,IAEd,GAAGC;AAAA,EAAA,GAELC,MACG;AAQH,UAAMC,IAAMC,GAAA,GACN,CAACC,GAAUC,CAAW,IAAIC,EAAgC,IAAI,GAC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AA,QACC,QAAQ,CAACC,MAAU;AAEjB,gBAAMC,IAAcC;AAAA,YAClBF;AAAA,YACAJ;AAAA,YACApD,IAAY4C,IAAsB,CAAA;AAAA,UAAC;AAErC,iBAAIH,IACKkB,EAAM,aAAaV,GAAcQ,CAAW,IAE5C,gBAAAV,EAAC,OAAA,EAAK,GAAGU,GAAc,UAAA1D,EAAA,CAAS;AAAA,QAE3C;AAAA,QACC,GAAGqB;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;"}
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { ScrollArea as BaseScrollArea } from '@base-ui-components/react';
2
+ import { ScrollArea as BaseScrollArea } from '@base-ui/react';
3
3
  export interface ScrollAreaProps extends Omit<BaseScrollArea.Root.Props, "onScroll"> {
4
4
  children: ReactNode;
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/scroll-area/component.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAIzE,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC;IACnD,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE;QACX;;WAEG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF;;OAEG;IACH,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAC/B;;WAEG;QACH,OAAO,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAC9B;;WAEG;QACH,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAChC;;WAEG;QACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;KAC7B,CAAC;IACF;;;OAGG;IACH,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC;IACjD;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACnC;AAED,eAAO,MAAM,UAAU,GAAI,wFASxB,eAAe,4CAmJjB,CAAC"}
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/scroll-area/component.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAI9D,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC;IACnD,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE;QACX;;WAEG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF;;OAEG;IACH,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAC/B;;WAEG;QACH,OAAO,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAC9B;;WAEG;QACH,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAChC;;WAEG;QACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;KAC7B,CAAC;IACF;;;OAGG;IACH,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC;IACjD;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACnC;AAED,eAAO,MAAM,UAAU,GAAI,wFASxB,eAAe,4CAmJjB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsxs as x, jsx as i } from "react/jsx-runtime";
3
3
  import { useRef as R, useState as E, useEffect as L } from "react";
4
- import { ScrollArea as e } from "@base-ui-components/react";
4
+ import { ScrollArea as e } from "@base-ui/react";
5
5
  import './style.css';/* empty css */
6
6
  import { useCls as j } from "../utils/antdUtils.js";
7
7
  import { clsx as c } from "../utils/cn.js";