-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: Add python picker #311
Conversation
We can totally wire up the onOpenChange, onFocusChange, onLoadMore callbacks. Note the onLoadMore we should have a note that it's irrelevant when using a table as a data source, but no technical reasons why we can't wire these up. |
I would just skip onloadmore, not worth it, table source is strictly better. |
Ok, I wasn't sure of what I should list here in terms of if they must be supported now or not but I removed |
@@ -47,3 +47,6 @@ | |||
TransformedData = Any | |||
StringSortDirection = Literal["ASC", "DESC"] | |||
TableSortDirection = Union[StringSortDirection, SortDirection] | |||
# Stringable is a type that is naturally convertible to a string | |||
Stringable = Union[str, int, float, bool] | |||
Key = Any |
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.
We can be a little more specific here. In the React typings, the keys allowed are: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/eaba7f4fb1a43d69a4e06084e530db36da0b63cd/types/react/index.d.ts#L233
Key could just be the same as Stringable and we should be fine (str, number, bool types). @bmingles also has a comment about how boolean is supported as a key on his PR.
We certainly do not want to allow non-serializable objects to be passed in as the key
, so Any
is not really appropriate.
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.
I should clarify that React's Key
type is restricted to number | string
only. Spectrum's Picker is just incorrectly declaring that as the type for selection keys.
For this particular case, we should be able to use Stringable
so that we get support for bool
included, but there are likely other cases where the Key
type would actually be correct, so the type may still be useful. In such case it should probably be defined as Key = Union[str, int, float]
Fixes #294
Creates python side of picker component along with section and items.
Props that are not currently supported:
items
- we don't support passing in a callback as a child and we support passing in lists inchildren
, so this will not be supportedvalidate
- is a callback we don't supporterrorMessage
- specifically a callbackonLoadMore
- irrelevant due to supporting a table source