Skip to content

Commit e6e088e

Browse files
committed
Merge branch 'main' into rac-tree-docs
# Conflicts: # packages/@react-spectrum/s2/src/TreeView.tsx # packages/react-aria-components/stories/Tree.stories.tsx # packages/react-aria-components/test/Tree.test.tsx
2 parents fa29995 + 818053f commit e6e088e

File tree

185 files changed

+1349
-460
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+1349
-460
lines changed

.storybook-s2/docs/Intro.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ import {ActionButton} from '@react-spectrum/s2';
202202
<li><Code>width</Code></li>
203203
<li><Code>minWidth</Code></li>
204204
<li><Code>maxWidth</Code></li>
205-
<li><Code>flex</Code></li>
206205
<li><Code>flexGrow</Code></li>
207206
<li><Code>flexShrink</Code></li>
208207
<li><Code>flexBasis</Code></li>

packages/@react-aria/collections/src/BaseCollection.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ export class CollectionNode<T> implements Node<T> {
3535
readonly lastChildKey: Key | null = null;
3636
readonly props: any = {};
3737
readonly render?: (node: Node<any>) => ReactElement;
38+
readonly colSpan: number | null = null;
39+
readonly colIndex: number | null = null;
3840

3941
constructor(type: string, key: Key) {
4042
this.type = type;
@@ -61,6 +63,8 @@ export class CollectionNode<T> implements Node<T> {
6163
node.lastChildKey = this.lastChildKey;
6264
node.props = this.props;
6365
node.render = this.render;
66+
node.colSpan = this.colSpan;
67+
node.colIndex = this.colIndex;
6468
return node;
6569
}
6670
}

packages/@react-aria/collections/src/Document.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,16 @@ export class ElementNode<T> extends BaseNode<T> {
260260
node.hasChildNodes = !!this.firstChild;
261261
node.firstChildKey = this.firstChild?.node.key ?? null;
262262
node.lastChildKey = this.lastChild?.node.key ?? null;
263+
264+
// Update the colIndex of sibling nodes if this node has a colSpan.
265+
if ((node.colSpan != null || node.colIndex != null) && this.nextSibling) {
266+
// This queues the next sibling for update, which means this happens recursively.
267+
let nextColIndex = (node.colIndex ?? node.index) + (node.colSpan ?? 1);
268+
if (nextColIndex !== this.nextSibling.node.colIndex) {
269+
let siblingNode = this.ownerDocument.getMutableNode(this.nextSibling);
270+
siblingNode.colIndex = nextColIndex;
271+
}
272+
}
263273
}
264274

265275
setProps<E extends Element>(obj: any, ref: ForwardedRef<E>, rendered?: any, render?: (node: Node<T>) => ReactElement) {
@@ -278,6 +288,10 @@ export class ElementNode<T> extends BaseNode<T> {
278288
node.key = id;
279289
}
280290

291+
if (props.colSpan != null) {
292+
node.colSpan = props.colSpan;
293+
}
294+
281295
// If this is the first time props have been set, end the transaction started in the constructor
282296
// so this node can be emitted.
283297
if (!this.hasSetProps) {
@@ -418,8 +432,8 @@ export class Document<T, C extends BaseCollection<T> = BaseCollection<T>> extend
418432
}
419433
}
420434

421-
collection.commit(this.firstChild?.node.key ?? null, this.lastChild?.node.key ?? null, this.isSSR);
422435
this.mutatedNodes.clear();
436+
collection.commit(this.firstChild?.node.key ?? null, this.lastChild?.node.key ?? null, this.isSSR);
423437
}
424438

425439
this.collectionMutated = false;

packages/@react-aria/virtualizer/src/VirtualizerItem.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@ export function layoutInfoToStyle(layoutInfo: LayoutInfo, dir: Direction, parent
8888
...rectStyles
8989
};
9090

91+
if (layoutInfo.isSticky) {
92+
if (style.top) {
93+
style.marginTop = style.top;
94+
}
95+
if (style[xProperty]) {
96+
style[dir === 'rtl' ? 'marginRight' : 'marginLeft'] = style[xProperty];
97+
}
98+
}
99+
91100
cache.set(layoutInfo, style);
92101
return style;
93102
}

packages/@react-spectrum/listbox/src/ListBoxBase.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function useListBoxLayout<T>(): ListBoxLayout<T> {
5454
new ListBoxLayout<T>({
5555
estimatedRowHeight: scale === 'large' ? 48 : 32,
5656
estimatedHeadingHeight: scale === 'large' ? 33 : 26,
57-
padding: scale === 'large' ? 5 : 4, // TODO: get from DNA
57+
paddingY: scale === 'large' ? 5 : 4, // TODO: get from DNA
5858
placeholderHeight: scale === 'large' ? 48 : 32
5959
})
6060
, [scale]);

packages/@react-spectrum/listbox/src/ListBoxLayout.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ interface ListBoxLayoutProps {
88

99
interface ListBoxLayoutOptions extends ListLayoutOptions {
1010
placeholderHeight: number,
11-
padding: number
11+
paddingY: number
1212
}
1313

1414
export class ListBoxLayout<T> extends ListLayout<T, ListBoxLayoutProps> {
1515
private isLoading: boolean = false;
1616
private placeholderHeight: number;
17-
private padding: number;
17+
private paddingY: number;
1818

1919
constructor(opts: ListBoxLayoutOptions) {
2020
super(opts);
2121
this.placeholderHeight = opts.placeholderHeight;
22-
this.padding = opts.padding;
22+
this.paddingY = opts.paddingY;
2323
}
2424

2525
update(invalidationContext: InvalidationContext<ListBoxLayoutProps>): void {
@@ -28,7 +28,7 @@ export class ListBoxLayout<T> extends ListLayout<T, ListBoxLayoutProps> {
2828
}
2929

3030
protected buildCollection(): LayoutNode[] {
31-
let nodes = super.buildCollection(this.padding);
31+
let nodes = super.buildCollection(this.paddingY);
3232
let y = this.contentSize.height;
3333

3434
if (this.isLoading) {
@@ -55,7 +55,7 @@ export class ListBoxLayout<T> extends ListLayout<T, ListBoxLayoutProps> {
5555
y = placeholder.rect.maxY;
5656
}
5757

58-
this.contentSize.height = y + this.padding;
58+
this.contentSize.height = y + this.paddingY;
5959
return nodes;
6060
}
6161

Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 6 additions & 0 deletions
Loading

packages/@react-spectrum/s2/s2wf-icons/S2_Icon_AlertDiamond_20_N.svg

Lines changed: 1 addition & 1 deletion
Loading

packages/@react-spectrum/s2/s2wf-icons/S2_Icon_AnimationNo_20_N.svg

Lines changed: 1 addition & 1 deletion
Loading

packages/@react-spectrum/s2/s2wf-icons/S2_Icon_Animation_20_N.svg

Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 5 additions & 0 deletions
Loading

packages/@react-spectrum/s2/s2wf-icons/S2_Icon_AspectRatio_20_N.svg

Lines changed: 1 addition & 1 deletion
Loading

packages/@react-spectrum/s2/s2wf-icons/S2_Icon_Asset_20_N.svg

Lines changed: 1 addition & 1 deletion
Loading

packages/@react-spectrum/s2/s2wf-icons/S2_Icon_AudioWave_20_N.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)