-
Notifications
You must be signed in to change notification settings - Fork 1.5k
chore: setup AI exports #10193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
chore: setup AI exports #10193
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| export {Attachment, AttachmentList} from '../src/AttachmentList'; | ||
|
|
||
| export type {AttachmentProps, AttachmentListProps} from '../src/AttachmentList'; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| export {BasicHorizontalCard, HorizontalCard, CardPreview} from '../src/HorizontalCard'; | ||
| export type {CardProps, BasicCardProps} from '../src/HorizontalCard'; | ||
| export type {HorizontalCardProps, BasicCardProps} from '../src/HorizontalCard'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| export {MessageFeedback} from '../src/MessageFeedback'; | ||
|
|
||
| export type {MessageFeedbackProps} from '../src/MessageFeedback'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| export {MessageSuggestion, MessageSuggestionList} from '../src/MessageSuggestion'; | ||
|
|
||
| export type {MessageSuggestionProps, MessageSuggestionListProps} from '../src/MessageSuggestion'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| export {Thread, ThreadItem, ThreadList, ThreadScrollButton} from '../src/Thread'; | ||
|
|
||
| export type { | ||
| ThreadProps, | ||
| ThreadItemProps, | ||
| ThreadListProps, | ||
| ThreadScrollButtonProps | ||
| } from '../src/Thread'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| export {UserMessage} from '../src/UserMessage'; | ||
|
|
||
| export type {UserMessageProps} from '../src/UserMessage'; |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,13 +16,22 @@ import {BasicHorizontalCard} from './HorizontalCard'; | |||||||||||||||
| import {Button} from 'react-aria-components/Button'; | ||||||||||||||||
| import {CardProps} from '@react-spectrum/s2/Card'; | ||||||||||||||||
| import Close from '@react-spectrum/s2/icons/Close'; | ||||||||||||||||
| import {forwardRef, useRef} from 'react'; | ||||||||||||||||
| import {forwardRef, ReactNode, useRef} from 'react'; | ||||||||||||||||
| import {iconStyle} from '@react-spectrum/s2/style' with {type: 'macro'}; | ||||||||||||||||
| import {mergeStyles} from '@react-spectrum/s2/mergeStyles'; | ||||||||||||||||
| import {pressScale} from '@react-spectrum/s2/pressScale'; | ||||||||||||||||
| import {Tag, TagGroup, TagList} from 'react-aria-components/TagGroup'; | ||||||||||||||||
| import type {StyleProps} from '@react-spectrum/s2'; | ||||||||||||||||
| import {Tag, TagGroup, TagGroupProps, TagList} from 'react-aria-components/TagGroup'; | ||||||||||||||||
| import {useDOMRef} from './useDOMRef'; | ||||||||||||||||
|
|
||||||||||||||||
| export interface AttachmentListProps extends TagGroupProps, StyleProps { | ||||||||||||||||
| children: ReactNode; | ||||||||||||||||
| } | ||||||||||||||||
|
Comment on lines
+27
to
+29
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
we're allowing all properties to be overridden so no need for
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also i noticed while looking at the storybook that AttachmentList also includes |
||||||||||||||||
|
|
||||||||||||||||
| export interface AttachmentProps extends CardProps { | ||||||||||||||||
| children: ReactNode; | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| const controlSizeM = { | ||||||||||||||||
| default: 32, | ||||||||||||||||
| size: { | ||||||||||||||||
|
|
@@ -104,7 +113,7 @@ const CloseButton = function CloseButton(props) { | |||||||||||||||
| }; | ||||||||||||||||
|
|
||||||||||||||||
| export const AttachmentList = forwardRef(function AttachmentList( | ||||||||||||||||
| props: any, | ||||||||||||||||
| props: AttachmentListProps, | ||||||||||||||||
| ref: DOMRef<HTMLDivElement> | ||||||||||||||||
| ) { | ||||||||||||||||
| let domRef = useDOMRef(ref); | ||||||||||||||||
|
|
||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| /* | ||
| * Copyright 2024 Adobe. All rights reserved. | ||
| * This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. You may obtain a copy | ||
| * of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under | ||
| * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
| * OF ANY KIND, either express or implied. See the License for the specific language | ||
| * governing permissions and limitations under the License. | ||
| */ | ||
|
|
||
| import { | ||
| Attachment as AttachmentComponent, | ||
| AttachmentList, | ||
| type AttachmentListProps | ||
| } from '@react-spectrum/ai/AttachmentList'; | ||
| import {Content} from '@react-spectrum/s2/Content'; | ||
| import {Image} from '@react-spectrum/s2/Image'; | ||
| import type {Meta, StoryObj} from '@storybook/react'; | ||
| import {style} from '@react-spectrum/s2/style' with {type: 'macro'}; | ||
| import {Text} from '@react-spectrum/s2/Text'; | ||
|
|
||
| const meta: Meta<AttachmentListProps> = { | ||
| component: AttachmentList, | ||
| parameters: { | ||
| layout: 'centered' | ||
| }, | ||
| tags: ['autodocs'], | ||
| argTypes: { | ||
| children: {table: {disable: true}} | ||
| }, | ||
| title: 'AI/AttachmentList' | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| type Story = StoryObj<typeof AttachmentList>; | ||
|
|
||
| export const AIAttachmentList: Story = { | ||
| render: args => ( | ||
| <AttachmentList {...args} styles={style({width: 500})}> | ||
| <AttachmentComponent aria-label="Demo file.pdf"> | ||
| <Image | ||
| slot="thumbnail" | ||
| src={new URL('../../s2/stories/assets/placeholder.png', import.meta.url).toString()} | ||
| /> | ||
| </AttachmentComponent> | ||
| <AttachmentComponent aria-label="Alligator.pdf"> | ||
| <Image | ||
| slot="thumbnail" | ||
| src={new URL('../../s2/stories/assets/placeholder.png', import.meta.url).toString()} | ||
| /> | ||
| </AttachmentComponent> | ||
| <AttachmentComponent aria-label="Rules.pdf"> | ||
| <Image | ||
| slot="thumbnail" | ||
| src={new URL('../../s2/stories/assets/placeholder.png', import.meta.url).toString()} | ||
| /> | ||
| </AttachmentComponent> | ||
| <AttachmentComponent aria-label="Echidna.pdf"> | ||
| <Image | ||
| slot="thumbnail" | ||
| src={new URL('../../s2/stories/assets/placeholder.png', import.meta.url).toString()} | ||
| /> | ||
| <Content> | ||
| <Text slot="title">Card title</Text> | ||
| <Text slot="description">Card description.</Text> | ||
| </Content> | ||
| </AttachmentComponent> | ||
| </AttachmentList> | ||
| ) | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need individual subpath exports for this package? I'm not sure why you'd use only one component. They are all related to each other.