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.58k stars 1.09k forks source link

Export all of the things #6502

Closed ArrayKnight closed 3 months ago

ArrayKnight commented 3 months ago

Provide a general summary of the feature here

There are a number of internal contexts and hooks that would be great to have available to support the development of more bespoke implementations.

๐Ÿค” Expected Behavior?

I'd like to see all of react-aria-components/Collection and react-stately/utils exported

๐Ÿ˜ฏ Current Behavior

Currently, all of react-aria-components/Collection and react-stately/utils are unavailable when importing from react-aria-components and react-stately

๐Ÿ’ Possible Solution

Update the root barrel file in react-aria, react-aria-components and react-stately to export all contextually applicable / available types, variables, methods, and components

Establish a governance guideline to continue the practice for all future features

๐Ÿ”ฆ Context

I'm currently working with the ListBox component, trying to establish a generic that supports all of the implementation flexibility of the ListBox but has access to the internal state of the component to provide additional functionality. But I'm not able to access useControlledState or any of the useCollection[...] hooks or the Collection[...] contexts

As-is, I'm unable to do this because you can't access the internal state of the ListBox component, and you can't fulling reimplement the ListBox due to private internals

๐Ÿ’ป Examples

No response

๐Ÿงข Your Company/Team

No response

๐Ÿ•ท Tracking Issue

No response

snowystinger commented 3 months ago

Closing as dupe of https://github.com/adobe/react-spectrum/issues/5954

ArrayKnight commented 3 months ago

While our context and examples are quite similar, I was hoping to expand the consideration of what's being exported to the entire API, not just the few items outlined in the example.

snowystinger commented 3 months ago

We'll be evaluating all of them when we are ready to do the release exposing collection building. I think it'd be better to keep the discussion to one place, feel free to add your use case to the other issue. Thanks for sharing!

ArrayKnight commented 3 months ago

Update the root barrel file in react-aria, react-aria-components and react-stately to export all contextually applicable / available types, variables, methods, and components

Establish a governance guideline to continue the practice for all future features

This is intended to be farther reaching than just Collections or any specific module. It's about establishing a process of making sure that any piece of code that is implemented inside of a public component or hook is also provided publicly. This will allow for advanced usage, customization, extension and reimplementation of all functionality. This will provide library authors full control and flexibility

Ignore the fact that I ever mentioned Collections

devongovett commented 3 months ago

If something is not exported it's usually because we aren't satisfied with the API yet, or it's considered an implementation detail that could change at any time. If we exported everything, we'd be locked into that API/implementation and could never change it. We need to take a more careful approach here to avoid future breaking changes and maintenance problems. Obviously we want to enable extensibility but it needs to be done in a responsible way.

devongovett commented 3 months ago

Would be useful to understand what you're trying to achieve so we can consider what we would need to do to enable it. Let's start with the problem rather than the solution. Feel free to open an issue or discussion about your use cases that you cannot achieve today with the exported APIs.