{
+ // Only toggle if not clicking the checkbox (which has its own handler)
+ if (!str.startsWith("checkbox-click")) {
+ toggleOption(optItem, group.groupLabel, group.multiple);
+ }
+ }}
+ className={cn(itemClasses, "gap-1")}
+ >
+ {/* Show a checkbox if multiple, else a single check icon if selected */}
+ {showCheckbox ? (
+
+ {
+ e.preventDefault();
+ e.stopPropagation();
+ toggleOption(optItem, group.groupLabel, group.multiple);
+ }}
+ data-value="checkbox-click"
+ />
+
+
+ ) : (
+
+ {isSelected ? (
+
+ ) : null}
+
+
+ )}
+
+ );
+ })}
+