-
Notifications
You must be signed in to change notification settings - Fork 15
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 gcds-date-input component #607
Conversation
packages/web/src/components/gcds-date-input/gcds-date-input.tsx
Outdated
Show resolved
Hide resolved
<Host name={name} onBlur={() => this.onBlur()}> | ||
{this.validateRequiredProps() && ( | ||
<gcds-fieldset | ||
legend={legend} |
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 know we had previously agreed to call this prop legend
because it is a legend, but after all the discussions we had about fieldsets in the last week, I'm wondering if it would make more sense to name it label
to keep it consistent (less confusing?) with other form fields for our users. What do you think @daine @ethanWallace ?
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'm now wondering if it's best to wait on the final decision for the change to the fieldset component for this. But yes I'm leaning towards the fact that it's probably appropriate to call it a label
because that's what it is in this case. From what the designers are also proposing, this label also looks different and will have the medium
style as opposed to bold
. I will tag you in the slack thread where they mentioned it
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.
Just flagging (I don't disagree): If we wait for the final decision on the fieldset component, we will need to hold releasing this component until then. Since the guidance still seems to be requiring some time, it wouldn't be the worst but Abdul did say that one team was waiting on the release of this component.
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 could see using label
since that is what it appears as and that's what we use on other form components but I still think legend
is more appropriate since it is just a legend element styled like a label and doesn't have any extra functionality to mimic label functionality.
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.
Sounds good, it is a bit of a weird one so I think either decision is ok!
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.
Left some comments with suggestions. Thank you for putting so much work into this component!
packages/web/src/components/gcds-date-input/gcds-date-input.tsx
Outdated
Show resolved
Hide resolved
packages/web/src/components/gcds-date-input/stories/overview.mdx
Outdated
Show resolved
Hide resolved
packages/web/src/components/gcds-date-input/stories/overview.mdx
Outdated
Show resolved
Hide resolved
packages/web/src/components/gcds-date-input/gcds-date-input.tsx
Outdated
Show resolved
Hide resolved
packages/web/src/components/gcds-date-input/gcds-date-input.tsx
Outdated
Show resolved
Hide resolved
Just realized I might have to rework the isValidDate function (again) since the date input will accept values of either FIXED |
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.
Ship it!
<Host name={name} onBlur={() => this.onBlur()}> | ||
{this.validateRequiredProps() && ( | ||
<gcds-fieldset | ||
legend={legend} |
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.
Sounds good, it is a bit of a weird one so I think either decision is ok!
Unit tests for new component and functions still need to be added
Requires tokens from cds-snc/gcds-tokens#301
Summary | Résumé
The date input element is a component that comes pre-configured with form elements to gather date information from users.
Required fields
The following are required fields that are needed to render the
gcds-date-input
.full
orcompact
Value format
The
gcds-date-input
inputs and outputs the dates in the following formatsYYYY-MM-DD
orYYYY-MM
depending on the chosenformat
. If thevalue
passed togcds-date-input
is not in the given format, the date input will not be pre-filled on load.Changes
Development of the date input required changes to some other components and the utility functions already used within the GC Design System.
gcds-fieldset
data-date
attribute to handle validation differently.gcds-input
part="input"
to internal HTML input to allow styling by parent components.max-width
calculation to display properlyWatch
functions to trackaria-invalid
andaria-description
attributes to allow inheriting of information around validation from parent component.gcds-select
part="select"
to internal HTML select to allow styling by parent components.Watch
functions to trackaria-invalid
andaria-description
attributes to allow inheriting of information around validation from parent component.inheritAttributes
function