@bioturing/components 0.44.1 → 0.46.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 (63) hide show
  1. package/dist/base.d.ts +2 -0
  2. package/dist/base.d.ts.map +1 -1
  3. package/dist/base.js +2 -0
  4. package/dist/base.js.map +1 -1
  5. package/dist/components/base-menu/index.d.ts.map +1 -1
  6. package/dist/components/base-menu/item.d.ts.map +1 -1
  7. package/dist/components/base-menu/item.js +6 -13
  8. package/dist/components/base-menu/item.js.map +1 -1
  9. package/dist/components/button/style.css +1 -1
  10. package/dist/components/choice-list/component.d.ts +11 -1
  11. package/dist/components/choice-list/component.d.ts.map +1 -1
  12. package/dist/components/choice-list/component.js +79 -82
  13. package/dist/components/choice-list/component.js.map +1 -1
  14. package/dist/components/choice-list/style.css +1 -1
  15. package/dist/components/combobox/component.d.ts +32 -1
  16. package/dist/components/combobox/component.d.ts.map +1 -1
  17. package/dist/components/combobox/component.js +286 -261
  18. package/dist/components/combobox/component.js.map +1 -1
  19. package/dist/components/combobox/style.css +1 -1
  20. package/dist/components/combobox/utils.d.ts +2 -0
  21. package/dist/components/combobox/utils.d.ts.map +1 -0
  22. package/dist/components/combobox/utils.js +10 -0
  23. package/dist/components/combobox/utils.js.map +1 -0
  24. package/dist/components/command-palette/style.css +1 -1
  25. package/dist/components/data-table/style.css +1 -1
  26. package/dist/components/dialog/Dialog.d.ts.map +1 -1
  27. package/dist/components/dialog/Dialog.js +73 -69
  28. package/dist/components/dialog/Dialog.js.map +1 -1
  29. package/dist/components/dialog/dialog.css +1 -1
  30. package/dist/components/hooks/useDraggable.d.ts.map +1 -1
  31. package/dist/components/hooks/useDraggable.js +34 -27
  32. package/dist/components/hooks/useDraggable.js.map +1 -1
  33. package/dist/components/input/component.d.ts +1 -1
  34. package/dist/components/input/component.d.ts.map +1 -1
  35. package/dist/components/input/component.js +55 -45
  36. package/dist/components/input/component.js.map +1 -1
  37. package/dist/components/modal/Modal.d.ts.map +1 -1
  38. package/dist/components/modal/Modal.js +151 -132
  39. package/dist/components/modal/Modal.js.map +1 -1
  40. package/dist/components/modal/style.css +1 -1
  41. package/dist/components/popup-panel/component.d.ts +1 -1
  42. package/dist/components/popup-panel/component.d.ts.map +1 -1
  43. package/dist/components/popup-panel/component.js +217 -233
  44. package/dist/components/popup-panel/component.js.map +1 -1
  45. package/dist/components/popup-panel/constants.d.ts +5 -1
  46. package/dist/components/popup-panel/constants.d.ts.map +1 -1
  47. package/dist/components/popup-panel/constants.js +8 -4
  48. package/dist/components/popup-panel/constants.js.map +1 -1
  49. package/dist/components/popup-panel/style.css +1 -1
  50. package/dist/components/popup-panel/types.d.ts +14 -1
  51. package/dist/components/popup-panel/types.d.ts.map +1 -1
  52. package/dist/components/select-trigger/style.css +1 -1
  53. package/dist/components/theme-provider/style.css +1 -1
  54. package/dist/components/truncate/helpers.d.ts +13 -7
  55. package/dist/components/truncate/helpers.d.ts.map +1 -1
  56. package/dist/components/truncate/helpers.js +102 -85
  57. package/dist/components/truncate/helpers.js.map +1 -1
  58. package/dist/stats.html +1 -1
  59. package/dist/tailwind.css +16 -0
  60. package/dist/tokens/and-theme/tokens.d.ts.map +1 -1
  61. package/dist/tokens/and-theme/tokens.js +4 -1
  62. package/dist/tokens/and-theme/tokens.js.map +1 -1
  63. package/package.json +4 -4
@@ -1,309 +1,293 @@
1
1
  "use client";
2
- import { jsx as n, jsxs as u, Fragment as de } from "react/jsx-runtime";
3
- import { Popover as f } from "@base-ui/react/popover";
4
- import { mergeProps as V } from "@base-ui/react";
5
- import { useStableCallback as ae } from "@base-ui/utils/useStableCallback";
6
- import { X as me } from "@bioturing/assets";
7
- import { useRef as Z, useCallback as k, useMemo as s, useEffect as ge } from "react";
8
- import { Stack as he } from "../stack/index.js";
9
- import { PopupPanelSize as Oe, DEFAULT_SIDE_OFFSET as be } from "./constants.js";
2
+ import { jsx as r, jsxs as f, Fragment as Oe } from "react/jsx-runtime";
3
+ import { Popover as c } from "@base-ui/react/popover";
4
+ import { mergeProps as Q } from "@base-ui/react";
5
+ import { useStableCallback as Ce } from "@base-ui/utils/useStableCallback";
6
+ import { X as Ee } from "@bioturing/assets";
7
+ import { useRef as te, useCallback as b, useMemo as m, useEffect as Re } from "react";
8
+ import { Stack as Le } from "../stack/index.js";
9
+ import { PopupPanelSize as Se, POPUP_PANEL_ARROW_HEIGHT as ne, POPUP_PANEL_ARROW_WIDTH as oe, POPUP_PANEL_ARROW_SIDE_OFFSET as _e, DEFAULT_SIDE_OFFSET as ee } from "./constants.js";
10
10
  import './style.css';/* empty css */
11
- import { anchorToResizeHandles as Ee } from "./utils.js";
12
- import { useDraggable as Se } from "../hooks/useDraggable.js";
13
- import { Resizable as Re } from "../resizable/component.js";
14
- import { parseAntdPlacement as Pe, buildAntdPlacement as ve } from "../utils/placement.js";
15
- import { useControlledState as ye } from "../hooks/useControlledState.js";
16
- import { useCls as Te } from "../utils/antdUtils.js";
11
+ import { anchorToResizeHandles as we } from "./utils.js";
12
+ import { useDraggable as ve } from "../hooks/useDraggable.js";
13
+ import { Resizable as He } from "../resizable/component.js";
14
+ import { parseAntdPlacement as be, buildAntdPlacement as Te } from "../utils/placement.js";
15
+ import { useControlledState as Ae } from "../hooks/useControlledState.js";
16
+ import { useCls as pe } from "../utils/antdUtils.js";
17
17
  import { useTheme as ke } from "../theme-provider/context/themeStore.js";
18
- import { clsx as d } from "../utils/cn.js";
19
- import { IconButton as Ce } from "../icon-button/component.js";
20
- const H = {};
21
- function W({
22
- side: g,
23
- align: P,
24
- onPlacementChange: h
25
- }) {
26
- const v = Z(void 0);
27
- return ge(() => {
28
- const O = ve({
29
- side: g,
30
- align: P
18
+ import { clsx as a } from "../utils/cn.js";
19
+ import { IconButton as xe } from "../icon-button/component.js";
20
+ const D = {};
21
+ function re({ side: s, align: l, onPlacementChange: P }) {
22
+ const _ = te(void 0);
23
+ return Re(() => {
24
+ const O = Te({
25
+ side: s,
26
+ align: l
31
27
  });
32
- O !== v.current && (v.current = O, h?.(O));
33
- }, [g, P, h]), null;
28
+ O !== _.current && (_.current = O, P?.(O));
29
+ }, [s, l, P]), null;
34
30
  }
35
- const Ye = ({
36
- children: g,
37
- placement: P,
38
- openOnHover: h = !1,
39
- open: v,
31
+ function ye(s) {
32
+ const l = pe();
33
+ return /* @__PURE__ */ f(
34
+ "svg",
35
+ {
36
+ width: oe,
37
+ height: ne,
38
+ viewBox: "0 0 20 10",
39
+ fill: "none",
40
+ "aria-hidden": "true",
41
+ ...s,
42
+ children: [
43
+ /* @__PURE__ */ r(
44
+ "path",
45
+ {
46
+ d: "M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z",
47
+ className: l("popup-panel-arrow-fill")
48
+ }
49
+ ),
50
+ /* @__PURE__ */ r(
51
+ "path",
52
+ {
53
+ d: "M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z",
54
+ className: l("popup-panel-arrow-outer-stroke")
55
+ }
56
+ ),
57
+ /* @__PURE__ */ r(
58
+ "path",
59
+ {
60
+ d: "M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z",
61
+ className: l("popup-panel-arrow-inner-stroke")
62
+ }
63
+ )
64
+ ]
65
+ }
66
+ );
67
+ }
68
+ const qe = ({
69
+ children: s,
70
+ placement: l,
71
+ openOnHover: P = !1,
72
+ open: _,
40
73
  onOpenChange: O,
41
74
  content: I,
42
- title: y,
43
- trigger: z = "click",
44
- className: A,
75
+ title: w,
76
+ trigger: M = "click",
77
+ className: $,
45
78
  anchor: o,
46
- beforeCloseButton: M,
47
- afterCloseButton: $,
48
- afterTitle: C,
49
- size: b = "medium",
79
+ beforeCloseButton: U,
80
+ afterCloseButton: V,
81
+ afterTitle: T,
82
+ arrow: v = !1,
83
+ size: C = "medium",
50
84
  footer: E,
51
- defaultOpen: N = !1,
52
- resizable: x = !1,
53
- draggable: ee = !1,
54
- maintainAspectRatio: j = !1,
85
+ defaultOpen: le = !1,
86
+ resizable: R = !1,
87
+ draggable: A = !1,
88
+ maintainAspectRatio: W = !1,
55
89
  classNames: e,
56
- modal: te = !1,
57
- closeOnClickOutside: re = !0,
58
- onPlacementChange: _,
59
- positionerProps: i = H,
60
- triggerProps: ne = H,
61
- portalProps: oe = H,
62
- offsetFrom: S,
63
- nativeButton: K = !0,
64
- ...le
90
+ modal: ie = !1,
91
+ closeOnClickOutside: ue = !0,
92
+ onPlacementChange: k,
93
+ positionerProps: i = D,
94
+ triggerProps: ce = D,
95
+ portalProps: ae = D,
96
+ offsetFrom: L,
97
+ nativeButton: F = !0,
98
+ zIndex: Z = "popup",
99
+ ...fe
65
100
  }) => {
66
- const [ie, D] = ye(
67
- v,
101
+ const [se, x] = Ae(
102
+ _,
68
103
  O,
69
- N
104
+ le
70
105
  // Always provide a default value to prevent undefined
71
- ), t = Te(), { className: U } = ke(), T = Pe(P), w = Z(null), B = k((r) => {
72
- r === null || w.current === r || (w.current = r);
73
- }, []), F = k(() => {
106
+ ), t = pe(), { className: j } = ke(), H = be(l), y = te(null), z = b((n) => {
107
+ n === null || y.current === n || (y.current = n);
108
+ }, []), B = b(() => {
74
109
  if (o instanceof Element) return o;
75
110
  if (o != null && "current" in o) return o.current;
76
111
  if (typeof o == "function") {
77
- const r = o();
78
- return r instanceof Element ? r : null;
112
+ const n = o();
113
+ return n instanceof Element ? n : null;
79
114
  }
80
- return w.current;
81
- }, [o]), J = s(() => {
82
- if (typeof i.sideOffset == "function")
83
- return i.sideOffset;
84
- const r = typeof i.sideOffset == "number" ? i.sideOffset : 0, l = be + r;
85
- return S ? ({ side: Q }) => {
86
- const R = S.current, p = F();
87
- if (!R || !p) return l;
88
- const c = R.getBoundingClientRect(), a = p.getBoundingClientRect();
89
- let m;
90
- switch (Q) {
115
+ return y.current;
116
+ }, [o]), K = m(() => {
117
+ if (typeof i.sideOffset == "function") return i.sideOffset;
118
+ const n = typeof i.sideOffset == "number" ? i.sideOffset : 0, p = (v ? _e + ee : ee) + n;
119
+ return L ? ({ side: q }) => {
120
+ const S = L.current, d = B();
121
+ if (!S || !d) return p;
122
+ const u = S.getBoundingClientRect(), g = d.getBoundingClientRect();
123
+ let h;
124
+ switch (q) {
91
125
  case "bottom":
92
- m = c.bottom - a.bottom;
126
+ h = u.bottom - g.bottom;
93
127
  break;
94
128
  case "top":
95
- m = a.top - c.top;
129
+ h = g.top - u.top;
96
130
  break;
97
131
  case "right":
98
- m = c.right - a.right;
132
+ h = u.right - g.right;
99
133
  break;
100
134
  case "left":
101
- m = a.left - c.left;
135
+ h = g.left - u.left;
102
136
  break;
103
137
  default:
104
- m = 0;
138
+ h = 0;
105
139
  }
106
- return Math.max(0, m) + l;
107
- } : l;
108
- }, [S, F, i.sideOffset]), L = s(() => /* @__PURE__ */ n(me, { size: 16 }), []), X = k(() => /* @__PURE__ */ u("div", { className: d(t("popup-panel-header"), e?.header), children: [
109
- /* @__PURE__ */ u(
110
- he,
111
- {
112
- align: "center",
113
- gap: 8,
114
- className: t("popup-panel-title-wrapper"),
115
- children: [
116
- /* @__PURE__ */ n(
117
- f.Title,
118
- {
119
- render: /* @__PURE__ */ n("div", { className: d(t("grow", "truncate"), e?.title), children: y })
120
- }
121
- ),
122
- /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
123
- M,
124
- /* @__PURE__ */ n(
125
- f.Close,
126
- {
127
- render: /* @__PURE__ */ n(Ce, { children: L })
128
- }
129
- ),
130
- $
131
- ] })
132
- ]
133
- }
134
- ),
135
- C || null
140
+ return Math.max(0, h) + p;
141
+ } : p;
142
+ }, [v, L, B, i.sideOffset]), N = m(() => /* @__PURE__ */ r(Ee, { size: 16 }), []), G = b(() => /* @__PURE__ */ f("div", { className: a(t("popup-panel-header"), e?.header), children: [
143
+ /* @__PURE__ */ f(Le, { align: "center", gap: 8, className: t("popup-panel-title-wrapper"), children: [
144
+ /* @__PURE__ */ r(
145
+ c.Title,
146
+ {
147
+ render: /* @__PURE__ */ r("div", { className: a(t("grow", "truncate"), e?.title), children: w })
148
+ }
149
+ ),
150
+ /* @__PURE__ */ f("div", { className: "flex items-center gap-2", children: [
151
+ U,
152
+ /* @__PURE__ */ r(c.Close, { render: /* @__PURE__ */ r(xe, { children: N }) }),
153
+ V
154
+ ] })
155
+ ] }),
156
+ T || null
136
157
  ] }), [
137
- $,
138
- C,
139
- M,
158
+ V,
159
+ T,
160
+ U,
140
161
  t,
141
162
  e?.header,
142
163
  e?.title,
143
- L,
144
- y
145
- ]), { ref: Y } = Se(ee), ce = s(
146
- () => /* @__PURE__ */ u(
147
- f.Popup,
164
+ N,
165
+ w
166
+ ]), { ref: J } = ve(A), de = m(
167
+ () => /* @__PURE__ */ f(
168
+ c.Popup,
148
169
  {
149
- className: d(
170
+ className: a(
150
171
  t("popup-panel"),
151
- t(`popup-panel-size-${b}`),
152
- A,
172
+ t(`popup-panel-size-${C}`),
173
+ $,
153
174
  e?.popup
154
175
  ),
155
- ref: Y,
176
+ "data-draggable": A ? "true" : void 0,
177
+ "data-resizable": R ? "true" : void 0,
178
+ ref: J,
156
179
  children: [
157
- y && X(),
158
- /* @__PURE__ */ n("div", { className: d(t("popup-panel-content"), e?.content), children: /* @__PURE__ */ n("div", { className: t("popup-panel-content-inner"), children: I }) }),
159
- E && /* @__PURE__ */ n("div", { className: d(t("popup-panel-footer"), e?.footer), children: typeof E == "function" ? E({ close: () => D(!1) }) : E })
180
+ v && /* @__PURE__ */ r(c.Arrow, { className: a(t("popup-panel-arrow"), e?.arrow), children: /* @__PURE__ */ r(ye, { className: t("popup-panel-arrow-svg") }) }),
181
+ w && G(),
182
+ /* @__PURE__ */ r("div", { className: a(t("popup-panel-content"), e?.content), children: I }),
183
+ E && /* @__PURE__ */ r("div", { className: a(t("popup-panel-footer"), e?.footer), children: typeof E == "function" ? E({ close: () => x(!1) }) : E })
160
184
  ]
161
185
  }
162
186
  ),
163
187
  [
164
- A,
188
+ $,
165
189
  e?.content,
166
190
  e?.footer,
167
191
  e?.popup,
192
+ e?.arrow,
168
193
  t,
169
194
  I,
170
- Y,
195
+ A,
196
+ J,
171
197
  E,
172
- X,
173
- D,
174
- b,
175
- y
198
+ G,
199
+ v,
200
+ x,
201
+ C,
202
+ w,
203
+ R
176
204
  ]
177
- ), q = k(
205
+ ), X = b(
178
206
  ({
179
- children: r,
180
- onDragEnd: l,
181
- onDragStart: Q,
182
- ...R
183
- }, { side: p, align: c }) => {
184
- const a = `${p}-${c}`;
185
- return x ? /* @__PURE__ */ u(de, { children: [
186
- /* @__PURE__ */ n(
187
- W,
188
- {
189
- side: p,
190
- align: c,
191
- onPlacementChange: _
192
- }
193
- ),
194
- /* @__PURE__ */ n(
195
- Re,
207
+ children: n,
208
+ onDragEnd: p,
209
+ onDragStart: q,
210
+ ...S
211
+ }, { side: d, align: u }) => {
212
+ const g = `${d}-${u}`;
213
+ return R ? /* @__PURE__ */ f(Oe, { children: [
214
+ /* @__PURE__ */ r(re, { side: d, align: u, onPlacementChange: k }),
215
+ /* @__PURE__ */ r(
216
+ He,
196
217
  {
197
- resizable: x,
198
- resetKey: a,
199
- maintainAspectRatio: j,
218
+ resizable: R,
219
+ resetKey: g,
220
+ maintainAspectRatio: W,
200
221
  classNames: {
201
222
  resizeHandle: e?.resizeHandle
202
223
  },
203
- handles: Ee(p),
204
- ...R,
205
- children: r
224
+ handles: we(d),
225
+ ...S,
226
+ children: n
206
227
  }
207
228
  )
208
- ] }) : /* @__PURE__ */ u("div", { ...R, children: [
209
- /* @__PURE__ */ n(
210
- W,
211
- {
212
- side: p,
213
- align: c,
214
- onPlacementChange: _
215
- }
216
- ),
217
- r
229
+ ] }) : /* @__PURE__ */ f("div", { ...S, children: [
230
+ /* @__PURE__ */ r(re, { side: d, align: u, onPlacementChange: k }),
231
+ n
218
232
  ] });
219
233
  },
220
- [
221
- x,
222
- j,
223
- e?.resizeHandle,
224
- _
225
- ]
226
- ), G = s(
234
+ [R, W, e?.resizeHandle, k]
235
+ ), Y = m(
227
236
  () => ({
228
- "--size-width": b ? Oe[b] : void 0
237
+ "--popup-panel-arrow-width": `${oe}px`,
238
+ "--popup-panel-arrow-height": `${ne}px`,
239
+ "--size-width": C ? Se[C] : void 0
229
240
  }),
230
- [b]
231
- ), pe = s(
241
+ [C]
242
+ ), me = m(
232
243
  () => ({
233
- className: d(
234
- t("popup-panel-root"),
235
- U,
244
+ className: a(
245
+ t("popup-panel-root", `popup-panel-z-index-${Z}`),
246
+ j,
236
247
  e?.root
237
248
  ),
238
- side: T.side,
239
- align: T.align,
240
- sideOffset: J,
249
+ side: H.side,
250
+ align: H.align,
251
+ sideOffset: K,
241
252
  anchor: o,
242
- style: G,
243
- render: q
253
+ style: Y,
254
+ render: X
244
255
  }),
245
256
  [
246
257
  t,
247
- U,
258
+ j,
248
259
  e?.root,
249
- T.side,
250
- T.align,
251
- J,
260
+ H.side,
261
+ H.align,
262
+ K,
252
263
  o,
253
- G,
254
- q
264
+ Y,
265
+ X,
266
+ Z
255
267
  ]
256
- ), ue = s(
257
- () => S ? (({ sideOffset: r, ...l }) => l)(i) : i,
258
- [S, i]
259
- ), fe = ae(
260
- (r, l) => {
261
- (l.reason === "outside-press" || l.reason === "focus-out") && !re || D(r, l);
268
+ ), ge = m(
269
+ () => L ? (({ sideOffset: n, ...p }) => p)(i) : i,
270
+ [L, i]
271
+ ), he = Ce(
272
+ (n, p) => {
273
+ (p.reason === "outside-press" || p.reason === "focus-out") && !ue || x(n, p);
262
274
  }
263
- ), se = s(
275
+ ), Pe = m(
264
276
  () => ({
265
- ref: B,
266
- render: g,
267
- nativeButton: K,
268
- className: d(t("popup-panel-trigger"), e?.trigger),
269
- openOnHover: z === "hover" ? !0 : h
277
+ ref: z,
278
+ render: s,
279
+ nativeButton: F,
280
+ className: a(t("popup-panel-trigger"), e?.trigger),
281
+ openOnHover: M === "hover" ? !0 : P
270
282
  }),
271
- [
272
- B,
273
- g,
274
- K,
275
- t,
276
- e?.trigger,
277
- z,
278
- h
279
- ]
280
- );
281
- return /* @__PURE__ */ u(
282
- f.Root,
283
- {
284
- open: ie,
285
- onOpenChange: fe,
286
- modal: te,
287
- ...le,
288
- children: [
289
- /* @__PURE__ */ n(
290
- f.Trigger,
291
- {
292
- ...V(se, ne)
293
- }
294
- ),
295
- /* @__PURE__ */ n(f.Portal, { ...oe, children: /* @__PURE__ */ n(
296
- f.Positioner,
297
- {
298
- ...V(pe, ue),
299
- children: ce
300
- }
301
- ) })
302
- ]
303
- }
283
+ [z, s, F, t, e?.trigger, M, P]
304
284
  );
285
+ return /* @__PURE__ */ f(c.Root, { open: se, onOpenChange: he, modal: ie, ...fe, children: [
286
+ /* @__PURE__ */ r(c.Trigger, { ...Q(Pe, ce) }),
287
+ /* @__PURE__ */ r(c.Portal, { ...ae, children: /* @__PURE__ */ r(c.Positioner, { ...Q(me, ge), children: de }) })
288
+ ] });
305
289
  };
306
290
  export {
307
- Ye as PopupPanel
291
+ qe as PopupPanel
308
292
  };
309
293
  //# 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/react/popover\";\nimport { buildAntdPlacement, clsx, parseAntdPlacement, useCls } from \"../utils\";\n\nimport { mergeProps } from \"@base-ui/react\";\nimport { useStableCallback } from \"@base-ui/utils/useStableCallback\";\nimport { X } from \"@bioturing/assets\";\nimport { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { useControlledState, useDraggable } from \"../hooks\";\nimport { IconButton } from \"../icon-button\";\nimport { Resizable } from \"../resizable\";\nimport { Stack } from \"../stack\";\nimport { DEFAULT_SIDE_OFFSET, PopupPanelSize } from \"./constants\";\nimport { PopupPanelProps } from \"./types\";\n\n// Import component-specific styles\nimport { useTheme } from \"../theme-provider\";\nimport \"./style.css\";\nimport { anchorToResizeHandles } from \"./utils\";\n\n// Stable empty objects to avoid creating new references on every render\nconst EMPTY_OBJECT = {} as const;\n\ninterface PlacementStateSyncProps {\n side: Popover.Positioner.State[\"side\"];\n align: Popover.Positioner.State[\"align\"];\n onPlacementChange?: (\n placement: NonNullable<PopupPanelProps[\"placement\"]>,\n ) => void;\n}\n\nfunction PlacementStateSync({\n side,\n align,\n onPlacementChange,\n}: PlacementStateSyncProps) {\n const lastPlacementRef = useRef<\n NonNullable<PopupPanelProps[\"placement\"]> | undefined\n >(undefined);\n\n useEffect(() => {\n const placement = buildAntdPlacement({\n side,\n align,\n }) as NonNullable<PopupPanelProps[\"placement\"]>;\n if (placement === lastPlacementRef.current) return;\n lastPlacementRef.current = placement;\n onPlacementChange?.(placement);\n }, [side, align, onPlacementChange]);\n\n return null;\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 = EMPTY_OBJECT,\n triggerProps = EMPTY_OBJECT,\n portalProps = EMPTY_OBJECT,\n offsetFrom,\n nativeButton = true,\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 triggerElRef = useRef<HTMLElement | null>(null);\n const handleTriggerRef = useCallback((node: HTMLElement | null) => {\n if (node === null || triggerElRef.current === node) return;\n triggerElRef.current = node;\n }, []);\n\n const getAnchorEl = useCallback(() => {\n if (anchor instanceof Element) return anchor;\n if (anchor != null && \"current\" in anchor) return anchor.current;\n if (typeof anchor === \"function\") {\n const result = anchor();\n return result instanceof Element ? result : null;\n }\n return triggerElRef.current;\n }, [anchor]);\n\n // Compute sideOffset: incorporate user sideOffset, and when offsetFrom is\n // provided, add the distance from the anchor to the offsetFrom element\n const resolvedSideOffset = useMemo(() => {\n // If user provides a function, let them fully control the offset\n if (typeof positionerProps.sideOffset === \"function\")\n return positionerProps.sideOffset;\n\n const userSideOffset =\n typeof positionerProps.sideOffset === \"number\"\n ? positionerProps.sideOffset\n : 0;\n const baseOffset = DEFAULT_SIDE_OFFSET + userSideOffset;\n\n if (!offsetFrom) return baseOffset;\n\n return ({ side }: { side: string }) => {\n const offsetFromEl = offsetFrom.current;\n const anchorEl = getAnchorEl();\n if (!offsetFromEl || !anchorEl) return baseOffset;\n\n const offsetRect = offsetFromEl.getBoundingClientRect();\n const anchorRect = anchorEl.getBoundingClientRect();\n\n let distance: number;\n switch (side) {\n case \"bottom\":\n distance = offsetRect.bottom - anchorRect.bottom;\n break;\n case \"top\":\n distance = anchorRect.top - offsetRect.top;\n break;\n case \"right\":\n distance = offsetRect.right - anchorRect.right;\n break;\n case \"left\":\n distance = anchorRect.left - offsetRect.left;\n break;\n default:\n distance = 0;\n }\n\n return Math.max(0, distance) + baseOffset;\n };\n }, [offsetFrom, getAnchorEl, positionerProps.sideOffset]);\n\n const defaultCloseIcon = useMemo(() => <X size={16} />, []);\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 // Positioner render function — useCallback keeps the reference stable when deps\n // don't change. Cannot use useStableCallback here because render props are\n // called during React's render phase, not in effects/event handlers.\n const positionerRender = useCallback(\n (\n {\n children,\n onDragEnd: _onDragEnd,\n onDragStart: _onDragStart,\n ...props\n }: React.ComponentProps<\"div\">,\n { side, align }: Popover.Positioner.State,\n ) => {\n const placementKey = `${side}-${align}`;\n return resizable ? (\n <>\n <PlacementStateSync\n side={side}\n align={align}\n onPlacementChange={onPlacementChange}\n />\n <Resizable\n resizable={resizable}\n resetKey={placementKey}\n maintainAspectRatio={maintainAspectRatio}\n classNames={{\n resizeHandle: classNames?.resizeHandle,\n }}\n handles={anchorToResizeHandles(side, align)}\n {...props}\n >\n {children}\n </Resizable>\n </>\n ) : (\n <div {...props}>\n <PlacementStateSync\n side={side}\n align={align}\n onPlacementChange={onPlacementChange}\n />\n {children}\n </div>\n );\n },\n [\n resizable,\n maintainAspectRatio,\n classNames?.resizeHandle,\n onPlacementChange,\n ],\n );\n\n const positionerStyle = useMemo(\n () =>\n ({\n \"--size-width\": size ? PopupPanelSize[size] : undefined,\n }) as React.CSSProperties,\n [size],\n );\n\n const defaultPositionerProps = useMemo(\n () => ({\n className: clsx(\n cls(\"popup-panel-root\"),\n themeClassName,\n classNames?.root,\n ),\n side: baseUIPlacement.side,\n align: baseUIPlacement.align,\n sideOffset: resolvedSideOffset,\n anchor,\n style: positionerStyle,\n render: positionerRender,\n }),\n [\n cls,\n themeClassName,\n classNames?.root,\n baseUIPlacement.side,\n baseUIPlacement.align,\n resolvedSideOffset,\n anchor,\n positionerStyle,\n positionerRender,\n ],\n );\n\n // Strip sideOffset from positionerProps when offsetFrom is active,\n // since we've already incorporated it into resolvedSideOffset\n const finalPositionerProps = useMemo(\n () =>\n offsetFrom\n ? (({ sideOffset: _, ...rest }) => rest)(positionerProps)\n : positionerProps,\n [offsetFrom, positionerProps],\n );\n\n // Stable onOpenChange handler to avoid recreating on every render\n const handleOpenChange = useStableCallback(\n (nextOpen: boolean, eventDetails: Popover.Root.ChangeEventDetails) => {\n if (\n (eventDetails.reason === \"outside-press\" ||\n eventDetails.reason === \"focus-out\") &&\n !closeOnClickOutside\n )\n return;\n setOpen(nextOpen, eventDetails);\n },\n );\n\n const defaultTriggerProps = useMemo(\n () => ({\n ref: handleTriggerRef,\n render: children,\n nativeButton,\n className: clsx(cls(\"popup-panel-trigger\"), classNames?.trigger),\n openOnHover: trigger === \"hover\" ? true : openOnHover,\n }),\n [\n handleTriggerRef,\n children,\n nativeButton,\n cls,\n classNames?.trigger,\n trigger,\n openOnHover,\n ],\n );\n\n return (\n <Popover.Root\n open={open}\n onOpenChange={handleOpenChange}\n modal={modal}\n {...rest}\n >\n <Popover.Trigger\n {...mergeProps(defaultTriggerProps, triggerProps)}\n ></Popover.Trigger>\n <Popover.Portal {...portalProps}>\n <Popover.Positioner\n {...mergeProps(defaultPositionerProps, finalPositionerProps)}\n >\n {popup}\n </Popover.Positioner>\n </Popover.Portal>\n </Popover.Root>\n );\n};\n"],"names":["EMPTY_OBJECT","PlacementStateSync","side","align","onPlacementChange","lastPlacementRef","useRef","useEffect","placement","buildAntdPlacement","PopupPanel","children","openOnHover","outsideOpen","outsideOnOpenChange","content","title","trigger","className","anchor","beforeCloseButton","afterCloseButton","afterTitle","size","footer","defaultOpen","resizable","draggable","maintainAspectRatio","classNames","modal","closeOnClickOutside","positionerProps","triggerProps","portalProps","offsetFrom","nativeButton","rest","open","setOpen","useControlledState","cls","useCls","themeClassName","useTheme","baseUIPlacement","parseAntdPlacement","triggerElRef","handleTriggerRef","useCallback","node","getAnchorEl","result","resolvedSideOffset","useMemo","userSideOffset","baseOffset","DEFAULT_SIDE_OFFSET","offsetFromEl","anchorEl","offsetRect","anchorRect","distance","defaultCloseIcon","jsx","X","renderTitle","jsxs","clsx","Stack","Popover","IconButton","draggableRef","useDraggable","popup","positionerRender","_onDragEnd","_onDragStart","props","placementKey","Fragment","Resizable","anchorToResizeHandles","positionerStyle","PopupPanelSize","defaultPositionerProps","finalPositionerProps","_","handleOpenChange","useStableCallback","nextOpen","eventDetails","defaultTriggerProps","mergeProps"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,MAAMA,IAAe,CAAA;AAUrB,SAASC,EAAmB;AAAA,EAC1B,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,mBAAAC;AACF,GAA4B;AAC1B,QAAMC,IAAmBC,EAEvB,MAAS;AAEX,SAAAC,GAAU,MAAM;A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MACA,WAAWgC,EAAK3B,EAAI,qBAAqB,GAAGZ,GAAY,OAAO;AAAA,MAC/D,aAAaZ,MAAY,UAAU,KAAOL;AAAA,IAAA;AAAA,IAE5C;AAAA,MACEoC;AAAA,MACArC;AAAA,MACAyB;AAAA,MACAK;AAAA,MACAZ,GAAY;AAAA,MACZZ;AAAA,MACAL;AAAA,IAAA;AAAA,EACF;AAGF,SACE,gBAAAuD;AAAA,IAACG,EAAQ;AAAA,IAAR;AAAA,MACC,MAAAhC;AAAA,MACA,cAAckD;AAAA,MACd,OAAA1D;AAAA,MACC,GAAGO;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAA2B;AAAA,UAACM,EAAQ;AAAA,UAAR;AAAA,YACE,GAAGuB,EAAWD,IAAqB3D,EAAY;AAAA,UAAA;AAAA,QAAA;AAAA,QAElD,gBAAA+B,EAACM,EAAQ,QAAR,EAAgB,GAAGpC,IAClB,UAAA,gBAAA8B;AAAA,UAACM,EAAQ;AAAA,UAAR;AAAA,YACE,GAAGuB,EAAWR,IAAwBC,EAAoB;AAAA,YAE1D,UAAAZ;AAAA,UAAA;AAAA,QAAA,EACH,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"component.js","sources":["../../../src/components/popup-panel/component.tsx"],"sourcesContent":["\"use client\";\nimport { Popover } from \"@base-ui/react/popover\";\nimport { buildAntdPlacement, clsx, parseAntdPlacement, useCls } from \"../utils\";\n\nimport { mergeProps } from \"@base-ui/react\";\nimport { useStableCallback } from \"@base-ui/utils/useStableCallback\";\nimport { X } from \"@bioturing/assets\";\nimport { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { useControlledState, useDraggable } from \"../hooks\";\nimport { IconButton } from \"../icon-button\";\nimport { Resizable } from \"../resizable\";\nimport { Stack } from \"../stack\";\nimport {\n DEFAULT_SIDE_OFFSET,\n POPUP_PANEL_ARROW_HEIGHT,\n POPUP_PANEL_ARROW_SIDE_OFFSET,\n POPUP_PANEL_ARROW_WIDTH,\n PopupPanelSize,\n} from \"./constants\";\nimport { PopupPanelProps } from \"./types\";\n\n// Import component-specific styles\nimport { useTheme } from \"../theme-provider\";\nimport \"./style.css\";\nimport { anchorToResizeHandles } from \"./utils\";\n\n// Stable empty objects to avoid creating new references on every render\nconst EMPTY_OBJECT = {} as const;\n\ninterface PlacementStateSyncProps {\n side: Popover.Positioner.State[\"side\"];\n align: Popover.Positioner.State[\"align\"];\n onPlacementChange?: (placement: NonNullable<PopupPanelProps[\"placement\"]>) => void;\n}\n\nfunction PlacementStateSync({ side, align, onPlacementChange }: PlacementStateSyncProps) {\n const lastPlacementRef = useRef<NonNullable<PopupPanelProps[\"placement\"]> | undefined>(undefined);\n\n useEffect(() => {\n const placement = buildAntdPlacement({\n side,\n align,\n }) as NonNullable<PopupPanelProps[\"placement\"]>;\n if (placement === lastPlacementRef.current) return;\n lastPlacementRef.current = placement;\n onPlacementChange?.(placement);\n }, [side, align, onPlacementChange]);\n\n return null;\n}\n\nfunction PopupPanelArrowSvg(props: React.ComponentProps<\"svg\">) {\n const cls = useCls();\n\n return (\n <svg\n width={POPUP_PANEL_ARROW_WIDTH}\n height={POPUP_PANEL_ARROW_HEIGHT}\n viewBox=\"0 0 20 10\"\n fill=\"none\"\n aria-hidden=\"true\"\n {...props}\n >\n <path\n d=\"M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z\"\n className={cls(\"popup-panel-arrow-fill\")}\n />\n <path\n d=\"M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z\"\n className={cls(\"popup-panel-arrow-outer-stroke\")}\n />\n <path\n d=\"M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z\"\n className={cls(\"popup-panel-arrow-inner-stroke\")}\n />\n </svg>\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 arrow = false,\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 = EMPTY_OBJECT,\n triggerProps = EMPTY_OBJECT,\n portalProps = EMPTY_OBJECT,\n offsetFrom,\n nativeButton = true,\n zIndex = \"popup\",\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 triggerElRef = useRef<HTMLElement | null>(null);\n const handleTriggerRef = useCallback((node: HTMLElement | null) => {\n if (node === null || triggerElRef.current === node) return;\n triggerElRef.current = node;\n }, []);\n\n const getAnchorEl = useCallback(() => {\n if (anchor instanceof Element) return anchor;\n if (anchor != null && \"current\" in anchor) return anchor.current;\n if (typeof anchor === \"function\") {\n const result = anchor();\n return result instanceof Element ? result : null;\n }\n return triggerElRef.current;\n }, [anchor]);\n\n // Compute sideOffset: incorporate user sideOffset, and when offsetFrom is\n // provided, add the distance from the anchor to the offsetFrom element\n const resolvedSideOffset = useMemo(() => {\n // If user provides a function, let them fully control the offset\n if (typeof positionerProps.sideOffset === \"function\") return positionerProps.sideOffset;\n\n const userSideOffset =\n typeof positionerProps.sideOffset === \"number\" ? positionerProps.sideOffset : 0;\n const baseOffset =\n (arrow ? POPUP_PANEL_ARROW_SIDE_OFFSET + DEFAULT_SIDE_OFFSET : DEFAULT_SIDE_OFFSET) +\n userSideOffset;\n if (!offsetFrom) return baseOffset;\n\n return ({ side }: { side: string }) => {\n const offsetFromEl = offsetFrom.current;\n const anchorEl = getAnchorEl();\n if (!offsetFromEl || !anchorEl) return baseOffset;\n\n const offsetRect = offsetFromEl.getBoundingClientRect();\n const anchorRect = anchorEl.getBoundingClientRect();\n\n let distance: number;\n switch (side) {\n case \"bottom\":\n distance = offsetRect.bottom - anchorRect.bottom;\n break;\n case \"top\":\n distance = anchorRect.top - offsetRect.top;\n break;\n case \"right\":\n distance = offsetRect.right - anchorRect.right;\n break;\n case \"left\":\n distance = anchorRect.left - offsetRect.left;\n break;\n default:\n distance = 0;\n }\n\n return Math.max(0, distance) + baseOffset;\n };\n }, [arrow, offsetFrom, getAnchorEl, positionerProps.sideOffset]);\n\n const defaultCloseIcon = useMemo(() => <X size={16} />, []);\n\n const renderTitle = useCallback(() => {\n return (\n <div className={clsx(cls(\"popup-panel-header\"), classNames?.header)}>\n <Stack align=\"center\" gap={8} className={cls(\"popup-panel-title-wrapper\")}>\n <Popover.Title\n render={<div className={clsx(cls(\"grow\", \"truncate\"), classNames?.title)}>{title}</div>}\n ></Popover.Title>\n <div className=\"flex items-center gap-2\">\n {beforeCloseButton}\n <Popover.Close render={<IconButton>{defaultCloseIcon}</IconButton>} />\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 data-draggable={draggable ? \"true\" : undefined}\n data-resizable={resizable ? \"true\" : undefined}\n ref={draggableRef}\n >\n {arrow && (\n <Popover.Arrow className={clsx(cls(\"popup-panel-arrow\"), classNames?.arrow)}>\n <PopupPanelArrowSvg className={cls(\"popup-panel-arrow-svg\")} />\n </Popover.Arrow>\n )}\n {title && renderTitle()}\n <div className={clsx(cls(\"popup-panel-content\"), classNames?.content)}>{content}</div>\n {footer && (\n <div className={clsx(cls(\"popup-panel-footer\"), classNames?.footer)}>\n {typeof footer === \"function\" ? footer({ close: () => setOpen(false) }) : footer}\n </div>\n )}\n </Popover.Popup>\n ),\n [\n className,\n classNames?.content,\n classNames?.footer,\n classNames?.popup,\n classNames?.arrow,\n cls,\n content,\n draggable,\n draggableRef,\n footer,\n renderTitle,\n arrow,\n setOpen,\n size,\n title,\n resizable,\n ],\n );\n\n // Positioner render function — useCallback keeps the reference stable when deps\n // don't change. Cannot use useStableCallback here because render props are\n // called during React's render phase, not in effects/event handlers.\n const positionerRender = useCallback(\n (\n {\n children,\n onDragEnd: _onDragEnd,\n onDragStart: _onDragStart,\n ...props\n }: React.ComponentProps<\"div\">,\n { side, align }: Popover.Positioner.State,\n ) => {\n const placementKey = `${side}-${align}`;\n return resizable ? (\n <>\n <PlacementStateSync side={side} align={align} onPlacementChange={onPlacementChange} />\n <Resizable\n resizable={resizable}\n resetKey={placementKey}\n maintainAspectRatio={maintainAspectRatio}\n classNames={{\n resizeHandle: classNames?.resizeHandle,\n }}\n handles={anchorToResizeHandles(side, align)}\n {...props}\n >\n {children}\n </Resizable>\n </>\n ) : (\n <div {...props}>\n <PlacementStateSync side={side} align={align} onPlacementChange={onPlacementChange} />\n {children}\n </div>\n );\n },\n [resizable, maintainAspectRatio, classNames?.resizeHandle, onPlacementChange],\n );\n\n const positionerStyle = useMemo(\n () =>\n ({\n \"--popup-panel-arrow-width\": `${POPUP_PANEL_ARROW_WIDTH}px`,\n \"--popup-panel-arrow-height\": `${POPUP_PANEL_ARROW_HEIGHT}px`,\n \"--size-width\": size ? PopupPanelSize[size] : undefined,\n }) as React.CSSProperties,\n [size],\n );\n\n const defaultPositionerProps = useMemo(\n () => ({\n className: clsx(\n cls(\"popup-panel-root\", `popup-panel-z-index-${zIndex}`),\n themeClassName,\n classNames?.root,\n ),\n side: baseUIPlacement.side,\n align: baseUIPlacement.align,\n sideOffset: resolvedSideOffset,\n anchor,\n style: positionerStyle,\n render: positionerRender,\n }),\n [\n cls,\n themeClassName,\n classNames?.root,\n baseUIPlacement.side,\n baseUIPlacement.align,\n resolvedSideOffset,\n anchor,\n positionerStyle,\n positionerRender,\n zIndex,\n ],\n );\n\n // Strip sideOffset from positionerProps when offsetFrom is active,\n // since we've already incorporated it into resolvedSideOffset\n const finalPositionerProps = useMemo(\n () => (offsetFrom ? (({ sideOffset: _, ...rest }) => rest)(positionerProps) : positionerProps),\n [offsetFrom, positionerProps],\n );\n\n // Stable onOpenChange handler to avoid recreating on every render\n const handleOpenChange = useStableCallback(\n (nextOpen: boolean, eventDetails: Popover.Root.ChangeEventDetails) => {\n if (\n (eventDetails.reason === \"outside-press\" || eventDetails.reason === \"focus-out\") &&\n !closeOnClickOutside\n )\n return;\n setOpen(nextOpen, eventDetails);\n },\n );\n\n const defaultTriggerProps = useMemo(\n () => ({\n ref: handleTriggerRef,\n render: children,\n nativeButton,\n className: clsx(cls(\"popup-panel-trigger\"), classNames?.trigger),\n openOnHover: trigger === \"hover\" ? true : openOnHover,\n }),\n [handleTriggerRef, children, nativeButton, cls, classNames?.trigger, trigger, openOnHover],\n );\n\n return (\n <Popover.Root open={open} onOpenChange={handleOpenChange} modal={modal} {...rest}>\n <Popover.Trigger {...mergeProps(defaultTriggerProps, triggerProps)}></Popover.Trigger>\n <Popover.Portal {...portalProps}>\n <Popover.Positioner {...mergeProps(defaultPositionerProps, finalPositionerProps)}>\n {popup}\n </Popover.Positioner>\n </Popover.Portal>\n </Popover.Root>\n );\n};\n"],"names":["EMPTY_OBJECT","PlacementStateSync","side","align","onPlacementChange","lastPlacementRef","useRef","useEffect","placement","buildAntdPlacement","PopupPanelArrowSvg","props","cls","useCls","jsxs","POPUP_PANEL_ARROW_WIDTH","POPUP_PANEL_ARROW_HEIGHT","jsx","PopupPanel","children","openOnHover","outsideOpen","outsideOnOpenChange","content","title","trigger","className","anchor","beforeCloseButton","afterCloseButton","afterTitle","arrow","size","footer","defaultOpen","resizable","draggable","maintainAspectRatio","classNames","modal","closeOnClickOutside","positionerProps","triggerProps","portalProps","offsetFrom","nativeButton","zIndex","rest","open","setOpen","useControlledState","themeClassName","useTheme","baseUIPlacement","parseAntdPlacement","triggerElRef","handleTriggerRef","useCallback","node","getAnchorEl","result","resolvedSideOffset","useMemo","userSideOffset","baseOffset","POPUP_PANEL_ARROW_SIDE_OFFSET","DEFAULT_SIDE_OFFSET","offsetFromEl","anchorEl","offsetRect","anchorRect","distance","defaultCloseIcon","X","renderTitle","clsx","Stack","Popover","IconButton","draggableRef","useDraggable","popup","positionerRender","_onDragEnd","_onDragStart","placementKey","Fragment","Resizable","anchorToResizeHandles","positionerStyle","PopupPanelSize","defaultPositionerProps","finalPositionerProps","_","handleOpenChange","useStableCallback","nextOpen","eventDetails","defaultTriggerProps","mergeProps"],"mappings":";;;;;;;;;;;;;;;;;;;AA2BA,MAAMA,IAAe,CAAA;AAQrB,SAASC,GAAmB,EAAE,MAAAC,GAAM,OAAAC,GAAO,mBAAAC,KAA8C;AACvF,QAAMC,IAAmBC,GAA8D,MAAS;AAEhG,SAAAC,GAAU,MAAM;AACd,UAAMC,IAAYC,GAAmB;AAAA,MACnC,MAAAP;AAAA,MACA,OAAAC;AAAA,IAAA,CACD;AACD,IAAIK,MAAcH,EAAiB,YACnCA,E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ClB,UAAA,gBAAA1B,EAAC4D,EAAQ,YAAR,EAAoB,GAAGsB,EAAWR,IAAwBC,EAAoB,GAC5E,cACH,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
@@ -4,6 +4,10 @@ export declare enum PopupPanelSize {
4
4
  small = "400px",
5
5
  medium = "480px",
6
6
  large = "640px",
7
- xlarge = "840px"
7
+ xlarge = "840px",
8
+ fit = "fit-content"
8
9
  }
10
+ export declare const POPUP_PANEL_ARROW_WIDTH = 20;
11
+ export declare const POPUP_PANEL_ARROW_HEIGHT = 10;
12
+ export declare const POPUP_PANEL_ARROW_SIDE_OFFSET = 8;
9
13
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/popup-panel/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAGrC,oBAAY,cAAc;IACxB,MAAM,UAAU;IAChB,KAAK,UAAU;IACf,MAAM,UAAU;IAChB,KAAK,UAAU;IACf,MAAM,UAAU;CACjB"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/popup-panel/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAGrC,oBAAY,cAAc;IACxB,MAAM,UAAU;IAChB,KAAK,UAAU;IACf,MAAM,UAAU;IAChB,KAAK,UAAU;IACf,MAAM,UAAU;IAChB,GAAG,gBAAgB;CACpB;AAED,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,6BAA6B,IAAI,CAAC"}