@astryxdesign/core 0.7.9-canary.f1f92c3 → 0.7.9-canary.f9281ef
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/dist/Layout/LayoutPanel.d.ts.map +1 -1
- package/dist/Layout/LayoutPanel.js +12 -3
- package/dist/OverflowList/OverflowList.d.ts.map +1 -1
- package/dist/OverflowList/OverflowList.js +7 -2
- package/dist/Resizable/resizablePane.d.ts +0 -2
- package/dist/Resizable/resizablePane.d.ts.map +1 -1
- package/dist/Resizable/resizablePane.js +2 -7
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +0 -2
- package/dist/hooks/useOverflow.d.ts +10 -0
- package/dist/hooks/useOverflow.d.ts.map +1 -1
- package/dist/hooks/useOverflow.js +25 -3
- package/package.json +4 -4
- package/src/Layout/LayoutPanel.tsx +16 -2
- package/src/OverflowList/OverflowList.tsx +15 -9
- package/src/Resizable/resizablePane.ts +4 -13
- package/src/SideNav/SideNav.tsx +0 -1
- package/src/hooks/useOverflow.ts +25 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutPanel.d.ts","sourceRoot":"","sources":["../../src/Layout/LayoutPanel.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAS5C,OAAO,KAAK,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"LayoutPanel.d.ts","sourceRoot":"","sources":["../../src/Layout/LayoutPanel.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,Q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CmMZ: "x1c1uobl",
|
|
84
|
+
kwRFfy: "xyri2b",
|
|
85
|
+
kVQacm: "x7giv3",
|
|
86
|
+
$$css: true
|
|
87
|
+
},
|
|
82
88
|
dividerEnd: {
|
|
83
89
|
ke9TFa: "x1lun4ml",
|
|
84
90
|
k8ry5P: "x18b5jzi",
|
|
@@ -205,11 +211,14 @@ export function LayoutPanel({
|
|
|
205
211
|
const isStartPanel = area === 'start';
|
|
206
212
|
const isEndPanel = area === 'end';
|
|
207
213
|
const isZeroPadding = padding === 0;
|
|
214
|
+
// A collapsed region sizes its panel to 0.
|
|
215
|
+
const isZeroWidth = effectiveWidth === 0;
|
|
208
216
|
|
|
209
217
|
// When no divider, collapse spacing for seamless visual flow
|
|
210
|
-
const shouldCollapseSpacing = !hasDivider && !isZeroPadding && padding == null;
|
|
218
|
+
const shouldCollapseSpacing = !hasDivider && !isZeroPadding && padding == null && !isZeroWidth;
|
|
219
|
+
// At width 0 the panel clips its content, so it does not scroll.
|
|
211
220
|
const region = useScrollRegionProps({
|
|
212
|
-
isScrollable,
|
|
221
|
+
isScrollable: isScrollable && !isZeroWidth,
|
|
213
222
|
role,
|
|
214
223
|
label
|
|
215
224
|
});
|
|
@@ -226,7 +235,7 @@ export function LayoutPanel({
|
|
|
226
235
|
"aria-label": region['aria-label'],
|
|
227
236
|
...mergeProps(themeProps('layout-panel'), stylex.props(styles.panel, dynamicStyles.sizing(effectiveWidth ?? null),
|
|
228
237
|
// Outer padding on container edges (unless component is full bleed)
|
|
229
|
-
isStartPanel && !isZeroPadding && padding == null && styles.startPanel, isEndPanel && !isZeroPadding && padding == null && styles.endPanel, !hasHeader && !isZeroPadding && padding == null && styles.noHeader, !hasFooter && !isZeroPadding && padding == null && styles.noFooter, isScrollable && styles.scrollable, isZeroPadding && styles.fullBleed, padding != null && paddingStyles[padding], padding != null && containerPaddingInlineVarStyles[padding], padding != null && containerPaddingBlockStartVarStyles[padding], padding != null && containerPaddingBlockEndVarStyles[padding], hasDivider && dividerStyle, shouldCollapseSpacing && collapseStyle, xstyle), className, style),
|
|
238
|
+
isStartPanel && !isZeroPadding && padding == null && styles.startPanel, isEndPanel && !isZeroPadding && padding == null && styles.endPanel, !hasHeader && !isZeroPadding && padding == null && styles.noHeader, !hasFooter && !isZeroPadding && padding == null && styles.noFooter, isScrollable && styles.scrollable, isZeroPadding && styles.fullBleed, padding != null && paddingStyles[padding], padding != null && containerPaddingInlineVarStyles[padding], padding != null && containerPaddingBlockStartVarStyles[padding], padding != null && containerPaddingBlockEndVarStyles[padding], hasDivider && dividerStyle, shouldCollapseSpacing && collapseStyle, isZeroWidth && styles.zeroWidth, xstyle), className, style),
|
|
230
239
|
...props,
|
|
231
240
|
...(isConcealed ? {
|
|
232
241
|
inert: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverflowList.d.ts","sourceRoot":"","sources":["../../src/OverflowList/OverflowList.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,KAAK,SAAS,EACd,KAAK,YAAY,EAKlB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAgFhD,MAAM,WAAW,YAAY;IAC3B,sCAAsC;IACtC,KAAK,EAAE,YAAY,CAAC;IACpB,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAkB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAClE,qDAAqD;IACrD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;;OAIG;IACH,GAAG,CAAC,EAAE,WAAW,CAAC;IAElB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;;OAMG;IACH,eAAe,CAA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E,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;;OAIG;IACH,GAAG,CAAC,EAAE,WAAW,CAAC;IAElB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAE/B;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,eAAe,GAAG,aAAa,CAAC;IAE3C;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,gBAAgB,CAAC,EAAE,CAAC,aAAa,EAAE,YAAY,EAAE,KAAK,SAAS,CAAC;IAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,gBAAgB,CAAC,EAAE,CAAC,aAAa,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;CAC5D;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,GAAO,EACP,eAAmB,EACnB,eAAe,EACf,OAAO,EACP,YAAoB,EACpB,QAAwB,EACxB,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,iBAAiB,+BA4InB;yBA3Je,YAAY"}
|
|
@@ -21,7 +21,7 @@ import { Children, useCallback, useRef, useState } from 'react';
|
|
|
21
21
|
import { isRenderable } from "../utils/isRenderable.js";
|
|
22
22
|
import * as stylex from '@stylexjs/stylex';
|
|
23
23
|
import { mergeProps } from "../utils/index.js";
|
|
24
|
-
import {
|
|
24
|
+
import { useOverflowInternal } from "../hooks/useOverflow.js";
|
|
25
25
|
import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
|
|
26
26
|
import "../theme/tokens.stylex.js";
|
|
27
27
|
import { spacingVars } from "../theme/tokens.stylex.js";
|
|
@@ -176,19 +176,24 @@ export function OverflowList({
|
|
|
176
176
|
const gapPx = spacingToPx[gap];
|
|
177
177
|
const observeParent = behavior === 'observeParent';
|
|
178
178
|
const isMultiRow = maxRows != null && maxRows > 1;
|
|
179
|
+
|
|
180
|
+
// Only the multi-row path renders from `rowHeight` (it caps the
|
|
181
|
+
// container's height), so only that path tracks it.
|
|
179
182
|
const {
|
|
180
183
|
containerRef,
|
|
181
184
|
measureRef,
|
|
182
185
|
visibleCount,
|
|
183
186
|
hasOverflow,
|
|
184
187
|
rowHeight
|
|
185
|
-
} =
|
|
188
|
+
} = useOverflowInternal(itemCount, {
|
|
186
189
|
gap: gapPx,
|
|
187
190
|
minVisibleItems,
|
|
188
191
|
maxVisibleItems,
|
|
189
192
|
maxRows,
|
|
190
193
|
collapseFrom,
|
|
191
194
|
behavior
|
|
195
|
+
}, {
|
|
196
|
+
tracksRows: isMultiRow
|
|
192
197
|
});
|
|
193
198
|
const allItems = childArray.map((child, index) => ({
|
|
194
199
|
child,
|
|
@@ -29,8 +29,6 @@ export declare function watchResizablePanes(listener: () => void): () => void;
|
|
|
29
29
|
* The pane a resize handle resizes: the lent LayoutPanel just before it, or
|
|
30
30
|
* just after it when the region is reversed.
|
|
31
31
|
*/
|
|
32
|
-
export declare function resizablePaneBeside(handle: Element, side: 'before' | 'after'): ResizablePane | null;
|
|
33
|
-
/** The lent panel a handle sizes: before it, or after it when reversed. */
|
|
34
32
|
export declare function resizablePaneFor(handle: Element, isReversed: boolean): ResizablePane | null;
|
|
35
33
|
/**
|
|
36
34
|
* Moves a handle's hold from `held` to `next`, and returns `next`. A pane the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resizablePane.d.ts","sourceRoot":"","sources":["../../src/Resizable/resizablePane.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;A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,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC9B,WAAW,GAAG,IAAI,CAapB;AAED,wDAAwD;AACxD,MAAM,WAAW,iBAAiB;IAChC,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;IACzD,QAAQ,CAAC,WAAW,EAAE,MAAM,OAAO,CAAC;IACpC,iEAAiE;IACjE,WAAW,IAAI,WAAW,GAAG,IAAI,CAAC;IAClC;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI,CAAC;CAC3C;AAED,wBAAgB,uBAAuB,IAAI,iBAAiB,CAwD3D"}
|
|
@@ -46,14 +46,9 @@ export function watchResizablePanes(listener) {
|
|
|
46
46
|
* The pane a resize handle resizes: the lent LayoutPanel just before it, or
|
|
47
47
|
* just after it when the region is reversed.
|
|
48
48
|
*/
|
|
49
|
-
export function resizablePaneBeside(handle, side) {
|
|
50
|
-
const sibling = side === 'before' ? handle.previousElementSibling : handle.nextElementSibling;
|
|
51
|
-
return sibling == null ? null : lent.get(sibling) ?? null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/** The lent panel a handle sizes: before it, or after it when reversed. */
|
|
55
49
|
export function resizablePaneFor(handle, isReversed) {
|
|
56
|
-
|
|
50
|
+
const sibling = isReversed ? handle.nextElementSibling : handle.previousElementSibling;
|
|
51
|
+
return sibling == null ? null : lent.get(sibling) ?? null;
|
|
57
52
|
}
|
|
58
53
|
|
|
59
54
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideNav.d.ts","sourceRoot":"","sources":["../../src/SideNav/SideNav.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,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;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,eAAe,GAAG,eAAe,CAAC;IAExD;;;;;;;;;;;;;OAaG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,wBAAwB,CAAC;CAClD;AAyBD;;;;;;;;;;;;;;;;;GAiBG;AAEH,wBAAgB,OAAO,CAAC,EACtB,MAAM,EACN,UAAU,EACV,QAAQ,EACR,MAAM,EACN,WAAW,EACX,WAAW,EAAE,eAAe,EAC5B,SAAiB,EACjB,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,SAAS,EACT,GAAG,KAAK,EACT,EAAE,YAAY,+BA+gBd;yBA9hBe,OAAO"}
|
package/dist/SideNav/SideNav.js
CHANGED
|
@@ -282,8 +282,6 @@ export function SideNav({
|
|
|
282
282
|
onSizeChange: resizableConfig.onWidthChange,
|
|
283
283
|
onCollapseChange: onCollapsedChange
|
|
284
284
|
});
|
|
285
|
-
|
|
286
|
-
// The region that sizes the rail: the caller's, or SideNav's own.
|
|
287
285
|
const region = ownerRegion ?? resizableHook;
|
|
288
286
|
const collapsed = region.isCollapsed;
|
|
289
287
|
|
|
@@ -74,4 +74,14 @@ export interface UseOverflowReturn {
|
|
|
74
74
|
* ```
|
|
75
75
|
*/
|
|
76
76
|
export declare function useOverflow(itemCount: number, options?: UseOverflowOptions): UseOverflowReturn;
|
|
77
|
+
/**
|
|
78
|
+
* `useOverflow` for a host inside Core that states whether it renders from
|
|
79
|
+
* `rows` and `rowHeight`. With `tracksRows` false, the hook does not track
|
|
80
|
+
* them and reports `rows: 1` and `rowHeight: 0`. A state write that nobody
|
|
81
|
+
* reads still re-renders the host. Internal: the public hook always tracks
|
|
82
|
+
* them.
|
|
83
|
+
*/
|
|
84
|
+
export declare function useOverflowInternal(itemCount: number, options: UseOverflowOptions, { tracksRows }: {
|
|
85
|
+
tracksRows: boolean;
|
|
86
|
+
}): UseOverflowReturn;
|
|
77
87
|
//# sourceMappingURL=useOverflow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOverflow.d.ts","sourceRoot":"","sources":["../../src/hooks/useOverflow.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAE/B;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,eAAe,GAAG,aAAa,CAAC;CAC5C;AAED,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAC7C,wDAAwD;IACxD,UAAU,EAAE,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAC3C,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,WAAW,EAAE,OAAO,CAAC;IACrB,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,+EAA+E;IAC/E,SAAS,EAAE,MAAM,CAAC;CACnB;AA6JD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB,
|
|
1
|
+
{"version":3,"file":"useOverflow.d.ts","sourceRoot":"","sources":["../../src/hooks/useOverflow.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAE/B;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,eAAe,GAAG,aAAa,CAAC;CAC5C;AAED,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAC7C,wDAAwD;IACxD,UAAU,EAAE,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAC3C,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,WAAW,EAAE,OAAO,CAAC;IACrB,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,+EAA+E;IAC/E,SAAS,EAAE,MAAM,CAAC;CACnB;AA6JD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB,CAEnB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,kBAAkB,EAC3B,EAAC,UAAU,EAAC,EAAE;IAAC,UAAU,EAAE,OAAO,CAAA;CAAC,GAClC,iBAAiB,CA2OnB"}
|
|
@@ -167,6 +167,21 @@ function observedSizeFollowsItems(list, observed) {
|
|
|
167
167
|
* ```
|
|
168
168
|
*/
|
|
169
169
|
export function useOverflow(itemCount, options = {}) {
|
|
170
|
+
return useOverflowInternal(itemCount, options, {
|
|
171
|
+
tracksRows: true
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* `useOverflow` for a host inside Core that states whether it renders from
|
|
177
|
+
* `rows` and `rowHeight`. With `tracksRows` false, the hook does not track
|
|
178
|
+
* them and reports `rows: 1` and `rowHeight: 0`. A state write that nobody
|
|
179
|
+
* reads still re-renders the host. Internal: the public hook always tracks
|
|
180
|
+
* them.
|
|
181
|
+
*/
|
|
182
|
+
export function useOverflowInternal(itemCount, options, {
|
|
183
|
+
tracksRows
|
|
184
|
+
}) {
|
|
170
185
|
const {
|
|
171
186
|
gap = 0,
|
|
172
187
|
minVisibleItems = 0,
|
|
@@ -199,6 +214,11 @@ export function useOverflow(itemCount, options = {}) {
|
|
|
199
214
|
applied.visibleCount = nextVisible;
|
|
200
215
|
setVisibleCount(nextVisible);
|
|
201
216
|
}
|
|
217
|
+
// A host that does not track rows renders from neither value, so they
|
|
218
|
+
// are not written.
|
|
219
|
+
if (!tracksRows) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
202
222
|
if (applied.rows !== nextRows) {
|
|
203
223
|
applied.rows = nextRows;
|
|
204
224
|
setRows(nextRows);
|
|
@@ -207,7 +227,7 @@ export function useOverflow(itemCount, options = {}) {
|
|
|
207
227
|
applied.rowHeight = nextRowHeight;
|
|
208
228
|
setRowHeight(nextRowHeight);
|
|
209
229
|
}
|
|
210
|
-
}, []);
|
|
230
|
+
}, [tracksRows]);
|
|
211
231
|
const calculate = useCallback((timing = 'now') => {
|
|
212
232
|
const container = containerElRef.current;
|
|
213
233
|
const measure = measureElRef.current;
|
|
@@ -317,7 +337,9 @@ export function useOverflow(itemCount, options = {}) {
|
|
|
317
337
|
measureRef,
|
|
318
338
|
visibleCount,
|
|
319
339
|
hasOverflow,
|
|
320
|
-
|
|
321
|
-
|
|
340
|
+
// A host that stops tracking keeps state from earlier measurements, so
|
|
341
|
+
// the return uses the fixed values.
|
|
342
|
+
rows: tracksRows ? rows : 1,
|
|
343
|
+
rowHeight: tracksRows ? rowHeight : 0
|
|
322
344
|
};
|
|
323
345
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/core",
|
|
3
|
-
"version": "0.7.9-canary.
|
|
3
|
+
"version": "0.7.9-canary.f9281ef",
|
|
4
4
|
"displayName": "Astryx Core",
|
|
5
5
|
"description": "The component library. Accessible, themeable React components with built-in spacing, dark mode, and StyleX styling.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -880,9 +880,9 @@
|
|
|
880
880
|
"react-dom": ">=19.0.0"
|
|
881
881
|
},
|
|
882
882
|
"devDependencies": {
|
|
883
|
-
"@astryxdesign/a11y-spec": "0.7.9-canary.
|
|
884
|
-
"@astryxdesign/cli": "0.7.9-canary.
|
|
885
|
-
"@astryxdesign/interaction-harness": "0.7.9-canary.
|
|
883
|
+
"@astryxdesign/a11y-spec": "0.7.9-canary.f9281ef",
|
|
884
|
+
"@astryxdesign/cli": "0.7.9-canary.f9281ef",
|
|
885
|
+
"@astryxdesign/interaction-harness": "0.7.9-canary.f9281ef",
|
|
886
886
|
"@babel/cli": "^7.29.7",
|
|
887
887
|
"@babel/core": "^7.29.7",
|
|
888
888
|
"@babel/preset-react": "^7.29.7",
|
|
@@ -92,6 +92,12 @@ const styles = stylex.create({
|
|
|
92
92
|
scrollable: {
|
|
93
93
|
overflow: 'auto',
|
|
94
94
|
},
|
|
95
|
+
// At width 0 the padding box is 0 too, so the clip hides every child.
|
|
96
|
+
zeroWidth: {
|
|
97
|
+
paddingInlineStart: 0,
|
|
98
|
+
paddingInlineEnd: 0,
|
|
99
|
+
overflow: 'clip',
|
|
100
|
+
},
|
|
95
101
|
// For start panel: divider on end edge
|
|
96
102
|
dividerEnd: {
|
|
97
103
|
borderInlineEndWidth: 1,
|
|
@@ -307,11 +313,18 @@ export function LayoutPanel({
|
|
|
307
313
|
const isEndPanel = area === 'end';
|
|
308
314
|
|
|
309
315
|
const isZeroPadding = padding === 0;
|
|
316
|
+
// A collapsed region sizes its panel to 0.
|
|
317
|
+
const isZeroWidth = effectiveWidth === 0;
|
|
310
318
|
|
|
311
319
|
// When no divider, collapse spacing for seamless visual flow
|
|
312
320
|
const shouldCollapseSpacing =
|
|
313
|
-
!hasDivider && !isZeroPadding && padding == null;
|
|
314
|
-
|
|
321
|
+
!hasDivider && !isZeroPadding && padding == null && !isZeroWidth;
|
|
322
|
+
// At width 0 the panel clips its content, so it does not scroll.
|
|
323
|
+
const region = useScrollRegionProps({
|
|
324
|
+
isScrollable: isScrollable && !isZeroWidth,
|
|
325
|
+
role,
|
|
326
|
+
label,
|
|
327
|
+
});
|
|
315
328
|
const mergedRef = useMergedRefs(ref, region.ref, elementRef, lendRef);
|
|
316
329
|
|
|
317
330
|
// Select divider style based on position
|
|
@@ -354,6 +367,7 @@ export function LayoutPanel({
|
|
|
354
367
|
padding != null && containerPaddingBlockEndVarStyles[padding],
|
|
355
368
|
hasDivider && dividerStyle,
|
|
356
369
|
shouldCollapseSpacing && collapseStyle,
|
|
370
|
+
isZeroWidth && styles.zeroWidth,
|
|
357
371
|
xstyle,
|
|
358
372
|
),
|
|
359
373
|
className,
|
|
@@ -31,7 +31,7 @@ import {isRenderable} from '../utils/isRenderable';
|
|
|
31
31
|
import type {SpacingStep} from '../utils/types';
|
|
32
32
|
import * as stylex from '@stylexjs/stylex';
|
|
33
33
|
import {mergeProps} from '../utils';
|
|
34
|
-
import {
|
|
34
|
+
import {useOverflowInternal} from '../hooks/useOverflow';
|
|
35
35
|
import {useIsomorphicLayoutEffect} from '../hooks/useIsomorphicLayoutEffect';
|
|
36
36
|
import {spacingVars} from '../theme/tokens.stylex';
|
|
37
37
|
import {themeProps} from '../utils/themeProps';
|
|
@@ -284,15 +284,21 @@ export function OverflowList({
|
|
|
284
284
|
const observeParent = behavior === 'observeParent';
|
|
285
285
|
const isMultiRow = maxRows != null && maxRows > 1;
|
|
286
286
|
|
|
287
|
+
// Only the multi-row path renders from `rowHeight` (it caps the
|
|
288
|
+
// container's height), so only that path tracks it.
|
|
287
289
|
const {containerRef, measureRef, visibleCount, hasOverflow, rowHeight} =
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
290
|
+
useOverflowInternal(
|
|
291
|
+
itemCount,
|
|
292
|
+
{
|
|
293
|
+
gap: gapPx,
|
|
294
|
+
minVisibleItems,
|
|
295
|
+
maxVisibleItems,
|
|
296
|
+
maxRows,
|
|
297
|
+
collapseFrom,
|
|
298
|
+
behavior,
|
|
299
|
+
},
|
|
300
|
+
{tracksRows: isMultiRow},
|
|
301
|
+
);
|
|
296
302
|
|
|
297
303
|
const allItems: OverflowItem[] = childArray.map((child, index) => ({
|
|
298
304
|
child,
|
|
@@ -56,23 +56,14 @@ export function watchResizablePanes(listener: () => void): () => void {
|
|
|
56
56
|
* The pane a resize handle resizes: the lent LayoutPanel just before it, or
|
|
57
57
|
* just after it when the region is reversed.
|
|
58
58
|
*/
|
|
59
|
-
export function resizablePaneBeside(
|
|
60
|
-
handle: Element,
|
|
61
|
-
side: 'before' | 'after',
|
|
62
|
-
): ResizablePane | null {
|
|
63
|
-
const sibling =
|
|
64
|
-
side === 'before'
|
|
65
|
-
? handle.previousElementSibling
|
|
66
|
-
: handle.nextElementSibling;
|
|
67
|
-
return sibling == null ? null : (lent.get(sibling) ?? null);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/** The lent panel a handle sizes: before it, or after it when reversed. */
|
|
71
59
|
export function resizablePaneFor(
|
|
72
60
|
handle: Element,
|
|
73
61
|
isReversed: boolean,
|
|
74
62
|
): ResizablePane | null {
|
|
75
|
-
|
|
63
|
+
const sibling = isReversed
|
|
64
|
+
? handle.nextElementSibling
|
|
65
|
+
: handle.previousElementSibling;
|
|
66
|
+
return sibling == null ? null : (lent.get(sibling) ?? null);
|
|
76
67
|
}
|
|
77
68
|
|
|
78
69
|
/**
|
package/src/SideNav/SideNav.tsx
CHANGED
package/src/hooks/useOverflow.ts
CHANGED
|
@@ -263,6 +263,21 @@ function observedSizeFollowsItems(
|
|
|
263
263
|
export function useOverflow(
|
|
264
264
|
itemCount: number,
|
|
265
265
|
options: UseOverflowOptions = {},
|
|
266
|
+
): UseOverflowReturn {
|
|
267
|
+
return useOverflowInternal(itemCount, options, {tracksRows: true});
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* `useOverflow` for a host inside Core that states whether it renders from
|
|
272
|
+
* `rows` and `rowHeight`. With `tracksRows` false, the hook does not track
|
|
273
|
+
* them and reports `rows: 1` and `rowHeight: 0`. A state write that nobody
|
|
274
|
+
* reads still re-renders the host. Internal: the public hook always tracks
|
|
275
|
+
* them.
|
|
276
|
+
*/
|
|
277
|
+
export function useOverflowInternal(
|
|
278
|
+
itemCount: number,
|
|
279
|
+
options: UseOverflowOptions,
|
|
280
|
+
{tracksRows}: {tracksRows: boolean},
|
|
266
281
|
): UseOverflowReturn {
|
|
267
282
|
const {
|
|
268
283
|
gap = 0,
|
|
@@ -303,6 +318,11 @@ export function useOverflow(
|
|
|
303
318
|
applied.visibleCount = nextVisible;
|
|
304
319
|
setVisibleCount(nextVisible);
|
|
305
320
|
}
|
|
321
|
+
// A host that does not track rows renders from neither value, so they
|
|
322
|
+
// are not written.
|
|
323
|
+
if (!tracksRows) {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
306
326
|
if (applied.rows !== nextRows) {
|
|
307
327
|
applied.rows = nextRows;
|
|
308
328
|
setRows(nextRows);
|
|
@@ -312,7 +332,7 @@ export function useOverflow(
|
|
|
312
332
|
setRowHeight(nextRowHeight);
|
|
313
333
|
}
|
|
314
334
|
},
|
|
315
|
-
[],
|
|
335
|
+
[tracksRows],
|
|
316
336
|
);
|
|
317
337
|
|
|
318
338
|
const calculate: Measure = useCallback(
|
|
@@ -488,7 +508,9 @@ export function useOverflow(
|
|
|
488
508
|
measureRef,
|
|
489
509
|
visibleCount,
|
|
490
510
|
hasOverflow,
|
|
491
|
-
|
|
492
|
-
|
|
511
|
+
// A host that stops tracking keeps state from earlier measurements, so
|
|
512
|
+
// the return uses the fixed values.
|
|
513
|
+
rows: tracksRows ? rows : 1,
|
|
514
|
+
rowHeight: tracksRows ? rowHeight : 0,
|
|
493
515
|
};
|
|
494
516
|
}
|