react-resizable-panels 2.0.8-rc.1 → 2.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.
@@ -1,5 +1,4 @@
1
1
  import * as React from 'react';
2
- import { compare } from 'stacking-order';
3
2
 
4
3
  // This module exists to work around Webpack issue https://github.com/webpack/webpack/issues/14814
5
4
 
@@ -131,6 +130,7 @@ function PanelWithForwardedRef({
131
130
  ...rest,
132
131
  children,
133
132
  className: classNameFromProps,
133
+ id: idFromProps,
134
134
  style: {
135
135
  ...style,
136
136
  ...styleFromProps
@@ -254,6 +254,114 @@ function intersects(rectOne, rectTwo, strict) {
254
254
  }
255
255
  }
256
256
 
257
+ // Forked from NPM stacking-order@2.0.0
258
+
259
+ /**
260
+ * Determine which of two nodes appears in front of the other —
261
+ * if `a` is in front, returns 1, otherwise returns -1
262
+ * @param {HTMLElement} a
263
+ * @param {HTMLElement} b
264
+ */
265
+ function compare(a, b) {
266
+ if (a === b) throw new Error("Cannot compare node with itself");
267
+ const ancestors = {
268
+ a: get_ancestors(a),
269
+ b: get_ancestors(b)
270
+ };
271
+ let common_ancestor;
272
+
273
+ // remove shared ancestors
274
+ while (ancestors.a.at(-1) === ancestors.b.at(-1)) {
275
+ a = ancestors.a.pop();
276
+ b = ancestors.b.pop();
277
+ common_ancestor = a;
278
+ }
279
+ assert(common_ancestor);
280
+ const z_indexes = {
281
+ a: get_z_index(find_stacking_context(ancestors.a)),
282
+ b: get_z_index(find_stacking_context(ancestors.b))
283
+ };
284
+ if (z_indexes.a === z_indexes.b) {
285
+ const children = common_ancestor.childNodes;
286
+ const furthest_ancestors = {
287
+ a: ancestors.a.at(-1),
288
+ b: ancestors.b.at(-1)
289
+ };
290
+ let i = children.length;
291
+ while (i--) {
292
+ const child = children[i];
293
+ if (child === furthest_ancestors.a) return 1;
294
+ if (child === furthest_ancestors.b) return -1;
295
+ }
296
+ }
297
+ return Math.sign(z_indexes.a - z_indexes.b);
298
+ }
299
+ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
300
+
301
+ /** @param {HTMLElement} node */
302
+ function is_flex_item(node) {
303
+ const display = getComputedStyle(get_parent(node)).display;
304
+ return display === "flex" || display === "inline-flex";
305
+ }
306
+
307
+ /** @param {HTMLElement} node */
308
+ function creates_stacking_context(node) {
309
+ const style = getComputedStyle(node);
310
+
311
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
312
+ if (style.position === "fixed") return true;
313
+ // Forked to fix upstream bug https://github.com/Rich-Harris/stacking-order/issues/3
314
+ // if (
315
+ // (style.zIndex !== "auto" && style.position !== "static") ||
316
+ // is_flex_item(node)
317
+ // )
318
+ if (style.zIndex !== "auto" && (style.position !== "static" || is_flex_item(node))) return true;
319
+ if (+style.opacity < 1) return true;
320
+ if ("transform" in style && style.transform !== "none") return true;
321
+ if ("webkitTransform" in style && style.webkitTransform !== "none") return true;
322
+ if ("mixBlendMode" in style && style.mixBlendMode !== "normal") return true;
323
+ if ("filter" in style && style.filter !== "none") return true;
324
+ if ("webkitFilter" in style && style.webkitFilter !== "none") return true;
325
+ if ("isolation" in style && style.isolation === "isolate") return true;
326
+ if (props.test(style.willChange)) return true;
327
+ // @ts-expect-error
328
+ if (style.webkitOverflowScrolling === "touch") return true;
329
+ return false;
330
+ }
331
+
332
+ /** @param {HTMLElement[]} nodes */
333
+ function find_stacking_context(nodes) {
334
+ let i = nodes.length;
335
+ while (i--) {
336
+ const node = nodes[i];
337
+ assert(node);
338
+ if (creates_stacking_context(node)) return node;
339
+ }
340
+ return null;
341
+ }
342
+
343
+ /** @param {HTMLElement} node */
344
+ function get_z_index(node) {
345
+ return node && Number(getComputedStyle(node).zIndex) || 0;
346
+ }
347
+
348
+ /** @param {HTMLElement} node */
349
+ function get_ancestors(node) {
350
+ const ancestors = [];
351
+ while (node) {
352
+ ancestors.push(node);
353
+ node = get_parent(node);
354
+ }
355
+ return ancestors; // [ node, ... <body>, <html>, document ]
356
+ }
357
+
358
+ /** @param {HTMLElement} node */
359
+ function get_parent(node) {
360
+ var _node$parentNode;
361
+ // @ts-ignore
362
+ return ((_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 ? void 0 : _node$parentNode.host) || node.parentNode;
363
+ }
364
+
257
365
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
258
366
  const EXCEEDED_HORIZONTAL_MAX = 0b0010;
259
367
  const EXCEEDED_VERTICAL_MIN = 0b0100;
@@ -466,7 +574,7 @@ function updateListeners() {
466
574
  window.removeEventListener("mouseup", handlePointerUp);
467
575
  window.removeEventListener("touchcancel", handlePointerUp);
468
576
  window.removeEventListener("touchend", handlePointerUp);
469
- if (registerResizeHandle.length > 0) {
577
+ if (registeredResizeHandlers.size > 0) {
470
578
  if (isPointerDown) {
471
579
  if (intersectingHandles.length > 0) {
472
580
  ownerDocumentCounts.forEach((count, ownerDocument) => {
@@ -1829,11 +1937,12 @@ function PanelGroupWithForwardedRef({
1829
1937
  ...rest,
1830
1938
  children,
1831
1939
  className: classNameFromProps,
1940
+ id: idFromProps,
1941
+ ref: panelGroupElementRef,
1832
1942
  style: {
1833
1943
  ...style,
1834
1944
  ...styleFromProps
1835
1945
  },
1836
- ref: panelGroupElementRef,
1837
1946
  // CSS selectors
1838
1947
  "data-panel-group": "",
1839
1948
  "data-panel-group-direction": direction,
@@ -2034,6 +2143,7 @@ function PanelResizeHandle({
2034
2143
  ...rest,
2035
2144
  children,
2036
2145
  className: classNameFromProps,
2146
+ id: idFromProps,
2037
2147
  onBlur: () => setIsFocused(false),
2038
2148
  onFocus: () => setIsFocused(true),
2039
2149
  ref: elementRef,
@@ -1,5 +1,4 @@
1
1
  import * as React from 'react';
2
- import { compare } from 'stacking-order';
3
2
 
4
3
  const isBrowser = typeof window !== "undefined";
5
4
 
@@ -158,6 +157,7 @@ function PanelWithForwardedRef({
158
157
  ...rest,
159
158
  children,
160
159
  className: classNameFromProps,
160
+ id: idFromProps,
161
161
  style: {
162
162
  ...style,
163
163
  ...styleFromProps
@@ -281,6 +281,114 @@ function intersects(rectOne, rectTwo, strict) {
281
281
  }
282
282
  }
283
283
 
284
+ // Forked from NPM stacking-order@2.0.0
285
+
286
+ /**
287
+ * Determine which of two nodes appears in front of the other —
288
+ * if `a` is in front, returns 1, otherwise returns -1
289
+ * @param {HTMLElement} a
290
+ * @param {HTMLElement} b
291
+ */
292
+ function compare(a, b) {
293
+ if (a === b) throw new Error("Cannot compare node with itself");
294
+ const ancestors = {
295
+ a: get_ancestors(a),
296
+ b: get_ancestors(b)
297
+ };
298
+ let common_ancestor;
299
+
300
+ // remove shared ancestors
301
+ while (ancestors.a.at(-1) === ancestors.b.at(-1)) {
302
+ a = ancestors.a.pop();
303
+ b = ancestors.b.pop();
304
+ common_ancestor = a;
305
+ }
306
+ assert(common_ancestor);
307
+ const z_indexes = {
308
+ a: get_z_index(find_stacking_context(ancestors.a)),
309
+ b: get_z_index(find_stacking_context(ancestors.b))
310
+ };
311
+ if (z_indexes.a === z_indexes.b) {
312
+ const children = common_ancestor.childNodes;
313
+ const furthest_ancestors = {
314
+ a: ancestors.a.at(-1),
315
+ b: ancestors.b.at(-1)
316
+ };
317
+ let i = children.length;
318
+ while (i--) {
319
+ const child = children[i];
320
+ if (child === furthest_ancestors.a) return 1;
321
+ if (child === furthest_ancestors.b) return -1;
322
+ }
323
+ }
324
+ return Math.sign(z_indexes.a - z_indexes.b);
325
+ }
326
+ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
327
+
328
+ /** @param {HTMLElement} node */
329
+ function is_flex_item(node) {
330
+ const display = getComputedStyle(get_parent(node)).display;
331
+ return display === "flex" || display === "inline-flex";
332
+ }
333
+
334
+ /** @param {HTMLElement} node */
335
+ function creates_stacking_context(node) {
336
+ const style = getComputedStyle(node);
337
+
338
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
339
+ if (style.position === "fixed") return true;
340
+ // Forked to fix upstream bug https://github.com/Rich-Harris/stacking-order/issues/3
341
+ // if (
342
+ // (style.zIndex !== "auto" && style.position !== "static") ||
343
+ // is_flex_item(node)
344
+ // )
345
+ if (style.zIndex !== "auto" && (style.position !== "static" || is_flex_item(node))) return true;
346
+ if (+style.opacity < 1) return true;
347
+ if ("transform" in style && style.transform !== "none") return true;
348
+ if ("webkitTransform" in style && style.webkitTransform !== "none") return true;
349
+ if ("mixBlendMode" in style && style.mixBlendMode !== "normal") return true;
350
+ if ("filter" in style && style.filter !== "none") return true;
351
+ if ("webkitFilter" in style && style.webkitFilter !== "none") return true;
352
+ if ("isolation" in style && style.isolation === "isolate") return true;
353
+ if (props.test(style.willChange)) return true;
354
+ // @ts-expect-error
355
+ if (style.webkitOverflowScrolling === "touch") return true;
356
+ return false;
357
+ }
358
+
359
+ /** @param {HTMLElement[]} nodes */
360
+ function find_stacking_context(nodes) {
361
+ let i = nodes.length;
362
+ while (i--) {
363
+ const node = nodes[i];
364
+ assert(node);
365
+ if (creates_stacking_context(node)) return node;
366
+ }
367
+ return null;
368
+ }
369
+
370
+ /** @param {HTMLElement} node */
371
+ function get_z_index(node) {
372
+ return node && Number(getComputedStyle(node).zIndex) || 0;
373
+ }
374
+
375
+ /** @param {HTMLElement} node */
376
+ function get_ancestors(node) {
377
+ const ancestors = [];
378
+ while (node) {
379
+ ancestors.push(node);
380
+ node = get_parent(node);
381
+ }
382
+ return ancestors; // [ node, ... <body>, <html>, document ]
383
+ }
384
+
385
+ /** @param {HTMLElement} node */
386
+ function get_parent(node) {
387
+ var _node$parentNode;
388
+ // @ts-ignore
389
+ return ((_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 ? void 0 : _node$parentNode.host) || node.parentNode;
390
+ }
391
+
284
392
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
285
393
  const EXCEEDED_HORIZONTAL_MAX = 0b0010;
286
394
  const EXCEEDED_VERTICAL_MIN = 0b0100;
@@ -493,7 +601,7 @@ function updateListeners() {
493
601
  window.removeEventListener("mouseup", handlePointerUp);
494
602
  window.removeEventListener("touchcancel", handlePointerUp);
495
603
  window.removeEventListener("touchend", handlePointerUp);
496
- if (registerResizeHandle.length > 0) {
604
+ if (registeredResizeHandlers.size > 0) {
497
605
  if (isPointerDown) {
498
606
  if (intersectingHandles.length > 0) {
499
607
  ownerDocumentCounts.forEach((count, ownerDocument) => {
@@ -1950,11 +2058,12 @@ function PanelGroupWithForwardedRef({
1950
2058
  ...rest,
1951
2059
  children,
1952
2060
  className: classNameFromProps,
2061
+ id: idFromProps,
2062
+ ref: panelGroupElementRef,
1953
2063
  style: {
1954
2064
  ...style,
1955
2065
  ...styleFromProps
1956
2066
  },
1957
- ref: panelGroupElementRef,
1958
2067
  // CSS selectors
1959
2068
  "data-panel-group": "",
1960
2069
  "data-panel-group-direction": direction,
@@ -2158,6 +2267,7 @@ function PanelResizeHandle({
2158
2267
  ...rest,
2159
2268
  children,
2160
2269
  className: classNameFromProps,
2270
+ id: idFromProps,
2161
2271
  onBlur: () => setIsFocused(false),
2162
2272
  onFocus: () => setIsFocused(true),
2163
2273
  ref: elementRef,
@@ -3,7 +3,6 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
- var stackingOrder = require('stacking-order');
7
6
 
8
7
  function _interopNamespace(e) {
9
8
  if (e && e.__esModule) return e;
@@ -144,6 +143,7 @@ function PanelWithForwardedRef({
144
143
  ...rest,
145
144
  children,
146
145
  className: classNameFromProps,
146
+ id: idFromProps,
147
147
  style: {
148
148
  ...style,
149
149
  ...styleFromProps
@@ -267,6 +267,114 @@ function intersects(rectOne, rectTwo, strict) {
267
267
  }
268
268
  }
269
269
 
270
+ // Forked from NPM stacking-order@2.0.0
271
+
272
+ /**
273
+ * Determine which of two nodes appears in front of the other —
274
+ * if `a` is in front, returns 1, otherwise returns -1
275
+ * @param {HTMLElement} a
276
+ * @param {HTMLElement} b
277
+ */
278
+ function compare(a, b) {
279
+ if (a === b) throw new Error("Cannot compare node with itself");
280
+ const ancestors = {
281
+ a: get_ancestors(a),
282
+ b: get_ancestors(b)
283
+ };
284
+ let common_ancestor;
285
+
286
+ // remove shared ancestors
287
+ while (ancestors.a.at(-1) === ancestors.b.at(-1)) {
288
+ a = ancestors.a.pop();
289
+ b = ancestors.b.pop();
290
+ common_ancestor = a;
291
+ }
292
+ assert(common_ancestor);
293
+ const z_indexes = {
294
+ a: get_z_index(find_stacking_context(ancestors.a)),
295
+ b: get_z_index(find_stacking_context(ancestors.b))
296
+ };
297
+ if (z_indexes.a === z_indexes.b) {
298
+ const children = common_ancestor.childNodes;
299
+ const furthest_ancestors = {
300
+ a: ancestors.a.at(-1),
301
+ b: ancestors.b.at(-1)
302
+ };
303
+ let i = children.length;
304
+ while (i--) {
305
+ const child = children[i];
306
+ if (child === furthest_ancestors.a) return 1;
307
+ if (child === furthest_ancestors.b) return -1;
308
+ }
309
+ }
310
+ return Math.sign(z_indexes.a - z_indexes.b);
311
+ }
312
+ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
313
+
314
+ /** @param {HTMLElement} node */
315
+ function is_flex_item(node) {
316
+ const display = getComputedStyle(get_parent(node)).display;
317
+ return display === "flex" || display === "inline-flex";
318
+ }
319
+
320
+ /** @param {HTMLElement} node */
321
+ function creates_stacking_context(node) {
322
+ const style = getComputedStyle(node);
323
+
324
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
325
+ if (style.position === "fixed") return true;
326
+ // Forked to fix upstream bug https://github.com/Rich-Harris/stacking-order/issues/3
327
+ // if (
328
+ // (style.zIndex !== "auto" && style.position !== "static") ||
329
+ // is_flex_item(node)
330
+ // )
331
+ if (style.zIndex !== "auto" && (style.position !== "static" || is_flex_item(node))) return true;
332
+ if (+style.opacity < 1) return true;
333
+ if ("transform" in style && style.transform !== "none") return true;
334
+ if ("webkitTransform" in style && style.webkitTransform !== "none") return true;
335
+ if ("mixBlendMode" in style && style.mixBlendMode !== "normal") return true;
336
+ if ("filter" in style && style.filter !== "none") return true;
337
+ if ("webkitFilter" in style && style.webkitFilter !== "none") return true;
338
+ if ("isolation" in style && style.isolation === "isolate") return true;
339
+ if (props.test(style.willChange)) return true;
340
+ // @ts-expect-error
341
+ if (style.webkitOverflowScrolling === "touch") return true;
342
+ return false;
343
+ }
344
+
345
+ /** @param {HTMLElement[]} nodes */
346
+ function find_stacking_context(nodes) {
347
+ let i = nodes.length;
348
+ while (i--) {
349
+ const node = nodes[i];
350
+ assert(node);
351
+ if (creates_stacking_context(node)) return node;
352
+ }
353
+ return null;
354
+ }
355
+
356
+ /** @param {HTMLElement} node */
357
+ function get_z_index(node) {
358
+ return node && Number(getComputedStyle(node).zIndex) || 0;
359
+ }
360
+
361
+ /** @param {HTMLElement} node */
362
+ function get_ancestors(node) {
363
+ const ancestors = [];
364
+ while (node) {
365
+ ancestors.push(node);
366
+ node = get_parent(node);
367
+ }
368
+ return ancestors; // [ node, ... <body>, <html>, document ]
369
+ }
370
+
371
+ /** @param {HTMLElement} node */
372
+ function get_parent(node) {
373
+ var _node$parentNode;
374
+ // @ts-ignore
375
+ return ((_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 ? void 0 : _node$parentNode.host) || node.parentNode;
376
+ }
377
+
270
378
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
271
379
  const EXCEEDED_HORIZONTAL_MAX = 0b0010;
272
380
  const EXCEEDED_VERTICAL_MIN = 0b0100;
@@ -408,7 +516,7 @@ function recalculateIntersectingHandles({
408
516
  // Calculating stacking order has a cost, so we should avoid it if possible
409
517
  // That is why we only check potentially intersecting handles,
410
518
  // and why we skip if the event target is within the handle's DOM
411
- stackingOrder.compare(targetElement, dragHandleElement) > 0) {
519
+ compare(targetElement, dragHandleElement) > 0) {
412
520
  // If the target is above the drag handle, then we also need to confirm they overlap
413
521
  // If they are beside each other (e.g. a panel and its drag handle) then the handle is still interactive
414
522
  //
@@ -479,7 +587,7 @@ function updateListeners() {
479
587
  window.removeEventListener("mouseup", handlePointerUp);
480
588
  window.removeEventListener("touchcancel", handlePointerUp);
481
589
  window.removeEventListener("touchend", handlePointerUp);
482
- if (registerResizeHandle.length > 0) {
590
+ if (registeredResizeHandlers.size > 0) {
483
591
  if (isPointerDown) {
484
592
  if (intersectingHandles.length > 0) {
485
593
  ownerDocumentCounts.forEach((count, ownerDocument) => {
@@ -1752,11 +1860,12 @@ function PanelGroupWithForwardedRef({
1752
1860
  ...rest,
1753
1861
  children,
1754
1862
  className: classNameFromProps,
1863
+ id: idFromProps,
1864
+ ref: panelGroupElementRef,
1755
1865
  style: {
1756
1866
  ...style,
1757
1867
  ...styleFromProps
1758
1868
  },
1759
- ref: panelGroupElementRef,
1760
1869
  // CSS selectors
1761
1870
  "data-panel-group": "",
1762
1871
  "data-panel-group-direction": direction,
@@ -1957,6 +2066,7 @@ function PanelResizeHandle({
1957
2066
  ...rest,
1958
2067
  children,
1959
2068
  className: classNameFromProps,
2069
+ id: idFromProps,
1960
2070
  onBlur: () => setIsFocused(false),
1961
2071
  onFocus: () => setIsFocused(true),
1962
2072
  ref: elementRef,
@@ -1,5 +1,4 @@
1
1
  import * as React from 'react';
2
- import { compare } from 'stacking-order';
3
2
 
4
3
  // This module exists to work around Webpack issue https://github.com/webpack/webpack/issues/14814
5
4
 
@@ -120,6 +119,7 @@ function PanelWithForwardedRef({
120
119
  ...rest,
121
120
  children,
122
121
  className: classNameFromProps,
122
+ id: idFromProps,
123
123
  style: {
124
124
  ...style,
125
125
  ...styleFromProps
@@ -243,6 +243,114 @@ function intersects(rectOne, rectTwo, strict) {
243
243
  }
244
244
  }
245
245
 
246
+ // Forked from NPM stacking-order@2.0.0
247
+
248
+ /**
249
+ * Determine which of two nodes appears in front of the other —
250
+ * if `a` is in front, returns 1, otherwise returns -1
251
+ * @param {HTMLElement} a
252
+ * @param {HTMLElement} b
253
+ */
254
+ function compare(a, b) {
255
+ if (a === b) throw new Error("Cannot compare node with itself");
256
+ const ancestors = {
257
+ a: get_ancestors(a),
258
+ b: get_ancestors(b)
259
+ };
260
+ let common_ancestor;
261
+
262
+ // remove shared ancestors
263
+ while (ancestors.a.at(-1) === ancestors.b.at(-1)) {
264
+ a = ancestors.a.pop();
265
+ b = ancestors.b.pop();
266
+ common_ancestor = a;
267
+ }
268
+ assert(common_ancestor);
269
+ const z_indexes = {
270
+ a: get_z_index(find_stacking_context(ancestors.a)),
271
+ b: get_z_index(find_stacking_context(ancestors.b))
272
+ };
273
+ if (z_indexes.a === z_indexes.b) {
274
+ const children = common_ancestor.childNodes;
275
+ const furthest_ancestors = {
276
+ a: ancestors.a.at(-1),
277
+ b: ancestors.b.at(-1)
278
+ };
279
+ let i = children.length;
280
+ while (i--) {
281
+ const child = children[i];
282
+ if (child === furthest_ancestors.a) return 1;
283
+ if (child === furthest_ancestors.b) return -1;
284
+ }
285
+ }
286
+ return Math.sign(z_indexes.a - z_indexes.b);
287
+ }
288
+ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
289
+
290
+ /** @param {HTMLElement} node */
291
+ function is_flex_item(node) {
292
+ const display = getComputedStyle(get_parent(node)).display;
293
+ return display === "flex" || display === "inline-flex";
294
+ }
295
+
296
+ /** @param {HTMLElement} node */
297
+ function creates_stacking_context(node) {
298
+ const style = getComputedStyle(node);
299
+
300
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
301
+ if (style.position === "fixed") return true;
302
+ // Forked to fix upstream bug https://github.com/Rich-Harris/stacking-order/issues/3
303
+ // if (
304
+ // (style.zIndex !== "auto" && style.position !== "static") ||
305
+ // is_flex_item(node)
306
+ // )
307
+ if (style.zIndex !== "auto" && (style.position !== "static" || is_flex_item(node))) return true;
308
+ if (+style.opacity < 1) return true;
309
+ if ("transform" in style && style.transform !== "none") return true;
310
+ if ("webkitTransform" in style && style.webkitTransform !== "none") return true;
311
+ if ("mixBlendMode" in style && style.mixBlendMode !== "normal") return true;
312
+ if ("filter" in style && style.filter !== "none") return true;
313
+ if ("webkitFilter" in style && style.webkitFilter !== "none") return true;
314
+ if ("isolation" in style && style.isolation === "isolate") return true;
315
+ if (props.test(style.willChange)) return true;
316
+ // @ts-expect-error
317
+ if (style.webkitOverflowScrolling === "touch") return true;
318
+ return false;
319
+ }
320
+
321
+ /** @param {HTMLElement[]} nodes */
322
+ function find_stacking_context(nodes) {
323
+ let i = nodes.length;
324
+ while (i--) {
325
+ const node = nodes[i];
326
+ assert(node);
327
+ if (creates_stacking_context(node)) return node;
328
+ }
329
+ return null;
330
+ }
331
+
332
+ /** @param {HTMLElement} node */
333
+ function get_z_index(node) {
334
+ return node && Number(getComputedStyle(node).zIndex) || 0;
335
+ }
336
+
337
+ /** @param {HTMLElement} node */
338
+ function get_ancestors(node) {
339
+ const ancestors = [];
340
+ while (node) {
341
+ ancestors.push(node);
342
+ node = get_parent(node);
343
+ }
344
+ return ancestors; // [ node, ... <body>, <html>, document ]
345
+ }
346
+
347
+ /** @param {HTMLElement} node */
348
+ function get_parent(node) {
349
+ var _node$parentNode;
350
+ // @ts-ignore
351
+ return ((_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 ? void 0 : _node$parentNode.host) || node.parentNode;
352
+ }
353
+
246
354
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
247
355
  const EXCEEDED_HORIZONTAL_MAX = 0b0010;
248
356
  const EXCEEDED_VERTICAL_MIN = 0b0100;
@@ -455,7 +563,7 @@ function updateListeners() {
455
563
  window.removeEventListener("mouseup", handlePointerUp);
456
564
  window.removeEventListener("touchcancel", handlePointerUp);
457
565
  window.removeEventListener("touchend", handlePointerUp);
458
- if (registerResizeHandle.length > 0) {
566
+ if (registeredResizeHandlers.size > 0) {
459
567
  if (isPointerDown) {
460
568
  if (intersectingHandles.length > 0) {
461
569
  ownerDocumentCounts.forEach((count, ownerDocument) => {
@@ -1728,11 +1836,12 @@ function PanelGroupWithForwardedRef({
1728
1836
  ...rest,
1729
1837
  children,
1730
1838
  className: classNameFromProps,
1839
+ id: idFromProps,
1840
+ ref: panelGroupElementRef,
1731
1841
  style: {
1732
1842
  ...style,
1733
1843
  ...styleFromProps
1734
1844
  },
1735
- ref: panelGroupElementRef,
1736
1845
  // CSS selectors
1737
1846
  "data-panel-group": "",
1738
1847
  "data-panel-group-direction": direction,
@@ -1933,6 +2042,7 @@ function PanelResizeHandle({
1933
2042
  ...rest,
1934
2043
  children,
1935
2044
  className: classNameFromProps,
2045
+ id: idFromProps,
1936
2046
  onBlur: () => setIsFocused(false),
1937
2047
  onFocus: () => setIsFocused(true),
1938
2048
  ref: elementRef,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-resizable-panels",
3
- "version": "2.0.8-rc.1",
3
+ "version": "2.0.9",
4
4
  "description": "React components for resizable panel groups/layouts",
5
5
  "author": "Brian Vaughn <brian.david.vaughn@gmail.com>",
6
6
  "license": "MIT",
@@ -66,9 +66,6 @@
66
66
  "test:watch": "jest --config=jest.config.js --watch",
67
67
  "watch": "parcel watch --port=2345"
68
68
  },
69
- "dependencies": {
70
- "stacking-order": "^1"
71
- },
72
69
  "devDependencies": {
73
70
  "@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6",
74
71
  "@babel/plugin-proposal-optional-chaining": "7.21.0",
@@ -738,6 +738,38 @@ describe("PanelGroup", () => {
738
738
  });
739
739
  });
740
740
 
741
+ describe("a11y", () => {
742
+ it("should pass explicit id prop to DOM", () => {
743
+ act(() => {
744
+ root.render(
745
+ <PanelGroup direction="horizontal">
746
+ <Panel id="explicit-id" />
747
+ </PanelGroup>
748
+ );
749
+ });
750
+
751
+ const element = container.querySelector("[data-panel]");
752
+
753
+ expect(element).not.toBeNull();
754
+ expect(element?.getAttribute("id")).toBe("explicit-id");
755
+ });
756
+
757
+ it("should not pass auto-generated id prop to DOM", () => {
758
+ act(() => {
759
+ root.render(
760
+ <PanelGroup direction="horizontal">
761
+ <Panel />
762
+ </PanelGroup>
763
+ );
764
+ });
765
+
766
+ const element = container.querySelector("[data-panel]");
767
+
768
+ expect(element).not.toBeNull();
769
+ expect(element?.getAttribute("id")).toBeNull();
770
+ });
771
+ });
772
+
741
773
  describe("DEV warnings", () => {
742
774
  it("should warn about server rendered panels with no default size", () => {
743
775
  jest.resetModules();