(optValue: string)
| 832 | }, [editing, onEndEdit]) |
| 833 | |
| 834 | const toggle = (optValue: string): void => { |
| 835 | if (multi) { |
| 836 | const next = selected.includes(optValue) |
| 837 | ? selected.filter((v) => v !== optValue) |
| 838 | : [...selected, optValue] |
| 839 | onCommit(next.join(', ')) |
| 840 | } else { |
| 841 | onCommit(selected[0] === optValue ? '' : optValue) |
| 842 | onEndEdit() |
| 843 | } |
| 844 | } |
| 845 | |
| 846 | const chips = ( |
| 847 | <div className="flex flex-wrap gap-1"> |