chore: Setup ai components package#10095
Conversation
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
| <Checkbox slot="selection" excludeFromTabOrder size={size === 'XS' ? 'S' : size} /> | ||
| </div> | ||
| ); | ||
| } |
There was a problem hiding this comment.
Can any of this be reused from the existing Card component? The idea there was to have the generic Card not specify any layout and for specific card types to extend from it. What were the things that prevented you from implementing it that way and necessitated copying the entire Card component here?
There was a problem hiding this comment.
yes, but I copied it so that it was standalone and we wouldn't be releasing horizontal cards in s2 yet
|
|
||
| export const AIAssetList: Story = { | ||
| render: args => ( | ||
| <AssetList {...args} styles={style({width: 400})}> |
There was a problem hiding this comment.
Are the args supposed to apply to the individual assets too? Like I noticed changing the variant wasn't affecting the stories.
There was a problem hiding this comment.
Not all of it was hooked up :-/ there weren't any designs for a number of things, so probably overlooked it
* support custom typography on s2 disclosure * initialize message source * add numberbadge, cleanup, formatting * more cleanup * remove story * minor fixes * support t-shirt sizing * add response status component * move files to ai package * fix imports * fix lint * fix formatting * actually fix lint? * move to correct storybook folder * add exports
|
Build successful! 🎉 |
* fix: rebase commits + add stories * feat: migrate MessageFeedback and UserMessage components to s2-ai package * Apply suggestions from code review Co-authored-by: Yihui Liao <44729383+yihuiliao@users.noreply.github.com> * add missing file --------- Co-authored-by: Yihui Liao <44729383+yihuiliao@users.noreply.github.com>
|
Build successful! 🎉 |
|
Build successful! 🎉 |
| const panelStyles = style({ | ||
| font: 'body', | ||
| height: '--disclosure-panel-height', | ||
| overflow: 'clip', | ||
| transition: { | ||
| default: '[height]', | ||
| '@media (prefers-reduced-motion: reduce)': 'none' | ||
| } | ||
| }); |
There was a problem hiding this comment.
one thing I noticed (and might be present in our S2 Disclosure as well) was that if the user didn't provide a ResponseStatusPanel while the ResponseStatus was loading but then provided one once loading finished, the disclosure would render with its non-expanded styles but the contents of the panel would be visible still. Maybe a non-issue but users might run into it accidentally
There was a problem hiding this comment.
oh interesting. i think my expectation was the a ResponseStatusPanel would always be provided even while ResponseStatus was loading so it would never be "missing" from the code and the actual content of the panel would get injected at some point. not sure if that's the right way to think about it tho
|
Build successful! 🎉 |
|
Build successful! 🎉 |
| let isRTL = direction === 'rtl'; | ||
|
|
||
| return ( | ||
| <RACButton |
There was a problem hiding this comment.
the only reason i ended up using a RACButton is because i needed the font weight to be less and there's no way to customize the typography in a button. similar to how we were open to supporting custom typography in disclosure, would we open to it in buttons as well?
* base setup, transferring the stuff from the prototypes repo * add dynamic story * more things to fix * explorations * add scroll to bottom button and scroll when new messages are added if near button * use aria live to announce new items * tentative column reverse investigation and update stories to reflect that * handle keyboard navigation when using column reverse * fix pageup/page down looping in column reverse * force shift tab and tab to go to newest card on first enty * make it so whenever you tab into the thread, you go to newest content regardless of prev focused key * virtualized story and testing stuff * announcement of new items only * add streaming example * make example more realistic and fine tune announcement behavior * add thinking response status * tried aria live on gridlist item * only announce if in thread or in field * only announce "new message" if user is in the thread, fix focus loss to body * forgot a new option doc * move to more RAC like API * move to ai components repo * clean up * add tests * fix 16/17? * update story to use available ai components
|
Build successful! 🎉 |
## API Changes
@react-spectrum/s2/@react-spectrum/s2:DisclosureTitle DisclosureTitle {
UNSAFE_className?: UnsafeClassName
UNSAFE_style?: CSSProperties
children: React.ReactNode
id?: string
level?: number = 3
+ styles?: StylesPropWithFont
}@react-spectrum/s2-ai/@react-spectrum/s2-ai:Attachment+Attachment {
+
+}/@react-spectrum/s2-ai:AttachmentList+AttachmentList {
+
+}/@react-spectrum/s2-ai:BasicHorizontalCard+BasicHorizontalCard {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ children: ReactNode | (CardRenderProps) => ReactNode
+ density?: 'compact' | 'regular' | 'spacious' = 'regular'
+ download?: boolean | string
+ href?: Href
+ hrefLang?: string
+ id?: Key
+ isDisabled?: boolean
+ onAction?: () => void
+ onPress?: (PressEvent) => void
+ onPressChange?: (boolean) => void
+ onPressEnd?: (PressEvent) => void
+ onPressStart?: (PressEvent) => void
+ onPressUp?: (PressEvent) => void
+ ping?: string
+ referrerPolicy?: HTMLAttributeReferrerPolicy
+ rel?: string
+ routerOptions?: RouterOptions
+ size?: 'XS' | 'S' | 'M' | 'L' | 'XL' = 'M'
+ styles?: StylesProp
+ target?: HTMLAttributeAnchorTarget
+ textValue?: string
+ value?: T
+ variant?: 'primary' | 'secondary' | 'tertiary' | 'quiet' = 'primary'
+}/@react-spectrum/s2-ai:HorizontalCard+HorizontalCard {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ children: ReactNode | (CardRenderProps) => ReactNode
+ density?: 'compact' | 'regular' | 'spacious' = 'regular'
+ download?: boolean | string
+ href?: Href
+ hrefLang?: string
+ id?: Key
+ isDisabled?: boolean
+ onAction?: () => void
+ onPress?: (PressEvent) => void
+ onPressChange?: (boolean) => void
+ onPressEnd?: (PressEvent) => void
+ onPressStart?: (PressEvent) => void
+ onPressUp?: (PressEvent) => void
+ ping?: string
+ referrerPolicy?: HTMLAttributeReferrerPolicy
+ rel?: string
+ routerOptions?: RouterOptions
+ size?: 'XS' | 'S' | 'M' | 'L' | 'XL' = 'M'
+ styles?: StylesProp
+ target?: HTMLAttributeAnchorTarget
+ textValue?: string
+ value?: T
+ variant?: 'primary' | 'secondary' | 'tertiary' | 'quiet' = 'primary'
+}/@react-spectrum/s2-ai:MessageFeedback+MessageFeedback {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ defaultValue?: MessageFeedbackValue
+ id?: string
+ isDisabled?: boolean
+ onChange?: (MessageFeedbackValue) => void
+ slot?: string | null
+ styles?: StylesProp
+ thumbDownLabel?: string
+ thumbUpLabel?: string
+ value?: MessageFeedbackValue
+}/@react-spectrum/s2-ai:MessageSuggestion+MessageSuggestion {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ aria-controls?: string
+ aria-current?: boolean | 'true' | 'false' | 'page' | 'step' | 'location' | 'date' | 'time'
+ aria-describedby?: string
+ aria-details?: string
+ aria-disabled?: boolean | 'true' | 'false'
+ aria-expanded?: boolean | 'true' | 'false'
+ aria-haspopup?: boolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | 'true' | 'false'
+ aria-label?: string
+ aria-labelledby?: string
+ aria-pressed?: boolean | 'true' | 'false' | 'mixed'
+ autoFocus?: boolean
+ children: ReactNode
+ excludeFromTabOrder?: boolean
+ form?: string
+ formAction?: ButtonHTMLAttributes<HTMLButtonElement>['formAction']
+ formEncType?: string
+ formMethod?: string
+ formNoValidate?: boolean
+ formTarget?: string
+ id?: string
+ name?: string
+ onBlur?: (FocusEvent<Target>) => void
+ onClick?: (MouseEvent<FocusableElement>) => void
+ onFocus?: (FocusEvent<Target>) => void
+ onFocusChange?: (boolean) => void
+ onHoverChange?: (boolean) => void
+ onHoverEnd?: (HoverEvent) => void
+ onHoverStart?: (HoverEvent) => void
+ onKeyDown?: (KeyboardEvent) => void
+ onKeyUp?: (KeyboardEvent) => void
+ onPress?: (PressEvent) => void
+ onPressChange?: (boolean) => void
+ onPressEnd?: (PressEvent) => void
+ onPressStart?: (PressEvent) => void
+ onPressUp?: (PressEvent) => void
+ preventFocusOnPress?: boolean
+ render?: DOMRenderFunction<keyof React.JSX.IntrinsicElements, ButtonRenderProps>
+ size?: 'S' | 'M' | 'L' | 'XL'
+ slot?: string | null
+ styles?: StylesProp
+ type?: 'button' | 'submit' | 'reset' = 'button'
+ value?: string
+}/@react-spectrum/s2-ai:MessageSuggestionContext+MessageSuggestionContext {
+ UNTYPED
+}/@react-spectrum/s2-ai:MessageSuggestionList+MessageSuggestionList {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ children: ReactNode
+ id?: string
+ size?: 'S' | 'M' | 'L' | 'XL'
+ slot?: string | null
+ styles?: StylesProp
+ title: string
+}/@react-spectrum/s2-ai:MessageSuggestionListContext+MessageSuggestionListContext {
+ UNTYPED
+}/@react-spectrum/s2-ai:ResponseStatus+ResponseStatus {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ children: ReactNode
+ defaultExpanded?: boolean
+ density?: 'compact' | 'regular' | 'spacious' = 'regular'
+ id?: Key
+ isDisabled?: boolean
+ isExpanded?: boolean
+ isLoading?: boolean
+ onExpandedChange?: (boolean) => void
+ size?: 'S' | 'M' | 'L' | 'XL' = 'M'
+ slot?: string | null
+ styles?: StylesProp
+}/@react-spectrum/s2-ai:ResponseStatusPanel+ResponseStatusPanel {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ children: React.ReactNode
+ id?: string
+ label?: ReactNode
+ labelElementType?: ElementType = 'label'
+ role?: 'group' | 'region' = 'group'
+}/@react-spectrum/s2-ai:UserMessage+UserMessage {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ children: ReactNode
+ id?: string
+ slot?: string | null
+ styles?: StylesProp
+} |
Agent Skills ChangesModified (1)
InstallReact Spectrum S2: React Aria: |
Closes
Sets up a new @react-spectrum/s2-ai package where we can develop the new and nebulous ai components that Spectrum is experimenting with.
Some things to note:
CenterBaseline. There isn’t a need for it if you’re using icons within S2 components but when you start using S2 icons outside of S2 components, I find myself reaching for itCenterBaseline(the component)getAllowedOverrides()andcontrolSize(), we also have to export type so something to think aboutuseDOMRefanduseSpectrumContextPropsto match how we do things in S2useDOMRefbut get rid ofuseSpectrumContextProps, can add contexts later but no need to complicate things for now✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: