@clasing/ui 0.1.127 → 0.1.128

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 (81) hide show
  1. package/dist/{badge-BnerQ2lF.js → badge-1kvIHznc.js} +1 -1
  2. package/dist/{badge-Czof3oqL.cjs → badge-P7DTJePf.cjs} +1 -1
  3. package/dist/{button-DddHyyHa.js → button-BMeBsgLZ.js} +156 -150
  4. package/dist/{button-Cegl49Yi.cjs → button-Chd1eL4R.cjs} +1 -1
  5. package/dist/{calendar-DL8gqdRp.cjs → calendar-B1iUTT_d.cjs} +1 -1
  6. package/dist/{calendar-BAQkzm4v.js → calendar-Bc6nud5f.js} +1 -1
  7. package/dist/{chip-A32aAc-8.cjs → chip-BtBgM97Y.cjs} +1 -1
  8. package/dist/{chip-ZZHZ8i1Q.js → chip-DOFVLzAe.js} +1 -1
  9. package/dist/command-BVqQYgq1.cjs +1 -0
  10. package/dist/command-DS_uqbdy.js +176 -0
  11. package/dist/components/accordion.cjs.js +1 -1
  12. package/dist/components/accordion.es.js +1 -1
  13. package/dist/components/alert-dialog.cjs.js +1 -1
  14. package/dist/components/alert-dialog.es.js +1 -1
  15. package/dist/components/alert.cjs.js +1 -1
  16. package/dist/components/alert.es.js +1 -1
  17. package/dist/components/badge.cjs.js +1 -1
  18. package/dist/components/badge.es.js +1 -1
  19. package/dist/components/blocks/date-picker.cjs.js +1 -1
  20. package/dist/components/blocks/date-picker.es.js +2 -2
  21. package/dist/components/blocks/date-range-picker.cjs.js +1 -1
  22. package/dist/components/blocks/date-range-picker.es.js +1 -1
  23. package/dist/components/blocks/interactive-card.cjs.js +1 -1
  24. package/dist/components/blocks/interactive-card.es.js +2 -2
  25. package/dist/components/blocks/selectable-chips.cjs.js +1 -1
  26. package/dist/components/blocks/selectable-chips.es.js +1 -1
  27. package/dist/components/breadcrumb.cjs.js +1 -1
  28. package/dist/components/breadcrumb.es.js +1 -1
  29. package/dist/components/button.cjs.js +1 -1
  30. package/dist/components/button.d.ts +1 -1
  31. package/dist/components/button.es.js +1 -1
  32. package/dist/components/calendar.cjs.js +1 -1
  33. package/dist/components/calendar.es.js +1 -1
  34. package/dist/components/checkbox.cjs.js +1 -1
  35. package/dist/components/checkbox.es.js +1 -1
  36. package/dist/components/chip.cjs.js +1 -1
  37. package/dist/components/chip.d.ts +1 -1
  38. package/dist/components/chip.es.js +1 -1
  39. package/dist/components/command.cjs.js +1 -1
  40. package/dist/components/command.es.js +1 -1
  41. package/dist/components/context-menu.cjs.js +1 -1
  42. package/dist/components/context-menu.es.js +1 -1
  43. package/dist/components/dialog.cjs.js +1 -1
  44. package/dist/components/dialog.es.js +1 -1
  45. package/dist/components/drawer.cjs.js +1 -3
  46. package/dist/components/drawer.es.js +58 -1091
  47. package/dist/components/dropdown-menu.cjs.js +1 -1
  48. package/dist/components/dropdown-menu.es.js +1 -1
  49. package/dist/components/icon-component.cjs.js +1 -1
  50. package/dist/components/icon-component.d.ts +2 -2
  51. package/dist/components/icon-component.es.js +1 -1
  52. package/dist/components/input-otp.cjs.js +1 -20
  53. package/dist/components/input-otp.es.js +37 -225
  54. package/dist/components/input.cjs.js +1 -1
  55. package/dist/components/input.d.ts +5 -8
  56. package/dist/components/input.es.js +1 -1
  57. package/dist/components/menubar.cjs.js +1 -1
  58. package/dist/components/menubar.es.js +1 -1
  59. package/dist/components/multi-select.cjs.js +1 -1
  60. package/dist/components/multi-select.es.js +3 -3
  61. package/dist/components/navigation-menu.cjs.js +1 -1
  62. package/dist/components/navigation-menu.es.js +1 -1
  63. package/dist/components/phone-input.cjs.js +1 -1
  64. package/dist/components/phone-input.es.js +4 -4
  65. package/dist/components/resizable.cjs.js +1 -1
  66. package/dist/components/resizable.es.js +24 -1527
  67. package/dist/components/select.cjs.js +1 -1
  68. package/dist/components/select.es.js +1 -1
  69. package/dist/components/sheet.cjs.js +1 -1
  70. package/dist/components/sheet.es.js +1 -1
  71. package/dist/{dialog-DZpF7OXg.js → dialog-BdbmyluB.js} +1 -1
  72. package/dist/{dialog-BKm2PZl2.cjs → dialog-DEwsbeqW.cjs} +1 -1
  73. package/dist/{icon-component-BZ-4FDV6.js → icon-component-DS1KwkwD.js} +11 -10
  74. package/dist/icon-component-lt1cLU_1.cjs +1 -0
  75. package/dist/{input-DwPDvbRE.js → input-CToZ7rWo.js} +55 -55
  76. package/dist/input-DDSu84U-.cjs +1 -0
  77. package/package.json +1 -1
  78. package/dist/command-BGCSJ9vX.js +0 -506
  79. package/dist/command-D9M8dk1M.cjs +0 -1
  80. package/dist/icon-component-LY_vGYHZ.cjs +0 -1
  81. package/dist/input-DFPJ_mtM.cjs +0 -1
@@ -1,1551 +1,48 @@
1
- import { j as ve } from "../jsx-runtime-C5mzlN2N.js";
2
- import * as Rn from "react";
3
- import { createContext as Ln, forwardRef as en, createElement as de, useContext as nn, useRef as j, useLayoutEffect as An, useImperativeHandle as tn, useState as ue, useEffect as te, useCallback as B, useMemo as Mn } from "react";
4
- import { c as rn } from "../index-CRiPKpXj.js";
5
- import { I as Nn } from "../icon-component-BZ-4FDV6.js";
6
- const Re = Ln(null);
7
- Re.displayName = "PanelGroupContext";
8
- const A = {
9
- group: "data-panel-group",
10
- groupDirection: "data-panel-group-direction",
11
- groupId: "data-panel-group-id",
12
- panel: "data-panel",
13
- panelCollapsible: "data-panel-collapsible",
14
- panelId: "data-panel-id",
15
- panelSize: "data-panel-size",
16
- resizeHandle: "data-resize-handle",
17
- resizeHandleActive: "data-resize-handle-active",
18
- resizeHandleEnabled: "data-panel-resize-handle-enabled",
19
- resizeHandleId: "data-panel-resize-handle-id",
20
- resizeHandleState: "data-resize-handle-state"
21
- }, Be = 10, re = An, Ue = Rn.useId, Dn = typeof Ue == "function" ? Ue : () => null;
22
- let Hn = 0;
23
- function je(e = null) {
24
- const n = Dn(), t = j(e || n || null);
25
- return t.current === null && (t.current = "" + Hn++), e ?? t.current;
26
- }
27
- function on({
28
- children: e,
29
- className: n = "",
30
- collapsedSize: t,
31
- collapsible: r,
32
- defaultSize: i,
33
- forwardedRef: o,
34
- id: l,
35
- maxSize: a,
36
- minSize: s,
37
- onCollapse: m,
38
- onExpand: P,
39
- onResize: f,
40
- order: u,
41
- style: x,
42
- tagName: h = "div",
43
- ...I
44
- }) {
45
- const w = nn(Re);
46
- if (w === null)
47
- throw Error("Panel components must be rendered within a PanelGroup container");
48
- const {
49
- collapsePanel: S,
50
- expandPanel: R,
51
- getPanelSize: N,
52
- getPanelStyle: H,
53
- groupId: O,
54
- isPanelCollapsed: C,
55
- reevaluatePanelConstraints: b,
56
- registerPanel: W,
57
- resizePanel: J,
58
- unregisterPanel: F
59
- } = w, _ = je(l), M = j({
60
- callbacks: {
61
- onCollapse: m,
62
- onExpand: P,
63
- onResize: f
64
- },
65
- constraints: {
66
- collapsedSize: t,
67
- collapsible: r,
68
- defaultSize: i,
69
- maxSize: a,
70
- minSize: s
71
- },
72
- id: _,
73
- idIsFromProps: l !== void 0,
74
- order: u
75
- });
76
- j({
77
- didLogMissingDefaultSizeWarning: !1
78
- }), re(() => {
79
- const {
80
- callbacks: k,
81
- constraints: $
82
- } = M.current, G = {
83
- ...$
84
- };
85
- M.current.id = _, M.current.idIsFromProps = l !== void 0, M.current.order = u, k.onCollapse = m, k.onExpand = P, k.onResize = f, $.collapsedSize = t, $.collapsible = r, $.defaultSize = i, $.maxSize = a, $.minSize = s, (G.collapsedSize !== $.collapsedSize || G.collapsible !== $.collapsible || G.maxSize !== $.maxSize || G.minSize !== $.minSize) && b(M.current, G);
86
- }), re(() => {
87
- const k = M.current;
88
- return W(k), () => {
89
- F(k);
90
- };
91
- }, [u, _, W, F]), tn(o, () => ({
92
- collapse: () => {
93
- S(M.current);
94
- },
95
- expand: (k) => {
96
- R(M.current, k);
97
- },
98
- getId() {
99
- return _;
100
- },
101
- getSize() {
102
- return N(M.current);
103
- },
104
- isCollapsed() {
105
- return C(M.current);
106
- },
107
- isExpanded() {
108
- return !C(M.current);
109
- },
110
- resize: (k) => {
111
- J(M.current, k);
112
- }
113
- }), [S, R, N, C, _, J]);
114
- const ee = H(M.current, i);
115
- return de(h, {
116
- ...I,
117
- children: e,
118
- className: n,
119
- id: _,
120
- style: {
121
- ...ee,
122
- ...x
123
- },
124
- // CSS selectors
125
- [A.groupId]: O,
126
- [A.panel]: "",
127
- [A.panelCollapsible]: r || void 0,
128
- [A.panelId]: _,
129
- [A.panelSize]: parseFloat("" + ee.flexGrow).toFixed(1)
130
- });
131
- }
132
- const ln = en((e, n) => de(on, {
133
- ...e,
134
- forwardedRef: n
135
- }));
136
- on.displayName = "Panel";
137
- ln.displayName = "forwardRef(Panel)";
138
- let Te = null, Ie = -1, Z = null;
139
- function $n(e, n) {
140
- if (n) {
141
- const t = (n & dn) !== 0, r = (n & fn) !== 0, i = (n & pn) !== 0, o = (n & gn) !== 0;
142
- if (t)
143
- return i ? "se-resize" : o ? "ne-resize" : "e-resize";
144
- if (r)
145
- return i ? "sw-resize" : o ? "nw-resize" : "w-resize";
146
- if (i)
147
- return "s-resize";
148
- if (o)
149
- return "n-resize";
150
- }
151
- switch (e) {
152
- case "horizontal":
153
- return "ew-resize";
154
- case "intersection":
155
- return "move";
156
- case "vertical":
157
- return "ns-resize";
158
- }
159
- }
160
- function kn() {
161
- Z !== null && (document.head.removeChild(Z), Te = null, Z = null, Ie = -1);
162
- }
163
- function He(e, n) {
164
- var t, r;
165
- const i = $n(e, n);
166
- if (Te !== i) {
167
- if (Te = i, Z === null && (Z = document.createElement("style"), document.head.appendChild(Z)), Ie >= 0) {
168
- var o;
169
- (o = Z.sheet) === null || o === void 0 || o.removeRule(Ie);
170
- }
171
- Ie = (t = (r = Z.sheet) === null || r === void 0 ? void 0 : r.insertRule(`*{cursor: ${i} !important;}`)) !== null && t !== void 0 ? t : -1;
172
- }
173
- }
174
- function an(e) {
175
- return e.type === "keydown";
176
- }
177
- function sn(e) {
178
- return e.type.startsWith("pointer");
179
- }
180
- function un(e) {
181
- return e.type.startsWith("mouse");
182
- }
183
- function Le(e) {
184
- if (sn(e)) {
185
- if (e.isPrimary)
186
- return {
187
- x: e.clientX,
188
- y: e.clientY
189
- };
190
- } else if (un(e))
191
- return {
192
- x: e.clientX,
193
- y: e.clientY
194
- };
195
- return {
196
- x: 1 / 0,
197
- y: 1 / 0
198
- };
199
- }
200
- function _n() {
201
- if (typeof matchMedia == "function")
202
- return matchMedia("(pointer:coarse)").matches ? "coarse" : "fine";
203
- }
204
- function Gn(e, n, t) {
205
- return e.x < n.x + n.width && e.x + e.width > n.x && e.y < n.y + n.height && e.y + e.height > n.y;
206
- }
207
- function Tn(e, n) {
208
- if (e === n) throw new Error("Cannot compare node with itself");
209
- const t = {
210
- a: Xe(e),
211
- b: Xe(n)
212
- };
213
- let r;
214
- for (; t.a.at(-1) === t.b.at(-1); )
215
- e = t.a.pop(), n = t.b.pop(), r = e;
216
- y(r, "Stacking order can only be calculated for elements with a common ancestor");
217
- const i = {
218
- a: qe(Oe(t.a)),
219
- b: qe(Oe(t.b))
220
- };
221
- if (i.a === i.b) {
222
- const o = r.childNodes, l = {
223
- a: t.a.at(-1),
224
- b: t.b.at(-1)
225
- };
226
- let a = o.length;
227
- for (; a--; ) {
228
- const s = o[a];
229
- if (s === l.a) return 1;
230
- if (s === l.b) return -1;
231
- }
232
- }
233
- return Math.sign(i.a - i.b);
234
- }
235
- const Bn = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
236
- function jn(e) {
237
- var n;
238
- const t = getComputedStyle((n = cn(e)) !== null && n !== void 0 ? n : e).display;
239
- return t === "flex" || t === "inline-flex";
240
- }
241
- function Fn(e) {
242
- const n = getComputedStyle(e);
243
- return !!(n.position === "fixed" || n.zIndex !== "auto" && (n.position !== "static" || jn(e)) || +n.opacity < 1 || "transform" in n && n.transform !== "none" || "webkitTransform" in n && n.webkitTransform !== "none" || "mixBlendMode" in n && n.mixBlendMode !== "normal" || "filter" in n && n.filter !== "none" || "webkitFilter" in n && n.webkitFilter !== "none" || "isolation" in n && n.isolation === "isolate" || Bn.test(n.willChange) || n.webkitOverflowScrolling === "touch");
244
- }
245
- function Oe(e) {
246
- let n = e.length;
247
- for (; n--; ) {
248
- const t = e[n];
249
- if (y(t, "Missing node"), Fn(t)) return t;
250
- }
251
- return null;
252
- }
253
- function qe(e) {
254
- return e && Number(getComputedStyle(e).zIndex) || 0;
255
- }
256
- function Xe(e) {
257
- const n = [];
258
- for (; e; )
259
- n.push(e), e = cn(e);
260
- return n;
261
- }
262
- function cn(e) {
263
- const {
264
- parentNode: n
265
- } = e;
266
- return n && n instanceof ShadowRoot ? n.host : n;
267
- }
268
- const dn = 1, fn = 2, pn = 4, gn = 8, Vn = _n() === "coarse";
269
- let U = [], ce = !1, Q = /* @__PURE__ */ new Map(), Ae = /* @__PURE__ */ new Map();
270
- const Se = /* @__PURE__ */ new Set();
271
- function Wn(e, n, t, r, i) {
272
- var o;
273
- const {
274
- ownerDocument: l
275
- } = n, a = {
276
- direction: t,
277
- element: n,
278
- hitAreaMargins: r,
279
- setResizeHandlerState: i
280
- }, s = (o = Q.get(l)) !== null && o !== void 0 ? o : 0;
281
- return Q.set(l, s + 1), Se.add(a), Ee(), function() {
282
- var P;
283
- Ae.delete(e), Se.delete(a);
284
- const f = (P = Q.get(l)) !== null && P !== void 0 ? P : 1;
285
- if (Q.set(l, f - 1), Ee(), f === 1 && Q.delete(l), U.includes(a)) {
286
- const u = U.indexOf(a);
287
- u >= 0 && U.splice(u, 1), Ve(), i("up", !0, null);
288
- }
289
- };
290
- }
291
- function Kn(e) {
292
- const {
293
- target: n
294
- } = e, {
295
- x: t,
296
- y: r
297
- } = Le(e);
298
- ce = !0, Fe({
299
- target: n,
300
- x: t,
301
- y: r
302
- }), Ee(), U.length > 0 && (Ce("down", e), e.preventDefault(), mn(n) || e.stopImmediatePropagation());
303
- }
304
- function $e(e) {
305
- const {
306
- x: n,
307
- y: t
308
- } = Le(e);
309
- if (ce && e.buttons === 0 && (ce = !1, Ce("up", e)), !ce) {
310
- const {
311
- target: r
312
- } = e;
313
- Fe({
314
- target: r,
315
- x: n,
316
- y: t
317
- });
318
- }
319
- Ce("move", e), Ve(), U.length > 0 && e.preventDefault();
320
- }
321
- function ke(e) {
322
- const {
323
- target: n
324
- } = e, {
325
- x: t,
326
- y: r
327
- } = Le(e);
328
- Ae.clear(), ce = !1, U.length > 0 && (e.preventDefault(), mn(n) || e.stopImmediatePropagation()), Ce("up", e), Fe({
329
- target: n,
330
- x: t,
331
- y: r
332
- }), Ve(), Ee();
333
- }
334
- function mn(e) {
335
- let n = e;
336
- for (; n; ) {
337
- if (n.hasAttribute(A.resizeHandle))
338
- return !0;
339
- n = n.parentElement;
340
- }
341
- return !1;
342
- }
343
- function Fe({
344
- target: e,
345
- x: n,
346
- y: t
347
- }) {
348
- U.splice(0);
349
- let r = null;
350
- (e instanceof HTMLElement || e instanceof SVGElement) && (r = e), Se.forEach((i) => {
351
- const {
352
- element: o,
353
- hitAreaMargins: l
354
- } = i, a = o.getBoundingClientRect(), {
355
- bottom: s,
356
- left: m,
357
- right: P,
358
- top: f
359
- } = a, u = Vn ? l.coarse : l.fine;
360
- if (n >= m - u && n <= P + u && t >= f - u && t <= s + u) {
361
- if (r !== null && document.contains(r) && o !== r && !o.contains(r) && !r.contains(o) && // Calculating stacking order has a cost, so we should avoid it if possible
362
- // That is why we only check potentially intersecting handles,
363
- // and why we skip if the event target is within the handle's DOM
364
- Tn(r, o) > 0) {
365
- let h = r, I = !1;
366
- for (; h && !h.contains(o); ) {
367
- if (Gn(h.getBoundingClientRect(), a)) {
368
- I = !0;
369
- break;
370
- }
371
- h = h.parentElement;
372
- }
373
- if (I)
374
- return;
375
- }
376
- U.push(i);
377
- }
378
- });
379
- }
380
- function _e(e, n) {
381
- Ae.set(e, n);
382
- }
383
- function Ve() {
384
- let e = !1, n = !1;
385
- U.forEach((r) => {
386
- const {
387
- direction: i
388
- } = r;
389
- i === "horizontal" ? e = !0 : n = !0;
390
- });
391
- let t = 0;
392
- Ae.forEach((r) => {
393
- t |= r;
394
- }), e && n ? He("intersection", t) : e ? He("horizontal", t) : n ? He("vertical", t) : kn();
395
- }
396
- let Ge;
397
- function Ee() {
398
- var e;
399
- (e = Ge) === null || e === void 0 || e.abort(), Ge = new AbortController();
400
- const n = {
401
- capture: !0,
402
- signal: Ge.signal
403
- };
404
- Se.size && (ce ? (U.length > 0 && Q.forEach((t, r) => {
405
- const {
406
- body: i
407
- } = r;
408
- t > 0 && (i.addEventListener("contextmenu", ke, n), i.addEventListener("pointerleave", $e, n), i.addEventListener("pointermove", $e, n));
409
- }), Q.forEach((t, r) => {
410
- const {
411
- body: i
412
- } = r;
413
- i.addEventListener("pointerup", ke, n), i.addEventListener("pointercancel", ke, n);
414
- })) : Q.forEach((t, r) => {
415
- const {
416
- body: i
417
- } = r;
418
- t > 0 && (i.addEventListener("pointerdown", Kn, n), i.addEventListener("pointermove", $e, n));
419
- }));
420
- }
421
- function Ce(e, n) {
422
- Se.forEach((t) => {
423
- const {
424
- setResizeHandlerState: r
425
- } = t, i = U.includes(t);
426
- r(e, i, n);
427
- });
428
- }
429
- function Un() {
430
- const [e, n] = ue(0);
431
- return B(() => n((t) => t + 1), []);
432
- }
433
- function y(e, n) {
434
- if (!e)
435
- throw console.error(n), Error(n);
436
- }
437
- function oe(e, n, t = Be) {
438
- return e.toFixed(t) === n.toFixed(t) ? 0 : e > n ? 1 : -1;
439
- }
440
- function Y(e, n, t = Be) {
441
- return oe(e, n, t) === 0;
442
- }
443
- function V(e, n, t) {
444
- return oe(e, n, t) === 0;
445
- }
446
- function On(e, n, t) {
447
- if (e.length !== n.length)
448
- return !1;
449
- for (let r = 0; r < e.length; r++) {
450
- const i = e[r], o = n[r];
451
- if (!V(i, o, t))
452
- return !1;
453
- }
454
- return !0;
455
- }
456
- function se({
457
- panelConstraints: e,
458
- panelIndex: n,
459
- size: t
460
- }) {
461
- const r = e[n];
462
- y(r != null, `Panel constraints not found for index ${n}`);
463
- let {
464
- collapsedSize: i = 0,
465
- collapsible: o,
466
- maxSize: l = 100,
467
- minSize: a = 0
468
- } = r;
469
- if (oe(t, a) < 0)
470
- if (o) {
471
- const s = (i + a) / 2;
472
- oe(t, s) < 0 ? t = i : t = a;
473
- } else
474
- t = a;
475
- return t = Math.min(l, t), t = parseFloat(t.toFixed(Be)), t;
476
- }
477
- function ye({
478
- delta: e,
479
- initialLayout: n,
480
- panelConstraints: t,
481
- pivotIndices: r,
482
- prevLayout: i,
483
- trigger: o
484
- }) {
485
- if (V(e, 0))
486
- return n;
487
- const l = [...n], [a, s] = r;
488
- y(a != null, "Invalid first pivot index"), y(s != null, "Invalid second pivot index");
489
- let m = 0;
490
- if (o === "keyboard") {
491
- {
492
- const f = e < 0 ? s : a, u = t[f];
493
- y(u, `Panel constraints not found for index ${f}`);
494
- const {
495
- collapsedSize: x = 0,
496
- collapsible: h,
497
- minSize: I = 0
498
- } = u;
499
- if (h) {
500
- const w = n[f];
501
- if (y(w != null, `Previous layout not found for panel index ${f}`), V(w, x)) {
502
- const S = I - w;
503
- oe(S, Math.abs(e)) > 0 && (e = e < 0 ? 0 - S : S);
504
- }
505
- }
506
- }
507
- {
508
- const f = e < 0 ? a : s, u = t[f];
509
- y(u, `No panel constraints found for index ${f}`);
510
- const {
511
- collapsedSize: x = 0,
512
- collapsible: h,
513
- minSize: I = 0
514
- } = u;
515
- if (h) {
516
- const w = n[f];
517
- if (y(w != null, `Previous layout not found for panel index ${f}`), V(w, I)) {
518
- const S = w - x;
519
- oe(S, Math.abs(e)) > 0 && (e = e < 0 ? 0 - S : S);
520
- }
521
- }
522
- }
523
- }
524
- {
525
- const f = e < 0 ? 1 : -1;
526
- let u = e < 0 ? s : a, x = 0;
527
- for (; ; ) {
528
- const I = n[u];
529
- y(I != null, `Previous layout not found for panel index ${u}`);
530
- const S = se({
531
- panelConstraints: t,
532
- panelIndex: u,
533
- size: 100
534
- }) - I;
535
- if (x += S, u += f, u < 0 || u >= t.length)
536
- break;
537
- }
538
- const h = Math.min(Math.abs(e), Math.abs(x));
539
- e = e < 0 ? 0 - h : h;
540
- }
541
- {
542
- let u = e < 0 ? a : s;
543
- for (; u >= 0 && u < t.length; ) {
544
- const x = Math.abs(e) - Math.abs(m), h = n[u];
545
- y(h != null, `Previous layout not found for panel index ${u}`);
546
- const I = h - x, w = se({
547
- panelConstraints: t,
548
- panelIndex: u,
549
- size: I
550
- });
551
- if (!V(h, w) && (m += h - w, l[u] = w, m.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3), void 0, {
552
- numeric: !0
553
- }) >= 0))
554
- break;
555
- e < 0 ? u-- : u++;
556
- }
557
- }
558
- if (On(i, l))
559
- return i;
560
- {
561
- const f = e < 0 ? s : a, u = n[f];
562
- y(u != null, `Previous layout not found for panel index ${f}`);
563
- const x = u + m, h = se({
564
- panelConstraints: t,
565
- panelIndex: f,
566
- size: x
567
- });
568
- if (l[f] = h, !V(h, x)) {
569
- let I = x - h, S = e < 0 ? s : a;
570
- for (; S >= 0 && S < t.length; ) {
571
- const R = l[S];
572
- y(R != null, `Previous layout not found for panel index ${S}`);
573
- const N = R + I, H = se({
574
- panelConstraints: t,
575
- panelIndex: S,
576
- size: N
577
- });
578
- if (V(R, H) || (I -= H - R, l[S] = H), V(I, 0))
579
- break;
580
- e > 0 ? S-- : S++;
581
- }
582
- }
583
- }
584
- const P = l.reduce((f, u) => u + f, 0);
585
- return V(P, 100) ? l : i;
586
- }
587
- function qn({
588
- layout: e,
589
- panelsArray: n,
590
- pivotIndices: t
591
- }) {
592
- let r = 0, i = 100, o = 0, l = 0;
593
- const a = t[0];
594
- y(a != null, "No pivot index found"), n.forEach((f, u) => {
595
- const {
596
- constraints: x
597
- } = f, {
598
- maxSize: h = 100,
599
- minSize: I = 0
600
- } = x;
601
- u === a ? (r = I, i = h) : (o += I, l += h);
602
- });
603
- const s = Math.min(i, 100 - o), m = Math.max(r, 100 - l), P = e[a];
604
- return {
605
- valueMax: s,
606
- valueMin: m,
607
- valueNow: P
608
- };
609
- }
610
- function be(e, n = document) {
611
- return Array.from(n.querySelectorAll(`[${A.resizeHandleId}][data-panel-group-id="${e}"]`));
612
- }
613
- function hn(e, n, t = document) {
614
- const i = be(e, t).findIndex((o) => o.getAttribute(A.resizeHandleId) === n);
615
- return i ?? null;
616
- }
617
- function zn(e, n, t) {
618
- const r = hn(e, n, t);
619
- return r != null ? [r, r + 1] : [-1, -1];
620
- }
621
- function Xn(e) {
622
- return e instanceof HTMLElement ? !0 : typeof e == "object" && e !== null && "tagName" in e && "getAttribute" in e;
623
- }
624
- function yn(e, n = document) {
625
- if (Xn(n) && n.dataset.panelGroupId == e)
626
- return n;
627
- const t = n.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);
628
- return t || null;
629
- }
630
- function Me(e, n = document) {
631
- const t = n.querySelector(`[${A.resizeHandleId}="${e}"]`);
632
- return t || null;
633
- }
634
- function Jn(e, n, t, r = document) {
635
- var i, o, l, a;
636
- const s = Me(n, r), m = be(e, r), P = s ? m.indexOf(s) : -1, f = (i = (o = t[P]) === null || o === void 0 ? void 0 : o.id) !== null && i !== void 0 ? i : null, u = (l = (a = t[P + 1]) === null || a === void 0 ? void 0 : a.id) !== null && l !== void 0 ? l : null;
637
- return [f, u];
638
- }
639
- function Yn({
640
- committedValuesRef: e,
641
- eagerValuesRef: n,
642
- groupId: t,
643
- layout: r,
644
- panelDataArray: i,
645
- panelGroupElement: o,
646
- setLayout: l
647
- }) {
648
- j({
649
- didWarnAboutMissingResizeHandle: !1
650
- }), re(() => {
651
- if (!o)
652
- return;
653
- const a = be(t, o);
654
- for (let s = 0; s < i.length - 1; s++) {
655
- const {
656
- valueMax: m,
657
- valueMin: P,
658
- valueNow: f
659
- } = qn({
660
- layout: r,
661
- panelsArray: i,
662
- pivotIndices: [s, s + 1]
663
- }), u = a[s];
664
- if (u != null) {
665
- const x = i[s];
666
- y(x, `No panel data found for index "${s}"`), u.setAttribute("aria-controls", x.id), u.setAttribute("aria-valuemax", "" + Math.round(m)), u.setAttribute("aria-valuemin", "" + Math.round(P)), u.setAttribute("aria-valuenow", f != null ? "" + Math.round(f) : "");
667
- }
668
- }
669
- return () => {
670
- a.forEach((s, m) => {
671
- s.removeAttribute("aria-controls"), s.removeAttribute("aria-valuemax"), s.removeAttribute("aria-valuemin"), s.removeAttribute("aria-valuenow");
672
- });
673
- };
674
- }, [t, r, i, o]), te(() => {
675
- if (!o)
676
- return;
677
- const a = n.current;
678
- y(a, "Eager values not found");
679
- const {
680
- panelDataArray: s
681
- } = a, m = yn(t, o);
682
- y(m != null, `No group found for id "${t}"`);
683
- const P = be(t, o);
684
- y(P, `No resize handles found for group id "${t}"`);
685
- const f = P.map((u) => {
686
- const x = u.getAttribute(A.resizeHandleId);
687
- y(x, "Resize handle element has no handle id attribute");
688
- const [h, I] = Jn(t, x, s, o);
689
- if (h == null || I == null)
690
- return () => {
691
- };
692
- const w = (S) => {
693
- if (!S.defaultPrevented)
694
- switch (S.key) {
695
- case "Enter": {
696
- S.preventDefault();
697
- const R = s.findIndex((N) => N.id === h);
698
- if (R >= 0) {
699
- const N = s[R];
700
- y(N, `No panel data found for index ${R}`);
701
- const H = r[R], {
702
- collapsedSize: O = 0,
703
- collapsible: C,
704
- minSize: b = 0
705
- } = N.constraints;
706
- if (H != null && C) {
707
- const W = ye({
708
- delta: V(H, O) ? b - O : O - H,
709
- initialLayout: r,
710
- panelConstraints: s.map((J) => J.constraints),
711
- pivotIndices: zn(t, x, o),
712
- prevLayout: r,
713
- trigger: "keyboard"
714
- });
715
- r !== W && l(W);
716
- }
717
- }
718
- break;
719
- }
720
- }
721
- };
722
- return u.addEventListener("keydown", w), () => {
723
- u.removeEventListener("keydown", w);
724
- };
725
- });
726
- return () => {
727
- f.forEach((u) => u());
728
- };
729
- }, [o, e, n, t, r, i, l]);
730
- }
731
- function Je(e, n) {
732
- if (e.length !== n.length)
733
- return !1;
734
- for (let t = 0; t < e.length; t++)
735
- if (e[t] !== n[t])
736
- return !1;
737
- return !0;
738
- }
739
- function xn(e, n) {
740
- const t = e === "horizontal", {
741
- x: r,
742
- y: i
743
- } = Le(n);
744
- return t ? r : i;
745
- }
746
- function Zn(e, n, t, r, i) {
747
- const o = t === "horizontal", l = Me(n, i);
748
- y(l, `No resize handle element found for id "${n}"`);
749
- const a = l.getAttribute(A.groupId);
750
- y(a, "Resize handle element has no group id attribute");
751
- let {
752
- initialCursorPosition: s
753
- } = r;
754
- const m = xn(t, e), P = yn(a, i);
755
- y(P, `No group element found for id "${a}"`);
756
- const f = P.getBoundingClientRect(), u = o ? f.width : f.height;
757
- return (m - s) / u * 100;
758
- }
759
- function Qn(e, n, t, r, i, o) {
760
- if (an(e)) {
761
- const l = t === "horizontal";
762
- let a = 0;
763
- e.shiftKey ? a = 100 : i != null ? a = i : a = 10;
764
- let s = 0;
765
- switch (e.key) {
766
- case "ArrowDown":
767
- s = l ? 0 : a;
768
- break;
769
- case "ArrowLeft":
770
- s = l ? -a : 0;
771
- break;
772
- case "ArrowRight":
773
- s = l ? a : 0;
774
- break;
775
- case "ArrowUp":
776
- s = l ? 0 : -a;
777
- break;
778
- case "End":
779
- s = 100;
780
- break;
781
- case "Home":
782
- s = -100;
783
- break;
784
- }
785
- return s;
786
- } else
787
- return r == null ? 0 : Zn(e, n, t, r, o);
788
- }
789
- function et({
790
- panelDataArray: e
791
- }) {
792
- const n = Array(e.length), t = e.map((o) => o.constraints);
793
- let r = 0, i = 100;
794
- for (let o = 0; o < e.length; o++) {
795
- const l = t[o];
796
- y(l, `Panel constraints not found for index ${o}`);
797
- const {
798
- defaultSize: a
799
- } = l;
800
- a != null && (r++, n[o] = a, i -= a);
801
- }
802
- for (let o = 0; o < e.length; o++) {
803
- const l = t[o];
804
- y(l, `Panel constraints not found for index ${o}`);
805
- const {
806
- defaultSize: a
807
- } = l;
808
- if (a != null)
809
- continue;
810
- const s = e.length - r, m = i / s;
811
- r++, n[o] = m, i -= m;
812
- }
813
- return n;
814
- }
815
- function le(e, n, t) {
816
- n.forEach((r, i) => {
817
- const o = e[i];
818
- y(o, `Panel data not found for index ${i}`);
819
- const {
820
- callbacks: l,
821
- constraints: a,
822
- id: s
823
- } = o, {
824
- collapsedSize: m = 0,
825
- collapsible: P
826
- } = a, f = t[s];
827
- if (f == null || r !== f) {
828
- t[s] = r;
829
- const {
830
- onCollapse: u,
831
- onExpand: x,
832
- onResize: h
833
- } = l;
834
- h && h(r, f), P && (u || x) && (x && (f == null || Y(f, m)) && !Y(r, m) && x(), u && (f == null || !Y(f, m)) && Y(r, m) && u());
835
- }
836
- });
837
- }
838
- function we(e, n) {
839
- if (e.length !== n.length)
840
- return !1;
841
- for (let t = 0; t < e.length; t++)
842
- if (e[t] != n[t])
843
- return !1;
844
- return !0;
845
- }
846
- function nt({
847
- defaultSize: e,
848
- dragState: n,
849
- layout: t,
850
- panelData: r,
851
- panelIndex: i,
852
- precision: o = 3
853
- }) {
854
- const l = t[i];
855
- let a;
856
- return l == null ? a = e != null ? e.toPrecision(o) : "1" : r.length === 1 ? a = "1" : a = l.toPrecision(o), {
857
- flexBasis: 0,
858
- flexGrow: a,
859
- flexShrink: 1,
860
- // Without this, Panel sizes may be unintentionally overridden by their content
861
- overflow: "hidden",
862
- // Disable pointer events inside of a panel during resize
863
- // This avoid edge cases like nested iframes
864
- pointerEvents: n !== null ? "none" : void 0
865
- };
866
- }
867
- function tt(e, n = 10) {
868
- let t = null;
869
- return (...i) => {
870
- t !== null && clearTimeout(t), t = setTimeout(() => {
871
- e(...i);
872
- }, n);
873
- };
874
- }
875
- function Ye(e) {
876
- try {
877
- if (typeof localStorage < "u")
878
- e.getItem = (n) => localStorage.getItem(n), e.setItem = (n, t) => {
879
- localStorage.setItem(n, t);
880
- };
881
- else
882
- throw new Error("localStorage not supported in this environment");
883
- } catch (n) {
884
- console.error(n), e.getItem = () => null, e.setItem = () => {
885
- };
886
- }
887
- }
888
- function vn(e) {
889
- return `react-resizable-panels:${e}`;
890
- }
891
- function Sn(e) {
892
- return e.map((n) => {
893
- const {
894
- constraints: t,
895
- id: r,
896
- idIsFromProps: i,
897
- order: o
898
- } = n;
899
- return i ? r : o ? `${o}:${JSON.stringify(t)}` : JSON.stringify(t);
900
- }).sort((n, t) => n.localeCompare(t)).join(",");
901
- }
902
- function bn(e, n) {
903
- try {
904
- const t = vn(e), r = n.getItem(t);
905
- if (r) {
906
- const i = JSON.parse(r);
907
- if (typeof i == "object" && i != null)
908
- return i;
909
- }
910
- } catch {
911
- }
912
- return null;
913
- }
914
- function rt(e, n, t) {
915
- var r, i;
916
- const o = (r = bn(e, t)) !== null && r !== void 0 ? r : {}, l = Sn(n);
917
- return (i = o[l]) !== null && i !== void 0 ? i : null;
918
- }
919
- function ot(e, n, t, r, i) {
920
- var o;
921
- const l = vn(e), a = Sn(n), s = (o = bn(e, i)) !== null && o !== void 0 ? o : {};
922
- s[a] = {
923
- expandToSizes: Object.fromEntries(t.entries()),
924
- layout: r
925
- };
926
- try {
927
- i.setItem(l, JSON.stringify(s));
928
- } catch (m) {
929
- console.error(m);
930
- }
931
- }
932
- function Ze({
933
- layout: e,
934
- panelConstraints: n
935
- }) {
936
- const t = [...e], r = t.reduce((o, l) => o + l, 0);
937
- if (t.length !== n.length)
938
- throw Error(`Invalid ${n.length} panel layout: ${t.map((o) => `${o}%`).join(", ")}`);
939
- if (!V(r, 100) && t.length > 0)
940
- for (let o = 0; o < n.length; o++) {
941
- const l = t[o];
942
- y(l != null, `No layout data found for index ${o}`);
943
- const a = 100 / r * l;
944
- t[o] = a;
945
- }
946
- let i = 0;
947
- for (let o = 0; o < n.length; o++) {
948
- const l = t[o];
949
- y(l != null, `No layout data found for index ${o}`);
950
- const a = se({
951
- panelConstraints: n,
952
- panelIndex: o,
953
- size: l
954
- });
955
- l != a && (i += l - a, t[o] = a);
956
- }
957
- if (!V(i, 0))
958
- for (let o = 0; o < n.length; o++) {
959
- const l = t[o];
960
- y(l != null, `No layout data found for index ${o}`);
961
- const a = l + i, s = se({
962
- panelConstraints: n,
963
- panelIndex: o,
964
- size: a
965
- });
966
- if (l !== s && (i -= s - l, t[o] = s, V(i, 0)))
967
- break;
968
- }
969
- return t;
970
- }
971
- const it = 100, xe = {
972
- getItem: (e) => (Ye(xe), xe.getItem(e)),
973
- setItem: (e, n) => {
974
- Ye(xe), xe.setItem(e, n);
975
- }
976
- }, Qe = {};
977
- function Pn({
978
- autoSaveId: e = null,
979
- children: n,
980
- className: t = "",
981
- direction: r,
982
- forwardedRef: i,
983
- id: o = null,
984
- onLayout: l = null,
985
- keyboardResizeBy: a = null,
986
- storage: s = xe,
987
- style: m,
988
- tagName: P = "div",
989
- ...f
990
- }) {
991
- const u = je(o), x = j(null), [h, I] = ue(null), [w, S] = ue([]), R = Un(), N = j({}), H = j(/* @__PURE__ */ new Map()), O = j(0), C = j({
992
- autoSaveId: e,
993
- direction: r,
994
- dragState: h,
995
- id: u,
996
- keyboardResizeBy: a,
997
- onLayout: l,
998
- storage: s
999
- }), b = j({
1000
- layout: w,
1001
- panelDataArray: [],
1002
- panelDataArrayChanged: !1
1003
- });
1004
- j({
1005
- didLogIdAndOrderWarning: !1,
1006
- didLogPanelConstraintsWarning: !1,
1007
- prevPanelIds: []
1008
- }), tn(i, () => ({
1009
- getId: () => C.current.id,
1010
- getLayout: () => {
1011
- const {
1012
- layout: c
1013
- } = b.current;
1014
- return c;
1015
- },
1016
- setLayout: (c) => {
1017
- const {
1018
- onLayout: g
1019
- } = C.current, {
1020
- layout: v,
1021
- panelDataArray: p
1022
- } = b.current, d = Ze({
1023
- layout: c,
1024
- panelConstraints: p.map((z) => z.constraints)
1025
- });
1026
- Je(v, d) || (S(d), b.current.layout = d, g && g(d), le(p, d, N.current));
1027
- }
1028
- }), []), re(() => {
1029
- C.current.autoSaveId = e, C.current.direction = r, C.current.dragState = h, C.current.id = u, C.current.onLayout = l, C.current.storage = s;
1030
- }), Yn({
1031
- committedValuesRef: C,
1032
- eagerValuesRef: b,
1033
- groupId: u,
1034
- layout: w,
1035
- panelDataArray: b.current.panelDataArray,
1036
- setLayout: S,
1037
- panelGroupElement: x.current
1038
- }), te(() => {
1039
- const {
1040
- panelDataArray: c
1041
- } = b.current;
1042
- if (e) {
1043
- if (w.length === 0 || w.length !== c.length)
1044
- return;
1045
- let g = Qe[e];
1046
- g == null && (g = tt(ot, it), Qe[e] = g);
1047
- const v = [...c], p = new Map(H.current);
1048
- g(e, v, p, w, s);
1049
- }
1050
- }, [e, w, s]), te(() => {
1051
- });
1052
- const W = B((c) => {
1053
- const {
1054
- onLayout: g
1055
- } = C.current, {
1056
- layout: v,
1057
- panelDataArray: p
1058
- } = b.current;
1059
- if (c.constraints.collapsible) {
1060
- const d = p.map((q) => q.constraints), {
1061
- collapsedSize: z = 0,
1062
- panelSize: E,
1063
- pivotIndices: D
1064
- } = ne(p, c, v);
1065
- if (y(E != null, `Panel size not found for panel "${c.id}"`), !Y(E, z)) {
1066
- H.current.set(c.id, E);
1067
- const X = ae(p, c) === p.length - 1 ? E - z : z - E, L = ye({
1068
- delta: X,
1069
- initialLayout: v,
1070
- panelConstraints: d,
1071
- pivotIndices: D,
1072
- prevLayout: v,
1073
- trigger: "imperative-api"
1074
- });
1075
- we(v, L) || (S(L), b.current.layout = L, g && g(L), le(p, L, N.current));
1076
- }
1077
- }
1078
- }, []), J = B((c, g) => {
1079
- const {
1080
- onLayout: v
1081
- } = C.current, {
1082
- layout: p,
1083
- panelDataArray: d
1084
- } = b.current;
1085
- if (c.constraints.collapsible) {
1086
- const z = d.map((K) => K.constraints), {
1087
- collapsedSize: E = 0,
1088
- panelSize: D = 0,
1089
- minSize: q = 0,
1090
- pivotIndices: X
1091
- } = ne(d, c, p), L = g ?? q;
1092
- if (Y(D, E)) {
1093
- const K = H.current.get(c.id), he = K != null && K >= L ? K : L, De = ae(d, c) === d.length - 1 ? D - he : he - D, T = ye({
1094
- delta: De,
1095
- initialLayout: p,
1096
- panelConstraints: z,
1097
- pivotIndices: X,
1098
- prevLayout: p,
1099
- trigger: "imperative-api"
1100
- });
1101
- we(p, T) || (S(T), b.current.layout = T, v && v(T), le(d, T, N.current));
1102
- }
1103
- }
1104
- }, []), F = B((c) => {
1105
- const {
1106
- layout: g,
1107
- panelDataArray: v
1108
- } = b.current, {
1109
- panelSize: p
1110
- } = ne(v, c, g);
1111
- return y(p != null, `Panel size not found for panel "${c.id}"`), p;
1112
- }, []), _ = B((c, g) => {
1113
- const {
1114
- panelDataArray: v
1115
- } = b.current, p = ae(v, c);
1116
- return nt({
1117
- defaultSize: g,
1118
- dragState: h,
1119
- layout: w,
1120
- panelData: v,
1121
- panelIndex: p
1122
- });
1123
- }, [h, w]), M = B((c) => {
1124
- const {
1125
- layout: g,
1126
- panelDataArray: v
1127
- } = b.current, {
1128
- collapsedSize: p = 0,
1129
- collapsible: d,
1130
- panelSize: z
1131
- } = ne(v, c, g);
1132
- return y(z != null, `Panel size not found for panel "${c.id}"`), d === !0 && Y(z, p);
1133
- }, []), ee = B((c) => {
1134
- const {
1135
- layout: g,
1136
- panelDataArray: v
1137
- } = b.current, {
1138
- collapsedSize: p = 0,
1139
- collapsible: d,
1140
- panelSize: z
1141
- } = ne(v, c, g);
1142
- return y(z != null, `Panel size not found for panel "${c.id}"`), !d || oe(z, p) > 0;
1143
- }, []), k = B((c) => {
1144
- const {
1145
- panelDataArray: g
1146
- } = b.current;
1147
- g.push(c), g.sort((v, p) => {
1148
- const d = v.order, z = p.order;
1149
- return d == null && z == null ? 0 : d == null ? -1 : z == null ? 1 : d - z;
1150
- }), b.current.panelDataArrayChanged = !0, R();
1151
- }, [R]);
1152
- re(() => {
1153
- if (b.current.panelDataArrayChanged) {
1154
- b.current.panelDataArrayChanged = !1;
1155
- const {
1156
- autoSaveId: c,
1157
- onLayout: g,
1158
- storage: v
1159
- } = C.current, {
1160
- layout: p,
1161
- panelDataArray: d
1162
- } = b.current;
1163
- let z = null;
1164
- if (c) {
1165
- const D = rt(c, d, v);
1166
- D && (H.current = new Map(Object.entries(D.expandToSizes)), z = D.layout);
1167
- }
1168
- z == null && (z = et({
1169
- panelDataArray: d
1170
- }));
1171
- const E = Ze({
1172
- layout: z,
1173
- panelConstraints: d.map((D) => D.constraints)
1174
- });
1175
- Je(p, E) || (S(E), b.current.layout = E, g && g(E), le(d, E, N.current));
1176
- }
1177
- }), re(() => {
1178
- const c = b.current;
1179
- return () => {
1180
- c.layout = [];
1181
- };
1182
- }, []);
1183
- const $ = B((c) => {
1184
- let g = !1;
1185
- const v = x.current;
1186
- return v && window.getComputedStyle(v, null).getPropertyValue("direction") === "rtl" && (g = !0), function(d) {
1187
- d.preventDefault();
1188
- const z = x.current;
1189
- if (!z)
1190
- return () => null;
1191
- const {
1192
- direction: E,
1193
- dragState: D,
1194
- id: q,
1195
- keyboardResizeBy: X,
1196
- onLayout: L
1197
- } = C.current, {
1198
- layout: K,
1199
- panelDataArray: he
1200
- } = b.current, {
1201
- initialLayout: Pe
1202
- } = D ?? {}, De = zn(q, c, z);
1203
- let T = Qn(d, c, E, D, X, z);
1204
- const We = E === "horizontal";
1205
- We && g && (T = -T);
1206
- const En = he.map((Cn) => Cn.constraints), ze = ye({
1207
- delta: T,
1208
- initialLayout: Pe ?? K,
1209
- panelConstraints: En,
1210
- pivotIndices: De,
1211
- prevLayout: K,
1212
- trigger: an(d) ? "keyboard" : "mouse-or-touch"
1213
- }), Ke = !we(K, ze);
1214
- (sn(d) || un(d)) && O.current != T && (O.current = T, !Ke && T !== 0 ? We ? _e(c, T < 0 ? dn : fn) : _e(c, T < 0 ? pn : gn) : _e(c, 0)), Ke && (S(ze), b.current.layout = ze, L && L(ze), le(he, ze, N.current));
1215
- };
1216
- }, []), G = B((c, g) => {
1217
- const {
1218
- onLayout: v
1219
- } = C.current, {
1220
- layout: p,
1221
- panelDataArray: d
1222
- } = b.current, z = d.map((K) => K.constraints), {
1223
- panelSize: E,
1224
- pivotIndices: D
1225
- } = ne(d, c, p);
1226
- y(E != null, `Panel size not found for panel "${c.id}"`);
1227
- const X = ae(d, c) === d.length - 1 ? E - g : g - E, L = ye({
1228
- delta: X,
1229
- initialLayout: p,
1230
- panelConstraints: z,
1231
- pivotIndices: D,
1232
- prevLayout: p,
1233
- trigger: "imperative-api"
1234
- });
1235
- we(p, L) || (S(L), b.current.layout = L, v && v(L), le(d, L, N.current));
1236
- }, []), fe = B((c, g) => {
1237
- const {
1238
- layout: v,
1239
- panelDataArray: p
1240
- } = b.current, {
1241
- collapsedSize: d = 0,
1242
- collapsible: z
1243
- } = g, {
1244
- collapsedSize: E = 0,
1245
- collapsible: D,
1246
- maxSize: q = 100,
1247
- minSize: X = 0
1248
- } = c.constraints, {
1249
- panelSize: L
1250
- } = ne(p, c, v);
1251
- L != null && (z && D && Y(L, d) ? Y(d, E) || G(c, E) : L < X ? G(c, X) : L > q && G(c, q));
1252
- }, [G]), pe = B((c, g) => {
1253
- const {
1254
- direction: v
1255
- } = C.current, {
1256
- layout: p
1257
- } = b.current;
1258
- if (!x.current)
1259
- return;
1260
- const d = Me(c, x.current);
1261
- y(d, `Drag handle element not found for id "${c}"`);
1262
- const z = xn(v, g);
1263
- I({
1264
- dragHandleId: c,
1265
- dragHandleRect: d.getBoundingClientRect(),
1266
- initialCursorPosition: z,
1267
- initialLayout: p
1268
- });
1269
- }, []), ge = B(() => {
1270
- I(null);
1271
- }, []), Ne = B((c) => {
1272
- const {
1273
- panelDataArray: g
1274
- } = b.current, v = ae(g, c);
1275
- v >= 0 && (g.splice(v, 1), delete N.current[c.id], b.current.panelDataArrayChanged = !0, R());
1276
- }, [R]), ie = Mn(() => ({
1277
- collapsePanel: W,
1278
- direction: r,
1279
- dragState: h,
1280
- expandPanel: J,
1281
- getPanelSize: F,
1282
- getPanelStyle: _,
1283
- groupId: u,
1284
- isPanelCollapsed: M,
1285
- isPanelExpanded: ee,
1286
- reevaluatePanelConstraints: fe,
1287
- registerPanel: k,
1288
- registerResizeHandle: $,
1289
- resizePanel: G,
1290
- startDragging: pe,
1291
- stopDragging: ge,
1292
- unregisterPanel: Ne,
1293
- panelGroupElement: x.current
1294
- }), [W, h, r, J, F, _, u, M, ee, fe, k, $, G, pe, ge, Ne]), me = {
1295
- display: "flex",
1296
- flexDirection: r === "horizontal" ? "row" : "column",
1297
- height: "100%",
1298
- overflow: "hidden",
1299
- width: "100%"
1300
- };
1301
- return de(Re.Provider, {
1302
- value: ie
1303
- }, de(P, {
1304
- ...f,
1305
- children: n,
1306
- className: t,
1307
- id: o,
1308
- ref: x,
1309
- style: {
1310
- ...me,
1311
- ...m
1312
- },
1313
- // CSS selectors
1314
- [A.group]: "",
1315
- [A.groupDirection]: r,
1316
- [A.groupId]: u
1317
- }));
1318
- }
1319
- const wn = en((e, n) => de(Pn, {
1320
- ...e,
1321
- forwardedRef: n
1322
- }));
1323
- Pn.displayName = "PanelGroup";
1324
- wn.displayName = "forwardRef(PanelGroup)";
1325
- function ae(e, n) {
1326
- return e.findIndex((t) => t === n || t.id === n.id);
1327
- }
1328
- function ne(e, n, t) {
1329
- const r = ae(e, n), o = r === e.length - 1 ? [r - 1, r] : [r, r + 1], l = t[r];
1330
- return {
1331
- ...n.constraints,
1332
- panelSize: l,
1333
- pivotIndices: o
1334
- };
1335
- }
1336
- function lt({
1337
- disabled: e,
1338
- handleId: n,
1339
- resizeHandler: t,
1340
- panelGroupElement: r
1341
- }) {
1342
- te(() => {
1343
- if (e || t == null || r == null)
1344
- return;
1345
- const i = Me(n, r);
1346
- if (i == null)
1347
- return;
1348
- const o = (l) => {
1349
- if (!l.defaultPrevented)
1350
- switch (l.key) {
1351
- case "ArrowDown":
1352
- case "ArrowLeft":
1353
- case "ArrowRight":
1354
- case "ArrowUp":
1355
- case "End":
1356
- case "Home": {
1357
- l.preventDefault(), t(l);
1358
- break;
1359
- }
1360
- case "F6": {
1361
- l.preventDefault();
1362
- const a = i.getAttribute(A.groupId);
1363
- y(a, `No group element found for id "${a}"`);
1364
- const s = be(a, r), m = hn(a, n, r);
1365
- y(m !== null, `No resize element found for id "${n}"`);
1366
- const P = l.shiftKey ? m > 0 ? m - 1 : s.length - 1 : m + 1 < s.length ? m + 1 : 0;
1367
- s[P].focus();
1368
- break;
1369
- }
1370
- }
1371
- };
1372
- return i.addEventListener("keydown", o), () => {
1373
- i.removeEventListener("keydown", o);
1374
- };
1375
- }, [r, e, n, t]);
1376
- }
1377
- function In({
1378
- children: e = null,
1379
- className: n = "",
1380
- disabled: t = !1,
1381
- hitAreaMargins: r,
1382
- id: i,
1383
- onBlur: o,
1384
- onClick: l,
1385
- onDragging: a,
1386
- onFocus: s,
1387
- onPointerDown: m,
1388
- onPointerUp: P,
1389
- style: f = {},
1390
- tabIndex: u = 0,
1391
- tagName: x = "div",
1392
- ...h
1393
- }) {
1394
- var I, w;
1395
- const S = j(null), R = j({
1396
- onClick: l,
1397
- onDragging: a,
1398
- onPointerDown: m,
1399
- onPointerUp: P
1400
- });
1401
- te(() => {
1402
- R.current.onClick = l, R.current.onDragging = a, R.current.onPointerDown = m, R.current.onPointerUp = P;
1403
- });
1404
- const N = nn(Re);
1405
- if (N === null)
1406
- throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");
1407
- const {
1408
- direction: H,
1409
- groupId: O,
1410
- registerResizeHandle: C,
1411
- startDragging: b,
1412
- stopDragging: W,
1413
- panelGroupElement: J
1414
- } = N, F = je(i), [_, M] = ue("inactive"), [ee, k] = ue(!1), [$, G] = ue(null), fe = j({
1415
- state: _
1416
- });
1417
- re(() => {
1418
- fe.current.state = _;
1419
- }), te(() => {
1420
- if (t)
1421
- G(null);
1422
- else {
1423
- const ie = C(F);
1424
- G(() => ie);
1425
- }
1426
- }, [t, F, C]);
1427
- const pe = (I = r?.coarse) !== null && I !== void 0 ? I : 15, ge = (w = r?.fine) !== null && w !== void 0 ? w : 5;
1428
- return te(() => {
1429
- if (t || $ == null)
1430
- return;
1431
- const ie = S.current;
1432
- y(ie, "Element ref not attached");
1433
- let me = !1;
1434
- return Wn(F, ie, H, {
1435
- coarse: pe,
1436
- fine: ge
1437
- }, (g, v, p) => {
1438
- if (!v) {
1439
- M("inactive");
1440
- return;
1441
- }
1442
- switch (g) {
1443
- case "down": {
1444
- M("drag"), me = !1, y(p, 'Expected event to be defined for "down" action'), b(F, p);
1445
- const {
1446
- onDragging: d,
1447
- onPointerDown: z
1448
- } = R.current;
1449
- d?.(!0), z?.();
1450
- break;
1451
- }
1452
- case "move": {
1453
- const {
1454
- state: d
1455
- } = fe.current;
1456
- me = !0, d !== "drag" && M("hover"), y(p, 'Expected event to be defined for "move" action'), $(p);
1457
- break;
1458
- }
1459
- case "up": {
1460
- M("hover"), W();
1461
- const {
1462
- onClick: d,
1463
- onDragging: z,
1464
- onPointerUp: E
1465
- } = R.current;
1466
- z?.(!1), E?.(), me || d?.();
1467
- break;
1468
- }
1469
- }
1470
- });
1471
- }, [pe, H, t, ge, C, F, $, b, W]), lt({
1472
- disabled: t,
1473
- handleId: F,
1474
- resizeHandler: $,
1475
- panelGroupElement: J
1476
- }), de(x, {
1477
- ...h,
1478
- children: e,
1479
- className: n,
1480
- id: i,
1481
- onBlur: () => {
1482
- k(!1), o?.();
1483
- },
1484
- onFocus: () => {
1485
- k(!0), s?.();
1486
- },
1487
- ref: S,
1488
- role: "separator",
1489
- style: {
1490
- ...{
1491
- touchAction: "none",
1492
- userSelect: "none"
1493
- },
1494
- ...f
1495
- },
1496
- tabIndex: u,
1497
- // CSS selectors
1498
- [A.groupDirection]: H,
1499
- [A.groupId]: O,
1500
- [A.resizeHandle]: "",
1501
- [A.resizeHandleActive]: _ === "drag" ? "pointer" : ee ? "keyboard" : void 0,
1502
- [A.resizeHandleEnabled]: !t,
1503
- [A.resizeHandleId]: F,
1504
- [A.resizeHandleState]: _
1505
- });
1506
- }
1507
- In.displayName = "PanelResizeHandle";
1508
- function dt({
1
+ import { j as a } from "../jsx-runtime-C5mzlN2N.js";
2
+ import * as t from "react-resizable-panels";
3
+ import { c as i } from "../index-CRiPKpXj.js";
4
+ import { I as n } from "../icon-component-DS1KwkwD.js";
5
+ function d({
1509
6
  className: e,
1510
- ...n
7
+ ...r
1511
8
  }) {
1512
- return /* @__PURE__ */ ve.jsx(
1513
- wn,
9
+ return /* @__PURE__ */ a.jsx(
10
+ t.PanelGroup,
1514
11
  {
1515
12
  "data-slot": "resizable-panel-group",
1516
- className: rn(
13
+ className: i(
1517
14
  "flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
1518
15
  e
1519
16
  ),
1520
- ...n
17
+ ...r
1521
18
  }
1522
19
  );
1523
20
  }
1524
- function ft({
21
+ function f({
1525
22
  ...e
1526
23
  }) {
1527
- return /* @__PURE__ */ ve.jsx(ln, { "data-slot": "resizable-panel", ...e });
24
+ return /* @__PURE__ */ a.jsx(t.Panel, { "data-slot": "resizable-panel", ...e });
1528
25
  }
1529
- function pt({
26
+ function p({
1530
27
  withHandle: e,
1531
- className: n,
1532
- ...t
28
+ className: r,
29
+ ...l
1533
30
  }) {
1534
- return /* @__PURE__ */ ve.jsx(
1535
- In,
31
+ return /* @__PURE__ */ a.jsx(
32
+ t.PanelResizeHandle,
1536
33
  {
1537
34
  "data-slot": "resizable-handle",
1538
- className: rn(
35
+ className: i(
1539
36
  "bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",
1540
- n
37
+ r
1541
38
  ),
1542
- ...t,
1543
- children: e && /* @__PURE__ */ ve.jsx("div", { className: "bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border", children: /* @__PURE__ */ ve.jsx(Nn, { iconName: "IconGripVertical", className: "size-2.5" }) })
39
+ ...l,
40
+ children: e && /* @__PURE__ */ a.jsx("div", { className: "bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border", children: /* @__PURE__ */ a.jsx(n, { iconName: "IconGripVertical", className: "size-2.5" }) })
1544
41
  }
1545
42
  );
1546
43
  }
1547
44
  export {
1548
- pt as ResizableHandle,
1549
- ft as ResizablePanel,
1550
- dt as ResizablePanelGroup
45
+ p as ResizableHandle,
46
+ f as ResizablePanel,
47
+ d as ResizablePanelGroup
1551
48
  };