/** * Hover-preview SVG mockups (block name → JSX). Inline fill/stroke — see icons.js. */ // Fixed pixel size so the preview iframe stylesheet cannot reflow the SVG. const ROOT = { viewBox: '0 0 240 110', xmlns: 'http://www.w3.org/2000/svg', strokeLinecap: 'round', strokeLinejoin: 'round', style: { fill: 'none', stroke: 'currentColor', display: 'block', width: '224px', height: '103px', maxWidth: 'none' }, }; const FILL = { fill: 'currentColor', stroke: 'none' }; const LABEL = { fontFamily: 'sans-serif', fontSize: 15, fontWeight: 600, style: FILL }; const PLACE = { fontFamily: 'sans-serif', fontSize: 13, opacity: 0.5, style: FILL }; const VALUE = { fontFamily: 'sans-serif', fontSize: 13, opacity: 0.8, style: FILL }; const SMALL = { fontFamily: 'sans-serif', fontSize: 11, opacity: 0.65, style: FILL }; // --- shared primitives ----------------------------------------------------- const lab = ( t ) => { t }; const frame = ( y, h ) => ; const chevron = ; // --- left-of-input glyphs (≈ x28–46, vertical centre y62) ------------------ const gEnvelope = ( ); const gLock = ( ); const gGlobe = ( ); const gPhone = ( ); const gAt = ( ); const gLink = ( ); const gPerson = ( ); const gFlag = ( ); const gMagnifier = ( ); // --- right-of-input picker glyphs ------------------------------------------ const gCalendar = ( ); const gClock = ( ); // --- control renderers ----------------------------------------------------- const textInput = ( label, placeholder, glyph = null ) => ( { lab( label ) } { frame( 42, 40 ) } { glyph } { placeholder } ); const selectInput = ( label, value, glyph = null ) => ( { lab( label ) } { frame( 42, 40 ) } { glyph } { value } { chevron } ); const searchSelect = ( label, value ) => ( { lab( label ) } { frame( 42, 40 ) } { gMagnifier } { value } { chevron } ); const multiSelect = ( label, chips ) => ( { lab( label ) } { frame( 42, 40 ) } { chips.map( ( c, i ) => { const x = 28 + i * 76; return ( { c } ); } ) } { chevron } ); const textareaInput = ( label ) => ( { lab( label ) } { frame( 40, 58 ) } ); const wysiwygInput = ( label ) => ( { lab( label ) } { frame( 40, 58 ) } ); const pickerInput = ( label, placeholder, rightGlyph ) => ( { lab( label ) } { frame( 42, 40 ) } { placeholder } { rightGlyph } ); const colorInput = ( label ) => ( { lab( label ) } { frame( 42, 40 ) } #3858E9 ); const checkboxInput = ( label, optionText ) => ( { lab( label ) } { optionText } ); const checkboxGroup = ( label, options ) => ( { lab( label ) } { options.map( ( o, i ) => { const y = 42 + i * 22; return ( { o.checked && } { o.label } ); } ) } ); const radioInput = ( label, options ) => ( { lab( label ) } { options.map( ( o, i ) => { const cy = 50 + i * 22; return ( { o.selected && } { o.label } ); } ) } ); const headingPreview = ( text ) => ( { text } ); const uploadInput = ( label ) => ( { lab( label ) } Drop a file or browse ); const avatarPreview = ( label ) => ( { lab( label ) } Upload ); const mapPreview = ( label ) => ( { lab( label ) } { frame( 40, 58 ) } ); const captchaWidget = ( optionText, badge ) => ( { optionText } { badge } ); const buttonPreview = ( text ) => ( { text } ); const hiddenPreview = ( label, note ) => ( { lab( label ) } { note } ); const repeaterPreview = ( label ) => ( { lab( label ) } Add row ); // PMS "Subscription Plans" — radio rows with a right-aligned price, so the // preview reads as "pick a paid plan" instead of a generic radio group. const plansPreview = ( label, plans ) => ( { lab( label ) } { plans.map( ( p, i ) => { const cy = 48 + i * 22; return ( { p.selected && } { p.label } { p.price } ); } ) } ); // A stack of inputs carrying their name as an in-input placeholder — for a field // type that renders a GROUP of inputs (PMS billing fields). Deliberately unlike // addressPreview (labels ABOVE each row) so the two don't read identically. const stackedInputs = ( label, placeholders ) => ( { lab( label ) } { placeholders.map( ( p, i ) => { const y = 38 + i * 24; return ( { p } ); } ) } ); const addressPreview = ( label, rows ) => ( { lab( label ) } { rows.map( ( r, i ) => { const y = 40 + i * 30; return ( { r } ); } ) } ); // --- structural ------------------------------------------------------------ const stepBreakPreview = ( Step Break 1 2 3 ); const columnsPreview = ( Columns ); const progressBarPreview = ( Progress Bar 50% complete ); // --- map ------------------------------------------------------------------- export const FIELD_PREVIEWS = { /* Default */ 'profile-builder/field-default-name-heading': headingPreview( 'Name' ), 'profile-builder/field-default-contact-info-heading': headingPreview( 'Contact Info' ), 'profile-builder/field-default-about-yourself-heading': headingPreview( 'About Yourself' ), 'profile-builder/field-default-username': textInput( 'Username *', 'your_username', gPerson ), 'profile-builder/field-default-first-name': textInput( 'First Name', 'Jane' ), 'profile-builder/field-default-last-name': textInput( 'Last Name', 'Doe' ), 'profile-builder/field-default-nickname': textInput( 'Nickname', 'jane' ), 'profile-builder/field-default-email': textInput( 'E-mail *', 'name@site.com', gEnvelope ), 'profile-builder/field-default-website': textInput( 'Website', 'https://example.com', gGlobe ), 'profile-builder/field-default-password': textInput( 'Password *', '••••••••', gLock ), 'profile-builder/field-default-repeat-password': textInput( 'Repeat Password *', '••••••••', gLock ), 'profile-builder/field-default-biographical-info': textareaInput( 'Biographical Info' ), 'profile-builder/field-default-display-name': selectInput( 'Display name publicly as', 'Jane Doe' ), 'profile-builder/field-default-aim': textInput( 'AIM', 'screenname' ), 'profile-builder/field-default-yim': textInput( 'Yahoo IM', 'screenname' ), 'profile-builder/field-default-jabber': textInput( 'Jabber / Google Talk', 'user@xmpp.org' ), /* Standard */ 'profile-builder/field-input': textInput( 'Text', 'Type here…' ), 'profile-builder/field-textarea': textareaInput( 'Textarea' ), 'profile-builder/field-select': selectInput( 'Choose an option', 'Select…' ), 'profile-builder/field-select-multiple': multiSelect( 'Select (Multiple)', [ 'Option A', 'Option B' ] ), 'profile-builder/field-checkbox': checkboxInput( 'Checkbox', 'Yes, sign me up' ), 'profile-builder/field-radio': radioInput( 'Radio', [ { label: 'Option one', selected: true }, { label: 'Option two' } ] ), 'profile-builder/field-heading': headingPreview( 'Heading' ), 'profile-builder/field-avatar': avatarPreview( 'Avatar' ), 'profile-builder/field-number': textInput( 'Number', '0' ), 'profile-builder/field-input-hidden': hiddenPreview( 'Hidden Field', 'Not shown on the form' ), 'profile-builder/field-language': selectInput( 'Language', 'English (United States)' ), 'profile-builder/field-wysiwyg': wysiwygInput( 'WYSIWYG' ), 'profile-builder/field-html': textareaInput( 'HTML' ), 'profile-builder/field-upload': uploadInput( 'Upload' ), 'profile-builder/field-international-telephone-input': textInput( 'Phone', '+1 (555) 000-0000', gFlag ), /* Advanced */ 'profile-builder/field-select2': searchSelect( 'Select2', 'Search…' ), 'profile-builder/field-phone': textInput( 'Phone', '+1 (555) 000-0000', gPhone ), 'profile-builder/field-select-country': selectInput( 'Country', 'United States', gFlag ), 'profile-builder/field-select-timezone': selectInput( 'Timezone', 'UTC+00:00 — London' ), 'profile-builder/field-select-currency': selectInput( 'Currency', 'USD — US Dollar ($)' ), 'profile-builder/field-select-cpt': selectInput( 'Select (CPT)', 'Choose a post…' ), 'profile-builder/field-select-taxonomy': selectInput( 'Select (Taxonomy)', 'Choose a category…' ), 'profile-builder/field-checkbox-toa': checkboxInput( 'Terms and Conditions', 'I agree to the Terms' ), 'profile-builder/field-datepicker': pickerInput( 'Datepicker', 'YYYY-MM-DD', gCalendar ), 'profile-builder/field-timepicker': pickerInput( 'Timepicker', 'HH : MM', gClock ), 'profile-builder/field-colorpicker': colorInput( 'Colorpicker' ), 'profile-builder/field-validation': textInput( 'Validation', 'Enter the code' ), 'profile-builder/field-map': mapPreview( 'Map' ), 'profile-builder/field-additional-map': mapPreview( 'Additional Map' ), 'profile-builder/field-recaptcha': captchaWidget( "I'm not a robot", ( reCAPTCHA ) ), 'profile-builder/field-turnstile': captchaWidget( 'Verify you are human', ( ) ), 'profile-builder/field-select-user-role': selectInput( 'User Role', 'Subscriber' ), 'profile-builder/field-default-blog-details': textInput( 'Blog Title', 'My blog' ), 'profile-builder/field-mailchimp-subscribe': checkboxInput( 'MailChimp', 'Subscribe to our newsletter' ), 'profile-builder/field-mailpoet-subscribe': checkboxInput( 'MailPoet', 'Subscribe to our newsletter' ), 'profile-builder/field-campaign-monitor-subscribe': checkboxInput( 'Campaign Monitor', 'Subscribe to our newsletter' ), 'profile-builder/field-woo-billing-address': addressPreview( 'Billing Address', [ 'Full name', 'Street address' ] ), 'profile-builder/field-woo-shipping-address': addressPreview( 'Shipping Address', [ 'Full name', 'Street address' ] ), /* Other */ 'profile-builder/field-email': textInput( 'Email', 'name@site.com', gAt ), 'profile-builder/field-email-confirmation': textInput( 'Confirm E-mail', 'name@site.com', gEnvelope ), 'profile-builder/field-gdpr-checkbox': checkboxInput( 'GDPR Agreement', 'I consent to my data being stored' ), 'profile-builder/field-gdpr-communication-preferences': checkboxGroup( 'Communication Preferences', [ { label: 'E-mail', checked: true }, { label: 'Phone' }, { label: 'SMS' }, ] ), 'profile-builder/field-gdpr-delete': buttonPreview( 'Delete my account' ), 'profile-builder/field-pms-subscription-plans': plansPreview( 'Subscription Plans', [ { label: 'Free', price: '$0', selected: true }, { label: 'Monthly', price: '$9 / mo' }, { label: 'Yearly', price: '$90 / yr' }, ] ), 'profile-builder/field-pms-billing-fields': stackedInputs( 'Billing Fields', [ 'Billing First Name', 'Billing Address', 'Billing Country', ] ), 'profile-builder/field-honeypot': hiddenPreview( 'Honeypot', 'Anti-spam — hidden from users' ), 'profile-builder/field-input-url': textInput( 'URL', 'https://example.com', gLink ), 'profile-builder/field-select2-multiple': multiSelect( 'Select2 (Multiple)', [ 'Tag one', 'Tag two' ] ), 'profile-builder/field-repeater': repeaterPreview( 'Repeater' ), /* Structural */ 'profile-builder/msf-step-break': stepBreakPreview, 'profile-builder/ffc-columns': columnsPreview, 'profile-builder/progress-bar': progressBarPreview, };