PluginProbe
Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor / 2.0.7
Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor v2.0.7
2.0.13 2.0.12 2.0.11 2.0.10 2.0.9 trunk 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8
blockenberg / blocks / product-tour / index.js

index.js in Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor 2.0.7, at blocks/product-tour/index.js

347 lines 25.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /* ====================================================
2 Product Tour Block — editor (index.js)
3 Block: blockenberg/product-tour
4 ==================================================== */
5 ( function () {
6 var el = wp.element.createElement;
7 var Fragment = wp.element.Fragment;
8 var useState = wp.element.useState;
9 var RichText = wp.blockEditor.RichText;
10 var MediaUpload = wp.blockEditor.MediaUpload;
11 var MediaUploadCheck = wp.blockEditor.MediaUploadCheck;
12 var registerBlockType = wp.blocks.registerBlockType;
13 var InspectorControls = wp.blockEditor.InspectorControls;
14 var useBlockProps = wp.blockEditor.useBlockProps;
15 var PanelBody = wp.components.PanelBody;
16 var PanelColorSettings = wp.blockEditor.PanelColorSettings;
17 var RangeControl = wp.components.RangeControl;
18 var SelectControl = wp.components.SelectControl;
19 var ToggleControl = wp.components.ToggleControl;
20 var TextControl = wp.components.TextControl;
21 var Button = wp.components.Button;
22 var ColorPicker = wp.components.ColorPicker;
23 var Popover = wp.components.Popover;
24 var __ = wp.i18n.__;
25
26 var _tc; function getTypoControl(){ return _tc || (_tc = window.bkbgTypographyControl); }
27 var _tv; function getTypoCssVars(){ return _tv || (_tv = window.bkbgTypoCssVars); }
28
29 function uid() { return 't' + Math.random().toString(36).slice(2,7); }
30 function move(arr, from, to) { var a=arr.slice(); a.splice(to,0,a.splice(from,1)[0]); return a; }
31 var IP = function () { return window.bkbgIconPicker; };
32
33 function wrapStyle(a) {
34 return {
35 '--bkbg-ptour-pt': a.paddingTop + 'px',
36 '--bkbg-ptour-pb': a.paddingBottom + 'px',
37 '--bkbg-ptour-h-gap': a.headerGap + 'px',
38 '--bkbg-ptour-img-r': a.imageRadius + 'px',
39 '--bkbg-ptour-tab-act-bg': a.tabActiveBg,
40 '--bkbg-ptour-tab-brd': a.tabActiveBorder,
41 '--bkbg-ptour-num-bg': a.numberBg,
42 '--bkbg-ptour-num-c': a.numberColor,
43 '--bkbg-ptour-title-c': a.titleColor,
44 '--bkbg-ptour-desc-c': a.descColor,
45 '--bkbg-ptour-ey-bg': a.eyebrowBg,
46 '--bkbg-ptour-ey-c': a.eyebrowColor,
47 '--bkbg-ptour-sec-title-c':a.sectionTitleColor,
48 '--bkbg-ptour-sec-sub-c': a.sectionSubColor,
49 background: a.sectionBg || undefined,
50 };
51 }
52
53 var BkbgColorSwatch = function (props) {
54 var _st = useState(false); var isOpen = _st[0]; var setOpen = _st[1];
55 return el(Fragment, {},
56 el('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', marginBottom: '8px' } },
57 el('span', { style: { fontSize: '11px', fontWeight: 500, textTransform: 'uppercase', color: '#1e1e1e' } }, props.label),
58 el('button', {
59 type: 'button',
60 onClick: function () { setOpen(!isOpen); },
61 style: { width: '28px', height: '28px', borderRadius: '4px', border: '1px solid #ccc', background: props.value || '#ffffff', cursor: 'pointer', padding: 0 }
62 })
63 ),
64 isOpen && el(Popover, { onClose: function () { setOpen(false); } },
65 el('div', { style: { padding: '8px' } },
66 el(ColorPicker, { color: props.value, onChangeComplete: function (c) { props.onChange(c.hex); }, enableAlpha: true })
67 )
68 )
69 );
70 };
71
72 registerBlockType('blockenberg/product-tour', {
73 edit: function (props) {
74 var a = props.attributes;
75 var setAttr = props.setAttributes;
76 var steps = a.steps;
77
78 var _active = useState(0);
79 var activeIdx = _active[0]; var setActiveIdx = _active[1];
80 var _edit = useState(null);
81 var editId = _edit[0]; var setEditId = _edit[1];
82
83 function updateStep(id, patch) {
84 setAttr({ steps: steps.map(function(s){ return s.id===id ? Object.assign({},s,patch) : s; }) });
85 }
86
87 var TC = getTypoControl();
88 var blockProps = useBlockProps((function(){
89 var fn = getTypoCssVars();
90 var s = Object.assign({}, wrapStyle(a));
91 if(fn){
92 Object.assign(s, fn(a.sectionTitleTypo||{}, '--bkbg-ptour-stt-'));
93 Object.assign(s, fn(a.sectionSubTypo||{}, '--bkbg-ptour-ssb-'));
94 Object.assign(s, fn(a.stepTitleTypo||{}, '--bkbg-ptour-stp-'));
95 }
96 return { className: 'bkbg-ptour-wrap bkbg-ptour-layout--' + a.layout, style: s };
97 })());
98
99 /* Header */
100 var headerEl = a.showHeader ? el('div', { className:'bkbg-ptour-header', style:{textAlign:a.headerAlign,marginBottom:a.headerGap+'px'} },
101 a.showEyebrow ? el('span', { className:'bkbg-ptour-eyebrow' }, a.eyebrow) : null,
102 el(RichText, { tagName:'h2', className:'bkbg-ptour-section-title', value:a.sectionTitle, onChange:function(v){ setAttr({sectionTitle:v}); }, placeholder:__('Section title…','blockenberg') }),
103 el(RichText, { tagName:'p', className:'bkbg-ptour-section-sub', value:a.sectionSubtitle, onChange:function(v){ setAttr({sectionSubtitle:v}); }, placeholder:__('Subtitle…','blockenberg') })
104 ) : null;
105
106 /* Tabs sidebar */
107 var activeStep = steps[activeIdx] || steps[0];
108 var tabsEl = el('div', { className:'bkbg-ptour-tabs' },
109 steps.map(function(step, idx) {
110 return el('button', {
111 key: step.id,
112 className: 'bkbg-ptour-tab' + (idx===activeIdx ? ' bkbg-ptour-tab--active' : ''),
113 onClick: function(){ setActiveIdx(idx); },
114 type: 'button'
115 },
116 a.tabStyle === 'numbered'
117 ? el('span', { className:'bkbg-ptour-num', style:{background:idx===activeIdx?step.accentColor:undefined,color:idx===activeIdx?'#fff':undefined} }, idx+1)
118 : el('span', { className:'bkbg-ptour-tab-icon' }, (step.iconType || 'custom-char') !== 'custom-char' ? IP().buildEditorIcon(step.iconType, step.icon, step.iconDashicon, step.iconImageUrl, step.iconDashiconColor) : step.icon),
119 el('div', { className:'bkbg-ptour-tab-text' },
120 el('strong', { className:'bkbg-ptour-tab-title' }, step.title),
121 idx===activeIdx ? el('p', { className:'bkbg-ptour-tab-desc' }, step.description) : null
122 )
123 );
124 })
125 );
126
127 /* Active step image */
128 var imgEl = activeStep
129 ? el('div', { className:'bkbg-ptour-preview' },
130 activeStep.imageUrl
131 ? el('img', { src:activeStep.imageUrl, alt:activeStep.title, className:'bkbg-ptour-img' + (a.imageShadow ? ' bkbg-ptour-img--shadow' : '') })
132 : el('div', { className:'bkbg-ptour-img-placeholder' },
133 el('span', { style:{fontSize:'48px'} }, (activeStep.iconType || 'custom-char') !== 'custom-char' ? IP().buildEditorIcon(activeStep.iconType, activeStep.icon, activeStep.iconDashicon, activeStep.iconImageUrl, activeStep.iconDashiconColor) : activeStep.icon),
134 el('p', { style:{color:'#94a3b8',fontSize:'13px',marginTop:'8px'} }, __('Upload a screenshot for this step','blockenberg'))
135 )
136 )
137 : null;
138
139 /* Inspector steps editor */
140 function stepRow(step, idx) {
141 var isEdit = editId === step.id;
142 return el('div', { key:step.id },
143 el('div', { style:{display:'flex',alignItems:'center',gap:'6px',background:isEdit?'#f3f0ff':'#f8f9fa',border:isEdit?'1px solid #6c3fb5':'1px solid #e2e8f0',borderRadius:'6px',padding:'6px 8px',marginBottom:'4px',cursor:'pointer'}, onClick:function(){ setEditId(isEdit?null:step.id); setActiveIdx(idx); } },
144 el('span', { style:{fontSize:'16px',marginRight:'4px'} }, (step.iconType || 'custom-char') !== 'custom-char' ? IP().buildEditorIcon(step.iconType, step.icon, step.iconDashicon, step.iconImageUrl, step.iconDashiconColor) : step.icon),
145 el('span', { style:{flex:1,overflow:'hidden',textOverflow:'ellipsis',whiteSpace:'nowrap'} }, step.title),
146 el(Button, { icon:'arrow-up', isSmall:true, disabled:idx===0, onClick:function(e){ e.stopPropagation(); setAttr({steps:move(steps,idx,idx-1)}); setActiveIdx(Math.max(0,idx-1)); } }),
147 el(Button, { icon:'arrow-down', isSmall:true, disabled:idx===steps.length-1, onClick:function(e){ e.stopPropagation(); setAttr({steps:move(steps,idx,idx+1)}); setActiveIdx(Math.min(steps.length-1,idx+1)); } }),
148 el(Button, { icon:'no-alt', isSmall:true, isDestructive:true, onClick:function(e){ e.stopPropagation(); setAttr({steps:steps.filter(function(_,i){ return i!==idx; })}); if(editId===step.id) setEditId(null); setActiveIdx(0); } })
149 ),
150 isEdit ? el('div', { style:{padding:'10px',background:'#faf8ff',border:'1px solid #6c3fb5',borderTop:'none',borderRadius:'0 0 6px 6px',marginBottom:'4px'} },
151 el(IP().IconPickerControl, {
152 iconType: step.iconType || 'custom-char',
153 customChar: step.icon,
154 dashicon: step.iconDashicon || '',
155 imageUrl: step.iconImageUrl || '',
156 onChangeType: function (v) { updateStep(step.id, { iconType: v }); },
157 onChangeChar: function (v) { updateStep(step.id, { icon: v }); },
158 onChangeDashicon: function (v) { updateStep(step.id, { iconDashicon: v }); },
159 onChangeImageUrl: function (v) { updateStep(step.id, { iconImageUrl: v }); }
160 }),
161 el(TextControl, { label:__('Title','blockenberg'), value:step.title, onChange:function(v){ updateStep(step.id,{title:v}); } }),
162 el(TextControl, { label:__('Description','blockenberg'), value:step.description, onChange:function(v){ updateStep(step.id,{description:v}); } }),
163 el(BkbgColorSwatch, { label:__('Active accent color','blockenberg'), value:step.accentColor, onChange:function(v){ updateStep(step.id,{accentColor:v}); } }),
164 el(MediaUploadCheck, null,
165 el(MediaUpload, {
166 onSelect:function(m){ updateStep(step.id,{imageUrl:m.url,imageId:m.id}); },
167 allowedTypes:['image'], value:step.imageId,
168 render:function(o){ return el(Button, { onClick:o.open, variant:'secondary', isSmall:true }, step.imageUrl ? __('Change screenshot','blockenberg') : __('Upload screenshot','blockenberg')); }
169 })
170 ),
171 step.imageUrl ? el(Button, { isDestructive:true, variant:'tertiary', isSmall:true, style:{marginTop:'4px'}, onClick:function(){ updateStep(step.id,{imageUrl:'',imageId:0}); } }, __('Remove image','blockenberg')) : null
172 ) : null
173 );
174 }
175
176 var inspector = el(InspectorControls, null,
177 el(PanelBody, { title:__('Steps','blockenberg'), initialOpen:true },
178 steps.map(function(s,i){ return stepRow(s,i); }),
179 el(Button, { variant:'primary', style:{marginTop:'8px',width:'100%'},
180 onClick:function(){
181 var n={id:uid(),icon:'',iconType:'custom-char',iconDashicon:'',iconImageUrl:'',title:'New Step',description:'Describe this step clearly.',imageUrl:'',imageId:0,accentColor:'#6c3fb5'};
182 setAttr({steps:steps.concat([n])});
183 setActiveIdx(steps.length);
184 setEditId(n.id);
185 }
186 }, __('+ Add Step','blockenberg'))
187 ),
188 el(PanelBody, { title:__('Layout & Style','blockenberg'), initialOpen:false },
189 el(SelectControl, { label:__('Layout','blockenberg'), value:a.layout, options:[
190 {label:'Tabs left — image right',value:'tabs-left'},
191 {label:'Tabs right — image left',value:'tabs-right'},
192 {label:'Tabs top — image below',value:'tabs-top'},
193 ], onChange:function(v){ setAttr({layout:v}); } }),
194 el(SelectControl, { label:__('Tab style','blockenberg'), value:a.tabStyle, options:[
195 {label:'Numbered',value:'numbered'},
196 {label:'Icon',value:'icon'},
197 ], onChange:function(v){ setAttr({tabStyle:v}); } }),
198 el(ToggleControl, { label:__('Image shadow','blockenberg'), checked:a.imageShadow, onChange:function(v){ setAttr({imageShadow:v}); } }),
199 el(RangeControl, { label:__('Image radius (px)','blockenberg'), value:a.imageRadius, min:0, max:32, onChange:function(v){ setAttr({imageRadius:v}); } })
200 ),
201 el(PanelBody, { title:__('Typography','blockenberg'), initialOpen:false },
202 TC && el(TC, {label:__('Section Title','blockenberg'),value:a.sectionTitleTypo||{},onChange:function(v){setAttr({sectionTitleTypo:v});}}),
203 TC && el(TC, {label:__('Section Subtitle','blockenberg'),value:a.sectionSubTypo||{},onChange:function(v){setAttr({sectionSubTypo:v});}}),
204 TC && el(TC, {label:__('Step Title','blockenberg'),value:a.stepTitleTypo||{},onChange:function(v){setAttr({stepTitleTypo:v});}})
205 ),
206 el(PanelBody, { title:__('Section Header','blockenberg'), initialOpen:false },
207 el(ToggleControl, { label:__('Show header','blockenberg'), checked:a.showHeader, onChange:function(v){ setAttr({showHeader:v}); } }),
208 el(ToggleControl, { label:__('Show eyebrow','blockenberg'), checked:a.showEyebrow, onChange:function(v){ setAttr({showEyebrow:v}); } }),
209 el(TextControl, { label:__('Eyebrow text','blockenberg'), value:a.eyebrow, onChange:function(v){ setAttr({eyebrow:v}); } }),
210 el(SelectControl, { label:__('Header align','blockenberg'), value:a.headerAlign, options:[
211 {label:'Left',value:'left'},{label:'Center',value:'center'}
212 ], onChange:function(v){ setAttr({headerAlign:v}); } })
213 ),
214 el(PanelBody, { title:__('Spacing','blockenberg'), initialOpen:false },
215 el(RangeControl, { label:__('Padding top (px)','blockenberg'), value:a.paddingTop, min:0, max:160, onChange:function(v){ setAttr({paddingTop:v}); } }),
216 el(RangeControl, { label:__('Padding bottom (px)','blockenberg'), value:a.paddingBottom, min:0, max:160, onChange:function(v){ setAttr({paddingBottom:v}); } }),
217 el(RangeControl, { label:__('Header gap (px)','blockenberg'), value:a.headerGap, min:0, max:80, onChange:function(v){ setAttr({headerGap:v}); } })
218 ),
219 el(PanelColorSettings, { title:__('Colors','blockenberg'), initialOpen:false, colorSettings:[
220 {label:__('Section bg','blockenberg'), value:a.sectionBg, onChange:function(v){ setAttr({sectionBg:v||''}); }},
221 {label:__('Active tab bg','blockenberg'), value:a.tabActiveBg, onChange:function(v){ setAttr({tabActiveBg:v||''}); }},
222 {label:__('Active tab border','blockenberg'), value:a.tabActiveBorder, onChange:function(v){ setAttr({tabActiveBorder:v||''}); }},
223 {label:__('Number bg','blockenberg'), value:a.numberBg, onChange:function(v){ setAttr({numberBg:v||''}); }},
224 {label:__('Number text','blockenberg'), value:a.numberColor, onChange:function(v){ setAttr({numberColor:v||''}); }},
225 {label:__('Title color','blockenberg'), value:a.titleColor, onChange:function(v){ setAttr({titleColor:v||''}); }},
226 {label:__('Description color','blockenberg'), value:a.descColor, onChange:function(v){ setAttr({descColor:v||''}); }},
227 {label:__('Eyebrow bg','blockenberg'), value:a.eyebrowBg, onChange:function(v){ setAttr({eyebrowBg:v||''}); }},
228 {label:__('Eyebrow text','blockenberg'), value:a.eyebrowColor, onChange:function(v){ setAttr({eyebrowColor:v||''}); }},
229 {label:__('Section title','blockenberg'), value:a.sectionTitleColor, onChange:function(v){ setAttr({sectionTitleColor:v||''}); }},
230 {label:__('Section subtitle','blockenberg'), value:a.sectionSubColor, onChange:function(v){ setAttr({sectionSubColor:v||''}); }},
231 ] })
232 );
233
234 return el(Fragment, null,
235 inspector,
236 el('div', blockProps,
237 headerEl,
238 el('div', { className:'bkbg-ptour-body' },
239 tabsEl,
240 imgEl
241 )
242 )
243 );
244 },
245
246 save: function (props) {
247 var a = props.attributes;
248 var fn = getTypoCssVars();
249 var s = Object.assign({}, wrapStyle(a));
250 if(fn){
251 Object.assign(s, fn(a.sectionTitleTypo||{}, '--bkbg-ptour-stt-'));
252 Object.assign(s, fn(a.sectionSubTypo||{}, '--bkbg-ptour-ssb-'));
253 Object.assign(s, fn(a.stepTitleTypo||{}, '--bkbg-ptour-stp-'));
254 }
255 var blockProps = wp.blockEditor.useBlockProps.save({
256 className:'bkbg-ptour-wrap bkbg-ptour-layout--'+a.layout,
257 style: s
258 });
259
260 var headerEl = a.showHeader ? el('div', { className:'bkbg-ptour-header', style:{textAlign:a.headerAlign,marginBottom:a.headerGap+'px'} },
261 a.showEyebrow ? el('span', { className:'bkbg-ptour-eyebrow' }, a.eyebrow) : null,
262 el(RichText.Content, { tagName:'h2', className:'bkbg-ptour-section-title', value:a.sectionTitle }),
263 el(RichText.Content, { tagName:'p', className:'bkbg-ptour-section-sub', value:a.sectionSubtitle })
264 ) : null;
265
266 return el('div', blockProps,
267 headerEl,
268 el('div', { className:'bkbg-ptour-body' },
269 el('div', { className:'bkbg-ptour-tabs' },
270 a.steps.map(function(step, idx) {
271 return el('button', { key:step.id, className:'bkbg-ptour-tab'+(idx===0?' bkbg-ptour-tab--active':''), 'data-step':step.id, type:'button' },
272 a.tabStyle==='numbered'
273 ? el('span', { className:'bkbg-ptour-num' }, idx+1)
274 : el('span', { className:'bkbg-ptour-tab-icon' }, (step.iconType || 'custom-char') !== 'custom-char' ? IP().buildSaveIcon(step.iconType, step.icon, step.iconDashicon, step.iconImageUrl, step.iconDashiconColor) : step.icon),
275 el('div', { className:'bkbg-ptour-tab-text' },
276 el('strong', { className:'bkbg-ptour-tab-title' }, step.title),
277 el('p', { className:'bkbg-ptour-tab-desc' }, step.description)
278 )
279 );
280 })
281 ),
282 el('div', { className:'bkbg-ptour-panels' },
283 a.steps.map(function(step, idx) {
284 return el('div', { key:step.id, className:'bkbg-ptour-panel'+(idx===0?' bkbg-ptour-panel--active':''), 'data-panel':step.id },
285 step.imageUrl
286 ? el('img', { src:step.imageUrl, alt:step.title, className:'bkbg-ptour-img'+(a.imageShadow?' bkbg-ptour-img--shadow':''), loading:'lazy' })
287 : el('div', { className:'bkbg-ptour-img-placeholder' }, el('span', { style:{fontSize:'56px'} }, (step.iconType || 'custom-char') !== 'custom-char' ? IP().buildSaveIcon(step.iconType, step.icon, step.iconDashicon, step.iconImageUrl, step.iconDashiconColor) : step.icon))
288 );
289 })
290 )
291 )
292 );
293 },
294
295 deprecated: [{
296 attributes: {
297 steps:{type:'array',default:[]},
298 layout:{type:'string',default:'tabs-left'},sectionTitle:{type:'string',default:'How it works'},sectionSubtitle:{type:'string',default:'Everything you need, step by step.'},showHeader:{type:'boolean',default:true},headerAlign:{type:'string',default:'center'},eyebrow:{type:'string',default:'Product Tour'},showEyebrow:{type:'boolean',default:true},imageRadius:{type:'number',default:16},imageShadow:{type:'boolean',default:true},tabStyle:{type:'string',default:'numbered'},paddingTop:{type:'number',default:72},paddingBottom:{type:'number',default:72},headerGap:{type:'number',default:56},sectionBg:{type:'string',default:''},tabActiveBg:{type:'string',default:'#f5f3ff'},tabActiveBorder:{type:'string',default:'#6c3fb5'},numberBg:{type:'string',default:'#6c3fb5'},numberColor:{type:'string',default:'#ffffff'},titleColor:{type:'string',default:'#1e293b'},descColor:{type:'string',default:'#64748b'},eyebrowBg:{type:'string',default:'#ede9fe'},eyebrowColor:{type:'string',default:'#6c3fb5'},sectionTitleColor:{type:'string',default:'#1e293b'},sectionSubColor:{type:'string',default:'#64748b'},
299 titleFontSize:{type:'number',default:15},titleFontWeight:{type:'number',default:500},titleLineHeight:{type:'number',default:1.4},sectionTitleFontSize:{type:'number',default:28},sectionTitleFontWeight:{type:'number',default:700},sectionTitleLineHeight:{type:'number',default:1.2}
300 },
301 save: function (props) {
302 var a = props.attributes;
303 var blockProps = wp.blockEditor.useBlockProps.save({
304 className:'bkbg-ptour-wrap bkbg-ptour-layout--'+a.layout,
305 style: {
306 '--bkbg-ptour-pt':a.paddingTop+'px','--bkbg-ptour-pb':a.paddingBottom+'px','--bkbg-ptour-h-gap':a.headerGap+'px','--bkbg-ptour-img-r':a.imageRadius+'px','--bkbg-ptour-tab-act-bg':a.tabActiveBg,'--bkbg-ptour-tab-brd':a.tabActiveBorder,'--bkbg-ptour-num-bg':a.numberBg,'--bkbg-ptour-num-c':a.numberColor,'--bkbg-ptour-title-c':a.titleColor,'--bkbg-ptour-desc-c':a.descColor,'--bkbg-ptour-ey-bg':a.eyebrowBg,'--bkbg-ptour-ey-c':a.eyebrowColor,'--bkbg-ptour-sec-title-c':a.sectionTitleColor,'--bkbg-ptour-sec-sub-c':a.sectionSubColor,'--bkbg-ptour-sec-title-fs':(a.sectionTitleFontSize || 28)+'px','--bkbg-ptour-sec-title-fw':(a.sectionTitleFontWeight || 700),'--bkbg-ptour-sec-title-lh':(a.sectionTitleLineHeight || 1.2),'--bkbg-ptour-title-fs':(a.titleFontSize || 15)+'px','--bkbg-ptour-title-fw':(a.titleFontWeight || 500),'--bkbg-ptour-title-lh':(a.titleLineHeight || 1.4),background:a.sectionBg||undefined,
307 }
308 });
309
310 var headerEl = a.showHeader ? el('div', { className:'bkbg-ptour-header', style:{textAlign:a.headerAlign,marginBottom:a.headerGap+'px'} },
311 a.showEyebrow ? el('span', { className:'bkbg-ptour-eyebrow' }, a.eyebrow) : null,
312 el(RichText.Content, { tagName:'h2', className:'bkbg-ptour-section-title', value:a.sectionTitle }),
313 el(RichText.Content, { tagName:'p', className:'bkbg-ptour-section-sub', value:a.sectionSubtitle })
314 ) : null;
315
316 return el('div', blockProps,
317 headerEl,
318 el('div', { className:'bkbg-ptour-body' },
319 el('div', { className:'bkbg-ptour-tabs' },
320 a.steps.map(function(step, idx) {
321 return el('button', { key:step.id, className:'bkbg-ptour-tab'+(idx===0?' bkbg-ptour-tab--active':''), 'data-step':step.id, type:'button' },
322 a.tabStyle==='numbered'
323 ? el('span', { className:'bkbg-ptour-num' }, idx+1)
324 : el('span', { className:'bkbg-ptour-tab-icon' }, step.icon),
325 el('div', { className:'bkbg-ptour-tab-text' },
326 el('strong', { className:'bkbg-ptour-tab-title' }, step.title),
327 el('p', { className:'bkbg-ptour-tab-desc' }, step.description)
328 )
329 );
330 })
331 ),
332 el('div', { className:'bkbg-ptour-panels' },
333 a.steps.map(function(step, idx) {
334 return el('div', { key:step.id, className:'bkbg-ptour-panel'+(idx===0?' bkbg-ptour-panel--active':''), 'data-panel':step.id },
335 step.imageUrl
336 ? el('img', { src:step.imageUrl, alt:step.title, className:'bkbg-ptour-img'+(a.imageShadow?' bkbg-ptour-img--shadow':''), loading:'lazy' })
337 : el('div', { className:'bkbg-ptour-img-placeholder' }, el('span', { style:{fontSize:'56px'} }, step.icon))
338 );
339 })
340 )
341 )
342 );
343 }
344 }]
345 });
346 }() );
347