@nascentdigital/funnel-ui 4.5.3 → 4.5.6
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 +1 -1
- package/dist/Tailwind.js +70 -24
- package/dist/client/interaction/Carousel.d.ts +1 -1
- package/dist/client/interaction/Carousel.js +28 -30
- package/dist/server/Page.d.ts +15 -0
- package/dist/server/Page.js +70 -0
- package/dist/server/blocks/Block.d.ts +4 -2
- package/dist/server/blocks/Block.js +9 -2
- package/dist/server/blocks/Editorial.d.ts +2 -2
- package/dist/server/blocks/Editorial.js +4 -4
- package/dist/server/blocks/Form.d.ts +2 -2
- package/dist/server/blocks/Form.js +3 -3
- package/dist/server/blocks/Projects.d.ts +29 -37
- package/dist/server/blocks/Projects.js +13 -84
- package/dist/server/blocks/RelatedPages.d.ts +58 -0
- package/dist/server/blocks/RelatedPages.js +99 -0
- package/dist/server/blocks/Stats.d.ts +19 -31
- package/dist/server/blocks/Stats.js +13 -57
- package/dist/server/blocks/Testimonial.d.ts +2 -2
- package/dist/server/blocks/Testimonial.js +4 -4
- package/dist/server/blocks/index.d.ts +1 -0
- package/dist/server/blocks/index.js +1 -0
- package/dist/server/entities/previews/MessagePreview.d.ts +2 -2
- package/dist/server/entities/previews/MessagePreview.js +1 -1
- package/dist/server/fields/Caption.js +3 -2
- package/dist/server/fields/Description.js +1 -1
- package/dist/server/fields/FreeFormContent.js +1 -1
- package/dist/server/fields/Headline.js +1 -1
- package/dist/server/fields/Quote.js +1 -1
- package/dist/server/fields/RichText.js +1 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +2 -0
- package/dist/server/layouts/BentoLayout.d.ts +289 -0
- package/dist/server/layouts/BentoLayout.js +25 -0
- package/dist/server/layouts/index.d.ts +1 -0
- package/dist/server/layouts/index.js +1 -0
- package/dist/server/panels/BlockPanel.js +2 -3
- package/dist/server/panels/ListPanel.d.ts +4 -4
- package/dist/server/panels/ListPanel.js +13 -2
- package/dist/server/panels/MessagePanel.js +0 -3
- package/dist/server/panels/VisualPanel.js +0 -2
- package/dist/server/schema/Anchor.d.ts +1 -1
- package/dist/server/schema/Anchor.js +2 -2
- package/dist/server/schema/BlockConfig.js +1 -1
- package/dist/server/schema/ListPanelLayout.d.ts +6 -0
- package/dist/server/schema/ListPanelLayout.js +3 -0
- package/dist/server/utils/ReactUtils.d.ts +6 -0
- package/dist/server/utils/ReactUtils.js +25 -0
- package/dist/server/utils/index.d.ts +1 -0
- package/dist/server/utils/index.js +17 -0
- package/dist/styles/Page.css +5 -0
- package/dist/styles/Section.css +52 -0
- package/dist/styles/blocks/Block-spacing.css +31 -38
- package/dist/styles/blocks/Block-theming.css +2 -4
- package/dist/styles/blocks/MediaLayout.css +16 -0
- package/dist/styles/blocks/Projects.css +0 -9
- package/dist/styles/blocks/RelatedPages.css +13 -0
- package/dist/styles/blocks/Stats.css +1 -30
- package/dist/styles/components/Carousel.css +128 -0
- package/dist/styles/components/_index.css +2 -1
- package/dist/styles/entities/Person.css +4 -4
- package/dist/styles/entities/Project.css +8 -2
- package/dist/styles/entities/UniqueSellingPoint.css +3 -3
- package/dist/styles/fields/Caption.css +2 -2
- package/dist/styles/fields/Description.css +2 -2
- package/dist/styles/fields/Icon.css +1 -1
- package/dist/styles/fields/Link.css +1 -1
- package/dist/styles/fields/Quote.css +2 -2
- package/dist/styles/fields/Title.css +1 -1
- package/dist/styles/index.css +2 -0
- package/dist/styles/layouts/BentoLayout.css +41 -0
- package/dist/styles/layouts/_index.css +1 -0
- package/dist/styles/panels/TestimonialPanel.css +4 -0
- package/package.json +2 -3
|
@@ -1,86 +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.Projects = Projects;
|
|
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 refs_1 = require("../../client/refs");
|
|
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 Projects(
|
|
27
|
-
|
|
28
|
-
var { className, headlineTag = 'h2', captionTag = 'div', projectProps = {}, projects: projectData } = _a, props = __rest(_a, ["className", "headlineTag", "captionTag", "projectProps", "projects"]);
|
|
29
|
-
// dont render if missing model
|
|
30
|
-
const { config, fields } = projectData !== null && projectData !== void 0 ? projectData : {};
|
|
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 (!projectData) {
|
|
33
|
-
console.warn('[Projects] attempted to render without projects model');
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
// render
|
|
37
|
-
const { headline: headlineRaw, caption: captionRaw } = fields;
|
|
38
|
-
const headline = headlineRaw === null || headlineRaw === void 0 ? void 0 : headlineRaw.value;
|
|
39
|
-
const caption = captionRaw === null || captionRaw === void 0 ? void 0 : captionRaw.value;
|
|
40
|
-
const layout = (_e = (_d = config === null || config === void 0 ? void 0 : config.layout) === null || _d === void 0 ? void 0 : _d.value) !== null && _e !== void 0 ? _e : 'masonry';
|
|
41
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)(className, 'nd-Projects', Projects.Layout.getClassName(layout), schema_1.BlockConfig.Presets.ThemeOnly.getClassName(config)) }, props, { children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-Projects-content", children: [(headline || caption) &&
|
|
42
|
-
(0, jsx_runtime_1.jsx)("div", { className: "nd-Projects-copyWrap", children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-Projects-copy", children: [headline &&
|
|
43
|
-
(0, jsx_runtime_1.jsx)(fields_1.Headline, { className: "nd-Projects-headline", as: headlineTag, headline: headline }), caption &&
|
|
44
|
-
(0, jsx_runtime_1.jsx)(fields_1.Caption, { className: "nd-Projects-caption", as: captionTag, caption: caption })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "nd-Projects-projectsWrap", children: renderProjects({ layout, projects: items, projectProps }) })] }) })));
|
|
9
|
+
function Projects(props) {
|
|
10
|
+
return (0, jsx_runtime_1.jsx)(Projects.Component, Object.assign({}, props));
|
|
45
11
|
}
|
|
46
12
|
// extension
|
|
47
13
|
(function (Projects) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
Layout.Enum = {
|
|
52
|
-
masonry: { name: 'Masonry', hint: 'A vertical brick-like layout.' }
|
|
53
|
-
};
|
|
54
|
-
// schema
|
|
55
|
-
Layout.schema = funnel_core_1.Schema.Field.enumeration({
|
|
56
|
-
name: 'Layout',
|
|
57
|
-
hint: 'Select you project layout',
|
|
58
|
-
description: 'Determine how your projects will be presented.',
|
|
59
|
-
options: Layout.Enum,
|
|
60
|
-
defaultOption: 'masonry'
|
|
61
|
-
});
|
|
62
|
-
// helpers
|
|
63
|
-
function getClassName(layout) {
|
|
64
|
-
switch (layout) {
|
|
65
|
-
case 'masonry':
|
|
66
|
-
return 'nd-Projects-layout-masonry';
|
|
67
|
-
default:
|
|
68
|
-
console.warn('[Projects] unrecognized layout:', layout);
|
|
69
|
-
return 'nd-Projects-layout-masonry';
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
Layout.getClassName = getClassName;
|
|
73
|
-
})(Layout = Projects.Layout || (Projects.Layout = {}));
|
|
74
|
-
// schema
|
|
75
|
-
Projects.schema = funnel_core_1.Schema.Block.create({
|
|
14
|
+
var _a;
|
|
15
|
+
// factory
|
|
16
|
+
_a = Block_1.Block.create({
|
|
76
17
|
id: '_nd-projects',
|
|
77
18
|
name: 'Projects',
|
|
78
19
|
version: 1,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
items: funnel_core_1.Schema.Field.list({
|
|
20
|
+
className: 'nd-Projects',
|
|
21
|
+
message: true,
|
|
22
|
+
list: {
|
|
23
|
+
schema: funnel_core_1.Schema.Field.list({
|
|
84
24
|
name: 'Projects',
|
|
85
25
|
description: 'Project will be displayed in the order you present them.',
|
|
86
26
|
itemTypes: {
|
|
@@ -91,19 +31,8 @@ function Projects(_a) {
|
|
|
91
31
|
},
|
|
92
32
|
min: 3,
|
|
93
33
|
max: 300
|
|
94
|
-
})
|
|
34
|
+
}),
|
|
35
|
+
itemRenderer: (item, itemProps) => ((0, jsx_runtime_1.jsx)(entities_1.Project, Object.assign({ as: "div", className: "nd-Projects-project", project: item.value }, itemProps)))
|
|
95
36
|
}
|
|
96
|
-
});
|
|
37
|
+
}), Projects.Component = _a.Component, Projects.schema = _a.schema;
|
|
97
38
|
})(Projects || (exports.Projects = Projects = {}));
|
|
98
|
-
function renderProjects(args) {
|
|
99
|
-
var _a;
|
|
100
|
-
switch (args.layout) {
|
|
101
|
-
case 'masonry':
|
|
102
|
-
return renderMasonryLayout(args);
|
|
103
|
-
default:
|
|
104
|
-
return ((0, jsx_runtime_1.jsxs)("div", { children: ["Unsupported Projects layout: ", (_a = args.layout) !== null && _a !== void 0 ? _a : 'undefined'] }));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
function renderMasonryLayout({ projects, projectProps }) {
|
|
108
|
-
return ((0, jsx_runtime_1.jsx)(refs_1.MasonryLayout, { className: "nd-Projects-projects", children: projects.map(project => (0, jsx_runtime_1.jsx)(entities_1.Project, Object.assign({}, projectProps, { as: "div", className: "nd-Projects-project", project: project.value }), project.id)) }));
|
|
109
|
-
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Schema, Transform } from '@nascentdigital/funnel-core';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { HTMLBlockElement } from '../../types';
|
|
4
|
+
import { Caption, Headline, Title } from '../fields';
|
|
5
|
+
export declare function RelatedPages<TPage extends Schema.Page>({ className, model, children, titleTag, headlineTag, captionTag, ...props }: RelatedPages.Props<TPage>): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export declare namespace RelatedPages {
|
|
7
|
+
function schema(args: schema.Args): Schema.Block<"_nd-relatedPages", {
|
|
8
|
+
list: Schema.DynamicPagesField;
|
|
9
|
+
title: Schema.Optional<Schema.TextField>;
|
|
10
|
+
headline: Schema.Optional<Schema.RichTextField>;
|
|
11
|
+
caption: Schema.Optional<Schema.RichTextField>;
|
|
12
|
+
ctas: Schema.Optional<Schema.ListField<{
|
|
13
|
+
cta: Schema.LinkField;
|
|
14
|
+
}>>;
|
|
15
|
+
}, ({
|
|
16
|
+
readonly theme: Schema.EnumField<Readonly<import("@nascentdigital/funnel-core").BlockThemes.Options>>;
|
|
17
|
+
} & {
|
|
18
|
+
layout: import("..").PanelLayout.Schema;
|
|
19
|
+
} & {
|
|
20
|
+
slotVariation: import("..").SlotVariation.Schema;
|
|
21
|
+
} & Record<"messageTextAlign", Schema.EnumField<Schema.EnumField.Options<import("..").TextAlignment>>> & Record<"messageWidth", Schema.EnumField<Schema.EnumField.Options<import("..").ItemSize>>> & Record<"messageHorizontalAlign", Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Record<"messageVerticalAlign", Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Schema.Block.Config) | ({
|
|
22
|
+
readonly theme: Schema.EnumField<Readonly<import("@nascentdigital/funnel-core").BlockThemes.Options>>;
|
|
23
|
+
} & {
|
|
24
|
+
layout: import("..").PanelLayout.Schema;
|
|
25
|
+
} & {
|
|
26
|
+
slotVariation: import("..").SlotVariation.Schema;
|
|
27
|
+
} & Record<"messageTextAlign", Schema.EnumField<Schema.EnumField.Options<import("..").TextAlignment>>> & Record<"messageWidth", Schema.EnumField<Schema.EnumField.Options<import("..").ItemSize>>> & Record<"messageHorizontalAlign", Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Record<"messageVerticalAlign", Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & {
|
|
28
|
+
contentAlign: import("..").ItemAlignment.Vertical.Schema;
|
|
29
|
+
} & Schema.Block.Config) | ({
|
|
30
|
+
readonly theme: Schema.EnumField<Readonly<import("@nascentdigital/funnel-core").BlockThemes.Options>>;
|
|
31
|
+
} & {
|
|
32
|
+
layout: import("..").PanelLayout.Schema;
|
|
33
|
+
} & {
|
|
34
|
+
slotVariation: import("..").SlotVariation.Schema;
|
|
35
|
+
} & Record<"messageTextAlign", Schema.EnumField<Schema.EnumField.Options<import("..").TextAlignment>>> & Record<"messageWidth", Schema.EnumField<Schema.EnumField.Options<import("..").ItemSize>>> & Record<"messageHorizontalAlign", Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Record<"messageVerticalAlign", Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Record<`${any}Width`, Schema.EnumField<Schema.EnumField.Options<import("..").ItemSize>>> & Record<`${any}HorizontalAlign`, Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Record<`${any}VerticalAlign`, Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Schema.Block.Config) | ({
|
|
36
|
+
readonly theme: Schema.EnumField<Readonly<import("@nascentdigital/funnel-core").BlockThemes.Options>>;
|
|
37
|
+
} & {
|
|
38
|
+
layout: import("..").PanelLayout.Schema;
|
|
39
|
+
} & {
|
|
40
|
+
slotVariation: import("..").SlotVariation.Schema;
|
|
41
|
+
} & Record<"messageTextAlign", Schema.EnumField<Schema.EnumField.Options<import("..").TextAlignment>>> & Record<"messageWidth", Schema.EnumField<Schema.EnumField.Options<import("..").ItemSize>>> & Record<"messageHorizontalAlign", Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Record<"messageVerticalAlign", Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Record<`${any}Width`, Schema.EnumField<Schema.EnumField.Options<import("..").ItemSize>>> & Record<`${any}HorizontalAlign`, Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Record<`${any}VerticalAlign`, Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & {
|
|
42
|
+
contentAlign: import("..").ItemAlignment.Vertical.Schema;
|
|
43
|
+
} & Schema.Block.Config)>;
|
|
44
|
+
namespace schema {
|
|
45
|
+
type Args = {
|
|
46
|
+
pageType: string;
|
|
47
|
+
size: number;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
type Props<TPage extends Schema.Page> = HTMLBlockElement<'div'> & {
|
|
51
|
+
model: Model;
|
|
52
|
+
children?: Transform<Schema.Page.LinkedData.AsPreview<TPage>, ReactNode>;
|
|
53
|
+
titleTag?: Title.Tag;
|
|
54
|
+
headlineTag?: Headline.Tag;
|
|
55
|
+
captionTag?: Caption.Tag;
|
|
56
|
+
};
|
|
57
|
+
type Model = Schema.Block.LinkedData<ReturnType<typeof schema>>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
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.RelatedPages = RelatedPages;
|
|
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 entities_1 = require("../entities");
|
|
22
|
+
const panels_1 = require("../panels");
|
|
23
|
+
const Block_1 = require("./Block");
|
|
24
|
+
// component
|
|
25
|
+
function RelatedPages(_a) {
|
|
26
|
+
var _b, _c, _d, _e, _f;
|
|
27
|
+
var { className, model, children, titleTag = 'span', headlineTag = 'h2', captionTag = 'div' } = _a, props = __rest(_a, ["className", "model", "children", "titleTag", "headlineTag", "captionTag"]);
|
|
28
|
+
// don't render if missing model
|
|
29
|
+
if (!model) {
|
|
30
|
+
console.warn('[RelatedPages] attempted to render without related model');
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
// extract fields
|
|
34
|
+
const config = (_b = model.config) !== null && _b !== void 0 ? _b : {};
|
|
35
|
+
const fields = (_c = model.fields) !== null && _c !== void 0 ? _c : {};
|
|
36
|
+
const { title: titleRaw, headline: headlineRaw, caption: captionRaw, ctas: ctasRaw, list: listRaw } = fields;
|
|
37
|
+
const title = titleRaw === null || titleRaw === void 0 ? void 0 : titleRaw.value;
|
|
38
|
+
const headline = headlineRaw === null || headlineRaw === void 0 ? void 0 : headlineRaw.value;
|
|
39
|
+
const caption = captionRaw === null || captionRaw === void 0 ? void 0 : captionRaw.value;
|
|
40
|
+
const ctas = ctasRaw === null || ctasRaw === void 0 ? void 0 : ctasRaw.value;
|
|
41
|
+
const pages = (_e = (_d = listRaw === null || listRaw === void 0 ? void 0 : listRaw.value) === null || _d === void 0 ? void 0 : _d.pages) !== null && _e !== void 0 ? _e : [];
|
|
42
|
+
const schema = (_f = listRaw === null || listRaw === void 0 ? void 0 : listRaw.value.__schema) !== null && _f !== void 0 ? _f : {};
|
|
43
|
+
// panel layout
|
|
44
|
+
const layout = panels_1.BlockPanel.getLayout({
|
|
45
|
+
args: { fields, config },
|
|
46
|
+
messageKey: 'message',
|
|
47
|
+
listKey: 'list'
|
|
48
|
+
});
|
|
49
|
+
const getPanel = ({ className, panel }) => {
|
|
50
|
+
var _a;
|
|
51
|
+
switch (panel.type) {
|
|
52
|
+
case 'message':
|
|
53
|
+
return ((0, jsx_runtime_1.jsx)(panels_1.MessagePanel, { panel: panel, title: title, headline: headline, caption: caption, ctas: ctas }));
|
|
54
|
+
case 'list': {
|
|
55
|
+
const listPanelConfig = config;
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)(panels_1.ListPanel, { panel: panel, items: pages, layout: ((_a = funnel_core_1.Schema.EnumField.Value.fromData(listPanelConfig.listLayout)) !== null && _a !== void 0 ? _a : 'card'), children: page => { var _a; return (_a = children === null || children === void 0 ? void 0 : children(page)) !== null && _a !== void 0 ? _a : (0, jsx_runtime_1.jsx)(entities_1.PagePreview, { page: page }); } }));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
// render
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)(Block_1.Block, Object.assign({ className: (0, classnames_1.default)(className, "nd-RelatedPages"), config: config, layout: layout, renderPanel: getPanel }, props)));
|
|
62
|
+
}
|
|
63
|
+
// extension
|
|
64
|
+
(function (RelatedPages) {
|
|
65
|
+
// schema
|
|
66
|
+
function fieldsSchema({ size, pageType }) {
|
|
67
|
+
return Object.assign(Object.assign({}, panels_1.MessagePanel.Fields.all), { list: funnel_core_1.Schema.Field.dynamicPages({
|
|
68
|
+
name: 'Related Content',
|
|
69
|
+
description: 'Pin pages to feature specific links in your preferred order. Priority settings will automatically fill any remaining slots with relevant content. If all slots are pinned, priority settings will have no effect.',
|
|
70
|
+
types: [pageType],
|
|
71
|
+
size
|
|
72
|
+
}) });
|
|
73
|
+
}
|
|
74
|
+
const configSchema = panels_1.BlockPanel.getConfigSchema({
|
|
75
|
+
fields: fieldsSchema({ pageType: 'any', size: 0 }),
|
|
76
|
+
messageKey: 'message',
|
|
77
|
+
listKey: 'list'
|
|
78
|
+
});
|
|
79
|
+
function schema(args) {
|
|
80
|
+
return funnel_core_1.Schema.Block.create({
|
|
81
|
+
id: '_nd-relatedPages',
|
|
82
|
+
name: 'Related',
|
|
83
|
+
version: 1,
|
|
84
|
+
fields: fieldsSchema(args),
|
|
85
|
+
config: configSchema,
|
|
86
|
+
getConfig: args => panels_1.BlockPanel.getConfig({
|
|
87
|
+
args,
|
|
88
|
+
messageKey: 'message',
|
|
89
|
+
listKey: 'list'
|
|
90
|
+
}),
|
|
91
|
+
getLayout: args => panels_1.BlockPanel.getLayout({
|
|
92
|
+
args,
|
|
93
|
+
messageKey: 'message',
|
|
94
|
+
listKey: 'list'
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
RelatedPages.schema = schema;
|
|
99
|
+
})(RelatedPages || (exports.RelatedPages = RelatedPages = {}));
|
|
@@ -1,36 +1,24 @@
|
|
|
1
1
|
import { Schema } from '@nascentdigital/funnel-core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export declare function Stats({ className, titleTag, headlineTag, captionTag, statTag, statProps, stats, ...props }: Stats.Props): import("react/jsx-runtime").JSX.Element | null;
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
import { Block } from './Block';
|
|
4
|
+
export declare function Stats(props: ComponentProps<typeof Stats.Component>): import("react/jsx-runtime").JSX.Element;
|
|
6
5
|
export declare namespace Stats {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
stats: Schema.ListField<{
|
|
15
|
-
stat: Schema.ObjectField<{
|
|
16
|
-
value: Schema.TextField;
|
|
17
|
-
label: Schema.TextField;
|
|
18
|
-
description: Schema.Optional<Schema.RichTextField>;
|
|
19
|
-
icon: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
|
|
20
|
-
link: Schema.Optional<Schema.LinkField>;
|
|
21
|
-
}>;
|
|
6
|
+
const Component: import("react").FunctionComponent<Block.Create.Result.Component<"_nd-stats", true, undefined, Schema.ListField<{
|
|
7
|
+
stat: Schema.ObjectField<{
|
|
8
|
+
value: Schema.TextField;
|
|
9
|
+
label: Schema.TextField;
|
|
10
|
+
description: Schema.Optional<Schema.RichTextField>;
|
|
11
|
+
icon: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
|
|
12
|
+
link: Schema.Optional<Schema.LinkField>;
|
|
22
13
|
}>;
|
|
23
|
-
}, {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
stats: Model;
|
|
33
|
-
};
|
|
34
|
-
type Tag = HTMLElements.Standard.Container;
|
|
14
|
+
}>, Schema.Block.Config, any>>, schema: Block.Create.Result.Schema<"_nd-stats", true, undefined, Schema.ListField<{
|
|
15
|
+
stat: Schema.ObjectField<{
|
|
16
|
+
value: Schema.TextField;
|
|
17
|
+
label: Schema.TextField;
|
|
18
|
+
description: Schema.Optional<Schema.RichTextField>;
|
|
19
|
+
icon: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
|
|
20
|
+
link: Schema.Optional<Schema.LinkField>;
|
|
21
|
+
}>;
|
|
22
|
+
}>, Schema.Block.Config>;
|
|
35
23
|
type Model = Schema.Block.LinkedData<typeof schema>;
|
|
36
24
|
}
|
|
@@ -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.Stats = Stats;
|
|
18
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
5
|
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
20
|
-
const
|
|
21
|
-
const fields_1 = require("../fields");
|
|
22
|
-
const schema_1 = require("../schema");
|
|
6
|
+
const Block_1 = require("./Block");
|
|
23
7
|
const Stat_1 = require("./Stat");
|
|
24
8
|
// component
|
|
25
|
-
function Stats(
|
|
26
|
-
|
|
27
|
-
var { className, titleTag = 'span', headlineTag = 'h2', captionTag = 'div', statTag = 'div', statProps = {}, stats } = _a, props = __rest(_a, ["className", "titleTag", "headlineTag", "captionTag", "statTag", "statProps", "stats"]);
|
|
28
|
-
// dont render if missing model
|
|
29
|
-
if (!stats) {
|
|
30
|
-
console.warn('[ValueProp] attempted to render without valueProp model');
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
const { config, fields } = stats !== null && stats !== void 0 ? stats : {};
|
|
34
|
-
const statsList = (_c = (_b = fields === null || fields === void 0 ? void 0 : fields.stats) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : [];
|
|
35
|
-
// render
|
|
36
|
-
const { title: titleRaw, headline: headlineRaw, caption: captionRaw, ctas: ctasRaw } = fields;
|
|
37
|
-
const title = titleRaw === null || titleRaw === void 0 ? void 0 : titleRaw.value;
|
|
38
|
-
const headline = headlineRaw === null || headlineRaw === void 0 ? void 0 : headlineRaw.value;
|
|
39
|
-
const caption = captionRaw === null || captionRaw === void 0 ? void 0 : captionRaw.value;
|
|
40
|
-
const ctas = (_d = ctasRaw === null || ctasRaw === void 0 ? void 0 : ctasRaw.value) !== null && _d !== void 0 ? _d : [];
|
|
41
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)(className, 'nd-Stats', schema_1.BlockConfig.Presets.ThemeOnly.getClassName(config)) }, props, { children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-Stats-content", children: [(title || headline || caption || ctas.length > 0) &&
|
|
42
|
-
(0, jsx_runtime_1.jsx)("div", { className: "nd-Stats-copyWrap", children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-Stats-copy", children: [title &&
|
|
43
|
-
(0, jsx_runtime_1.jsx)(fields_1.Title, { className: "nd-Stats-title", as: titleTag, title: title }), (0, jsx_runtime_1.jsx)(fields_1.Headline, { className: "nd-Stats-headline", as: headlineTag, headline: headline }), caption &&
|
|
44
|
-
(0, jsx_runtime_1.jsx)(fields_1.Caption, { className: "nd-Stats-caption", as: captionTag, caption: caption }), ctas.length > 0 &&
|
|
45
|
-
(0, jsx_runtime_1.jsx)("div", { className: "nd-Stats-ctas", children: ctas.map(cta => (0, jsx_runtime_1.jsx)(fields_1.Link, { className: "nd-Stats-cta", link: cta.value }, cta.id)) })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "nd-Stats-statsWrap", children: (0, jsx_runtime_1.jsx)("div", { className: "nd-Stats-stats", "data-stats-count": statsList.length, children: statsList.map(stat => (0, jsx_runtime_1.jsx)(Stat_1.Stat, Object.assign({ as: statTag, stat: stat }, statProps), stat.id)) }) })] }) })));
|
|
9
|
+
function Stats(props) {
|
|
10
|
+
return (0, jsx_runtime_1.jsx)(Stats.Component, Object.assign({}, props));
|
|
46
11
|
}
|
|
47
12
|
// extension
|
|
48
13
|
(function (Stats) {
|
|
49
|
-
|
|
50
|
-
|
|
14
|
+
var _a;
|
|
15
|
+
// factory
|
|
16
|
+
_a = Block_1.Block.create({
|
|
51
17
|
id: '_nd-stats',
|
|
52
18
|
name: 'Statistics',
|
|
53
19
|
version: 1,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
caption: fields_1.Caption.schema.optional(),
|
|
59
|
-
ctas: funnel_core_1.Schema.Field.list({
|
|
60
|
-
name: 'CTAs',
|
|
61
|
-
description: 'Add your call-to-actions in the order you\'d like them to appear *(these are optional)*.',
|
|
62
|
-
itemTypes: {
|
|
63
|
-
cta: funnel_core_1.Schema.Field.link({ name: 'Call to Action' })
|
|
64
|
-
},
|
|
65
|
-
min: 1,
|
|
66
|
-
max: 2
|
|
67
|
-
}).optional(),
|
|
68
|
-
stats: funnel_core_1.Schema.Field.list({
|
|
20
|
+
className: 'nd-Stats',
|
|
21
|
+
message: true,
|
|
22
|
+
list: {
|
|
23
|
+
schema: funnel_core_1.Schema.Field.list({
|
|
69
24
|
name: 'Stat',
|
|
70
25
|
description: 'Stat will be displayed in the order you present them.',
|
|
71
26
|
itemTypes: {
|
|
@@ -73,7 +28,8 @@ function Stats(_a) {
|
|
|
73
28
|
},
|
|
74
29
|
min: 1,
|
|
75
30
|
max: 6
|
|
76
|
-
})
|
|
31
|
+
}),
|
|
32
|
+
itemRenderer: (item, itemProps) => ((0, jsx_runtime_1.jsx)(Stat_1.Stat, Object.assign({ as: "li", stat: item }, itemProps)))
|
|
77
33
|
}
|
|
78
|
-
});
|
|
34
|
+
}), Stats.Component = _a.Component, Stats.schema = _a.schema;
|
|
79
35
|
})(Stats || (exports.Stats = Stats = {}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Schema } from '@nascentdigital/funnel-core';
|
|
2
2
|
import { HTMLBlockElement } from '../../types';
|
|
3
3
|
import { BlockPanel, TestimonialPanel, VisualPanel } from '../panels';
|
|
4
|
-
export declare function Testimonial({ className,
|
|
4
|
+
export declare function Testimonial({ className, model, testimonialPanelProps, visualPanelProps, ...props }: Testimonial.Props): import("react/jsx-runtime").JSX.Element | null;
|
|
5
5
|
export declare namespace Testimonial {
|
|
6
6
|
const fieldsSchema: {
|
|
7
7
|
visual: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
|
|
@@ -83,7 +83,7 @@ export declare namespace Testimonial {
|
|
|
83
83
|
}>>;
|
|
84
84
|
}, "message", "visual", undefined, Schema.Block.Config>>;
|
|
85
85
|
export type Props = HTMLBlockElement<'div'> & {
|
|
86
|
-
|
|
86
|
+
model: Model;
|
|
87
87
|
testimonialPanelProps?: TestimonialPanel.Props.Configuration;
|
|
88
88
|
visualPanelProps?: VisualPanel.Props.Configuration;
|
|
89
89
|
};
|
|
@@ -23,15 +23,15 @@ const Block_1 = require("./Block");
|
|
|
23
23
|
// block
|
|
24
24
|
function Testimonial(_a) {
|
|
25
25
|
var _b, _c;
|
|
26
|
-
var { className,
|
|
26
|
+
var { className, model, testimonialPanelProps = {}, visualPanelProps = {} } = _a, props = __rest(_a, ["className", "model", "testimonialPanelProps", "visualPanelProps"]);
|
|
27
27
|
// dont render if missing model
|
|
28
|
-
if (!
|
|
28
|
+
if (!model) {
|
|
29
29
|
console.warn('[Testimonial] attempted to render without testimonial model');
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
// destructure props
|
|
33
|
-
const config = (_b =
|
|
34
|
-
const fields = (_c =
|
|
33
|
+
const config = (_b = model.config) !== null && _b !== void 0 ? _b : {};
|
|
34
|
+
const fields = (_c = model.fields) !== null && _c !== void 0 ? _c : {};
|
|
35
35
|
const { visual: visualRaw, title: titleRaw, quote: quoteRaw, author: authorRaw, ctas: ctasRaw } = fields;
|
|
36
36
|
const visual = visualRaw === null || visualRaw === void 0 ? void 0 : visualRaw.value;
|
|
37
37
|
const title = titleRaw === null || titleRaw === void 0 ? void 0 : titleRaw.value;
|
|
@@ -23,6 +23,7 @@ __exportStar(require("./MediaLayout"), exports);
|
|
|
23
23
|
__exportStar(require("./Message"), exports);
|
|
24
24
|
__exportStar(require("./Outcome"), exports);
|
|
25
25
|
__exportStar(require("./Projects"), exports);
|
|
26
|
+
__exportStar(require("./RelatedPages"), exports);
|
|
26
27
|
__exportStar(require("./Stat"), exports);
|
|
27
28
|
__exportStar(require("./Stats"), exports);
|
|
28
29
|
__exportStar(require("./Testimonial"), exports);
|
|
@@ -2,7 +2,7 @@ import { HTMLAttributes, ReactNode } from 'react';
|
|
|
2
2
|
import { HTMLElements } from '../../../types';
|
|
3
3
|
import { Message } from '../../blocks';
|
|
4
4
|
import { Caption, Headline, Title, Visual } from '../../fields';
|
|
5
|
-
export declare function MessagePreview<T extends MessagePreview.Tag>({ className, as, preview, titleTag, headlineTag, captionTag, copyDecorator, visualDecorator, visualLoading, ...props }: MessagePreview.Props<T>): import("react").DetailedReactHTMLElement<{
|
|
5
|
+
export declare function MessagePreview<T extends MessagePreview.Tag = 'div'>({ className, as, preview, titleTag, headlineTag, captionTag, copyDecorator, visualDecorator, visualLoading, ...props }: MessagePreview.Props<T>): import("react").DetailedReactHTMLElement<{
|
|
6
6
|
prefix?: string | undefined | undefined;
|
|
7
7
|
content?: string | undefined | undefined;
|
|
8
8
|
translate?: "yes" | "no" | undefined | undefined;
|
|
@@ -285,7 +285,7 @@ export declare function MessagePreview<T extends MessagePreview.Tag>({ className
|
|
|
285
285
|
}, HTMLElement> | null;
|
|
286
286
|
export declare namespace MessagePreview {
|
|
287
287
|
type Props<T extends Tag> = Omit<HTMLAttributes<HTMLElements.Standard[T]>, 'children'> & {
|
|
288
|
-
as
|
|
288
|
+
as?: T;
|
|
289
289
|
preview: Model;
|
|
290
290
|
titleTag?: Title.Tag;
|
|
291
291
|
headlineTag?: Headline.Tag;
|
|
@@ -33,7 +33,7 @@ function MessagePreview(_a) {
|
|
|
33
33
|
const headline = headlineRaw === null || headlineRaw === void 0 ? void 0 : headlineRaw.value;
|
|
34
34
|
const visual = visualRaw === null || visualRaw === void 0 ? void 0 : visualRaw.value;
|
|
35
35
|
const caption = captionRaw === null || captionRaw === void 0 ? void 0 : captionRaw.value;
|
|
36
|
-
return (0, react_1.createElement)(as, Object.assign({ className: (0, classnames_1.default)(className, 'nd-MessagePreview') }, props), (0, jsx_runtime_1.jsxs)("div", { className: "nd-MessagePreview-content", children: [(visual || visualDecorator) &&
|
|
36
|
+
return (0, react_1.createElement)(as !== null && as !== void 0 ? as : 'div', Object.assign({ className: (0, classnames_1.default)(className, 'nd-MessagePreview') }, props), (0, jsx_runtime_1.jsxs)("div", { className: "nd-MessagePreview-content", children: [(visual || visualDecorator) &&
|
|
37
37
|
(0, jsx_runtime_1.jsxs)("div", { className: "nd-MessagePreview-visualWrap", children: [visual &&
|
|
38
38
|
(0, jsx_runtime_1.jsx)(fields_1.Visual, { className: "nd-MessagePreview-visual", visual: visual, loading: visualLoading }), visualDecorator] }), (0, jsx_runtime_1.jsxs)("div", { className: "nd-MessagePreview-copyWrap", children: [(0, jsx_runtime_1.jsxs)("div", { className: "nd-MessagePreview-copy", children: [title &&
|
|
39
39
|
(0, jsx_runtime_1.jsx)(fields_1.Title, { as: titleTag, title: title, className: "nd-MessagePreview-title" }), (0, jsx_runtime_1.jsx)(fields_1.Headline, { as: headlineTag, headline: headline, className: "nd-MessagePreview-headline" }), caption &&
|
|
@@ -31,7 +31,7 @@ function Caption(_a) {
|
|
|
31
31
|
Caption.schema = funnel_core_1.Schema.Field.richtext({
|
|
32
32
|
name: 'Caption',
|
|
33
33
|
hint: 'Enter some text',
|
|
34
|
-
|
|
34
|
+
semantics: 'mini-editor',
|
|
35
35
|
capabilities: {
|
|
36
36
|
bold: true,
|
|
37
37
|
italics: true,
|
|
@@ -39,7 +39,8 @@ function Caption(_a) {
|
|
|
39
39
|
strikethrough: true,
|
|
40
40
|
superscript: true,
|
|
41
41
|
subscript: true,
|
|
42
|
-
links: true
|
|
42
|
+
links: true,
|
|
43
|
+
lists: true
|
|
43
44
|
}
|
|
44
45
|
});
|
|
45
46
|
})(Caption || (exports.Caption = Caption = {}));
|
|
@@ -34,7 +34,7 @@ function FreeFormContent(_a) {
|
|
|
34
34
|
const baseArgs = {
|
|
35
35
|
name: 'Content',
|
|
36
36
|
hint: 'Free form content',
|
|
37
|
-
|
|
37
|
+
semantics: 'full-editor'
|
|
38
38
|
};
|
|
39
39
|
// variants
|
|
40
40
|
schema.article = funnel_core_1.Schema.Field.richtext(Object.assign(Object.assign({}, baseArgs), { capabilities: funnel_core_1.Schema.RichTextField.Capabilities.Options.article }));
|
package/dist/server/index.d.ts
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -23,3 +23,5 @@ __exportStar(require("./panels"), exports);
|
|
|
23
23
|
__exportStar(require("./schema"), exports);
|
|
24
24
|
__exportStar(require("./sections"), exports);
|
|
25
25
|
__exportStar(require("./transitions"), exports);
|
|
26
|
+
__exportStar(require("./utils"), exports);
|
|
27
|
+
__exportStar(require("./Page"), exports);
|