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

1684 components dropdown controlled mode #1708

Merged
merged 2 commits into from
Nov 29, 2023

Conversation

Powerplex
Copy link
Contributor

TYPE(SCOPE): TITLE

TASK: #1684

Description, Motivation and Context

Controlled mode is provided for two features:

  • value management using value, onValueChange, defaultValue to stick with other Spark components API
  • open management using open, onOpenChange, defaultOpen to stick with other Spark components API

Types of changes

  • ✨ New feature (non-breaking change which adds functionality)
  • 🧾 Documentation

Copy link

codecov bot commented Nov 28, 2023

Codecov Report

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

Comparison is base (ad0317f) 97.39% compared to head (0052903) 97.25%.
Report is 3 commits behind head on main.

Files Patch % Lines
...ckages/components/dropdown/src/DropdownContext.tsx 57.14% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1708      +/-   ##
==========================================
- Coverage   97.39%   97.25%   -0.14%     
==========================================
  Files         689      689              
  Lines        4793     4804      +11     
  Branches     1743     1748       +5     
==========================================
+ Hits         4668     4672       +4     
- Misses        125      132       +7     

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


return (
<div className="w-sz-480 pb-[300px]">
<Dropdown value={value} onValueChange={setValue}>
Copy link
Member

Choose a reason for hiding this comment

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

The value is not handled by the Dropdown.value component?

Copy link
Contributor Author

@Powerplex Powerplex Nov 29, 2023

Choose a reason for hiding this comment

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

Actually no :) We read the Radix doc too fast last time. Dropdown.Value is just for the display of the current selected value inside the trigger, but it does not manage it. Radix doc about Dropdown.Value: "The part that reflects the selected value. By default the selected item's text will be rendered."

All the main props are on the root element: https://www.radix-ui.com/primitives/docs/components/select#root

And this is also how we did for other components until now:

Capture d’écran 2023-11-29 à 11 31 20

@Powerplex Powerplex merged commit d79341e into main Nov 29, 2023
7 of 9 checks passed
@Powerplex Powerplex deleted the 1684-components-dropdown-controlled-mode branch November 29, 2023 14:34
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] - Dropdown - Controlled mode
2 participants