-
Notifications
You must be signed in to change notification settings - Fork 123
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
feature/select #70
feature/select #70
Conversation
Wanted to open a draft PR to get some initial feedback on what I have so far, so yea let me know what you think
|
Awesome! This is a great start! How deep do you want the feedback to go? Just overall if this is going into the right direction or is there any more specific things you'd like me to address? Thanks for working on this! I am super excited for this! |
I think overall/high-level for now. Im still tidying up everything. Can definitely do a more in depth one once I think this is closer to being done. I think one thing I also wanted an opinion on is do you think we should have stories for just brain usage and one with only hlm?
2.to make sure hlm is exposing everything it should from underlying brain and just using brain correctly overall? What do you think? |
So one thing we decided to do going forward is to allow him to depend on brain directly. This means him can use brain components in their own template or via host directives, etc. However, brain should never depend on helm and we should expose enough information so you can build your own UI lib just with brain components. Radix UI = Brain We are implementing both at the same time so we need to be a little more careful, but overall brain should do all the work and him only does some minor additions, adds styles, and improves API surface for those using them together! Overall, I really like how this is coming along though! I think you are absolutely on the right track! |
@thatsamsonkid let me know if I can do anything else to help or if you got everything you need for this! This is going to be a great addition 👍 |
Definitely!, I think I was getting hung up on some things for it and just needed a small break from it 😅. Let me verify I pushed everything I have so far and maybe I can get help with some specific things |
2a65033
to
0d93c14
Compare
Ok I updated this branch with latest and wanted to give an overview of what is remaining for this So remaining items/issues:
|
Sweet, I'll try to check this out this week! @elite-benni feel free to also take a look at this if you have time :) |
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.
Looks pretty good already. Left some comments.
@Component({ | ||
selector: 'brn-select-content, hlm-select-content:not(noHlm)', | ||
standalone: true, | ||
imports: [BrnSelectScrollUpDirective, BrnSelectScrollDownDirective, HlmIconComponent], |
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.
A Dependency to helm should be avoided.
I am not sure how to achieve this when we want to use the same component as helm selector.
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.
Agreed! Maybe we can work with content projection here?
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.
That is the same problem, that I had with the switch.
When using content projection, the api is not as nice as it would be now. :/
It is already possible to use content projection, hlm Icon is used if no brnSelectScrollUp or brnSelectScrollDown is provided in the content.
So technically this is not a "tight" dependency, it would also work without Hlm.
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.
Hmmm I had originally imagined that there would be a default icon and you would only need to provide the up/down icon arrows through projection if you wished to change the default to some other icon or icon family. I see two potential options:
-
A brnIcon of some sort (would this just be ngIcon lol) - probably would not be different from current hlm really and would of course make ng-icon a dep for this component so probably not the best idea but an idea none the less.
-
We would have to require the user to project both and up and down icon and maybe throw some warning if they don't (provide both that is) and maybe just keep a placeholder text until hlmIcon contents are provided and or simply just keep this as an optional thing. If you don't provide content we can just leave this "hover scrolling areas" out.
-
Or just throwing this out another idea we could keep a very simple svg inlined for the the up and down arrows as well
Let me know what you guys think or open to any other suggestions also
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.
For me 2. sounds like the best of these options.
The other option would be to make an helm component that uses the correct content, but this has the disadvantage of adding a new layer again. :/
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.
Yea I think lets just keep it as optional projections for these "hover scroll areas" optional. I'll make that change and i think just add some console warning if only one is provided not the other.
standalone: true, | ||
host: { | ||
'aria-hidden': 'true', | ||
class: 'flex cursor-default items-center justify-center py-1', |
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.
brain should not depend on tailwind
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 may not need these depending on our decision on the up and down arrows. But yes will definitely remove the tw classes
private readonly classNames = signal<ClassValue>(''); | ||
|
||
// eslint-disable-next-line @angular-eslint/no-input-rename | ||
@Input({ alias: 'class' }) |
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.
Why do you use an alias here?
Agree with @elite-benni's comments! I'll need to find some time to give this the attention it deserves! Thanks for your great work on this @thatsamsonkid! Probably one of the hardest and most impactful primitives! I think we are pretty close on this!! |
76f7b14
to
3d4ee2a
Compare
Alrighty update on changes, seems never ending for some reason 🥲 Completed Items/fixes:
|
Screen.Recording.2024-01-28.at.8.38.24.AM.mov👀👀👀 |
7e56025
to
2abc152
Compare
imports: [ReactiveFormsModule, BrnSelectImports, HlmSelectImports], | ||
providers: [provideIcons({ radixChevronUp, radixChevronDown })], | ||
template: ` | ||
<form [formGroup]="options"> |
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.
Guess we can remove the form in the example now.
You want me to clean this up?
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.
Yes please
- fixes issue with root brain select component not reacting to input changes - fixes storybook issue args not being passed to component - comments out stories that still need work
1. made stuff that can be readonly readonly 2. marked things as public, protected, private explicitly 3. moved things from taps into subscribes 4. added some early returns instead of nested ifs 5. fixed a weird flickering bug when using arrows 6. fixed minor css issue with very long values 7. introduced input that allows for custom function transforming the raw value 8. introduced icon where it was possible 9. made some computedClass stuff cleaner FINALLY: HOLY SHIT IS THIS CODE A PIECE OF ART! INCREDIBLE WORK!! I AM IN LOVE WITH THIS COMPONENT
1. missing id on brn-select content 2. select not closing on making a selection in single value mode
1. remove uneeded stories and story clean up
f6cd47f
to
abbf382
Compare
@thatsamsonkid anything I can help to get this into main? Keep up the awesome work! |
I should have some time tomorrow to hopefully wrap up the tests. Mainly just need to add tests for some of the keyboard actions and scrolling. Then refine docs maybe. I was thinking I should probably add a few useful event outputs like on open/close to start with. I think autofill is still an issue here but I think I will resolve that once I help convert combobox and command to our own implementation since its very similar. |
- adds openChanged event emitter
- add test for openChange event - add test for disabled state - add test for scroll behavior - add test for group headings accessibility attributes
docs(select): remove formcontrol from examples and preview
All, I think this might be ready for serious consideration to merge finally!. Do we need to test cli/nx setup? I think docs we can do more but I know we were still looking into how to best format inputs/outputs of the components. But for now the same level of docs seems to be there now thanks @elite-benni and I think I got a good number of tests there to test the core functionality! Let me know if anything |
…tyle improvements seems like contentchildren did not work the way we expected and the trigger always was undefined. we let the trigger set itself inside the service, which is accessible by the brn-select component. then we can use the reference to focus the trigger on close
Feature/select pr review
* feat(select): adds functional select brain/hlm cmps/directives * feat(label): adds label brain * feat(select): brain select component refinement - fixes issue with root brain select component not reacting to input changes - fixes storybook issue args not being passed to component - comments out stories that still need work * feat(label): brain label component * feat: adds directives for scrolling select elements * chore: select cypress init * refactor: change brn-select-content to component * refactor: adds helm selectors to brn-select, brn-select-value * feat: adds helm select directive * fix: helm select content directive with brn refactor * fix: updates select stories * fix(select): missing brn export * fix(select): incorrect setter * fix(select): removes tw class from brn-select-content * fix(select): removes unused code * fix(select): tw scroll class * feat(select): add brn-select-up/down * feat(select): add hlm select-scroll-up/down * fix(select): clear selected when multi changes from true to false * fix(select): change detection issue with selected options * feat(select): show/hide scroll up/down * fix(select): hide scrollbar * feat(select): add arrow scroll up/down * fix(select): dropdown border dark mode * feat(select): select-trigger custom icon * fix(select): option checkmark location * fix(label): add getter for id * feat(select): brn group and label * feat(select): helm select group and label * fix(select): update scrollable story * fix(select): selected options value display * fix(select): multiple value update and selection display * fix(select): service deselect all options fix * fix(select): log clean up * feat(select): sticky labels * fix(select): multi value selection indentation issue * refactor: brn-select-content * fix(select): select ada label and value reading * docs(select): add the select page with preview and examples * docs(select): use the correct formcontrolname in srcollable select * fix(select): allow select to function without explicit ngControl * fix(select): storybook cleanup * feat: minor code style improvements and a couple more. see below 1. made stuff that can be readonly readonly 2. marked things as public, protected, private explicitly 3. moved things from taps into subscribes 4. added some early returns instead of nested ifs 5. fixed a weird flickering bug when using arrows 6. fixed minor css issue with very long values 7. introduced input that allows for custom function transforming the raw value 8. introduced icon where it was possible 9. made some computedClass stuff cleaner FINALLY: HOLY SHIT IS THIS CODE A PIECE OF ART! INCREDIBLE WORK!! I AM IN LOVE WITH THIS COMPONENT * fix(select): testing surfaced issues 1. missing id on brn-select content 2. select not closing on making a selection in single value mode * fix: ts config formatting * feat(select): initial tests 1. remove uneeded stories and story clean up * docs(select): remove formcontrol from examples and preview * feat(select): support for dir - adds openChanged event emitter * feat(select): additional tests - add test for openChange event - add test for disabled state - add test for scroll behavior - add test for group headings accessibility attributes * docs: border css rule * fix: turn up and down into components and import the icons in there * fix: add border classes and allow classnames passed to hlm-select * fix: make focus return to trigger when dropdown closed & minor code style improvements seems like contentchildren did not work the way we expected and the trigger always was undefined. we let the trigger set itself inside the service, which is accessible by the brn-select component. then we can use the reference to focus the trigger on close * docs: minor improvements to select documentation & examples * fix: remove unneeded border color rule --------- Co-authored-by: elite-benni <benjamin.heiss@elite.tirol> Co-authored-by: robingotz <tug29225@temple.edu>
PR Checklist
Please check if your PR fulfills the following requirements:
guidelines: https://github.com/goetzrobin/spartan/blob/main/CONTRIBUTING.md#-commit-message-guidelines
PR Type
What kind of change does this PR introduce?
Which package are you modifying?
What is the current behavior?
Closes #
Select Primitive
Closes #65
What is the new behavior?
Does this PR introduce a breaking change?
Other information