Conversation
|
Build successful! 🎉 |
|
Build successful! 🎉 |
| ...focusRing() | ||
| }); | ||
|
|
||
| const gridGap = css('gap: 6px;'); |
There was a problem hiding this comment.
I can swap this out for 8px, Figma had 6, wasn't sure.
There was a problem hiding this comment.
you can use custom values in a style macro like so
gap: '[6px]'
or if it needs to respond to font size or scaling, you can make use of size() or space()
https://react-spectrum.adobe.com/style-macro#space
There was a problem hiding this comment.
is it really a static 6px at all sizes? Feels like the scale should change the gap size
| ) | ||
| }; | ||
|
|
||
| export const WithAttachmentGrid: Story = { |
There was a problem hiding this comment.
Thought this would be a useful story, can remove.
| export const Overflow: Story = { | ||
| name: 'Overflow (vertical scroll fade)', | ||
| render: args => ( | ||
| <div style={{width: 320, resize: 'horizontal', overflow: 'hidden'}}> |
There was a problem hiding this comment.
maybe this needs padding
|
Build successful! 🎉 |
| ...focusRing() | ||
| }); | ||
|
|
||
| const gridGap = css('gap: 6px;'); |
There was a problem hiding this comment.
is it really a static 6px at all sizes? Feels like the scale should change the gap size
| let domRef = useDOMRef(ref); | ||
|
|
||
| return ( | ||
| <ListBox |
There was a problem hiding this comment.
should the container have a focus ring? Or are the items focusable its hard to tell
There was a problem hiding this comment.
I don't think the individual items should be focusable/interactable but perhaps the grid/container itself should have a focus ring. You are supposed to be able to scroll it with keyboard when focused.
| const hasContent = ':has([data-slot=content])'; | ||
|
|
||
| const gridStyles = style({ | ||
| display: 'grid', |
There was a problem hiding this comment.
Can there be a mix of cards that are thumbnails and cards that have the description?
There was a problem hiding this comment.
no, the card types can't be mixed (at least following AttachmentList)
| const gridStyles = style({ | ||
| display: 'grid', | ||
| gridTemplateColumns: { | ||
| default: 'repeat(auto-fill, minmax(64px, 1fr))', |
There was a problem hiding this comment.
If the container is wide and there aren't enough thumbs to fill it in the first row, i think they'll end up spaced apart
I think you just want
default: 'repeat(auto-fill, minmax(64px, auto))'
though that only matters if the attachments can be varying sizes, if they can't, then you could just do
default: 'repeat(auto-fill, 64px)'
There was a problem hiding this comment.
We had a discussion about this in one of our team meetings. We're unsure if it should be justified space around as you have it here, or left justified... or what, can you follow up with the designer?
| size?: 'XS' | 'S' | 'M' | 'L' | 'XL'; | ||
| /** Whether the attachment has an error. */ | ||
| isInvalid?: boolean; | ||
| uploadProgress?: number; |
There was a problem hiding this comment.
bump on this, still missing a description. Mind adding some docs for this as well? Can just go under the ai-components docs
| aria-label={ariaLabel} | ||
| aria-labelledby={ariaLabelledby} | ||
| aria-describedby={ariaDescribedby} |
There was a problem hiding this comment.
these and id are all just getting passed straight through, we can use filterDOMProps with labeling set to true
then we can just spread the result of that
|
Build successful! 🎉 |
eeb779f to
6edbbf8
Compare
|
Build successful! 🎉 |
LFDanLu
left a comment
There was a problem hiding this comment.
Looks pretty good, just a couple of small comments
| overflowY: 'auto', | ||
| overflowX: 'clip', | ||
| boxSizing: 'border-box', | ||
| ...focusRing() |
There was a problem hiding this comment.
doesn't seem like this focus ring is appearing on the grid, maybe getting clipped or something?
There was a problem hiding this comment.
I figured out what was happening, it was being clipped and even when I added some offset it needed some padding so that it didn't overlap with the grid items.
| } | ||
| }, | ||
| gap: 8, | ||
| maxHeight: 240, |
There was a problem hiding this comment.
is this height defined explicitly in the design or should it be customizable by the user?
There was a problem hiding this comment.
So in the designs a bunch of the examples had a maxHeight of 240, but one of them was 190. I swapped it to inherit, that probably makes more sense.
| size?: 'XS' | 'S' | 'M' | 'L' | 'XL'; | ||
| /** Whether the attachment has an error. */ | ||
| isInvalid?: boolean; | ||
| uploadProgress?: number; |
There was a problem hiding this comment.
bump on this, still missing a description. Mind adding some docs for this as well? Can just go under the ai-components docs
|
Build successful! 🎉 |
| overflowY: 'auto', | ||
| overflowX: 'clip', | ||
| boxSizing: 'border-box', | ||
| ...focusRing(), |
There was a problem hiding this comment.
nit: should the focus ring have rounded borders? dunno, feel like everything in S2 is rounded so 🤷♀️
There was a problem hiding this comment.
ik there aren't designs for this so probably fine to leave it as is
| /** | ||
| * An AttachmentGrid displays file attachments as a wrapping, vertically-scrolling grid of | ||
| * thumbnails. Unlike AttachmentList, it is display-only and does not support selection or removal. | ||
| * Every attachment is disabled, so the grid itself becomes the sole tab stop, keeping the |
There was a problem hiding this comment.
do we need this part (aka "every attachment is disabled...")? i feel like it's sorta implied?
|
|
||
| #### AttachmentGrid | ||
|
|
||
| Use `AttachmentGrid` to display file attachments as a wrapping, vertically-scrolling grid of |
There was a problem hiding this comment.
wonder if we should have an example of this in a user message somewhere
There was a problem hiding this comment.
Yeah I originally had it as part of the UserMessage's story but wasn't sure if that was a good place.
|
Build successful! 🎉 |
## API Changes
@react-spectrum/ai/@react-spectrum/ai:AttachmentGrid+AttachmentGrid <T> {
+ align?: 'start' | 'center' | 'end' = 'start'
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ children?: ReactNode | (T) => ReactNode
+ dependencies?: ReadonlyArray<any>
+ id?: string
+ items?: Iterable<T>
+ styles?: StyleString
+}/@react-spectrum/ai:AttachmentGridItem+AttachmentGridItem {
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ children: ReactNode
+ id?: Key
+ isInvalid?: boolean
+ size?: 'XS' | 'S' | 'M' | 'L' | 'XL'
+ styles?: StyleString
+ textValue?: string
+ uploadProgress?: number
+}/@react-spectrum/ai:AttachmentGridProps+AttachmentGridProps <T> {
+ align?: 'start' | 'center' | 'end' = 'start'
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ children?: ReactNode | (T) => ReactNode
+ dependencies?: ReadonlyArray<any>
+ id?: string
+ items?: Iterable<T>
+ styles?: StyleString
+}/@react-spectrum/ai:AttachmentGridItemProps+AttachmentGridItemProps {
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ children: ReactNode
+ id?: Key
+ isInvalid?: boolean
+ size?: 'XS' | 'S' | 'M' | 'L' | 'XL'
+ styles?: StyleString
+ textValue?: string
+ uploadProgress?: number
+} |
Closes
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project:
Adobe