@nascentdigital/funnel-ui 4.6.1 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/client/fields/EmbeddedVideo/EmbeddedVideo.d.ts +2 -2
  2. package/dist/client/fields/EmbeddedVideo/EmbeddedVideo.js +3 -3
  3. package/dist/client/fields/EmbeddedVideo/vimeo/VimeoVideo.d.ts +3 -3
  4. package/dist/client/fields/EmbeddedVideo/vimeo/VimeoVideo.js +4 -3
  5. package/dist/client/fields/EmbeddedVideo/youtube/YoutubeVideo.d.ts +3 -3
  6. package/dist/client/fields/EmbeddedVideo/youtube/YoutubeVideo.js +4 -3
  7. package/dist/client/fields/LazyVideo.d.ts +6 -1
  8. package/dist/client/fields/LazyVideo.js +6 -4
  9. package/dist/client/hooks/useTouch.js +1 -0
  10. package/dist/client/interaction/paginator/Paginator.js +0 -1
  11. package/dist/server/blocks/Block.d.ts +82 -14
  12. package/dist/server/blocks/Block.js +782 -61
  13. package/dist/server/blocks/MediaLayout.d.ts +23 -4
  14. package/dist/server/blocks/MediaLayout.js +2 -12
  15. package/dist/server/blocks/RelatedPages.d.ts +2 -0
  16. package/dist/server/blocks/RelatedPages.js +4 -4
  17. package/dist/server/fields/Media.d.ts +79 -0
  18. package/dist/server/fields/Media.js +174 -0
  19. package/dist/server/fields/Visual.d.ts +7 -2
  20. package/dist/server/fields/Visual.js +9 -5
  21. package/dist/server/fields/index.d.ts +1 -0
  22. package/dist/server/fields/index.js +1 -0
  23. package/dist/server/index.d.ts +1 -0
  24. package/dist/server/index.js +1 -0
  25. package/dist/server/layouts/accordion/Accordion.d.ts +21 -0
  26. package/dist/server/layouts/accordion/Accordion.js +66 -0
  27. package/dist/server/layouts/accordion/AccordionContainer.d.ts +5 -0
  28. package/dist/server/layouts/accordion/AccordionContainer.js +18 -0
  29. package/dist/server/layouts/accordion/AccordionContext.d.ts +7 -0
  30. package/dist/server/layouts/accordion/AccordionContext.js +7 -0
  31. package/dist/server/layouts/accordion/AccordionExpander.d.ts +9 -0
  32. package/dist/server/layouts/accordion/AccordionExpander.js +72 -0
  33. package/dist/server/layouts/accordion/AccordionItem.d.ts +8 -0
  34. package/dist/server/layouts/accordion/AccordionItem.js +22 -0
  35. package/dist/server/layouts/accordion/AccordionLayout.d.ts +7 -0
  36. package/dist/server/layouts/accordion/AccordionLayout.js +26 -0
  37. package/dist/server/layouts/accordion/AccordionOptions.d.ts +3 -0
  38. package/dist/server/layouts/accordion/AccordionOptions.js +2 -0
  39. package/dist/server/layouts/accordion/index.d.ts +3 -0
  40. package/dist/server/layouts/accordion/index.js +19 -0
  41. package/dist/server/layouts/accordion/useAccordion.d.ts +1 -0
  42. package/dist/server/layouts/accordion/useAccordion.js +34 -0
  43. package/dist/server/layouts/index.d.ts +2 -1
  44. package/dist/server/layouts/index.js +2 -1
  45. package/dist/server/panels/BlockPanel.d.ts +14 -77
  46. package/dist/server/panels/BlockPanel.js +46 -702
  47. package/dist/server/panels/ListPanel.js +6 -3
  48. package/dist/server/panels/MessagePanel.js +33 -33
  49. package/dist/server/panels/VisualPanel.d.ts +58 -10
  50. package/dist/server/panels/VisualPanel.js +155 -79
  51. package/dist/server/schema/ListPanelLayout.d.ts +1 -0
  52. package/dist/server/schema/ListPanelLayout.js +1 -0
  53. package/dist/server/schema/RowRatio.d.ts +7 -0
  54. package/dist/server/schema/RowRatio.js +26 -0
  55. package/dist/server/schema/index.d.ts +1 -0
  56. package/dist/server/schema/index.js +1 -0
  57. package/dist/styles/blocks/Block-layout.css +88 -47
  58. package/dist/styles/blocks/Editorial.css +2 -2
  59. package/dist/styles/blocks/Form.css +2 -2
  60. package/dist/styles/blocks/MediaLayout.css +1 -1
  61. package/dist/styles/components/container.css +3 -24
  62. package/dist/styles/components/embed/YoutubePlayer.css +1 -1
  63. package/dist/styles/fields/Media.css +37 -0
  64. package/dist/styles/fields/_index.css +1 -0
  65. package/dist/styles/layouts/Accordion.css +29 -0
  66. package/dist/styles/layouts/_index.css +2 -1
  67. package/dist/styles/panels/VisualPanel.css +2 -1
  68. package/package.json +2 -2
@@ -50,41 +50,6 @@ function Block(_a) {
50
50
  }
51
51
  // extension
52
52
  (function (Block) {
53
- function createSchema({ id, name, version, hint, message, visual, list, extendConfigSchema }) {
54
- // build fields schema and panel key mapping
55
- let fieldsSchema = {};
56
- const panelKeyMapping = {};
57
- if (message) {
58
- fieldsSchema = Object.assign(Object.assign({}, fieldsSchema), panels_1.MessagePanel.Fields.all);
59
- panelKeyMapping.messageKey = 'message';
60
- }
61
- if (visual) {
62
- fieldsSchema = Object.assign(Object.assign({}, fieldsSchema), panels_1.VisualPanel.Fields.all);
63
- panelKeyMapping.visualKey = 'visual';
64
- }
65
- if (list) {
66
- fieldsSchema = Object.assign(Object.assign({}, fieldsSchema), { list });
67
- panelKeyMapping.listKey = 'list';
68
- }
69
- // create config schema
70
- const configSchema = panels_1.BlockPanel.getConfigSchema(Object.assign(Object.assign({ fields: fieldsSchema }, panelKeyMapping), { extend: extendConfigSchema }));
71
- // create block schema
72
- const schema = funnel_core_1.Schema.Block.create({
73
- id,
74
- name,
75
- version,
76
- hint,
77
- config: configSchema,
78
- fields: fieldsSchema,
79
- getConfig: args => panels_1.BlockPanel.getConfig(Object.assign({ args }, panelKeyMapping)),
80
- getLayout: args => panels_1.BlockPanel.getLayout(Object.assign({ args }, panelKeyMapping))
81
- });
82
- // return
83
- return {
84
- schema: schema,
85
- panelKeyMapping
86
- };
87
- }
88
53
  function create(args) {
89
54
  // create schema
90
55
  const { schema, panelKeyMapping } = createSchema(args);
@@ -97,28 +62,31 @@ function Block(_a) {
97
62
  return null;
98
63
  }
99
64
  // layout
100
- const blockLayout = panels_1.BlockPanel.getLayout(Object.assign({ args: {
65
+ const blockLayout = getLayout(Object.assign({ args: {
101
66
  fields: (_a = props.model.fields) !== null && _a !== void 0 ? _a : {},
102
67
  config: (_b = props.model.config) !== null && _b !== void 0 ? _b : {}
103
68
  } }, panelKeyMapping));
104
69
  const getPanel = ({ className, panel }) => {
105
- var _a, _b, _c, _d, _e, _f, _g, _h;
70
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
106
71
  switch (panel.type) {
72
+ // message panel
107
73
  case 'message': {
108
74
  const { model: { fields }, messagePanelProps } = props;
109
- const _j = messagePanelProps !== null && messagePanelProps !== void 0 ? messagePanelProps : {}, { className: panelClassName } = _j, panelProps = __rest(_j, ["className"]);
75
+ const _o = messagePanelProps !== null && messagePanelProps !== void 0 ? messagePanelProps : {}, { className: panelClassName } = _o, panelProps = __rest(_o, ["className"]);
110
76
  return ((0, jsx_runtime_1.jsx)(panels_1.MessagePanel, Object.assign({ className: (0, classnames_1.default)(className, panelClassName), panel: panel, title: (_a = fields === null || fields === void 0 ? void 0 : fields.title) === null || _a === void 0 ? void 0 : _a.value, headline: (_b = fields === null || fields === void 0 ? void 0 : fields.headline) === null || _b === void 0 ? void 0 : _b.value, caption: (_c = fields === null || fields === void 0 ? void 0 : fields.caption) === null || _c === void 0 ? void 0 : _c.value, ctas: (_d = fields === null || fields === void 0 ? void 0 : fields.ctas) === null || _d === void 0 ? void 0 : _d.value }, panelProps)));
111
77
  }
78
+ // visual panel
112
79
  case 'visual': {
113
80
  const { model: { fields, config }, visualPanelProps } = props;
114
- const _k = visualPanelProps !== null && visualPanelProps !== void 0 ? visualPanelProps : {}, { className: panelClassName } = _k, panelProps = __rest(_k, ["className"]);
115
- return ((0, jsx_runtime_1.jsx)(panels_1.VisualPanel, Object.assign({ className: (0, classnames_1.default)(className, panelClassName), panel: panel, visual: (_e = fields === null || fields === void 0 ? void 0 : fields.visual) === null || _e === void 0 ? void 0 : _e.value, anchor: (_f = funnel_core_1.Schema.EnumField.Value.fromData(config === null || config === void 0 ? void 0 : config.visualAnchor)) !== null && _f !== void 0 ? _f : 'center' }, panelProps)));
81
+ const _p = visualPanelProps !== null && visualPanelProps !== void 0 ? visualPanelProps : {}, { className: panelClassName } = _p, panelProps = __rest(_p, ["className"]);
82
+ return ((0, jsx_runtime_1.jsx)(panels_1.VisualPanel, Object.assign({ className: (0, classnames_1.default)(className, panelClassName), panel: panel, visual: (_e = fields === null || fields === void 0 ? void 0 : fields.visual) === null || _e === void 0 ? void 0 : _e.value, anchor: (_f = funnel_core_1.Schema.EnumField.Value.fromData(config === null || config === void 0 ? void 0 : config.visualAnchor)) !== null && _f !== void 0 ? _f : 'center', controls: (_g = funnel_core_1.Schema.BooleanField.Value.fromData(config === null || config === void 0 ? void 0 : config.visualControls)) !== null && _g !== void 0 ? _g : true, autoPlay: (_h = funnel_core_1.Schema.BooleanField.Value.fromData(config === null || config === void 0 ? void 0 : config.visualAutoPlay)) !== null && _h !== void 0 ? _h : false, loop: (_j = funnel_core_1.Schema.BooleanField.Value.fromData(config === null || config === void 0 ? void 0 : config.visualLoop)) !== null && _j !== void 0 ? _j : false, mute: (_k = funnel_core_1.Schema.BooleanField.Value.fromData(config === null || config === void 0 ? void 0 : config.visualMute)) !== null && _k !== void 0 ? _k : false }, panelProps)));
116
83
  }
84
+ // list panel
117
85
  case 'list': {
118
86
  const { model: { fields, config }, listPanelProps, children } = props;
119
- const _l = listPanelProps !== null && listPanelProps !== void 0 ? listPanelProps : {}, { className: panelClassName, itemProps } = _l, panelProps = __rest(_l, ["className", "itemProps"]);
120
- const listLayout = (_g = funnel_core_1.Schema.EnumField.Value.fromData(config === null || config === void 0 ? void 0 : config.listLayout)) !== null && _g !== void 0 ? _g : 'card';
121
- return ((0, jsx_runtime_1.jsx)(panels_1.ListPanel, Object.assign({ className: (0, classnames_1.default)(className, panelClassName), panel: panel, layout: listLayout, items: (_h = fields === null || fields === void 0 ? void 0 : fields.list) === null || _h === void 0 ? void 0 : _h.value }, panelProps, { children: item => children({ item, itemProps, listLayout, blockLayout }) })));
87
+ const _q = listPanelProps !== null && listPanelProps !== void 0 ? listPanelProps : {}, { className: panelClassName, itemProps } = _q, panelProps = __rest(_q, ["className", "itemProps"]);
88
+ const listLayout = (_l = funnel_core_1.Schema.EnumField.Value.fromData(config === null || config === void 0 ? void 0 : config.listLayout)) !== null && _l !== void 0 ? _l : 'card';
89
+ return ((0, jsx_runtime_1.jsx)(panels_1.ListPanel, Object.assign({ className: (0, classnames_1.default)(className, panelClassName), panel: panel, layout: listLayout, items: (_m = fields === null || fields === void 0 ? void 0 : fields.list) === null || _m === void 0 ? void 0 : _m.value }, panelProps, { children: item => children({ item, itemProps, listLayout, blockLayout }) })));
122
90
  }
123
91
  }
124
92
  };
@@ -132,24 +100,737 @@ function Block(_a) {
132
100
  };
133
101
  }
134
102
  Block.create = create;
135
- function filterNode(node) {
136
- return (0, react_1.isValidElement)(node)
137
- && !!node.props && typeof node.props === 'object' && !Array.isArray(node.props)
138
- && 'model' in node.props && !!node.props.model && typeof node.props.model === 'object' && !Array.isArray(node.props.model);
103
+ // create schema
104
+ function createSchema({ id, name, version, hint, message, visual, list, extendConfigSchema }) {
105
+ // build fields schema and panel key mapping
106
+ let fieldsSchema = {};
107
+ const panelKeyMapping = {};
108
+ if (message) {
109
+ fieldsSchema = Object.assign(Object.assign({}, fieldsSchema), panels_1.MessagePanel.Fields.all);
110
+ panelKeyMapping.messageKey = 'message';
111
+ }
112
+ if (visual) {
113
+ fieldsSchema = Object.assign(Object.assign({}, fieldsSchema), panels_1.VisualPanel.Fields.all);
114
+ panelKeyMapping.visualKey = 'visual';
115
+ }
116
+ if (list) {
117
+ fieldsSchema = Object.assign(Object.assign({}, fieldsSchema), { list });
118
+ panelKeyMapping.listKey = 'list';
119
+ }
120
+ // create config schema
121
+ const configSchema = getConfigSchema(Object.assign(Object.assign({ fields: fieldsSchema }, panelKeyMapping), { extend: extendConfigSchema }));
122
+ // create block schema
123
+ const schema = funnel_core_1.Schema.Block.create({
124
+ id,
125
+ name,
126
+ version,
127
+ hint,
128
+ config: configSchema,
129
+ fields: fieldsSchema,
130
+ getConfig: args => getConfig(Object.assign({ args }, panelKeyMapping)),
131
+ getLayout: args => getLayout(Object.assign({ args }, panelKeyMapping))
132
+ });
133
+ // return
134
+ return {
135
+ schema: schema,
136
+ panelKeyMapping
137
+ };
138
+ }
139
+ // config schema
140
+ let GetConfigSchema;
141
+ (function (GetConfigSchema) {
142
+ let Key;
143
+ (function (Key) {
144
+ // helper
145
+ function normalize(key) {
146
+ return typeof key === 'string'
147
+ ? { key, name: funnel_core_1.StringUtils.capitalize(key) }
148
+ : key;
149
+ }
150
+ Key.normalize = normalize;
151
+ })(Key = GetConfigSchema.Key || (GetConfigSchema.Key = {}));
152
+ })(GetConfigSchema = Block.GetConfigSchema || (Block.GetConfigSchema = {}));
153
+ function getConfigSchema({ extend, messageKey: messageKeyRaw, visualKey: visualKeyRaw, listKey: listKeyRaw }) {
154
+ // throw if there are not enough panels
155
+ const { key: messageKey, name: messageLabel } = messageKeyRaw === undefined
156
+ ? {}
157
+ : GetConfigSchema.Key.normalize(messageKeyRaw);
158
+ const { key: visualKey, name: visualLabel } = visualKeyRaw === undefined
159
+ ? {}
160
+ : GetConfigSchema.Key.normalize(visualKeyRaw);
161
+ const { key: listKey, name: listLabel } = listKeyRaw === undefined
162
+ ? {}
163
+ : GetConfigSchema.Key.normalize(listKeyRaw);
164
+ const panelCount = [messageKey, visualKey, listKey].filter(funnel_core_1.Value.isDefined).length;
165
+ if (panelCount === 0) {
166
+ throw new funnel_core_1.IllegalStateError('[BlockPanel.ts] There needs to be at least one panel');
167
+ }
168
+ // initialize config schema
169
+ const configSchema = Object.assign(Object.assign(Object.assign({}, schema_1.BlockConfig.Presets.ThemeOnly.schema), extend), { layout: schema_1.PanelLayout.schema.optional(), slotVariation: schema_1.SlotVariation.schema });
170
+ // TODO: runtime error for key not available in fields
171
+ // add schema for message
172
+ if (messageKey) {
173
+ const keys = panels_1.MessagePanel.Config.getKeys(messageKey);
174
+ configSchema[keys.textAlign] = schema_1.TextAlignment.schema
175
+ .rename(`${messageLabel} ${schema_1.TextAlignment.schema.name}`)
176
+ .optional();
177
+ configSchema[keys.width] =
178
+ schema_1.ItemSize.schema
179
+ .rename(`${messageLabel} ${schema_1.ItemSize.schema.name}`)
180
+ .optional();
181
+ configSchema[keys.horizontalAlign] =
182
+ schema_1.ItemAlignment
183
+ .Horizontal.schema.rename(`${messageLabel} ${schema_1.ItemAlignment.Horizontal.schema.name}`)
184
+ .optional();
185
+ configSchema[keys.verticalAlign] = schema_1.ItemAlignment.Vertical.schema.rename(`${messageLabel} ${schema_1.ItemAlignment.Vertical.schema.name}`).optional();
186
+ }
187
+ // add schema for list
188
+ if (listKey) {
189
+ const keys = panels_1.ListPanel.Config.getKeys(listKey);
190
+ configSchema[keys.layout] = schema_1.ListPanelLayout.schema.rename(`${listLabel} ${schema_1.ListPanelLayout.schema.name}`).optional();
191
+ configSchema[keys.width] = schema_1.ItemSize.schema.rename(`${listLabel} ${schema_1.ItemSize.schema.name}`).optional();
192
+ configSchema[keys.horizontalAlign] = schema_1.ItemAlignment
193
+ .Horizontal.schema
194
+ .rename(`${listLabel} ${schema_1.ItemAlignment.Horizontal.schema.name}`)
195
+ .optional();
196
+ configSchema[keys.verticalAlign] = schema_1.ItemAlignment
197
+ .Horizontal.schema
198
+ .rename(`${listLabel} ${schema_1.ItemAlignment.Vertical.schema.name}`)
199
+ .optional();
200
+ }
201
+ // add schema for visual
202
+ if (visualKey) {
203
+ const keys = panels_1.VisualPanel.Config.getKeys(visualKey);
204
+ configSchema[keys.aspect] = schema_1.AspectRatio.schema
205
+ .rename(`${visualLabel} ${schema_1.AspectRatio.schema.name}`)
206
+ .optional();
207
+ configSchema[keys.anchor] = schema_1.Anchor.schema
208
+ .rename(`${visualLabel} ${schema_1.Anchor.schema.name}`)
209
+ .optional();
210
+ configSchema[keys.width] =
211
+ schema_1.ItemSize.schema
212
+ .rename(`${visualLabel} ${schema_1.ItemSize.schema.name}`)
213
+ .optional();
214
+ configSchema[keys.horizontalAlign] =
215
+ schema_1.ItemAlignment
216
+ .Horizontal.schema.rename(`${visualLabel} ${schema_1.ItemAlignment.Horizontal.schema.name}`)
217
+ .optional();
218
+ configSchema[keys.controls] = funnel_core_1.Schema.Field.boolean({
219
+ name: 'Controls',
220
+ description: 'Display video controls so views can play/pause/seek content.',
221
+ defaultValue: true,
222
+ semantics: 'toggle'
223
+ }).optional();
224
+ configSchema[keys.autoPlay] = funnel_core_1.Schema.Field.boolean({
225
+ name: 'Autoplay',
226
+ description: 'Video will automatically play once it\'s ready.',
227
+ defaultValue: false,
228
+ semantics: 'toggle'
229
+ }).optional();
230
+ configSchema[keys.loop] = funnel_core_1.Schema.Field.boolean({
231
+ name: 'Loop',
232
+ description: 'Video will loop forever when enabled.',
233
+ defaultValue: false,
234
+ semantics: 'toggle'
235
+ }).optional();
236
+ configSchema[keys.mute] = funnel_core_1.Schema.Field.boolean({
237
+ name: 'Mute',
238
+ description: 'Audio will be silenced.',
239
+ defaultValue: true,
240
+ semantics: 'toggle'
241
+ }).optional();
242
+ }
243
+ // add content alignment/split if there are more than 2 panels
244
+ if (panelCount > 1) {
245
+ configSchema['contentAlign'] = schema_1.ItemAlignment.Vertical.schema.rename('Content Alignment').optional();
246
+ configSchema['contentSplit'] = schema_1.RowRatio.schema.rename('Content Split').optional();
247
+ }
248
+ // return
249
+ return configSchema;
250
+ }
251
+ Block.getConfigSchema = getConfigSchema;
252
+ function getConfig({ args, messageFieldKeys, messageKey, visualKey, listKey }) {
253
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
254
+ // throw if there are not enough panels
255
+ const panelCount = [messageKey, visualKey, listKey].filter(funnel_core_1.Value.isDefined).length;
256
+ if (panelCount === 0) {
257
+ throw new funnel_core_1.IllegalStateError('[BlockPanel.ts] There needs to be at least one panel');
258
+ }
259
+ // resolve props
260
+ const configSchema = args.configSchema;
261
+ const config = args.config;
262
+ const fields = args.fields;
263
+ const messageKeys = messageKey
264
+ ? panels_1.MessagePanel.Config.getKeys(messageKey)
265
+ : {};
266
+ const visualKeys = visualKey
267
+ ? panels_1.VisualPanel.Config.getKeys(visualKey)
268
+ : {};
269
+ const listKeys = listKey
270
+ ? panels_1.ListPanel.Config.getKeys(listKey)
271
+ : {};
272
+ const allKeys = [
273
+ ...Object.values(messageKeys),
274
+ ...Object.values(visualKeys),
275
+ ...Object.values(listKeys)
276
+ ];
277
+ // current config helpers
278
+ const visual = visualKey
279
+ ? fields[visualKey]
280
+ : undefined;
281
+ const panelInfo = getActivePanels({ fields: args.fields, messageFieldKeys, messageKey, visualKey, listKey });
282
+ const activePanels = {
283
+ message: panelInfo.message !== false,
284
+ visual: panelInfo.visual !== false,
285
+ list: panelInfo.list !== false,
286
+ };
287
+ // get layout schema
288
+ const layoutSchema = schema_1.PanelLayout.schemaForPanels(activePanels);
289
+ let layout = ((_b = (_a = config.layout) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 'solo');
290
+ layout = layoutSchema.isValidOption(layout)
291
+ ? layout
292
+ : layoutSchema.defaultOption;
293
+ const slotVariationSchema = schema_1.SlotVariation.schemaForLayout(layout);
294
+ let slotVariation = ((_d = (_c = config.slotVariation) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : 'v1');
295
+ slotVariation = slotVariationSchema.isValidOption(slotVariation)
296
+ ? slotVariation
297
+ : slotVariationSchema.defaultOption;
298
+ const items = panels_1.BlockPanel.Slots.Items.compute({
299
+ panels: activePanels,
300
+ layout,
301
+ variation: slotVariation
302
+ });
303
+ const flexDirections = panels_1.BlockPanel.Slots.getFlexDirections({ layout, items });
304
+ // extract message config
305
+ let messageConfig = undefined;
306
+ if (messageKey && activePanels.message) {
307
+ messageConfig = panels_1.MessagePanel.getConfig({
308
+ messageKey,
309
+ config: config,
310
+ fields: fields,
311
+ flexDirection: flexDirections.M
312
+ });
313
+ }
314
+ // extract visual config (if any)
315
+ let visualConfig = undefined;
316
+ if (visualKey && activePanels.visual) {
317
+ visualConfig = panels_1.VisualPanel.getConfig({
318
+ visualKey,
319
+ visual,
320
+ config: config,
321
+ flexDirection: flexDirections.V
322
+ });
323
+ }
324
+ // extract list config (if any)
325
+ let listConfig = undefined;
326
+ if (listKey && activePanels.list) {
327
+ listConfig = panels_1.ListPanel.getConfig({
328
+ listKey,
329
+ config: config,
330
+ flexDirection: flexDirections.L
331
+ });
332
+ }
333
+ // create new schema
334
+ const updatedConfigSchema = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, Object.entries(configSchema)
335
+ .reduce((configSchema, [key, fieldSchema]) => {
336
+ // add the config back if it's not in the panel config keys
337
+ if (!allKeys.includes(key)) {
338
+ configSchema[key] = fieldSchema;
339
+ }
340
+ // keep reducing
341
+ return configSchema;
342
+ }, {})), messageConfig === null || messageConfig === void 0 ? void 0 : messageConfig.configSchema), visualConfig === null || visualConfig === void 0 ? void 0 : visualConfig.configSchema), listConfig === null || listConfig === void 0 ? void 0 : listConfig.configSchema), { layout: layoutSchema, slotVariation: slotVariationSchema });
343
+ // drop content alignment if it's not applicable
344
+ if (!panels_1.BlockPanel.Slots.contentAlignmentExists(layout)) {
345
+ delete updatedConfigSchema.contentAlign;
346
+ }
347
+ // drop layout/content split if not applicable
348
+ if (panelCount < 2) {
349
+ delete updatedConfigSchema.layout;
350
+ delete updatedConfigSchema.contentSplit;
351
+ }
352
+ // create default config
353
+ const defaultConfig = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, config), { theme: funnel_core_1.Schema.EnumField.Value.toData('default'), contentAlign: funnel_core_1.Schema.EnumField.Value.toData('start'), contentSplit: funnel_core_1.Schema.EnumField.Value.toData('1/1') }), messageConfig === null || messageConfig === void 0 ? void 0 : messageConfig.defaultConfig), visualConfig === null || visualConfig === void 0 ? void 0 : visualConfig.defaultConfig), listConfig === null || listConfig === void 0 ? void 0 : listConfig.defaultConfig), { layout: funnel_core_1.Schema.EnumField.Value.toData((_e = layoutSchema.defaultOption) !== null && _e !== void 0 ? _e : 'solo'), slotVariation: funnel_core_1.Schema.EnumField.Value.toData((_f = slotVariationSchema.defaultOption) !== null && _f !== void 0 ? _f : 'v1') });
354
+ const contentAlign = ((_h = (_g = config.contentAlign) === null || _g === void 0 ? void 0 : _g.value) !== null && _h !== void 0 ? _h : 'start');
355
+ const contentSplit = ((_k = (_j = config.contentSplit) === null || _j === void 0 ? void 0 : _j.value) !== null && _k !== void 0 ? _k : '1/1');
356
+ // create new config
357
+ const updatedConfig = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, config), messageConfig === null || messageConfig === void 0 ? void 0 : messageConfig.config), visualConfig === null || visualConfig === void 0 ? void 0 : visualConfig.config), listConfig === null || listConfig === void 0 ? void 0 : listConfig.config), { layout: funnel_core_1.Schema.EnumField.Value.toData(layout), slotVariation: funnel_core_1.Schema.EnumField.Value.toData(slotVariation), contentAlign: funnel_core_1.Schema.EnumField.Value.toData(contentAlign), contentSplit: funnel_core_1.Schema.EnumField.Value.toData(contentSplit) });
358
+ // return config
359
+ return {
360
+ updatedConfigSchema: updatedConfigSchema,
361
+ updatedConfig: updatedConfig,
362
+ defaultConfig: defaultConfig
363
+ };
364
+ }
365
+ Block.getConfig = getConfig;
366
+ function getLayout({ args, messageFieldKeys, messageKey, visualKey, listKey }) {
367
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
368
+ // throw if there are not enough panels
369
+ const panelCount = [messageKey, visualKey, listKey].filter(funnel_core_1.Value.isDefined).length;
370
+ if (panelCount === 0) {
371
+ throw new funnel_core_1.IllegalStateError('[BlockPanel.ts] There needs to be at least one panel');
372
+ }
373
+ // resolve props
374
+ const config = args.config;
375
+ const messageKeys = messageKey
376
+ ? panels_1.MessagePanel.Config.getKeys(messageKey)
377
+ : {};
378
+ const visualKeys = visualKey
379
+ ? panels_1.VisualPanel.Config.getKeys(visualKey)
380
+ : {};
381
+ const listKeys = listKey
382
+ ? panels_1.ListPanel.Config.getKeys(listKey)
383
+ : {};
384
+ // current config helpers
385
+ const panelInfo = getActivePanels({ fields: args.fields, messageFieldKeys, messageKey, visualKey, listKey });
386
+ const activePanels = {
387
+ message: panelInfo.message !== false,
388
+ visual: panelInfo.visual !== false,
389
+ list: panelInfo.list !== false,
390
+ };
391
+ // get layout schema
392
+ const layout = ((_b = (_a = config.layout) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 'solo');
393
+ const slotVariation = ((_d = (_c = config.slotVariation) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : 'v1');
394
+ const items = panels_1.BlockPanel.Slots.Items.compute({
395
+ panels: activePanels,
396
+ layout,
397
+ variation: slotVariation
398
+ });
399
+ // compute content alignment/split config
400
+ const contentAlign = (_f = (_e = config.contentAlign) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : 'start';
401
+ const contentSplit = ((_h = (_g = config.contentSplit) === null || _g === void 0 ? void 0 : _g.value) !== null && _h !== void 0 ? _h : '1/1');
402
+ // compute message config
403
+ const messageWidthRaw = (_j = config[messageKeys.width]) === null || _j === void 0 ? void 0 : _j.value;
404
+ const isMessageFullBleed = messageWidthRaw === 'fullBleed';
405
+ const messageWidth = isMessageFullBleed ? 'full' : (_l = (_k = config[messageKeys.width]) === null || _k === void 0 ? void 0 : _k.value) !== null && _l !== void 0 ? _l : 'full';
406
+ const messageTextAlign = (_o = (_m = config[messageKeys.textAlign]) === null || _m === void 0 ? void 0 : _m.value) !== null && _o !== void 0 ? _o : 'left';
407
+ const messageHorizontalAlign = (_q = (_p = config[messageKeys.horizontalAlign]) === null || _p === void 0 ? void 0 : _p.value) !== null && _q !== void 0 ? _q : 'start';
408
+ const messageVerticalAlign = (_s = (_r = config[messageKeys.verticalAlign]) === null || _r === void 0 ? void 0 : _r.value) !== null && _s !== void 0 ? _s : 'start';
409
+ // compute visual config
410
+ const visualAspect = (_u = (_t = config[visualKeys.aspect]) === null || _t === void 0 ? void 0 : _t.value) !== null && _u !== void 0 ? _u : 'auto';
411
+ const visualWidth = ((_w = (_v = config[visualKeys.width]) === null || _v === void 0 ? void 0 : _v.value) !== null && _w !== void 0 ? _w : 'full');
412
+ const visualHorizontalAlign = (_y = (_x = config[visualKeys.horizontalAlign]) === null || _x === void 0 ? void 0 : _x.value) !== null && _y !== void 0 ? _y : 'start';
413
+ const isVisualFullBleed = visualWidth === 'fullBleed';
414
+ // compute list config
415
+ const listWidthRaw = (_z = config[listKeys.width]) === null || _z === void 0 ? void 0 : _z.value;
416
+ const isListFullBleed = listWidthRaw === 'fullBleed';
417
+ const listWidth = isListFullBleed ? 'full' : (_1 = (_0 = config[listKeys.width]) === null || _0 === void 0 ? void 0 : _0.value) !== null && _1 !== void 0 ? _1 : 'full';
418
+ const listHorizontalAlign = (_3 = (_2 = config[listKeys.horizontalAlign]) === null || _2 === void 0 ? void 0 : _2.value) !== null && _3 !== void 0 ? _3 : 'start';
419
+ const listVerticalAlign = (_5 = (_4 = config[listKeys.verticalAlign]) === null || _4 === void 0 ? void 0 : _4.value) !== null && _5 !== void 0 ? _5 : 'start';
420
+ // create visual if we have one
421
+ let visualSlot = undefined;
422
+ if (items.includes('V') || schema_1.PanelLayout.isNested(layout)) {
423
+ // language=XML
424
+ visualSlot = (`
425
+ <visual
426
+ xmlns="nd:block"
427
+ aspect="${visualAspect}"
428
+ size="${visualWidth === 'fullBleed' ? 'full' : visualWidth}"
429
+ alignX="${visualHorizontalAlign}"
430
+ fullBleed="${isVisualFullBleed}"
431
+ />
432
+ `);
433
+ }
434
+ // create slot items
435
+ const slots = items.map(item => {
436
+ switch (item) {
437
+ case 'M': {
438
+ // language=XML
439
+ return (`
440
+ <message
441
+ xmlns="nd:block"
442
+ textAlign="${messageTextAlign}"
443
+ size="${messageWidth}"
444
+ fullBleed="${isMessageFullBleed}"
445
+ alignX="${messageHorizontalAlign}"
446
+ alignY="${messageVerticalAlign}"
447
+ />
448
+ `);
449
+ }
450
+ case 'V':
451
+ return visualSlot;
452
+ case 'L': {
453
+ // FIXME: update props from config (lists WILL REQUIRED new props)
454
+ // language=XML
455
+ return (`
456
+ <list
457
+ xmlns="nd:block"
458
+ layout="column"
459
+ itemType="message"
460
+ size="${listWidth}"
461
+ alignX="${listHorizontalAlign}"
462
+ alignY="${listVerticalAlign}"
463
+ fullBleed="${isListFullBleed}"
464
+ itemCount="2"
465
+ />
466
+ `);
467
+ }
468
+ }
469
+ });
470
+ // build layout
471
+ let blockLayout = '';
472
+ switch (layout) {
473
+ case 'solo':
474
+ // language=XML
475
+ blockLayout = `
476
+ <block xmlns="nd:block" name="Solo">
477
+ <col>
478
+ ${slots[0]}
479
+ </col>
480
+ </block>
481
+ `;
482
+ break;
483
+ case 'stack.h': {
484
+ // compute tight
485
+ let tightDesktop = 'none';
486
+ let tightMobile = 'none';
487
+ if (isVisualFullBleed) {
488
+ tightDesktop = 'both';
489
+ tightMobile = items[0] === 'V' ? 'above' : 'below';
490
+ }
491
+ // language=XML
492
+ blockLayout = `
493
+ <block
494
+ xmlns="nd:block"
495
+ name="Horizontal Stack"
496
+ tightDesktop="${tightDesktop}"
497
+ tightMobile="${tightMobile}"
498
+ >
499
+ <row alignY="${contentAlign}" ratioDesktop="${contentSplit}">
500
+ ${slots[0]}
501
+ ${slots[1]}
502
+ </row>
503
+ </block>
504
+ `;
505
+ break;
506
+ }
507
+ case 'stack.v':
508
+ // language=XML
509
+ blockLayout = `
510
+ <block
511
+ xmlns="nd:block" name="Vertical Stack"
512
+ tight="${!isVisualFullBleed ? 'none' : items[0] === 'V' ? 'above' : 'below'}">
513
+ <col>
514
+ ${slots[0]}
515
+ ${slots[1]}
516
+ </col>
517
+ </block>
518
+ `;
519
+ break;
520
+ case 'nested':
521
+ // language=XML
522
+ blockLayout = `
523
+ <block xmlns="nd:block" name="Nested: Simple" tight="${isVisualFullBleed ? 'both' : 'none'}">
524
+ <stack>
525
+ ${visualSlot}
526
+ ${slots[0]}
527
+ </stack>
528
+ </block>
529
+ `;
530
+ break;
531
+ case 'nested.h':
532
+ // language=XML
533
+ blockLayout = `
534
+ <block xmlns="nd:block" name="Nested: Horizontal">
535
+ <stack>
536
+ ${visualSlot}
537
+ <row alignY="${contentAlign}" ratioDesktop="${contentSplit}">
538
+ ${slots[0]}
539
+ ${slots[1]}
540
+ </row>
541
+ </stack>
542
+ </block>
543
+ `;
544
+ break;
545
+ case 'nested.v':
546
+ // language=XML
547
+ blockLayout = `
548
+ <block xmlns="nd:block" name="Nested: Vertical">
549
+ <stack>
550
+ ${visualSlot}
551
+ <col>
552
+ ${slots[0]}
553
+ ${slots[1]}
554
+ </col>
555
+ </stack>
556
+ </block>
557
+ `;
558
+ break;
559
+ case 'nested.t':
560
+ // language=XML
561
+ blockLayout = `
562
+ <block xmlns="nd:block" name="Nested: Top">
563
+ <col>
564
+ <stack>
565
+ ${visualSlot}
566
+ ${slots[0]}
567
+ </stack>
568
+ ${slots[1]}
569
+ </col>
570
+ </block>
571
+ `;
572
+ break;
573
+ case 'nested.r':
574
+ // language=XML
575
+ blockLayout = `
576
+ <block xmlns="nd:block" name="Nested: Right">
577
+ <row alignY="${contentAlign}" ratioDesktop="${contentSplit}">
578
+ ${slots[0]}
579
+ <stack>
580
+ ${visualSlot}
581
+ ${slots[1]}
582
+ </stack>
583
+ </row>
584
+ </block>
585
+ `;
586
+ break;
587
+ case 'nested.b':
588
+ // language=XML
589
+ blockLayout = `
590
+ <block xmlns="nd:block" name="Nested: Bottom">
591
+ <col>
592
+ ${slots[0]}
593
+ <stack>
594
+ ${visualSlot}
595
+ ${slots[1]}
596
+ </stack>
597
+ </col>
598
+ </block>
599
+ `;
600
+ break;
601
+ case 'nested.l':
602
+ // language=XML
603
+ blockLayout = `
604
+ <block xmlns="nd:block" name="Nested: Left">
605
+ <row alignY="${contentAlign}" ratioDesktop="${contentSplit}">
606
+ <stack>
607
+ ${visualSlot}
608
+ ${slots[0]}
609
+ </stack>
610
+ ${slots[1]}
611
+ </row>
612
+ </block>
613
+ `;
614
+ break;
615
+ case 'brick.v': {
616
+ // compute tight
617
+ let tight = 'none';
618
+ if (isVisualFullBleed) {
619
+ if (items[0] === 'V') {
620
+ tight = 'above';
621
+ }
622
+ else if (items[2] === 'V') {
623
+ tight = 'below';
624
+ }
625
+ }
626
+ // language=XML
627
+ blockLayout = `
628
+ <block
629
+ xmlns="nd:block"
630
+ name="Brick: Vertical"
631
+ tight="${tight}"
632
+ >
633
+ <col>
634
+ ${slots[0]}
635
+ ${slots[1]}
636
+ ${slots[2]}
637
+ </col>
638
+ </block>
639
+ `;
640
+ break;
641
+ }
642
+ case 'brick.t': {
643
+ // compute tight
644
+ let tightDesktop = 'none';
645
+ let tightMobile = 'none';
646
+ if (isVisualFullBleed) {
647
+ if (items[0] === 'V') {
648
+ tightDesktop = 'above';
649
+ tightMobile = 'above';
650
+ }
651
+ else if (items[1] === 'V') {
652
+ tightDesktop = 'below';
653
+ tightMobile = 'none';
654
+ }
655
+ else if (items[2] === 'V') {
656
+ tightDesktop = 'below';
657
+ tightMobile = 'below';
658
+ }
659
+ }
660
+ // language=XML
661
+ blockLayout = `
662
+ <block
663
+ xmlns="nd:block"
664
+ name="Brick: Top"
665
+ tightDesktop="${tightDesktop}"
666
+ tightMobile="${tightMobile}"
667
+ >
668
+ <col>
669
+ ${slots[0]}
670
+ <row alignY="${contentAlign}" ratioDesktop="${contentSplit}">
671
+ ${slots[1]}
672
+ ${slots[2]}
673
+ </row>
674
+ </col>
675
+ </block>
676
+ `;
677
+ break;
678
+ }
679
+ case 'brick.r': {
680
+ // compute tight
681
+ let tightDesktop = 'none';
682
+ let tightMobile = 'none';
683
+ if (isVisualFullBleed) {
684
+ if (items[0] === 'V') {
685
+ tightDesktop = 'above';
686
+ tightMobile = 'above';
687
+ }
688
+ else if (items[1] === 'V') {
689
+ tightDesktop = 'both';
690
+ tightMobile = 'below';
691
+ }
692
+ else if (items[2] === 'V') {
693
+ tightDesktop = 'below';
694
+ tightMobile = 'none';
695
+ }
696
+ }
697
+ // language=XML
698
+ blockLayout = `
699
+ <block
700
+ xmlns="nd:block"
701
+ name="Brick: Right"
702
+ tightDesktop="${tightDesktop}"
703
+ tightMobile="${tightMobile}"
704
+ >
705
+ <row alignY="${contentAlign}" ratioDesktop="${contentSplit}">
706
+ <col>
707
+ ${slots[0]}
708
+ ${slots[2]}
709
+ </col>
710
+ ${slots[1]}
711
+ </row>
712
+ </block>
713
+ `;
714
+ break;
715
+ }
716
+ case 'brick.b': {
717
+ // compute tight
718
+ let tightDesktop = 'none';
719
+ let tightMobile = 'none';
720
+ if (isVisualFullBleed) {
721
+ if (items[0] === 'V') {
722
+ tightDesktop = 'above';
723
+ tightMobile = 'above';
724
+ }
725
+ else if (items[1] === 'V') {
726
+ tightDesktop = 'above';
727
+ tightMobile = 'none';
728
+ }
729
+ else if (items[2] === 'V') {
730
+ tightDesktop = 'below';
731
+ tightMobile = 'below';
732
+ }
733
+ }
734
+ // language=XML
735
+ blockLayout = `
736
+ <block
737
+ xmlns="nd:block"
738
+ name="Brick: Bottom"
739
+ tightDesktop="${tightDesktop}"
740
+ tightMobile="${tightMobile}"
741
+ >
742
+ <col>
743
+ <row alignY="${contentAlign}" ratioDesktop="${contentSplit}">
744
+ ${slots[0]}
745
+ ${slots[1]}
746
+ </row>
747
+ ${slots[2]}
748
+ </col>
749
+ </block>
750
+ `;
751
+ break;
752
+ }
753
+ case 'brick.l': {
754
+ // compute tight
755
+ let tightDesktop = 'none';
756
+ let tightMobile = 'none';
757
+ if (isVisualFullBleed) {
758
+ if (items[0] === 'V') {
759
+ tightDesktop = 'both';
760
+ tightMobile = 'above';
761
+ }
762
+ else if (items[1] === 'V') {
763
+ tightDesktop = 'above';
764
+ tightMobile = 'none';
765
+ }
766
+ else if (items[2] === 'V') {
767
+ tightDesktop = 'below';
768
+ tightMobile = 'below';
769
+ }
770
+ }
771
+ // language=XML
772
+ blockLayout = `
773
+ <block
774
+ xmlns="nd:block"
775
+ name="Brick: Left"
776
+ tightDesktop="${tightDesktop}"
777
+ tightMobile="${tightMobile}"
778
+ >
779
+ <row alignY="${contentAlign}" ratioDesktop="${contentSplit}">
780
+ ${slots[0]}
781
+ <col>
782
+ ${slots[1]}
783
+ ${slots[2]}
784
+ </col>
785
+ </row>
786
+ </block>
787
+ `;
788
+ break;
789
+ }
790
+ default:
791
+ throw new funnel_core_1.NotImplementedError();
792
+ }
793
+ // return parsed layout
794
+ return funnel_core_1.BlockLayout.parse(blockLayout);
139
795
  }
140
- Block.filterNode = filterNode;
796
+ Block.getLayout = getLayout;
797
+ function getActivePanels({ fields: fieldsRaw, messageFieldKeys, messageKey, visualKey, listKey }) {
798
+ var _a;
799
+ // prepare values
800
+ const fields = fieldsRaw;
801
+ const visual = visualKey
802
+ ? fields[visualKey]
803
+ : undefined;
804
+ const list = listKey
805
+ ? fields[listKey]
806
+ : undefined;
807
+ // return result
808
+ return {
809
+ message: messageKey && panels_1.MessagePanel.Fields.exists(fields, messageFieldKeys)
810
+ ? panels_1.MessagePanel.Fields.isEmpty(fields, messageFieldKeys)
811
+ ? 'invalid'
812
+ : 'valid'
813
+ : false,
814
+ visual: visual
815
+ ? visual.value
816
+ ? 'valid'
817
+ : 'invalid'
818
+ : false,
819
+ list: list
820
+ ? ((_a = list.value) !== null && _a !== void 0 ? _a : []).length === 0
821
+ ? 'valid'
822
+ : 'invalid'
823
+ : false
824
+ };
825
+ }
826
+ Block.getActivePanels = getActivePanels;
141
827
  })(Block || (exports.Block = Block = {}));
142
- function renderLayout({ renderPanel, layout }) {
143
- // render root container (row/column/stack)
144
- const { root } = layout;
145
- const { items } = root;
146
- const siblingCount = items.length;
147
- return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('nd-Block-root', getContainerClasses(root)), children: items.map((item, index) => (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: renderItem({ renderPanel, parent: root.type, item, siblingCount }) }, `${item.type}.${index}`)) }));
148
- }
149
- function getContainerClasses({ type, alignX, alignY, items }) {
828
+ // helpers
829
+ function getContainerClasses(container) {
150
830
  var _a;
831
+ const { type, alignX, alignY, items } = container;
151
832
  const itemCount = (_a = items.length) !== null && _a !== void 0 ? _a : 0;
152
- return (0, classnames_1.default)({
833
+ return (0, classnames_1.default)('nd-Block-container', {
153
834
  'nd-Block-row': type === 'row',
154
835
  'nd-Block-column': type === 'column',
155
836
  'nd-Block-stack': type === 'stack',
@@ -159,11 +840,51 @@ function getContainerClasses({ type, alignX, alignY, items }) {
159
840
  'nd-Block-y-start': alignY === 'start',
160
841
  'nd-Block-y-center': alignY === 'center',
161
842
  'nd-Block-y-end': alignY === 'end',
162
- 'nd-Block-items-1': itemCount === 1,
163
- 'nd-Block-items-2': itemCount === 2,
164
- 'nd-Block-items-3': itemCount === 3
843
+ }, type === 'row' && funnel_core_1.BlockLayout.ResponsiveClassNames.parse({
844
+ value: container.ratio,
845
+ desktop: {
846
+ '1/1': 'md:nd-Block-row-ratio-1_1',
847
+ '1/2': 'md:nd-Block-row-ratio-1_2',
848
+ '1/3': 'md:nd-Block-row-ratio-1_3',
849
+ '2/1': 'md:nd-Block-row-ratio-2_1',
850
+ '2/3': 'md:nd-Block-row-ratio-2_3',
851
+ '3/1': 'md:nd-Block-row-ratio-3_1',
852
+ '3/2': 'md:nd-Block-row-ratio-3_2',
853
+ },
854
+ mobile: {
855
+ '1/1': '',
856
+ '1/2': '',
857
+ '1/3': '',
858
+ '2/1': '',
859
+ '2/3': '',
860
+ '3/1': '',
861
+ '3/2': '',
862
+ },
863
+ base: {
864
+ '1/1': '',
865
+ '1/2': '',
866
+ '1/3': '',
867
+ '2/1': '',
868
+ '2/3': '',
869
+ '3/1': '',
870
+ '3/2': '',
871
+ }
872
+ }));
873
+ }
874
+ function getWrapperClasses(type) {
875
+ return (0, classnames_1.default)('nd-Block-containerWrap', {
876
+ 'nd-Block-rowWrap': type === 'row',
877
+ 'nd-Block-columnWrap': type === 'column',
878
+ 'nd-Block-stackWrap': type === 'stack',
165
879
  });
166
880
  }
881
+ function renderLayout({ renderPanel, layout }) {
882
+ // render root container (row/column/stack)
883
+ const { root } = layout;
884
+ const { items } = root;
885
+ const siblingCount = items.length;
886
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('nd-Block-rootContainerWrap', getWrapperClasses(root.type)), children: (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('nd-Block-rootContainer', getContainerClasses(root)), children: items.map((item, index) => (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: renderItem({ renderPanel, parent: root.type, item, siblingCount }) }, `${item.type}.${index}`)) }) }));
887
+ }
167
888
  function renderItem({ renderPanel, parent, item, siblingCount }) {
168
889
  // render based on item type
169
890
  switch (item.type) {
@@ -174,7 +895,7 @@ function renderItem({ renderPanel, parent, item, siblingCount }) {
174
895
  const { items } = item;
175
896
  const parent = item.type;
176
897
  const siblingCount = items.length;
177
- return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(getContainerClasses(item)), children: items.map((child, index) => (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: renderItem({ renderPanel, parent, item: child, siblingCount }) }, `${child.type}.${index}`)) }));
898
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(getWrapperClasses(item.type)), children: (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(getContainerClasses(item)), children: items.map((child, index) => (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: renderItem({ renderPanel, parent, item: child, siblingCount }) }, `${child.type}.${index}`)) }) }));
178
899
  }
179
900
  // child panel (provided by caller)
180
901
  default: {