import { ColorSwatchField, Field, Section, Segmented, Toggle, useScopedFormContext } from '@components/common/page-builder/index.js'; import { _ } from '@evershop/evershop/lib/locale/translate/_'; import React from 'react'; import type { SeparatorSize } from './Separator.js'; interface SeparatorSettingProps { separatorWidget?: { size?: SeparatorSize | null; showLine?: boolean | null; lineColor?: string | null; }; } const SIZE_OPTIONS: ReadonlyArray<{ value: SeparatorSize; label: string }> = [ { value: 'xs', label: _('XS') }, { value: 'sm', label: _('S') }, { value: 'md', label: _('M') }, { value: 'lg', label: _('L') }, { value: 'xl', label: _('XL') } ]; export default function SeparatorSetting({ separatorWidget }: SeparatorSettingProps) { const { size = 'md', showLine = false, lineColor = null } = separatorWidget ?? {}; const { register, setValue, watch } = useScopedFormContext(); const sizeV = ((watch('settings.size') as string) ?? size ?? 'md') as SeparatorSize; const showLineV = (watch('settings.showLine') as boolean | null) ?? showLine ?? false; const lineColorV = (watch('settings.lineColor') as string) ?? lineColor ?? ''; return (