Conversation
|
Build successful! 🎉 |
| constructor(options: ListLayoutOptions = {}) { | ||
| super(); | ||
| this.rowHeight = options.rowHeight ?? null; | ||
| this.rowHeight = options?.rowSize ?? options?.rowHeight ?? null; |
There was a problem hiding this comment.
We could also go ahead and change these height properties to be size as well, would just need to make it back compat with additional getters. Not sure if worth it if those would stick around for quite some time, but might reduce confusion
| this.headingHeight = options.headingHeight ?? null; | ||
| this.estimatedHeadingHeight = options.estimatedHeadingHeight ?? null; | ||
| this.loaderHeight = options.loaderHeight ?? null; | ||
| this.estimatedRowHeight = options?.estimatedRowSize ?? options?.estimatedRowHeight ?? null; |
There was a problem hiding this comment.
did we want to change all the internal variables to size as well?
There was a problem hiding this comment.
o, i think that's what you were saying here #9843 (comment)
There was a problem hiding this comment.
yep, thats right. I might try and do it to see how bad it is
There was a problem hiding this comment.
Btw, when working on this I was kind of unsure whether to use "size" here, since that typically refers to a 2-dimensional value in the context of our virtualizer package. I think it's fine, but wanted to share it for consideration - naming is hard 😅
There was a problem hiding this comment.
haha yeah, I had a similar thought but couldn't think up of a better alternative either. I'll see about pushing up the full changes and then see if we can land on a better name
| grid-template-columns: auto; | ||
| align-items: center; | ||
|
|
||
| &[data-orientation=horizontal] { |
There was a problem hiding this comment.
Need this in the tailwind starter as well
| selectionMode="multiple" | ||
| items={items} | ||
| style={{display: 'block', padding: 0, height: 100}}> | ||
| {(item) => <ListBoxItem style={{height: '100%'}}>{item.name}</ListBoxItem>} |
There was a problem hiding this comment.
We should add some styles to the items so that it's clear where one ends and the next begins. Right now it just looks like a long string of text with some random break in it.
It'd also be nice if this was an example I'd want to use, so if we can make them basically more like cards with a title and description, that'd be better
| ### List | ||
|
|
||
| `ListLayout` supports layout of items in a vertical stack. Rows can be fixed or variable height. When using variable heights, set the `estimatedRowHeight` to a reasonable guess for how tall the rows will be on average. This allows the size of the scrollbar to be calculated. | ||
| `ListLayout` places items along its orientation. Rows can be fixed or variable size. When using variable size, set the `estimatedRowSize` to a reasonable guess for how tall or wide the rows will be on average. This allows the size of the scrollbar to be calculated. |
There was a problem hiding this comment.
| `ListLayout` places items along its orientation. Rows can be fixed or variable size. When using variable size, set the `estimatedRowSize` to a reasonable guess for how tall or wide the rows will be on average. This allows the size of the scrollbar to be calculated. | |
| `ListLayout` places items along its orientation. Rows can be fixed or variable in size. When using a variable size, set the `estimatedRowSize` to a reasonable guess for how tall or wide the rows will be on average. This allows the size of the scrollbar to be calculated. |
|
Build successful! 🎉 |
|
|
||
| Use the `orientation` option to arrange items horizontally or vertically. Provide the same `orientation` on the collection component so keyboard navigation matches the layout. | ||
|
|
||
| ```tsx render docs={docs.exports.ListLayoutOptions} links={docs.links} props={['gap', 'padding']} initialProps={{estimatedRowSize: 300, gap: 8, padding: 8, orientation: 'horizontal'}} propsObject="layoutOptions" wide |
There was a problem hiding this comment.
any chance we make the images a tad bit smaller
|
Build successful! 🎉 |
## API Changes
react-aria-components/react-aria-components:TableLayout TableLayout <O extends TableLayoutProps = TableLayoutProps, T> {
- constructor: (ListLayoutOptions) => void
+ constructor: (TableLayoutProps) => void
getContentSize: () => Size
getDropTargetFromPoint: (number, number, (DropTarget) => boolean) => DropTarget | null
getDropTargetLayoutInfo: (ItemDropTarget) => LayoutInfo
getLayoutInfo: (Key) => LayoutInfo | null
shouldInvalidate: (Rect, Rect) => boolean
shouldInvalidateLayoutOptions: (TableLayoutProps, TableLayoutProps) => boolean
update: (InvalidationContext<TableLayoutProps>) => void
updateItemSize: (Key, Size) => boolean
useLayoutOptions: () => TableLayoutProps
virtualizer: Virtualizer<{}, any> | null
}/react-aria-components:ListLayoutOptions ListLayoutOptions {
dropIndicatorThickness?: number = 2
- estimatedHeadingHeight?: number
- estimatedRowHeight?: number
+ estimatedHeadingSize?: number
+ estimatedRowSize?: number
gap?: number = 0
- headingHeight?: number = 48
- loaderHeight?: number = 48
+ headingSize?: number = 48
+ loaderSize?: number = 48
orientation?: Orientation = 'vertical'
padding?: number = 0
- rowHeight?: number = 48
+ rowSize?: number = 48
}/react-aria-components:TableLayoutProps+TableLayoutProps {
+ columnWidths?: Map<Key, number>
+ dropIndicatorThickness?: number = 2
+ estimatedHeadingHeight?: number
+ estimatedRowHeight?: number
+ gap?: number = 0
+ headingHeight?: number = 48
+ loaderHeight?: number = 48
+ padding?: number = 0
+ rowHeight?: number = 48
+}@internationalized/date/@internationalized/date:DateValue-DateValue {
- D: undefined
-}@react-spectrum/s2/@react-spectrum/s2:ListView ListView <T extends {}> {
UNSAFE_className?: UnsafeClassName
UNSAFE_style?: CSSProperties
aria-describedby?: string
aria-details?: string
aria-label?: string
aria-labelledby?: string
autoFocus?: boolean | FocusStrategy
children: ReactNode | ({}) => ReactNode
defaultSelectedKeys?: 'all' | Iterable<Key>
dependencies?: ReadonlyArray<any>
disabledBehavior?: DisabledBehavior = "all"
disabledKeys?: Iterable<Key>
disallowEmptySelection?: boolean
disallowTypeAhead?: boolean = false
escapeKeyBehavior?: 'clearSelection' | 'none' = 'clearSelection'
hideLinkOutIcon?: boolean
id?: string
isQuiet?: boolean
items?: Iterable<T>
loadingState?: LoadingState
onAction?: (Key) => void
onLoadMore?: () => void
onSelectionChange?: (Selection) => void
- orientation?: Orientation = 'vertical'
overflowMode?: 'wrap' | 'truncate' = 'truncate'
renderActionBar?: ('all' | Set<Key>) => ReactElement
renderEmptyState?: (GridListRenderProps) => ReactNode
selectedKeys?: 'all' | Iterable<Key>
selectionStyle?: 'highlight' | 'checkbox' = 'checkbox'
shouldSelectOnPressUp?: boolean
slot?: string | null
styles?: StylesPropWithHeight
}/@react-spectrum/s2:ListViewProps ListViewProps <T> {
UNSAFE_className?: UnsafeClassName
UNSAFE_style?: CSSProperties
aria-describedby?: string
aria-details?: string
aria-label?: string
aria-labelledby?: string
autoFocus?: boolean | FocusStrategy
children: ReactNode | (T) => ReactNode
defaultSelectedKeys?: 'all' | Iterable<Key>
dependencies?: ReadonlyArray<any>
disabledBehavior?: DisabledBehavior = "all"
disabledKeys?: Iterable<Key>
disallowEmptySelection?: boolean
disallowTypeAhead?: boolean = false
escapeKeyBehavior?: 'clearSelection' | 'none' = 'clearSelection'
hideLinkOutIcon?: boolean
id?: string
isQuiet?: boolean
items?: Iterable<T>
loadingState?: LoadingState
onAction?: (Key) => void
onLoadMore?: () => void
onSelectionChange?: (Selection) => void
- orientation?: Orientation = 'vertical'
overflowMode?: 'wrap' | 'truncate' = 'truncate'
renderActionBar?: ('all' | Set<Key>) => ReactElement
renderEmptyState?: (GridListRenderProps) => ReactNode
selectedKeys?: 'all' | Iterable<Key>
selectionStyle?: 'highlight' | 'checkbox' = 'checkbox'
shouldSelectOnPressUp?: boolean
slot?: string | null
styles?: StylesPropWithHeight
}@react-spectrum/toast/@react-spectrum/toast:CloseFunction-CloseFunction {
- C: undefined
-}@react-stately/data/@react-stately/data:AsyncListLoadFunction-AsyncListLoadFunction {
- A: undefined
-}/@react-stately/data:AsyncListLoadOptions-AsyncListLoadOptions <C, T> {
- cursor?: C
- filterText?: string
- items: Array<T>
- loadingState?: LoadingState
- selectedKeys: Selection
- signal: AbortSignal
- sortDescriptor?: SortDescriptor
-}/@react-stately/data:AsyncListStateUpdate-AsyncListStateUpdate <C, T> {
- cursor?: C
- filterText?: string
- items: Iterable<T>
- selectedKeys?: Iterable<Key>
- sortDescriptor?: SortDescriptor
-}@react-stately/layout/@react-stately/layout:TableLayout TableLayout <O extends TableLayoutProps = TableLayoutProps, T> {
- constructor: (ListLayoutOptions) => void
+ constructor: (TableLayoutProps) => void
getContentSize: () => Size
getDropTargetFromPoint: (number, number, (DropTarget) => boolean) => DropTarget | null
getDropTargetLayoutInfo: (ItemDropTarget) => LayoutInfo
getLayoutInfo: (Key) => LayoutInfo | null
shouldInvalidate: (Rect, Rect) => boolean
shouldInvalidateLayoutOptions: (TableLayoutProps, TableLayoutProps) => boolean
update: (InvalidationContext<TableLayoutProps>) => void
updateItemSize: (Key, Size) => boolean
virtualizer: Virtualizer<{}, any> | null
}/@react-stately/layout:ListLayoutOptions ListLayoutOptions {
dropIndicatorThickness?: number = 2
- estimatedHeadingHeight?: number
- estimatedRowHeight?: number
+ estimatedHeadingSize?: number
+ estimatedRowSize?: number
gap?: number = 0
- headingHeight?: number = 48
- loaderHeight?: number = 48
+ headingSize?: number = 48
+ loaderSize?: number = 48
orientation?: Orientation = 'vertical'
padding?: number = 0
- rowHeight?: number = 48
+ rowSize?: number = 48
}/@react-stately/layout:TableLayoutProps TableLayoutProps {
columnWidths?: Map<Key, number>
dropIndicatorThickness?: number = 2
estimatedHeadingHeight?: number
estimatedRowHeight?: number
gap?: number = 0
headingHeight?: number = 48
loaderHeight?: number = 48
- orientation?: Orientation = 'vertical'
padding?: number = 0
rowHeight?: number = 48
} |
snowystinger
left a comment
There was a problem hiding this comment.
smaller images in the cards would be nice, otherwise looks good
Part of audit
✅ Pull Request Checklist:
📝 Test Instructions:
Check out the docs updates
🧢 Your Project:
RSP