@primer/react 0.0.0-20260220162457 → 0.0.0-20260220184804

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 (34) hide show
  1. package/CHANGELOG.md +14 -2
  2. package/dist/Autocomplete/Autocomplete.js +76 -159
  3. package/dist/Autocomplete/AutocompleteMenu.js +128 -333
  4. package/dist/Autocomplete/AutocompleteOverlay.js +49 -130
  5. package/dist/Banner/Banner.js +64 -238
  6. package/dist/Button/Button.js +11 -34
  7. package/dist/Button/IconButton.js +51 -140
  8. package/dist/Button/LinkButton.js +11 -39
  9. package/dist/Checkbox/Checkbox.js +55 -163
  10. package/dist/Dialog/Dialog.js +105 -347
  11. package/dist/FilteredActionList/FilteredActionList.d.ts +16 -1
  12. package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
  13. package/dist/FilteredActionList/FilteredActionList.js +147 -42
  14. package/dist/Overlay/Overlay-15519c09.css +2 -0
  15. package/dist/Overlay/Overlay-15519c09.css.map +1 -0
  16. package/dist/Overlay/Overlay.module.css.js +1 -1
  17. package/dist/PageLayout/PageLayout.js +622 -1560
  18. package/dist/SelectPanel/SelectPanel.d.ts +1 -1
  19. package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
  20. package/dist/SelectPanel/SelectPanel.js +3 -1
  21. package/dist/Text/Text.d.ts +1 -1
  22. package/dist/Text/Text.d.ts.map +1 -1
  23. package/dist/Text/Text.js +10 -13
  24. package/dist/UnderlineNav/UnderlineNavItem.js +56 -149
  25. package/dist/experimental/SelectPanel2/SelectPanel.js +209 -593
  26. package/dist/hooks/useScrollFlash.d.ts.map +1 -1
  27. package/dist/hooks/useScrollFlash.js +14 -22
  28. package/dist/hooks/useSlots.d.ts +50 -6
  29. package/dist/hooks/useSlots.d.ts.map +1 -1
  30. package/dist/hooks/useSlots.js +114 -36
  31. package/generated/components.json +7 -1
  32. package/package.json +2 -2
  33. package/dist/Overlay/Overlay-43cda449.css +0 -2
  34. package/dist/Overlay/Overlay-43cda449.css.map +0 -1
@@ -1,4 +1,3 @@
1
- import { c } from 'react-compiler-runtime';
2
1
  import React, { useRef, memo } from 'react';
3
2
  import { clsx } from 'clsx';
4
3
  import { useId } from '../hooks/useId.js';
@@ -9,9 +8,9 @@ import { useOverflow } from '../hooks/useOverflow.js';
9
8
  import { warning } from '../utils/warning.js';
10
9
  import { getResponsiveAttributes } from '../internal/utils/getResponsiveAttributes.js';
11
10
  import classes from './PageLayout.module.css.js';
12
- import { usePaneWidth, isCustomWidthOptions, isPaneWidth, updateAriaValues, ARROW_KEY_STEP } from './usePaneWidth.js';
11
+ import { usePaneWidth, isPaneWidth, isCustomWidthOptions, updateAriaValues, ARROW_KEY_STEP } from './usePaneWidth.js';
13
12
  import { setDraggingStyles, removeDraggingStyles } from './paneUtils.js';
14
- import { jsxs, jsx } from 'react/jsx-runtime';
13
+ import { jsx, jsxs } from 'react/jsx-runtime';
15
14
 
16
15
  const isArrowKey = key => key === 'ArrowLeft' || key === 'ArrowRight' || key === 'ArrowUp' || key === 'ArrowDown';
17
16
  const isShrinkKey = key => key === 'ArrowLeft' || key === 'ArrowDown';
@@ -34,42 +33,27 @@ const PageLayoutContext = /*#__PURE__*/React.createContext({
34
33
  });
35
34
 
36
35
  // TODO: refs
37
- const Root = t0 => {
38
- const $ = c(24);
39
- const {
40
- containerWidth: t1,
41
- padding: t2,
42
- rowGap: t3,
43
- columnGap: t4,
44
- children,
45
- className,
46
- style,
47
- _slotsConfig: slotsConfig
48
- } = t0;
49
- const containerWidth = t1 === undefined ? "xlarge" : t1;
50
- const padding = t2 === undefined ? "normal" : t2;
51
- const rowGap = t3 === undefined ? "normal" : t3;
52
- const columnGap = t4 === undefined ? "normal" : t4;
36
+ const Root = ({
37
+ containerWidth = 'xlarge',
38
+ padding = 'normal',
39
+ rowGap = 'normal',
40
+ columnGap = 'normal',
41
+ children,
42
+ className,
43
+ style,
44
+ _slotsConfig: slotsConfig
45
+ }) => {
53
46
  const paneRef = useRef(null);
54
47
  const contentWrapperRef = useRef(null);
55
48
  const sidebarRef = useRef(null);
56
49
  const sidebarContentWrapperRef = useRef(null);
57
- let t5;
58
- if ($[0] !== slotsConfig) {
59
- t5 = slotsConfig !== null && slotsConfig !== void 0 ? slotsConfig : {
60
- header: Header,
61
- footer: Footer,
62
- sidebar: Sidebar
63
- };
64
- $[0] = slotsConfig;
65
- $[1] = t5;
66
- } else {
67
- t5 = $[1];
68
- }
69
- const [slots, rest] = useSlots(children, t5);
70
- let t6;
71
- if ($[2] !== columnGap || $[3] !== padding || $[4] !== rowGap) {
72
- t6 = {
50
+ const [slots, rest] = useSlots(children, slotsConfig !== null && slotsConfig !== void 0 ? slotsConfig : {
51
+ header: Header,
52
+ footer: Footer,
53
+ sidebar: Sidebar
54
+ });
55
+ const memoizedContextValue = React.useMemo(() => {
56
+ return {
73
57
  padding,
74
58
  rowGap,
75
59
  columnGap,
@@ -78,301 +62,113 @@ const Root = t0 => {
78
62
  sidebarRef,
79
63
  sidebarContentWrapperRef
80
64
  };
81
- $[2] = columnGap;
82
- $[3] = padding;
83
- $[4] = rowGap;
84
- $[5] = t6;
85
- } else {
86
- t6 = $[5];
87
- }
88
- const memoizedContextValue = t6;
89
- const t7 = !!slots.sidebar;
90
- const t8 = slots.sidebar;
91
- const t9 = slots.header;
92
- let t10;
93
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
94
- t10 = clsx(classes.PageLayoutContent);
95
- $[6] = t10;
96
- } else {
97
- t10 = $[6];
98
- }
99
- let t11;
100
- if ($[7] !== rest) {
101
- t11 = /*#__PURE__*/jsx("div", {
102
- className: t10,
103
- children: rest
104
- });
105
- $[7] = rest;
106
- $[8] = t11;
107
- } else {
108
- t11 = $[8];
109
- }
110
- let t12;
111
- if ($[9] !== containerWidth || $[10] !== slots.footer || $[11] !== slots.header || $[12] !== t11) {
112
- t12 = /*#__PURE__*/jsxs("div", {
113
- ref: sidebarContentWrapperRef,
114
- className: classes.PageLayoutWrapper,
115
- "data-width": containerWidth,
116
- children: [t9, t11, slots.footer]
117
- });
118
- $[9] = containerWidth;
119
- $[10] = slots.footer;
120
- $[11] = slots.header;
121
- $[12] = t11;
122
- $[13] = t12;
123
- } else {
124
- t12 = $[13];
125
- }
126
- let t13;
127
- if ($[14] !== className || $[15] !== padding || $[16] !== slots.sidebar || $[17] !== style || $[18] !== t12 || $[19] !== t7) {
128
- t13 = /*#__PURE__*/jsxs(RootWrapper, {
65
+ }, [padding, rowGap, columnGap, paneRef, contentWrapperRef, sidebarRef, sidebarContentWrapperRef]);
66
+ return /*#__PURE__*/jsx(PageLayoutContext.Provider, {
67
+ value: memoizedContextValue,
68
+ children: /*#__PURE__*/jsxs(RootWrapper, {
129
69
  style: style,
130
70
  padding: padding,
131
71
  className: className,
132
- hasSidebar: t7,
133
- children: [t8, t12]
134
- });
135
- $[14] = className;
136
- $[15] = padding;
137
- $[16] = slots.sidebar;
138
- $[17] = style;
139
- $[18] = t12;
140
- $[19] = t7;
141
- $[20] = t13;
142
- } else {
143
- t13 = $[20];
144
- }
145
- let t14;
146
- if ($[21] !== memoizedContextValue || $[22] !== t13) {
147
- t14 = /*#__PURE__*/jsx(PageLayoutContext.Provider, {
148
- value: memoizedContextValue,
149
- children: t13
150
- });
151
- $[21] = memoizedContextValue;
152
- $[22] = t13;
153
- $[23] = t14;
154
- } else {
155
- t14 = $[23];
156
- }
157
- return t14;
72
+ hasSidebar: !!slots.sidebar,
73
+ children: [slots.sidebar, /*#__PURE__*/jsxs("div", {
74
+ ref: sidebarContentWrapperRef,
75
+ className: classes.PageLayoutWrapper,
76
+ "data-width": containerWidth,
77
+ children: [slots.header, /*#__PURE__*/jsx("div", {
78
+ className: clsx(classes.PageLayoutContent),
79
+ children: rest
80
+ }), slots.footer]
81
+ })]
82
+ })
83
+ });
158
84
  };
159
- const RootWrapper = /*#__PURE__*/memo(t0 => {
160
- const $ = c(10);
161
- const {
162
- style,
163
- padding,
164
- children,
165
- className,
166
- hasSidebar
167
- } = t0;
168
- const t1 = `var(--spacing-${padding})`;
169
- let t2;
170
- if ($[0] !== style || $[1] !== t1) {
171
- t2 = {
172
- "--spacing": t1,
85
+ Root.displayName = "Root";
86
+ const RootWrapper = /*#__PURE__*/memo(({
87
+ style,
88
+ padding,
89
+ children,
90
+ className,
91
+ hasSidebar
92
+ }) => {
93
+ return /*#__PURE__*/jsx("div", {
94
+ style: {
95
+ '--spacing': `var(--spacing-${padding})`,
173
96
  ...style
174
- };
175
- $[0] = style;
176
- $[1] = t1;
177
- $[2] = t2;
178
- } else {
179
- t2 = $[2];
180
- }
181
- const t3 = t2;
182
- let t4;
183
- if ($[3] !== className) {
184
- t4 = clsx(classes.PageLayoutRoot, className);
185
- $[3] = className;
186
- $[4] = t4;
187
- } else {
188
- t4 = $[4];
189
- }
190
- const t5 = hasSidebar || undefined;
191
- let t6;
192
- if ($[5] !== children || $[6] !== t3 || $[7] !== t4 || $[8] !== t5) {
193
- t6 = /*#__PURE__*/jsx("div", {
194
- style: t3,
195
- className: t4,
196
- "data-has-sidebar": t5,
197
- children: children
198
- });
199
- $[5] = children;
200
- $[6] = t3;
201
- $[7] = t4;
202
- $[8] = t5;
203
- $[9] = t6;
204
- } else {
205
- t6 = $[9];
206
- }
207
- return t6;
97
+ },
98
+ className: clsx(classes.PageLayoutRoot, className),
99
+ "data-has-sidebar": hasSidebar || undefined,
100
+ children: children
101
+ });
208
102
  });
209
103
  Root.displayName = 'PageLayout';
210
104
 
211
105
  // ----------------------------------------------------------------------------
212
106
  // Divider (internal)
213
107
 
214
- const HorizontalDivider = /*#__PURE__*/memo(t0 => {
215
- const $ = c(14);
216
- const {
217
- variant: t1,
218
- className,
219
- position,
220
- style
221
- } = t0;
222
- const variant = t1 === undefined ? "none" : t1;
108
+ const HorizontalDivider = /*#__PURE__*/memo(({
109
+ variant = 'none',
110
+ className,
111
+ position,
112
+ style
113
+ }) => {
223
114
  const {
224
115
  padding
225
116
  } = React.useContext(PageLayoutContext);
226
- let t2;
227
- if ($[0] !== className) {
228
- t2 = clsx(classes.HorizontalDivider, className);
229
- $[0] = className;
230
- $[1] = t2;
231
- } else {
232
- t2 = $[1];
233
- }
234
- let t3;
235
- if ($[2] !== variant) {
236
- t3 = getResponsiveAttributes("variant", variant);
237
- $[2] = variant;
238
- $[3] = t3;
239
- } else {
240
- t3 = $[3];
241
- }
242
- let t4;
243
- if ($[4] !== position) {
244
- t4 = getResponsiveAttributes("position", position);
245
- $[4] = position;
246
- $[5] = t4;
247
- } else {
248
- t4 = $[5];
249
- }
250
- const t5 = `var(--spacing-${padding})`;
251
- let t6;
252
- if ($[6] !== style || $[7] !== t5) {
253
- t6 = {
254
- "--spacing-divider": t5,
117
+ return /*#__PURE__*/jsx("div", {
118
+ className: clsx(classes.HorizontalDivider, className),
119
+ ...getResponsiveAttributes('variant', variant),
120
+ ...getResponsiveAttributes('position', position),
121
+ style: {
122
+ '--spacing-divider': `var(--spacing-${padding})`,
255
123
  ...style
256
- };
257
- $[6] = style;
258
- $[7] = t5;
259
- $[8] = t6;
260
- } else {
261
- t6 = $[8];
262
- }
263
- const t7 = t6;
264
- let t8;
265
- if ($[9] !== t2 || $[10] !== t3 || $[11] !== t4 || $[12] !== t7) {
266
- t8 = /*#__PURE__*/jsx("div", {
267
- className: t2,
268
- ...t3,
269
- ...t4,
270
- style: t7
271
- });
272
- $[9] = t2;
273
- $[10] = t3;
274
- $[11] = t4;
275
- $[12] = t7;
276
- $[13] = t8;
277
- } else {
278
- t8 = $[13];
279
- }
280
- return t8;
124
+ }
125
+ });
281
126
  });
282
127
  HorizontalDivider.displayName = 'HorizontalDivider';
283
- const VerticalDivider = /*#__PURE__*/memo(t0 => {
284
- const $ = c(12);
285
- const {
286
- variant: t1,
287
- position,
288
- className,
289
- style,
290
- children
291
- } = t0;
292
- const variant = t1 === undefined ? "none" : t1;
293
- let t2;
294
- if ($[0] !== className) {
295
- t2 = clsx(classes.VerticalDivider, className);
296
- $[0] = className;
297
- $[1] = t2;
298
- } else {
299
- t2 = $[1];
300
- }
301
- let t3;
302
- if ($[2] !== variant) {
303
- t3 = getResponsiveAttributes("variant", variant);
304
- $[2] = variant;
305
- $[3] = t3;
306
- } else {
307
- t3 = $[3];
308
- }
309
- let t4;
310
- if ($[4] !== position) {
311
- t4 = getResponsiveAttributes("position", position);
312
- $[4] = position;
313
- $[5] = t4;
314
- } else {
315
- t4 = $[5];
316
- }
317
- let t5;
318
- if ($[6] !== children || $[7] !== style || $[8] !== t2 || $[9] !== t3 || $[10] !== t4) {
319
- t5 = /*#__PURE__*/jsx("div", {
320
- className: t2,
321
- ...t3,
322
- ...t4,
323
- style: style,
324
- children: children
325
- });
326
- $[6] = children;
327
- $[7] = style;
328
- $[8] = t2;
329
- $[9] = t3;
330
- $[10] = t4;
331
- $[11] = t5;
332
- } else {
333
- t5 = $[11];
334
- }
335
- return t5;
128
+ const VerticalDivider = /*#__PURE__*/memo(({
129
+ variant = 'none',
130
+ position,
131
+ className,
132
+ style,
133
+ children
134
+ }) => {
135
+ return /*#__PURE__*/jsx("div", {
136
+ className: clsx(classes.VerticalDivider, className),
137
+ ...getResponsiveAttributes('variant', variant),
138
+ ...getResponsiveAttributes('position', position),
139
+ style: style,
140
+ children: children
141
+ });
336
142
  });
337
143
  VerticalDivider.displayName = 'VerticalDivider';
338
- const SidebarDivider = /*#__PURE__*/memo(function SidebarDivider(t0) {
339
- const $ = c(22);
340
- const {
341
- position,
342
- divider,
343
- resizable,
344
- minPaneWidth,
345
- maxPaneWidth,
346
- currentWidth,
347
- currentWidthRef,
348
- handleRef,
349
- sidebarRef,
350
- dragStartClientXRef,
351
- dragStartWidthRef,
352
- dragMaxWidthRef,
353
- getMaxPaneWidth,
354
- getDefaultWidth,
355
- saveWidth
356
- } = t0;
144
+ const SidebarDivider = /*#__PURE__*/memo(function SidebarDivider({
145
+ position,
146
+ divider,
147
+ resizable,
148
+ minPaneWidth,
149
+ maxPaneWidth,
150
+ currentWidth,
151
+ currentWidthRef,
152
+ handleRef,
153
+ sidebarRef,
154
+ dragStartClientXRef,
155
+ dragStartWidthRef,
156
+ dragMaxWidthRef,
157
+ getMaxPaneWidth,
158
+ getDefaultWidth,
159
+ saveWidth
160
+ }) {
357
161
  const {
358
162
  columnGap
359
163
  } = React.useContext(PageLayoutContext);
360
- const t1 = resizable ? "line" : divider;
361
- const t2 = `var(--spacing-${columnGap})`;
362
- let t3;
363
- if ($[0] !== t2) {
364
- t3 = {
365
- "--spacing": t2
366
- };
367
- $[0] = t2;
368
- $[1] = t3;
369
- } else {
370
- t3 = $[1];
371
- }
372
- const t4 = t3;
373
- let t5;
374
- 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) {
375
- t5 = resizable ? /*#__PURE__*/jsx(DragHandle, {
164
+ return /*#__PURE__*/jsx(VerticalDivider, {
165
+ variant: resizable ? 'line' : divider,
166
+ position: position,
167
+ className: classes.SidebarVerticalDivider,
168
+ style: {
169
+ '--spacing': `var(--spacing-${columnGap})`
170
+ },
171
+ children: resizable ? /*#__PURE__*/jsx(DragHandle, {
376
172
  handleRef: handleRef,
377
173
  "aria-valuemin": minPaneWidth,
378
174
  "aria-valuemax": maxPaneWidth,
@@ -386,12 +182,14 @@ const SidebarDivider = /*#__PURE__*/memo(function SidebarDivider(t0) {
386
182
  onDrag: (value, isKeyboard) => {
387
183
  const maxWidth = isKeyboard ? getMaxPaneWidth() : dragMaxWidthRef.current;
388
184
  if (isKeyboard) {
389
- const delta = position === "end" ? -value : value;
185
+ // For position='end': invert the delta so arrow keys feel natural
186
+ // ArrowRight should shrink (move divider right), ArrowLeft should expand
187
+ const delta = position === 'end' ? -value : value;
390
188
  const newWidth = Math.max(minPaneWidth, Math.min(maxWidth, currentWidthRef.current + delta));
391
189
  if (newWidth !== currentWidthRef.current) {
392
190
  var _sidebarRef$current2;
393
191
  currentWidthRef.current = newWidth;
394
- (_sidebarRef$current2 = sidebarRef.current) === null || _sidebarRef$current2 === void 0 ? void 0 : _sidebarRef$current2.style.setProperty("--pane-width", `${newWidth}px`);
192
+ (_sidebarRef$current2 = sidebarRef.current) === null || _sidebarRef$current2 === void 0 ? void 0 : _sidebarRef$current2.style.setProperty('--pane-width', `${newWidth}px`);
395
193
  updateAriaValues(handleRef.current, {
396
194
  current: newWidth,
397
195
  max: maxWidth
@@ -400,11 +198,13 @@ const SidebarDivider = /*#__PURE__*/memo(function SidebarDivider(t0) {
400
198
  } else {
401
199
  if (sidebarRef.current) {
402
200
  const deltaX = value - dragStartClientXRef.current;
403
- const directedDelta = position === "end" ? -deltaX : deltaX;
404
- const newWidth_0 = dragStartWidthRef.current + directedDelta;
405
- const clampedWidth = Math.max(minPaneWidth, Math.min(maxWidth, newWidth_0));
201
+ // For position='end': cursor moving left (negative delta) increases width
202
+ // For position='start': cursor moving right (positive delta) increases width
203
+ const directedDelta = position === 'end' ? -deltaX : deltaX;
204
+ const newWidth = dragStartWidthRef.current + directedDelta;
205
+ const clampedWidth = Math.max(minPaneWidth, Math.min(maxWidth, newWidth));
406
206
  if (Math.round(clampedWidth) !== Math.round(currentWidthRef.current)) {
407
- sidebarRef.current.style.setProperty("--pane-width", `${clampedWidth}px`);
207
+ sidebarRef.current.style.setProperty('--pane-width', `${clampedWidth}px`);
408
208
  currentWidthRef.current = clampedWidth;
409
209
  updateAriaValues(handleRef.current, {
410
210
  current: Math.round(clampedWidth),
@@ -420,7 +220,7 @@ const SidebarDivider = /*#__PURE__*/memo(function SidebarDivider(t0) {
420
220
  onDoubleClick: () => {
421
221
  const resetWidth = getDefaultWidth();
422
222
  if (sidebarRef.current) {
423
- sidebarRef.current.style.setProperty("--pane-width", `${resetWidth}px`);
223
+ sidebarRef.current.style.setProperty('--pane-width', `${resetWidth}px`);
424
224
  currentWidthRef.current = resetWidth;
425
225
  updateAriaValues(handleRef.current, {
426
226
  current: resetWidth
@@ -428,643 +228,328 @@ const SidebarDivider = /*#__PURE__*/memo(function SidebarDivider(t0) {
428
228
  }
429
229
  saveWidth(resetWidth);
430
230
  }
431
- }) : null;
432
- $[2] = currentWidth;
433
- $[3] = currentWidthRef;
434
- $[4] = dragMaxWidthRef;
435
- $[5] = dragStartClientXRef;
436
- $[6] = dragStartWidthRef;
437
- $[7] = getDefaultWidth;
438
- $[8] = getMaxPaneWidth;
439
- $[9] = handleRef;
440
- $[10] = maxPaneWidth;
441
- $[11] = minPaneWidth;
442
- $[12] = position;
443
- $[13] = resizable;
444
- $[14] = saveWidth;
445
- $[15] = sidebarRef;
446
- $[16] = t5;
447
- } else {
448
- t5 = $[16];
449
- }
450
- let t6;
451
- if ($[17] !== position || $[18] !== t1 || $[19] !== t4 || $[20] !== t5) {
452
- t6 = /*#__PURE__*/jsx(VerticalDivider, {
453
- variant: t1,
454
- position: position,
455
- className: classes.SidebarVerticalDivider,
456
- style: t4,
457
- children: t5
458
- });
459
- $[17] = position;
460
- $[18] = t1;
461
- $[19] = t4;
462
- $[20] = t5;
463
- $[21] = t6;
464
- } else {
465
- t6 = $[21];
466
- }
467
- return t6;
231
+ }) : null
232
+ });
468
233
  });
469
234
  /**
470
235
  * DragHandle - handles all pointer and keyboard interactions for resizing
471
236
  * ARIA values are set in JSX for SSR accessibility,
472
237
  * then updated via DOM manipulation during drag for performance
473
238
  */
474
- const DragHandle = /*#__PURE__*/memo(function DragHandle(t0) {
475
- const $ = c(35);
476
- const {
477
- handleRef,
478
- onDragStart,
479
- onDrag,
480
- onDragEnd,
481
- onDoubleClick,
482
- "aria-valuemin": ariaValueMin,
483
- "aria-valuemax": ariaValueMax,
484
- "aria-valuenow": ariaValueNow
485
- } = t0;
239
+ const DragHandle = /*#__PURE__*/memo(function DragHandle({
240
+ handleRef,
241
+ onDragStart,
242
+ onDrag,
243
+ onDragEnd,
244
+ onDoubleClick,
245
+ 'aria-valuemin': ariaValueMin,
246
+ 'aria-valuemax': ariaValueMax,
247
+ 'aria-valuenow': ariaValueNow
248
+ }) {
486
249
  const stableOnDragStart = React.useRef(onDragStart);
487
250
  const stableOnDrag = React.useRef(onDrag);
488
251
  const stableOnDragEnd = React.useRef(onDragEnd);
489
- let t1;
490
- if ($[0] !== onDrag || $[1] !== onDragEnd || $[2] !== onDragStart) {
491
- t1 = () => {
492
- stableOnDragStart.current = onDragStart;
493
- stableOnDrag.current = onDrag;
494
- stableOnDragEnd.current = onDragEnd;
495
- };
496
- $[0] = onDrag;
497
- $[1] = onDragEnd;
498
- $[2] = onDragStart;
499
- $[3] = t1;
500
- } else {
501
- t1 = $[3];
502
- }
503
- React.useEffect(t1);
252
+ React.useEffect(() => {
253
+ stableOnDragStart.current = onDragStart;
254
+ stableOnDrag.current = onDrag;
255
+ stableOnDragEnd.current = onDragEnd;
256
+ });
504
257
  const {
505
258
  paneRef,
506
259
  contentWrapperRef
507
260
  } = React.useContext(PageLayoutContext);
261
+
262
+ // Dragging state as a ref - cheaper than reading from DOM style
508
263
  const isDraggingRef = React.useRef(false);
509
- let t2;
510
- if ($[4] !== contentWrapperRef || $[5] !== handleRef || $[6] !== paneRef) {
511
- t2 = () => {
512
- if (isDraggingRef.current) {
513
- return;
514
- }
515
- setDraggingStyles({
516
- handle: handleRef.current,
517
- pane: paneRef.current,
518
- contentWrapper: contentWrapperRef.current
519
- });
520
- isDraggingRef.current = true;
521
- };
522
- $[4] = contentWrapperRef;
523
- $[5] = handleRef;
524
- $[6] = paneRef;
525
- $[7] = t2;
526
- } else {
527
- t2 = $[7];
528
- }
529
- const startDragging = t2;
530
- let t3;
531
- if ($[8] !== contentWrapperRef || $[9] !== handleRef || $[10] !== paneRef) {
532
- t3 = () => {
533
- if (!isDraggingRef.current) {
534
- return;
535
- }
536
- removeDraggingStyles({
537
- handle: handleRef.current,
538
- pane: paneRef.current,
539
- contentWrapper: contentWrapperRef.current
540
- });
541
- isDraggingRef.current = false;
542
- };
543
- $[8] = contentWrapperRef;
544
- $[9] = handleRef;
545
- $[10] = paneRef;
546
- $[11] = t3;
547
- } else {
548
- t3 = $[11];
549
- }
550
- const endDragging = t3;
551
- let t4;
552
- if ($[12] !== startDragging) {
553
- t4 = event => {
554
- if (event.button !== 0) {
555
- return;
556
- }
557
- event.preventDefault();
558
- const target = event.currentTarget;
559
- try {
560
- target.setPointerCapture(event.pointerId);
561
- } catch {}
562
- stableOnDragStart.current(event.clientX);
563
- startDragging();
564
- };
565
- $[12] = startDragging;
566
- $[13] = t4;
567
- } else {
568
- t4 = $[13];
569
- }
570
- const handlePointerDown = t4;
264
+
265
+ // Set inline styles for drag optimizations - zero overhead at rest
266
+ const startDragging = React.useCallback(() => {
267
+ if (isDraggingRef.current) return;
268
+ setDraggingStyles({
269
+ handle: handleRef.current,
270
+ pane: paneRef.current,
271
+ contentWrapper: contentWrapperRef.current
272
+ });
273
+ isDraggingRef.current = true;
274
+ }, [handleRef, contentWrapperRef, paneRef]);
275
+ const endDragging = React.useCallback(() => {
276
+ if (!isDraggingRef.current) return;
277
+ removeDraggingStyles({
278
+ handle: handleRef.current,
279
+ pane: paneRef.current,
280
+ contentWrapper: contentWrapperRef.current
281
+ });
282
+ isDraggingRef.current = false;
283
+ }, [handleRef, contentWrapperRef, paneRef]);
284
+
285
+ /**
286
+ * Pointer down starts a drag operation
287
+ * Capture the pointer to continue receiving events outside the handle area
288
+ */
289
+ const handlePointerDown = React.useCallback(event => {
290
+ if (event.button !== 0) return;
291
+ event.preventDefault();
292
+ const target = event.currentTarget;
293
+ // Try to capture pointer - may fail in test environments or if pointer is already released
294
+ try {
295
+ target.setPointerCapture(event.pointerId);
296
+ } catch {
297
+ // Ignore - pointer capture is a nice-to-have for dragging outside the element
298
+ }
299
+ stableOnDragStart.current(event.clientX);
300
+ startDragging();
301
+ }, [startDragging]);
302
+
303
+ // Simple rAF throttle - one update per frame, latest position wins
571
304
  const rafIdRef = React.useRef(null);
572
305
  const pendingClientXRef = React.useRef(null);
573
- let t5;
574
- if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
575
- t5 = event_0 => {
576
- if (!isDraggingRef.current) {
577
- return;
578
- }
579
- event_0.preventDefault();
580
- pendingClientXRef.current = event_0.clientX;
581
- if (rafIdRef.current === null) {
582
- rafIdRef.current = requestAnimationFrame(() => {
583
- rafIdRef.current = null;
584
- if (pendingClientXRef.current !== null) {
585
- stableOnDrag.current(pendingClientXRef.current, false);
586
- pendingClientXRef.current = null;
587
- }
588
- });
589
- }
590
- };
591
- $[14] = t5;
592
- } else {
593
- t5 = $[14];
594
- }
595
- const handlePointerMove = t5;
596
- let t6;
597
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
598
- t6 = event_1 => {
599
- if (!isDraggingRef.current) {
600
- return;
601
- }
602
- event_1.preventDefault();
603
- };
604
- $[15] = t6;
605
- } else {
606
- t6 = $[15];
607
- }
608
- const handlePointerUp = t6;
609
- let t7;
610
- if ($[16] !== endDragging) {
611
- t7 = () => {
612
- if (!isDraggingRef.current) {
613
- return;
614
- }
615
- if (rafIdRef.current !== null) {
616
- cancelAnimationFrame(rafIdRef.current);
306
+
307
+ /**
308
+ * Pointer move during drag
309
+ * Calls onDrag with absolute cursor X position
310
+ * Uses rAF to coalesce updates to one per frame
311
+ */
312
+ const handlePointerMove = React.useCallback(event => {
313
+ if (!isDraggingRef.current) return;
314
+ event.preventDefault();
315
+
316
+ // Store latest position - only the final position before rAF fires matters
317
+ pendingClientXRef.current = event.clientX;
318
+
319
+ // Schedule update if not already scheduled
320
+ if (rafIdRef.current === null) {
321
+ rafIdRef.current = requestAnimationFrame(() => {
617
322
  rafIdRef.current = null;
618
- pendingClientXRef.current = null;
619
- }
620
- endDragging();
621
- stableOnDragEnd.current();
622
- };
623
- $[16] = endDragging;
624
- $[17] = t7;
625
- } else {
626
- t7 = $[17];
627
- }
628
- const handleLostPointerCapture = t7;
629
- let t8;
630
- if ($[18] !== startDragging) {
631
- t8 = event_2 => {
632
- if (!isArrowKey(event_2.key)) {
633
- return;
634
- }
635
- event_2.preventDefault();
636
- const delta = isShrinkKey(event_2.key) ? -ARROW_KEY_STEP : ARROW_KEY_STEP;
637
- if (!isDraggingRef.current) {
638
- startDragging();
639
- }
640
- stableOnDrag.current(delta, true);
641
- };
642
- $[18] = startDragging;
643
- $[19] = t8;
644
- } else {
645
- t8 = $[19];
646
- }
647
- const handleKeyDown = t8;
648
- let t9;
649
- if ($[20] !== endDragging) {
650
- t9 = event_3 => {
651
- if (!isArrowKey(event_3.key)) {
652
- return;
653
- }
654
- event_3.preventDefault();
655
- endDragging();
656
- stableOnDragEnd.current();
657
- };
658
- $[20] = endDragging;
659
- $[21] = t9;
660
- } else {
661
- t9 = $[21];
662
- }
663
- const handleKeyUp = t9;
664
- let t10;
665
- let t11;
666
- if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
667
- t10 = () => () => {
323
+ if (pendingClientXRef.current !== null) {
324
+ stableOnDrag.current(pendingClientXRef.current, false);
325
+ pendingClientXRef.current = null;
326
+ }
327
+ });
328
+ }
329
+ }, []);
330
+
331
+ /**
332
+ * Pointer up - cleanup is handled by onLostPointerCapture event
333
+ * which fires when pointer capture is released (including on pointerup)
334
+ */
335
+ const handlePointerUp = React.useCallback(event => {
336
+ if (!isDraggingRef.current) return;
337
+ event.preventDefault();
338
+ }, []);
339
+
340
+ /**
341
+ * Lost pointer capture ends a drag operation
342
+ * Cleans up dragging state and cancels any pending rAF
343
+ * Calls onDragEnd callback
344
+ */
345
+ const handleLostPointerCapture = React.useCallback(() => {
346
+ if (!isDraggingRef.current) return;
347
+ // Cancel any pending rAF to prevent stale updates
348
+ if (rafIdRef.current !== null) {
349
+ cancelAnimationFrame(rafIdRef.current);
350
+ rafIdRef.current = null;
351
+ pendingClientXRef.current = null;
352
+ }
353
+ endDragging();
354
+ stableOnDragEnd.current();
355
+ }, [endDragging]);
356
+
357
+ /**
358
+ * Keyboard handling for accessibility
359
+ * Arrow keys adjust the pane size in 3px increments
360
+ * Prevents default scrolling behavior
361
+ * Sets and clears dragging state via data attribute
362
+ * Calls onDrag
363
+ */
364
+ const handleKeyDown = React.useCallback(event => {
365
+ if (!isArrowKey(event.key)) return;
366
+ event.preventDefault();
367
+
368
+ // https://github.com/github/accessibility/issues/5101#issuecomment-1822870655
369
+ const delta = isShrinkKey(event.key) ? -ARROW_KEY_STEP : ARROW_KEY_STEP;
370
+
371
+ // Only set dragging on first keydown (not repeats)
372
+ if (!isDraggingRef.current) {
373
+ startDragging();
374
+ }
375
+ stableOnDrag.current(delta, true);
376
+ }, [startDragging]);
377
+ const handleKeyUp = React.useCallback(event => {
378
+ if (!isArrowKey(event.key)) return;
379
+ event.preventDefault();
380
+ endDragging();
381
+ stableOnDragEnd.current();
382
+ }, [endDragging]);
383
+
384
+ // Cleanup rAF on unmount to prevent stale callbacks
385
+ React.useEffect(() => {
386
+ return () => {
668
387
  if (rafIdRef.current !== null) {
669
388
  cancelAnimationFrame(rafIdRef.current);
670
389
  rafIdRef.current = null;
671
390
  }
672
391
  };
673
- t11 = [];
674
- $[22] = t10;
675
- $[23] = t11;
676
- } else {
677
- t10 = $[22];
678
- t11 = $[23];
679
- }
680
- React.useEffect(t10, t11);
681
- const t12 = ariaValueNow !== undefined ? `Pane width ${ariaValueNow} pixels` : undefined;
682
- let t13;
683
- if ($[24] !== ariaValueMax || $[25] !== ariaValueMin || $[26] !== ariaValueNow || $[27] !== handleKeyDown || $[28] !== handleKeyUp || $[29] !== handleLostPointerCapture || $[30] !== handlePointerDown || $[31] !== handleRef || $[32] !== onDoubleClick || $[33] !== t12) {
684
- t13 = /*#__PURE__*/jsx("div", {
685
- ref: handleRef,
686
- className: classes.DraggableHandle,
687
- role: "slider",
688
- "aria-label": "Draggable pane splitter",
689
- "aria-valuemin": ariaValueMin,
690
- "aria-valuemax": ariaValueMax,
691
- "aria-valuenow": ariaValueNow,
692
- "aria-valuetext": t12,
693
- tabIndex: 0,
694
- onPointerDown: handlePointerDown,
695
- onPointerMove: handlePointerMove,
696
- onPointerUp: handlePointerUp,
697
- onLostPointerCapture: handleLostPointerCapture,
698
- onKeyDown: handleKeyDown,
699
- onKeyUp: handleKeyUp,
700
- onDoubleClick: onDoubleClick
701
- });
702
- $[24] = ariaValueMax;
703
- $[25] = ariaValueMin;
704
- $[26] = ariaValueNow;
705
- $[27] = handleKeyDown;
706
- $[28] = handleKeyUp;
707
- $[29] = handleLostPointerCapture;
708
- $[30] = handlePointerDown;
709
- $[31] = handleRef;
710
- $[32] = onDoubleClick;
711
- $[33] = t12;
712
- $[34] = t13;
713
- } else {
714
- t13 = $[34];
715
- }
716
- return t13;
392
+ }, []);
393
+ return /*#__PURE__*/jsx("div", {
394
+ ref: handleRef,
395
+ className: classes.DraggableHandle,
396
+ role: "slider",
397
+ "aria-label": "Draggable pane splitter",
398
+ "aria-valuemin": ariaValueMin,
399
+ "aria-valuemax": ariaValueMax,
400
+ "aria-valuenow": ariaValueNow,
401
+ "aria-valuetext": ariaValueNow !== undefined ? `Pane width ${ariaValueNow} pixels` : undefined,
402
+ tabIndex: 0,
403
+ onPointerDown: handlePointerDown,
404
+ onPointerMove: handlePointerMove,
405
+ onPointerUp: handlePointerUp,
406
+ onLostPointerCapture: handleLostPointerCapture,
407
+ onKeyDown: handleKeyDown,
408
+ onKeyUp: handleKeyUp,
409
+ onDoubleClick: onDoubleClick
410
+ });
717
411
  });
718
412
 
719
413
  // ----------------------------------------------------------------------------
720
414
  // PageLayout.Header
721
415
 
722
- const Header = t0 => {
723
- const $ = c(28);
724
- const {
725
- "aria-label": label,
726
- "aria-labelledby": labelledBy,
727
- padding: t1,
728
- divider: t2,
729
- dividerWhenNarrow: t3,
730
- hidden: t4,
731
- children,
732
- style,
733
- className
734
- } = t0;
735
- const padding = t1 === undefined ? "none" : t1;
736
- const divider = t2 === undefined ? "none" : t2;
737
- const dividerWhenNarrow = t3 === undefined ? "inherit" : t3;
738
- const hidden = t4 === undefined ? false : t4;
739
- let t5;
740
- if ($[0] !== divider || $[1] !== dividerWhenNarrow) {
741
- t5 = !isResponsiveValue(divider) && dividerWhenNarrow !== "inherit" ? {
742
- regular: divider,
743
- narrow: dividerWhenNarrow
744
- } : divider;
745
- $[0] = divider;
746
- $[1] = dividerWhenNarrow;
747
- $[2] = t5;
748
- } else {
749
- t5 = $[2];
750
- }
751
- const dividerProp = t5;
416
+ const Header = ({
417
+ 'aria-label': label,
418
+ 'aria-labelledby': labelledBy,
419
+ padding = 'none',
420
+ divider = 'none',
421
+ dividerWhenNarrow = 'inherit',
422
+ hidden = false,
423
+ children,
424
+ style,
425
+ className
426
+ }) => {
427
+ // Combine divider and dividerWhenNarrow for backwards compatibility
428
+ const dividerProp = !isResponsiveValue(divider) && dividerWhenNarrow !== 'inherit' ? {
429
+ regular: divider,
430
+ narrow: dividerWhenNarrow
431
+ } : divider;
752
432
  const {
753
433
  rowGap
754
434
  } = React.useContext(PageLayoutContext);
755
- let t6;
756
- if ($[3] !== hidden) {
757
- t6 = getResponsiveAttributes("hidden", hidden);
758
- $[3] = hidden;
759
- $[4] = t6;
760
- } else {
761
- t6 = $[4];
762
- }
763
- let t7;
764
- if ($[5] !== className) {
765
- t7 = clsx(classes.Header, className);
766
- $[5] = className;
767
- $[6] = t7;
768
- } else {
769
- t7 = $[6];
770
- }
771
- const t8 = `var(--spacing-${rowGap})`;
772
- let t9;
773
- if ($[7] !== style || $[8] !== t8) {
774
- t9 = {
775
- "--spacing": t8,
435
+ return /*#__PURE__*/jsxs("header", {
436
+ "aria-label": label,
437
+ "aria-labelledby": labelledBy,
438
+ ...getResponsiveAttributes('hidden', hidden),
439
+ className: clsx(classes.Header, className),
440
+ style: {
441
+ '--spacing': `var(--spacing-${rowGap})`,
776
442
  ...style
777
- };
778
- $[7] = style;
779
- $[8] = t8;
780
- $[9] = t9;
781
- } else {
782
- t9 = $[9];
783
- }
784
- const t10 = t9;
785
- const t11 = `var(--spacing-${padding})`;
786
- let t12;
787
- if ($[10] !== t11) {
788
- t12 = {
789
- "--spacing": t11
790
- };
791
- $[10] = t11;
792
- $[11] = t12;
793
- } else {
794
- t12 = $[11];
795
- }
796
- const t13 = t12;
797
- let t14;
798
- if ($[12] !== children || $[13] !== t13) {
799
- t14 = /*#__PURE__*/jsx("div", {
443
+ },
444
+ children: [/*#__PURE__*/jsx("div", {
800
445
  className: classes.HeaderContent,
801
- style: t13,
446
+ style: {
447
+ '--spacing': `var(--spacing-${padding})`
448
+ },
802
449
  children: children
803
- });
804
- $[12] = children;
805
- $[13] = t13;
806
- $[14] = t14;
807
- } else {
808
- t14 = $[14];
809
- }
810
- const t15 = `var(--spacing-${rowGap})`;
811
- let t16;
812
- if ($[15] !== t15) {
813
- t16 = {
814
- "--spacing": t15
815
- };
816
- $[15] = t15;
817
- $[16] = t16;
818
- } else {
819
- t16 = $[16];
820
- }
821
- const t17 = t16;
822
- let t18;
823
- if ($[17] !== dividerProp || $[18] !== t17) {
824
- t18 = /*#__PURE__*/jsx(HorizontalDivider, {
450
+ }), /*#__PURE__*/jsx(HorizontalDivider, {
825
451
  variant: dividerProp,
826
452
  className: classes.HeaderHorizontalDivider,
827
- style: t17
828
- });
829
- $[17] = dividerProp;
830
- $[18] = t17;
831
- $[19] = t18;
832
- } else {
833
- t18 = $[19];
834
- }
835
- let t19;
836
- if ($[20] !== label || $[21] !== labelledBy || $[22] !== t10 || $[23] !== t14 || $[24] !== t18 || $[25] !== t6 || $[26] !== t7) {
837
- t19 = /*#__PURE__*/jsxs("header", {
838
- "aria-label": label,
839
- "aria-labelledby": labelledBy,
840
- ...t6,
841
- className: t7,
842
- style: t10,
843
- children: [t14, t18]
844
- });
845
- $[20] = label;
846
- $[21] = labelledBy;
847
- $[22] = t10;
848
- $[23] = t14;
849
- $[24] = t18;
850
- $[25] = t6;
851
- $[26] = t7;
852
- $[27] = t19;
853
- } else {
854
- t19 = $[27];
855
- }
856
- return t19;
453
+ style: {
454
+ '--spacing': `var(--spacing-${rowGap})`
455
+ }
456
+ })]
457
+ });
857
458
  };
459
+ Header.displayName = "Header";
858
460
  Header.displayName = 'PageLayout.Header';
859
- const Content = t0 => {
860
- const $ = c(19);
861
- const {
862
- as: t1,
863
- "aria-label": label,
864
- "aria-labelledby": labelledBy,
865
- width: t2,
866
- padding: t3,
867
- hidden: t4,
868
- children,
869
- className,
870
- style
871
- } = t0;
872
- const as = t1 === undefined ? "main" : t1;
873
- const width = t2 === undefined ? "full" : t2;
874
- const padding = t3 === undefined ? "none" : t3;
875
- const hidden = t4 === undefined ? false : t4;
461
+ const Content = ({
462
+ as = 'main',
463
+ 'aria-label': label,
464
+ 'aria-labelledby': labelledBy,
465
+ width = 'full',
466
+ padding = 'none',
467
+ hidden = false,
468
+ children,
469
+ className,
470
+ style
471
+ }) => {
876
472
  const Component = as;
877
473
  const {
878
474
  contentWrapperRef
879
475
  } = React.useContext(PageLayoutContext);
880
- let t5;
881
- if ($[0] !== className) {
882
- t5 = clsx(classes.ContentWrapper, className);
883
- $[0] = className;
884
- $[1] = t5;
885
- } else {
886
- t5 = $[1];
887
- }
888
- let t6;
889
- if ($[2] !== hidden) {
890
- t6 = getResponsiveAttributes("is-hidden", hidden);
891
- $[2] = hidden;
892
- $[3] = t6;
893
- } else {
894
- t6 = $[3];
895
- }
896
- const t7 = `var(--spacing-${padding})`;
897
- let t8;
898
- if ($[4] !== t7) {
899
- t8 = {
900
- "--spacing": t7
901
- };
902
- $[4] = t7;
903
- $[5] = t8;
904
- } else {
905
- t8 = $[5];
906
- }
907
- const t9 = t8;
908
- let t10;
909
- if ($[6] !== children || $[7] !== t9 || $[8] !== width) {
910
- t10 = /*#__PURE__*/jsx("div", {
476
+ return /*#__PURE__*/jsx(Component, {
477
+ ref: contentWrapperRef,
478
+ "aria-label": label,
479
+ "aria-labelledby": labelledBy,
480
+ style: style,
481
+ className: clsx(classes.ContentWrapper, className),
482
+ ...getResponsiveAttributes('is-hidden', hidden),
483
+ children: /*#__PURE__*/jsx("div", {
911
484
  className: classes.Content,
912
485
  "data-width": width,
913
- style: t9,
486
+ style: {
487
+ '--spacing': `var(--spacing-${padding})`
488
+ },
914
489
  children: children
915
- });
916
- $[6] = children;
917
- $[7] = t9;
918
- $[8] = width;
919
- $[9] = t10;
920
- } else {
921
- t10 = $[9];
922
- }
923
- let t11;
924
- if ($[10] !== Component || $[11] !== contentWrapperRef || $[12] !== label || $[13] !== labelledBy || $[14] !== style || $[15] !== t10 || $[16] !== t5 || $[17] !== t6) {
925
- t11 = /*#__PURE__*/jsx(Component, {
926
- ref: contentWrapperRef,
927
- "aria-label": label,
928
- "aria-labelledby": labelledBy,
929
- style: style,
930
- className: t5,
931
- ...t6,
932
- children: t10
933
- });
934
- $[10] = Component;
935
- $[11] = contentWrapperRef;
936
- $[12] = label;
937
- $[13] = labelledBy;
938
- $[14] = style;
939
- $[15] = t10;
940
- $[16] = t5;
941
- $[17] = t6;
942
- $[18] = t11;
943
- } else {
944
- t11 = $[18];
945
- }
946
- return t11;
490
+ })
491
+ });
947
492
  };
493
+ Content.displayName = "Content";
948
494
  Content.displayName = 'PageLayout.Content';
949
495
  const overflowProps = {
950
496
  tabIndex: 0,
951
497
  role: 'region'
952
498
  };
953
- const Pane = /*#__PURE__*/React.forwardRef((t0, forwardRef) => {
954
- const $ = c(96);
955
- const {
956
- "aria-label": label,
957
- "aria-labelledby": labelledBy,
958
- position: t1,
959
- positionWhenNarrow: t2,
960
- width: t3,
961
- minWidth: t4,
962
- currentWidth: controlledWidth,
963
- onResizeEnd,
964
- padding: t5,
965
- resizable: t6,
966
- widthStorageKey: t7,
967
- divider: t8,
968
- dividerWhenNarrow: t9,
969
- sticky: t10,
970
- offsetHeader: t11,
971
- hidden: t12,
972
- children,
973
- id,
974
- className,
975
- style
976
- } = t0;
977
- const responsivePosition = t1 === undefined ? "end" : t1;
978
- const positionWhenNarrow = t2 === undefined ? "inherit" : t2;
979
- const width = t3 === undefined ? "medium" : t3;
980
- const minWidth = t4 === undefined ? 256 : t4;
981
- const padding = t5 === undefined ? "none" : t5;
982
- const resizable = t6 === undefined ? false : t6;
983
- const widthStorageKey = t7 === undefined ? "paneWidth" : t7;
984
- const responsiveDivider = t8 === undefined ? "none" : t8;
985
- const dividerWhenNarrow = t9 === undefined ? "inherit" : t9;
986
- const sticky = t10 === undefined ? false : t10;
987
- const offsetHeader = t11 === undefined ? 0 : t11;
988
- const responsiveHidden = t12 === undefined ? false : t12;
989
- let t13;
990
- if ($[0] !== positionWhenNarrow || $[1] !== responsivePosition) {
991
- t13 = !isResponsiveValue(responsivePosition) && positionWhenNarrow !== "inherit" ? {
992
- regular: responsivePosition,
993
- narrow: positionWhenNarrow
994
- } : responsivePosition;
995
- $[0] = positionWhenNarrow;
996
- $[1] = responsivePosition;
997
- $[2] = t13;
998
- } else {
999
- t13 = $[2];
1000
- }
1001
- const positionProp = t13;
1002
- let t14;
1003
- if ($[3] !== dividerWhenNarrow || $[4] !== responsiveDivider) {
1004
- t14 = !isResponsiveValue(responsiveDivider) && dividerWhenNarrow !== "inherit" ? {
1005
- regular: responsiveDivider,
1006
- narrow: dividerWhenNarrow
1007
- } : responsiveDivider;
1008
- $[3] = dividerWhenNarrow;
1009
- $[4] = responsiveDivider;
1010
- $[5] = t14;
1011
- } else {
1012
- t14 = $[5];
1013
- }
1014
- const dividerProp = t14;
1015
- let t15;
1016
- if ($[6] !== positionProp) {
1017
- t15 = isResponsiveValue(positionProp) ? "end" : positionProp;
1018
- $[6] = positionProp;
1019
- $[7] = t15;
1020
- } else {
1021
- t15 = $[7];
1022
- }
1023
- const position = t15;
1024
- let t16;
1025
- if ($[8] !== dividerProp) {
1026
- t16 = isResponsiveValue(dividerProp) ? "none" : dividerProp;
1027
- $[8] = dividerProp;
1028
- $[9] = t16;
1029
- } else {
1030
- t16 = $[9];
1031
- }
1032
- const dividerVariant = t16;
499
+ const Pane = /*#__PURE__*/React.forwardRef(({
500
+ 'aria-label': label,
501
+ 'aria-labelledby': labelledBy,
502
+ position: responsivePosition = 'end',
503
+ positionWhenNarrow = 'inherit',
504
+ width = 'medium',
505
+ minWidth = 256,
506
+ currentWidth: controlledWidth,
507
+ onResizeEnd,
508
+ padding = 'none',
509
+ resizable = false,
510
+ widthStorageKey = 'paneWidth',
511
+ divider: responsiveDivider = 'none',
512
+ dividerWhenNarrow = 'inherit',
513
+ sticky = false,
514
+ offsetHeader = 0,
515
+ hidden: responsiveHidden = false,
516
+ children,
517
+ id,
518
+ className,
519
+ style
520
+ }, forwardRef) => {
521
+ // Combine position and positionWhenNarrow for backwards compatibility
522
+ const positionProp = !isResponsiveValue(responsivePosition) && positionWhenNarrow !== 'inherit' ? {
523
+ regular: responsivePosition,
524
+ narrow: positionWhenNarrow
525
+ } : responsivePosition;
526
+
527
+ // Combine divider and dividerWhenNarrow for backwards compatibility
528
+ const dividerProp = !isResponsiveValue(responsiveDivider) && dividerWhenNarrow !== 'inherit' ? {
529
+ regular: responsiveDivider,
530
+ narrow: dividerWhenNarrow
531
+ } : responsiveDivider;
532
+
533
+ // For components that need responsive values in JavaScript logic, we'll use a fallback value
534
+ // The actual responsive behavior will be handled by CSS through data attributes
535
+ const position = isResponsiveValue(positionProp) ? 'end' : positionProp;
536
+ const dividerVariant = isResponsiveValue(dividerProp) ? 'none' : dividerProp;
1033
537
  const {
1034
538
  rowGap,
1035
539
  columnGap,
1036
540
  paneRef,
1037
541
  contentWrapperRef
1038
542
  } = React.useContext(PageLayoutContext);
543
+
544
+ // Ref to the drag handle for updating ARIA attributes
1039
545
  const handleRef = React.useRef(null);
546
+
547
+ // Cache drag start values to calculate relative delta during drag
548
+ // This approach is immune to layout shifts (scrollbars appearing/disappearing)
1040
549
  const dragStartClientXRef = React.useRef(0);
1041
550
  const dragStartWidthRef = React.useRef(0);
551
+ // Cache max width at drag start - won't change during a drag operation
1042
552
  const dragMaxWidthRef = React.useRef(0);
1043
- let t17;
1044
- if ($[10] !== contentWrapperRef || $[11] !== controlledWidth || $[12] !== minWidth || $[13] !== onResizeEnd || $[14] !== paneRef || $[15] !== resizable || $[16] !== width || $[17] !== widthStorageKey) {
1045
- t17 = {
1046
- width,
1047
- minWidth,
1048
- resizable,
1049
- widthStorageKey,
1050
- paneRef,
1051
- handleRef,
1052
- contentWrapperRef,
1053
- onResizeEnd,
1054
- currentWidth: controlledWidth
1055
- };
1056
- $[10] = contentWrapperRef;
1057
- $[11] = controlledWidth;
1058
- $[12] = minWidth;
1059
- $[13] = onResizeEnd;
1060
- $[14] = paneRef;
1061
- $[15] = resizable;
1062
- $[16] = width;
1063
- $[17] = widthStorageKey;
1064
- $[18] = t17;
1065
- } else {
1066
- t17 = $[18];
1067
- }
1068
553
  const {
1069
554
  currentWidth,
1070
555
  currentWidthRef,
@@ -1073,331 +558,163 @@ const Pane = /*#__PURE__*/React.forwardRef((t0, forwardRef) => {
1073
558
  getMaxPaneWidth,
1074
559
  saveWidth,
1075
560
  getDefaultWidth
1076
- } = usePaneWidth(t17);
561
+ } = usePaneWidth({
562
+ width,
563
+ minWidth,
564
+ resizable,
565
+ widthStorageKey,
566
+ paneRef,
567
+ handleRef,
568
+ contentWrapperRef,
569
+ onResizeEnd,
570
+ currentWidth: controlledWidth
571
+ });
1077
572
  useRefObjectAsForwardedRef(forwardRef, paneRef);
1078
573
  const hasOverflow = useOverflow(paneRef);
1079
574
  const paneId = useId(id);
1080
- let labelProp;
1081
- if ($[19] !== hasOverflow || $[20] !== label || $[21] !== labelledBy) {
1082
- labelProp = {};
1083
- if (hasOverflow) {
1084
- process.env.NODE_ENV !== "production" ? warning(label === undefined && labelledBy === undefined, "The <PageLayout.Pane> has overflow and `aria-label` or `aria-labelledby` has not been set. Please provide `aria-label` or `aria-labelledby` to <PageLayout.Pane> in order to label this region.") : void 0;
1085
- if (labelledBy) {
1086
- labelProp["aria-labelledby"] = labelledBy;
1087
- } else {
1088
- if (label) {
1089
- labelProp["aria-label"] = label;
1090
- }
1091
- }
575
+ const labelProp = {};
576
+ if (hasOverflow) {
577
+ process.env.NODE_ENV !== "production" ? warning(label === undefined && labelledBy === undefined, 'The <PageLayout.Pane> has overflow and `aria-label` or `aria-labelledby` has not been set. ' + 'Please provide `aria-label` or `aria-labelledby` to <PageLayout.Pane> in order to label this ' + 'region.') : void 0;
578
+ if (labelledBy) {
579
+ labelProp['aria-labelledby'] = labelledBy;
580
+ } else if (label) {
581
+ labelProp['aria-label'] = label;
1092
582
  }
1093
- $[19] = hasOverflow;
1094
- $[20] = label;
1095
- $[21] = labelledBy;
1096
- $[22] = labelProp;
1097
- } else {
1098
- labelProp = $[22];
1099
- }
1100
- let t18;
1101
- if ($[23] !== className) {
1102
- t18 = clsx(classes.PaneWrapper, className);
1103
- $[23] = className;
1104
- $[24] = t18;
1105
- } else {
1106
- t18 = $[24];
1107
583
  }
1108
- const t19 = typeof offsetHeader === "number" ? `${offsetHeader}px` : offsetHeader;
1109
- const t20 = `var(--spacing-${rowGap})`;
1110
- const t21 = `var(--spacing-${columnGap})`;
1111
- let t22;
1112
- if ($[25] !== style || $[26] !== t19 || $[27] !== t20 || $[28] !== t21) {
1113
- t22 = {
1114
- "--offset-header": t19,
1115
- "--spacing-row": t20,
1116
- "--spacing-column": t21,
584
+ return /*#__PURE__*/jsxs("div", {
585
+ className: clsx(classes.PaneWrapper, className),
586
+ style: {
587
+ '--offset-header': typeof offsetHeader === 'number' ? `${offsetHeader}px` : offsetHeader,
588
+ '--spacing-row': `var(--spacing-${rowGap})`,
589
+ '--spacing-column': `var(--spacing-${columnGap})`,
1117
590
  ...style
1118
- };
1119
- $[25] = style;
1120
- $[26] = t19;
1121
- $[27] = t20;
1122
- $[28] = t21;
1123
- $[29] = t22;
1124
- } else {
1125
- t22 = $[29];
1126
- }
1127
- const t23 = t22;
1128
- let t24;
1129
- if ($[30] !== responsiveHidden) {
1130
- t24 = getResponsiveAttributes("is-hidden", responsiveHidden);
1131
- $[30] = responsiveHidden;
1132
- $[31] = t24;
1133
- } else {
1134
- t24 = $[31];
1135
- }
1136
- let t25;
1137
- if ($[32] !== positionProp) {
1138
- t25 = getResponsiveAttributes("position", positionProp);
1139
- $[32] = positionProp;
1140
- $[33] = t25;
1141
- } else {
1142
- t25 = $[33];
1143
- }
1144
- const t26 = sticky || undefined;
1145
- let t27;
1146
- if ($[34] !== dividerProp || $[35] !== dividerVariant) {
1147
- t27 = isResponsiveValue(dividerProp) ? dividerProp : {
1148
- narrow: dividerVariant,
1149
- regular: "none"
1150
- };
1151
- $[34] = dividerProp;
1152
- $[35] = dividerVariant;
1153
- $[36] = t27;
1154
- } else {
1155
- t27 = $[36];
1156
- }
1157
- const t28 = `var(--spacing-${rowGap})`;
1158
- let t29;
1159
- if ($[37] !== t28) {
1160
- t29 = {
1161
- "--spacing": t28
1162
- };
1163
- $[37] = t28;
1164
- $[38] = t29;
1165
- } else {
1166
- t29 = $[38];
1167
- }
1168
- const t30 = t29;
1169
- let t31;
1170
- if ($[39] !== positionProp || $[40] !== t27 || $[41] !== t30) {
1171
- t31 = /*#__PURE__*/jsx(HorizontalDivider, {
1172
- variant: t27,
591
+ },
592
+ ...getResponsiveAttributes('is-hidden', responsiveHidden),
593
+ ...getResponsiveAttributes('position', positionProp),
594
+ "data-sticky": sticky || undefined,
595
+ children: [/*#__PURE__*/jsx(HorizontalDivider, {
596
+ variant: isResponsiveValue(dividerProp) ? dividerProp : {
597
+ narrow: dividerVariant,
598
+ regular: 'none'
599
+ },
1173
600
  className: classes.PaneHorizontalDivider,
1174
- style: t30,
601
+ style: {
602
+ '--spacing': `var(--spacing-${rowGap})`
603
+ },
1175
604
  position: positionProp
1176
- });
1177
- $[39] = positionProp;
1178
- $[40] = t27;
1179
- $[41] = t30;
1180
- $[42] = t31;
1181
- } else {
1182
- t31 = $[42];
1183
- }
1184
- const t32 = resizable === true && !onResizeEnd;
1185
- let t33;
1186
- if ($[43] !== hasOverflow) {
1187
- t33 = hasOverflow ? overflowProps : {};
1188
- $[43] = hasOverflow;
1189
- $[44] = t33;
1190
- } else {
1191
- t33 = $[44];
1192
- }
1193
- let t34;
1194
- if ($[45] !== id || $[46] !== paneId) {
1195
- t34 = id && {
1196
- id: paneId
1197
- };
1198
- $[45] = id;
1199
- $[46] = paneId;
1200
- $[47] = t34;
1201
- } else {
1202
- t34 = $[47];
1203
- }
1204
- const t35 = resizable || undefined;
1205
- const t36 = `var(--spacing-${padding})`;
1206
- const t37 = isCustomWidthOptions(width) ? width.min : `${minWidth}px`;
1207
- const t38 = isCustomWidthOptions(width) ? width.max : "calc(100vw - var(--pane-max-width-diff))";
1208
- const t39 = isCustomWidthOptions(width) ? width.default : undefined;
1209
- const t40 = `var(--pane-width-${isPaneWidth(width) ? width : "custom"})`;
1210
- const t41 = `${currentWidth}px`;
1211
- let t42;
1212
- if ($[48] !== t36 || $[49] !== t37 || $[50] !== t38 || $[51] !== t39 || $[52] !== t40 || $[53] !== t41) {
1213
- t42 = {
1214
- "--spacing": t36,
1215
- "--pane-min-width": t37,
1216
- "--pane-max-width": t38,
1217
- "--pane-width-custom": t39,
1218
- "--pane-width-size": t40,
1219
- "--pane-width": t41
1220
- };
1221
- $[48] = t36;
1222
- $[49] = t37;
1223
- $[50] = t38;
1224
- $[51] = t39;
1225
- $[52] = t40;
1226
- $[53] = t41;
1227
- $[54] = t42;
1228
- } else {
1229
- t42 = $[54];
1230
- }
1231
- const t43 = t42;
1232
- let t44;
1233
- if ($[55] !== children || $[56] !== labelProp || $[57] !== paneRef || $[58] !== t32 || $[59] !== t33 || $[60] !== t34 || $[61] !== t35 || $[62] !== t43) {
1234
- t44 = /*#__PURE__*/jsx("div", {
1235
- ref: paneRef,
1236
- suppressHydrationWarning: t32,
1237
- ...t33,
605
+ }), /*#__PURE__*/jsx("div", {
606
+ ref: paneRef
607
+ // Suppress hydration mismatch for --pane-width when localStorage
608
+ // provides a width that differs from the server-rendered default.
609
+ // Not needed when onResizeEnd is provided (localStorage isn't read).
610
+ ,
611
+ suppressHydrationWarning: resizable === true && !onResizeEnd,
612
+ ...(hasOverflow ? overflowProps : {}),
1238
613
  ...labelProp,
1239
- ...t34,
614
+ ...(id && {
615
+ id: paneId
616
+ }),
1240
617
  className: classes.Pane,
1241
- "data-resizable": t35,
1242
- style: t43,
618
+ "data-resizable": resizable || undefined,
619
+ style: {
620
+ '--spacing': `var(--spacing-${padding})`,
621
+ '--pane-min-width': isCustomWidthOptions(width) ? width.min : `${minWidth}px`,
622
+ '--pane-max-width': isCustomWidthOptions(width) ? width.max : `calc(100vw - var(--pane-max-width-diff))`,
623
+ '--pane-width-custom': isCustomWidthOptions(width) ? width.default : undefined,
624
+ '--pane-width-size': `var(--pane-width-${isPaneWidth(width) ? width : 'custom'})`,
625
+ '--pane-width': `${currentWidth}px`
626
+ },
1243
627
  children: children
1244
- });
1245
- $[55] = children;
1246
- $[56] = labelProp;
1247
- $[57] = paneRef;
1248
- $[58] = t32;
1249
- $[59] = t33;
1250
- $[60] = t34;
1251
- $[61] = t35;
1252
- $[62] = t43;
1253
- $[63] = t44;
1254
- } else {
1255
- t44 = $[63];
1256
- }
1257
- let t45;
1258
- if ($[64] !== dividerProp || $[65] !== dividerVariant || $[66] !== resizable) {
1259
- t45 = isResponsiveValue(dividerProp) ? {
1260
- narrow: "none",
1261
- regular: resizable ? "line" : dividerProp.regular || "none",
1262
- wide: resizable ? "line" : dividerProp.wide || dividerProp.regular || "none"
1263
- } : {
1264
- narrow: "none",
1265
- regular: resizable ? "line" : dividerVariant
1266
- };
1267
- $[64] = dividerProp;
1268
- $[65] = dividerVariant;
1269
- $[66] = resizable;
1270
- $[67] = t45;
1271
- } else {
1272
- t45 = $[67];
1273
- }
1274
- const t46 = `var(--spacing-${columnGap})`;
1275
- let t47;
1276
- if ($[68] !== t46) {
1277
- t47 = {
1278
- "--spacing": t46
1279
- };
1280
- $[68] = t46;
1281
- $[69] = t47;
1282
- } else {
1283
- t47 = $[69];
1284
- }
1285
- const t48 = t47;
1286
- let t49;
1287
- if ($[70] !== currentWidth || $[71] !== currentWidthRef || $[72] !== getDefaultWidth || $[73] !== getMaxPaneWidth || $[74] !== maxPaneWidth || $[75] !== minPaneWidth || $[76] !== paneRef || $[77] !== position || $[78] !== resizable || $[79] !== saveWidth) {
1288
- t49 = resizable ? /*#__PURE__*/jsx(DragHandle, {
1289
- handleRef: handleRef,
1290
- "aria-valuemin": minPaneWidth,
1291
- "aria-valuemax": maxPaneWidth,
1292
- "aria-valuenow": currentWidth,
1293
- onDragStart: clientX => {
1294
- var _paneRef$current$getB, _paneRef$current;
1295
- dragStartClientXRef.current = clientX;
1296
- dragStartWidthRef.current = (_paneRef$current$getB = (_paneRef$current = paneRef.current) === null || _paneRef$current === void 0 ? void 0 : _paneRef$current.getBoundingClientRect().width) !== null && _paneRef$current$getB !== void 0 ? _paneRef$current$getB : currentWidthRef.current;
1297
- dragMaxWidthRef.current = getMaxPaneWidth();
628
+ }), /*#__PURE__*/jsx(VerticalDivider, {
629
+ variant: isResponsiveValue(dividerProp) ? {
630
+ narrow: 'none',
631
+ regular: resizable ? 'line' : dividerProp.regular || 'none',
632
+ wide: resizable ? 'line' : dividerProp.wide || dividerProp.regular || 'none'
633
+ } : {
634
+ narrow: 'none',
635
+ // If pane is resizable, always show a vertical divider on regular viewports
636
+ regular: resizable ? 'line' : dividerVariant
637
+ }
638
+ // If pane is resizable, the divider should be draggable
639
+ ,
640
+ draggable: resizable,
641
+ position: positionProp,
642
+ className: classes.PaneVerticalDivider,
643
+ style: {
644
+ '--spacing': `var(--spacing-${columnGap})`
1298
645
  },
1299
- onDrag: (value, isKeyboard) => {
1300
- const maxWidth = isKeyboard ? getMaxPaneWidth() : dragMaxWidthRef.current;
1301
- if (isKeyboard) {
1302
- const delta = value;
1303
- const newWidth = Math.max(minPaneWidth, Math.min(maxWidth, currentWidthRef.current + delta));
1304
- if (newWidth !== currentWidthRef.current) {
1305
- var _paneRef$current2;
1306
- currentWidthRef.current = newWidth;
1307
- (_paneRef$current2 = paneRef.current) === null || _paneRef$current2 === void 0 ? void 0 : _paneRef$current2.style.setProperty("--pane-width", `${newWidth}px`);
1308
- updateAriaValues(handleRef.current, {
1309
- current: newWidth,
1310
- max: maxWidth
1311
- });
1312
- }
1313
- } else {
1314
- if (paneRef.current) {
1315
- const deltaX = value - dragStartClientXRef.current;
1316
- const directedDelta = position === "end" ? -deltaX : deltaX;
1317
- const newWidth_0 = dragStartWidthRef.current + directedDelta;
1318
- const clampedWidth = Math.max(minPaneWidth, Math.min(maxWidth, newWidth_0));
1319
- if (Math.round(clampedWidth) !== Math.round(currentWidthRef.current)) {
1320
- paneRef.current.style.setProperty("--pane-width", `${clampedWidth}px`);
1321
- currentWidthRef.current = clampedWidth;
646
+ children: resizable ? /*#__PURE__*/jsx(DragHandle, {
647
+ handleRef: handleRef,
648
+ "aria-valuemin": minPaneWidth,
649
+ "aria-valuemax": maxPaneWidth,
650
+ "aria-valuenow": currentWidth,
651
+ onDragStart: clientX => {
652
+ var _paneRef$current$getB, _paneRef$current;
653
+ // Cache cursor position and pane width at drag start
654
+ // Using relative delta (current - start) is immune to layout shifts
655
+ // (e.g., scrollbars appearing/disappearing during drag)
656
+ dragStartClientXRef.current = clientX;
657
+ dragStartWidthRef.current = (_paneRef$current$getB = (_paneRef$current = paneRef.current) === null || _paneRef$current === void 0 ? void 0 : _paneRef$current.getBoundingClientRect().width) !== null && _paneRef$current$getB !== void 0 ? _paneRef$current$getB : currentWidthRef.current;
658
+ // Cache max width - won't change during drag
659
+ dragMaxWidthRef.current = getMaxPaneWidth();
660
+ },
661
+ onDrag: (value, isKeyboard) => {
662
+ // Use cached max width for pointer drag, fresh value for keyboard (less frequent)
663
+ const maxWidth = isKeyboard ? getMaxPaneWidth() : dragMaxWidthRef.current;
664
+ if (isKeyboard) {
665
+ // Keyboard: value is a delta (e.g., +3 or -3)
666
+ const delta = value;
667
+ const newWidth = Math.max(minPaneWidth, Math.min(maxWidth, currentWidthRef.current + delta));
668
+ if (newWidth !== currentWidthRef.current) {
669
+ var _paneRef$current2;
670
+ currentWidthRef.current = newWidth;
671
+ (_paneRef$current2 = paneRef.current) === null || _paneRef$current2 === void 0 ? void 0 : _paneRef$current2.style.setProperty('--pane-width', `${newWidth}px`);
1322
672
  updateAriaValues(handleRef.current, {
1323
- current: Math.round(clampedWidth),
673
+ current: newWidth,
1324
674
  max: maxWidth
1325
675
  });
1326
676
  }
677
+ } else {
678
+ // Pointer: value is clientX - calculate width using relative delta from drag start
679
+ // This approach is immune to layout shifts during drag
680
+ if (paneRef.current) {
681
+ const deltaX = value - dragStartClientXRef.current;
682
+ // For position='end': cursor moving left (negative delta) increases width
683
+ // For position='start': cursor moving right (positive delta) increases width
684
+ const directedDelta = position === 'end' ? -deltaX : deltaX;
685
+ const newWidth = dragStartWidthRef.current + directedDelta;
686
+ const clampedWidth = Math.max(minPaneWidth, Math.min(maxWidth, newWidth));
687
+
688
+ // Only update if width actually changed
689
+ if (Math.round(clampedWidth) !== Math.round(currentWidthRef.current)) {
690
+ paneRef.current.style.setProperty('--pane-width', `${clampedWidth}px`);
691
+ currentWidthRef.current = clampedWidth;
692
+ updateAriaValues(handleRef.current, {
693
+ current: Math.round(clampedWidth),
694
+ max: maxWidth
695
+ });
696
+ }
697
+ }
1327
698
  }
699
+ },
700
+ onDragEnd: () => {
701
+ // Sync React state so parent re-renders use the correct width
702
+ saveWidth(currentWidthRef.current);
703
+ },
704
+ onDoubleClick: () => {
705
+ const resetWidth = getDefaultWidth();
706
+ if (paneRef.current) {
707
+ paneRef.current.style.setProperty('--pane-width', `${resetWidth}px`);
708
+ currentWidthRef.current = resetWidth;
709
+ updateAriaValues(handleRef.current, {
710
+ current: resetWidth
711
+ });
712
+ }
713
+ saveWidth(resetWidth);
1328
714
  }
1329
- },
1330
- onDragEnd: () => {
1331
- saveWidth(currentWidthRef.current);
1332
- },
1333
- onDoubleClick: () => {
1334
- const resetWidth = getDefaultWidth();
1335
- if (paneRef.current) {
1336
- paneRef.current.style.setProperty("--pane-width", `${resetWidth}px`);
1337
- currentWidthRef.current = resetWidth;
1338
- updateAriaValues(handleRef.current, {
1339
- current: resetWidth
1340
- });
1341
- }
1342
- saveWidth(resetWidth);
1343
- }
1344
- }) : null;
1345
- $[70] = currentWidth;
1346
- $[71] = currentWidthRef;
1347
- $[72] = getDefaultWidth;
1348
- $[73] = getMaxPaneWidth;
1349
- $[74] = maxPaneWidth;
1350
- $[75] = minPaneWidth;
1351
- $[76] = paneRef;
1352
- $[77] = position;
1353
- $[78] = resizable;
1354
- $[79] = saveWidth;
1355
- $[80] = t49;
1356
- } else {
1357
- t49 = $[80];
1358
- }
1359
- let t50;
1360
- if ($[81] !== positionProp || $[82] !== resizable || $[83] !== t45 || $[84] !== t48 || $[85] !== t49) {
1361
- t50 = /*#__PURE__*/jsx(VerticalDivider, {
1362
- variant: t45,
1363
- draggable: resizable,
1364
- position: positionProp,
1365
- className: classes.PaneVerticalDivider,
1366
- style: t48,
1367
- children: t49
1368
- });
1369
- $[81] = positionProp;
1370
- $[82] = resizable;
1371
- $[83] = t45;
1372
- $[84] = t48;
1373
- $[85] = t49;
1374
- $[86] = t50;
1375
- } else {
1376
- t50 = $[86];
1377
- }
1378
- let t51;
1379
- if ($[87] !== t18 || $[88] !== t23 || $[89] !== t24 || $[90] !== t25 || $[91] !== t26 || $[92] !== t31 || $[93] !== t44 || $[94] !== t50) {
1380
- t51 = /*#__PURE__*/jsxs("div", {
1381
- className: t18,
1382
- style: t23,
1383
- ...t24,
1384
- ...t25,
1385
- "data-sticky": t26,
1386
- children: [t31, t44, t50]
1387
- });
1388
- $[87] = t18;
1389
- $[88] = t23;
1390
- $[89] = t24;
1391
- $[90] = t25;
1392
- $[91] = t26;
1393
- $[92] = t31;
1394
- $[93] = t44;
1395
- $[94] = t50;
1396
- $[95] = t51;
1397
- } else {
1398
- t51 = $[95];
1399
- }
1400
- return t51;
715
+ }) : null
716
+ })]
717
+ });
1401
718
  });
1402
719
  Pane.displayName = 'PageLayout.Pane';
1403
720
 
@@ -1407,66 +724,37 @@ Pane.displayName = 'PageLayout.Pane';
1407
724
  // ----------------------------------------------------------------------------
1408
725
  // PageLayout.Sidebar
1409
726
 
1410
- const Sidebar = /*#__PURE__*/React.forwardRef((t0, forwardRef) => {
1411
- const $ = c(73);
1412
- const {
1413
- "aria-label": label,
1414
- "aria-labelledby": labelledBy,
1415
- position: t1,
1416
- width: t2,
1417
- minWidth: t3,
1418
- padding: t4,
1419
- resizable: t5,
1420
- widthStorageKey,
1421
- divider: t6,
1422
- sticky: t7,
1423
- responsiveVariant: t8,
1424
- hidden: t9,
1425
- children,
1426
- id,
1427
- className,
1428
- style
1429
- } = t0;
1430
- const position = t1 === undefined ? "start" : t1;
1431
- const width = t2 === undefined ? "medium" : t2;
1432
- const minWidth = t3 === undefined ? 256 : t3;
1433
- const padding = t4 === undefined ? "none" : t4;
1434
- const resizable = t5 === undefined ? false : t5;
1435
- const divider = t6 === undefined ? "none" : t6;
1436
- const sticky = t7 === undefined ? false : t7;
1437
- const responsiveVariant = t8 === undefined ? "default" : t8;
1438
- const responsiveHidden = t9 === undefined ? false : t9;
727
+ const Sidebar = /*#__PURE__*/React.forwardRef(({
728
+ 'aria-label': label,
729
+ 'aria-labelledby': labelledBy,
730
+ position = 'start',
731
+ width = 'medium',
732
+ minWidth = 256,
733
+ padding = 'none',
734
+ resizable = false,
735
+ widthStorageKey,
736
+ divider = 'none',
737
+ sticky = false,
738
+ responsiveVariant = 'default',
739
+ hidden: responsiveHidden = false,
740
+ children,
741
+ id,
742
+ className,
743
+ style
744
+ }, forwardRef) => {
1439
745
  const {
1440
746
  columnGap,
1441
747
  sidebarRef,
1442
748
  sidebarContentWrapperRef
1443
749
  } = React.useContext(PageLayoutContext);
750
+
751
+ // Ref to the drag handle for updating ARIA attributes
1444
752
  const handleRef = React.useRef(null);
753
+
754
+ // Cache drag start values to calculate relative delta during drag
1445
755
  const dragStartClientXRef = React.useRef(0);
1446
756
  const dragStartWidthRef = React.useRef(0);
1447
757
  const dragMaxWidthRef = React.useRef(0);
1448
- let t10;
1449
- if ($[0] !== minWidth || $[1] !== resizable || $[2] !== sidebarContentWrapperRef || $[3] !== sidebarRef || $[4] !== width || $[5] !== widthStorageKey) {
1450
- t10 = {
1451
- width,
1452
- minWidth,
1453
- resizable,
1454
- widthStorageKey,
1455
- paneRef: sidebarRef,
1456
- handleRef,
1457
- contentWrapperRef: sidebarContentWrapperRef,
1458
- constrainToViewport: true
1459
- };
1460
- $[0] = minWidth;
1461
- $[1] = resizable;
1462
- $[2] = sidebarContentWrapperRef;
1463
- $[3] = sidebarRef;
1464
- $[4] = width;
1465
- $[5] = widthStorageKey;
1466
- $[6] = t10;
1467
- } else {
1468
- t10 = $[6];
1469
- }
1470
758
  const {
1471
759
  currentWidth,
1472
760
  currentWidthRef,
@@ -1475,65 +763,39 @@ const Sidebar = /*#__PURE__*/React.forwardRef((t0, forwardRef) => {
1475
763
  getMaxPaneWidth,
1476
764
  saveWidth,
1477
765
  getDefaultWidth
1478
- } = usePaneWidth(t10);
766
+ } = usePaneWidth({
767
+ width,
768
+ minWidth,
769
+ resizable,
770
+ widthStorageKey,
771
+ paneRef: sidebarRef,
772
+ handleRef,
773
+ contentWrapperRef: sidebarContentWrapperRef,
774
+ constrainToViewport: true
775
+ });
1479
776
  useRefObjectAsForwardedRef(forwardRef, sidebarRef);
1480
777
  const hasOverflow = useOverflow(sidebarRef);
1481
778
  const sidebarId = useId(id);
1482
- let labelProp;
1483
- if ($[7] !== hasOverflow || $[8] !== label || $[9] !== labelledBy) {
1484
- labelProp = {};
1485
- if (hasOverflow) {
1486
- process.env.NODE_ENV !== "production" ? warning(label === undefined && labelledBy === undefined, "The <PageLayout.Sidebar> has overflow and `aria-label` or `aria-labelledby` has not been set. Please provide `aria-label` or `aria-labelledby` to <PageLayout.Sidebar> in order to label this region.") : void 0;
1487
- if (labelledBy) {
1488
- labelProp["aria-labelledby"] = labelledBy;
1489
- } else {
1490
- if (label) {
1491
- labelProp["aria-label"] = label;
1492
- }
1493
- }
779
+ const labelProp = {};
780
+ if (hasOverflow) {
781
+ process.env.NODE_ENV !== "production" ? warning(label === undefined && labelledBy === undefined, 'The <PageLayout.Sidebar> has overflow and `aria-label` or `aria-labelledby` has not been set. ' + 'Please provide `aria-label` or `aria-labelledby` to <PageLayout.Sidebar> in order to label this ' + 'region.') : void 0;
782
+ if (labelledBy) {
783
+ labelProp['aria-labelledby'] = labelledBy;
784
+ } else if (label) {
785
+ labelProp['aria-label'] = label;
1494
786
  }
1495
- $[7] = hasOverflow;
1496
- $[8] = label;
1497
- $[9] = labelledBy;
1498
- $[10] = labelProp;
1499
- } else {
1500
- labelProp = $[10];
1501
787
  }
1502
- let t11;
1503
- if ($[11] !== className) {
1504
- t11 = clsx(classes.SidebarWrapper, className);
1505
- $[11] = className;
1506
- $[12] = t11;
1507
- } else {
1508
- t11 = $[12];
1509
- }
1510
- const t12 = `var(--spacing-${columnGap})`;
1511
- let t13;
1512
- if ($[13] !== style || $[14] !== t12) {
1513
- t13 = {
1514
- "--spacing-column": t12,
788
+ return /*#__PURE__*/jsxs("div", {
789
+ className: clsx(classes.SidebarWrapper, className),
790
+ style: {
791
+ '--spacing-column': `var(--spacing-${columnGap})`,
1515
792
  ...style
1516
- };
1517
- $[13] = style;
1518
- $[14] = t12;
1519
- $[15] = t13;
1520
- } else {
1521
- t13 = $[15];
1522
- }
1523
- const t14 = t13;
1524
- let t15;
1525
- if ($[16] !== responsiveHidden) {
1526
- t15 = getResponsiveAttributes("is-hidden", responsiveHidden);
1527
- $[16] = responsiveHidden;
1528
- $[17] = t15;
1529
- } else {
1530
- t15 = $[17];
1531
- }
1532
- const t16 = sticky || undefined;
1533
- const t17 = responsiveVariant !== "default" ? responsiveVariant : undefined;
1534
- let t18;
1535
- if ($[18] !== currentWidth || $[19] !== currentWidthRef || $[20] !== divider || $[21] !== getDefaultWidth || $[22] !== getMaxPaneWidth || $[23] !== maxPaneWidth || $[24] !== minPaneWidth || $[25] !== position || $[26] !== resizable || $[27] !== saveWidth || $[28] !== sidebarRef) {
1536
- t18 = position === "end" && /*#__PURE__*/jsx(SidebarDivider, {
793
+ },
794
+ ...getResponsiveAttributes('is-hidden', responsiveHidden),
795
+ "data-position": position,
796
+ "data-sticky": sticky || undefined,
797
+ "data-responsive-variant": responsiveVariant !== 'default' ? responsiveVariant : undefined,
798
+ children: [position === 'end' && /*#__PURE__*/jsx(SidebarDivider, {
1537
799
  position: position,
1538
800
  divider: divider,
1539
801
  resizable: resizable,
@@ -1549,98 +811,29 @@ const Sidebar = /*#__PURE__*/React.forwardRef((t0, forwardRef) => {
1549
811
  getMaxPaneWidth: getMaxPaneWidth,
1550
812
  getDefaultWidth: getDefaultWidth,
1551
813
  saveWidth: saveWidth
1552
- });
1553
- $[18] = currentWidth;
1554
- $[19] = currentWidthRef;
1555
- $[20] = divider;
1556
- $[21] = getDefaultWidth;
1557
- $[22] = getMaxPaneWidth;
1558
- $[23] = maxPaneWidth;
1559
- $[24] = minPaneWidth;
1560
- $[25] = position;
1561
- $[26] = resizable;
1562
- $[27] = saveWidth;
1563
- $[28] = sidebarRef;
1564
- $[29] = t18;
1565
- } else {
1566
- t18 = $[29];
1567
- }
1568
- const t19 = resizable === true && !!widthStorageKey;
1569
- let t20;
1570
- if ($[30] !== hasOverflow) {
1571
- t20 = hasOverflow ? overflowProps : {};
1572
- $[30] = hasOverflow;
1573
- $[31] = t20;
1574
- } else {
1575
- t20 = $[31];
1576
- }
1577
- let t21;
1578
- if ($[32] !== id || $[33] !== sidebarId) {
1579
- t21 = id && {
1580
- id: sidebarId
1581
- };
1582
- $[32] = id;
1583
- $[33] = sidebarId;
1584
- $[34] = t21;
1585
- } else {
1586
- t21 = $[34];
1587
- }
1588
- const t22 = resizable || undefined;
1589
- const t23 = `var(--spacing-${padding})`;
1590
- const t24 = isCustomWidthOptions(width) ? width.min : `${minWidth}px`;
1591
- const t25 = isCustomWidthOptions(width) ? width.max : "calc(100vw - var(--sidebar-max-width-diff))";
1592
- const t26 = isCustomWidthOptions(width) ? width.default : undefined;
1593
- const t27 = `var(--pane-width-${isPaneWidth(width) ? width : "custom"})`;
1594
- const t28 = `${currentWidth}px`;
1595
- let t29;
1596
- if ($[35] !== t23 || $[36] !== t24 || $[37] !== t25 || $[38] !== t26 || $[39] !== t27 || $[40] !== t28) {
1597
- t29 = {
1598
- "--spacing": t23,
1599
- "--pane-min-width": t24,
1600
- "--pane-max-width": t25,
1601
- "--pane-width-custom": t26,
1602
- "--pane-width-size": t27,
1603
- "--pane-width": t28
1604
- };
1605
- $[35] = t23;
1606
- $[36] = t24;
1607
- $[37] = t25;
1608
- $[38] = t26;
1609
- $[39] = t27;
1610
- $[40] = t28;
1611
- $[41] = t29;
1612
- } else {
1613
- t29 = $[41];
1614
- }
1615
- const t30 = t29;
1616
- let t31;
1617
- if ($[42] !== children || $[43] !== labelProp || $[44] !== sidebarRef || $[45] !== t19 || $[46] !== t20 || $[47] !== t21 || $[48] !== t22 || $[49] !== t30) {
1618
- t31 = /*#__PURE__*/jsx("div", {
1619
- ref: sidebarRef,
1620
- suppressHydrationWarning: t19,
1621
- ...t20,
814
+ }), /*#__PURE__*/jsx("div", {
815
+ ref: sidebarRef
816
+ // Suppress hydration mismatch for --pane-width when localStorage
817
+ // provides a width that differs from the server-rendered default.
818
+ ,
819
+ suppressHydrationWarning: resizable === true && !!widthStorageKey,
820
+ ...(hasOverflow ? overflowProps : {}),
1622
821
  ...labelProp,
1623
- ...t21,
822
+ ...(id && {
823
+ id: sidebarId
824
+ }),
1624
825
  className: classes.Sidebar,
1625
- "data-resizable": t22,
1626
- style: t30,
826
+ "data-resizable": resizable || undefined,
827
+ style: {
828
+ '--spacing': `var(--spacing-${padding})`,
829
+ '--pane-min-width': isCustomWidthOptions(width) ? width.min : `${minWidth}px`,
830
+ '--pane-max-width': isCustomWidthOptions(width) ? width.max : `calc(100vw - var(--sidebar-max-width-diff))`,
831
+ '--pane-width-custom': isCustomWidthOptions(width) ? width.default : undefined,
832
+ '--pane-width-size': `var(--pane-width-${isPaneWidth(width) ? width : 'custom'})`,
833
+ '--pane-width': `${currentWidth}px`
834
+ },
1627
835
  children: children
1628
- });
1629
- $[42] = children;
1630
- $[43] = labelProp;
1631
- $[44] = sidebarRef;
1632
- $[45] = t19;
1633
- $[46] = t20;
1634
- $[47] = t21;
1635
- $[48] = t22;
1636
- $[49] = t30;
1637
- $[50] = t31;
1638
- } else {
1639
- t31 = $[50];
1640
- }
1641
- let t32;
1642
- if ($[51] !== currentWidth || $[52] !== currentWidthRef || $[53] !== divider || $[54] !== getDefaultWidth || $[55] !== getMaxPaneWidth || $[56] !== maxPaneWidth || $[57] !== minPaneWidth || $[58] !== position || $[59] !== resizable || $[60] !== saveWidth || $[61] !== sidebarRef) {
1643
- t32 = position === "start" && /*#__PURE__*/jsx(SidebarDivider, {
836
+ }), position === 'start' && /*#__PURE__*/jsx(SidebarDivider, {
1644
837
  position: position,
1645
838
  divider: divider,
1646
839
  resizable: resizable,
@@ -1656,189 +849,58 @@ const Sidebar = /*#__PURE__*/React.forwardRef((t0, forwardRef) => {
1656
849
  getMaxPaneWidth: getMaxPaneWidth,
1657
850
  getDefaultWidth: getDefaultWidth,
1658
851
  saveWidth: saveWidth
1659
- });
1660
- $[51] = currentWidth;
1661
- $[52] = currentWidthRef;
1662
- $[53] = divider;
1663
- $[54] = getDefaultWidth;
1664
- $[55] = getMaxPaneWidth;
1665
- $[56] = maxPaneWidth;
1666
- $[57] = minPaneWidth;
1667
- $[58] = position;
1668
- $[59] = resizable;
1669
- $[60] = saveWidth;
1670
- $[61] = sidebarRef;
1671
- $[62] = t32;
1672
- } else {
1673
- t32 = $[62];
1674
- }
1675
- let t33;
1676
- if ($[63] !== position || $[64] !== t11 || $[65] !== t14 || $[66] !== t15 || $[67] !== t16 || $[68] !== t17 || $[69] !== t18 || $[70] !== t31 || $[71] !== t32) {
1677
- t33 = /*#__PURE__*/jsxs("div", {
1678
- className: t11,
1679
- style: t14,
1680
- ...t15,
1681
- "data-position": position,
1682
- "data-sticky": t16,
1683
- "data-responsive-variant": t17,
1684
- children: [t18, t31, t32]
1685
- });
1686
- $[63] = position;
1687
- $[64] = t11;
1688
- $[65] = t14;
1689
- $[66] = t15;
1690
- $[67] = t16;
1691
- $[68] = t17;
1692
- $[69] = t18;
1693
- $[70] = t31;
1694
- $[71] = t32;
1695
- $[72] = t33;
1696
- } else {
1697
- t33 = $[72];
1698
- }
1699
- return t33;
852
+ })]
853
+ });
1700
854
  });
1701
855
  Sidebar.displayName = 'PageLayout.Sidebar';
1702
856
 
1703
857
  // ----------------------------------------------------------------------------
1704
858
  // PageLayout.Footer
1705
859
 
1706
- const Footer = t0 => {
1707
- const $ = c(28);
1708
- const {
1709
- "aria-label": label,
1710
- "aria-labelledby": labelledBy,
1711
- padding: t1,
1712
- divider: t2,
1713
- dividerWhenNarrow: t3,
1714
- hidden: t4,
1715
- children,
1716
- className,
1717
- style
1718
- } = t0;
1719
- const padding = t1 === undefined ? "none" : t1;
1720
- const divider = t2 === undefined ? "none" : t2;
1721
- const dividerWhenNarrow = t3 === undefined ? "inherit" : t3;
1722
- const hidden = t4 === undefined ? false : t4;
1723
- let t5;
1724
- if ($[0] !== divider || $[1] !== dividerWhenNarrow) {
1725
- t5 = !isResponsiveValue(divider) && dividerWhenNarrow !== "inherit" ? {
1726
- regular: divider,
1727
- narrow: dividerWhenNarrow
1728
- } : divider;
1729
- $[0] = divider;
1730
- $[1] = dividerWhenNarrow;
1731
- $[2] = t5;
1732
- } else {
1733
- t5 = $[2];
1734
- }
1735
- const dividerProp = t5;
860
+ const Footer = ({
861
+ 'aria-label': label,
862
+ 'aria-labelledby': labelledBy,
863
+ padding = 'none',
864
+ divider = 'none',
865
+ dividerWhenNarrow = 'inherit',
866
+ hidden = false,
867
+ children,
868
+ className,
869
+ style
870
+ }) => {
871
+ // Combine divider and dividerWhenNarrow for backwards compatibility
872
+ const dividerProp = !isResponsiveValue(divider) && dividerWhenNarrow !== 'inherit' ? {
873
+ regular: divider,
874
+ narrow: dividerWhenNarrow
875
+ } : divider;
1736
876
  const {
1737
877
  rowGap
1738
878
  } = React.useContext(PageLayoutContext);
1739
- let t6;
1740
- if ($[3] !== hidden) {
1741
- t6 = getResponsiveAttributes("hidden", hidden);
1742
- $[3] = hidden;
1743
- $[4] = t6;
1744
- } else {
1745
- t6 = $[4];
1746
- }
1747
- let t7;
1748
- if ($[5] !== className) {
1749
- t7 = clsx(classes.FooterWrapper, className);
1750
- $[5] = className;
1751
- $[6] = t7;
1752
- } else {
1753
- t7 = $[6];
1754
- }
1755
- const t8 = `var(--spacing-${rowGap})`;
1756
- let t9;
1757
- if ($[7] !== style || $[8] !== t8) {
1758
- t9 = {
1759
- "--spacing": t8,
879
+ return /*#__PURE__*/jsxs("footer", {
880
+ "aria-label": label,
881
+ "aria-labelledby": labelledBy,
882
+ ...getResponsiveAttributes('hidden', hidden),
883
+ className: clsx(classes.FooterWrapper, className),
884
+ style: {
885
+ '--spacing': `var(--spacing-${rowGap})`,
1760
886
  ...style
1761
- };
1762
- $[7] = style;
1763
- $[8] = t8;
1764
- $[9] = t9;
1765
- } else {
1766
- t9 = $[9];
1767
- }
1768
- const t10 = t9;
1769
- const t11 = `var(--spacing-${rowGap})`;
1770
- let t12;
1771
- if ($[10] !== t11) {
1772
- t12 = {
1773
- "--spacing": t11
1774
- };
1775
- $[10] = t11;
1776
- $[11] = t12;
1777
- } else {
1778
- t12 = $[11];
1779
- }
1780
- const t13 = t12;
1781
- let t14;
1782
- if ($[12] !== dividerProp || $[13] !== t13) {
1783
- t14 = /*#__PURE__*/jsx(HorizontalDivider, {
887
+ },
888
+ children: [/*#__PURE__*/jsx(HorizontalDivider, {
1784
889
  className: classes.FooterHorizontalDivider,
1785
- style: t13,
890
+ style: {
891
+ '--spacing': `var(--spacing-${rowGap})`
892
+ },
1786
893
  variant: dividerProp
1787
- });
1788
- $[12] = dividerProp;
1789
- $[13] = t13;
1790
- $[14] = t14;
1791
- } else {
1792
- t14 = $[14];
1793
- }
1794
- const t15 = `var(--spacing-${padding})`;
1795
- let t16;
1796
- if ($[15] !== t15) {
1797
- t16 = {
1798
- "--spacing": t15
1799
- };
1800
- $[15] = t15;
1801
- $[16] = t16;
1802
- } else {
1803
- t16 = $[16];
1804
- }
1805
- const t17 = t16;
1806
- let t18;
1807
- if ($[17] !== children || $[18] !== t17) {
1808
- t18 = /*#__PURE__*/jsx("div", {
894
+ }), /*#__PURE__*/jsx("div", {
1809
895
  className: classes.FooterContent,
1810
- style: t17,
896
+ style: {
897
+ '--spacing': `var(--spacing-${padding})`
898
+ },
1811
899
  children: children
1812
- });
1813
- $[17] = children;
1814
- $[18] = t17;
1815
- $[19] = t18;
1816
- } else {
1817
- t18 = $[19];
1818
- }
1819
- let t19;
1820
- if ($[20] !== label || $[21] !== labelledBy || $[22] !== t10 || $[23] !== t14 || $[24] !== t18 || $[25] !== t6 || $[26] !== t7) {
1821
- t19 = /*#__PURE__*/jsxs("footer", {
1822
- "aria-label": label,
1823
- "aria-labelledby": labelledBy,
1824
- ...t6,
1825
- className: t7,
1826
- style: t10,
1827
- children: [t14, t18]
1828
- });
1829
- $[20] = label;
1830
- $[21] = labelledBy;
1831
- $[22] = t10;
1832
- $[23] = t14;
1833
- $[24] = t18;
1834
- $[25] = t6;
1835
- $[26] = t7;
1836
- $[27] = t19;
1837
- } else {
1838
- t19 = $[27];
1839
- }
1840
- return t19;
900
+ })]
901
+ });
1841
902
  };
903
+ Footer.displayName = "Footer";
1842
904
  Footer.displayName = 'PageLayout.Footer';
1843
905
 
1844
906
  // ----------------------------------------------------------------------------