@nascentdigital/funnel-ui 4.4.21 → 4.5.0
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.
- package/dist/Tailwind.d.ts +5 -1
- package/dist/Tailwind.js +9 -0
- package/dist/server/blocks/Block.d.ts +42 -2
- package/dist/server/blocks/Block.js +88 -0
- package/dist/server/blocks/Clients.d.ts +20 -29
- package/dist/server/blocks/Clients.js +13 -57
- package/dist/server/blocks/MediaLayout.d.ts +10 -5
- package/dist/server/blocks/MediaLayout.js +41 -22
- package/dist/server/blocks/Message.d.ts +9 -67
- package/dist/server/blocks/Message.js +15 -292
- package/dist/server/blocks/Outcome.d.ts +22 -82
- package/dist/server/blocks/Outcome.js +20 -474
- package/dist/server/blocks/Testimonial.d.ts +81 -16
- package/dist/server/blocks/Testimonial.js +59 -27
- package/dist/server/blocks/Testimonials.d.ts +41 -0
- package/dist/server/blocks/Testimonials.js +90 -0
- package/dist/server/blocks/ValueProp.d.ts +19 -38
- package/dist/server/blocks/ValueProp.js +14 -100
- package/dist/server/blocks/index.d.ts +1 -0
- package/dist/server/blocks/index.js +1 -0
- package/dist/server/blocks/summary/Statement.d.ts +304 -0
- package/dist/server/blocks/summary/Statement.js +52 -0
- package/dist/server/blocks/summary/Summary.d.ts +18 -0
- package/dist/server/blocks/summary/Summary.js +34 -0
- package/dist/server/blocks/summary/index.d.ts +1 -0
- package/dist/server/blocks/summary/index.js +17 -0
- package/dist/server/entities/Person.d.ts +27 -2
- package/dist/server/entities/Person.js +55 -5
- package/dist/server/layouts/BrickLayout.d.ts +290 -0
- package/dist/server/layouts/BrickLayout.js +25 -0
- package/dist/server/layouts/CardLayout.d.ts +291 -0
- package/dist/server/layouts/CardLayout.js +25 -0
- package/dist/server/layouts/FlexWrapLayout.d.ts +290 -0
- package/dist/server/layouts/FlexWrapLayout.js +41 -0
- package/dist/server/layouts/StackLayout.d.ts +290 -0
- package/dist/server/layouts/StackLayout.js +25 -0
- package/dist/server/layouts/grid/GridItem.d.ts +8 -0
- package/dist/server/layouts/grid/GridItem.js +9 -0
- package/dist/server/layouts/grid/GridLayout.d.ts +293 -0
- package/dist/server/layouts/grid/GridLayout.js +25 -0
- package/dist/server/layouts/grid/index.d.ts +2 -0
- package/dist/server/layouts/grid/index.js +18 -0
- package/dist/server/layouts/index.d.ts +5 -0
- package/dist/server/layouts/index.js +21 -0
- package/dist/server/panels/BlockPanel.d.ts +80 -1
- package/dist/server/panels/BlockPanel.js +831 -0
- package/dist/server/panels/ListPanel.d.ts +62 -0
- package/dist/server/panels/ListPanel.js +137 -0
- package/dist/server/panels/MessagePanel.d.ts +69 -5
- package/dist/server/panels/MessagePanel.js +128 -5
- package/dist/server/panels/TestimonialPanel.d.ts +47 -0
- package/dist/server/panels/TestimonialPanel.js +71 -0
- package/dist/server/panels/VisualPanel.d.ts +45 -13
- package/dist/server/panels/VisualPanel.js +75 -16
- package/dist/server/panels/index.d.ts +2 -0
- package/dist/server/panels/index.js +2 -0
- package/dist/server/schema/BlockConfig.d.ts +3 -1
- package/dist/server/schema/BlockConfig.js +2 -1
- package/dist/server/schema/ItemAlignment.d.ts +2 -0
- package/dist/server/schema/ItemPosition.d.ts +1 -0
- package/dist/server/schema/ItemSize.d.ts +2 -1
- package/dist/server/schema/ItemSize.js +2 -1
- package/dist/server/schema/ListPanelLayout.d.ts +34 -0
- package/dist/server/schema/ListPanelLayout.js +24 -0
- package/dist/server/schema/PanelLayout.d.ts +14 -0
- package/dist/server/schema/PanelLayout.js +70 -0
- package/dist/server/schema/SlotVariation.d.ts +9 -0
- package/dist/server/schema/SlotVariation.js +48 -0
- package/dist/server/schema/TextAlignment.d.ts +1 -0
- package/dist/server/schema/index.d.ts +3 -0
- package/dist/server/schema/index.js +3 -0
- package/dist/styles/blocks/Clients.css +0 -1
- package/dist/styles/blocks/Message.css +0 -343
- package/dist/styles/blocks/Outcome.css +13 -50
- package/dist/styles/blocks/Summary.css +15 -0
- package/dist/styles/blocks/Testimonial.css +1 -318
- package/dist/styles/blocks/ValueProp.css +0 -126
- package/dist/styles/blocks/_index.css +1 -0
- package/dist/styles/layouts/BrickLayout.css +43 -0
- package/dist/styles/layouts/CardLayout.css +46 -0
- package/dist/styles/layouts/FlexWrapLayout.css +38 -0
- package/dist/styles/layouts/GridLayout.css +25 -0
- package/dist/styles/layouts/StackLayout.css +46 -0
- package/dist/styles/layouts/_index.css +6 -1
- package/dist/styles/panels/ListPanel.css +3 -0
- package/dist/styles/panels/TestimonialPanel.css +64 -0
- package/dist/styles/panels/_index.css +2 -0
- 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
|
|
22
|
-
const
|
|
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,
|
|
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
|
-
//
|
|
34
|
-
const
|
|
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
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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:
|
|
53
|
-
fields:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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,24 @@
|
|
|
1
1
|
import { Schema } from '@nascentdigital/funnel-core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export declare function ValueProp({ className, titleTag, headlineTag, captionTag, uspProps, valueProp, ...props }: ValueProp.Props): import("react/jsx-runtime").JSX.Element | null;
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
import { Block } from './Block';
|
|
4
|
+
export declare function ValueProp(props: ComponentProps<typeof ValueProp.Component>): import("react/jsx-runtime").JSX.Element;
|
|
6
5
|
export declare namespace ValueProp {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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;
|
|
6
|
+
const Component: import("react").FunctionComponent<Block.Create.Result.Component<true, true, Schema.ListField<{
|
|
7
|
+
item: Schema.CollectionField<Schema.Collection<{
|
|
8
|
+
icon: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
|
|
9
|
+
image: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
|
|
10
|
+
headline: Schema.RichTextField;
|
|
11
|
+
caption: Schema.Optional<Schema.RichTextField>;
|
|
12
|
+
link: Schema.Optional<Schema.LinkField>;
|
|
19
13
|
}>>;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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;
|
|
14
|
+
}>, Schema.Block.Config>>, schema: Block.Create.Result.Schema<true, true, Schema.ListField<{
|
|
15
|
+
item: Schema.CollectionField<Schema.Collection<{
|
|
16
|
+
icon: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
|
|
17
|
+
image: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
|
|
18
|
+
headline: Schema.RichTextField;
|
|
19
|
+
caption: Schema.Optional<Schema.RichTextField>;
|
|
20
|
+
link: Schema.Optional<Schema.LinkField>;
|
|
21
|
+
}>>;
|
|
22
|
+
}>, Schema.Block.Config>;
|
|
41
23
|
type Model = Schema.Block.LinkedData<typeof schema>;
|
|
42
|
-
type ItemModel = Model['fields']['items']['value'][number];
|
|
43
24
|
}
|
|
@@ -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
|
|
24
|
-
const schema_1 = require("../schema");
|
|
7
|
+
const Block_1 = require("./Block");
|
|
25
8
|
// component
|
|
26
|
-
function ValueProp(
|
|
27
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
}
|