import React, { useMemo } from 'react' import { useInputContext, useInputSetters, Components } from 'leva/plugin' import { BezierSvg } from './BezierSvg' import type { BezierProps } from './bezier-types' import { BezierPreview } from './BezierPreview' import { Container, SyledInnerLabel } from './StyledBezier' import { BuiltIn } from './bezier-plugin' const { Label, Row, Vector, Select } = Components const optionKeys = ['custom', ...Object.keys(BuiltIn)] const optionValues = [false, ...Object.values(BuiltIn).map((c) => c.toString())] const selectSettings = { keys: optionKeys, values: optionValues } function SelectBezier({ value, onUpdate }: Pick) { const selectValue = useMemo(() => optionValues.find((v) => v === value.toString()) || false, [value]) const args = { type: 'SELECT', value: selectValue, settings: selectSettings } const setValue = (newValue: string | boolean) => newValue && onUpdate((newValue as string).split(',')) const select = useInputSetters({ ...args, setValue }) return (