@atlaskit/navigation-system 11.3.1 → 11.3.3

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 (53) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/ui/page-layout/calculate-layout-area-states.js +76 -37
  3. package/dist/cjs/ui/page-layout/chat-panel.js +6 -3
  4. package/dist/cjs/ui/page-layout/layout-area-sizing-context.js +2 -2
  5. package/dist/cjs/ui/page-layout/layout-area-sizing-provider.js +243 -247
  6. package/dist/cjs/ui/page-layout/layout-area-sizing-runtime.js +468 -0
  7. package/dist/cjs/ui/page-layout/main/main.js +1 -1
  8. package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.js +239 -99
  9. package/dist/cjs/ui/page-layout/panel-splitter/provider.js +3 -1
  10. package/dist/cjs/ui/page-layout/panel.js +10 -3
  11. package/dist/cjs/ui/page-layout/root.compiled.css +14 -3
  12. package/dist/cjs/ui/page-layout/root.js +43 -17
  13. package/dist/cjs/ui/page-layout/side-nav/side-nav.js +14 -3
  14. package/dist/cjs/ui/page-layout/use-css-layout-area-states.js +117 -0
  15. package/dist/cjs/ui/page-layout/use-layout-area-sizing.js +3 -1
  16. package/dist/es2019/ui/page-layout/calculate-layout-area-states.js +51 -17
  17. package/dist/es2019/ui/page-layout/chat-panel.js +29 -5
  18. package/dist/es2019/ui/page-layout/layout-area-sizing-context.js +2 -2
  19. package/dist/es2019/ui/page-layout/layout-area-sizing-provider.js +171 -241
  20. package/dist/es2019/ui/page-layout/layout-area-sizing-runtime.js +419 -0
  21. package/dist/es2019/ui/page-layout/main/main.js +2 -2
  22. package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.js +60 -10
  23. package/dist/es2019/ui/page-layout/panel-splitter/provider.js +3 -1
  24. package/dist/es2019/ui/page-layout/panel.js +10 -3
  25. package/dist/es2019/ui/page-layout/root.compiled.css +14 -3
  26. package/dist/es2019/ui/page-layout/root.js +30 -3
  27. package/dist/es2019/ui/page-layout/side-nav/side-nav.js +23 -3
  28. package/dist/es2019/ui/page-layout/use-css-layout-area-states.js +73 -0
  29. package/dist/es2019/ui/page-layout/use-layout-area-sizing.js +3 -1
  30. package/dist/esm/ui/page-layout/calculate-layout-area-states.js +75 -37
  31. package/dist/esm/ui/page-layout/chat-panel.js +7 -4
  32. package/dist/esm/ui/page-layout/layout-area-sizing-context.js +2 -2
  33. package/dist/esm/ui/page-layout/layout-area-sizing-provider.js +243 -248
  34. package/dist/esm/ui/page-layout/layout-area-sizing-runtime.js +459 -0
  35. package/dist/esm/ui/page-layout/main/main.js +2 -2
  36. package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.js +238 -98
  37. package/dist/esm/ui/page-layout/panel-splitter/provider.js +3 -1
  38. package/dist/esm/ui/page-layout/panel.js +10 -3
  39. package/dist/esm/ui/page-layout/root.compiled.css +14 -3
  40. package/dist/esm/ui/page-layout/root.js +42 -16
  41. package/dist/esm/ui/page-layout/side-nav/side-nav.js +14 -3
  42. package/dist/esm/ui/page-layout/use-css-layout-area-states.js +110 -0
  43. package/dist/esm/ui/page-layout/use-layout-area-sizing.js +3 -1
  44. package/dist/types/ui/page-layout/calculate-layout-area-states.d.ts +7 -2
  45. package/dist/types/ui/page-layout/layout-area-sizing-context.d.ts +10 -3
  46. package/dist/types/ui/page-layout/layout-area-sizing-provider.d.ts +6 -0
  47. package/dist/types/ui/page-layout/layout-area-sizing-runtime.d.ts +8 -0
  48. package/dist/types/ui/page-layout/panel-splitter/panel-splitter-context.d.ts +4 -0
  49. package/dist/types/ui/page-layout/panel-splitter/provider.d.ts +1 -1
  50. package/dist/types/ui/page-layout/root.d.ts +2 -0
  51. package/dist/types/ui/page-layout/use-css-layout-area-states.d.ts +8 -0
  52. package/dist/types/ui/page-layout/use-layout-area-sizing.d.ts +2 -0
  53. package/package.json +11 -6
@@ -1,4 +1,5 @@
1
1
  /* panel-splitter.tsx generated by @compiled/babel-plugin v3.0.2 */
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _extends from "@babel/runtime/helpers/extends";
3
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
5
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
@@ -7,6 +8,7 @@ var _excluded = ["children", "className"];
7
8
  import "./panel-splitter.compiled.css";
8
9
  import * as React from 'react';
9
10
  import { ax, ix } from "@compiled/react/runtime";
11
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
12
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
13
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
14
  import { forwardRef, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
@@ -136,6 +138,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
136
138
  onCompleteResize = _ref3.onCompleteResize,
137
139
  onResizeStartInternal = _ref3.onResizeStartInternal,
138
140
  onResizeInternal = _ref3.onResizeInternal,
141
+ prepareResize = _ref3.prepareResize,
139
142
  getResizeBounds = _ref3.getResizeBounds,
140
143
  panel = _ref3.panel,
141
144
  portal = _ref3.portal,
@@ -287,8 +290,9 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
287
290
  });
288
291
  var resizingWidth = "clamp(".concat(resizeBounds.min, ", ").concat(targetWidth, "px, ").concat(resizeBounds.max, ")");
289
292
  if (fg('platform-dst-chat-panel-layout') && onResizeInternal) {
290
- // Let the sizing provider constrain the width against Main's available space.
291
- var width = Math.max(convertResizeBoundToPixels(resizeBounds.min), Math.min(targetWidth, convertResizeBoundToPixels(resizeBounds.max)));
293
+ // The allocator needs below-minimum requests for the local-to-chat cascade.
294
+ var currentBounds = getResizeBounds();
295
+ var width = Math.max(0, Math.min(targetWidth, prepareResize ? window.innerWidth : convertResizeBoundToPixels(currentBounds.max)));
292
296
  if (width !== lastManagedResizeWidth) {
293
297
  lastManagedResizeWidth = width;
294
298
  onResizeInternal(width);
@@ -301,39 +305,68 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
301
305
  source.data.resizingWidth = resizingWidth;
302
306
  },
303
307
  onDrop: function onDrop(_ref7) {
304
- var _resizingElementRef$c2;
305
- var source = _ref7.source;
306
- invariant(isPanelSplitterDragData(source.data));
307
- preventUnhandled.stop();
308
-
309
- // PDD may deliver its final throttled drag update immediately before drop.
310
- // Commit that update once before measuring; do not persist a previous frame.
311
- if (onResizeInternal && lastManagedResizeWidth !== undefined) {
312
- var width = lastManagedResizeWidth;
313
- flushSync(function () {
314
- return onResizeInternal(width);
315
- });
316
- lastManagedResizeWidth = undefined;
317
- }
318
- var finalWidth = getPixelWidth(panel);
319
- // Persist the final preferred width before removing the imperative drag
320
- // variable, so the rendered width is continuous across pointer release.
321
- if (fg('platform-dst-chat-panel-layout')) {
322
- flushSync(function () {
323
- return onCompleteResize(finalWidth);
324
- });
325
- } else {
326
- onCompleteResize(finalWidth);
327
- }
328
- onResizeEnd === null || onResizeEnd === void 0 || onResizeEnd({
329
- initialWidth: source.data.initialWidth,
330
- finalWidth: finalWidth
331
- });
332
- panel.style.removeProperty(resizingCssVar);
333
- resizingElementRef === null || resizingElementRef === void 0 || (_resizingElementRef$c2 = resizingElementRef.current) === null || _resizingElementRef$c2 === void 0 || _resizingElementRef$c2.style.removeProperty(resizingCssVar);
308
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
309
+ var _resizingElementRef$c2;
310
+ var source, width, finalWidth, _t;
311
+ return _regeneratorRuntime.wrap(function (_context) {
312
+ while (1) switch (_context.prev = _context.next) {
313
+ case 0:
314
+ source = _ref7.source;
315
+ invariant(isPanelSplitterDragData(source.data));
316
+ preventUnhandled.stop();
317
+ if (!prepareResize) {
318
+ _context.next = 3;
319
+ break;
320
+ }
321
+ _context.next = 1;
322
+ return prepareResize();
323
+ case 1:
324
+ _t = !_context.sent;
325
+ if (_t) {
326
+ _context.next = 2;
327
+ break;
328
+ }
329
+ _t = !panel.isConnected;
330
+ case 2:
331
+ if (!_t) {
332
+ _context.next = 3;
333
+ break;
334
+ }
335
+ return _context.abrupt("return");
336
+ case 3:
337
+ // PDD may deliver its final throttled drag update immediately before drop.
338
+ // Commit that update once before measuring; do not persist a previous frame.
339
+ if (onResizeInternal && lastManagedResizeWidth !== undefined) {
340
+ width = lastManagedResizeWidth;
341
+ flushSync(function () {
342
+ return onResizeInternal(width);
343
+ });
344
+ lastManagedResizeWidth = undefined;
345
+ }
346
+ finalWidth = getPixelWidth(panel); // Persist the final preferred width before removing the imperative drag
347
+ // variable, so the rendered width is continuous across pointer release.
348
+ if (fg('platform-dst-chat-panel-layout')) {
349
+ flushSync(function () {
350
+ return onCompleteResize(finalWidth);
351
+ });
352
+ } else {
353
+ onCompleteResize(finalWidth);
354
+ }
355
+ onResizeEnd === null || onResizeEnd === void 0 || onResizeEnd({
356
+ initialWidth: source.data.initialWidth,
357
+ finalWidth: finalWidth
358
+ });
359
+ panel.style.removeProperty(resizingCssVar);
360
+ resizingElementRef === null || resizingElementRef === void 0 || (_resizingElementRef$c2 = resizingElementRef.current) === null || _resizingElementRef$c2 === void 0 || _resizingElementRef$c2.style.removeProperty(resizingCssVar);
361
+ case 4:
362
+ case "end":
363
+ return _context.stop();
364
+ }
365
+ }, _callee);
366
+ }))();
334
367
  }
335
368
  }));
336
- }, [onCompleteResize, onResizeStartInternal, onResizeInternal, onResizeStart, onResizeEnd, panel, resizingCssVar, resizingElementRef, legacyPanelWidth, position, openLayerObserver, panelId, getResizeBounds]);
369
+ }, [onCompleteResize, onResizeStartInternal, onResizeInternal, prepareResize, onResizeStart, onResizeEnd, panel, resizingCssVar, resizingElementRef, legacyPanelWidth, position, openLayerObserver, panelId, getResizeBounds]);
337
370
  var onResizeStartStableRef = useStableRef(onResizeStart);
338
371
  var onResizeEndStableRef = useStableRef(onResizeEnd);
339
372
  var _useState5 = useState(function () {
@@ -358,74 +391,177 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
358
391
  }),
359
392
  _useState6 = _slicedToArray(_useState5, 1),
360
393
  keyboardResizeManager = _useState6[0];
361
- var handleSliderInputChange = useCallback(function (event) {
362
- var isManagedResize = fg('platform-dst-chat-panel-layout') && onResizeInternal;
363
- var value = isManagedResize ? parseFloat(event.target.value) : parseInt(event.target.value);
364
- if (isManagedResize) {
365
- // The available region may have changed since focus, including without a
366
- // window resize. Use the allocator's current bounds for the public payload.
367
- var bounds = getResizeBounds();
368
- var min = convertResizeBoundToPixels(bounds.min);
369
- var max = convertResizeBoundToPixels(bounds.max);
370
- value = Math.max(min, Math.min(value, max));
371
- setRangeInputBounds({
372
- min: min,
373
- max: max
374
- });
375
- }
376
- setRangeInputValue(value);
394
+ var focusSequence = useRef(0);
395
+ var keyboardBoundsReady = useRef(false);
396
+ var pendingKeyboardWidth = useRef(null);
397
+ var handleSliderInputChange = useCallback( /*#__PURE__*/function () {
398
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(event, pendingKey) {
399
+ var isManagedResize, sequence, value, bounds, min, max, _pendingKeyboardWidth, current, isRtl, increase, step, _t2, _t3;
400
+ return _regeneratorRuntime.wrap(function (_context2) {
401
+ while (1) switch (_context2.prev = _context2.next) {
402
+ case 0:
403
+ isManagedResize = fg('platform-dst-chat-panel-layout') && onResizeInternal;
404
+ sequence = focusSequence.current;
405
+ value = isManagedResize ? parseFloat(event.currentTarget.value) : parseInt(event.currentTarget.value);
406
+ if (!prepareResize) {
407
+ _context2.next = 4;
408
+ break;
409
+ }
410
+ _context2.next = 1;
411
+ return prepareResize();
412
+ case 1:
413
+ _t3 = !_context2.sent;
414
+ if (_t3) {
415
+ _context2.next = 2;
416
+ break;
417
+ }
418
+ _t3 = !panel.isConnected;
419
+ case 2:
420
+ _t2 = _t3;
421
+ if (_t2) {
422
+ _context2.next = 3;
423
+ break;
424
+ }
425
+ _t2 = sequence !== focusSequence.current;
426
+ case 3:
427
+ if (!_t2) {
428
+ _context2.next = 4;
429
+ break;
430
+ }
431
+ return _context2.abrupt("return");
432
+ case 4:
433
+ if (isManagedResize) {
434
+ // The available region may have changed since focus, including without a
435
+ // window resize. Use the allocator's current bounds for the public payload.
436
+ bounds = getResizeBounds();
437
+ min = convertResizeBoundToPixels(bounds.min);
438
+ max = convertResizeBoundToPixels(bounds.max);
439
+ if (pendingKey) {
440
+ // Native range inputs would apply these keys to the placeholder bounds.
441
+ // Preserve the intent until the chunk provides the real bounds instead.
442
+ current = (_pendingKeyboardWidth = pendingKeyboardWidth.current) !== null && _pendingKeyboardWidth !== void 0 ? _pendingKeyboardWidth : getPixelWidth(panel);
443
+ isRtl = getTextDirection(panel) === 'rtl';
444
+ increase = pendingKey === 'ArrowUp' || pendingKey === (isRtl ? 'ArrowLeft' : 'ArrowRight') || pendingKey === 'PageUp';
445
+ step = pendingKey.startsWith('Page') ? Math.max(20, (max - min) / 10) : 20;
446
+ value = pendingKey === 'End' ? max : pendingKey === 'Home' ? min : current + (increase ? step : -step);
447
+ }
448
+ value = Math.max(min, Math.min(value, max));
449
+ setRangeInputBounds({
450
+ min: min,
451
+ max: max
452
+ });
453
+ }
454
+ pendingKeyboardWidth.current = value;
455
+ setRangeInputValue(value);
377
456
 
378
- /**
379
- * We are intentionally _not_ debouncing `onCompleteResize` as we want it to be called anytime the user changes the range input value.
380
- * It is an internal-only callback - it's provided by `PanelSplitterProvider`, and used by layout slots to update their layout width state.
381
- */
382
- onCompleteResize(value);
383
- keyboardResizeManager.onResize({
384
- initialWidth: panelWidth,
385
- finalWidth: value
386
- });
387
- }, [getResizeBounds, onCompleteResize, onResizeInternal, panelWidth, keyboardResizeManager]);
457
+ /**
458
+ * We are intentionally _not_ debouncing `onCompleteResize` as we want it to be called anytime the user changes the range input value.
459
+ * It is an internal-only callback - it's provided by `PanelSplitterProvider`, and used by layout slots to update their layout width state.
460
+ */
461
+ onCompleteResize(value);
462
+ keyboardResizeManager.onResize({
463
+ initialWidth: panelWidth,
464
+ finalWidth: value
465
+ });
466
+ case 5:
467
+ case "end":
468
+ return _context2.stop();
469
+ }
470
+ }, _callee2);
471
+ }));
472
+ return function (_x, _x2) {
473
+ return _ref8.apply(this, arguments);
474
+ };
475
+ }(), [getResizeBounds, onCompleteResize, onResizeInternal, panelWidth, keyboardResizeManager, panel, prepareResize]);
476
+ var handleSliderKeyDown = useCallback(function (event) {
477
+ if (prepareResize && !keyboardBoundsReady.current && ['Home', 'End', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'PageUp', 'PageDown'].includes(event.key)) {
478
+ event.preventDefault();
479
+ void handleSliderInputChange(event, event.key);
480
+ }
481
+ }, [handleSliderInputChange, prepareResize]);
388
482
  var resizeEventListenerCleanupFn = useRef(null);
389
- var handleSliderFocus = useCallback(function () {
483
+ var handleSliderFocus = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
390
484
  var _resizeEventListenerC;
391
- /**
392
- * We are only updating the range input's properties when the element is focused, as a performance optimisation.
393
- * It isn't necessary to recalculate these values until the element is going to be used.
394
- */
395
-
396
- // Clean up any left over listeners in case `focus` was triggered again without `blur`.
397
- (_resizeEventListenerC = resizeEventListenerCleanupFn.current) === null || _resizeEventListenerC === void 0 || _resizeEventListenerC.call(resizeEventListenerCleanupFn);
485
+ var sequence, width, resizeBounds, _t4, _t5;
486
+ return _regeneratorRuntime.wrap(function (_context3) {
487
+ while (1) switch (_context3.prev = _context3.next) {
488
+ case 0:
489
+ sequence = ++focusSequence.current;
490
+ keyboardBoundsReady.current = false;
491
+ pendingKeyboardWidth.current = null;
492
+ if (!prepareResize) {
493
+ _context3.next = 4;
494
+ break;
495
+ }
496
+ _context3.next = 1;
497
+ return prepareResize();
498
+ case 1:
499
+ _t5 = !_context3.sent;
500
+ if (_t5) {
501
+ _context3.next = 2;
502
+ break;
503
+ }
504
+ _t5 = !panel.isConnected;
505
+ case 2:
506
+ _t4 = _t5;
507
+ if (_t4) {
508
+ _context3.next = 3;
509
+ break;
510
+ }
511
+ _t4 = sequence !== focusSequence.current;
512
+ case 3:
513
+ if (!_t4) {
514
+ _context3.next = 4;
515
+ break;
516
+ }
517
+ return _context3.abrupt("return");
518
+ case 4:
519
+ /**
520
+ * We are only updating the range input's properties when the element is focused, as a performance optimisation.
521
+ * It isn't necessary to recalculate these values until the element is going to be used.
522
+ */
398
523
 
399
- // Update the range input value to match the current panel width.
400
- setRangeInputValue(panelWidth);
401
- var resizeBounds = getResizeBounds();
524
+ // Clean up any left over listeners in case `focus` was triggered again without `blur`.
525
+ (_resizeEventListenerC = resizeEventListenerCleanupFn.current) === null || _resizeEventListenerC === void 0 || _resizeEventListenerC.call(resizeEventListenerCleanupFn);
402
526
 
403
- // Update the range input bounds to ensure they are accurate (in case the viewport was previously resized)
404
- setRangeInputBounds({
405
- min: convertResizeBoundToPixels(resizeBounds.min),
406
- max: convertResizeBoundToPixels(resizeBounds.max)
407
- });
527
+ // Update the range input value to match the current panel width.
528
+ width = prepareResize ? getPixelWidth(panel) : panelWidth;
529
+ pendingKeyboardWidth.current = width;
530
+ setRangeInputValue(width);
531
+ resizeBounds = getResizeBounds(); // Update the range input bounds to ensure they are accurate (in case the viewport was previously resized)
532
+ setRangeInputBounds({
533
+ min: convertResizeBoundToPixels(resizeBounds.min),
534
+ max: convertResizeBoundToPixels(resizeBounds.max)
535
+ });
536
+ keyboardBoundsReady.current = true;
408
537
 
409
- /**
410
- * _While the slider element is focused_, add a window resize event listener to update the range input bounds
411
- * when the window is resized. This is needed to ensure the min and max widths accurately reflect the viewport
412
- * size - in case they are provided in vw units.
413
- *
414
- * This listener is cleaned up when the element is blurred.
415
- */
416
- resizeEventListenerCleanupFn.current = bind(window, {
417
- type: 'resize',
418
- listener: function updateState() {
419
- var resizeBounds = getResizeBounds();
420
- setRangeInputBounds({
421
- min: convertResizeBoundToPixels(resizeBounds.min),
422
- max: convertResizeBoundToPixels(resizeBounds.max)
423
- });
538
+ /**
539
+ * _While the slider element is focused_, add a window resize event listener to update the range input bounds
540
+ * when the window is resized. This is needed to ensure the min and max widths accurately reflect the viewport
541
+ * size - in case they are provided in vw units.
542
+ *
543
+ * This listener is cleaned up when the element is blurred.
544
+ */
545
+ resizeEventListenerCleanupFn.current = bind(window, {
546
+ type: 'resize',
547
+ listener: function updateState() {
548
+ var resizeBounds = getResizeBounds();
549
+ setRangeInputBounds({
550
+ min: convertResizeBoundToPixels(resizeBounds.min),
551
+ max: convertResizeBoundToPixels(resizeBounds.max)
552
+ });
553
+ }
554
+ });
555
+ case 5:
556
+ case "end":
557
+ return _context3.stop();
424
558
  }
425
- });
426
- }, [panelWidth, getResizeBounds]);
559
+ }, _callee3);
560
+ })), [panelWidth, getResizeBounds, panel, prepareResize]);
427
561
  var handleSliderBlur = useCallback(function () {
428
562
  var _resizeEventListenerC2;
563
+ focusSequence.current++;
564
+ keyboardBoundsReady.current = false;
429
565
  // Remove the resize event listener when the range input is blurred.
430
566
  (_resizeEventListenerC2 = resizeEventListenerCleanupFn.current) === null || _resizeEventListenerC2 === void 0 || _resizeEventListenerC2.call(resizeEventListenerCleanupFn);
431
567
  }, []);
@@ -452,6 +588,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
452
588
  }, /*#__PURE__*/React.createElement("div", {
453
589
  ref: splitterRef,
454
590
  "data-testid": testId,
591
+ "data-panel-splitter": prepareResize ? '' : undefined,
455
592
  onDoubleClick: onDoubleClick,
456
593
  className: ax([grabAreaStyles.root, fg('platform-dst-tokens-finesse') && grabAreaStyles.rootFinesse])
457
594
  }, /*#__PURE__*/React.createElement(VisuallyHidden, null, /*#__PURE__*/React.createElement("input", {
@@ -463,6 +600,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
463
600
  "aria-valuetext": ariaValueText,
464
601
  "aria-labelledby": labelId,
465
602
  onChange: handleSliderInputChange,
603
+ onKeyDown: prepareResize ? handleSliderKeyDown : undefined,
466
604
  onFocus: handleSliderFocus,
467
605
  onBlur: handleSliderBlur
468
606
  }), /*#__PURE__*/React.createElement("span", {
@@ -487,12 +625,12 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
487
625
  * </Aside>
488
626
  * ```
489
627
  */
490
- export var PanelSplitter = function PanelSplitter(_ref8) {
491
- var label = _ref8.label,
492
- onResizeStart = _ref8.onResizeStart,
493
- onResizeEnd = _ref8.onResizeEnd,
494
- testId = _ref8.testId,
495
- tooltipContent = _ref8.tooltipContent;
628
+ export var PanelSplitter = function PanelSplitter(_ref0) {
629
+ var label = _ref0.label,
630
+ onResizeStart = _ref0.onResizeStart,
631
+ onResizeEnd = _ref0.onResizeEnd,
632
+ testId = _ref0.testId,
633
+ tooltipContent = _ref0.tooltipContent;
496
634
  var _useState7 = useState(null),
497
635
  _useState8 = _slicedToArray(_useState7, 2),
498
636
  panel = _useState8[0],
@@ -512,6 +650,7 @@ export var PanelSplitter = function PanelSplitter(_ref8) {
512
650
  onResizeStartInternal = context.onResizeStartInternal,
513
651
  onResizeInternal = context.onResizeInternal,
514
652
  getResizeBounds = context.getResizeBounds,
653
+ prepareResize = context.prepareResize,
515
654
  resizingCssVar = context.resizingCssVar,
516
655
  resizingElementRef = context.resizingElementRef,
517
656
  position = context.position,
@@ -610,6 +749,7 @@ export var PanelSplitter = function PanelSplitter(_ref8) {
610
749
  onCompleteResize: onCompleteResize,
611
750
  onResizeStartInternal: onResizeStartInternal,
612
751
  onResizeInternal: onResizeInternal,
752
+ prepareResize: prepareResize,
613
753
  getResizeBounds: getResizeBounds,
614
754
  resizingCssVar: resizingCssVar,
615
755
  resizingElementRef: resizingElementRef,
@@ -11,6 +11,7 @@ export var PanelSplitterProvider = function PanelSplitterProvider(_ref) {
11
11
  onCompleteResize = _ref.onCompleteResize,
12
12
  onResizeStartInternal = _ref.onResizeStartInternal,
13
13
  onResizeInternal = _ref.onResizeInternal,
14
+ prepareResize = _ref.prepareResize,
14
15
  getResizeBounds = _ref.getResizeBounds,
15
16
  resizingCssVar = _ref.resizingCssVar,
16
17
  panelRef = _ref.panelRef,
@@ -30,6 +31,7 @@ export var PanelSplitterProvider = function PanelSplitterProvider(_ref) {
30
31
  onCompleteResize: onCompleteResize,
31
32
  onResizeStartInternal: onResizeStartInternal,
32
33
  onResizeInternal: onResizeInternal,
34
+ prepareResize: prepareResize,
33
35
  getResizeBounds: getResizeBounds,
34
36
  resizingCssVar: resizingCssVar,
35
37
  position: position,
@@ -39,7 +41,7 @@ export var PanelSplitterProvider = function PanelSplitterProvider(_ref) {
39
41
  portalRef: typeof providedPortalRef !== 'undefined' ? providedPortalRef : portalRef,
40
42
  shortcut: shortcut
41
43
  };
42
- }, [panelId, panelWidth, onCompleteResize, onResizeStartInternal, onResizeInternal, getResizeBounds, resizingCssVar, position, panelRef, resizingElementRef, isEnabled, providedPortalRef, shortcut]);
44
+ }, [panelId, panelWidth, onCompleteResize, onResizeStartInternal, onResizeInternal, prepareResize, getResizeBounds, resizingCssVar, position, panelRef, resizingElementRef, isEnabled, providedPortalRef, shortcut]);
43
45
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(PanelSplitterContext.Provider, {
44
46
  value: context
45
47
  }, children), typeof providedPortalRef !== 'undefined' ? null : /*#__PURE__*/React.createElement("div", {
@@ -80,6 +80,13 @@ export function Panel(_ref2) {
80
80
  providedId: providedId
81
81
  });
82
82
  var isMotionUpliftEnabled = fg('platform-dst-motion-uplift-panel');
83
+ var isContentMotionEnabled = fg('platform-dst-motion-uplift-panel-content');
84
+ var prevContentKeyRef = useRef(contentKey);
85
+ useEffect(function () {
86
+ if (isContentMotionEnabled && contentKey !== undefined) {
87
+ prevContentKeyRef.current = contentKey;
88
+ }
89
+ }, [contentKey, isContentMotionEnabled]);
83
90
  var defaultWidth = useSafeDefaultWidth({
84
91
  defaultWidthProp: defaultWidthProp,
85
92
  fallbackDefaultWidth: fallbackDefaultWidth,
@@ -230,9 +237,9 @@ export function Panel(_ref2) {
230
237
  position: "start"
231
238
  }, /*#__PURE__*/React.createElement("div", {
232
239
  className: ax([styles.scrollContainer, isMotionUpliftEnabled && state === 'entering' && styles.contentEntering, isMotionUpliftEnabled && state === 'exiting' && styles.contentExiting])
233
- }, isMotionUpliftEnabled && contentKey !== undefined ? /*#__PURE__*/React.createElement(ExitingPersistence, {
234
- exitThenEnter: true
240
+ }, isContentMotionEnabled ? /*#__PURE__*/React.createElement(ExitingPersistence, {
241
+ exitThenEnter: contentKey !== undefined
235
242
  }, /*#__PURE__*/React.createElement(PanelContentMotion, {
236
- key: contentKey
243
+ key: contentKey === undefined ? prevContentKeyRef.current : contentKey
237
244
  }, children)) : children)));
238
245
  }
@@ -1,13 +1,24 @@
1
1
  ._18m9zryt{overflow-y:clip}
2
+ ._1bsb1osq{width:100%}
3
+ ._1bsb1raa{width:max(0px,calc(var(--n_layoutW) - var(--n_mainMinW) - var(--n_fitAside, 0px) - var(--n_fitRibbon, 0px) - var(--n_fitPanel, 0px)))}
4
+ ._1bsb4nr3{width:var(--n_layoutW)}
5
+ ._1bsbjwgu{width:max(0px,calc(100% - var(--n_fitNav)))}
2
6
  ._1ciragmp >:not([data-layout-slot]){display:none!important}
3
7
  ._1cwmtye8{--n_mainMinW:20rem}
4
8
  ._1e0c11p5{display:grid}
9
+ ._1f381mry{container-name:navigation-chat-space}
10
+ ._1f38hwoh{container-name:navigation-main-space}
11
+ ._1f38hx13{container-name:navigation-layout-width}
5
12
  ._1lmcq9em{grid-template-areas:"banner" "top-bar" "main" "aside"}
6
13
  ._1reozryt{overflow-x:clip}
7
14
  ._1tke1kxc{min-height:100vh}
8
15
  ._1tvnagmp >:not([data-layout-slot]):not(dialog):not([popover]){display:none!important}
9
16
  ._2z0516ab{grid-template-rows:auto auto 1fr auto}
17
+ ._5to3grho{--n_fitNav:0px}
18
+ ._7cca15wb{container-type:inline-size}
19
+ ._82d6okmw{--n_layoutW:100cqw}
20
+ ._vchh1ntv{box-sizing:content-box}
10
21
  ._yv0ei47z{grid-template-columns:minmax(0,1fr)}
11
- @media (min-width:40rem){._12ag50j2{grid-template-areas:"banner banner" "top-bar chat-panel" "main chat-panel" "aside chat-panel"}._71dlqwpl{grid-template-columns:minmax(var(--n_mainMinW),1fr) minmax(0,max-content)}}
12
- @media (min-width:64rem){._12fk1aio{grid-template-areas:"banner banner banner banner" "ribbon top-bar top-bar top-bar" "ribbon side-nav main aside"}._12qzrxre{grid-template-rows:auto auto 3fr}._1rqteala{grid-template-columns:auto auto minmax(0,1fr) auto}._12fkqmyk{grid-template-areas:"banner banner banner banner banner" "ribbon top-bar top-bar top-bar chat-panel" "ribbon side-nav main aside chat-panel"}._1rqt8mqp{grid-template-columns:auto auto minmax(var(--n_mainMinW),1fr) auto minmax(0,max-content)}}
13
- @media (min-width:90rem){._xkmggc7l{grid-template-areas:"banner banner banner banner banner banner" "ribbon top-bar top-bar top-bar top-bar chat-panel" "ribbon side-nav main aside panel chat-panel"}._tyve1i18{grid-template-columns:auto auto minmax(var(--n_mainMinW),1fr) auto auto minmax(0,max-content)}._xkmgks3h{grid-template-areas:"banner banner banner banner banner" "ribbon top-bar top-bar top-bar top-bar" "ribbon side-nav main aside panel"}._jbc7rxre{grid-template-rows:auto auto 3fr}._tyve1nco{grid-template-columns:auto auto minmax(0,1fr) auto auto}}
22
+ @media (min-width:40rem){._12ag50j2{grid-template-areas:"banner banner" "top-bar chat-panel" "main chat-panel" "aside chat-panel"}._71dl19sb{grid-template-columns:minmax(var(--n_mainMinW),1fr) var(--n_chatTrack,0)}}
23
+ @media (min-width:64rem){._12fk1aio{grid-template-areas:"banner banner banner banner" "ribbon top-bar top-bar top-bar" "ribbon side-nav main aside"}._12qzrxre{grid-template-rows:auto auto 3fr}._1rqteala{grid-template-columns:auto auto minmax(0,1fr) auto}._12fkqmyk{grid-template-areas:"banner banner banner banner banner" "ribbon top-bar top-bar top-bar chat-panel" "ribbon side-nav main aside chat-panel"}._1rqttswr{grid-template-columns:auto auto minmax(var(--n_mainMinW),1fr) auto var(--n_chatTrack,0)}}
24
+ @media (min-width:90rem){._xkmggc7l{grid-template-areas:"banner banner banner banner banner banner" "ribbon top-bar top-bar top-bar top-bar chat-panel" "ribbon side-nav main aside panel chat-panel"}._tyve87m4{grid-template-columns:auto auto minmax(var(--n_mainMinW),1fr) auto auto var(--n_chatTrack,0)}._xkmgks3h{grid-template-areas:"banner banner banner banner banner" "ribbon top-bar top-bar top-bar top-bar" "ribbon side-nav main aside panel"}._jbc7rxre{grid-template-rows:auto auto 3fr}._tyve1nco{grid-template-columns:auto auto minmax(0,1fr) auto auto}}
@@ -15,34 +15,60 @@ import { SideNavVisibilityProvider } from './side-nav/visibility-provider';
15
15
 
16
16
  // ID of the root element that the banner and top bar slots hoist their sizes to. Only internally exported.
17
17
  export var gridRootId = 'unsafe-design-system-page-layout-root';
18
+ export var gridRootFitId = "".concat(gridRootId, "-fit");
19
+ export var gridRootChatFitId = "".concat(gridRootId, "-chat-fit");
18
20
  var styles = {
21
+ widthContainer: "_7cca15wb _1f38hx13 _1bsb1osq",
22
+ mainSpace: "_82d6okmw _1cwmtye8 _7cca15wb _1f38hwoh _vchh1ntv _1bsb1raa",
23
+ chatSpace: "_5to3grho _7cca15wb _1f381mry _1bsbjwgu",
19
24
  legacyRoot: "_1e0c11p5 _1tke1kxc _1lmcq9em _yv0ei47z _2z0516ab _12fk1aio _12qzrxre _1rqteala _xkmgks3h _jbc7rxre _tyve1nco",
20
- root: "_1cwmtye8 _1e0c11p5 _1tke1kxc _1lmcq9em _yv0ei47z _2z0516ab _12ag50j2 _71dlqwpl _12fkqmyk _12qzrxre _1rqt8mqp _xkmggc7l _tyve1i18",
25
+ root: "_1cwmtye8 _1e0c11p5 _1tke1kxc _1bsb4nr3 _1lmcq9em _yv0ei47z _2z0516ab _12ag50j2 _71dl19sb _12fkqmyk _12qzrxre _1rqttswr _xkmggc7l _tyve87m4",
21
26
  safetyRail: "_1ciragmp",
22
27
  safetyRailWithTopLayer: "_1tvnagmp",
23
28
  panelUplift: "_1reozryt _18m9zryt"
24
29
  };
30
+ function LayoutFitContainers(_ref) {
31
+ var children = _ref.children;
32
+ // CSS cannot use custom properties in a size-query condition. Query the
33
+ // remaining capacity instead: these wrappers subtract configured minimums
34
+ // and occupied tracks, while the actual grid keeps its original host width.
35
+ return /*#__PURE__*/React.createElement("div", {
36
+ "data-layout-width-container": "",
37
+ className: ax([styles.widthContainer])
38
+ }, /*#__PURE__*/React.createElement("style", {
39
+ dangerouslySetInnerHTML: {
40
+ __html: "@property --n_layoutW { syntax: '<length>'; inherits: true; initial-value: 0px; }"
41
+ }
42
+ }), /*#__PURE__*/React.createElement("div", {
43
+ id: gridRootFitId,
44
+ className: ax([styles.mainSpace])
45
+ }, /*#__PURE__*/React.createElement("div", {
46
+ id: gridRootChatFitId,
47
+ className: ax([styles.chatSpace])
48
+ }, children)));
49
+ }
25
50
 
26
51
  /**
27
52
  * The root component of the navigation system. It wraps the underlying components with the necessary contexts allowing to use certain data and hooks
28
53
  * @param skipLinksLabel - The very first element of the layout is a skip links container that can be accessed by pressing Tab button and holds the links to the other sections of the layout thus improving accessibility. This parameter defines the header text for this container
29
54
  */
30
- export function Root(_ref) {
31
- var children = _ref.children,
32
- xcss = _ref.xcss,
33
- _ref$UNSAFE_dangerous = _ref.UNSAFE_dangerouslyHoistSlotSizes,
34
- UNSAFE_dangerouslyHoistSlotSizes = _ref$UNSAFE_dangerous === void 0 ? false : _ref$UNSAFE_dangerous,
35
- _ref$skipLinksLabel = _ref.skipLinksLabel,
36
- skipLinksLabel = _ref$skipLinksLabel === void 0 ? fg('platform_dst_nav4_skip_link_a11y_1') ? 'Skip to' : 'Skip to:' : _ref$skipLinksLabel,
37
- _ref$skipLinksTrigger = _ref.skipLinksTriggerLabel,
38
- skipLinksTriggerLabel = _ref$skipLinksTrigger === void 0 ? 'Skip to' : _ref$skipLinksTrigger,
39
- testId = _ref.testId,
40
- defaultSideNavCollapsed = _ref.defaultSideNavCollapsed,
41
- _ref$isSideNavShortcu = _ref.isSideNavShortcutEnabled,
42
- isSideNavShortcutEnabled = _ref$isSideNavShortcu === void 0 ? false : _ref$isSideNavShortcu;
55
+ export function Root(_ref2) {
56
+ var children = _ref2.children,
57
+ xcss = _ref2.xcss,
58
+ _ref2$UNSAFE_dangerou = _ref2.UNSAFE_dangerouslyHoistSlotSizes,
59
+ UNSAFE_dangerouslyHoistSlotSizes = _ref2$UNSAFE_dangerou === void 0 ? false : _ref2$UNSAFE_dangerou,
60
+ _ref2$skipLinksLabel = _ref2.skipLinksLabel,
61
+ skipLinksLabel = _ref2$skipLinksLabel === void 0 ? fg('platform_dst_nav4_skip_link_a11y_1') ? 'Skip to' : 'Skip to:' : _ref2$skipLinksLabel,
62
+ _ref2$skipLinksTrigge = _ref2.skipLinksTriggerLabel,
63
+ skipLinksTriggerLabel = _ref2$skipLinksTrigge === void 0 ? 'Skip to' : _ref2$skipLinksTrigge,
64
+ testId = _ref2.testId,
65
+ defaultSideNavCollapsed = _ref2.defaultSideNavCollapsed,
66
+ _ref2$isSideNavShortc = _ref2.isSideNavShortcutEnabled,
67
+ isSideNavShortcutEnabled = _ref2$isSideNavShortc === void 0 ? false : _ref2$isSideNavShortc;
43
68
  var ref = useRef(null);
44
69
  var isChatPanelLayoutEnabled = fg('platform-dst-chat-panel-layout');
45
70
  var LayoutProvider = isChatPanelLayoutEnabled ? LayoutAreaSizingProvider : React.Fragment;
71
+ var WidthContainer = isChatPanelLayoutEnabled ? LayoutFitContainers : React.Fragment;
46
72
  useEffect(function () {
47
73
  if (process.env.NODE_ENV !== 'production') {
48
74
  var IGNORED_ELEMENTS = ['SCRIPT', 'STYLE'];
@@ -71,10 +97,10 @@ export function Root(_ref) {
71
97
  label: skipLinksLabel,
72
98
  triggerLabel: skipLinksTriggerLabel,
73
99
  testId: testId
74
- }, /*#__PURE__*/React.createElement("div", {
100
+ }, /*#__PURE__*/React.createElement(WidthContainer, null, /*#__PURE__*/React.createElement("div", {
75
101
  ref: ref,
76
102
  className: ax([isChatPanelLayoutEnabled ? styles.root : styles.legacyRoot, fg('platform-dst-motion-uplift-panel') && styles.panelUplift, fg('platform-dst-top-layer') ? styles.safetyRailWithTopLayer : styles.safetyRail, xcss]),
77
103
  id: gridRootId,
78
104
  "data-testid": testId
79
- }, children))))))))));
105
+ }, children)))))))))));
80
106
  }