@nascentdigital/funnel-ui 4.4.21 → 4.5.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 (91) hide show
  1. package/dist/Tailwind.d.ts +5 -1
  2. package/dist/Tailwind.js +9 -0
  3. package/dist/server/blocks/Block.d.ts +42 -2
  4. package/dist/server/blocks/Block.js +88 -0
  5. package/dist/server/blocks/Clients.d.ts +20 -28
  6. package/dist/server/blocks/Clients.js +13 -57
  7. package/dist/server/blocks/MediaLayout.d.ts +11 -302
  8. package/dist/server/blocks/MediaLayout.js +19 -65
  9. package/dist/server/blocks/Message.d.ts +9 -67
  10. package/dist/server/blocks/Message.js +15 -292
  11. package/dist/server/blocks/Outcome.d.ts +22 -81
  12. package/dist/server/blocks/Outcome.js +20 -474
  13. package/dist/server/blocks/OutcomeDetail.d.ts +5 -2
  14. package/dist/server/blocks/Testimonial.d.ts +81 -16
  15. package/dist/server/blocks/Testimonial.js +59 -27
  16. package/dist/server/blocks/Testimonials.d.ts +41 -0
  17. package/dist/server/blocks/Testimonials.js +90 -0
  18. package/dist/server/blocks/ValueProp.d.ts +19 -37
  19. package/dist/server/blocks/ValueProp.js +14 -100
  20. package/dist/server/blocks/index.d.ts +1 -0
  21. package/dist/server/blocks/index.js +1 -0
  22. package/dist/server/blocks/summary/Statement.d.ts +304 -0
  23. package/dist/server/blocks/summary/Statement.js +52 -0
  24. package/dist/server/blocks/summary/Summary.d.ts +19 -0
  25. package/dist/server/blocks/summary/Summary.js +34 -0
  26. package/dist/server/blocks/summary/index.d.ts +1 -0
  27. package/dist/server/blocks/summary/index.js +17 -0
  28. package/dist/server/entities/Client.d.ts +1 -1
  29. package/dist/server/entities/Person.d.ts +27 -2
  30. package/dist/server/entities/Person.js +55 -5
  31. package/dist/server/entities/UniqueSellingPoint.d.ts +1 -1
  32. package/dist/server/layouts/BrickLayout.d.ts +290 -0
  33. package/dist/server/layouts/BrickLayout.js +25 -0
  34. package/dist/server/layouts/CardLayout.d.ts +291 -0
  35. package/dist/server/layouts/CardLayout.js +25 -0
  36. package/dist/server/layouts/FlexWrapLayout.d.ts +290 -0
  37. package/dist/server/layouts/FlexWrapLayout.js +41 -0
  38. package/dist/server/layouts/StackLayout.d.ts +290 -0
  39. package/dist/server/layouts/StackLayout.js +25 -0
  40. package/dist/server/layouts/grid/GridItem.d.ts +8 -0
  41. package/dist/server/layouts/grid/GridItem.js +9 -0
  42. package/dist/server/layouts/grid/GridLayout.d.ts +293 -0
  43. package/dist/server/layouts/grid/GridLayout.js +25 -0
  44. package/dist/server/layouts/grid/index.d.ts +2 -0
  45. package/dist/server/layouts/grid/index.js +18 -0
  46. package/dist/server/layouts/index.d.ts +5 -0
  47. package/dist/server/layouts/index.js +21 -0
  48. package/dist/server/panels/BlockPanel.d.ts +96 -1
  49. package/dist/server/panels/BlockPanel.js +856 -0
  50. package/dist/server/panels/ListPanel.d.ts +63 -0
  51. package/dist/server/panels/ListPanel.js +147 -0
  52. package/dist/server/panels/MessagePanel.d.ts +71 -5
  53. package/dist/server/panels/MessagePanel.js +158 -6
  54. package/dist/server/panels/TestimonialPanel.d.ts +47 -0
  55. package/dist/server/panels/TestimonialPanel.js +71 -0
  56. package/dist/server/panels/VisualPanel.d.ts +46 -13
  57. package/dist/server/panels/VisualPanel.js +85 -17
  58. package/dist/server/panels/index.d.ts +2 -0
  59. package/dist/server/panels/index.js +2 -0
  60. package/dist/server/schema/BlockConfig.d.ts +3 -1
  61. package/dist/server/schema/BlockConfig.js +2 -1
  62. package/dist/server/schema/ItemAlignment.d.ts +2 -0
  63. package/dist/server/schema/ItemPosition.d.ts +1 -0
  64. package/dist/server/schema/ItemSize.d.ts +2 -1
  65. package/dist/server/schema/ItemSize.js +2 -1
  66. package/dist/server/schema/ListPanelLayout.d.ts +34 -0
  67. package/dist/server/schema/ListPanelLayout.js +24 -0
  68. package/dist/server/schema/PanelLayout.d.ts +14 -0
  69. package/dist/server/schema/PanelLayout.js +70 -0
  70. package/dist/server/schema/SlotVariation.d.ts +9 -0
  71. package/dist/server/schema/SlotVariation.js +48 -0
  72. package/dist/server/schema/TextAlignment.d.ts +1 -0
  73. package/dist/server/schema/index.d.ts +3 -0
  74. package/dist/server/schema/index.js +3 -0
  75. package/dist/styles/blocks/Clients.css +0 -1
  76. package/dist/styles/blocks/Message.css +0 -343
  77. package/dist/styles/blocks/Outcome.css +13 -50
  78. package/dist/styles/blocks/Summary.css +15 -0
  79. package/dist/styles/blocks/Testimonial.css +1 -318
  80. package/dist/styles/blocks/ValueProp.css +0 -126
  81. package/dist/styles/blocks/_index.css +1 -0
  82. package/dist/styles/layouts/BrickLayout.css +43 -0
  83. package/dist/styles/layouts/CardLayout.css +46 -0
  84. package/dist/styles/layouts/FlexWrapLayout.css +38 -0
  85. package/dist/styles/layouts/GridLayout.css +25 -0
  86. package/dist/styles/layouts/StackLayout.css +46 -0
  87. package/dist/styles/layouts/_index.css +6 -1
  88. package/dist/styles/panels/ListPanel.css +3 -0
  89. package/dist/styles/panels/TestimonialPanel.css +64 -0
  90. package/dist/styles/panels/_index.css +2 -0
  91. package/package.json +3 -2
@@ -183,13 +183,17 @@ export declare namespace Tailwind {
183
183
  '600': string;
184
184
  '800': string;
185
185
  };
186
+ containers: {
187
+ 'panel-md': string;
188
+ 'panel-lg': string;
189
+ };
186
190
  };
187
191
  };
188
192
  plugins: ({
189
193
  handler: () => void;
190
194
  } | {
191
195
  handler: import("tailwindcss/types/config").PluginCreator;
192
- config?: Partial<import("tailwindcss/types/config").Config>;
196
+ config?: Partial<import("tailwindcss/types/config").Config> | undefined;
193
197
  })[];
194
198
  };
195
199
  function toPixel(value: number): PixelSize;
package/dist/Tailwind.js CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Tailwind = void 0;
7
7
  const funnel_core_1 = require("@nascentdigital/funnel-core");
8
8
  const aspect_ratio_1 = __importDefault(require("@tailwindcss/aspect-ratio"));
9
+ const container_queries_1 = __importDefault(require("@tailwindcss/container-queries"));
9
10
  const color_1 = __importDefault(require("color"));
10
11
  const fs_1 = __importDefault(require("fs"));
11
12
  const path_1 = __importDefault(require("path"));
@@ -161,6 +162,12 @@ var Tailwind;
161
162
  '450': '450ms',
162
163
  '600': '600ms',
163
164
  '800': '800ms'
165
+ },
166
+ containers: {
167
+ // below the 900px with 80px gutters
168
+ 'panel-md': '739px',
169
+ // 1280px with 102px gutters
170
+ 'panel-lg': '1075px'
164
171
  }
165
172
  }
166
173
  },
@@ -168,6 +175,8 @@ var Tailwind;
168
175
  plugins: [
169
176
  // aspect ratios
170
177
  aspect_ratio_1.default,
178
+ // container queries
179
+ container_queries_1.default,
171
180
  // custom selectors
172
181
  (0, plugin_1.default)(function ({ addVariant }) {
173
182
  // not first/last child
@@ -1,6 +1,7 @@
1
- import { BlockLayout, Transform } from '@nascentdigital/funnel-core';
2
- import { ReactNode } from 'react';
1
+ import { BlockLayout, Schema, Transform } from '@nascentdigital/funnel-core';
2
+ import { FunctionComponent, ReactNode } from 'react';
3
3
  import { HTMLBlockElement } from '../../types';
4
+ import { BlockPanel, ListPanel, MessagePanel, VisualPanel } from '../panels';
4
5
  import { BlockConfig } from '../schema';
5
6
  export declare function Block({ className, config, layout, renderPanel, ...props }: Block.Props): import("react/jsx-runtime").JSX.Element;
6
7
  export declare namespace Block {
@@ -13,4 +14,43 @@ export declare namespace Block {
13
14
  className?: string;
14
15
  panel: BlockLayout.Panel;
15
16
  };
17
+ function create<TBlockId extends string, TMessage extends boolean | undefined = undefined, TVisual extends boolean | undefined = undefined, TList extends Schema.ListField | undefined = undefined, TExtend extends Schema.Block.Config = Schema.Block.Config, TItemProps = any>(args: Create.Args<TBlockId, TMessage, TVisual, TList, TExtend, TItemProps>): Create.Result<TBlockId, TMessage, TVisual, TList, TExtend, TItemProps>;
18
+ namespace Create {
19
+ type Args<TBlockId extends string, TMessage extends boolean | undefined, TVisual extends boolean | undefined, TList extends Schema.ListField | undefined, TExtend extends Schema.Block.Config, TItemProps> = {
20
+ id: TBlockId;
21
+ name: string;
22
+ version: number;
23
+ className?: string;
24
+ message?: TMessage;
25
+ visual?: TVisual;
26
+ list?: {
27
+ schema: TList;
28
+ itemRenderer: TList extends Schema.ListField<infer TContent> ? (item: Schema.ListField.LinkedValue.ForItem<TContent>, itemProps: TItemProps) => ReactNode : never;
29
+ };
30
+ extendConfigSchema?: TExtend;
31
+ };
32
+ type Result<TBlockId extends string, TMessage extends boolean | undefined, TVisual extends boolean | undefined, TList extends Schema.ListField | undefined, TExtend extends Schema.Block.Config, TItemProps> = {
33
+ Component: FunctionComponent<Result.Component<TBlockId, TMessage, TVisual, TList, TExtend, TItemProps>>;
34
+ schema: Result.Schema<TBlockId, TMessage, TVisual, TList, TExtend>;
35
+ };
36
+ namespace Result {
37
+ type FieldsSchema<TMessage extends boolean | undefined, TVisual extends boolean | undefined, TList extends Schema.ListField | undefined> = ((TMessage extends true ? typeof MessagePanel.Fields.all : {}) & (TVisual extends true ? typeof VisualPanel.Fields.all : {}) & (TList extends Schema.ListField ? {
38
+ list: TList;
39
+ } : {}));
40
+ type ConfigSchema<TMessage extends boolean | undefined, TVisual extends boolean | undefined, TList extends Schema.ListField | undefined, TExtend extends Schema.Block.Config, TFields extends FieldsSchema<TMessage, TVisual, TList> = FieldsSchema<TMessage, TVisual, TList>> = BlockPanel.GetConfigSchema.Result<TFields, TMessage extends true ? 'message' : undefined, TVisual extends true ? 'visual' extends Schema.Fields.AssetFields.Keys<TFields> ? 'visual' : undefined : undefined, TList extends Schema.ListField ? 'list' extends Schema.Fields.ListFields.Keys<TFields> ? 'list' : undefined : undefined, TExtend>;
41
+ type Schema<TBlockId extends string, TMessage extends boolean | undefined, TVisual extends boolean | undefined, TList extends Schema.ListField | undefined, TExtend extends Schema.Block.Config> = Schema.Block<TBlockId, FieldsSchema<TMessage, TVisual, TList>, ConfigSchema<TMessage, TVisual, TList, TExtend>>;
42
+ type Component<TBlockId extends string, TMessage extends boolean | undefined, TVisual extends boolean | undefined, TList extends Schema.ListField | undefined, TExtend extends Schema.Block.Config, TItemProps> = {
43
+ className?: string;
44
+ model: Schema.Block.LinkedData<Schema<TBlockId, TMessage, TVisual, TList, TExtend>>;
45
+ } & ((TMessage extends true ? {
46
+ messagePanelProps?: MessagePanel.Props.Configuration;
47
+ } : {}) & (TVisual extends true ? {
48
+ visualPanelProps?: VisualPanel.Props.Configuration;
49
+ } : {}) & (TList extends Schema.ListField ? {
50
+ listPanelProps?: ListPanel.Props.Configuration & {
51
+ itemProps: TItemProps;
52
+ };
53
+ } : {}));
54
+ }
55
+ }
16
56
  }
@@ -19,6 +19,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
19
19
  const funnel_core_1 = require("@nascentdigital/funnel-core");
20
20
  const classnames_1 = __importDefault(require("classnames"));
21
21
  const react_1 = require("react");
22
+ const panels_1 = require("../panels");
22
23
  const schema_1 = require("../schema");
23
24
  // component
24
25
  function Block(_a) {
@@ -47,6 +48,93 @@ function Block(_a) {
47
48
  }
48
49
  }), schema_1.BlockConfig.Theme.getClassName((_b = config === null || config === void 0 ? void 0 : config.theme) === null || _b === void 0 ? void 0 : _b.value)) }, props, { children: renderLayout({ renderPanel, layout }) })));
49
50
  }
51
+ // extension
52
+ (function (Block) {
53
+ function createSchema({ id, name, version, message, visual, list }) {
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: list.schema });
67
+ panelKeyMapping.listKey = 'list';
68
+ }
69
+ // create config schema
70
+ const configSchema = panels_1.BlockPanel.getConfigSchema(Object.assign({ fields: fieldsSchema }, panelKeyMapping));
71
+ // create block schema
72
+ const schema = funnel_core_1.Schema.Block.create({
73
+ id,
74
+ name,
75
+ version,
76
+ config: configSchema,
77
+ fields: fieldsSchema,
78
+ getConfig: args => panels_1.BlockPanel.getConfig(Object.assign({ args }, panelKeyMapping)),
79
+ getLayout: args => panels_1.BlockPanel.getLayout(Object.assign({ args }, panelKeyMapping))
80
+ });
81
+ // return
82
+ return {
83
+ schema: schema,
84
+ panelKeyMapping
85
+ };
86
+ }
87
+ function create(args) {
88
+ // create schema
89
+ const { schema, panelKeyMapping } = createSchema(args);
90
+ // component
91
+ const Component = (_a) => {
92
+ var _b, _c;
93
+ var { className, model } = _a, props = __rest(_a, ["className", "model"]);
94
+ // skip if no model
95
+ if (!model) {
96
+ console.warn('[Block] attempted to render block without model');
97
+ return null;
98
+ }
99
+ // destructure
100
+ const config = (_b = model.config) !== null && _b !== void 0 ? _b : {};
101
+ const fields = (_c = model.fields) !== null && _c !== void 0 ? _c : {};
102
+ // panel layout
103
+ const layout = panels_1.BlockPanel.getLayout(Object.assign({ args: { fields, config } }, panelKeyMapping));
104
+ // FIXME: internal typing of fields, props, and config need some work
105
+ const getPanel = ({ className, panel }) => {
106
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
107
+ switch (panel.type) {
108
+ case 'message': {
109
+ const messagePanelFields = fields;
110
+ const _m = (_a = props === null || props === void 0 ? void 0 : props.messagePanelProps) !== null && _a !== void 0 ? _a : {}, { className: messagePanelClassname } = _m, messagePanelProps = __rest(_m, ["className"]);
111
+ return ((0, jsx_runtime_1.jsx)(panels_1.MessagePanel, Object.assign({ className: (0, classnames_1.default)(className, messagePanelClassname), panel: panel, title: (_b = messagePanelFields.title) === null || _b === void 0 ? void 0 : _b.value, headline: (_c = messagePanelFields.headline) === null || _c === void 0 ? void 0 : _c.value, caption: (_d = messagePanelFields.caption) === null || _d === void 0 ? void 0 : _d.value, ctas: (_e = messagePanelFields.ctas) === null || _e === void 0 ? void 0 : _e.value }, messagePanelProps)));
112
+ }
113
+ case 'visual': {
114
+ const visualPanelFields = fields;
115
+ const visualPanelConfig = config;
116
+ const _o = (_f = props === null || props === void 0 ? void 0 : props.visualPanelProps) !== null && _f !== void 0 ? _f : {}, { className: visualPanelClassname } = _o, visualPanelProps = __rest(_o, ["className"]);
117
+ return ((0, jsx_runtime_1.jsx)(panels_1.VisualPanel, Object.assign({ className: (0, classnames_1.default)(className, visualPanelClassname), panel: panel, visual: (_g = visualPanelFields.visual) === null || _g === void 0 ? void 0 : _g.value, anchor: (_h = funnel_core_1.Schema.EnumField.Value.fromData(visualPanelConfig.visualAnchor)) !== null && _h !== void 0 ? _h : 'center' }, visualPanelProps)));
118
+ }
119
+ case 'list': {
120
+ const listPanelFields = fields;
121
+ const listPanelConfig = config;
122
+ const _p = (_j = props === null || props === void 0 ? void 0 : props.listPanelProps) !== null && _j !== void 0 ? _j : {}, { className: listPanelClassname, itemProps } = _p, listPanelProps = __rest(_p, ["className", "itemProps"]);
123
+ return ((0, jsx_runtime_1.jsx)(panels_1.ListPanel, Object.assign({ className: (0, classnames_1.default)(className, listPanelClassname), panel: panel, layout: ((_k = funnel_core_1.Schema.EnumField.Value.fromData(listPanelConfig.listLayout)) !== null && _k !== void 0 ? _k : 'card'), items: (_l = listPanelFields.list) === null || _l === void 0 ? void 0 : _l.value }, listPanelProps, { children: item => { var _a; return (_a = args.list) === null || _a === void 0 ? void 0 : _a.itemRenderer(item, itemProps); } })));
124
+ }
125
+ }
126
+ };
127
+ // render block
128
+ return ((0, jsx_runtime_1.jsx)(Block, { className: (0, classnames_1.default)(className, args.className), config: config, layout: layout, renderPanel: getPanel }));
129
+ };
130
+ // return
131
+ return {
132
+ Component,
133
+ schema
134
+ };
135
+ }
136
+ Block.create = create;
137
+ })(Block || (exports.Block = Block = {}));
50
138
  function renderLayout({ renderPanel, layout }) {
51
139
  // render root container (row/column/stack)
52
140
  const { root } = layout;
@@ -1,33 +1,25 @@
1
1
  import { Schema } from '@nascentdigital/funnel-core';
2
- import { HTMLBlockElement, HTMLElements } from '../../types';
2
+ import { ComponentProps } from 'react';
3
3
  import { Client } from '../entities';
4
- import { Caption, Headline } from '../fields';
5
- export declare function Clients({ className, headlineTag, captionTag, clientsTag, clientTag, clientProps, clients: clientData, ...props }: Clients.Props): import("react/jsx-runtime").JSX.Element | null;
4
+ import { Block } from './Block';
5
+ export declare function Clients(props: ComponentProps<typeof Clients.Component>): import("react/jsx-runtime").JSX.Element;
6
6
  export declare namespace Clients {
7
- const schema: Schema.Block<"_nd-clients", {
8
- headline: Schema.Optional<Schema.RichTextField>;
9
- caption: Schema.Optional<Schema.RichTextField>;
10
- items: Schema.ListField<{
11
- item: Schema.CollectionField<Schema.Collection<{
12
- division: Schema.Optional<Schema.TextField>;
13
- location: Schema.Optional<Schema.TextField>;
14
- logo: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
15
- badge: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
16
- badgeText: Schema.Optional<Schema.TextField>;
17
- }>>;
18
- }>;
19
- }, {
20
- theme: Schema.EnumField<Readonly<import("@nascentdigital/funnel-core").BlockThemes.Options>>;
21
- }>;
22
- type Props = HTMLBlockElement<'div'> & {
23
- headlineTag?: Headline.Tag;
24
- captionTag?: Caption.Tag;
25
- clientsTag?: HTMLElements.Standard.Container;
26
- clientTag?: Client.Tag;
27
- clientProps?: Client.Props.Configuration;
28
- clients: Model;
29
- };
30
- type Tag = HTMLElements.Standard.Container;
7
+ const Component: import("react").FunctionComponent<Block.Create.Result.Component<"_nd-clients", true, undefined, Schema.ListField<{
8
+ item: Schema.CollectionField<Schema.Collection<{
9
+ division: Schema.Optional<Schema.TextField>;
10
+ location: Schema.Optional<Schema.TextField>;
11
+ logo: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
12
+ badge: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
13
+ badgeText: Schema.Optional<Schema.TextField>;
14
+ }>>;
15
+ }>, Schema.Block.Config, Client.Props.Configuration>>, schema: Block.Create.Result.Schema<"_nd-clients", true, undefined, Schema.ListField<{
16
+ item: Schema.CollectionField<Schema.Collection<{
17
+ division: Schema.Optional<Schema.TextField>;
18
+ location: Schema.Optional<Schema.TextField>;
19
+ logo: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
20
+ badge: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
21
+ badgeText: Schema.Optional<Schema.TextField>;
22
+ }>>;
23
+ }>, Schema.Block.Config>;
31
24
  type Model = Schema.Block.LinkedData<typeof schema>;
32
- type ItemModel = Model['fields']['items']['value'][number];
33
25
  }
@@ -1,71 +1,26 @@
1
1
  "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
3
  exports.Clients = Clients;
18
4
  const jsx_runtime_1 = require("react/jsx-runtime");
19
5
  const funnel_core_1 = require("@nascentdigital/funnel-core");
20
- const classnames_1 = __importDefault(require("classnames"));
21
- const react_1 = require("react");
22
6
  const entities_1 = require("../entities");
23
- const fields_1 = require("../fields");
24
- const schema_1 = require("../schema");
7
+ const Block_1 = require("./Block");
25
8
  // component
26
- function Clients(_a) {
27
- var _b, _c;
28
- var { className, headlineTag = 'h2', captionTag = 'div', clientsTag = 'ul', clientTag = 'li', clientProps = {}, clients: clientData } = _a, props = __rest(_a, ["className", "headlineTag", "captionTag", "clientsTag", "clientTag", "clientProps", "clients"]);
29
- // dont render if missing model
30
- const { config, fields } = clientData !== null && clientData !== void 0 ? clientData : {};
31
- const items = (_c = (_b = fields === null || fields === void 0 ? void 0 : fields.items) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : [];
32
- if (!clientData) {
33
- console.warn('[Clients] attempted to render without clients model');
34
- return null;
35
- }
36
- // slice clients for layout
37
- let clients;
38
- let trailingClients;
39
- if (items.length >= 4) {
40
- const trailingLogoOffset = items.length - 2;
41
- clients = items.slice(0, trailingLogoOffset);
42
- trailingClients = items.slice(trailingLogoOffset);
43
- }
44
- else {
45
- clients = items;
46
- trailingClients = undefined;
47
- }
48
- // render
49
- const { headline: headlineRaw, caption: captionRaw } = fields;
50
- const headline = headlineRaw === null || headlineRaw === void 0 ? void 0 : headlineRaw.value;
51
- const caption = captionRaw === null || captionRaw === void 0 ? void 0 : captionRaw.value;
52
- return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)(className, 'nd-Clients', schema_1.BlockConfig.Presets.ThemeOnly.getClassName(config)) }, props, { children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-Clients-content", children: [(headline || caption) &&
53
- (0, jsx_runtime_1.jsx)("div", { className: "nd-Clients-copyWrap", children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-Clients-copy", children: [headline &&
54
- (0, jsx_runtime_1.jsx)(fields_1.Headline, { className: "nd-Clients-headline", as: headlineTag, headline: headline }), caption &&
55
- (0, jsx_runtime_1.jsx)(fields_1.Caption, { className: "nd-Clients-caption", as: captionTag, caption: caption })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "nd-Clients-clientsWrap", children: (0, react_1.createElement)(clientsTag, { className: 'nd-Clients-clients' }, (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [clients.map((client) => (0, jsx_runtime_1.jsx)(entities_1.Client, Object.assign({}, clientProps, { as: clientTag, className: "nd-Clients-client", client: client.value }), client.id)), trailingClients && (0, react_1.createElement)(clientTag, { className: 'nd-Clients-trailingClients' }, (0, react_1.createElement)(clientsTag, { className: 'nd-Clients-clients' }, trailingClients.map(client => (0, jsx_runtime_1.jsx)(entities_1.Client, Object.assign({}, clientProps, { as: clientTag, className: "nd-Clients-client", client: client.value }), client.id))))] })) })] }) })));
9
+ function Clients(props) {
10
+ return (0, jsx_runtime_1.jsx)(Clients.Component, Object.assign({}, props));
56
11
  }
57
12
  // extension
58
13
  (function (Clients) {
59
- // schema
60
- Clients.schema = funnel_core_1.Schema.Block.create({
14
+ var _a;
15
+ // factory
16
+ _a = Block_1.Block.create({
61
17
  id: '_nd-clients',
62
18
  name: 'Clients',
63
19
  version: 1,
64
- config: Object.assign({}, schema_1.BlockConfig.Presets.ThemeOnly.schema),
65
- fields: {
66
- headline: fields_1.Headline.schema.optional(),
67
- caption: fields_1.Caption.schema.optional(),
68
- items: funnel_core_1.Schema.Field.list({
20
+ className: 'nd-Clients',
21
+ message: true,
22
+ list: {
23
+ schema: funnel_core_1.Schema.Field.list({
69
24
  name: 'Clients',
70
25
  description: 'Client brands will be displayed in the order you present them.',
71
26
  itemTypes: {
@@ -76,7 +31,8 @@ function Clients(_a) {
76
31
  },
77
32
  min: 3,
78
33
  max: 20
79
- })
34
+ }),
35
+ itemRenderer: (item, itemProps) => ((0, jsx_runtime_1.jsx)(entities_1.Client, Object.assign({ as: "li", className: "nd-Clients-client", client: item.value }, itemProps)))
80
36
  }
81
- });
37
+ }), Clients.Component = _a.Component, Clients.schema = _a.schema;
82
38
  })(Clients || (exports.Clients = Clients = {}));