mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-30 12:42:22 +00:00
auto close labels dropdown on select but not on checkbox
This commit is contained in:
@@ -75,6 +75,7 @@ export function TableLabelsCell({
|
|||||||
orgId={orgId}
|
orgId={orgId}
|
||||||
selectedLabels={localLabels}
|
selectedLabels={localLabels}
|
||||||
toggleLabel={toggleLabel}
|
toggleLabel={toggleLabel}
|
||||||
|
onClose={() => handleOpenChange(false)}
|
||||||
/>
|
/>
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ export type LabelsSelectorProps = {
|
|||||||
orgId: string;
|
orgId: string;
|
||||||
selectedLabels: SelectedLabel[];
|
selectedLabels: SelectedLabel[];
|
||||||
toggleLabel: (newlabel: SelectedLabel, action: "detach" | "attach") => void;
|
toggleLabel: (newlabel: SelectedLabel, action: "detach" | "attach") => void;
|
||||||
|
onClose?: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const LABEL_COLORS = {
|
export const LABEL_COLORS = {
|
||||||
@@ -51,7 +52,8 @@ export const LABEL_COLORS = {
|
|||||||
export function LabelsSelector({
|
export function LabelsSelector({
|
||||||
orgId,
|
orgId,
|
||||||
selectedLabels,
|
selectedLabels,
|
||||||
toggleLabel
|
toggleLabel,
|
||||||
|
onClose
|
||||||
}: LabelsSelectorProps) {
|
}: LabelsSelectorProps) {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const [labelSearchQuery, setlabelsSearchQuery] = useState("");
|
const [labelSearchQuery, setlabelsSearchQuery] = useState("");
|
||||||
@@ -200,18 +202,24 @@ export function LabelsSelector({
|
|||||||
? "detach"
|
? "detach"
|
||||||
: "attach"
|
: "attach"
|
||||||
);
|
);
|
||||||
// } else {
|
onClose?.();
|
||||||
// onSelectionChange([
|
|
||||||
// ...selectedLabels,
|
|
||||||
// label
|
|
||||||
// ]);
|
|
||||||
// }
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
className="pointer-events-none shrink-0"
|
className="shrink-0"
|
||||||
checked={selectedIds.has(label.labelId)}
|
checked={selectedIds.has(label.labelId)}
|
||||||
onCheckedChange={() => {}}
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
}}
|
||||||
|
onPointerDown={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
}}
|
||||||
|
onCheckedChange={(checked) => {
|
||||||
|
toggleLabel(
|
||||||
|
label,
|
||||||
|
checked ? "attach" : "detach"
|
||||||
|
);
|
||||||
|
}}
|
||||||
aria-hidden
|
aria-hidden
|
||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user