@primer/react 0.0.0-20260715113945 → 0.0.0-20260715132248
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.
- package/CHANGELOG.md +5 -5
- package/dist/ActionBar/ActionBar-e63def3c.css +2 -0
- package/dist/ActionBar/ActionBar-e63def3c.css.map +1 -0
- package/dist/ActionBar/ActionBar.module.css.js +1 -1
- package/dist/ActionList/Group.js +1 -1
- package/dist/ActionList/Item.js +1 -1
- package/dist/ActionList/List.js +1 -1
- package/dist/ActionMenu/ActionMenu.js +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +1 -2
- package/dist/Autocomplete/AutocompleteMenu.js +2 -3
- package/dist/Breadcrumbs/Breadcrumbs.js +1 -4
- package/dist/Dialog/Dialog.js +1 -1
- package/dist/FilteredActionList/useAnnouncements.js +14 -20
- package/dist/LabelGroup/LabelGroup-7d19205a.css +2 -0
- package/dist/LabelGroup/LabelGroup-7d19205a.css.map +1 -0
- package/dist/LabelGroup/LabelGroup.module.css.js +1 -1
- package/dist/NavList/NavList.js +1 -1
- package/dist/PageHeader/PageHeader.js +1 -1
- package/dist/PageLayout/DragHandle.d.ts +38 -0
- package/dist/PageLayout/DragHandle.js +220 -0
- package/dist/PageLayout/PageLayout.js +54 -248
- package/dist/PageLayout/index.d.ts +3 -1
- package/dist/PageLayout/usePaneWidth.d.ts +55 -1
- package/dist/PageLayout/usePaneWidth.js +10 -5
- package/dist/TextInputWithTokens/TextInputWithTokens.js +1 -1
- package/dist/TooltipV2/Tooltip.js +1 -2
- package/dist/TreeView/TreeView.js +3 -6
- package/dist/experimental/SelectPanel2/SelectPanel.js +2 -2
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +1 -1
- package/dist/experimental/index.js +1 -1
- package/dist/hooks/useDialog.js +1 -2
- package/dist/hooks/useScrollFlash.js +1 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +7 -5
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js +1 -1
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/dist/utils/warning.js +2 -3
- package/package.json +2 -2
- package/dist/ActionBar/ActionBar-3767d551.css +0 -2
- package/dist/ActionBar/ActionBar-3767d551.css.map +0 -1
- package/dist/LabelGroup/LabelGroup-db41f443.css +0 -2
- package/dist/LabelGroup/LabelGroup-db41f443.css.map +0 -1
- package/dist/internal/components/UnderlineTabbedInterface-70ae932b.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-70ae932b.css.map +0 -1
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
2
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
3
3
|
import { warning } from "../utils/warning.js";
|
|
4
|
-
import { useSlots } from "../hooks/useSlots.js";
|
|
5
4
|
import { isResponsiveValue } from "../hooks/useResponsiveValue.js";
|
|
5
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
6
6
|
import { useOverflow } from "../hooks/useOverflow.js";
|
|
7
7
|
import { getResponsiveAttributes } from "../internal/utils/getResponsiveAttributes.js";
|
|
8
8
|
import PageLayout_module_css_default from "./PageLayout.module.css.js";
|
|
9
9
|
import { isCustomWidthOptions, isPaneWidth, updateAriaValues, usePaneWidth } from "./usePaneWidth.js";
|
|
10
|
-
import {
|
|
10
|
+
import { DragHandle } from "./DragHandle.js";
|
|
11
11
|
import { c } from "react-compiler-runtime";
|
|
12
12
|
import { clsx } from "clsx";
|
|
13
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
14
|
import React, { memo, useRef } from "react";
|
|
15
15
|
//#region src/PageLayout/PageLayout.tsx
|
|
16
|
-
const isArrowKey = (key) => key === "ArrowLeft" || key === "ArrowRight" || key === "ArrowUp" || key === "ArrowDown";
|
|
17
|
-
const isShrinkKey = (key) => key === "ArrowLeft" || key === "ArrowDown";
|
|
18
16
|
const PageLayoutContext = /*#__PURE__*/ React.createContext({
|
|
19
17
|
padding: "normal",
|
|
20
18
|
rowGap: "normal",
|
|
@@ -267,9 +265,9 @@ const VerticalDivider = /*#__PURE__*/ memo((t0) => {
|
|
|
267
265
|
});
|
|
268
266
|
VerticalDivider.displayName = "VerticalDivider";
|
|
269
267
|
const SidebarDivider = /*#__PURE__*/ memo(function SidebarDivider(t0) {
|
|
270
|
-
const $ = c(
|
|
268
|
+
const $ = c(23);
|
|
271
269
|
const { position, divider, resizable, minPaneWidth, maxPaneWidth, currentWidth, currentWidthRef, handleRef, sidebarRef, dragStartClientXRef, dragStartWidthRef, dragMaxWidthRef, getMaxPaneWidth, getDefaultWidth, saveWidth } = t0;
|
|
272
|
-
const { columnGap } = React.useContext(PageLayoutContext);
|
|
270
|
+
const { columnGap, sidebarContentWrapperRef } = React.useContext(PageLayoutContext);
|
|
273
271
|
const t1 = resizable ? "line" : divider;
|
|
274
272
|
const t2 = `var(--spacing-${columnGap})`;
|
|
275
273
|
let t3;
|
|
@@ -280,9 +278,11 @@ const SidebarDivider = /*#__PURE__*/ memo(function SidebarDivider(t0) {
|
|
|
280
278
|
} else t3 = $[1];
|
|
281
279
|
const t4 = t3;
|
|
282
280
|
let t5;
|
|
283
|
-
if ($[2] !== currentWidth || $[3] !== currentWidthRef || $[4] !== dragMaxWidthRef || $[5] !== dragStartClientXRef || $[6] !== dragStartWidthRef || $[7] !== getDefaultWidth || $[8] !== getMaxPaneWidth || $[9] !== handleRef || $[10] !== maxPaneWidth || $[11] !== minPaneWidth || $[12] !== position || $[13] !== resizable || $[14] !== saveWidth || $[15] !== sidebarRef) {
|
|
281
|
+
if ($[2] !== currentWidth || $[3] !== currentWidthRef || $[4] !== dragMaxWidthRef || $[5] !== dragStartClientXRef || $[6] !== dragStartWidthRef || $[7] !== getDefaultWidth || $[8] !== getMaxPaneWidth || $[9] !== handleRef || $[10] !== maxPaneWidth || $[11] !== minPaneWidth || $[12] !== position || $[13] !== resizable || $[14] !== saveWidth || $[15] !== sidebarContentWrapperRef || $[16] !== sidebarRef) {
|
|
284
282
|
t5 = resizable ? /*#__PURE__*/ jsx(DragHandle, {
|
|
285
283
|
handleRef,
|
|
284
|
+
dragTargetRef: sidebarRef,
|
|
285
|
+
contentWrapperRef: sidebarContentWrapperRef,
|
|
286
286
|
"aria-valuemin": minPaneWidth,
|
|
287
287
|
"aria-valuemax": maxPaneWidth,
|
|
288
288
|
"aria-valuenow": currentWidth,
|
|
@@ -347,11 +347,12 @@ const SidebarDivider = /*#__PURE__*/ memo(function SidebarDivider(t0) {
|
|
|
347
347
|
$[12] = position;
|
|
348
348
|
$[13] = resizable;
|
|
349
349
|
$[14] = saveWidth;
|
|
350
|
-
$[15] =
|
|
351
|
-
$[16] =
|
|
352
|
-
|
|
350
|
+
$[15] = sidebarContentWrapperRef;
|
|
351
|
+
$[16] = sidebarRef;
|
|
352
|
+
$[17] = t5;
|
|
353
|
+
} else t5 = $[17];
|
|
353
354
|
let t6;
|
|
354
|
-
if ($[
|
|
355
|
+
if ($[18] !== position || $[19] !== t1 || $[20] !== t4 || $[21] !== t5) {
|
|
355
356
|
t6 = /*#__PURE__*/ jsx(VerticalDivider, {
|
|
356
357
|
variant: t1,
|
|
357
358
|
position,
|
|
@@ -359,212 +360,14 @@ const SidebarDivider = /*#__PURE__*/ memo(function SidebarDivider(t0) {
|
|
|
359
360
|
style: t4,
|
|
360
361
|
children: t5
|
|
361
362
|
});
|
|
362
|
-
$[
|
|
363
|
-
$[
|
|
364
|
-
$[
|
|
365
|
-
$[
|
|
366
|
-
$[
|
|
367
|
-
} else t6 = $[
|
|
363
|
+
$[18] = position;
|
|
364
|
+
$[19] = t1;
|
|
365
|
+
$[20] = t4;
|
|
366
|
+
$[21] = t5;
|
|
367
|
+
$[22] = t6;
|
|
368
|
+
} else t6 = $[22];
|
|
368
369
|
return t6;
|
|
369
370
|
});
|
|
370
|
-
/**
|
|
371
|
-
* DragHandle - handles all pointer and keyboard interactions for resizing
|
|
372
|
-
* ARIA values are set in JSX for SSR accessibility,
|
|
373
|
-
* then updated via DOM manipulation during drag for performance
|
|
374
|
-
*/
|
|
375
|
-
const DragHandle = /*#__PURE__*/ memo(function DragHandle(t0) {
|
|
376
|
-
const $ = c(35);
|
|
377
|
-
const { handleRef, onDragStart, onDrag, onDragEnd, onDoubleClick, "aria-valuemin": ariaValueMin, "aria-valuemax": ariaValueMax, "aria-valuenow": ariaValueNow } = t0;
|
|
378
|
-
const stableOnDragStart = React.useRef(onDragStart);
|
|
379
|
-
const stableOnDrag = React.useRef(onDrag);
|
|
380
|
-
const stableOnDragEnd = React.useRef(onDragEnd);
|
|
381
|
-
let t1;
|
|
382
|
-
if ($[0] !== onDrag || $[1] !== onDragEnd || $[2] !== onDragStart) {
|
|
383
|
-
t1 = () => {
|
|
384
|
-
stableOnDragStart.current = onDragStart;
|
|
385
|
-
stableOnDrag.current = onDrag;
|
|
386
|
-
stableOnDragEnd.current = onDragEnd;
|
|
387
|
-
};
|
|
388
|
-
$[0] = onDrag;
|
|
389
|
-
$[1] = onDragEnd;
|
|
390
|
-
$[2] = onDragStart;
|
|
391
|
-
$[3] = t1;
|
|
392
|
-
} else t1 = $[3];
|
|
393
|
-
React.useEffect(t1);
|
|
394
|
-
const { paneRef, contentWrapperRef } = React.useContext(PageLayoutContext);
|
|
395
|
-
const isDraggingRef = React.useRef(false);
|
|
396
|
-
let t2;
|
|
397
|
-
if ($[4] !== contentWrapperRef || $[5] !== handleRef || $[6] !== paneRef) {
|
|
398
|
-
t2 = () => {
|
|
399
|
-
if (isDraggingRef.current) return;
|
|
400
|
-
setDraggingStyles({
|
|
401
|
-
handle: handleRef.current,
|
|
402
|
-
pane: paneRef.current,
|
|
403
|
-
contentWrapper: contentWrapperRef.current
|
|
404
|
-
});
|
|
405
|
-
isDraggingRef.current = true;
|
|
406
|
-
};
|
|
407
|
-
$[4] = contentWrapperRef;
|
|
408
|
-
$[5] = handleRef;
|
|
409
|
-
$[6] = paneRef;
|
|
410
|
-
$[7] = t2;
|
|
411
|
-
} else t2 = $[7];
|
|
412
|
-
const startDragging = t2;
|
|
413
|
-
let t3;
|
|
414
|
-
if ($[8] !== contentWrapperRef || $[9] !== handleRef || $[10] !== paneRef) {
|
|
415
|
-
t3 = () => {
|
|
416
|
-
if (!isDraggingRef.current) return;
|
|
417
|
-
removeDraggingStyles({
|
|
418
|
-
handle: handleRef.current,
|
|
419
|
-
pane: paneRef.current,
|
|
420
|
-
contentWrapper: contentWrapperRef.current
|
|
421
|
-
});
|
|
422
|
-
isDraggingRef.current = false;
|
|
423
|
-
};
|
|
424
|
-
$[8] = contentWrapperRef;
|
|
425
|
-
$[9] = handleRef;
|
|
426
|
-
$[10] = paneRef;
|
|
427
|
-
$[11] = t3;
|
|
428
|
-
} else t3 = $[11];
|
|
429
|
-
const endDragging = t3;
|
|
430
|
-
let t4;
|
|
431
|
-
if ($[12] !== startDragging) {
|
|
432
|
-
t4 = (event) => {
|
|
433
|
-
if (event.button !== 0) return;
|
|
434
|
-
event.preventDefault();
|
|
435
|
-
const target = event.currentTarget;
|
|
436
|
-
try {
|
|
437
|
-
target.setPointerCapture(event.pointerId);
|
|
438
|
-
} catch {}
|
|
439
|
-
stableOnDragStart.current(event.clientX);
|
|
440
|
-
startDragging();
|
|
441
|
-
};
|
|
442
|
-
$[12] = startDragging;
|
|
443
|
-
$[13] = t4;
|
|
444
|
-
} else t4 = $[13];
|
|
445
|
-
const handlePointerDown = t4;
|
|
446
|
-
const rafIdRef = React.useRef(null);
|
|
447
|
-
const pendingClientXRef = React.useRef(null);
|
|
448
|
-
let t5;
|
|
449
|
-
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
450
|
-
t5 = (event_0) => {
|
|
451
|
-
if (!isDraggingRef.current) return;
|
|
452
|
-
event_0.preventDefault();
|
|
453
|
-
pendingClientXRef.current = event_0.clientX;
|
|
454
|
-
if (rafIdRef.current === null) rafIdRef.current = requestAnimationFrame(() => {
|
|
455
|
-
rafIdRef.current = null;
|
|
456
|
-
if (pendingClientXRef.current !== null) {
|
|
457
|
-
stableOnDrag.current(pendingClientXRef.current, false);
|
|
458
|
-
pendingClientXRef.current = null;
|
|
459
|
-
}
|
|
460
|
-
});
|
|
461
|
-
};
|
|
462
|
-
$[14] = t5;
|
|
463
|
-
} else t5 = $[14];
|
|
464
|
-
const handlePointerMove = t5;
|
|
465
|
-
let t6;
|
|
466
|
-
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
467
|
-
t6 = (event_1) => {
|
|
468
|
-
if (!isDraggingRef.current) return;
|
|
469
|
-
event_1.preventDefault();
|
|
470
|
-
};
|
|
471
|
-
$[15] = t6;
|
|
472
|
-
} else t6 = $[15];
|
|
473
|
-
const handlePointerUp = t6;
|
|
474
|
-
let t7;
|
|
475
|
-
if ($[16] !== endDragging) {
|
|
476
|
-
t7 = () => {
|
|
477
|
-
if (!isDraggingRef.current) return;
|
|
478
|
-
if (rafIdRef.current !== null) {
|
|
479
|
-
cancelAnimationFrame(rafIdRef.current);
|
|
480
|
-
rafIdRef.current = null;
|
|
481
|
-
pendingClientXRef.current = null;
|
|
482
|
-
}
|
|
483
|
-
endDragging();
|
|
484
|
-
stableOnDragEnd.current();
|
|
485
|
-
};
|
|
486
|
-
$[16] = endDragging;
|
|
487
|
-
$[17] = t7;
|
|
488
|
-
} else t7 = $[17];
|
|
489
|
-
const handleLostPointerCapture = t7;
|
|
490
|
-
let t8;
|
|
491
|
-
if ($[18] !== startDragging) {
|
|
492
|
-
t8 = (event_2) => {
|
|
493
|
-
if (!isArrowKey(event_2.key)) return;
|
|
494
|
-
event_2.preventDefault();
|
|
495
|
-
const delta = isShrinkKey(event_2.key) ? -3 : 3;
|
|
496
|
-
if (!isDraggingRef.current) startDragging();
|
|
497
|
-
stableOnDrag.current(delta, true);
|
|
498
|
-
};
|
|
499
|
-
$[18] = startDragging;
|
|
500
|
-
$[19] = t8;
|
|
501
|
-
} else t8 = $[19];
|
|
502
|
-
const handleKeyDown = t8;
|
|
503
|
-
let t9;
|
|
504
|
-
if ($[20] !== endDragging) {
|
|
505
|
-
t9 = (event_3) => {
|
|
506
|
-
if (!isArrowKey(event_3.key)) return;
|
|
507
|
-
event_3.preventDefault();
|
|
508
|
-
endDragging();
|
|
509
|
-
stableOnDragEnd.current();
|
|
510
|
-
};
|
|
511
|
-
$[20] = endDragging;
|
|
512
|
-
$[21] = t9;
|
|
513
|
-
} else t9 = $[21];
|
|
514
|
-
const handleKeyUp = t9;
|
|
515
|
-
let t10;
|
|
516
|
-
let t11;
|
|
517
|
-
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
518
|
-
t10 = () => () => {
|
|
519
|
-
if (rafIdRef.current !== null) {
|
|
520
|
-
cancelAnimationFrame(rafIdRef.current);
|
|
521
|
-
rafIdRef.current = null;
|
|
522
|
-
}
|
|
523
|
-
};
|
|
524
|
-
t11 = [];
|
|
525
|
-
$[22] = t10;
|
|
526
|
-
$[23] = t11;
|
|
527
|
-
} else {
|
|
528
|
-
t10 = $[22];
|
|
529
|
-
t11 = $[23];
|
|
530
|
-
}
|
|
531
|
-
React.useEffect(t10, t11);
|
|
532
|
-
const t12 = ariaValueNow !== void 0 ? `Pane width ${ariaValueNow} pixels` : void 0;
|
|
533
|
-
let t13;
|
|
534
|
-
if ($[24] !== ariaValueMax || $[25] !== ariaValueMin || $[26] !== ariaValueNow || $[27] !== handleKeyDown || $[28] !== handleKeyUp || $[29] !== handleLostPointerCapture || $[30] !== handlePointerDown || $[31] !== handleRef || $[32] !== onDoubleClick || $[33] !== t12) {
|
|
535
|
-
t13 = /*#__PURE__*/ jsx("div", {
|
|
536
|
-
ref: handleRef,
|
|
537
|
-
className: PageLayout_module_css_default.DraggableHandle,
|
|
538
|
-
"data-component": "PageLayout.DragHandle",
|
|
539
|
-
role: "slider",
|
|
540
|
-
"aria-label": "Draggable pane splitter",
|
|
541
|
-
"aria-valuemin": ariaValueMin,
|
|
542
|
-
"aria-valuemax": ariaValueMax,
|
|
543
|
-
"aria-valuenow": ariaValueNow,
|
|
544
|
-
"aria-valuetext": t12,
|
|
545
|
-
tabIndex: 0,
|
|
546
|
-
onPointerDown: handlePointerDown,
|
|
547
|
-
onPointerMove: handlePointerMove,
|
|
548
|
-
onPointerUp: handlePointerUp,
|
|
549
|
-
onLostPointerCapture: handleLostPointerCapture,
|
|
550
|
-
onKeyDown: handleKeyDown,
|
|
551
|
-
onKeyUp: handleKeyUp,
|
|
552
|
-
onDoubleClick
|
|
553
|
-
});
|
|
554
|
-
$[24] = ariaValueMax;
|
|
555
|
-
$[25] = ariaValueMin;
|
|
556
|
-
$[26] = ariaValueNow;
|
|
557
|
-
$[27] = handleKeyDown;
|
|
558
|
-
$[28] = handleKeyUp;
|
|
559
|
-
$[29] = handleLostPointerCapture;
|
|
560
|
-
$[30] = handlePointerDown;
|
|
561
|
-
$[31] = handleRef;
|
|
562
|
-
$[32] = onDoubleClick;
|
|
563
|
-
$[33] = t12;
|
|
564
|
-
$[34] = t13;
|
|
565
|
-
} else t13 = $[34];
|
|
566
|
-
return t13;
|
|
567
|
-
});
|
|
568
371
|
const Header = (t0) => {
|
|
569
372
|
const $ = c(29);
|
|
570
373
|
const { "aria-label": label, "aria-labelledby": labelledBy, padding: t1, divider: t2, dividerWhenNarrow: t3, hidden: t4, children, style, className, "data-component": t5 } = t0;
|
|
@@ -745,7 +548,7 @@ const overflowProps = {
|
|
|
745
548
|
role: "region"
|
|
746
549
|
};
|
|
747
550
|
const Pane = /*#__PURE__*/ React.forwardRef((t0, forwardRef) => {
|
|
748
|
-
const $ = c(
|
|
551
|
+
const $ = c(98);
|
|
749
552
|
const { "aria-label": label, "aria-labelledby": labelledBy, position: t1, positionWhenNarrow: t2, width: t3, minWidth: t4, currentWidth: controlledWidth, onResizeEnd, padding: t5, resizable: t6, widthStorageKey: t7, divider: t8, dividerWhenNarrow: t9, sticky: t10, offsetHeader: t11, hidden: t12, children, id, className, style, "data-component": t13 } = t0;
|
|
750
553
|
const responsivePosition = t1 === void 0 ? "end" : t1;
|
|
751
554
|
const positionWhenNarrow = t2 === void 0 ? "inherit" : t2;
|
|
@@ -998,9 +801,11 @@ const Pane = /*#__PURE__*/ React.forwardRef((t0, forwardRef) => {
|
|
|
998
801
|
} else t48 = $[70];
|
|
999
802
|
const t49 = t48;
|
|
1000
803
|
let t50;
|
|
1001
|
-
if ($[71] !==
|
|
804
|
+
if ($[71] !== contentWrapperRef || $[72] !== currentWidth || $[73] !== currentWidthRef || $[74] !== getDefaultWidth || $[75] !== getMaxPaneWidth || $[76] !== maxPaneWidth || $[77] !== minPaneWidth || $[78] !== paneRef || $[79] !== position || $[80] !== resizable || $[81] !== saveWidth) {
|
|
1002
805
|
t50 = resizable ? /*#__PURE__*/ jsx(DragHandle, {
|
|
1003
806
|
handleRef,
|
|
807
|
+
dragTargetRef: paneRef,
|
|
808
|
+
contentWrapperRef,
|
|
1004
809
|
"aria-valuemin": minPaneWidth,
|
|
1005
810
|
"aria-valuemax": maxPaneWidth,
|
|
1006
811
|
"aria-valuenow": currentWidth,
|
|
@@ -1052,20 +857,21 @@ const Pane = /*#__PURE__*/ React.forwardRef((t0, forwardRef) => {
|
|
|
1052
857
|
saveWidth(resetWidth);
|
|
1053
858
|
}
|
|
1054
859
|
}) : null;
|
|
1055
|
-
$[71] =
|
|
1056
|
-
$[72] =
|
|
1057
|
-
$[73] =
|
|
1058
|
-
$[74] =
|
|
1059
|
-
$[75] =
|
|
1060
|
-
$[76] =
|
|
1061
|
-
$[77] =
|
|
1062
|
-
$[78] =
|
|
1063
|
-
$[79] =
|
|
1064
|
-
$[80] =
|
|
1065
|
-
$[81] =
|
|
1066
|
-
|
|
860
|
+
$[71] = contentWrapperRef;
|
|
861
|
+
$[72] = currentWidth;
|
|
862
|
+
$[73] = currentWidthRef;
|
|
863
|
+
$[74] = getDefaultWidth;
|
|
864
|
+
$[75] = getMaxPaneWidth;
|
|
865
|
+
$[76] = maxPaneWidth;
|
|
866
|
+
$[77] = minPaneWidth;
|
|
867
|
+
$[78] = paneRef;
|
|
868
|
+
$[79] = position;
|
|
869
|
+
$[80] = resizable;
|
|
870
|
+
$[81] = saveWidth;
|
|
871
|
+
$[82] = t50;
|
|
872
|
+
} else t50 = $[82];
|
|
1067
873
|
let t51;
|
|
1068
|
-
if ($[
|
|
874
|
+
if ($[83] !== positionProp || $[84] !== resizable || $[85] !== t46 || $[86] !== t49 || $[87] !== t50) {
|
|
1069
875
|
t51 = /*#__PURE__*/ jsx(VerticalDivider, {
|
|
1070
876
|
variant: t46,
|
|
1071
877
|
draggable: resizable,
|
|
@@ -1074,15 +880,15 @@ const Pane = /*#__PURE__*/ React.forwardRef((t0, forwardRef) => {
|
|
|
1074
880
|
style: t49,
|
|
1075
881
|
children: t50
|
|
1076
882
|
});
|
|
1077
|
-
$[
|
|
1078
|
-
$[
|
|
1079
|
-
$[
|
|
1080
|
-
$[
|
|
1081
|
-
$[
|
|
1082
|
-
$[
|
|
1083
|
-
} else t51 = $[
|
|
883
|
+
$[83] = positionProp;
|
|
884
|
+
$[84] = resizable;
|
|
885
|
+
$[85] = t46;
|
|
886
|
+
$[86] = t49;
|
|
887
|
+
$[87] = t50;
|
|
888
|
+
$[88] = t51;
|
|
889
|
+
} else t51 = $[88];
|
|
1084
890
|
let t52;
|
|
1085
|
-
if ($[
|
|
891
|
+
if ($[89] !== t19 || $[90] !== t24 || $[91] !== t25 || $[92] !== t26 || $[93] !== t27 || $[94] !== t32 || $[95] !== t45 || $[96] !== t51) {
|
|
1086
892
|
t52 = /*#__PURE__*/ jsxs("div", {
|
|
1087
893
|
className: t19,
|
|
1088
894
|
style: t24,
|
|
@@ -1095,16 +901,16 @@ const Pane = /*#__PURE__*/ React.forwardRef((t0, forwardRef) => {
|
|
|
1095
901
|
t51
|
|
1096
902
|
]
|
|
1097
903
|
});
|
|
1098
|
-
$[
|
|
1099
|
-
$[
|
|
1100
|
-
$[
|
|
1101
|
-
$[
|
|
1102
|
-
$[
|
|
1103
|
-
$[
|
|
1104
|
-
$[
|
|
1105
|
-
$[
|
|
1106
|
-
$[
|
|
1107
|
-
} else t52 = $[
|
|
904
|
+
$[89] = t19;
|
|
905
|
+
$[90] = t24;
|
|
906
|
+
$[91] = t25;
|
|
907
|
+
$[92] = t26;
|
|
908
|
+
$[93] = t27;
|
|
909
|
+
$[94] = t32;
|
|
910
|
+
$[95] = t45;
|
|
911
|
+
$[96] = t51;
|
|
912
|
+
$[97] = t52;
|
|
913
|
+
} else t52 = $[97];
|
|
1108
914
|
return t52;
|
|
1109
915
|
});
|
|
1110
916
|
Pane.displayName = "PageLayout.Pane";
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import { CustomWidthOptions, PaneWidth, PaneWidthValue, UsePaneWidthOptions, UsePaneWidthResult, defaultPaneWidth, usePaneWidth } from "./usePaneWidth.js";
|
|
1
2
|
import { PageLayout, PageLayoutContentProps, PageLayoutFooterProps, PageLayoutHeaderProps, PageLayoutPaneBaseProps, PageLayoutPaneProps, PageLayoutProps, PageLayoutSidebarBaseProps, PageLayoutSidebarProps } from "./PageLayout.js";
|
|
2
|
-
|
|
3
|
+
import { DragHandle, DragHandleProps } from "./DragHandle.js";
|
|
4
|
+
export { type CustomWidthOptions, DragHandle, type DragHandleProps, PageLayout, PageLayoutContentProps, PageLayoutFooterProps, PageLayoutHeaderProps, PageLayoutPaneBaseProps, PageLayoutPaneProps, PageLayoutProps, PageLayoutSidebarBaseProps, PageLayoutSidebarProps, type PaneWidth, type PaneWidthValue, type UsePaneWidthOptions, type UsePaneWidthResult, defaultPaneWidth, usePaneWidth };
|
|
@@ -14,5 +14,59 @@ type PaneWidth = 'small' | 'medium' | 'large';
|
|
|
14
14
|
* - `CustomWidthOptions`: Explicit min/default/max constraints
|
|
15
15
|
*/
|
|
16
16
|
type PaneWidthValue = PaneWidth | CustomWidthOptions;
|
|
17
|
+
type UsePaneWidthOptions = {
|
|
18
|
+
width: PaneWidthValue;
|
|
19
|
+
minWidth: number;
|
|
20
|
+
resizable: boolean; /** localStorage key for persisting width. When undefined, localStorage is not used. */
|
|
21
|
+
widthStorageKey?: string;
|
|
22
|
+
paneRef: React.RefObject<HTMLDivElement | null>;
|
|
23
|
+
handleRef: React.RefObject<HTMLDivElement | null>;
|
|
24
|
+
/**
|
|
25
|
+
* Optional ref to the content wrapper element. Only used by PageLayout for its
|
|
26
|
+
* viewport/content math during resize. Standalone consumers can omit this.
|
|
27
|
+
*/
|
|
28
|
+
contentWrapperRef?: React.RefObject<HTMLDivElement | null>;
|
|
29
|
+
/**
|
|
30
|
+
* When true, custom max width values are capped to the viewport-based max.
|
|
31
|
+
* This prevents overflow in non-wrapping flex layouts (e.g., Sidebar).
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
constrainToViewport?: boolean; /** Callback fired when a resize operation ends (drag release or keyboard key up) */
|
|
35
|
+
onResizeEnd?: (width: number) => void; /** Current/controlled width value in pixels (used instead of internal state; default from `width` is still used for reset) */
|
|
36
|
+
currentWidth?: number;
|
|
37
|
+
};
|
|
38
|
+
type UsePaneWidthResult = {
|
|
39
|
+
/** Current width for React state (used in ARIA attributes) */currentWidth: number; /** Mutable ref tracking width during drag operations */
|
|
40
|
+
currentWidthRef: React.MutableRefObject<number>; /** Minimum allowed pane width */
|
|
41
|
+
minPaneWidth: number; /** Maximum allowed pane width (updates on viewport resize) */
|
|
42
|
+
maxPaneWidth: number; /** Calculate current max width constraint */
|
|
43
|
+
getMaxPaneWidth: () => number; /** Persist width to localStorage and sync React state */
|
|
44
|
+
saveWidth: (value: number) => void; /** Reset to default width */
|
|
45
|
+
getDefaultWidth: () => number;
|
|
46
|
+
};
|
|
47
|
+
/** Default widths for preset size options */
|
|
48
|
+
declare const defaultPaneWidth: Record<PaneWidth, number>;
|
|
49
|
+
/**
|
|
50
|
+
* Manages pane width state with storage persistence and viewport constraints.
|
|
51
|
+
* Handles initialization from storage, clamping on viewport resize, and provides
|
|
52
|
+
* functions to save and reset width.
|
|
53
|
+
*
|
|
54
|
+
* Storage behavior:
|
|
55
|
+
* - When `resizable` is `true` and `onResizeEnd` is not provided: Uses localStorage
|
|
56
|
+
* - When `onResizeEnd` is provided: Calls the callback instead of localStorage
|
|
57
|
+
* - When `resizable` is `false` or `undefined`: Not resizable, no persistence
|
|
58
|
+
*/
|
|
59
|
+
declare function usePaneWidth({
|
|
60
|
+
width,
|
|
61
|
+
minWidth,
|
|
62
|
+
resizable,
|
|
63
|
+
widthStorageKey,
|
|
64
|
+
paneRef,
|
|
65
|
+
handleRef,
|
|
66
|
+
contentWrapperRef,
|
|
67
|
+
constrainToViewport,
|
|
68
|
+
onResizeEnd,
|
|
69
|
+
currentWidth: controlledWidth
|
|
70
|
+
}: UsePaneWidthOptions): UsePaneWidthResult;
|
|
17
71
|
//#endregion
|
|
18
|
-
export { CustomWidthOptions, PaneWidth, PaneWidthValue };
|
|
72
|
+
export { CustomWidthOptions, PaneWidth, PaneWidthValue, UsePaneWidthOptions, UsePaneWidthResult, defaultPaneWidth, usePaneWidth };
|
|
@@ -47,13 +47,18 @@ function getMaxWidthDiffFromViewport() {
|
|
|
47
47
|
if (!canUseDOM) return DEFAULT_MAX_WIDTH_DIFF;
|
|
48
48
|
return window.innerWidth >= DEFAULT_PANE_MAX_WIDTH_DIFF_BREAKPOINT ? WIDE_MAX_WIDTH_DIFF : DEFAULT_MAX_WIDTH_DIFF;
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Default formatter for the drag handle's `aria-valuetext`.
|
|
52
|
+
* Kept in sync between the rendered attribute and drag-time DOM writes.
|
|
53
|
+
*/
|
|
54
|
+
const defaultFormatValueText = (valueNow) => `Pane width ${valueNow} pixels`;
|
|
55
|
+
const updateAriaValues = (handle, values, formatValueText = defaultFormatValueText) => {
|
|
51
56
|
if (!handle) return;
|
|
52
57
|
if (values.min !== void 0) handle.setAttribute("aria-valuemin", String(values.min));
|
|
53
58
|
if (values.max !== void 0) handle.setAttribute("aria-valuemax", String(values.max));
|
|
54
59
|
if (values.current !== void 0) {
|
|
55
60
|
handle.setAttribute("aria-valuenow", String(values.current));
|
|
56
|
-
handle.setAttribute("aria-valuetext",
|
|
61
|
+
handle.setAttribute("aria-valuetext", formatValueText(values.current));
|
|
57
62
|
}
|
|
58
63
|
};
|
|
59
64
|
const localStoragePersister = {
|
|
@@ -274,14 +279,14 @@ function usePaneWidth(t0) {
|
|
|
274
279
|
if (isResizing) return;
|
|
275
280
|
isResizing = true;
|
|
276
281
|
(_paneRef$current4 = paneRef.current) === null || _paneRef$current4 === void 0 || _paneRef$current4.setAttribute("data-dragging", "true");
|
|
277
|
-
|
|
282
|
+
contentWrapperRef === null || contentWrapperRef === void 0 || (_contentWrapperRef$cu = contentWrapperRef.current) == null || _contentWrapperRef$cu.setAttribute("data-dragging", "true");
|
|
278
283
|
};
|
|
279
284
|
const endResizeOptimizations = () => {
|
|
280
285
|
var _paneRef$current5, _contentWrapperRef$cu2;
|
|
281
286
|
if (!isResizing) return;
|
|
282
287
|
isResizing = false;
|
|
283
288
|
(_paneRef$current5 = paneRef.current) === null || _paneRef$current5 === void 0 || _paneRef$current5.removeAttribute("data-dragging");
|
|
284
|
-
|
|
289
|
+
contentWrapperRef === null || contentWrapperRef === void 0 || (_contentWrapperRef$cu2 = contentWrapperRef.current) == null || _contentWrapperRef$cu2.removeAttribute("data-dragging");
|
|
285
290
|
};
|
|
286
291
|
const handleResize = () => {
|
|
287
292
|
startResizeOptimizations();
|
|
@@ -357,4 +362,4 @@ function usePaneWidth(t0) {
|
|
|
357
362
|
return t14;
|
|
358
363
|
}
|
|
359
364
|
//#endregion
|
|
360
|
-
export { DEFAULT_MAX_WIDTH_DIFF, DEFAULT_SIDEBAR_MAX_WIDTH_DIFF, defaultPaneWidth, getDefaultPaneWidth, getMaxWidthDiffFromViewport, isCustomWidthOptions, isPaneWidth, updateAriaValues, usePaneWidth };
|
|
365
|
+
export { DEFAULT_MAX_WIDTH_DIFF, DEFAULT_SIDEBAR_MAX_WIDTH_DIFF, defaultFormatValueText, defaultPaneWidth, getDefaultPaneWidth, getMaxWidthDiffFromViewport, isCustomWidthOptions, isPaneWidth, updateAriaValues, usePaneWidth };
|
|
@@ -12,8 +12,8 @@ import { c } from "react-compiler-runtime";
|
|
|
12
12
|
import { clsx } from "clsx";
|
|
13
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
14
|
import React, { useRef, useState } from "react";
|
|
15
|
-
import { isFocusable } from "@primer/behaviors/utils";
|
|
16
15
|
import { FocusKeys } from "@primer/behaviors";
|
|
16
|
+
import { isFocusable } from "@primer/behaviors/utils";
|
|
17
17
|
import { isValidElementType } from "react-is";
|
|
18
18
|
//#region src/TextInputWithTokens/TextInputWithTokens.tsx
|
|
19
19
|
/**
|
|
@@ -184,13 +184,12 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
|
|
|
184
184
|
(_child$props$onFocus = (_child$props3 = child.props).onFocus) === null || _child$props$onFocus === void 0 || _child$props$onFocus.call(_child$props3, event);
|
|
185
185
|
},
|
|
186
186
|
onMouseOverCapture: (event) => {
|
|
187
|
-
const delayTime = delayTimeMap[delay] || 50;
|
|
188
187
|
openTimeoutRef.current = safeSetTimeout(() => {
|
|
189
188
|
var _child$props$onMouseE, _child$props4;
|
|
190
189
|
if (!openTimeoutRef.current) return;
|
|
191
190
|
openTooltip();
|
|
192
191
|
(_child$props$onMouseE = (_child$props4 = child.props).onMouseEnter) === null || _child$props$onMouseE === void 0 || _child$props$onMouseE.call(_child$props4, event);
|
|
193
|
-
},
|
|
192
|
+
}, delayTimeMap[delay] || 50);
|
|
194
193
|
},
|
|
195
194
|
onMouseLeave: (event) => {
|
|
196
195
|
var _child$props$onMouseL, _child$props5;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
2
|
-
import { isSlot } from "../utils/is-slot.js";
|
|
3
|
-
import { useSlots } from "../hooks/useSlots.js";
|
|
4
2
|
import Spinner from "../Spinner/Spinner.js";
|
|
5
3
|
import { AriaStatus } from "../live-region/AriaStatus.js";
|
|
6
4
|
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
@@ -12,6 +10,8 @@ import useSafeTimeout from "../hooks/useSafeTimeout.js";
|
|
|
12
10
|
import { Tooltip } from "../TooltipV2/Tooltip.js";
|
|
13
11
|
import { IconButton } from "../Button/IconButton.js";
|
|
14
12
|
import { ButtonComponent } from "../Button/Button.js";
|
|
13
|
+
import { isSlot } from "../utils/is-slot.js";
|
|
14
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
15
15
|
import { Dialog } from "../Dialog/Dialog.js";
|
|
16
16
|
import { ConfirmationDialog } from "../ConfirmationDialog/ConfirmationDialog.js";
|
|
17
17
|
import { ActionList } from "../ActionList/index.js";
|
|
@@ -349,10 +349,7 @@ const SubTree = ({ count, state, children, "aria-label": ariaLabel }) => {
|
|
|
349
349
|
});
|
|
350
350
|
setLoadingFocused(false);
|
|
351
351
|
}
|
|
352
|
-
} else if (state === "loading") {
|
|
353
|
-
const parentName = getAccessibleName(parentElement);
|
|
354
|
-
announceUpdate(`${parentName} content loading`);
|
|
355
|
-
}
|
|
352
|
+
} else if (state === "loading") announceUpdate(`${getAccessibleName(parentElement)} content loading`);
|
|
356
353
|
}, [
|
|
357
354
|
loadingFocused,
|
|
358
355
|
previousState,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useProvidedRefOrCreate } from "../../hooks/useProvidedRefOrCreate.js";
|
|
2
2
|
import { useAnchoredPosition } from "../../hooks/useAnchoredPosition.js";
|
|
3
3
|
import { useId as useId$1 } from "../../hooks/useId.js";
|
|
4
|
-
import { isSlot } from "../../utils/is-slot.js";
|
|
5
|
-
import { useSlots } from "../../hooks/useSlots.js";
|
|
6
4
|
import Spinner from "../../Spinner/Spinner.js";
|
|
7
5
|
import { AriaStatus } from "../../live-region/AriaStatus.js";
|
|
8
6
|
import { invariant } from "../../utils/invariant.js";
|
|
9
7
|
import { IconButton } from "../../Button/IconButton.js";
|
|
10
8
|
import { ButtonComponent } from "../../Button/Button.js";
|
|
11
9
|
import { useResponsiveValue } from "../../hooks/useResponsiveValue.js";
|
|
10
|
+
import { isSlot } from "../../utils/is-slot.js";
|
|
11
|
+
import { useSlots } from "../../hooks/useSlots.js";
|
|
12
12
|
import { ActionListContainerContext } from "../../ActionList/ActionListContainerContext.js";
|
|
13
13
|
import Heading from "../../Heading/Heading.js";
|
|
14
14
|
import Link from "../../Link/Link.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import useIsomorphicLayoutEffect from "../../utils/useIsomorphicLayoutEffect.js";
|
|
2
2
|
import { useResizeObserver } from "../../hooks/useResizeObserver.js";
|
|
3
3
|
import { useId as useId$1 } from "../../hooks/useId.js";
|
|
4
|
-
import { isSlot } from "../../utils/is-slot.js";
|
|
5
4
|
import { invariant } from "../../utils/invariant.js";
|
|
5
|
+
import { isSlot } from "../../utils/is-slot.js";
|
|
6
6
|
import { createComponent } from "../../utils/create-component.js";
|
|
7
7
|
import { UnderlineItem, UnderlineItemList, UnderlineWrapper } from "../../internal/components/UnderlineTabbedInterface.js";
|
|
8
8
|
import UnderlinePanels_module_css_default from "./UnderlinePanels.module.css.js";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useSlots } from "../hooks/useSlots.js";
|
|
3
2
|
import { Announce } from "../live-region/Announce.js";
|
|
4
3
|
import { AriaAlert } from "../live-region/AriaAlert.js";
|
|
5
4
|
import { AriaStatus } from "../live-region/AriaStatus.js";
|
|
@@ -7,6 +6,7 @@ import { ButtonBase } from "../Button/ButtonBase.js";
|
|
|
7
6
|
import { KeybindingHint } from "../KeybindingHint/KeybindingHint.js";
|
|
8
7
|
import { getAccessibleKeybindingHintString } from "../KeybindingHint/utils.js";
|
|
9
8
|
import { Tooltip } from "../TooltipV2/Tooltip.js";
|
|
9
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
10
10
|
import { useOverflow } from "../hooks/useOverflow.js";
|
|
11
11
|
import { ScrollableRegion } from "../ScrollableRegion/ScrollableRegion.js";
|
|
12
12
|
import { Dialog } from "../Dialog/Dialog.js";
|
package/dist/hooks/useDialog.js
CHANGED
|
@@ -91,8 +91,7 @@ function useDialog(t0) {
|
|
|
91
91
|
let t8;
|
|
92
92
|
if ($[15] !== getFocusableItem) {
|
|
93
93
|
t8 = (e_1) => {
|
|
94
|
-
const
|
|
95
|
-
const focusableItem_0 = getFocusableItem(e_1, movement_0);
|
|
94
|
+
const focusableItem_0 = getFocusableItem(e_1, e_1.shiftKey ? -1 : 1);
|
|
96
95
|
if (!focusableItem_0) return;
|
|
97
96
|
focusableItem_0.focus();
|
|
98
97
|
};
|
|
@@ -15,8 +15,7 @@ function useScrollFlash(scrollContainerRef) {
|
|
|
15
15
|
if (!scrollContainer) return;
|
|
16
16
|
const id = requestAnimationFrame(() => {
|
|
17
17
|
const currentScroll = scrollContainer.scrollTop;
|
|
18
|
-
|
|
19
|
-
scrollContainer.scrollTop = altScroll;
|
|
18
|
+
scrollContainer.scrollTop = currentScroll < 1 ? currentScroll + 1 : currentScroll - 1;
|
|
20
19
|
scrollContainer.scrollTop = currentScroll;
|
|
21
20
|
});
|
|
22
21
|
return () => cancelAnimationFrame(id);
|