-
Notifications
You must be signed in to change notification settings - Fork 176
fix(split-view): use real checkboxes in the secondary pane layer menu (#840) #865
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -114,8 +114,11 @@ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const DropdownMenuCheckboxItem = React.forwardRef< | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| >(({ className, children, checked, ...props }, ref) => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem> & { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** `"check"` (default): bare checkmark when checked. `"box"`: always-visible bordered square that fills on check. */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| indicator?: "check" | "box"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| >(({ className, children, checked, indicator = "check", ...props }, ref) => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <DropdownMenuPrimitive.CheckboxItem | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ref={ref} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className={cn( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -125,11 +128,30 @@ export const DropdownMenuCheckboxItem = React.forwardRef< | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| checked={checked} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {...props} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <DropdownMenuPrimitive.ItemIndicator> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Check className="h-4 w-4" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </DropdownMenuPrimitive.ItemIndicator> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {indicator === "box" ? ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className={cn( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "absolute left-2 flex h-4 w-4 items-center justify-center rounded-[4px] border transition-colors", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| checked === true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? "border-primary bg-primary text-primary-foreground" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : checked === "indeterminate" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? "border-primary bg-primary/40 text-primary-foreground" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : "border-input", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {checked === true ? ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Check className="h-3 w-3" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) : checked === "indeterminate" ? ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span className="h-0.5 w-2 rounded-full bg-current" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) : null} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+131
to
+147
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug (medium confidence): The The Mitigations (pick one):
Suggested change
The |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) : ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <DropdownMenuPrimitive.ItemIndicator> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Check className="h-4 w-4" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </DropdownMenuPrimitive.ItemIndicator> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {children} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </DropdownMenuPrimitive.CheckboxItem> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
Nit (quality): The JSDoc describes visual behaviour but doesn't flag the controlled-only constraint. Adding a note here makes the limitation discoverable at the call site: