@nascentdigital/funnel-ui 5.0.1 → 5.0.3
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/client/hooks/index.d.ts +1 -0
- package/dist/client/hooks/index.js +1 -0
- package/dist/client/hooks/useRefValue.d.ts +2 -0
- package/dist/client/hooks/useRefValue.js +15 -0
- package/dist/server/blocks/Block.d.ts +6 -2
- package/dist/server/blocks/Block.js +11 -6
- package/dist/server/blocks/MediaLayout.d.ts +3 -6
- package/dist/server/blocks/MediaLayout.js +14 -13
- package/dist/server/blocks/Message.js +2 -2
- package/dist/server/blocks/index.d.ts +0 -1
- package/dist/server/blocks/index.js +0 -1
- package/dist/server/fields/Media.js +2 -2
- package/package.json +3 -3
- package/dist/server/blocks/Editorial.d.ts +0 -33
- package/dist/server/blocks/Editorial.js +0 -80
|
@@ -16,6 +16,7 @@ export * from './useLock';
|
|
|
16
16
|
export * from './useMixedResponsiveValue';
|
|
17
17
|
export * from './usePathname';
|
|
18
18
|
export * from './useRefElement';
|
|
19
|
+
export * from './useRefValue';
|
|
19
20
|
export * from './useRefresh';
|
|
20
21
|
export * from './useResizeObserver';
|
|
21
22
|
export * from './useResponsiveValue';
|
|
@@ -32,6 +32,7 @@ __exportStar(require("./useLock"), exports);
|
|
|
32
32
|
__exportStar(require("./useMixedResponsiveValue"), exports);
|
|
33
33
|
__exportStar(require("./usePathname"), exports);
|
|
34
34
|
__exportStar(require("./useRefElement"), exports);
|
|
35
|
+
__exportStar(require("./useRefValue"), exports);
|
|
35
36
|
__exportStar(require("./useRefresh"), exports);
|
|
36
37
|
__exportStar(require("./useResizeObserver"), exports);
|
|
37
38
|
__exportStar(require("./useResponsiveValue"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useRefValue = useRefValue;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
// hook
|
|
6
|
+
function useRefValue() {
|
|
7
|
+
// create state
|
|
8
|
+
const [value, setValue] = (0, react_1.useState)(null);
|
|
9
|
+
// create ref callback function
|
|
10
|
+
const setRef = (0, react_1.useCallback)((value) => {
|
|
11
|
+
setValue(value);
|
|
12
|
+
}, []);
|
|
13
|
+
// return state and setter
|
|
14
|
+
return [setRef, value];
|
|
15
|
+
}
|
|
@@ -14,6 +14,7 @@ export declare namespace Block {
|
|
|
14
14
|
className?: string;
|
|
15
15
|
panel: BlockLayout.Panel;
|
|
16
16
|
};
|
|
17
|
+
type RenderItemArgs<TField, TItemProps = {}> = TField extends Schema.Optional.Maybe<Schema.ListField<infer TContent>> ? Create.Result.ComponentProps.RenderItemArgs<TContent, TItemProps> : never;
|
|
17
18
|
namespace Create {
|
|
18
19
|
type Args<TBlockId extends string, TMessage extends boolean | undefined, TVisual extends boolean | undefined, TList extends Schema.Optional.Maybe<Schema.ListField> | undefined, TExtend extends Schema.Block.Config, TItemProps> = {
|
|
19
20
|
id: TBlockId;
|
|
@@ -23,7 +24,10 @@ export declare namespace Block {
|
|
|
23
24
|
className?: string;
|
|
24
25
|
message?: TMessage;
|
|
25
26
|
visual?: TVisual;
|
|
26
|
-
list?:
|
|
27
|
+
list?: {
|
|
28
|
+
schema: TList;
|
|
29
|
+
renderItem: TList extends Schema.Optional.Maybe<Schema.ListField<infer TContent>> ? Transform<Result.ComponentProps.RenderItemArgs<TContent, TItemProps>, ReactNode> : never;
|
|
30
|
+
};
|
|
27
31
|
extendConfigSchema?: TExtend;
|
|
28
32
|
};
|
|
29
33
|
type Result<TBlockId extends string, TMessage extends boolean | undefined, TVisual extends boolean | undefined, TList extends Schema.Optional.Maybe<Schema.ListField> | undefined, TExtend extends Schema.Block.Config, TItemProps> = {
|
|
@@ -47,7 +51,7 @@ export declare namespace Block {
|
|
|
47
51
|
listPanelProps?: ListPanel.Props.Configuration & {
|
|
48
52
|
itemProps?: TItemProps;
|
|
49
53
|
};
|
|
50
|
-
children
|
|
54
|
+
children?: Transform<ComponentProps.RenderItemArgs<TContent, TItemProps>, ReactNode>;
|
|
51
55
|
} : {})) & HTMLBlockElement<'div'>;
|
|
52
56
|
namespace ComponentProps {
|
|
53
57
|
type ForMessage = ComponentProps<string, true, undefined, undefined, {}, unknown>;
|
|
@@ -67,26 +67,31 @@ function Block(_a) {
|
|
|
67
67
|
config: (_b = props.model.config) !== null && _b !== void 0 ? _b : {}
|
|
68
68
|
} }, panelKeyMapping));
|
|
69
69
|
const getPanel = ({ className, panel }) => {
|
|
70
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
70
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
71
71
|
switch (panel.type) {
|
|
72
72
|
// message panel
|
|
73
73
|
case 'message': {
|
|
74
74
|
const { model: { fields }, messagePanelProps } = props;
|
|
75
|
-
const
|
|
75
|
+
const _p = messagePanelProps !== null && messagePanelProps !== void 0 ? messagePanelProps : {}, { className: panelClassName } = _p, panelProps = __rest(_p, ["className"]);
|
|
76
76
|
return ((0, jsx_runtime_1.jsx)(panels_1.MessagePanel, Object.assign({ className: (0, classnames_1.default)(className, panelClassName), panel: panel, title: (_a = fields === null || fields === void 0 ? void 0 : fields.title) === null || _a === void 0 ? void 0 : _a.value, headline: (_b = fields === null || fields === void 0 ? void 0 : fields.headline) === null || _b === void 0 ? void 0 : _b.value, caption: (_c = fields === null || fields === void 0 ? void 0 : fields.caption) === null || _c === void 0 ? void 0 : _c.value, ctas: (_d = fields === null || fields === void 0 ? void 0 : fields.ctas) === null || _d === void 0 ? void 0 : _d.value }, panelProps)));
|
|
77
77
|
}
|
|
78
78
|
// visual panel
|
|
79
79
|
case 'visual': {
|
|
80
80
|
const { model: { fields, config }, visualPanelProps } = props;
|
|
81
|
-
const
|
|
81
|
+
const _q = visualPanelProps !== null && visualPanelProps !== void 0 ? visualPanelProps : {}, { className: panelClassName } = _q, panelProps = __rest(_q, ["className"]);
|
|
82
82
|
return ((0, jsx_runtime_1.jsx)(panels_1.VisualPanel, Object.assign({ className: (0, classnames_1.default)(className, panelClassName), panel: panel, visual: (_e = fields === null || fields === void 0 ? void 0 : fields.visual) === null || _e === void 0 ? void 0 : _e.value, anchor: (_f = funnel_core_1.Schema.EnumField.Value.fromData(config === null || config === void 0 ? void 0 : config.visualAnchor)) !== null && _f !== void 0 ? _f : 'center', controls: (_g = funnel_core_1.Schema.BooleanField.Value.fromData(config === null || config === void 0 ? void 0 : config.visualControls)) !== null && _g !== void 0 ? _g : true, autoPlay: (_h = funnel_core_1.Schema.BooleanField.Value.fromData(config === null || config === void 0 ? void 0 : config.visualAutoPlay)) !== null && _h !== void 0 ? _h : false, loop: (_j = funnel_core_1.Schema.BooleanField.Value.fromData(config === null || config === void 0 ? void 0 : config.visualLoop)) !== null && _j !== void 0 ? _j : false, mute: (_k = funnel_core_1.Schema.BooleanField.Value.fromData(config === null || config === void 0 ? void 0 : config.visualMute)) !== null && _k !== void 0 ? _k : false }, panelProps)));
|
|
83
83
|
}
|
|
84
84
|
// list panel
|
|
85
85
|
case 'list': {
|
|
86
86
|
const { model: { fields, config }, listPanelProps, children } = props;
|
|
87
|
-
const
|
|
87
|
+
const _r = listPanelProps !== null && listPanelProps !== void 0 ? listPanelProps : {}, { className: panelClassName, itemProps } = _r, panelProps = __rest(_r, ["className", "itemProps"]);
|
|
88
88
|
const listLayout = (_l = funnel_core_1.Schema.EnumField.Value.fromData(config === null || config === void 0 ? void 0 : config.listLayout)) !== null && _l !== void 0 ? _l : 'card';
|
|
89
|
-
|
|
89
|
+
// determine renderer
|
|
90
|
+
const renderItem = children !== null && children !== void 0 ? children : (_m = args.list) === null || _m === void 0 ? void 0 : _m.renderItem;
|
|
91
|
+
if (!renderItem) {
|
|
92
|
+
throw new funnel_core_1.IllegalStateError(`No item render specified for list panel`);
|
|
93
|
+
}
|
|
94
|
+
return ((0, jsx_runtime_1.jsx)(panels_1.ListPanel, Object.assign({ className: (0, classnames_1.default)(className, panelClassName), panel: panel, layout: listLayout, items: (_o = fields === null || fields === void 0 ? void 0 : fields.list) === null || _o === void 0 ? void 0 : _o.value }, panelProps, { children: item => renderItem({ item, itemProps, listLayout, blockLayout }) })));
|
|
90
95
|
}
|
|
91
96
|
}
|
|
92
97
|
};
|
|
@@ -114,7 +119,7 @@ function Block(_a) {
|
|
|
114
119
|
panelKeyMapping.visualKey = 'visual';
|
|
115
120
|
}
|
|
116
121
|
if (list) {
|
|
117
|
-
fieldsSchema = Object.assign(Object.assign({}, fieldsSchema), { list });
|
|
122
|
+
fieldsSchema = Object.assign(Object.assign({}, fieldsSchema), { list: list.schema });
|
|
118
123
|
panelKeyMapping.listKey = 'list';
|
|
119
124
|
}
|
|
120
125
|
// create config schema
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Schema } from '@nascentdigital/funnel-core';
|
|
2
|
-
import { ComponentProps
|
|
3
|
-
import { EmbeddedVideo } from '../../client/refs';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
4
3
|
import { Media } from '../fields';
|
|
5
4
|
import { Block } from './Block';
|
|
6
|
-
export declare function MediaLayout({
|
|
5
|
+
export declare function MediaLayout({ ...props }: MediaLayout.Props): import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
export declare namespace MediaLayout {
|
|
8
7
|
const Component: import("react").FunctionComponent<Block.Create.Result.ComponentProps<"_nd-mediaLayout", true, undefined, Schema.ListField<{
|
|
9
8
|
media: Schema.CollectionField<Schema.Collection<{
|
|
@@ -31,7 +30,5 @@ export declare namespace MediaLayout {
|
|
|
31
30
|
}>>;
|
|
32
31
|
}>, Schema.Block.Config>;
|
|
33
32
|
type Model = Schema.Block.LinkedData<typeof schema>;
|
|
34
|
-
type Props = Omit<ComponentProps<typeof Component>, 'children'
|
|
35
|
-
EmbeddedVideoElement?: JSXElementConstructor<EmbeddedVideo.Props>;
|
|
36
|
-
};
|
|
33
|
+
type Props = Omit<ComponentProps<typeof Component>, 'children'>;
|
|
37
34
|
}
|
|
@@ -14,14 +14,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.MediaLayout = MediaLayout;
|
|
15
15
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
16
|
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
17
|
-
const refs_1 = require("../../client/refs");
|
|
18
17
|
const fields_1 = require("../fields");
|
|
19
18
|
const Block_1 = require("./Block");
|
|
20
19
|
// block
|
|
21
20
|
function MediaLayout(_a) {
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)(MediaLayout.Component, Object.assign({}, props, { children: ({ item }) => (0, jsx_runtime_1.jsx)("div", { className: "nd-MediaLayout-itemWrap", children: (0, jsx_runtime_1.jsx)(fields_1.Media, { className: "nd-MediaLayout-item", media: item.value }) }) })));
|
|
21
|
+
var props = __rest(_a, []);
|
|
22
|
+
return (0, jsx_runtime_1.jsx)(MediaLayout.Component, Object.assign({}, props));
|
|
25
23
|
}
|
|
26
24
|
// extension
|
|
27
25
|
(function (MediaLayout) {
|
|
@@ -33,14 +31,17 @@ function MediaLayout(_a) {
|
|
|
33
31
|
version: 1,
|
|
34
32
|
className: 'nd-MediaLayout',
|
|
35
33
|
message: true,
|
|
36
|
-
list:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
list: {
|
|
35
|
+
schema: funnel_core_1.Schema.Field.list({
|
|
36
|
+
name: 'Assets',
|
|
37
|
+
description: 'Add one or more assets and then configure the layout.',
|
|
38
|
+
itemTypes: {
|
|
39
|
+
media: fields_1.Media.schema
|
|
40
|
+
},
|
|
41
|
+
min: 1,
|
|
42
|
+
max: 20
|
|
43
|
+
}),
|
|
44
|
+
renderItem: ({ item }) => ((0, jsx_runtime_1.jsx)("div", { className: "nd-MediaLayout-itemWrap", children: (0, jsx_runtime_1.jsx)(fields_1.Media, { className: "nd-MediaLayout-item", media: item.value }) }))
|
|
45
|
+
}
|
|
45
46
|
}), MediaLayout.Component = _a.Component, MediaLayout.schema = _a.schema;
|
|
46
47
|
})(MediaLayout || (exports.MediaLayout = MediaLayout = {}));
|
|
@@ -19,14 +19,14 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
19
19
|
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
20
20
|
const classnames_1 = __importDefault(require("classnames"));
|
|
21
21
|
const Block_1 = require("./Block");
|
|
22
|
-
//
|
|
22
|
+
// block
|
|
23
23
|
function Message(_a) {
|
|
24
24
|
var _b;
|
|
25
25
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
26
26
|
// extract variant
|
|
27
27
|
const variant = funnel_core_1.Schema.EnumField.Value.fromData((_b = props.model) === null || _b === void 0 ? void 0 : _b.config.variant);
|
|
28
28
|
// render
|
|
29
|
-
return (0, jsx_runtime_1.jsx)(Message.Component, Object.assign({ className: (0, classnames_1.default)(className, 'nd-Message', Message.Variant.getClassName(variant)) }, props));
|
|
29
|
+
return ((0, jsx_runtime_1.jsx)(Message.Component, Object.assign({ className: (0, classnames_1.default)(className, 'nd-Message', Message.Variant.getClassName(variant)) }, props)));
|
|
30
30
|
}
|
|
31
31
|
// extension
|
|
32
32
|
(function (Message) {
|
|
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./Block"), exports);
|
|
18
|
-
__exportStar(require("./Editorial"), exports);
|
|
19
18
|
__exportStar(require("./Form"), exports);
|
|
20
19
|
__exportStar(require("./FormMessage"), exports);
|
|
21
20
|
__exportStar(require("./MediaLayout"), exports);
|
|
@@ -58,8 +58,8 @@ function Media(_a) {
|
|
|
58
58
|
description: 'Image content for your website',
|
|
59
59
|
version: 1,
|
|
60
60
|
fields: {
|
|
61
|
-
image: funnel_core_1.Schema.Field.image({ name: 'Primary' }),
|
|
62
|
-
mobileImage: funnel_core_1.Schema.Field.image({ name: 'Mobile
|
|
61
|
+
image: funnel_core_1.Schema.Field.image({ name: 'Primary Image' }),
|
|
62
|
+
mobileImage: funnel_core_1.Schema.Field.image({ name: 'Mobile Image' }).optional()
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
})(Image = Media.Image || (Media.Image = {}));
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nascentdigital/funnel-ui",
|
|
3
3
|
"description": "UI components for funnel",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
7
|
-
"access": "
|
|
7
|
+
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"url": "git+https://github.com/nascentdigital/funnel.git",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"react-dom": "^19",
|
|
70
70
|
"ts-jest": "^29.3.2"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "0d1cc7d78504e8819998d928ffb342d622f75690"
|
|
73
73
|
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Schema } from '@nascentdigital/funnel-core';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
import { HTMLBlockElement } from '../../types';
|
|
4
|
-
import { Caption, FreeFormContent, Headline, Title, Visual } from '../fields';
|
|
5
|
-
import { BlockConfig } from '../schema';
|
|
6
|
-
export declare function Editorial({ className, model, titleTag, headlineTag, captionTag, freeFormContentTag, headerDecorator, visualDecorator, visualLoading, ...props }: Editorial.Props): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
-
export declare namespace Editorial {
|
|
8
|
-
const schema: Schema.Block<"_nd-editorial", {
|
|
9
|
-
visual: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
|
|
10
|
-
title: Schema.Optional<Schema.TextField>;
|
|
11
|
-
headline: Schema.Optional<Schema.RichTextField>;
|
|
12
|
-
caption: Schema.Optional<Schema.RichTextField>;
|
|
13
|
-
ctas: Schema.Optional<Schema.ListField<{
|
|
14
|
-
cta: Schema.LinkField;
|
|
15
|
-
}>>;
|
|
16
|
-
content: Schema.RichTextField;
|
|
17
|
-
extraContent: Schema.Optional<Schema.RichTextField>;
|
|
18
|
-
}, {
|
|
19
|
-
theme: Schema.EnumField<Readonly<import("@nascentdigital/funnel-core").BlockThemes.Options>>;
|
|
20
|
-
visualLayout: Schema.EnumField<Schema.EnumField.Options<BlockConfig.VisualLayout>>;
|
|
21
|
-
}>;
|
|
22
|
-
type Props = HTMLBlockElement<'div'> & {
|
|
23
|
-
model: Model;
|
|
24
|
-
titleTag?: Title.Tag;
|
|
25
|
-
headlineTag?: Headline.Tag;
|
|
26
|
-
captionTag?: Caption.Tag;
|
|
27
|
-
freeFormContentTag?: FreeFormContent.Tag;
|
|
28
|
-
headerDecorator?: ReactNode;
|
|
29
|
-
visualDecorator?: ReactNode;
|
|
30
|
-
visualLoading?: Visual.Loading;
|
|
31
|
-
};
|
|
32
|
-
type Model = Schema.Block.LinkedData<typeof schema>;
|
|
33
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
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.Editorial = Editorial;
|
|
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 fields_1 = require("../fields");
|
|
22
|
-
const schema_1 = require("../schema");
|
|
23
|
-
// block
|
|
24
|
-
function Editorial(_a) {
|
|
25
|
-
var _b, _c, _d, _e, _f;
|
|
26
|
-
var { className, model, titleTag = 'span', headlineTag = 'div', captionTag = 'div', freeFormContentTag = 'div', headerDecorator, visualDecorator, visualLoading = 'eager' } = _a, props = __rest(_a, ["className", "model", "titleTag", "headlineTag", "captionTag", "freeFormContentTag", "headerDecorator", "visualDecorator", "visualLoading"]);
|
|
27
|
-
// dont render if missing model
|
|
28
|
-
if (!model) {
|
|
29
|
-
console.warn('[Editorial] attempted to render without editorial model');
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
// render
|
|
33
|
-
const { title: titleRaw, headline: headlineRaw, caption: captionRaw, ctas: ctasRaw, visual: visualRaw, content: contentRaw, extraContent: extraContentRaw } = model.fields;
|
|
34
|
-
const visual = visualRaw === null || visualRaw === void 0 ? void 0 : visualRaw.value;
|
|
35
|
-
const title = titleRaw === null || titleRaw === void 0 ? void 0 : titleRaw.value;
|
|
36
|
-
const headline = headlineRaw === null || headlineRaw === void 0 ? void 0 : headlineRaw.value;
|
|
37
|
-
const caption = captionRaw === null || captionRaw === void 0 ? void 0 : captionRaw.value;
|
|
38
|
-
const ctas = (_b = ctasRaw === null || ctasRaw === void 0 ? void 0 : ctasRaw.value) !== null && _b !== void 0 ? _b : [];
|
|
39
|
-
const content = contentRaw === null || contentRaw === void 0 ? void 0 : contentRaw.value;
|
|
40
|
-
const extraContent = extraContentRaw === null || extraContentRaw === void 0 ? void 0 : extraContentRaw.value;
|
|
41
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)(className, 'nd-Block nd-Editorial', schema_1.BlockConfig.Theme.getClassName((_d = (_c = model === null || model === void 0 ? void 0 : model.config) === null || _c === void 0 ? void 0 : _c.theme) === null || _d === void 0 ? void 0 : _d.value), schema_1.BlockConfig.VisualLayout.getClassName((_f = (_e = model === null || model === void 0 ? void 0 : model.config) === null || _e === void 0 ? void 0 : _e.visualLayout) === null || _f === void 0 ? void 0 : _f.value)) }, props, { children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-Editorial-content", children: [(title || headline || caption || ctas.length > 0) &&
|
|
42
|
-
(0, jsx_runtime_1.jsxs)("div", { className: "nd-Editorial-headerWrap", children: [(0, jsx_runtime_1.jsxs)("div", { className: "nd-Editorial-header", children: [title &&
|
|
43
|
-
(0, jsx_runtime_1.jsx)(fields_1.Title, { className: "nd-Editorial-title", as: titleTag, title: title }), headline &&
|
|
44
|
-
(0, jsx_runtime_1.jsx)(fields_1.Headline, { className: "nd-Editorial-headline", as: headlineTag, headline: headline }), caption &&
|
|
45
|
-
(0, jsx_runtime_1.jsx)(fields_1.Caption, { className: "nd-Editorial-caption", as: captionTag, caption: caption }), ctas.length > 0 &&
|
|
46
|
-
(0, jsx_runtime_1.jsx)("div", { className: "nd-Editorial-ctas", children: ctas.map(cta => (0, jsx_runtime_1.jsx)(fields_1.Link, { className: "nd-Editorial-cta", link: cta.value }, cta.id)) })] }), headerDecorator] }), (0, jsx_runtime_1.jsx)("div", { className: "nd-Editorial-bodyWrap", children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-Editorial-body", children: [(visual || visualDecorator) &&
|
|
47
|
-
(0, jsx_runtime_1.jsxs)("div", { className: "nd-Editorial-visualWrap", children: [visual &&
|
|
48
|
-
(0, jsx_runtime_1.jsx)(fields_1.Visual, { className: "nd-Editorial-visual", visual: visual, loading: visualLoading }), visualDecorator] }), (0, jsx_runtime_1.jsxs)("div", { className: "nd-Editorial-columns", children: [(0, jsx_runtime_1.jsx)(fields_1.FreeFormContent, { as: freeFormContentTag, className: "nd-Editorial-freeFormContent", content: content }), extraContent &&
|
|
49
|
-
(0, jsx_runtime_1.jsx)(fields_1.FreeFormContent, { as: freeFormContentTag, className: "nd-Editorial-freeFormContent", content: extraContent })] })] }) })] }) })));
|
|
50
|
-
}
|
|
51
|
-
// extension
|
|
52
|
-
(function (Editorial) {
|
|
53
|
-
// schema
|
|
54
|
-
Editorial.schema = funnel_core_1.Schema.Block.create({
|
|
55
|
-
id: '_nd-editorial',
|
|
56
|
-
name: 'Editorial',
|
|
57
|
-
version: 1,
|
|
58
|
-
config: {
|
|
59
|
-
theme: schema_1.BlockConfig.Theme.schema,
|
|
60
|
-
visualLayout: schema_1.BlockConfig.VisualLayout.schema
|
|
61
|
-
},
|
|
62
|
-
fields: {
|
|
63
|
-
visual: fields_1.Visual.schema.optional(),
|
|
64
|
-
title: fields_1.Title.schema.modify({ description: 'A short intro or heading for the message' }).optional(),
|
|
65
|
-
headline: fields_1.Headline.schema.optional(),
|
|
66
|
-
caption: fields_1.Caption.schema.optional(),
|
|
67
|
-
ctas: funnel_core_1.Schema.Field.list({
|
|
68
|
-
name: 'CTAs',
|
|
69
|
-
description: 'Add your call-to-actions in the order you\'d like them to appear *(these are optional)*.',
|
|
70
|
-
itemTypes: {
|
|
71
|
-
cta: funnel_core_1.Schema.Field.link({ name: 'Call to Action' })
|
|
72
|
-
},
|
|
73
|
-
min: 1,
|
|
74
|
-
max: 2
|
|
75
|
-
}).optional(),
|
|
76
|
-
content: fields_1.FreeFormContent.schema.full,
|
|
77
|
-
extraContent: fields_1.FreeFormContent.schema.full.optional()
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
})(Editorial || (exports.Editorial = Editorial = {}));
|