Skip to content

chore: S2 storybook standardisation updates, treeview generics fix #8397

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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

snowystinger
Copy link
Member

@snowystinger snowystinger commented Jun 16, 2025

Closes

Same test instructions as #8375

Types should match https://app.unpkg.com/@react-spectrum/s2@0.9.2/files/dist/types.d.ts

Note, I was more thorough on our S2 stories than I was with v3 because it's our documentation and it was easier to align them since they were already fairly close. I'd recommend writing all future stories in this style.
I found a handful of type errors in our stories as a result. I've corrected those. No changes to the source types :)

I think we may still be missing a generic on TreeView? @LFDanLu please have a look at the changes I made in the stories around TreeExampleDynamic.

ran chromatic https://www.chromatic.com/build?appId=5f0dd5ad2b5fc10022a2e320&number=969 only changes are expected because I fixed some types

✅ 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

rspbot commented Jun 16, 2025

Build successful! 🎉

@rspbot
Copy link

rspbot commented Jun 16, 2025

Build successful! 🎉

@LFDanLu
Copy link
Member

LFDanLu commented Jun 17, 2025

@snowystinger I'm not sure what specifically about the TreeExampleDynamic changes is problematic here?

@snowystinger
Copy link
Member Author

@snowystinger I'm not sure what specifically about the TreeExampleDynamic changes is problematic here?

        <Collection items={childItems}>
          {(item: TreeViewItemType) => (

it's not inferring the type, i have to say what it is despite passing it to the TreeView

@rspbot
Copy link

rspbot commented Jun 18, 2025

Build successful! 🎉

@rspbot
Copy link

rspbot commented Jun 18, 2025

Build successful! 🎉

@rspbot
Copy link

rspbot commented Jun 18, 2025

Build successful! 🎉

@rspbot
Copy link

rspbot commented Jun 18, 2025

Build successful! 🎉

LFDanLu
LFDanLu previously approved these changes Jun 20, 2025
reidbarber
reidbarber previously approved these changes Jun 23, 2025
# Conflicts:
#	packages/@react-spectrum/s2/src/Tabs.tsx
@snowystinger snowystinger dismissed stale reviews from reidbarber and LFDanLu via 5f67967 June 23, 2025 20:53
# Conflicts:
#	packages/@react-spectrum/s2/src/Slider.tsx
@rspbot
Copy link

rspbot commented Jun 23, 2025

# Conflicts:
#	packages/@react-spectrum/s2/chromatic/ContextualHelp.stories.tsx
#	packages/@react-spectrum/s2/chromatic/Menu.stories.tsx
@snowystinger snowystinger changed the title chore: TS explicit module S2 chore: S2 storybook standardisation updates, treeview generics fix Jun 26, 2025
@rspbot
Copy link

rspbot commented Jun 26, 2025

@rspbot
Copy link

rspbot commented Jun 26, 2025

@rspbot
Copy link

rspbot commented Jun 26, 2025

Copy link
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

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

Did a spot check of most of the stories, did you happen to run chromatic again on the latest changes just in case?

@@ -112,7 +114,7 @@ function PhotoCard({item, layout}: {item: Item, layout: string}) {
);
}

export const Example = (args: CardViewProps<any>) => {
const ExampleRender = (args: CardViewProps<any>) => {
Copy link
Member

Choose a reason for hiding this comment

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

Noticed that the ActionBar Card story is broken, maybe this needs to be imported instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, fixed. That is awful that the inferred types don't catch that one

@rspbot
Copy link

rspbot commented Jun 27, 2025

@snowystinger
Copy link
Member Author

@LFDanLu Chromatic is green https://www.chromatic.com/build?appId=5f0dd5ad2b5fc10022a2e320&number=979

LFDanLu
LFDanLu previously approved these changes Jun 27, 2025
# Conflicts:
#	packages/@react-spectrum/s2/stories/TableView.stories.tsx
@rspbot
Copy link

rspbot commented Jun 30, 2025

@rspbot
Copy link

rspbot commented Jun 30, 2025

## API Changes

@react-spectrum/s2

/@react-spectrum/s2:TreeView

-TreeView {
+TreeView <T extends {}> {
   UNSAFE_className?: UnsafeClassName
   UNSAFE_style?: CSSProperties
   aria-describedby?: string
   aria-label?: string
   aria-labelledby?: string
   autoFocus?: boolean | FocusStrategy
   children?: ReactNode | (T) => ReactNode
   defaultExpandedKeys?: Iterable<Key>
   defaultSelectedKeys?: 'all' | Iterable<Key>
   dependencies?: ReadonlyArray<any>
   disabledBehavior?: DisabledBehavior = 'all'
   disabledKeys?: Iterable<Key>
   disallowEmptySelection?: boolean
   escapeKeyBehavior?: 'clearSelection' | 'none' = 'clearSelection'
   expandedKeys?: Iterable<Key>
   id?: string
   isDetached?: boolean
   isEmphasized?: boolean
   items?: Iterable<T>
   onAction?: (Key) => void
   onExpandedChange?: (Set<Key>) => any
   onSelectionChange?: (Selection) => void
   renderEmptyState?: (TreeEmptyStateRenderProps) => ReactNode
   selectedKeys?: 'all' | Iterable<Key>
   selectionMode?: SelectionMode
   shouldSelectOnPressUp?: boolean
   slot?: string | null
   styles?: StylesPropWithHeight
 }

/@react-spectrum/s2:TreeViewProps

-TreeViewProps {
+TreeViewProps <T> {
   UNSAFE_className?: UnsafeClassName
   UNSAFE_style?: CSSProperties
   aria-describedby?: string
   aria-label?: string
   aria-labelledby?: string
   autoFocus?: boolean | FocusStrategy
   children?: ReactNode | (T) => ReactNode
   defaultExpandedKeys?: Iterable<Key>
   defaultSelectedKeys?: 'all' | Iterable<Key>
   dependencies?: ReadonlyArray<any>
   disabledBehavior?: DisabledBehavior = 'all'
   disabledKeys?: Iterable<Key>
   disallowEmptySelection?: boolean
   escapeKeyBehavior?: 'clearSelection' | 'none' = 'clearSelection'
   expandedKeys?: Iterable<Key>
   id?: string
   isDetached?: boolean
   isEmphasized?: boolean
   items?: Iterable<T>
   onAction?: (Key) => void
   onExpandedChange?: (Set<Key>) => any
   onSelectionChange?: (Selection) => void
   renderEmptyState?: (TreeEmptyStateRenderProps) => ReactNode
   selectedKeys?: 'all' | Iterable<Key>
   selectionMode?: SelectionMode
   shouldSelectOnPressUp?: boolean
   slot?: string | null
   styles?: StylesPropWithHeight
 }

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

Successfully merging this pull request may close these issues.

5 participants