@primer/react 0.0.0-20260710210842 → 0.0.0-20260714134147
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 +15 -3
- package/dist/ActionBar/ActionBar.js +1 -1
- package/dist/ActionList/Group.js +1 -1
- package/dist/ActionList/List.js +10 -16
- package/dist/AnchoredOverlay/AnchoredOverlay.js +3 -10
- package/dist/Autocomplete/AutocompleteInput.js +7 -10
- package/dist/ButtonGroup/ButtonGroup.js +5 -12
- package/dist/Checkbox/Checkbox.js +3 -10
- package/dist/Dialog/Dialog.js +2 -9
- package/dist/FeatureFlags/DefaultFeatureFlags.js +1 -2
- package/dist/FilteredActionList/FilteredActionList.js +4 -15
- package/dist/FilteredActionList/FilteredActionListInput.d.ts +1 -1
- package/dist/Overlay/Overlay.js +1 -1
- package/dist/PageHeader/PageHeader.js +9 -18
- package/dist/PageLayout/DragHandle.d.ts +38 -0
- package/dist/PageLayout/DragHandle.js +220 -0
- package/dist/PageLayout/PageLayout.js +67 -260
- 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/SelectPanel/SelectPanel.js +1 -1
- package/dist/TextInput/TextInput.js +3 -10
- package/dist/TooltipV2/Tooltip.js +2 -9
- package/dist/experimental/Tabs/types.d.ts +2 -2
- package/dist/experimental/Tabs/useTabList.js +7 -15
- package/dist/experimental/index.js +3 -3
- package/dist/hooks/useAnchoredPosition.js +14 -1
- package/dist/hooks/useMergedRefs.js +1 -4
- package/dist/hooks/useProvidedRefOrCreate.d.ts +10 -7
- package/dist/hooks/useProvidedRefOrCreate.js +10 -7
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import PageLayout_module_css_default from "./PageLayout.module.css.js";
|
|
2
|
+
import { defaultFormatValueText } from "./usePaneWidth.js";
|
|
3
|
+
import { removeDraggingStyles, setDraggingStyles } from "./paneUtils.js";
|
|
4
|
+
import { c } from "react-compiler-runtime";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import React, { memo } from "react";
|
|
7
|
+
//#region src/PageLayout/DragHandle.tsx
|
|
8
|
+
const isArrowKey = (key) => key === "ArrowLeft" || key === "ArrowRight" || key === "ArrowUp" || key === "ArrowDown";
|
|
9
|
+
const isShrinkKey = (key) => key === "ArrowLeft" || key === "ArrowDown";
|
|
10
|
+
/**
|
|
11
|
+
* DragHandle - handles all pointer and keyboard interactions for resizing.
|
|
12
|
+
* ARIA values are set in JSX for SSR accessibility, then updated via DOM
|
|
13
|
+
* manipulation during drag for performance. The consumer owns writing the width
|
|
14
|
+
* (via the `onDrag` callback); this component only reports interactions.
|
|
15
|
+
*/
|
|
16
|
+
const DragHandle = /*#__PURE__*/ memo(function DragHandle(t0) {
|
|
17
|
+
const $ = c(39);
|
|
18
|
+
const { handleRef, onDragStart, onDrag, onDragEnd, onDoubleClick, "aria-valuemin": ariaValueMin, "aria-valuemax": ariaValueMax, "aria-valuenow": ariaValueNow, dragTargetRef, contentWrapperRef, formatValueText: t1, "data-component": t2 } = t0;
|
|
19
|
+
const formatValueText = t1 === void 0 ? defaultFormatValueText : t1;
|
|
20
|
+
const dataComponent = t2 === void 0 ? "PageLayout.DragHandle" : t2;
|
|
21
|
+
const stableOnDragStart = React.useRef(onDragStart);
|
|
22
|
+
const stableOnDrag = React.useRef(onDrag);
|
|
23
|
+
const stableOnDragEnd = React.useRef(onDragEnd);
|
|
24
|
+
let t3;
|
|
25
|
+
if ($[0] !== onDrag || $[1] !== onDragEnd || $[2] !== onDragStart) {
|
|
26
|
+
t3 = () => {
|
|
27
|
+
stableOnDragStart.current = onDragStart;
|
|
28
|
+
stableOnDrag.current = onDrag;
|
|
29
|
+
stableOnDragEnd.current = onDragEnd;
|
|
30
|
+
};
|
|
31
|
+
$[0] = onDrag;
|
|
32
|
+
$[1] = onDragEnd;
|
|
33
|
+
$[2] = onDragStart;
|
|
34
|
+
$[3] = t3;
|
|
35
|
+
} else t3 = $[3];
|
|
36
|
+
React.useEffect(t3);
|
|
37
|
+
const isDraggingRef = React.useRef(false);
|
|
38
|
+
let t4;
|
|
39
|
+
if ($[4] !== contentWrapperRef || $[5] !== dragTargetRef || $[6] !== handleRef) {
|
|
40
|
+
t4 = () => {
|
|
41
|
+
var _dragTargetRef$curren, _contentWrapperRef$cu;
|
|
42
|
+
if (isDraggingRef.current) return;
|
|
43
|
+
setDraggingStyles({
|
|
44
|
+
handle: handleRef.current,
|
|
45
|
+
pane: (_dragTargetRef$curren = dragTargetRef === null || dragTargetRef === void 0 ? void 0 : dragTargetRef.current) !== null && _dragTargetRef$curren !== void 0 ? _dragTargetRef$curren : null,
|
|
46
|
+
contentWrapper: (_contentWrapperRef$cu = contentWrapperRef === null || contentWrapperRef === void 0 ? void 0 : contentWrapperRef.current) !== null && _contentWrapperRef$cu !== void 0 ? _contentWrapperRef$cu : null
|
|
47
|
+
});
|
|
48
|
+
isDraggingRef.current = true;
|
|
49
|
+
};
|
|
50
|
+
$[4] = contentWrapperRef;
|
|
51
|
+
$[5] = dragTargetRef;
|
|
52
|
+
$[6] = handleRef;
|
|
53
|
+
$[7] = t4;
|
|
54
|
+
} else t4 = $[7];
|
|
55
|
+
const startDragging = t4;
|
|
56
|
+
let t5;
|
|
57
|
+
if ($[8] !== contentWrapperRef || $[9] !== dragTargetRef || $[10] !== handleRef) {
|
|
58
|
+
t5 = () => {
|
|
59
|
+
var _dragTargetRef$curren2, _contentWrapperRef$cu2;
|
|
60
|
+
if (!isDraggingRef.current) return;
|
|
61
|
+
removeDraggingStyles({
|
|
62
|
+
handle: handleRef.current,
|
|
63
|
+
pane: (_dragTargetRef$curren2 = dragTargetRef === null || dragTargetRef === void 0 ? void 0 : dragTargetRef.current) !== null && _dragTargetRef$curren2 !== void 0 ? _dragTargetRef$curren2 : null,
|
|
64
|
+
contentWrapper: (_contentWrapperRef$cu2 = contentWrapperRef === null || contentWrapperRef === void 0 ? void 0 : contentWrapperRef.current) !== null && _contentWrapperRef$cu2 !== void 0 ? _contentWrapperRef$cu2 : null
|
|
65
|
+
});
|
|
66
|
+
isDraggingRef.current = false;
|
|
67
|
+
};
|
|
68
|
+
$[8] = contentWrapperRef;
|
|
69
|
+
$[9] = dragTargetRef;
|
|
70
|
+
$[10] = handleRef;
|
|
71
|
+
$[11] = t5;
|
|
72
|
+
} else t5 = $[11];
|
|
73
|
+
const endDragging = t5;
|
|
74
|
+
let t6;
|
|
75
|
+
if ($[12] !== startDragging) {
|
|
76
|
+
t6 = (event) => {
|
|
77
|
+
if (event.button !== 0) return;
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
const target = event.currentTarget;
|
|
80
|
+
try {
|
|
81
|
+
target.setPointerCapture(event.pointerId);
|
|
82
|
+
} catch {}
|
|
83
|
+
stableOnDragStart.current(event.clientX);
|
|
84
|
+
startDragging();
|
|
85
|
+
};
|
|
86
|
+
$[12] = startDragging;
|
|
87
|
+
$[13] = t6;
|
|
88
|
+
} else t6 = $[13];
|
|
89
|
+
const handlePointerDown = t6;
|
|
90
|
+
const rafIdRef = React.useRef(null);
|
|
91
|
+
const pendingClientXRef = React.useRef(null);
|
|
92
|
+
let t7;
|
|
93
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
94
|
+
t7 = (event_0) => {
|
|
95
|
+
if (!isDraggingRef.current) return;
|
|
96
|
+
event_0.preventDefault();
|
|
97
|
+
pendingClientXRef.current = event_0.clientX;
|
|
98
|
+
if (rafIdRef.current === null) rafIdRef.current = requestAnimationFrame(() => {
|
|
99
|
+
rafIdRef.current = null;
|
|
100
|
+
if (pendingClientXRef.current !== null) {
|
|
101
|
+
stableOnDrag.current(pendingClientXRef.current, false);
|
|
102
|
+
pendingClientXRef.current = null;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
$[14] = t7;
|
|
107
|
+
} else t7 = $[14];
|
|
108
|
+
const handlePointerMove = t7;
|
|
109
|
+
let t8;
|
|
110
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
111
|
+
t8 = (event_1) => {
|
|
112
|
+
if (!isDraggingRef.current) return;
|
|
113
|
+
event_1.preventDefault();
|
|
114
|
+
};
|
|
115
|
+
$[15] = t8;
|
|
116
|
+
} else t8 = $[15];
|
|
117
|
+
const handlePointerUp = t8;
|
|
118
|
+
let t9;
|
|
119
|
+
if ($[16] !== endDragging) {
|
|
120
|
+
t9 = () => {
|
|
121
|
+
if (!isDraggingRef.current) return;
|
|
122
|
+
if (rafIdRef.current !== null) {
|
|
123
|
+
cancelAnimationFrame(rafIdRef.current);
|
|
124
|
+
rafIdRef.current = null;
|
|
125
|
+
pendingClientXRef.current = null;
|
|
126
|
+
}
|
|
127
|
+
endDragging();
|
|
128
|
+
stableOnDragEnd.current();
|
|
129
|
+
};
|
|
130
|
+
$[16] = endDragging;
|
|
131
|
+
$[17] = t9;
|
|
132
|
+
} else t9 = $[17];
|
|
133
|
+
const handleLostPointerCapture = t9;
|
|
134
|
+
let t10;
|
|
135
|
+
if ($[18] !== startDragging) {
|
|
136
|
+
t10 = (event_2) => {
|
|
137
|
+
if (!isArrowKey(event_2.key)) return;
|
|
138
|
+
event_2.preventDefault();
|
|
139
|
+
const delta = isShrinkKey(event_2.key) ? -3 : 3;
|
|
140
|
+
if (!isDraggingRef.current) startDragging();
|
|
141
|
+
stableOnDrag.current(delta, true);
|
|
142
|
+
};
|
|
143
|
+
$[18] = startDragging;
|
|
144
|
+
$[19] = t10;
|
|
145
|
+
} else t10 = $[19];
|
|
146
|
+
const handleKeyDown = t10;
|
|
147
|
+
let t11;
|
|
148
|
+
if ($[20] !== endDragging) {
|
|
149
|
+
t11 = (event_3) => {
|
|
150
|
+
if (!isArrowKey(event_3.key)) return;
|
|
151
|
+
event_3.preventDefault();
|
|
152
|
+
endDragging();
|
|
153
|
+
stableOnDragEnd.current();
|
|
154
|
+
};
|
|
155
|
+
$[20] = endDragging;
|
|
156
|
+
$[21] = t11;
|
|
157
|
+
} else t11 = $[21];
|
|
158
|
+
const handleKeyUp = t11;
|
|
159
|
+
let t12;
|
|
160
|
+
let t13;
|
|
161
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
162
|
+
t12 = () => () => {
|
|
163
|
+
if (rafIdRef.current !== null) {
|
|
164
|
+
cancelAnimationFrame(rafIdRef.current);
|
|
165
|
+
rafIdRef.current = null;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
t13 = [];
|
|
169
|
+
$[22] = t12;
|
|
170
|
+
$[23] = t13;
|
|
171
|
+
} else {
|
|
172
|
+
t12 = $[22];
|
|
173
|
+
t13 = $[23];
|
|
174
|
+
}
|
|
175
|
+
React.useEffect(t12, t13);
|
|
176
|
+
let t14;
|
|
177
|
+
if ($[24] !== ariaValueNow || $[25] !== formatValueText) {
|
|
178
|
+
t14 = ariaValueNow !== void 0 ? formatValueText(ariaValueNow) : void 0;
|
|
179
|
+
$[24] = ariaValueNow;
|
|
180
|
+
$[25] = formatValueText;
|
|
181
|
+
$[26] = t14;
|
|
182
|
+
} else t14 = $[26];
|
|
183
|
+
let t15;
|
|
184
|
+
if ($[27] !== ariaValueMax || $[28] !== ariaValueMin || $[29] !== ariaValueNow || $[30] !== dataComponent || $[31] !== handleKeyDown || $[32] !== handleKeyUp || $[33] !== handleLostPointerCapture || $[34] !== handlePointerDown || $[35] !== handleRef || $[36] !== onDoubleClick || $[37] !== t14) {
|
|
185
|
+
t15 = /*#__PURE__*/ jsx("div", {
|
|
186
|
+
ref: handleRef,
|
|
187
|
+
className: PageLayout_module_css_default.DraggableHandle,
|
|
188
|
+
"data-component": dataComponent,
|
|
189
|
+
role: "slider",
|
|
190
|
+
"aria-label": "Draggable pane splitter",
|
|
191
|
+
"aria-valuemin": ariaValueMin,
|
|
192
|
+
"aria-valuemax": ariaValueMax,
|
|
193
|
+
"aria-valuenow": ariaValueNow,
|
|
194
|
+
"aria-valuetext": t14,
|
|
195
|
+
tabIndex: 0,
|
|
196
|
+
onPointerDown: handlePointerDown,
|
|
197
|
+
onPointerMove: handlePointerMove,
|
|
198
|
+
onPointerUp: handlePointerUp,
|
|
199
|
+
onLostPointerCapture: handleLostPointerCapture,
|
|
200
|
+
onKeyDown: handleKeyDown,
|
|
201
|
+
onKeyUp: handleKeyUp,
|
|
202
|
+
onDoubleClick
|
|
203
|
+
});
|
|
204
|
+
$[27] = ariaValueMax;
|
|
205
|
+
$[28] = ariaValueMin;
|
|
206
|
+
$[29] = ariaValueNow;
|
|
207
|
+
$[30] = dataComponent;
|
|
208
|
+
$[31] = handleKeyDown;
|
|
209
|
+
$[32] = handleKeyUp;
|
|
210
|
+
$[33] = handleLostPointerCapture;
|
|
211
|
+
$[34] = handlePointerDown;
|
|
212
|
+
$[35] = handleRef;
|
|
213
|
+
$[36] = onDoubleClick;
|
|
214
|
+
$[37] = t14;
|
|
215
|
+
$[38] = t15;
|
|
216
|
+
} else t15 = $[38];
|
|
217
|
+
return t15;
|
|
218
|
+
});
|
|
219
|
+
//#endregion
|
|
220
|
+
export { DragHandle };
|
|
@@ -7,14 +7,12 @@ 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(24);
|
|
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, paneRef, contentWrapperRef } = 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] !==
|
|
281
|
+
if ($[2] !== contentWrapperRef || $[3] !== currentWidth || $[4] !== currentWidthRef || $[5] !== dragMaxWidthRef || $[6] !== dragStartClientXRef || $[7] !== dragStartWidthRef || $[8] !== getDefaultWidth || $[9] !== getMaxPaneWidth || $[10] !== handleRef || $[11] !== maxPaneWidth || $[12] !== minPaneWidth || $[13] !== paneRef || $[14] !== position || $[15] !== resizable || $[16] !== saveWidth || $[17] !== sidebarRef) {
|
|
284
282
|
t5 = resizable ? /*#__PURE__*/ jsx(DragHandle, {
|
|
285
283
|
handleRef,
|
|
284
|
+
dragTargetRef: paneRef,
|
|
285
|
+
contentWrapperRef,
|
|
286
286
|
"aria-valuemin": minPaneWidth,
|
|
287
287
|
"aria-valuemax": maxPaneWidth,
|
|
288
288
|
"aria-valuenow": currentWidth,
|
|
@@ -334,24 +334,26 @@ const SidebarDivider = /*#__PURE__*/ memo(function SidebarDivider(t0) {
|
|
|
334
334
|
saveWidth(resetWidth);
|
|
335
335
|
}
|
|
336
336
|
}) : null;
|
|
337
|
-
$[2] =
|
|
338
|
-
$[3] =
|
|
339
|
-
$[4] =
|
|
340
|
-
$[5] =
|
|
341
|
-
$[6] =
|
|
342
|
-
$[7] =
|
|
343
|
-
$[8] =
|
|
344
|
-
$[9] =
|
|
345
|
-
$[10] =
|
|
346
|
-
$[11] =
|
|
347
|
-
$[12] =
|
|
348
|
-
$[13] =
|
|
349
|
-
$[14] =
|
|
350
|
-
$[15] =
|
|
351
|
-
$[16] =
|
|
352
|
-
|
|
337
|
+
$[2] = contentWrapperRef;
|
|
338
|
+
$[3] = currentWidth;
|
|
339
|
+
$[4] = currentWidthRef;
|
|
340
|
+
$[5] = dragMaxWidthRef;
|
|
341
|
+
$[6] = dragStartClientXRef;
|
|
342
|
+
$[7] = dragStartWidthRef;
|
|
343
|
+
$[8] = getDefaultWidth;
|
|
344
|
+
$[9] = getMaxPaneWidth;
|
|
345
|
+
$[10] = handleRef;
|
|
346
|
+
$[11] = maxPaneWidth;
|
|
347
|
+
$[12] = minPaneWidth;
|
|
348
|
+
$[13] = paneRef;
|
|
349
|
+
$[14] = position;
|
|
350
|
+
$[15] = resizable;
|
|
351
|
+
$[16] = saveWidth;
|
|
352
|
+
$[17] = sidebarRef;
|
|
353
|
+
$[18] = t5;
|
|
354
|
+
} else t5 = $[18];
|
|
353
355
|
let t6;
|
|
354
|
-
if ($[
|
|
356
|
+
if ($[19] !== position || $[20] !== t1 || $[21] !== t4 || $[22] !== t5) {
|
|
355
357
|
t6 = /*#__PURE__*/ jsx(VerticalDivider, {
|
|
356
358
|
variant: t1,
|
|
357
359
|
position,
|
|
@@ -359,212 +361,14 @@ const SidebarDivider = /*#__PURE__*/ memo(function SidebarDivider(t0) {
|
|
|
359
361
|
style: t4,
|
|
360
362
|
children: t5
|
|
361
363
|
});
|
|
362
|
-
$[
|
|
363
|
-
$[
|
|
364
|
-
$[
|
|
365
|
-
$[
|
|
366
|
-
$[
|
|
367
|
-
} else t6 = $[
|
|
364
|
+
$[19] = position;
|
|
365
|
+
$[20] = t1;
|
|
366
|
+
$[21] = t4;
|
|
367
|
+
$[22] = t5;
|
|
368
|
+
$[23] = t6;
|
|
369
|
+
} else t6 = $[23];
|
|
368
370
|
return t6;
|
|
369
371
|
});
|
|
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
372
|
const Header = (t0) => {
|
|
569
373
|
const $ = c(29);
|
|
570
374
|
const { "aria-label": label, "aria-labelledby": labelledBy, padding: t1, divider: t2, dividerWhenNarrow: t3, hidden: t4, children, style, className, "data-component": t5 } = t0;
|
|
@@ -745,7 +549,7 @@ const overflowProps = {
|
|
|
745
549
|
role: "region"
|
|
746
550
|
};
|
|
747
551
|
const Pane = /*#__PURE__*/ React.forwardRef((t0, forwardRef) => {
|
|
748
|
-
const $ = c(
|
|
552
|
+
const $ = c(98);
|
|
749
553
|
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
554
|
const responsivePosition = t1 === void 0 ? "end" : t1;
|
|
751
555
|
const positionWhenNarrow = t2 === void 0 ? "inherit" : t2;
|
|
@@ -998,9 +802,11 @@ const Pane = /*#__PURE__*/ React.forwardRef((t0, forwardRef) => {
|
|
|
998
802
|
} else t48 = $[70];
|
|
999
803
|
const t49 = t48;
|
|
1000
804
|
let t50;
|
|
1001
|
-
if ($[71] !==
|
|
805
|
+
if ($[71] !== contentWrapperRef || $[72] !== currentWidth || $[73] !== currentWidthRef || $[74] !== getDefaultWidth || $[75] !== getMaxPaneWidth || $[76] !== maxPaneWidth || $[77] !== minPaneWidth || $[78] !== paneRef || $[79] !== position || $[80] !== resizable || $[81] !== saveWidth) {
|
|
1002
806
|
t50 = resizable ? /*#__PURE__*/ jsx(DragHandle, {
|
|
1003
807
|
handleRef,
|
|
808
|
+
dragTargetRef: paneRef,
|
|
809
|
+
contentWrapperRef,
|
|
1004
810
|
"aria-valuemin": minPaneWidth,
|
|
1005
811
|
"aria-valuemax": maxPaneWidth,
|
|
1006
812
|
"aria-valuenow": currentWidth,
|
|
@@ -1052,20 +858,21 @@ const Pane = /*#__PURE__*/ React.forwardRef((t0, forwardRef) => {
|
|
|
1052
858
|
saveWidth(resetWidth);
|
|
1053
859
|
}
|
|
1054
860
|
}) : null;
|
|
1055
|
-
$[71] =
|
|
1056
|
-
$[72] =
|
|
1057
|
-
$[73] =
|
|
1058
|
-
$[74] =
|
|
1059
|
-
$[75] =
|
|
1060
|
-
$[76] =
|
|
1061
|
-
$[77] =
|
|
1062
|
-
$[78] =
|
|
1063
|
-
$[79] =
|
|
1064
|
-
$[80] =
|
|
1065
|
-
$[81] =
|
|
1066
|
-
|
|
861
|
+
$[71] = contentWrapperRef;
|
|
862
|
+
$[72] = currentWidth;
|
|
863
|
+
$[73] = currentWidthRef;
|
|
864
|
+
$[74] = getDefaultWidth;
|
|
865
|
+
$[75] = getMaxPaneWidth;
|
|
866
|
+
$[76] = maxPaneWidth;
|
|
867
|
+
$[77] = minPaneWidth;
|
|
868
|
+
$[78] = paneRef;
|
|
869
|
+
$[79] = position;
|
|
870
|
+
$[80] = resizable;
|
|
871
|
+
$[81] = saveWidth;
|
|
872
|
+
$[82] = t50;
|
|
873
|
+
} else t50 = $[82];
|
|
1067
874
|
let t51;
|
|
1068
|
-
if ($[
|
|
875
|
+
if ($[83] !== positionProp || $[84] !== resizable || $[85] !== t46 || $[86] !== t49 || $[87] !== t50) {
|
|
1069
876
|
t51 = /*#__PURE__*/ jsx(VerticalDivider, {
|
|
1070
877
|
variant: t46,
|
|
1071
878
|
draggable: resizable,
|
|
@@ -1074,15 +881,15 @@ const Pane = /*#__PURE__*/ React.forwardRef((t0, forwardRef) => {
|
|
|
1074
881
|
style: t49,
|
|
1075
882
|
children: t50
|
|
1076
883
|
});
|
|
1077
|
-
$[
|
|
1078
|
-
$[
|
|
1079
|
-
$[
|
|
1080
|
-
$[
|
|
1081
|
-
$[
|
|
1082
|
-
$[
|
|
1083
|
-
} else t51 = $[
|
|
884
|
+
$[83] = positionProp;
|
|
885
|
+
$[84] = resizable;
|
|
886
|
+
$[85] = t46;
|
|
887
|
+
$[86] = t49;
|
|
888
|
+
$[87] = t50;
|
|
889
|
+
$[88] = t51;
|
|
890
|
+
} else t51 = $[88];
|
|
1084
891
|
let t52;
|
|
1085
|
-
if ($[
|
|
892
|
+
if ($[89] !== t19 || $[90] !== t24 || $[91] !== t25 || $[92] !== t26 || $[93] !== t27 || $[94] !== t32 || $[95] !== t45 || $[96] !== t51) {
|
|
1086
893
|
t52 = /*#__PURE__*/ jsxs("div", {
|
|
1087
894
|
className: t19,
|
|
1088
895
|
style: t24,
|
|
@@ -1095,16 +902,16 @@ const Pane = /*#__PURE__*/ React.forwardRef((t0, forwardRef) => {
|
|
|
1095
902
|
t51
|
|
1096
903
|
]
|
|
1097
904
|
});
|
|
1098
|
-
$[
|
|
1099
|
-
$[
|
|
1100
|
-
$[
|
|
1101
|
-
$[
|
|
1102
|
-
$[
|
|
1103
|
-
$[
|
|
1104
|
-
$[
|
|
1105
|
-
$[
|
|
1106
|
-
$[
|
|
1107
|
-
} else t52 = $[
|
|
905
|
+
$[89] = t19;
|
|
906
|
+
$[90] = t24;
|
|
907
|
+
$[91] = t25;
|
|
908
|
+
$[92] = t26;
|
|
909
|
+
$[93] = t27;
|
|
910
|
+
$[94] = t32;
|
|
911
|
+
$[95] = t45;
|
|
912
|
+
$[96] = t51;
|
|
913
|
+
$[97] = t52;
|
|
914
|
+
} else t52 = $[97];
|
|
1108
915
|
return t52;
|
|
1109
916
|
});
|
|
1110
917
|
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 };
|