react-resizable-panels 0.0.8 → 0.0.9

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.
@@ -38,6 +38,8 @@ function $ad28bce87b00c2be$export$2e2bcd8739ae039({ children: children = null ,
38
38
  const style = getPanelStyle(id);
39
39
  return /*#__PURE__*/ (0, $fpI56$jsxDEV)("div", {
40
40
  className: className,
41
+ "data-panel-id": id,
42
+ id: `data-panel-id-${id}`,
41
43
  style: style,
42
44
  children: children
43
45
  }, void 0, false, {
@@ -87,10 +89,56 @@ function $6ff1a22b27cc039d$export$af183b313c61be4f(autoSaveId, panelIds, sizes)
87
89
  }
88
90
 
89
91
 
90
- function $4b6140a59f4bd98c$export$70637efcd850e4ef(event, prevCoordinates) {
92
+ const $96f6397ae645d178$var$element = document.createElement("div");
93
+ $96f6397ae645d178$var$element.getBoundingClientRect();
94
+ function $96f6397ae645d178$export$70637efcd850e4ef(event, prevCoordinates, dimensions, direction) {
91
95
  const { screenX: prevScreenX , screenY: prevScreenY } = prevCoordinates;
96
+ const { height: height , width: width } = dimensions;
92
97
  const getMovementBetween = (current, prev)=>prev === 0 ? 0 : current - prev;
93
- if ($4b6140a59f4bd98c$export$ce897e7f0aa63661(event)) {
98
+ if ($96f6397ae645d178$export$e7bf60a870f429b0(event)) {
99
+ let movementX = 0;
100
+ let movementY = 0;
101
+ const size = direction === "horizontal" ? width : height;
102
+ const denominator = event.shiftKey ? 10 : 100;
103
+ const delta = size / denominator;
104
+ switch(event.key){
105
+ case "ArrowDown":
106
+ movementY = delta;
107
+ break;
108
+ case "ArrowLeft":
109
+ movementX = -delta;
110
+ break;
111
+ case "ArrowRight":
112
+ movementX = delta;
113
+ break;
114
+ case "ArrowUp":
115
+ movementY = -delta;
116
+ break;
117
+ case "End":
118
+ if (direction === "horizontal") movementX = size;
119
+ else movementY = size;
120
+ break;
121
+ case "Home":
122
+ if (direction === "horizontal") movementX = -size;
123
+ else movementY = -size;
124
+ break;
125
+ }
126
+ // Estimate screen X/Y to be the center of the resize handle.
127
+ // Otherwise the first mouse/touch event after a keyboard event will appear to "jump"
128
+ let screenX = 0;
129
+ let screenY = 0;
130
+ if (document.activeElement) {
131
+ const rect = document.activeElement.getBoundingClientRect();
132
+ screenX = rect.left + rect.width / 2;
133
+ screenY = rect.top + rect.height / 2;
134
+ }
135
+ return {
136
+ movementX: movementX,
137
+ movementY: movementY,
138
+ screenX: screenX,
139
+ screenY: screenY
140
+ };
141
+ } else if ($96f6397ae645d178$export$ce897e7f0aa63661(event)) {
94
142
  const firstTouch = event.touches[0];
95
143
  return {
96
144
  movementX: getMovementBetween(firstTouch.screenX, prevScreenX),
@@ -98,20 +146,223 @@ function $4b6140a59f4bd98c$export$70637efcd850e4ef(event, prevCoordinates) {
98
146
  screenX: firstTouch.screenX,
99
147
  screenY: firstTouch.screenY
100
148
  };
101
- }
102
- return {
149
+ } else if ($96f6397ae645d178$export$5107d838cdd17dee(event)) return {
103
150
  movementX: getMovementBetween(event.screenX, prevScreenX),
104
151
  movementY: getMovementBetween(event.screenY, prevScreenY),
105
152
  screenX: event.screenX,
106
153
  screenY: event.screenY
107
154
  };
155
+ else throw Error(`Unsupported event type: "${event.type}"`);
108
156
  }
109
- function $4b6140a59f4bd98c$export$ce897e7f0aa63661(event) {
157
+ function $96f6397ae645d178$export$e7bf60a870f429b0(event) {
158
+ return event.type === "keydown";
159
+ }
160
+ function $96f6397ae645d178$export$5107d838cdd17dee(event) {
161
+ return event.type === "mousemove";
162
+ }
163
+ function $96f6397ae645d178$export$ce897e7f0aa63661(event) {
110
164
  return event.type === "touchmove";
111
165
  }
112
166
 
113
167
 
114
- const $c44ee3356398c8a1$var$PRECISION = 5;
168
+ const $fc25b75732bfda27$export$d6d3992f3becc879 = 5;
169
+
170
+
171
+ function $f30c804b5fe6cc1a$export$f50bae335f53943c(panels, idBefore, idAfter, delta, prevSizes) {
172
+ if (delta === 0) return prevSizes;
173
+ const panelsArray = $f30c804b5fe6cc1a$export$a861c0ad45885494(panels);
174
+ const nextSizes = prevSizes.concat();
175
+ let deltaApplied = 0;
176
+ // A resizing panel affects the panels before or after it.
177
+ //
178
+ // A negative delta means the panel immediately after the resizer should grow/expand by decreasing its offset.
179
+ // Other panels may also need to shrink/contract (and shift) to make room, depending on the min weights.
180
+ //
181
+ // A positive delta means the panel immediately before the resizer should "expand".
182
+ // This is accomplished by shrinking/contracting (and shifting) one or more of the panels after the resizer.
183
+ let pivotId = delta < 0 ? idBefore : idAfter;
184
+ let index = panelsArray.findIndex((panel)=>panel.id === pivotId);
185
+ while(true){
186
+ const panel = panelsArray[index];
187
+ const prevSize = prevSizes[index];
188
+ const nextSize = Math.max(prevSize - Math.abs(delta), panel.minSize);
189
+ if (prevSize !== nextSize) {
190
+ deltaApplied += prevSize - nextSize;
191
+ nextSizes[index] = nextSize;
192
+ if (deltaApplied.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879)) >= delta.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879))) break;
193
+ }
194
+ if (delta < 0) {
195
+ if (--index < 0) break;
196
+ } else {
197
+ if (++index >= panelsArray.length) break;
198
+ }
199
+ }
200
+ // If we were unable to resize any of the panels panels, return the previous state.
201
+ // This will essentially bailout and ignore the "mousemove" event.
202
+ if (deltaApplied === 0) return prevSizes;
203
+ // Adjust the pivot panel before, but only by the amount that surrounding panels were able to shrink/contract.
204
+ pivotId = delta < 0 ? idAfter : idBefore;
205
+ index = panelsArray.findIndex((panel)=>panel.id === pivotId);
206
+ nextSizes[index] = prevSizes[index] + deltaApplied;
207
+ return nextSizes;
208
+ }
209
+ function $f30c804b5fe6cc1a$export$622cea445a1c5b7d(panels, id, direction, sizes, height, width) {
210
+ const panelsArray = $f30c804b5fe6cc1a$export$a861c0ad45885494(panels);
211
+ let index = panelsArray.findIndex((panel)=>panel.id === id);
212
+ if (index < 0) return 0;
213
+ let scaledOffset = 0;
214
+ for(index = index - 1; index >= 0; index--){
215
+ const panel = panelsArray[index];
216
+ scaledOffset += $f30c804b5fe6cc1a$export$31b21d0167753bb4(panels, panel.id, direction, sizes, height, width);
217
+ }
218
+ return Math.round(scaledOffset);
219
+ }
220
+ function $f30c804b5fe6cc1a$export$7361ed18ff57179e(id) {
221
+ const element = document.querySelector(`[data-panel-id="${id}"]`);
222
+ if (element) return element;
223
+ return null;
224
+ }
225
+ function $f30c804b5fe6cc1a$export$2e27d3a347680388(id) {
226
+ const element = document.querySelector(`[data-panel-resize-handle-id="${id}"]`);
227
+ if (element) return element;
228
+ return null;
229
+ }
230
+ function $f30c804b5fe6cc1a$export$96a40be80fb6c3c8(id) {
231
+ const handles = $f30c804b5fe6cc1a$export$8d0cd3c32ddc045e();
232
+ const index = handles.findIndex((handle)=>handle.getAttribute("data-panel-resize-handle-id") === id);
233
+ return index ?? null;
234
+ }
235
+ function $f30c804b5fe6cc1a$export$8d0cd3c32ddc045e() {
236
+ return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id]`));
237
+ }
238
+ function $f30c804b5fe6cc1a$export$ae14931f0a0256a3(groupId) {
239
+ return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${groupId}"]`));
240
+ }
241
+ function $f30c804b5fe6cc1a$export$68d3a33c21dfbe27(groupId, handleId, panelsArray) {
242
+ const handle = $f30c804b5fe6cc1a$export$2e27d3a347680388(handleId);
243
+ const handles = $f30c804b5fe6cc1a$export$ae14931f0a0256a3(groupId);
244
+ const index = handles.indexOf(handle);
245
+ const idBefore = panelsArray[index]?.id ?? null;
246
+ const idAfter = panelsArray[index + 1]?.id ?? null;
247
+ return [
248
+ idBefore,
249
+ idAfter
250
+ ];
251
+ }
252
+ function $f30c804b5fe6cc1a$export$a861c0ad45885494(panels) {
253
+ return Array.from(panels.values()).sort((a, b)=>a.order - b.order);
254
+ }
255
+ function $f30c804b5fe6cc1a$export$31b21d0167753bb4(panels, id, direction, sizes, height, width) {
256
+ const totalSize = direction === "horizontal" ? width : height;
257
+ if (panels.size === 1) return totalSize;
258
+ const panelsArray = $f30c804b5fe6cc1a$export$a861c0ad45885494(panels);
259
+ const index = panelsArray.findIndex((panel)=>panel.id === id);
260
+ const size = sizes[index];
261
+ if (size == null) return 0;
262
+ return Math.round(size * totalSize);
263
+ }
264
+
265
+
266
+
267
+
268
+
269
+ function $99ad02c951ec80d0$export$d9fcbe062527d159({ committedValuesRef: committedValuesRef , groupId: groupId , panels: panels , setSizes: setSizes , sizes: sizes }) {
270
+ (0, $fpI56$useEffect)(()=>{
271
+ const { direction: direction , height: height , panels: panels , width: width } = committedValuesRef.current;
272
+ const handles = (0, $f30c804b5fe6cc1a$export$ae14931f0a0256a3)(groupId);
273
+ const cleanupFunctions = handles.map((handle)=>{
274
+ const handleId = handle.getAttribute("data-panel-resize-handle-id");
275
+ const panelsArray = (0, $f30c804b5fe6cc1a$export$a861c0ad45885494)(panels);
276
+ const [idBefore, idAfter] = (0, $f30c804b5fe6cc1a$export$68d3a33c21dfbe27)(groupId, handleId, panelsArray);
277
+ if (idBefore == null || idAfter == null) return ()=>{};
278
+ const ariaValueMax = panelsArray.reduce((difference, panel)=>{
279
+ if (panel.id !== idBefore) return difference - panel.minSize;
280
+ return difference;
281
+ }, 1);
282
+ const ariaValueMin = panelsArray.find((panel)=>panel.id == idBefore)?.minSize ?? 0;
283
+ const size = (0, $f30c804b5fe6cc1a$export$31b21d0167753bb4)(panels, idBefore, direction, sizes, height, width);
284
+ const ariaValueNow = size / (direction === "horizontal" ? width : height);
285
+ handle.setAttribute("aria-valuemax", "" + Math.round(100 * ariaValueMax));
286
+ handle.setAttribute("aria-valuemin", "" + Math.round(100 * ariaValueMin));
287
+ handle.setAttribute("aria-valuenow", "" + Math.round(100 * ariaValueNow));
288
+ const onKeyDown = (event)=>{
289
+ switch(event.key){
290
+ case "Enter":
291
+ {
292
+ const index = panelsArray.findIndex((panel)=>panel.id === idBefore);
293
+ if (index >= 0) {
294
+ const panelData = panelsArray[index];
295
+ const size = sizes[index];
296
+ if (size != null) {
297
+ let delta = 0;
298
+ if (size.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879)) <= panelData.minSize.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879))) delta = direction === "horizontal" ? width : height;
299
+ else delta = -(direction === "horizontal" ? width : height);
300
+ const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(panels, idBefore, idAfter, delta, sizes);
301
+ if (sizes !== nextSizes) setSizes(nextSizes);
302
+ }
303
+ }
304
+ break;
305
+ }
306
+ }
307
+ };
308
+ handle.addEventListener("keydown", onKeyDown);
309
+ const panelBefore = (0, $f30c804b5fe6cc1a$export$7361ed18ff57179e)(idBefore);
310
+ if (panelBefore != null) handle.setAttribute("aria-controls", panelBefore.id);
311
+ return ()=>{
312
+ handle.removeAttribute("aria-valuemax");
313
+ handle.removeAttribute("aria-valuemin");
314
+ handle.removeAttribute("aria-valuenow");
315
+ handle.removeEventListener("keydown", onKeyDown);
316
+ if (panelBefore != null) handle.removeAttribute("aria-controls");
317
+ };
318
+ });
319
+ return ()=>{
320
+ cleanupFunctions.forEach((cleanupFunction)=>cleanupFunction());
321
+ };
322
+ }, [
323
+ groupId,
324
+ panels,
325
+ sizes
326
+ ]);
327
+ }
328
+ function $99ad02c951ec80d0$export$33b0bea6ac3ffb03({ disabled: disabled , handleId: handleId , resizeHandler: resizeHandler }) {
329
+ (0, $fpI56$useEffect)(()=>{
330
+ if (disabled || resizeHandler == null) return;
331
+ const handleElement = (0, $f30c804b5fe6cc1a$export$2e27d3a347680388)(handleId);
332
+ if (handleElement == null) return;
333
+ const onKeyDown = (event)=>{
334
+ switch(event.key){
335
+ case "ArrowDown":
336
+ case "ArrowLeft":
337
+ case "ArrowRight":
338
+ case "ArrowUp":
339
+ case "End":
340
+ case "Home":
341
+ resizeHandler(event);
342
+ break;
343
+ case "F6":
344
+ {
345
+ const handles = (0, $f30c804b5fe6cc1a$export$8d0cd3c32ddc045e)();
346
+ const index = (0, $f30c804b5fe6cc1a$export$96a40be80fb6c3c8)(handleId);
347
+ const nextIndex = event.shiftKey ? index > 0 ? index - 1 : handles.length - 1 : index + 1 < handles.length ? index + 1 : 0;
348
+ const nextHandle = handles[nextIndex];
349
+ nextHandle.focus();
350
+ break;
351
+ }
352
+ }
353
+ };
354
+ handleElement.addEventListener("keydown", onKeyDown);
355
+ return ()=>{
356
+ handleElement.removeEventListener("keydown", onKeyDown);
357
+ };
358
+ }, [
359
+ disabled,
360
+ handleId,
361
+ resizeHandler
362
+ ]);
363
+ }
364
+
365
+
115
366
  function $c44ee3356398c8a1$export$2e2bcd8739ae039({ autoSaveId: autoSaveId , children: children = null , className: className = "" , direction: direction , height: height , width: width }) {
116
367
  const groupId = (0, $968185313205dcfa$export$2e2bcd8739ae039)();
117
368
  const [activeHandleId, setActiveHandleId] = (0, $fpI56$useState)(null);
@@ -139,6 +390,13 @@ function $c44ee3356398c8a1$export$2e2bcd8739ae039({ autoSaveId: autoSaveId , chi
139
390
  committedValuesRef.current.sizes = sizes;
140
391
  committedValuesRef.current.width = width;
141
392
  });
393
+ (0, $99ad02c951ec80d0$export$d9fcbe062527d159)({
394
+ committedValuesRef: committedValuesRef,
395
+ groupId: groupId,
396
+ panels: panels,
397
+ setSizes: setSizes,
398
+ sizes: sizes
399
+ });
142
400
  // Once all panels have registered themselves,
143
401
  // Compute the initial sizes based on default weights.
144
402
  // This assumes that panels register during initial mount (no conditional rendering)!
@@ -151,12 +409,12 @@ function $c44ee3356398c8a1$export$2e2bcd8739ae039({ autoSaveId: autoSaveId , chi
151
409
  // default size should be restored from local storage if possible.
152
410
  let defaultSizes = undefined;
153
411
  if (autoSaveId) {
154
- const panelIds = $c44ee3356398c8a1$var$panelsMapToSortedArray(panels).map((panel)=>panel.id);
412
+ const panelIds = (0, $f30c804b5fe6cc1a$export$a861c0ad45885494)(panels).map((panel)=>panel.id);
155
413
  defaultSizes = (0, $6ff1a22b27cc039d$export$9c80c6617f0386da)(autoSaveId, panelIds);
156
414
  }
157
415
  if (defaultSizes != null) setSizes(defaultSizes);
158
416
  else {
159
- const panelsArray = $c44ee3356398c8a1$var$panelsMapToSortedArray(panels);
417
+ const panelsArray = (0, $f30c804b5fe6cc1a$export$a861c0ad45885494)(panels);
160
418
  const totalWeight = panelsArray.reduce((weight, panel)=>{
161
419
  return weight + panel.defaultSize;
162
420
  }, 0);
@@ -170,7 +428,7 @@ function $c44ee3356398c8a1$export$2e2bcd8739ae039({ autoSaveId: autoSaveId , chi
170
428
  // If this panel has been configured to persist sizing information, save sizes to local storage.
171
429
  if (autoSaveId) {
172
430
  if (sizes.length === 0 || sizes.length !== panels.size) return;
173
- const panelIds = $c44ee3356398c8a1$var$panelsMapToSortedArray(panels).map((panel)=>panel.id);
431
+ const panelIds = (0, $f30c804b5fe6cc1a$export$a861c0ad45885494)(panels).map((panel)=>panel.id);
174
432
  (0, $6ff1a22b27cc039d$export$af183b313c61be4f)(autoSaveId, panelIds, sizes);
175
433
  }
176
434
  }, [
@@ -180,8 +438,8 @@ function $c44ee3356398c8a1$export$2e2bcd8739ae039({ autoSaveId: autoSaveId , chi
180
438
  ]);
181
439
  const getPanelStyle = (0, $fpI56$useCallback)((id)=>{
182
440
  const { panels: panels } = committedValuesRef.current;
183
- const offset = $c44ee3356398c8a1$var$getOffset(panels, id, direction, sizes, height, width);
184
- const size = $c44ee3356398c8a1$var$getSize(panels, id, direction, sizes, height, width);
441
+ const offset = (0, $f30c804b5fe6cc1a$export$622cea445a1c5b7d)(panels, id, direction, sizes, height, width);
442
+ const size = (0, $f30c804b5fe6cc1a$export$31b21d0167753bb4)(panels, id, direction, sizes, height, width);
185
443
  if (direction === "horizontal") return {
186
444
  height: "100%",
187
445
  position: "absolute",
@@ -210,18 +468,17 @@ function $c44ee3356398c8a1$export$2e2bcd8739ae039({ autoSaveId: autoSaveId , chi
210
468
  return nextPanels;
211
469
  });
212
470
  }, []);
213
- const registerResizeHandle = (0, $fpI56$useCallback)((id)=>{
471
+ const registerResizeHandle = (0, $fpI56$useCallback)((handleId)=>{
214
472
  const resizeHandler = (event)=>{
215
473
  event.preventDefault();
216
474
  const { direction: direction , height: height , panels: panels , sizes: prevSizes , width: width } = committedValuesRef.current;
217
- const handle = document.querySelector(`[data-panel-resize-handle-id="${id}"]`);
218
- const handles = Array.from(document.querySelectorAll(`[data-panel-group-id="${groupId}"]`));
219
- const index = handles.indexOf(handle);
220
- const panelsArray = $c44ee3356398c8a1$var$panelsMapToSortedArray(panels);
221
- const idBefore = panelsArray[index]?.id ?? null;
222
- const idAfter = panelsArray[index + 1]?.id ?? null;
475
+ const panelsArray = (0, $f30c804b5fe6cc1a$export$a861c0ad45885494)(panels);
476
+ const [idBefore, idAfter] = (0, $f30c804b5fe6cc1a$export$68d3a33c21dfbe27)(groupId, handleId, panelsArray);
223
477
  if (idBefore == null || idAfter == null) return;
224
- const nextCoordinates = (0, $4b6140a59f4bd98c$export$70637efcd850e4ef)(event, prevCoordinatesRef.current);
478
+ const nextCoordinates = (0, $96f6397ae645d178$export$70637efcd850e4ef)(event, prevCoordinatesRef.current, {
479
+ height: height,
480
+ width: width
481
+ }, direction);
225
482
  prevCoordinatesRef.current = {
226
483
  screenX: nextCoordinates.screenX,
227
484
  screenY: nextCoordinates.screenY
@@ -229,7 +486,7 @@ function $c44ee3356398c8a1$export$2e2bcd8739ae039({ autoSaveId: autoSaveId , chi
229
486
  const isHorizontal = direction === "horizontal";
230
487
  const movement = isHorizontal ? nextCoordinates.movementX : nextCoordinates.movementY;
231
488
  const delta = isHorizontal ? movement / width : movement / height;
232
- const nextSizes = $c44ee3356398c8a1$var$adjustByDelta(panels, idBefore, idAfter, delta, prevSizes);
489
+ const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(panels, idBefore, idAfter, delta, prevSizes);
233
490
  if (prevSizes !== nextSizes) setSizes(nextSizes);
234
491
  };
235
492
  return resizeHandler;
@@ -281,81 +538,21 @@ function $c44ee3356398c8a1$export$2e2bcd8739ae039({ autoSaveId: autoSaveId , chi
281
538
  children: children
282
539
  }, void 0, false, {
283
540
  fileName: "packages/react-resizable-panels/src/PanelGroup.tsx",
284
- lineNumber: 273,
541
+ lineNumber: 290,
285
542
  columnNumber: 9
286
543
  }, this)
287
544
  }, void 0, false, {
288
545
  fileName: "packages/react-resizable-panels/src/PanelGroup.tsx",
289
- lineNumber: 272,
546
+ lineNumber: 289,
290
547
  columnNumber: 7
291
548
  }, this)
292
549
  }, void 0, false, {
293
550
  fileName: "packages/react-resizable-panels/src/PanelGroup.tsx",
294
- lineNumber: 271,
551
+ lineNumber: 288,
295
552
  columnNumber: 5
296
553
  }, this);
297
554
  }
298
- function $c44ee3356398c8a1$var$adjustByDelta(panels, idBefore, idAfter, delta, prevSizes) {
299
- if (delta === 0) return prevSizes;
300
- const panelsArray = $c44ee3356398c8a1$var$panelsMapToSortedArray(panels);
301
- const nextSizes = prevSizes.concat();
302
- let deltaApplied = 0;
303
- // A resizing panel affects the panels before or after it.
304
- //
305
- // A negative delta means the panel immediately after the resizer should grow/expand by decreasing its offset.
306
- // Other panels may also need to shrink/contract (and shift) to make room, depending on the min weights.
307
- //
308
- // A positive delta means the panel immediately before the resizer should "expand".
309
- // This is accomplished by shrinking/contracting (and shifting) one or more of the panels after the resizer.
310
- let pivotId = delta < 0 ? idBefore : idAfter;
311
- let index = panelsArray.findIndex((panel)=>panel.id === pivotId);
312
- while(true){
313
- const panel = panelsArray[index];
314
- const prevSize = prevSizes[index];
315
- const nextSize = Math.max(prevSize - Math.abs(delta), panel.minSize);
316
- if (prevSize !== nextSize) {
317
- deltaApplied += prevSize - nextSize;
318
- nextSizes[index] = nextSize;
319
- if (deltaApplied.toPrecision($c44ee3356398c8a1$var$PRECISION) >= delta.toPrecision($c44ee3356398c8a1$var$PRECISION)) break;
320
- }
321
- if (delta < 0) {
322
- if (--index < 0) break;
323
- } else {
324
- if (++index >= panelsArray.length) break;
325
- }
326
- }
327
- // If we were unable to resize any of the panels panels, return the previous state.
328
- // This will essentially bailout and ignore the "mousemove" event.
329
- if (deltaApplied === 0) return prevSizes;
330
- // Adjust the pivot panel before, but only by the amount that surrounding panels were able to shrink/contract.
331
- pivotId = delta < 0 ? idAfter : idBefore;
332
- index = panelsArray.findIndex((panel)=>panel.id === pivotId);
333
- nextSizes[index] = prevSizes[index] + deltaApplied;
334
- return nextSizes;
335
- }
336
- function $c44ee3356398c8a1$var$getOffset(panels, id, direction, sizes, height, width) {
337
- const panelsArray = $c44ee3356398c8a1$var$panelsMapToSortedArray(panels);
338
- let index = panelsArray.findIndex((panel)=>panel.id === id);
339
- if (index < 0) return 0;
340
- let scaledOffset = 0;
341
- for(index = index - 1; index >= 0; index--){
342
- const panel = panelsArray[index];
343
- scaledOffset += $c44ee3356398c8a1$var$getSize(panels, panel.id, direction, sizes, height, width);
344
- }
345
- return Math.round(scaledOffset);
346
- }
347
- function $c44ee3356398c8a1$var$getSize(panels, id, direction, sizes, height, width) {
348
- const totalSize = direction === "horizontal" ? width : height;
349
- if (panels.size === 1) return totalSize;
350
- const panelsArray = $c44ee3356398c8a1$var$panelsMapToSortedArray(panels);
351
- const index = panelsArray.findIndex((panel)=>panel.id === id);
352
- const size = sizes[index];
353
- if (size == null) return 0;
354
- return Math.round(size * totalSize);
355
- }
356
- function $c44ee3356398c8a1$var$panelsMapToSortedArray(panels) {
357
- return Array.from(panels.values()).sort((a, b)=>a.order - b.order);
358
- }
555
+
359
556
 
360
557
 
361
558
 
@@ -379,7 +576,6 @@ function $b067b37706bb37b8$export$2e2bcd8739ae039({ children: children = null ,
379
576
  }
380
577
  }, [
381
578
  disabled,
382
- groupId,
383
579
  id,
384
580
  registerResizeHandle
385
581
  ]);
@@ -407,23 +603,31 @@ function $b067b37706bb37b8$export$2e2bcd8739ae039({ children: children = null ,
407
603
  resizeHandler,
408
604
  stopDragging
409
605
  ]);
606
+ (0, $99ad02c951ec80d0$export$33b0bea6ac3ffb03)({
607
+ disabled: disabled,
608
+ handleId: id,
609
+ resizeHandler: resizeHandler
610
+ });
410
611
  return /*#__PURE__*/ (0, $fpI56$jsxDEV)("div", {
411
612
  className: className,
412
613
  "data-panel-group-id": groupId,
614
+ "data-panel-resize-handle-enabled": !disabled,
413
615
  "data-panel-resize-handle-id": id,
414
616
  onMouseDown: ()=>startDragging(id),
415
617
  onMouseUp: stopDragging,
416
618
  onTouchCancel: stopDragging,
417
619
  onTouchEnd: stopDragging,
418
620
  onTouchStart: ()=>startDragging(id),
621
+ role: "separator",
419
622
  style: {
420
623
  cursor: direction === "horizontal" ? "ew-resize" : "ns-resize",
421
624
  touchAction: "none"
422
625
  },
626
+ tabIndex: 0,
423
627
  children: children
424
628
  }, void 0, false, {
425
629
  fileName: "packages/react-resizable-panels/src/PanelResizeHandle.tsx",
426
- lineNumber: 80,
630
+ lineNumber: 87,
427
631
  columnNumber: 5
428
632
  }, this);
429
633
  }