Skip to content

chore: Setup ai components package#10095

Open
snowystinger wants to merge 13 commits into
mainfrom
setup-ai-components-package
Open

chore: Setup ai components package#10095
snowystinger wants to merge 13 commits into
mainfrom
setup-ai-components-package

Conversation

@snowystinger
Copy link
Copy Markdown
Member

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.

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

@rspbot
Copy link
Copy Markdown

rspbot commented May 22, 2026

@rspbot
Copy link
Copy Markdown

rspbot commented May 22, 2026

@rspbot
Copy link
Copy Markdown

rspbot commented May 28, 2026

@rspbot
Copy link
Copy Markdown

rspbot commented May 28, 2026

@rspbot
Copy link
Copy Markdown

rspbot commented May 28, 2026

## API Changes

@react-spectrum/s2-ai

/@react-spectrum/s2-ai:Asset

+Asset {
+
+}

/@react-spectrum/s2-ai:AssetList

+AssetList {
+
+}

/@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'
+}

@@ -0,0 +1,3 @@
# @react-spectrum/s2-ai
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to just call it @react-spectrum/ai?

aria-labelledby={ariaLabelledby}
aria-describedby={ariaDescribedby}
ref={domRef}
className={style({flexShrink: 0, flexGrow: 0, position: 'relative'})}>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs focus ring? I'm seeing the native browser one

);
});

export const Asset = forwardRef(function Asset(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call these AttachmentList / Attachment? I think that's the name design is using.

<Checkbox slot="selection" excludeFromTabOrder size={size === 'XS' ? 'S' : size} />
</div>
);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

* const merged = mergeStyles(baseStyles, overrideStyles);
* // merged has `padding: 16` and `color: heading`.
*/
export function mergeStyles(...styles: (StyleString | null | undefined)[]): StyleString {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure this is exported from the s2 package. Does it need to be duplicated here?

styles?: StylesProp;
}

export function getAllowedOverrides({width = true, height = false} = {}): string[] {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we just allow all overrides for now so we don't need to copy all this?


export const AIAssetList: Story = {
render: args => (
<AssetList {...args} styles={style({width: 400})}>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the args supposed to apply to the individual assets too? Like I noticed changing the variant wasn't affecting the stories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants