Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
|
||
| @layer wp-ui-compositions { | ||
| .wrapper { | ||
| --wp-ui-input-padding-block: 9.9px; |
There was a problem hiding this comment.
I'm still thinking unit-less line height is more versatile, and it would allow us to have just a few values that can be combined with all font sizes if / when necessary.
If we want to use line height to establish an element's height, I'd be almost more inclined to use a size/height token for the line-height CSS property to really show what's the intent.
There was a problem hiding this comment.
I'm adding more tests than the other primitives here, since we're doing a good amount of integration in the implementation.
There was a problem hiding this comment.
Should we test disabled / rows attributes, or do we trust we don't have to test for those?
packages/ui/CHANGELOG.md
Outdated
|
|
||
| ### New Features | ||
|
|
||
| - Add `Select` primitive ([#74661](https://github.com/WordPress/gutenberg/pull/74661)). |
There was a problem hiding this comment.
Fixing the misplaced changelog for Select.
|
Size Change: 0 B Total Size: 2.99 MB ℹ️ View Unchanged
|
| style={ style } | ||
| render={ wrappedRender( | ||
| render || ( ( props ) => <textarea { ...props } /> ), | ||
| { className: styles.textarea, ref, rows, ...restProps } |
There was a problem hiding this comment.
Do these need to be applied here vs. the top-level component? Particularly className, ref, and restProps. Guessing rows could be a problem with the base component being typed for HTMLInputElement. Is there any way we can make it generic? Just trying to see if there's an option to avoid the wrapping logic.
There was a problem hiding this comment.
Basically yes. It's either this or we make the props for Input generic, which isn't inherently simpler, and also just less type safe. ref, rows, and restProps all need to be of a Textarea type. This is probably the only place where we'll be doing something like this, if that makes it more palatable 😅
className is not about types, but just that the classes on the render element go to a different element (<textarea> itself) from the top-level class (a wrapper div).
| }; | ||
| }; | ||
|
|
||
| export const Textarea = forwardRef< HTMLTextAreaElement, TextareaProps >( |
There was a problem hiding this comment.
Should we add a JSDoc comment describing the component?
There was a problem hiding this comment.
I think I'll go in and add them for all the form primitives once the *Control versions are ready, so I can point to them in the description.
|
|
||
| @layer wp-ui-compositions { | ||
| .wrapper { | ||
| --wp-ui-input-padding-block: 9.9px; |
There was a problem hiding this comment.
I'm still thinking unit-less line height is more versatile, and it would allow us to have just a few values that can be combined with all font sizes if / when necessary.
If we want to use line height to establish an element's height, I'd be almost more inclined to use a size/height token for the line-height CSS property to really show what's the intent.
There was a problem hiding this comment.
Should we test disabled / rows attributes, or do we trust we don't have to test for those?
There was a problem hiding this comment.
What's the deal with controlled components? Should we add an example?
There was a problem hiding this comment.
I don't know 🤔 It would get tedious to add controlled code samples for all components. Maybe we can have the code snippet in the JSDoc descriptions to all be controlled examples? Seems like that's what we do in @wordpress/components.
There was a problem hiding this comment.
Yeah. Or otherwise have a MDX document at the top of the folder to explain controlled vs uncontrolled — should be feasible since all components in the package should follow the same value/defaultValue/onValueChange convention?
There was a problem hiding this comment.
all components in the package should follow the same
Aside from a minor deviation for checkboxes and switches (checked instead of value). I guess a JSDoc code snippet would be most straightforward, when accounting for this kind of difference.
| if ( ! render ) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
This early return doesn't seem necessary, given how wrappedRender always receives a value for the render argument?
# Conflicts: # packages/ui/CHANGELOG.md
* UI: Add Textarea primitive * Add changelog * Add tests for disabled and rows * Remove unnecessary early return Co-authored-by: mirka <[email protected]> Co-authored-by: aduth <[email protected]> Co-authored-by: ciampo <[email protected]>
What?
Part of #74178
Add
Textareaprimitive component to@wordpress/ui.Why?
This is a low-level primitive that will build up to an
TextareaControlequivalent.How?
It's a
Inputcomponent rendered as atextareaelement. This allows us to reuse the styles and API, which are largely the same. (Base UI currently has no independent Textarea component.)Testing Instructions
See stories in Storybook.
Screenshots or screencast