Skip to content
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: adds floating label #955

Merged
merged 140 commits into from
Sep 29, 2023

Conversation

okelloMarvinSophany
Copy link
Contributor

Summarize the changes made and the motivation behind them.
I have created a new component called Floating Label as directed by the issue. While it is still an input, it was better to created the new component so as not to mix and possibly redo or undo the work that someone else might have undertaken.

Reference related issues using # followed by the issue number.
The issue number is: #189

@vercel
Copy link

vercel bot commented Sep 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
flowbite-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 29, 2023 5:55pm

@rluders rluders changed the title Feat/floating label feat: adds floating label Sep 12, 2023
@codecov
Copy link

codecov bot commented Sep 12, 2023

Codecov Report

Attention: 487 lines in your changes are missing coverage. Please review.

Comparison is base (7461173) 99.54% compared to head (5122d07) 93.59%.
Report is 96 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #955      +/-   ##
==========================================
- Coverage   99.54%   93.59%   -5.96%     
==========================================
  Files         163      184      +21     
  Lines        6621     8088    +1467     
  Branches      401      446      +45     
==========================================
+ Hits         6591     7570     +979     
- Misses         30      518     +488     
Files Coverage Δ
src/components/Badge/Badge.tsx 100.00% <100.00%> (ø)
src/components/Banner/index.ts 100.00% <100.00%> (ø)
src/components/Breadcrumb/theme.ts 100.00% <100.00%> (ø)
src/components/Button/Button.tsx 100.00% <100.00%> (ø)
src/components/Button/ButtonBase.tsx 100.00% <100.00%> (ø)
src/components/Button/theme.ts 100.00% <100.00%> (ø)
src/components/Card/Card.tsx 100.00% <100.00%> (ø)
src/components/Carousel/Carousel.tsx 99.10% <100.00%> (+0.13%) ⬆️
src/components/DarkThemeToggle/DarkThemeToggle.tsx 100.00% <100.00%> (ø)
src/components/Datepicker/index.ts 100.00% <100.00%> (ø)
... and 49 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zoltanszogyenyi
Copy link
Member

zoltanszogyenyi commented Sep 12, 2023

Hey @okelloMarvinSophany,

Thank you for your contribution!

For the docs page, can you please create a new category called "Forms" in the Sidebar and make the URL like this:

https://www.flowbite-react.com/docs/forms/floating-label

It should be categorized the same way the one from the main library is:

https://flowbite.com/docs/forms/floating-label/

Should be something like this in the sidebar:

Screenshot 2023-09-12 at 17 24 37

Thank you for your contribution!

Cheers,
Zoltan

@rluders
Copy link
Collaborator

rluders commented Sep 12, 2023

@okelloMarvinSophany thanks for the PR, for now, I just have two notes. You have 2 commits in your PR that are merge commits. I would recommend removing those merges and using rebase instead, otherwise, it can cause some history issues.

@okelloMarvinSophany
Copy link
Contributor Author

@rluders I have completed the rebase

@nigellima
Copy link
Collaborator

Hi @okelloMarvinSophany

Checking the deployed preview version I noticed some inconsistencies with the core library Flowbite

The label always have a solid bg on all cases, which is noticible in the filled variant:
image

On the other hand the core library does not
image

Also in the filled variant the label should not go entirely over the border of the input. It remains inside it when focused
Core library:
image

Your PR:
image

One last thing is that in the validation examples, only the label has the color accordingly to the validation state. This is probably due to the issue I mentioned here: https://github.com/themesberg/flowbite-react/pull/955/files/7f06ff7ae2494b9ab3ff93633aab7433135aad6c#diff-cff7813980f3b1bce4f7bf26b6fe9fef8f7272e24b44ac3c59560ba5ed423287

image

@rluders
Copy link
Collaborator

rluders commented Sep 21, 2023

@nigellima Can we merge this one?

@nigellima
Copy link
Collaborator

@nigellima Can we merge this one?

Hi. I guess there are some unresolved comments yet... could you take a look at them @okelloMarvinSophany ?

@okelloMarvinSophany
Copy link
Contributor Author

okelloMarvinSophany commented Sep 21, 2023

@nigellima I resolved the comments, If you preview, you'll see that I worked on the issues you raised

@nigellima
Copy link
Collaborator

@nigellima I resolved the comments, If you preview, you'll see that I worked on the issues you raised

Yes. Visually it's great now... but there are some code comments I made regarding the use of the theme object (currently it's just an empty file) and the naming of the props of the main component

@okelloMarvinSophany
Copy link
Contributor Author

@nigellima I resolved the comments, If you preview, you'll see that I worked on the issues you raised

Yes. Visually it's great now... but there are some code comments I made regarding the use of the theme object (currently it's just an empty file) and the naming of the props of the main component

I do not see those comments

src/components/FloatingLabel/FloatingLabel.tsx Outdated Show resolved Hide resolved
src/components/FloatingLabel/FloatingLabel.tsx Outdated Show resolved Hide resolved
src/components/FloatingLabel/FloatingLabel.tsx Outdated Show resolved Hide resolved
src/components/FloatingLabel/FloatingLabel.tsx Outdated Show resolved Hide resolved
src/components/FloatingLabel/FloatingLabel.tsx Outdated Show resolved Hide resolved
src/components/FloatingLabel/FloatingLabel.tsx Outdated Show resolved Hide resolved
src/components/FloatingLabel/FloatingLabel.tsx Outdated Show resolved Hide resolved
@nigellima
Copy link
Collaborator

@nigellima I resolved the comments, If you preview, you'll see that I worked on the issues you raised

Yes. Visually it's great now... but there are some code comments I made regarding the use of the theme object (currently it's just an empty file) and the naming of the props of the main component

I do not see those comments

Sorry. I had made the comments but forgot to Submit the review... 🥲

@okelloMarvinSophany
Copy link
Contributor Author

Made a mistake :(

It happens... No worries.

It is complete now. @nigellima can check now

@nigellima
Copy link
Collaborator

Made a mistake :(

It happens... No worries.

It is complete now. @nigellima can check now

Hi.
Weird that now there is no animation when checking the Preview app:

floating-label-animation

@rluders
Copy link
Collaborator

rluders commented Sep 29, 2023

BTW, that "blinking" bug also happens at the standard flowbite library.
https://flowbite.com/docs/forms/floating-label/

@okelloMarvinSophany
Copy link
Contributor Author

BTW, that "blinking" bug also happens at the standard flowbite library. https://flowbite.com/docs/forms/floating-label/

Yeah,

@okelloMarvinSophany
Copy link
Contributor Author

The Animation is tied to the class duration-300, when I remove it, the blinking stops, but we loose the animation. So I have returned the anomation, but the blinking is back

@okelloMarvinSophany
Copy link
Contributor Author

So whats the way forward ? @rluders , @nigellima

@rluders
Copy link
Collaborator

rluders commented Sep 29, 2023

Easy fix...

Replace the transform with transition-transform

@nigellima
Copy link
Collaborator

Easy fix...

Replace the transform with transition-transform

Yes.

You can also use transition withou changing the duration time... the "blinking" issue is due to a difference of animation duration between classes. The fix is basically making sure every animation has the same duration

@okelloMarvinSophany
Copy link
Contributor Author

Easy fix...
Replace the transform with transition-transform

Yes.

You can also use transition withou changing the duration time... the "blinking" issue is due to a difference of animation duration between classes. The fix is basically making sure every animation has the same duration

Thw first option has worked, am gonna push, and thanks for the insights

Copy link
Collaborator

@nigellima nigellima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent 👏

@rluders
Copy link
Collaborator

rluders commented Sep 29, 2023

Now just a prettier:fix and I guess that we are good to go! :)

Copy link
Collaborator

@rluders rluders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@okelloMarvinSophany thanks for all the good work. @nigellima thanks for all the reviews here.

@rluders rluders merged commit 3fc7b88 into themesberg:main Sep 29, 2023
3 of 5 checks passed
@MateoWartelle
Copy link
Contributor

Why comment out kbd?

@rluders
Copy link
Collaborator

rluders commented Sep 29, 2023

Why comment out kbd?

oh-ho... I didn't noticed that

@rluders
Copy link
Collaborator

rluders commented Sep 29, 2023

Let me put a hotfix

@MateoWartelle
Copy link
Contributor

image

I think this image is missing also.

@rluders
Copy link
Collaborator

rluders commented Sep 29, 2023

#1021

@MateoWartelle
Copy link
Contributor

#1022 looks like a regression also

@okelloMarvinSophany
Copy link
Contributor Author

#1022 looks like a regression also

For this Issue, do I need to address it directly from here or in the issue created itself?

maman pushed a commit to transkripid/flowbite-react that referenced this pull request Oct 7, 2023
* created component Floating Label and added its story

* feat: Created floating label component, with the possibility of styles filled, outlined and standard as well as for each case, success and failure

* feat: added more stories, for different cases, implementation for disabled and sizes

* feat: added documentation for the floating label

* feat: wrote tests for the the Floating label component

* formatting code

* formatted the code with prettier

* Added Floating Label under Forms in the docs

* fix: updated code to fix the validation styles

* fix: small sizing of floating label is fixed

* feat: added more stories, for different cases, implementation for disabled and sizes

* feat: added documentation for the floating label

* formatted the code with prettier

* Added Floating Label under Forms in the docs

* fix: updated code to fix the validation styles

* fix: updated naming of props as reccomended

* feat: added more stories, for different cases, implementation for disabled and sizes

* feat: added documentation for the floating label

* feat: wrote tests for the the Floating label component

* formatting code

* formatted the code with prettier

* Added Floating Label under Forms in the docs

* fix: updated code to fix the validation styles

* fix: small sizing of floating label is fixed

* feat: added more stories, for different cases, implementation for disabled and sizes

* feat: added documentation for the floating label

* formatted the code with prettier

* Added Floating Label under Forms in the docs

* fix: updated code to fix the validation styles

* fix: adjusted tests

* fix: unique ids for helper text

* fix: removed  template strings

* Revert "fix: removed  template strings"

This reverts commit 6e80a67.

* fix: added theme and twmerge to the codebase

* created component Floating Label and added its story

* feat: added documentation for the floating label

* feat: wrote tests for the the Floating label component

* formatting code

* formatted the code with prettier

* Added Floating Label under Forms in the docs

* fix: updated code to fix the validation styles

* feat: added more stories, for different cases, implementation for disabled and sizes

* feat: added documentation for the floating label

* formatted the code with prettier

* Added Floating Label under Forms in the docs

* fix: updated code to fix the validation styles

* fix: updated naming of props as reccomended

* feat: added more stories, for different cases, implementation for disabled and sizes

* feat: added documentation for the floating label

* feat: wrote tests for the the Floating label component

* formatting code

* formatted the code with prettier

* Added Floating Label under Forms in the docs

* fix: updated code to fix the validation styles

* fix: small sizing of floating label is fixed

* feat: added more stories, for different cases, implementation for disabled and sizes

* feat: added documentation for the floating label

* formatted the code with prettier

* Added Floating Label under Forms in the docs

* fix: updated code to fix the validation styles

* fix: adjusted tests

* fix: this commit is because I forgot to force push after rebasing :(

* fix: structured the theme.ts file to avoid if else in the component

* fix: removing the lag in label background when the theme changes

* fix: resolved missing label for the standard floating label (z-0) was missing

* fix: fixing after rebase

* created component Floating Label and added its story

* feat: Created floating label component, with the possibility of styles filled, outlined and standard as well as for each case, success and failure

* feat: added more stories, for different cases, implementation for disabled and sizes

* feat: added documentation for the floating label

* feat: wrote tests for the the Floating label component

* formatting code

* formatted the code with prettier

* Added Floating Label under Forms in the docs

* fix: updated code to fix the validation styles

* fix: small sizing of floating label is fixed

* feat: added more stories, for different cases, implementation for disabled and sizes

* feat: added documentation for the floating label

* formatted the code with prettier

* Added Floating Label under Forms in the docs

* fix: updated code to fix the validation styles

* fix: updated naming of props as reccomended

* feat: added more stories, for different cases, implementation for disabled and sizes

* feat: added documentation for the floating label

* feat: wrote tests for the the Floating label component

* formatting code

* formatted the code with prettier

* Added Floating Label under Forms in the docs

* fix: updated code to fix the validation styles

* fix: small sizing of floating label is fixed

* feat: added more stories, for different cases, implementation for disabled and sizes

* feat: added documentation for the floating label

* formatted the code with prettier

* Added Floating Label under Forms in the docs

* fix: updated code to fix the validation styles

* fix: adjusted tests

* fix: unique ids for helper text

* fix: removed  template strings

* Revert "fix: removed  template strings"

This reverts commit 6e80a67.

* fix: added theme and twmerge to the codebase

* created component Floating Label and added its story

* feat: Created floating label component, with the possibility of styles filled, outlined and standard as well as for each case, success and failure

* feat: added more stories, for different cases, implementation for disabled and sizes

* feat: added documentation for the floating label

* feat: wrote tests for the the Floating label component

* formatting code

* formatted the code with prettier

* Added Floating Label under Forms in the docs

* fix: updated code to fix the validation styles

* fix: small sizing of floating label is fixed

* feat: added more stories, for different cases, implementation for disabled and sizes

* feat: added documentation for the floating label

* formatted the code with prettier

* Added Floating Label under Forms in the docs

* fix: updated code to fix the validation styles

* fix: updated naming of props as reccomended

* created component Floating Label and added its story

* feat: Created floating label component, with the possibility of styles filled, outlined and standard as well as for each case, success and failure

* feat: added more stories, for different cases, implementation for disabled and sizes

* feat: added documentation for the floating label

* feat: wrote tests for the the Floating label component

* formatting code

* formatted the code with prettier

* Added Floating Label under Forms in the docs

* fix: updated code to fix the validation styles

* fix: small sizing of floating label is fixed

* feat: added more stories, for different cases, implementation for disabled and sizes

* feat: added documentation for the floating label

* formatted the code with prettier

* Added Floating Label under Forms in the docs

* fix: updated code to fix the validation styles

* fix: adjusted tests

* fix: this commit is because I forgot to force push after rebasing :(

* fix: structured the theme.ts file to avoid if else in the component

* fix: removing the lag in label background when the theme changes

* fix: resolved missing label for the standard floating label (z-0) was missing

* fixes after rebase

* fix: returned the animation for the floating label

* fix: removed blinking on theme change

* fix: prettier  fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[components] Floating Label
5 participants