- {searchable
- ?
setQuery(event.currentTarget.value)}
- placeholder={placeholder}
- type='search'
- value={query}
- />
- : null}
-
- {visibleOptions.map(option => (
-
- ))}
- {visibleOptions.length === 0
- ?
{emptyLabel}
- : null}
-
-
- )
-}
-
-export function AvatarPresetPicker({
- className,
- emptyLabel = 'No avatars found',
- onChange,
- options,
- placeholder = 'Search avatars',
- searchable = false,
- theme = 'system',
- value,
- ...divProps
-}: AvatarPresetPickerProps) {
- const [query, setQuery] = useState('')
- const visibleOptions = useMemo(
- () => options.filter(option => matchesPickerQuery(option, query)),
- [options, query]
- )
- return (
-
- {searchable
- ?
setQuery(event.currentTarget.value)}
- placeholder={placeholder}
- type='search'
- value={query}
- />
- : null}
-
- {visibleOptions.map(option => (
-
- ))}
- {visibleOptions.length === 0
- ?
{emptyLabel}
- : null}
-
-
- )
-}
-
-export interface AvatarEditorHandle {
- focus(): void
- getDefinition(): AvatarDefinition
- setDefinition(definition: AvatarDefinition): void
-}
-
-export interface AvatarEditorProps extends Omit