-
Notifications
You must be signed in to change notification settings - Fork 4
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 sd-input #255
Comments
I would like to adjust the figma comp according to code comp once it is ready. We might see things that need to be adjusted while coding. E.g. the default slot content for the field slot could be "placeholder" but turned off - > field es empty in figma per default |
For the tooltip-icon -> sd-interactive is being used, right? |
@mariohamann @karlbaumhauer @yoezlem So I understand:
I will follow the Dev Notes to the best of my ability. Seems like there are many points left undiscussed and a lot will come up in review. Is this really ready to implement? @coraliefeil good question, I would also like to know. @mariohamann I'm seeing TS errors out of the box that are also included in other existing components like: |
@abudd1094 I will try to answer them as good as I am able to... ;-)
"the needed form files" are basically everything you need to get the input component running. With more complex components, there are usually multiple "extracted" JS, which needs to be imported. So if you copy the from
So the The tests and stories need then to be adopted according to our need from the ticket. Unfortunately I just realized that you (again) got a ticket which is quite old and we haven't been very precise and structured in the beginning with the tickets. I will try to reformulate this asap.
As this is most probably one of the most complex components in terms of a11y, testing and dependencies, I am pretty sure that the review will be pretty big anyways. If you don't feel blocked by any information, I suggest to start and see how far you will come (after I refactored the description) and then just face the bigger review later on.
pls yes. Do so if possible.
@solid-design-system/development can somebody else help out with the linting here? |
@abudd1094 I updated the description but found some (at least for me) unclear points. Tagged Coralie and Mario to help answering these questions. |
Regarding tooltip: I don't see any value in providing a tooltip here. They can slot it without any additional effort. If we implement it, we instead have to create a tooltip slot, integrate tooltip-related stuff like positioning etc. Let's please remove this from the component and let it just be a sample. |
I updated the props table to my understanding: Removed icon-left and icon-right (is just handled via their slot), tooltip (creates unneeded overhead for an already complex component), changed label, help-text and placeholder tonstring instead of boolean. |
Updated parts. Regarding samples: What do we have from design? I would match those from design, at least one with a tooltip. |
In general: I hope that the message-thing will work out. 🤞 |
Only one sample so far ... stepper-values. Can add label-tooltip sample. I’ve opened up a branch to refactor sd-input design comp while coding - listing down all new decisions |
We did not define anything specific for A11y aspects for form elements yet ... especially when sth is invalid. This article has excellent suggestions smashingmagazine.com/2023/02/guide-accessible-form-validation/#invalid-fields @solid-design-system/development FYI |
@karlbaumhauer @mariohamann Probably this was not yet considered. Should I systematically document what I think is relevant as I go (to discuss) or simply remove it on my own? In the case of pill, there is nothing in Figma, it has no visual effect, I would delete it and its corresponding style if left to my own devices... |
@abudd1094 That would be awesome. |
@mariohamann I have a question towards development the behavior of the input field: will the icon be the stop for the text (where it breaks) in which the field's width is fix or will it get "pushed" by the text and the whole field grow with? |
@coraliefeil @yoezlem might be a redundant question: should the successful validation be named success-message or? |
success-text sounds good now that we have an error-text |
... cause it’s all slotted and hint text is just the default slot content |
I’ve updated the issue description according to our agreements from today. Also updated most things in figma and left some comments for @van-nguyen-ht to do. |
@solid-design-system/development @karlbaumhauer @mariohamann @yoezlem uses an "invalid" property in sd-radio, but that does not exist in sl-radio: This is then used to apply the conditional "invalid" styles via tailwind: Should I include the same additional property for sd-input (sl-input also does not use an "invalid" property) and mirror this approach? What bothers me at the moment, is I have a demo form in a temporary story (used for development) in which the invalid styles are immediately applied before the user touches anything (using a simple sd-input with the "required" property). I assume this is because behavior around input "touching" (user must first click input before invalid styles are applied) is then done by the developer using our component when implementing their form? Shoelace has a nice example where they apply the styles conditionally only after submission. But I can't understand how that works from the code there: https://shoelace.style/getting-started/form-controls#styling-invalid-form-controls. My assumption is I am going too deep testing that behavior. I should simply use an "invalid" property on the sd-input component itself (even though Shoelace does not do that) and then it is the implementers job to make sure the invalid property is properly controlled from the form parent... Does this sound right? Can anyone please advise? |
@abudd1094 I think I would go with the "invalid" property simply because that's the approach that was already implemented in another form. We've also added properties that don't exist in shoelace(eg: sd-carousel, if I remember correctly) if it better suits our use case, so adding a brand new attribute is normal I would say. |
I am not 100% sure but it sounds a bit like it. I would say yes. Just build in the invalid prop and leave it to the user to control it. As we dont offer a form with this component but only the input field, I would only implement the logic of the input field => showing that the input is invalid. right @mariohamann ? |
@abudd1094 No, validation has to work out of the box. Like it already does. Radio behaves a bit different, as it needs custom validation because of ShadowDOM and it depends on other elements which are in ShadowDOM either. Text input has to work on its own. |
@mariohamann, the validation will work out of the box, but not the error styles. The error styles depend on the invalid prop. |
https://tailwindcss.com/docs/hover-focus-and-other-states#form-states Did someone try this in the components? (Not radio, as it's special.) |
:valid and :invalid work great... on an input element, not on the wrappers (which contain borders etc.) Many questions still open: @solid-design-system/community Should the input stretch to fill the width of its container by default? Should clearable icon be visible if the user has not entered any text? In Shoelace, it is not, in your designs, it is. What is the desired order of icons (for example when invalid and clearable)?: Have we considered the "password" type? https://shoelace.style/components/input#toggle-password There is nothing regarding passwords in the design. Shall I keep or take out the logic from Shoelace? |
Should the input stretch to fill the width of its container by default? Should clearable icon be visible if the user has not entered any text? In Shoelace, it is not, in your designs, it is. What is the desired order of icons (for example when invalid and clearable)?: Have we considered the "password" type? https://shoelace.style/components/input#toggle-password |
@coraliefeil thanks for your reply. I will implement. We can comment out password for now. |
@solid-design-system/design @solid-design-system/development
Am I expected to keep these in the sd-input for use in future components such as a datepicker? How extensive should the stories be? @mariohamann has only listed the following in the ticket requirements: |
@mariohamann |
It makes sense to have a |
Please let all text related types in it. |
Including number, date etc. @abudd1094 :) |
Added sd-input component and samples. Closes #255
Description
As a user of the Solid Design System, I would like to use an Input component that allows me to enter text. This Input component should have the flexibility to be displayed in various ways, depending on the specified type attribute. Additionally, I should have the option to hide the default label, display a hint if needed, and have mandatory fields clearly marked with an * added to their label.
API
https://www.figma.com/file/xSIeTnyfW2T21Uw5JgdZOg/Input?node-id=0%3A1&mode=dev
Handoff
https://www.figma.com/file/xSIeTnyfW2T21Uw5JgdZOg/Input?node-id=6%3A4&mode=dev
Dev notes
src/_components/input
intosrc/components
.hint
tohelper-text
clearable
, we will rename the boolean in designdisabled
, we will rename it in designComponents detailed requirements
Here is a WIP branch from Design with all adoptions resulting from the implementation.
Props
the following props only relate to design relevant props. All other props that are already provided (e.g. type, pattern, min max etc.) should not be removed.
clearable
boolean
false
disabled
boolean
false
helper-text
string
placeholder
string
error-text
string
label
string
size
lg
/md
/sm
lg
Parts
error-text
Slots
label
- slot for the input field labelhelper-text
- slot for the helper texterror-text
- slot for the error messageleft
- slot to add prefix content to the start of the input fieldright
- slot to add suffix content to the end of the input fieldplaceholder
- slot for the placeholder of the input fieldStories (besides the
default
story)Samples
tooltip
- An input field with a sd-interactive (using info-circle) added to the labelOpen Questions towards design
icon-right
property reallytrue
by default? => no/maybe. @van-nguyen-ht clarifies that and adds a comment here if needed: the field input with the icon-right true by default is the auto-suggest with the search icon.message
property is not available in the playground. Do you know why? => @van-nguyen-ht verifies it. ??DoR (Definition of Ready)
DoD (Definition of Done)
feature
branch.The text was updated successfully, but these errors were encountered: