Open adriantrunzo opened 5 months ago
The main reason that useControlledState
and similar utilities aren't exported from the monopackage is because they aren't documented, and aren't necessarily intended to be public APIs. You're right that we do prefer people to use the monopackages to avoid issues with managing package versions. I think if we do want to start exporting these from the monopackage, we'll need to solidify the APIs and document them.
Provide a general summary of the feature here
The
useControlledState
hook from@react-stately/utils
is very helpful in creating reusable components, especially when building on top of React Aria Components. You can currently accessuseControlledState
usingimport { useControlledState } from '@react-stately/utils';
, but that import feels a bit like using undocumented internals. I am not sure what the intended separation is between the namespaced@react-*
packages and the non-namespaced packages, but it would be convenient if they exposed the same exports.π€ Expected Behavior?
One of the following imports works:
π― Current Behavior
useControlledState
is only available usingimport { useControlledState } from '@react-stately/utils';
.π Possible Solution
Augment the
react-stately
orreact-aria-components
main index file (or both) to exportuseControlledState
.useControlledState
is actually one example of a few hooks that I've found helpful, but I am not sure if there is a reason it's not exported from a non-namespaced package.useDescription
from@react-aria/utils
is another hook that I have found helpful.I don't know if a goal of
react-aria-components
is to re-export everything available inreact-aria
andreact-stately
. For managing package versions in apps, it seems beneficial to only have to install one "monopackage", rather than worry about if the version of@react-stately/utils
in package.json is different from the version used inreact-aria-components
, etc.π¦ Context
One of my use cases for
useControlledState
is creating a wrapper around DateRangePicker that uses values that can be tagged as a preset date range. For example, something like:useControlledState
allows me to makePresetRangePicker
either controlled or uncontrolled for flexibility and more closely mimic the behavior of DateRangePicker.π» Examples
No response
π§’ Your Company/Team
No response
π· Tracking Issue
No response