adobe / react-spectrum

A collection of libraries and tools that help you build adaptive, accessible, and robust user experiences.
https://react-spectrum.adobe.com
Apache License 2.0
12.72k stars 1.09k forks source link

Move RAC collections implementation into new package #6640

Closed devongovett closed 2 months ago

devongovett commented 3 months ago

This moves the collection implementation used by React Aria Components into a new package (@react-aria/collections), enabling it to be used in other React Aria hook-based libraries like NextUI. This includes:

Code has been split into multiple files for readability as well.

What's not moving:

@react-stately/collections (the old collection implementation) will remain unchanged and continue to work. In the future, we may deprecate it once we update all of the documentation examples. Short term, @react-aria/collections will be in a pre-release state, enabling libraries to test it out and provide feedback.

@react-aria/collections is in React Aria rather than React Stately because it relies on react-dom for portals. React Native users will either need to continue using @react-stately/collections or find a new way to implement collections that's specific to React Native.

rspbot commented 3 months ago

Build successful! πŸŽ‰

rspbot commented 3 months ago

Build successful! πŸŽ‰

rspbot commented 2 months ago

Build successful! πŸŽ‰

rspbot commented 2 months ago
## API Changes unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any', access: 'private' } unknown top level export { type: 'any', access: 'private' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'identifier', name: 'Column' } unknown top level export { type: 'identifier', name: 'Column' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown type { type: 'link' } unknown type { type: 'link' } unknown type { type: 'link' } unknown type { type: 'link' } unknown type { type: 'link' } unknown type { type: 'link' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } unknown top level export { type: 'any' } ### @react-aria/collections #### CollectionBuilder ```diff - +CollectionBuilder> { + children: (BaseCollection<{}>) => ReactNode + content: ReactNode + createCollection?: () => BaseCollection<{}> +} ``` #### Collection ```diff +Collection { +} ``` #### createLeafComponent ```diff - +createLeafComponent { + type: string + render: (P, ForwardedRef, any) => ReactNode + returnVal: undefined +} ``` #### createBranchComponent ```diff - +createBranchComponent { + type: string + render: (P, ForwardedRef, Node) => ReactNode + useChildren: (P) => ReactNode + returnVal: undefined +} ``` #### createHideableComponent ```diff - +createHideableComponent

{ + fn: (P, React.Ref) => ReactNode | null + returnVal: undefined +} ``` #### useIsHidden ```diff - +useIsHidden { + returnVal: undefined +} ``` #### useCachedChildren changed by: - CachedChildrenOptions ```diff - +useCachedChildren { + props: CachedChildrenOptions + returnVal: undefined +} ``` #### BaseCollection changed by: - NodeValue - NodeValue ```diff - +BaseCollection { + addNode: (NodeValue) => void + at: () => Node + clone: () => this + commit: (Key | null, Key | null, any) => void + getChildren: (Key) => Iterable> + getFirstKey: () => void + getItem: (Key) => Node | null + getKeyAfter: (Key) => void + getKeyBefore: (Key) => void + getKeys: () => void + getLastKey: () => void + removeNode: (Key) => void + size: any + undefined: () => void +} ``` #### NodeValue changed by: - NodeValue ```diff - +NodeValue { + aria-label?: string + childNodes: Iterable> + clone: () => NodeValue + constructor: (string, Key) => void + firstChildKey: Key | null + hasChildNodes: boolean + index: number + key: Key + lastChildKey: Key | null + level: number + nextKey: Key | null + parentKey: Key | null + prevKey: Key | null + props: any + render?: (Node) => ReactElement + rendered: ReactNode + textValue: string + type: string + value: T | null +} ``` it changed: - BaseCollection - NodeValue #### CollectionBuilderProps ```diff - +CollectionBuilderProps> { + children: (BaseCollection<{}>) => ReactNode + content: ReactNode + createCollection?: () => BaseCollection<{}> +} ``` #### CollectionProps ```diff +CollectionProps { +} ``` #### CachedChildrenOptions ```diff - +CachedChildrenOptions { + addIdAndValue?: boolean + children?: ReactNode | (T) => ReactNode + dependencies?: Array + idScope?: Key + items?: Iterable +} ``` it changed: - useCachedChildren -----------------------------------