import { useMemo, useState } from 'react' import { allDeviceCategories } from '../../domain/diagram' import { useCatalogStore } from '../../state/catalogStore' const NEW_CATEGORY_VALUE = '__new__' /** A device-category setDraftName(e.target.value)} onKeyDown={(e) => { if (e.key === 'Enter') { e.preventDefault() commitNewCategory() } else if (e.key === 'Escape') { setCreating(false) setDraftName('') } }} placeholder="New category name" className="w-full min-w-0 flex-1 rounded border border-slate-300 px-2 py-1 text-sm" /> ) } return ( ) }