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 / bmi-calculator / index.js

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

416 lines 27.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 ( function () {
2 var el = wp.element.createElement;
3 var useState = wp.element.useState;
4 var Fragment = wp.element.Fragment;
5 var registerBlockType = wp.blocks.registerBlockType;
6 var __ = wp.i18n.__;
7 var InspectorControls = wp.blockEditor.InspectorControls;
8 var PanelColorSettings = wp.blockEditor.PanelColorSettings;
9 var useBlockProps = wp.blockEditor.useBlockProps;
10 var PanelBody = wp.components.PanelBody;
11 var RangeControl = wp.components.RangeControl;
12 var SelectControl = wp.components.SelectControl;
13 var TextControl = wp.components.TextControl;
14 var TextareaControl = wp.components.TextareaControl;
15 var ToggleControl = wp.components.ToggleControl;
16 var Button = wp.components.Button;
17
18 function getTypographyControl() {
19 return (window.bkbgTypographyControl || function () { return null; });
20 }
21
22 function _tv(typo, prefix) {
23 if (!typo) return {};
24 var s = {};
25 if (typo.family) s[prefix + 'font-family'] = "'" + typo.family + "', sans-serif";
26 if (typo.weight) s[prefix + 'font-weight'] = typo.weight;
27 if (typo.transform) s[prefix + 'text-transform'] = typo.transform;
28 if (typo.style) s[prefix + 'font-style'] = typo.style;
29 if (typo.decoration) s[prefix + 'text-decoration'] = typo.decoration;
30 var su = typo.sizeUnit || 'px';
31 if (typo.sizeDesktop !== '' && typo.sizeDesktop != null) s[prefix + 'font-size-d'] = typo.sizeDesktop + su;
32 if (typo.sizeTablet !== '' && typo.sizeTablet != null) s[prefix + 'font-size-t'] = typo.sizeTablet + su;
33 if (typo.sizeMobile !== '' && typo.sizeMobile != null) s[prefix + 'font-size-m'] = typo.sizeMobile + su;
34 var lhu = typo.lineHeightUnit || '';
35 if (typo.lineHeightDesktop !== '' && typo.lineHeightDesktop != null) s[prefix + 'line-height-d'] = typo.lineHeightDesktop + lhu;
36 if (typo.lineHeightTablet !== '' && typo.lineHeightTablet != null) s[prefix + 'line-height-t'] = typo.lineHeightTablet + lhu;
37 if (typo.lineHeightMobile !== '' && typo.lineHeightMobile != null) s[prefix + 'line-height-m'] = typo.lineHeightMobile + lhu;
38 var lsu = typo.letterSpacingUnit || 'px';
39 if (typo.letterSpacingDesktop !== '' && typo.letterSpacingDesktop != null) s[prefix + 'letter-spacing-d'] = typo.letterSpacingDesktop + lsu;
40 if (typo.letterSpacingTablet !== '' && typo.letterSpacingTablet != null) s[prefix + 'letter-spacing-t'] = typo.letterSpacingTablet + lsu;
41 if (typo.letterSpacingMobile !== '' && typo.letterSpacingMobile != null) s[prefix + 'letter-spacing-m'] = typo.letterSpacingMobile + lsu;
42 var wsu = typo.wordSpacingUnit || 'px';
43 if (typo.wordSpacingDesktop !== '' && typo.wordSpacingDesktop != null) s[prefix + 'word-spacing-d'] = typo.wordSpacingDesktop + wsu;
44 if (typo.wordSpacingTablet !== '' && typo.wordSpacingTablet != null) s[prefix + 'word-spacing-t'] = typo.wordSpacingTablet + wsu;
45 if (typo.wordSpacingMobile !== '' && typo.wordSpacingMobile != null) s[prefix + 'word-spacing-m'] = typo.wordSpacingMobile + wsu;
46 return s;
47 }
48
49 /* ── BMI calculation helpers ───────────────────────────────────────────── */
50 function calcBMI(system, weightKg, heightCm, weightLbs, heightFt, heightIn) {
51 var bmi;
52 if (system === 'metric') {
53 var hM = heightCm / 100;
54 bmi = hM > 0 ? weightKg / (hM * hM) : 0;
55 } else {
56 var totalIn = heightFt * 12 + heightIn;
57 bmi = totalIn > 0 ? (703 * weightLbs) / (totalIn * totalIn) : 0;
58 }
59 return Math.round(bmi * 10) / 10;
60 }
61
62 function bmiCategory(bmi) {
63 if (bmi < 18.5) return 'underweight';
64 if (bmi < 25) return 'normal';
65 if (bmi < 30) return 'overweight';
66 return 'obese';
67 }
68
69 function bmiNeedle(bmi) {
70 // Maps bmi 10-40+ to 0-100%
71 var clamped = Math.min(Math.max(bmi, 10), 40);
72 return ((clamped - 10) / 30) * 100;
73 }
74
75 /* ── BMI Preview Component ──────────────────────────────────────────────── */
76 function BMIPreview(props) {
77 var a = props.attrs;
78 var sys = useState(a.unitSystem || 'metric');
79 var system = sys[0]; var setSystem = sys[1];
80
81 var wkg = useState(a.weightDefaultKg || 70);
82 var weightKg = wkg[0]; var setWeightKg = wkg[1];
83 var hcm = useState(a.heightDefaultCm || 170);
84 var heightCm = hcm[0]; var setHeightCm = hcm[1];
85 var wlbs = useState(a.weightDefaultLbs || 154);
86 var weightLbs = wlbs[0]; var setWeightLbs = wlbs[1];
87 var hft = useState(a.heightDefaultFt || 5);
88 var heightFt = hft[0]; var setHeightFt = hft[1];
89 var hin = useState(a.heightDefaultIn || 7);
90 var heightIn = hin[0]; var setHeightIn = hin[1];
91
92 var bmi = calcBMI(system, weightKg, heightCm, weightLbs, heightFt, heightIn);
93 var cat = bmiCategory(bmi);
94 var pct = bmiNeedle(bmi);
95
96 var catColors = {
97 underweight: a.underweightColor || '#3b82f6',
98 normal: a.normalColor || '#10b981',
99 overweight: a.overweightColor || '#f59e0b',
100 obese: a.obeseColor || '#ef4444',
101 };
102 var catLabels = {
103 underweight: __('Underweight', 'blockenberg'),
104 normal: __('Normal', 'blockenberg'),
105 overweight: __('Overweight', 'blockenberg'),
106 obese: __('Obese', 'blockenberg'),
107 };
108 var catColor = catColors[cat];
109
110 var idealMin = system === 'metric'
111 ? (18.5 * Math.pow(heightCm / 100, 2)).toFixed(1)
112 : ((18.5 * Math.pow(heightFt * 12 + heightIn, 2)) / 703).toFixed(1);
113 var idealMax = system === 'metric'
114 ? (24.9 * Math.pow(heightCm / 100, 2)).toFixed(1)
115 : ((24.9 * Math.pow(heightFt * 12 + heightIn, 2)) / 703).toFixed(1);
116
117 var cardStyle = {
118 background: a.cardBg || '#ffffff',
119 borderRadius: (a.cardRadius || 16) + 'px',
120 padding: '32px',
121 boxShadow: '0 4px 24px rgba(0,0,0,0.08)',
122 maxWidth: (a.maxWidth || 680) + 'px',
123 margin: '0 auto',
124 paddingTop: (a.paddingTop || 60) + 'px',
125 paddingBottom:(a.paddingBottom || 60) + 'px',
126 boxSizing: 'border-box',
127 };
128 if (a.bgColor) cardStyle.background = a.bgColor;
129
130 return el(Fragment, null,
131 el('div', { style: cardStyle },
132
133 /* title */
134 a.showTitle && el('h2', {
135 className: 'bkbg-bmi-title',
136 style: { color: a.titleColor || '#1e1b4b', textAlign: 'center', marginTop: 0, marginBottom: 8 }
137 }, a.title || __('BMI Calculator', 'blockenberg')),
138 a.showSubtitle && el('p', {
139 style: { color: a.subtitleColor || '#6b7280', textAlign: 'center', marginTop: 0, marginBottom: 28 }
140 }, a.subtitle || ''),
141
142 /* unit toggle */
143 a.showUnitToggle && el('div', { style: { display: 'flex', justifyContent: 'center', gap: '8px', marginBottom: '24px' } },
144 ['metric', 'imperial'].map(function(s) {
145 return el('button', {
146 key: s,
147 onClick: function() { setSystem(s); },
148 style: {
149 padding: '6px 18px',
150 borderRadius: (a.btnRadius || 8) + 'px',
151 border: 'none',
152 cursor: 'pointer',
153 fontWeight: 600,
154 fontSize: '14px',
155 background: system === s ? (a.accentColor || '#6c3fb5') : '#f3f4f6',
156 color: system === s ? '#ffffff' : '#374151',
157 transition: 'all 0.2s',
158 }
159 }, s === 'metric' ? __('Metric (kg/cm)', 'blockenberg') : __('Imperial (lbs/ft)', 'blockenberg'));
160 })
161 ),
162
163 /* inputs */
164 el('div', { style: { display: 'grid', gridTemplateColumns: system === 'imperial' ? '1fr 1fr 1fr' : '1fr 1fr', gap: '16px', marginBottom: '24px' } },
165 system === 'metric'
166 ? el(Fragment, null,
167 el('div', null,
168 el('label', { style: { display: 'block', color: a.labelColor || '#374151', fontSize: '13px', fontWeight: 600, marginBottom: '6px' } }, __('Weight (kg)', 'blockenberg')),
169 el('input', { type: 'number', className: 'bkbg-bmi-input', value: weightKg, min: a.weightMinKg || 20, max: a.weightMaxKg || 200,
170 onChange: function(e) { setWeightKg(Number(e.target.value)); },
171 style: { width: '100%', padding: '10px 12px', borderRadius: '8px', border: '1.5px solid #e5e7eb', fontSize: '16px', boxSizing: 'border-box' }
172 })
173 ),
174 el('div', null,
175 el('label', { style: { display: 'block', color: a.labelColor || '#374151', fontSize: '13px', fontWeight: 600, marginBottom: '6px' } }, __('Height (cm)', 'blockenberg')),
176 el('input', { type: 'number', className: 'bkbg-bmi-input', value: heightCm, min: a.heightMinCm || 100, max: a.heightMaxCm || 220,
177 onChange: function(e) { setHeightCm(Number(e.target.value)); },
178 style: { width: '100%', padding: '10px 12px', borderRadius: '8px', border: '1.5px solid #e5e7eb', fontSize: '16px', boxSizing: 'border-box' }
179 })
180 )
181 )
182 : el(Fragment, null,
183 el('div', null,
184 el('label', { style: { display: 'block', color: a.labelColor || '#374151', fontSize: '13px', fontWeight: 600, marginBottom: '6px' } }, __('Weight (lbs)', 'blockenberg')),
185 el('input', { type: 'number', className: 'bkbg-bmi-input', value: weightLbs, min: a.weightMinLbs || 44, max: a.weightMaxLbs || 440,
186 onChange: function(e) { setWeightLbs(Number(e.target.value)); },
187 style: { width: '100%', padding: '10px 12px', borderRadius: '8px', border: '1.5px solid #e5e7eb', fontSize: '16px', boxSizing: 'border-box' }
188 })
189 ),
190 el('div', null,
191 el('label', { style: { display: 'block', color: a.labelColor || '#374151', fontSize: '13px', fontWeight: 600, marginBottom: '6px' } }, __('Height (ft)', 'blockenberg')),
192 el('input', { type: 'number', className: 'bkbg-bmi-input', value: heightFt, min: 3, max: 8,
193 onChange: function(e) { setHeightFt(Number(e.target.value)); },
194 style: { width: '100%', padding: '10px 12px', borderRadius: '8px', border: '1.5px solid #e5e7eb', fontSize: '16px', boxSizing: 'border-box' }
195 })
196 ),
197 el('div', null,
198 el('label', { style: { display: 'block', color: a.labelColor || '#374151', fontSize: '13px', fontWeight: 600, marginBottom: '6px' } }, __('Height (in)', 'blockenberg')),
199 el('input', { type: 'number', className: 'bkbg-bmi-input', value: heightIn, min: 0, max: 11,
200 onChange: function(e) { setHeightIn(Number(e.target.value)); },
201 style: { width: '100%', padding: '10px 12px', borderRadius: '8px', border: '1.5px solid #e5e7eb', fontSize: '16px', boxSizing: 'border-box' }
202 })
203 )
204 )
205 ),
206
207 /* Result */
208 el('div', {
209 style: {
210 background: a.resultBg || '#f5f3ff',
211 border: '1.5px solid ' + (a.resultBorder || '#ede9fe'),
212 borderRadius: (a.cardRadius || 16) + 'px',
213 padding: '24px',
214 textAlign: 'center',
215 }
216 },
217 /* Large BMI number */
218 el('div', { className: 'bkbg-bmi-number', style: { color: catColor, marginBottom: '4px' } }, bmi.toFixed(1)),
219 el('div', { style: { fontSize: '18px', fontWeight: 700, color: catColor, marginBottom: '16px' } }, catLabels[cat]),
220
221 /* Gauge bar */
222 a.showGauge && el('div', { style: { margin: '0 auto 16px', maxWidth: '380px' } },
223 el('div', { style: { position: 'relative', height: '16px', borderRadius: '99px', overflow: 'hidden', background: 'linear-gradient(to right, ' + (a.underweightColor || '#3b82f6') + ' 0%, ' + (a.normalColor || '#10b981') + ' 30%, ' + (a.overweightColor || '#f59e0b') + ' 60%, ' + (a.obeseColor || '#ef4444') + ' 100%)' } },
224 el('div', {
225 style: {
226 position: 'absolute',
227 left: pct + '%',
228 top: '-2px',
229 transform: 'translateX(-50%)',
230 width: '20px',
231 height: '20px',
232 borderRadius: '50%',
233 background: '#fff',
234 border: '3px solid ' + catColor,
235 boxShadow: '0 2px 6px rgba(0,0,0,0.2)',
236 transition: 'left 0.4s ease',
237 }
238 })
239 ),
240 el('div', { style: { display: 'flex', justifyContent: 'space-between', fontSize: '11px', color: '#9ca3af', marginTop: '4px' } },
241 el('span', null, '10'),
242 el('span', null, '18.5'),
243 el('span', null, '25'),
244 el('span', null, '30'),
245 el('span', null, '40+')
246 )
247 ),
248
249 /* Category legend */
250 a.showCategories && el('div', { style: { display: 'flex', justifyContent: 'center', gap: '12px', flexWrap: 'wrap', marginBottom: '12px' } },
251 Object.entries(catColors).map(function(entry) {
252 return el('div', { key: entry[0], style: { display: 'flex', alignItems: 'center', gap: '5px', fontSize: '12px' } },
253 el('span', { style: { width: '10px', height: '10px', borderRadius: '50%', background: entry[1], display: 'inline-block' } }),
254 el('span', null, catLabels[entry[0]])
255 );
256 })
257 ),
258
259 /* Ideal weight */
260 a.showIdealWeight && el('p', { style: { margin: '12px 0 0', color: '#6b7280', fontSize: '13px' } },
261 __('Ideal weight range: ', 'blockenberg'),
262 el('strong', null, system === 'metric' ? idealMin + '' + idealMax + ' kg' : idealMin + '' + idealMax + ' lbs')
263 ),
264
265 /* Interpretation */
266 a.showInterpretation && el('p', { style: { margin: '8px 0 0', color: catColor, fontWeight: 600, fontSize: '14px' } },
267 cat === 'underweight' ? __('Consider speaking with a healthcare professional about healthy weight gain.', 'blockenberg')
268 : cat === 'normal' ? __('Great job! You are in a healthy weight range.', 'blockenberg')
269 : cat === 'overweight' ? __('Small lifestyle changes can bring you into a healthy range.', 'blockenberg')
270 : __('Consult a healthcare professional for personalized guidance.', 'blockenberg')
271 )
272 ),
273
274 /* Disclaimer */
275 a.showDisclaimer && el('p', { style: { color: '#9ca3af', fontSize: '12px', textAlign: 'center', marginTop: '16px', marginBottom: 0 } }, a.disclaimer)
276 )
277 );
278 }
279
280 registerBlockType('blockenberg/bmi-calculator', {
281 edit: function(props) {
282 var a = props.attributes;
283 var setAttr = props.setAttributes;
284
285 var blockProps = useBlockProps({ style: Object.assign({ background: a.bgColor || undefined }, _tv(a.typoTitle, '--bkbg-bmi-title-'), _tv(a.typoBmi, '--bkbg-bmi-number-')) });
286
287 return el(Fragment, null,
288 el(InspectorControls, null,
289
290 /* Content */
291 el(PanelBody, { title: __('Content', 'blockenberg'), initialOpen: true },
292 el(ToggleControl, { label: __('Show Title', 'blockenberg'), checked: a.showTitle, onChange: function(v) { setAttr({ showTitle: v }); }, __nextHasNoMarginBottom: true }),
293 a.showTitle && el(TextControl, { label: __('Title', 'blockenberg'), value: a.title, onChange: function(v) { setAttr({ title: v }); } }),
294 el(ToggleControl, { label: __('Show Subtitle', 'blockenberg'), checked: a.showSubtitle, onChange: function(v) { setAttr({ showSubtitle: v }); }, __nextHasNoMarginBottom: true }),
295 a.showSubtitle && el(TextControl, { label: __('Subtitle', 'blockenberg'), value: a.subtitle, onChange: function(v) { setAttr({ subtitle: v }); } }),
296 el(SelectControl, { label: __('Default Unit System', 'blockenberg'), value: a.unitSystem, options: [{ label: __('Metric (kg / cm)', 'blockenberg'), value: 'metric' }, { label: __('Imperial (lbs / ft-in)', 'blockenberg'), value: 'imperial' }], onChange: function(v) { setAttr({ unitSystem: v }); } }),
297 el(ToggleControl, { label: __('Show Unit Toggle', 'blockenberg'), checked: a.showUnitToggle, onChange: function(v) { setAttr({ showUnitToggle: v }); }, __nextHasNoMarginBottom: true })
298 ),
299
300 /* Defaults metric */
301 el(PanelBody, { title: __('Metric Defaults', 'blockenberg'), initialOpen: false },
302 el(RangeControl, { label: __('Default Weight (kg)', 'blockenberg'), value: a.weightDefaultKg, min: 20, max: 200, onChange: function(v) { setAttr({ weightDefaultKg: v }); } }),
303 el(RangeControl, { label: __('Default Height (cm)', 'blockenberg'), value: a.heightDefaultCm, min: 100, max: 220, onChange: function(v) { setAttr({ heightDefaultCm: v }); } })
304 ),
305
306 /* Defaults imperial */
307 el(PanelBody, { title: __('Imperial Defaults', 'blockenberg'), initialOpen: false },
308 el(RangeControl, { label: __('Default Weight (lbs)', 'blockenberg'), value: a.weightDefaultLbs, min: 44, max: 440, onChange: function(v) { setAttr({ weightDefaultLbs: v }); } }),
309 el(RangeControl, { label: __('Default Height (ft)', 'blockenberg'), value: a.heightDefaultFt, min: 3, max: 8, onChange: function(v) { setAttr({ heightDefaultFt: v }); } }),
310 el(RangeControl, { label: __('Default Height (in)', 'blockenberg'), value: a.heightDefaultIn, min: 0, max: 11, onChange: function(v) { setAttr({ heightDefaultIn: v }); } })
311 ),
312
313 /* Display options */
314 el(PanelBody, { title: __('Display Options', 'blockenberg'), initialOpen: false },
315 el(ToggleControl, { label: __('Show Gauge Bar', 'blockenberg'), checked: a.showGauge, onChange: function(v) { setAttr({ showGauge: v }); }, __nextHasNoMarginBottom: true }),
316 el(ToggleControl, { label: __('Show Category Legend', 'blockenberg'), checked: a.showCategories, onChange: function(v) { setAttr({ showCategories: v }); }, __nextHasNoMarginBottom: true }),
317 el(ToggleControl, { label: __('Show Interpretation Text', 'blockenberg'), checked: a.showInterpretation, onChange: function(v) { setAttr({ showInterpretation: v }); }, __nextHasNoMarginBottom: true }),
318 el(ToggleControl, { label: __('Show Ideal Weight Range', 'blockenberg'), checked: a.showIdealWeight, onChange: function(v) { setAttr({ showIdealWeight: v }); }, __nextHasNoMarginBottom: true }),
319 el(ToggleControl, { label: __('Show Disclaimer', 'blockenberg'), checked: a.showDisclaimer, onChange: function(v) { setAttr({ showDisclaimer: v }); }, __nextHasNoMarginBottom: true }),
320 a.showDisclaimer && el(TextareaControl, { label: __('Disclaimer Text', 'blockenberg'), value: a.disclaimer, onChange: function(v) { setAttr({ disclaimer: v }); } })
321 ),
322
323 /* Colors */
324 el(PanelColorSettings, {
325 title: __('Colors', 'blockenberg'), initialOpen: false,
326 colorSettings: [
327 { label: __('Accent Color', 'blockenberg'), value: a.accentColor, onChange: function(v) { setAttr({ accentColor: v || '#6c3fb5' }); } },
328 { label: __('Underweight Color', 'blockenberg'), value: a.underweightColor, onChange: function(v) { setAttr({ underweightColor: v || '#3b82f6' }); } },
329 { label: __('Normal Color', 'blockenberg'), value: a.normalColor, onChange: function(v) { setAttr({ normalColor: v || '#10b981' }); } },
330 { label: __('Overweight Color', 'blockenberg'), value: a.overweightColor, onChange: function(v) { setAttr({ overweightColor: v || '#f59e0b' }); } },
331 { label: __('Obese Color', 'blockenberg'), value: a.obeseColor, onChange: function(v) { setAttr({ obeseColor: v || '#ef4444' }); } },
332 { label: __('Card Background', 'blockenberg'), value: a.cardBg, onChange: function(v) { setAttr({ cardBg: v || '#ffffff' }); } },
333 { label: __('Result Background', 'blockenberg'), value: a.resultBg, onChange: function(v) { setAttr({ resultBg: v || '#f5f3ff' }); } },
334 { label: __('Section Background', 'blockenberg'), value: a.bgColor, onChange: function(v) { setAttr({ bgColor: v || '' }); } },
335 ]
336 }),
337 /* Typography */
338 el(PanelBody, { title: __('Typography', 'blockenberg'), initialOpen: false },
339 el(getTypographyControl(), { label: __('Title', 'blockenberg'), value: a.typoTitle, onChange: function(v) { setAttr({ typoTitle: v }); } }),
340 el(getTypographyControl(), { label: __('BMI Number', 'blockenberg'), value: a.typoBmi, onChange: function(v) { setAttr({ typoBmi: v }); } })
341 ),
342 el(PanelBody, { title: __('Appearance', 'blockenberg'), initialOpen: false },
343 el(RangeControl, { label: __('Card Radius (px)', 'blockenberg'), value: a.cardRadius, min: 0, max: 40, onChange: function(v) { setAttr({ cardRadius: v }); } }),
344 el(RangeControl, { label: __('Button Radius (px)', 'blockenberg'), value: a.btnRadius, min: 0, max: 40, onChange: function(v) { setAttr({ btnRadius: v }); } }),
345 el(RangeControl, { label: __('Max Width (px)', 'blockenberg'), value: a.maxWidth, min: 400, max: 1200, onChange: function(v) { setAttr({ maxWidth: v }); } }),
346 el(RangeControl, { label: __('Padding Top (px)', 'blockenberg'), value: a.paddingTop, min: 0, max: 160, onChange: function(v) { setAttr({ paddingTop: v }); } }),
347 el(RangeControl, { label: __('Padding Bottom (px)', 'blockenberg'), value: a.paddingBottom, min: 0, max: 160, onChange: function(v) { setAttr({ paddingBottom: v }); } })
348 )
349 ),
350
351 el('div', blockProps,
352 el(BMIPreview, { attrs: a })
353 )
354 );
355 },
356
357 save: function(props) {
358 var a = props.attributes;
359 var blockProps = wp.blockEditor.useBlockProps.save({ style: { background: a.bgColor || undefined } });
360
361 var opts = JSON.stringify({
362 unitSystem: a.unitSystem,
363 showUnitToggle: a.showUnitToggle,
364 weightDefaultKg: a.weightDefaultKg,
365 weightMinKg: a.weightMinKg,
366 weightMaxKg: a.weightMaxKg,
367 heightDefaultCm: a.heightDefaultCm,
368 heightMinCm: a.heightMinCm,
369 heightMaxCm: a.heightMaxCm,
370 weightDefaultLbs: a.weightDefaultLbs,
371 weightMinLbs: a.weightMinLbs,
372 weightMaxLbs: a.weightMaxLbs,
373 heightDefaultFt: a.heightDefaultFt,
374 heightDefaultIn: a.heightDefaultIn,
375 showGauge: a.showGauge,
376 showCategories: a.showCategories,
377 showInterpretation: a.showInterpretation,
378 showIdealWeight: a.showIdealWeight,
379 showDisclaimer: a.showDisclaimer,
380 disclaimer: a.disclaimer,
381 underweightColor: a.underweightColor,
382 normalColor: a.normalColor,
383 overweightColor: a.overweightColor,
384 obeseColor: a.obeseColor,
385 accentColor: a.accentColor,
386 cardBg: a.cardBg,
387 resultBg: a.resultBg,
388 resultBorder: a.resultBorder,
389 titleColor: a.titleColor,
390 subtitleColor: a.subtitleColor,
391 labelColor: a.labelColor,
392 titleSize: a.titleSize,
393 bmiSize: a.bmiSize,
394 cardRadius: a.cardRadius,
395 btnRadius: a.btnRadius,
396 maxWidth: a.maxWidth,
397 paddingTop: a.paddingTop,
398 paddingBottom: a.paddingBottom,
399 typoTitle: a.typoTitle,
400 typoBmi: a.typoBmi,
401 });
402
403 return el('div', blockProps,
404 el('div', {
405 className: 'bkbg-bmi-app',
406 'data-opts': opts,
407 },
408 a.showTitle && el('h2', { className: 'bkbg-bmi-title', style: { color: a.titleColor } }, a.title),
409 a.showSubtitle && el('p', { className: 'bkbg-bmi-subtitle', style: { color: a.subtitleColor } }, a.subtitle),
410 el('p', { className: 'bkbg-bmi-loading' }, __('Loading calculator…', 'blockenberg'))
411 )
412 );
413 }
414 });
415 }() );
416