-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[useInput] Add return value interface #36036
Conversation
|
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.
The types look correct 👍 Let's wait on Sam's response for the description of the props.
|
||
export interface UseInputReturnValue { | ||
/** | ||
* If `true`, the component is disabled. |
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 use present here, but future int he error
prop description. Also, I wonder if for the hooks we shouldn't use a phrase like:
"If true
it indicates that the component it ...."
@samuelsycamore for thoughts on this.
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.
Hmm, I think in a situation like this, the future tense is preferable. "If X, then Y will be Z." It helps clarify cause and effect this way—Y becomes Z because of X. In the current version, the cause and effect are not as clear.
*/ | ||
required: boolean; | ||
/** | ||
* `value` of input element. |
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.
* `value` of input element. | |
* The `value` of input element. |
@mnajdova this is somewhat tangential, but as I'm reviewing these descriptions, I'm realizing that we don't have clear guidelines for styling and formatting these. In the Component docs we try to be precise about the Material UI Input component vs. the concept of an input vs. the |
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.
Thanks @Shorifpatwary !
Thanks, @mnajdova and @samuelsycamore. |
"description": "Resolver for the input slot's props." | ||
}, | ||
"required": true | ||
}, | ||
"getRootProps": { | ||
"type": { | ||
"name": "<TOther extends Record<string, any> = {}>(externalProps?: TOther) => UseInputRootSlotProps<TOther>", | ||
"description": "Resolver for the root slot's props." |
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.
"description": "Resolver for the input slot's props." | |
}, | |
"required": true | |
}, | |
"getRootProps": { | |
"type": { | |
"name": "<TOther extends Record<string, any> = {}>(externalProps?: TOther) => UseInputRootSlotProps<TOther>", | |
"description": "Resolver for the root slot's props." | |
"description": "Resolver for the `input` slot's props." | |
}, | |
"required": true | |
}, | |
"getRootProps": { | |
"type": { | |
"name": "<TOther extends Record<string, any> = {}>(externalProps?: TOther) => UseInputRootSlotProps<TOther>", | |
"description": "Resolver for the `root` slot's props." |
@samuelsycamore one last question :) Should we consider the slots' names as code elements too?
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.
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 would say it makes sense to use back ticks when referring specifically to the class name: so either "the root slot" or MuiSwitch-root
.
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.
Alright, in this case I am merging the PR, no need for additional changes.
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.
@Shorifpatwary please revert the last commit, as we decided not to go with #36036 (comment) Next time, I would recommend waiting for a resolution before committing :)
This reverts commit ce7ab96.
Thanks for the work @Shorifpatwary! It's a great first pull request on MUI 👌 |
UseInput return value interface
I tried to add a return interface to UseInput MUI Base Hooks (Those hooks are defined in this issue #35933).
added return value type
I have followed (at least) the PR section of the contributing guide.