@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
@@ -18,51 +18,83 @@ exports.Testimonial = Testimonial;
18
18
  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
- const entities_1 = require("../entities");
22
- const fields_1 = require("../fields");
23
- const schema_1 = require("../schema");
21
+ const panels_1 = require("../panels");
22
+ const Block_1 = require("./Block");
24
23
  // block
25
24
  function Testimonial(_a) {
26
- var _b;
27
- var { className, titleTag = 'span', quoteTag = 'h2', testimonial } = _a, props = __rest(_a, ["className", "titleTag", "quoteTag", "testimonial"]);
25
+ var _b, _c;
26
+ var { className, testimonial, testimonialPanelProps = {}, visualPanelProps = {} } = _a, props = __rest(_a, ["className", "testimonial", "testimonialPanelProps", "visualPanelProps"]);
28
27
  // dont render if missing model
29
28
  if (!testimonial) {
30
29
  console.warn('[Testimonial] attempted to render without testimonial model');
31
30
  return null;
32
31
  }
33
- // render
34
- const { visual: visualRaw, title: titleRaw, quote: quoteRaw, author: authorRaw, link: linkRaw } = (_b = testimonial.fields) !== null && _b !== void 0 ? _b : {};
32
+ // destructure props
33
+ const config = (_b = testimonial.config) !== null && _b !== void 0 ? _b : {};
34
+ const fields = (_c = testimonial.fields) !== null && _c !== void 0 ? _c : {};
35
+ const { visual: visualRaw, title: titleRaw, quote: quoteRaw, author: authorRaw, ctas: ctasRaw } = fields;
35
36
  const visual = visualRaw === null || visualRaw === void 0 ? void 0 : visualRaw.value;
36
37
  const title = titleRaw === null || titleRaw === void 0 ? void 0 : titleRaw.value;
37
38
  const quote = quoteRaw === null || quoteRaw === void 0 ? void 0 : quoteRaw.value;
38
39
  const author = authorRaw === null || authorRaw === void 0 ? void 0 : authorRaw.value;
39
- const link = linkRaw === null || linkRaw === void 0 ? void 0 : linkRaw.value;
40
- return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)(className, 'nd-Testimonial', schema_1.BlockConfig.Presets.VisualAndCopy.getClassName(testimonial.config)) }, props, { children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-Testimonial-content", children: [visual &&
41
- (0, jsx_runtime_1.jsx)("div", { className: "nd-Testimonial-visualWrap", children: (0, jsx_runtime_1.jsx)(fields_1.Visual, { className: "nd-Testimonial-visual", visual: visual }) }), (0, jsx_runtime_1.jsx)("div", { className: "nd-Testimonial-copyWrap", children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-Testimonial-copy", children: [title &&
42
- (0, jsx_runtime_1.jsx)(fields_1.Title, { className: "nd-Testimonial-title", as: titleTag, title: title }), (0, jsx_runtime_1.jsx)(fields_1.Quote, { className: "nd-Testimonial-quote", as: quoteTag, quote: quote }), (0, jsx_runtime_1.jsx)(entities_1.Person, { as: "div", className: "nd-Testimonial-author", person: author }), link &&
43
- (0, jsx_runtime_1.jsx)(fields_1.Link, { className: "nd-Testimonial-link", link: link })] }) })] }) })));
40
+ const ctas = ctasRaw === null || ctasRaw === void 0 ? void 0 : ctasRaw.value;
41
+ const { className: testimonialPanelClassname } = testimonialPanelProps, testimonialPanelPropsRest = __rest(testimonialPanelProps, ["className"]);
42
+ const { className: visualPanelClassname } = visualPanelProps, visualPanelPropsRest = __rest(visualPanelProps
43
+ // panel layout
44
+ , ["className"]);
45
+ // panel layout
46
+ const layout = panels_1.BlockPanel.getLayout({
47
+ args: { fields, config },
48
+ messageKey: 'message',
49
+ visualKey: 'visual'
50
+ });
51
+ const getPanel = ({ className, panel }) => {
52
+ var _a;
53
+ switch (panel.type) {
54
+ case 'message':
55
+ return ((0, jsx_runtime_1.jsx)(panels_1.TestimonialPanel, Object.assign({ className: (0, classnames_1.default)(className, testimonialPanelClassname, 'nd-Testimonial-message'), panel: panel, title: title, quote: quote, author: author, ctas: ctas }, testimonialPanelPropsRest)));
56
+ case 'visual':
57
+ return visual
58
+ ?
59
+ (0, jsx_runtime_1.jsx)(panels_1.VisualPanel, Object.assign({ className: (0, classnames_1.default)(className, visualPanelClassname, 'nd-Testimonial-visual'), panel: panel, visual: visual, anchor: (_a = funnel_core_1.Schema.EnumField.Value.fromData(config.visualAnchor)) !== null && _a !== void 0 ? _a : 'center' }, visualPanelPropsRest))
60
+ : undefined;
61
+ default:
62
+ return undefined;
63
+ }
64
+ };
65
+ // render block
66
+ return ((0, jsx_runtime_1.jsx)(Block_1.Block, Object.assign({ className: (0, classnames_1.default)(className, 'nd-Testimonial'), config: config, layout: layout, renderPanel: getPanel }, props)));
44
67
  }
45
68
  // extension
46
69
  (function (Testimonial) {
47
70
  // schema
71
+ const fieldsSchema = {
72
+ visual: panels_1.VisualPanel.Fields.visual,
73
+ title: panels_1.TestimonialPanel.Fields.title,
74
+ quote: panels_1.TestimonialPanel.Fields.quote,
75
+ author: panels_1.TestimonialPanel.Fields.author,
76
+ ctas: panels_1.TestimonialPanel.Fields.ctas
77
+ };
78
+ const configSchema = panels_1.BlockPanel.getConfigSchema({
79
+ fields: fieldsSchema,
80
+ messageKey: 'message',
81
+ visualKey: 'visual'
82
+ });
48
83
  Testimonial.schema = funnel_core_1.Schema.Block.create({
49
84
  id: '_nd-testimonial',
50
85
  name: 'Testimonial',
51
86
  version: 1,
52
- config: Object.assign({}, schema_1.BlockConfig.Presets.VisualAndCopy.schema),
53
- fields: {
54
- visual: fields_1.Visual.schema.modify({
55
- hint: 'Create some context about the speaker or the statement',
56
- tags: ['lifestyle', 'person', 'product', 'brand']
57
- }).optional(),
58
- title: fields_1.Title.schema.optional(),
59
- quote: fields_1.Quote.schema,
60
- author: funnel_core_1.Schema.Field.collection({
61
- name: 'Author',
62
- hint: 'Who said it?',
63
- collections: [entities_1.Person.schema]
64
- }),
65
- link: funnel_core_1.Schema.Field.link({ name: 'Link' }).optional()
66
- }
87
+ config: configSchema,
88
+ fields: fieldsSchema,
89
+ getConfig: args => panels_1.BlockPanel.getConfig({
90
+ args,
91
+ messageKey: 'message',
92
+ visualKey: 'visual'
93
+ }),
94
+ getLayout: args => panels_1.BlockPanel.getLayout({
95
+ args,
96
+ messageKey: 'message',
97
+ visualKey: 'visual'
98
+ })
67
99
  });
68
100
  })(Testimonial || (exports.Testimonial = Testimonial = {}));
@@ -0,0 +1,41 @@
1
+ import { Schema } from '@nascentdigital/funnel-core';
2
+ import { HTMLBlockElement, HTMLElements } from '../../types';
3
+ import { MessagePanel } from '../panels';
4
+ export declare function Testimonials({ className, testimonials, messagePanelProps, testimonialsPanelProps, ...props }: Testimonials.Props): import("react/jsx-runtime").JSX.Element | null;
5
+ export declare namespace Testimonials {
6
+ const schema: Schema.Block<"_nd-testimonials", {
7
+ title: Schema.Optional<Schema.TextField>;
8
+ headline: Schema.Optional<Schema.RichTextField>;
9
+ caption: Schema.Optional<Schema.RichTextField>;
10
+ ctas: Schema.Optional<Schema.ListField<{
11
+ cta: Schema.LinkField;
12
+ }>>;
13
+ testimonials: Schema.ListField<{
14
+ testimonial: Schema.ObjectField<{
15
+ quote: Schema.RichTextField;
16
+ author: Schema.CollectionField<Schema.Collection<{
17
+ title: Schema.Optional<Schema.TextField>;
18
+ company: Schema.Optional<Schema.CollectionField<Schema.Collection<{
19
+ division: Schema.Optional<Schema.TextField>;
20
+ location: Schema.Optional<Schema.TextField>;
21
+ logo: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
22
+ badge: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
23
+ badgeText: Schema.Optional<Schema.TextField>;
24
+ }>>>;
25
+ location: Schema.Optional<Schema.TextField>;
26
+ picture: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
27
+ }>>;
28
+ }>;
29
+ }>;
30
+ }, Schema.Block.Config>;
31
+ type Props = HTMLBlockElement<'div'> & {
32
+ testimonials: Model;
33
+ messagePanelProps?: MessagePanel.Props.Configuration;
34
+ testimonialsPanelProps?: TestimonialsPanelProps;
35
+ };
36
+ type TestimonialsPanelProps = {
37
+ className?: string;
38
+ tag?: HTMLElements.Standard.Container;
39
+ };
40
+ type Model = Schema.Block.LinkedData<typeof schema>;
41
+ }
@@ -0,0 +1,90 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Testimonials = Testimonials;
18
+ const jsx_runtime_1 = require("react/jsx-runtime");
19
+ const funnel_core_1 = require("@nascentdigital/funnel-core");
20
+ const classnames_1 = __importDefault(require("classnames"));
21
+ const panels_1 = require("../panels");
22
+ const Block_1 = require("./Block");
23
+ // block
24
+ function Testimonials(_a) {
25
+ var _b, _c, _d;
26
+ var { className, testimonials, messagePanelProps = {}, testimonialsPanelProps = {} } = _a, props = __rest(_a, ["className", "testimonials", "messagePanelProps", "testimonialsPanelProps"]);
27
+ // don't render if missing model
28
+ if (!testimonials) {
29
+ console.warn('[Testimonials] attempted to render without testimonials model');
30
+ return null;
31
+ }
32
+ // destructure props
33
+ const config = (_b = testimonials.config) !== null && _b !== void 0 ? _b : {};
34
+ const fields = (_c = testimonials.fields) !== null && _c !== void 0 ? _c : {};
35
+ const { title: titleRaw, headline: headlineRaw, caption: captionRaw, ctas: ctasRaw, testimonials: testimonialsRaw } = fields;
36
+ const title = titleRaw === null || titleRaw === void 0 ? void 0 : titleRaw.value;
37
+ const headline = headlineRaw === null || headlineRaw === void 0 ? void 0 : headlineRaw.value;
38
+ const caption = captionRaw === null || captionRaw === void 0 ? void 0 : captionRaw.value;
39
+ const ctas = ctasRaw === null || ctasRaw === void 0 ? void 0 : ctasRaw.value;
40
+ const testimonialItems = (_d = testimonialsRaw === null || testimonialsRaw === void 0 ? void 0 : testimonialsRaw.value) !== null && _d !== void 0 ? _d : [];
41
+ const { className: messagePanelClassname } = messagePanelProps, messagePanelPropsRest = __rest(messagePanelProps, ["className"]);
42
+ const { className: testimonialsPanelClassname } = testimonialsPanelProps;
43
+ // panel layout
44
+ const layout = {};
45
+ const getPanel = ({ className, panel }) => {
46
+ var _a;
47
+ switch (panel.type) {
48
+ case 'message':
49
+ return ((0, jsx_runtime_1.jsx)(panels_1.MessagePanel, Object.assign({ className: (0, classnames_1.default)(className, messagePanelClassname, 'nd-Testimonials-message'), panel: panel, title: title, headline: headline, caption: caption, ctas: ctas }, messagePanelPropsRest)));
50
+ case 'list':
51
+ return ((0, jsx_runtime_1.jsx)(panels_1.ListPanel, { as: (_a = testimonialsPanelProps.tag) !== null && _a !== void 0 ? _a : 'ul', className: (0, classnames_1.default)(className, testimonialsPanelClassname, 'nd-Testimonials-list'), panel: panel, items: testimonialItems, layout: "horizontalStack", children: testimonial => (0, jsx_runtime_1.jsx)(panels_1.TestimonialPanel, { panel: {}, quote: testimonial.value.quote.value, author: testimonial.value.author.value }) }));
52
+ }
53
+ };
54
+ // render block
55
+ return ((0, jsx_runtime_1.jsx)(Block_1.Block, Object.assign({ className: (0, classnames_1.default)(className, 'nd-Testimonials'), layout: layout, renderPanel: getPanel }, props)));
56
+ }
57
+ // extension
58
+ (function (Testimonials) {
59
+ // schema
60
+ const testimonialSchema = funnel_core_1.Schema.Field.object({
61
+ name: 'Testimonial',
62
+ preview: {
63
+ title: 'quote'
64
+ },
65
+ content: {
66
+ quote: panels_1.TestimonialPanel.Fields.quote,
67
+ author: panels_1.TestimonialPanel.Fields.author
68
+ }
69
+ });
70
+ const fieldsSchema = {
71
+ title: panels_1.MessagePanel.Fields.title,
72
+ headline: panels_1.MessagePanel.Fields.headline,
73
+ caption: panels_1.MessagePanel.Fields.caption,
74
+ ctas: panels_1.MessagePanel.Fields.ctas,
75
+ testimonials: funnel_core_1.Schema.Field.list({
76
+ name: 'Testimonials',
77
+ min: 1,
78
+ max: 3,
79
+ itemTypes: {
80
+ testimonial: testimonialSchema
81
+ }
82
+ })
83
+ };
84
+ Testimonials.schema = funnel_core_1.Schema.Block.create({
85
+ id: '_nd-testimonials',
86
+ name: 'Testimonials',
87
+ version: 1,
88
+ fields: fieldsSchema
89
+ });
90
+ })(Testimonials || (exports.Testimonials = Testimonials = {}));
@@ -1,43 +1,25 @@
1
1
  import { Schema } from '@nascentdigital/funnel-core';
2
- import { HTMLBlockElement, HTMLElements } from '../../types';
2
+ import { ComponentProps } from 'react';
3
3
  import { UniqueSellingPoint } from '../entities';
4
- import { Caption, Headline, Title } from '../fields';
5
- export declare function ValueProp({ className, titleTag, headlineTag, captionTag, uspProps, valueProp, ...props }: ValueProp.Props): import("react/jsx-runtime").JSX.Element | null;
4
+ import { Block } from './Block';
5
+ export declare function ValueProp(props: ComponentProps<typeof ValueProp.Component>): import("react/jsx-runtime").JSX.Element;
6
6
  export declare namespace ValueProp {
7
- type Layout = 'riverflow' | 'lineup' | 'cards';
8
- namespace Layout {
9
- const Enum: Schema.EnumField.Options<Layout>;
10
- const schema: Schema.EnumField<Schema.EnumField.Options<Layout>>;
11
- function getClassName(layout?: Layout): string;
12
- }
13
- const schema: Schema.Block<"_nd-valueProp", {
14
- title: Schema.Optional<Schema.TextField>;
15
- headline: Schema.RichTextField;
16
- caption: Schema.Optional<Schema.RichTextField>;
17
- ctas: Schema.Optional<Schema.ListField<{
18
- cta: Schema.LinkField;
7
+ const Component: import("react").FunctionComponent<Block.Create.Result.Component<"_nd-valueProp", true, true, Schema.ListField<{
8
+ item: Schema.CollectionField<Schema.Collection<{
9
+ icon: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
10
+ image: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
11
+ headline: Schema.RichTextField;
12
+ caption: Schema.Optional<Schema.RichTextField>;
13
+ link: Schema.Optional<Schema.LinkField>;
19
14
  }>>;
20
- items: Schema.ListField<{
21
- item: Schema.CollectionField<Schema.Collection<{
22
- icon: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
23
- image: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
24
- headline: Schema.RichTextField;
25
- caption: Schema.Optional<Schema.RichTextField>;
26
- link: Schema.Optional<Schema.LinkField>;
27
- }>>;
28
- }>;
29
- }, {
30
- layout: Schema.EnumField<Schema.EnumField.Options<Layout>>;
31
- theme: Schema.EnumField<Readonly<import("@nascentdigital/funnel-core").BlockThemes.Options>>;
32
- }>;
33
- type Props = HTMLBlockElement<'div'> & {
34
- titleTag?: Title.Tag;
35
- headlineTag?: Headline.Tag;
36
- captionTag?: Caption.Tag;
37
- uspProps?: UniqueSellingPoint.Props.Configuration;
38
- valueProp: Model;
39
- };
40
- type Tag = HTMLElements.Standard.Container;
15
+ }>, Schema.Block.Config, UniqueSellingPoint.Props.Configuration>>, schema: Block.Create.Result.Schema<"_nd-valueProp", true, true, Schema.ListField<{
16
+ item: Schema.CollectionField<Schema.Collection<{
17
+ icon: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
18
+ image: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
19
+ headline: Schema.RichTextField;
20
+ caption: Schema.Optional<Schema.RichTextField>;
21
+ link: Schema.Optional<Schema.LinkField>;
22
+ }>>;
23
+ }>, Schema.Block.Config>;
41
24
  type Model = Schema.Block.LinkedData<typeof schema>;
42
- type ItemModel = Model['fields']['items']['value'][number];
43
25
  }
@@ -1,104 +1,27 @@
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.ValueProp = ValueProp;
18
- const react_1 = require("react");
19
4
  const jsx_runtime_1 = require("react/jsx-runtime");
20
5
  const funnel_core_1 = require("@nascentdigital/funnel-core");
21
- const classnames_1 = __importDefault(require("classnames"));
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 ValueProp(_a) {
27
- var _b, _c, _d, _e, _f;
28
- var { className, titleTag = 'span', headlineTag = 'h2', captionTag = 'div', uspProps = {}, valueProp } = _a, props = __rest(_a, ["className", "titleTag", "headlineTag", "captionTag", "uspProps", "valueProp"]);
29
- // dont render if missing model
30
- const { config, fields } = valueProp !== null && valueProp !== void 0 ? valueProp : {};
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 (!valueProp) {
33
- console.warn('[ValueProp] attempted to render without valueProp model');
34
- return null;
35
- }
36
- // render
37
- const { title: titleRaw, headline: headlineRaw, caption: captionRaw, ctas: ctasRaw } = fields;
38
- const title = titleRaw === null || titleRaw === void 0 ? void 0 : titleRaw.value;
39
- const headline = headlineRaw === null || headlineRaw === void 0 ? void 0 : headlineRaw.value;
40
- const caption = captionRaw === null || captionRaw === void 0 ? void 0 : captionRaw.value;
41
- const ctas = (_d = ctasRaw === null || ctasRaw === void 0 ? void 0 : ctasRaw.value) !== null && _d !== void 0 ? _d : [];
42
- const layout = (_f = (_e = config === null || config === void 0 ? void 0 : config.layout) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : 'riverflow';
43
- return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)(className, 'nd-ValueProp', ValueProp.Layout.getClassName(layout), schema_1.BlockConfig.Presets.ThemeOnly.getClassName(config)) }, props, { children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-ValueProp-content", children: [(0, jsx_runtime_1.jsx)("div", { className: "nd-ValueProp-copyWrap", children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-ValueProp-copy", children: [title &&
44
- (0, jsx_runtime_1.jsx)(fields_1.Title, { className: "nd-ValueProp-title", as: titleTag, title: title }), (0, jsx_runtime_1.jsx)(fields_1.Headline, { className: "nd-ValueProp-headline", as: headlineTag, headline: headline }), caption &&
45
- (0, jsx_runtime_1.jsx)(fields_1.Caption, { className: "nd-ValueProp-caption", as: captionTag, caption: caption }), ctas.length > 0 &&
46
- (0, jsx_runtime_1.jsx)("div", { className: "nd-ValueProp-ctas", children: ctas.map(cta => (0, jsx_runtime_1.jsx)(fields_1.Link, { className: "nd-ValueProp-cta", link: cta.value }, cta.id)) })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "nd-ValueProp-uspsWrap", children: renderLayout({ layout, usps: items, uspProps }) })] }) })));
9
+ function ValueProp(props) {
10
+ return (0, jsx_runtime_1.jsx)(ValueProp.Component, Object.assign({}, props));
47
11
  }
48
12
  // extension
49
13
  (function (ValueProp) {
50
- let Layout;
51
- (function (Layout) {
52
- // enum
53
- Layout.Enum = {
54
- cards: { name: 'Cards', hint: 'A set of cards that wrap.' },
55
- riverflow: { name: 'Riverflow', hint: 'A vertically alternating pattern.' },
56
- lineup: { name: 'Lineup', hint: 'A horizontal stack.' }
57
- };
58
- // schema
59
- Layout.schema = funnel_core_1.Schema.Field.enumeration({
60
- name: 'Layout',
61
- hint: 'Select you selling point layout',
62
- description: 'Determine how your USPs will be presented.',
63
- options: Layout.Enum,
64
- defaultOption: 'cards'
65
- });
66
- // helpers
67
- function getClassName(layout) {
68
- switch (layout) {
69
- case 'cards':
70
- return 'nd-ValueProp-layout-cards';
71
- case 'riverflow':
72
- return 'nd-ValueProp-layout-riverflow';
73
- case 'lineup':
74
- return 'nd-ValueProp-layout-lineup';
75
- default:
76
- console.warn('[ValueProp] unrecognized layout:', layout);
77
- return 'nd-ValueProp-layout-cards';
78
- }
79
- }
80
- Layout.getClassName = getClassName;
81
- })(Layout = ValueProp.Layout || (ValueProp.Layout = {}));
82
- // schema
83
- ValueProp.schema = funnel_core_1.Schema.Block.create({
14
+ var _a;
15
+ // factory
16
+ _a = Block_1.Block.create({
84
17
  id: '_nd-valueProp',
85
18
  name: 'Value Proposition',
86
19
  version: 1,
87
- config: Object.assign(Object.assign({}, schema_1.BlockConfig.Presets.ThemeOnly.schema), { layout: Layout.schema }),
88
- fields: {
89
- title: fields_1.Title.schema.optional(),
90
- headline: fields_1.Headline.schema,
91
- caption: fields_1.Caption.schema.optional(),
92
- ctas: funnel_core_1.Schema.Field.list({
93
- name: 'CTAs',
94
- description: 'Add your call-to-actions in the order you\'d like them to appear *(these are optional)*.',
95
- itemTypes: {
96
- cta: funnel_core_1.Schema.Field.link({ name: 'Call to Action' })
97
- },
98
- min: 1,
99
- max: 2
100
- }).optional(),
101
- items: funnel_core_1.Schema.Field.list({
20
+ className: 'nd-ValueProp',
21
+ message: true,
22
+ visual: true,
23
+ list: {
24
+ schema: funnel_core_1.Schema.Field.list({
102
25
  name: 'Selling Points',
103
26
  description: 'Project will be displayed in the order you present them.',
104
27
  itemTypes: {
@@ -109,17 +32,8 @@ function ValueProp(_a) {
109
32
  },
110
33
  min: 3,
111
34
  max: 300
112
- })
35
+ }),
36
+ itemRenderer: (item, itemProps) => ((0, jsx_runtime_1.jsx)(entities_1.UniqueSellingPoint, Object.assign({ as: "li", className: "nd-ValueProp-usp", usp: item.value }, itemProps)))
113
37
  }
114
- });
38
+ }), ValueProp.Component = _a.Component, ValueProp.schema = _a.schema;
115
39
  })(ValueProp || (exports.ValueProp = ValueProp = {}));
116
- function renderLayout(args) {
117
- // render based on layout
118
- const { usps = [], layout, uspProps } = args;
119
- switch (layout) {
120
- case 'riverflow':
121
- case 'lineup':
122
- default:
123
- return ((0, jsx_runtime_1.jsx)("ul", { className: "nd-ValueProp-usps", children: usps.map(({ id, value: usp }) => (0, react_1.createElement)(entities_1.UniqueSellingPoint, Object.assign({}, uspProps, { key: id, as: "li", className: "nd-ValueProp-usp", usp: usp }))) }));
124
- }
125
- }
@@ -11,3 +11,4 @@ export * from './Stat';
11
11
  export * from './Stats';
12
12
  export * from './Testimonial';
13
13
  export * from './ValueProp';
14
+ export * from './summary';
@@ -27,3 +27,4 @@ __exportStar(require("./Stat"), exports);
27
27
  __exportStar(require("./Stats"), exports);
28
28
  __exportStar(require("./Testimonial"), exports);
29
29
  __exportStar(require("./ValueProp"), exports);
30
+ __exportStar(require("./summary"), exports);