import React from 'react' import { Check, Sparkles } from 'lucide-react' import InfoTip from './InfoTip' import { FIELD_STYLE_PRESETS } from './fieldStylePresets' import { applyFilters } from '../../extensions/registry' /** * "Display Style" preset picker (port of the reference builder FieldStylePicker). Applying a preset writes its appliedStyles; * keys the preset sets to undefined are written as null so they are really removed from the saved field. * `extraClear` lists older WP keys that would override the the reference builder key on the canvas (radio/checkbox choiceStyle). */ export default function FieldStylePicker({ field, onUpdate }) { const presets = (applyFilters('fieldStylePresets', FIELD_STYLE_PRESETS) || FIELD_STYLE_PRESETS)[field.type] if (!presets || presets.length === 0) return null const legacyChoiceStyle = (field.type === 'radio' || field.type === 'checkbox') && field.choiceStyle const apply = (preset) => { const patch = {} for (const [k, v] of Object.entries(preset.appliedStyles)) patch[k] = v === undefined ? null : v if (legacyChoiceStyle) patch.choiceStyle = null onUpdate(patch) } return (