@nascentdigital/funnel-ui 4.4.20 → 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
package/dist/Tailwind.d.ts
CHANGED
|
@@ -183,13 +183,17 @@ export declare namespace Tailwind {
|
|
|
183
183
|
'600': string;
|
|
184
184
|
'800': string;
|
|
185
185
|
};
|
|
186
|
+
containers: {
|
|
187
|
+
'panel-md': string;
|
|
188
|
+
'panel-lg': string;
|
|
189
|
+
};
|
|
186
190
|
};
|
|
187
191
|
};
|
|
188
192
|
plugins: ({
|
|
189
193
|
handler: () => void;
|
|
190
194
|
} | {
|
|
191
195
|
handler: import("tailwindcss/types/config").PluginCreator;
|
|
192
|
-
config?: Partial<import("tailwindcss/types/config").Config
|
|
196
|
+
config?: Partial<import("tailwindcss/types/config").Config> | undefined;
|
|
193
197
|
})[];
|
|
194
198
|
};
|
|
195
199
|
function toPixel(value: number): PixelSize;
|
package/dist/Tailwind.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Tailwind = void 0;
|
|
7
7
|
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
8
8
|
const aspect_ratio_1 = __importDefault(require("@tailwindcss/aspect-ratio"));
|
|
9
|
+
const container_queries_1 = __importDefault(require("@tailwindcss/container-queries"));
|
|
9
10
|
const color_1 = __importDefault(require("color"));
|
|
10
11
|
const fs_1 = __importDefault(require("fs"));
|
|
11
12
|
const path_1 = __importDefault(require("path"));
|
|
@@ -161,6 +162,12 @@ var Tailwind;
|
|
|
161
162
|
'450': '450ms',
|
|
162
163
|
'600': '600ms',
|
|
163
164
|
'800': '800ms'
|
|
165
|
+
},
|
|
166
|
+
containers: {
|
|
167
|
+
// below the 900px with 80px gutters
|
|
168
|
+
'panel-md': '739px',
|
|
169
|
+
// 1280px with 102px gutters
|
|
170
|
+
'panel-lg': '1075px'
|
|
164
171
|
}
|
|
165
172
|
}
|
|
166
173
|
},
|
|
@@ -168,6 +175,8 @@ var Tailwind;
|
|
|
168
175
|
plugins: [
|
|
169
176
|
// aspect ratios
|
|
170
177
|
aspect_ratio_1.default,
|
|
178
|
+
// container queries
|
|
179
|
+
container_queries_1.default,
|
|
171
180
|
// custom selectors
|
|
172
181
|
(0, plugin_1.default)(function ({ addVariant }) {
|
|
173
182
|
// not first/last child
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { BlockLayout, Transform } from '@nascentdigital/funnel-core';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { BlockLayout, Schema, Transform } from '@nascentdigital/funnel-core';
|
|
2
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
3
3
|
import { HTMLBlockElement } from '../../types';
|
|
4
|
+
import { BlockPanel, ListPanel, MessagePanel, VisualPanel } from '../panels';
|
|
4
5
|
import { BlockConfig } from '../schema';
|
|
5
6
|
export declare function Block({ className, config, layout, renderPanel, ...props }: Block.Props): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export declare namespace Block {
|
|
@@ -13,4 +14,43 @@ export declare namespace Block {
|
|
|
13
14
|
className?: string;
|
|
14
15
|
panel: BlockLayout.Panel;
|
|
15
16
|
};
|
|
17
|
+
function create<TMessage extends boolean | undefined = undefined, TVisual extends boolean | undefined = undefined, TList extends Schema.ListField | undefined = undefined, TExtend extends Schema.Block.Config = Schema.Block.Config>(args: Create.Args<TMessage, TVisual, TList, TExtend>): Create.Result<TMessage, TVisual, TList, TExtend>;
|
|
18
|
+
namespace Create {
|
|
19
|
+
type Args<TMessage extends boolean | undefined, TVisual extends boolean | undefined, TList extends Schema.ListField | undefined, TExtend extends Schema.Block.Config> = {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
version: number;
|
|
23
|
+
className?: string;
|
|
24
|
+
message?: TMessage;
|
|
25
|
+
visual?: TVisual;
|
|
26
|
+
list?: {
|
|
27
|
+
schema: TList;
|
|
28
|
+
itemRenderer: TList extends Schema.ListField<infer TContent> ? (item: Schema.ListField.LinkedValue.ForItem<TContent>, itemProps: any) => ReactNode : never;
|
|
29
|
+
};
|
|
30
|
+
extendConfigSchema?: TExtend;
|
|
31
|
+
};
|
|
32
|
+
type Result<TMessage extends boolean | undefined, TVisual extends boolean | undefined, TList extends Schema.ListField | undefined, TExtend extends Schema.Block.Config> = {
|
|
33
|
+
Component: FunctionComponent<Result.Component<TMessage, TVisual, TList, TExtend>>;
|
|
34
|
+
schema: Result.Schema<TMessage, TVisual, TList, TExtend>;
|
|
35
|
+
};
|
|
36
|
+
namespace Result {
|
|
37
|
+
type FieldsSchema<TMessage extends boolean | undefined, TVisual extends boolean | undefined, TList extends Schema.ListField | undefined> = ((TMessage extends true ? typeof MessagePanel.Fields.all : {}) & (TVisual extends true ? typeof VisualPanel.Fields.all : {}) & (TList extends Schema.ListField ? {
|
|
38
|
+
list: TList;
|
|
39
|
+
} : {}));
|
|
40
|
+
type ConfigSchema<TMessage extends boolean | undefined, TVisual extends boolean | undefined, TList extends Schema.ListField | undefined, TExtend extends Schema.Block.Config, TFields extends FieldsSchema<TMessage, TVisual, TList> = FieldsSchema<TMessage, TVisual, TList>> = BlockPanel.GetConfigSchema.Result<TFields, TMessage extends true ? 'message' : undefined, TVisual extends true ? 'visual' extends Schema.Fields.AssetFields.Keys<TFields> ? 'visual' : undefined : undefined, TList extends Schema.ListField ? 'list' extends Schema.Fields.ListFields.Keys<TFields> ? 'list' : undefined : undefined, TExtend>;
|
|
41
|
+
type Schema<TMessage extends boolean | undefined, TVisual extends boolean | undefined, TList extends Schema.ListField | undefined, TExtend extends Schema.Block.Config> = Schema.Block<string, FieldsSchema<TMessage, TVisual, TList>, ConfigSchema<TMessage, TVisual, TList, TExtend>>;
|
|
42
|
+
type Component<TMessage extends boolean | undefined, TVisual extends boolean | undefined, TList extends Schema.ListField | undefined, TExtend extends Schema.Block.Config> = {
|
|
43
|
+
className?: string;
|
|
44
|
+
model: Schema.Block.LinkedData<Schema<TMessage, TVisual, TList, TExtend>>;
|
|
45
|
+
} & ((TMessage extends true ? {
|
|
46
|
+
messagePanelProps?: MessagePanel.Props.Configuration;
|
|
47
|
+
} : {}) & (TVisual extends true ? {
|
|
48
|
+
visualPanelProps?: VisualPanel.Props.Configuration;
|
|
49
|
+
} : {}) & (TList extends Schema.ListField ? {
|
|
50
|
+
listPanelProps?: ListPanel.Props.Configuration & {
|
|
51
|
+
itemProps: any;
|
|
52
|
+
};
|
|
53
|
+
} : {}));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
16
56
|
}
|
|
@@ -19,6 +19,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
19
19
|
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
20
20
|
const classnames_1 = __importDefault(require("classnames"));
|
|
21
21
|
const react_1 = require("react");
|
|
22
|
+
const panels_1 = require("../panels");
|
|
22
23
|
const schema_1 = require("../schema");
|
|
23
24
|
// component
|
|
24
25
|
function Block(_a) {
|
|
@@ -47,6 +48,93 @@ function Block(_a) {
|
|
|
47
48
|
}
|
|
48
49
|
}), schema_1.BlockConfig.Theme.getClassName((_b = config === null || config === void 0 ? void 0 : config.theme) === null || _b === void 0 ? void 0 : _b.value)) }, props, { children: renderLayout({ renderPanel, layout }) })));
|
|
49
50
|
}
|
|
51
|
+
// extension
|
|
52
|
+
(function (Block) {
|
|
53
|
+
function createSchema({ id, name, version, message, visual, list }) {
|
|
54
|
+
// build fields schema and panel key mapping
|
|
55
|
+
let fieldsSchema = {};
|
|
56
|
+
const panelKeyMapping = {};
|
|
57
|
+
if (message) {
|
|
58
|
+
fieldsSchema = Object.assign(Object.assign({}, fieldsSchema), panels_1.MessagePanel.Fields.all);
|
|
59
|
+
panelKeyMapping.messageKey = 'message';
|
|
60
|
+
}
|
|
61
|
+
if (visual) {
|
|
62
|
+
fieldsSchema = Object.assign(Object.assign({}, fieldsSchema), panels_1.VisualPanel.Fields.all);
|
|
63
|
+
panelKeyMapping.visualKey = 'visual';
|
|
64
|
+
}
|
|
65
|
+
if (list) {
|
|
66
|
+
fieldsSchema = Object.assign(Object.assign({}, fieldsSchema), { list: list.schema });
|
|
67
|
+
panelKeyMapping.listKey = 'list';
|
|
68
|
+
}
|
|
69
|
+
// create config schema
|
|
70
|
+
const configSchema = panels_1.BlockPanel.getConfigSchema(Object.assign({ fields: fieldsSchema }, panelKeyMapping));
|
|
71
|
+
// create block schema
|
|
72
|
+
const schema = funnel_core_1.Schema.Block.create({
|
|
73
|
+
id,
|
|
74
|
+
name,
|
|
75
|
+
version,
|
|
76
|
+
config: configSchema,
|
|
77
|
+
fields: fieldsSchema,
|
|
78
|
+
getConfig: args => panels_1.BlockPanel.getConfig(Object.assign({ args }, panelKeyMapping)),
|
|
79
|
+
getLayout: args => panels_1.BlockPanel.getLayout(Object.assign({ args }, panelKeyMapping))
|
|
80
|
+
});
|
|
81
|
+
// return
|
|
82
|
+
return {
|
|
83
|
+
schema: schema,
|
|
84
|
+
panelKeyMapping
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function create(args) {
|
|
88
|
+
// create schema
|
|
89
|
+
const { schema, panelKeyMapping } = createSchema(args);
|
|
90
|
+
// component
|
|
91
|
+
const Component = (_a) => {
|
|
92
|
+
var _b, _c;
|
|
93
|
+
var { className, model } = _a, props = __rest(_a, ["className", "model"]);
|
|
94
|
+
// skip if no model
|
|
95
|
+
if (!model) {
|
|
96
|
+
console.warn('[Block] attempted to render block without model');
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
// destructure
|
|
100
|
+
const config = (_b = model.config) !== null && _b !== void 0 ? _b : {};
|
|
101
|
+
const fields = (_c = model.fields) !== null && _c !== void 0 ? _c : {};
|
|
102
|
+
// panel layout
|
|
103
|
+
const layout = panels_1.BlockPanel.getLayout(Object.assign({ args: { fields, config } }, panelKeyMapping));
|
|
104
|
+
// FIXME: internal typing of fields, props, and config need some work
|
|
105
|
+
const getPanel = ({ className, panel }) => {
|
|
106
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
107
|
+
switch (panel.type) {
|
|
108
|
+
case 'message': {
|
|
109
|
+
const messagePanelFields = fields;
|
|
110
|
+
const _m = (_a = props === null || props === void 0 ? void 0 : props.messagePanelProps) !== null && _a !== void 0 ? _a : {}, { className: messagePanelClassname } = _m, messagePanelProps = __rest(_m, ["className"]);
|
|
111
|
+
return ((0, jsx_runtime_1.jsx)(panels_1.MessagePanel, Object.assign({ className: (0, classnames_1.default)(className, messagePanelClassname), panel: panel, title: (_b = messagePanelFields.title) === null || _b === void 0 ? void 0 : _b.value, headline: (_c = messagePanelFields.headline) === null || _c === void 0 ? void 0 : _c.value, caption: (_d = messagePanelFields.caption) === null || _d === void 0 ? void 0 : _d.value, ctas: (_e = messagePanelFields.ctas) === null || _e === void 0 ? void 0 : _e.value }, messagePanelProps)));
|
|
112
|
+
}
|
|
113
|
+
case 'visual': {
|
|
114
|
+
const visualPanelFields = fields;
|
|
115
|
+
const visualPanelConfig = config;
|
|
116
|
+
const _o = (_f = props === null || props === void 0 ? void 0 : props.visualPanelProps) !== null && _f !== void 0 ? _f : {}, { className: visualPanelClassname } = _o, visualPanelProps = __rest(_o, ["className"]);
|
|
117
|
+
return ((0, jsx_runtime_1.jsx)(panels_1.VisualPanel, Object.assign({ className: (0, classnames_1.default)(className, visualPanelClassname), panel: panel, visual: (_g = visualPanelFields.visual) === null || _g === void 0 ? void 0 : _g.value, anchor: (_h = funnel_core_1.Schema.EnumField.Value.fromData(visualPanelConfig.visualAnchor)) !== null && _h !== void 0 ? _h : 'center' }, visualPanelProps)));
|
|
118
|
+
}
|
|
119
|
+
case 'list': {
|
|
120
|
+
const listPanelFields = fields;
|
|
121
|
+
const listPanelConfig = config;
|
|
122
|
+
const _p = (_j = props === null || props === void 0 ? void 0 : props.listPanelProps) !== null && _j !== void 0 ? _j : {}, { className: listPanelClassname, itemProps } = _p, listPanelProps = __rest(_p, ["className", "itemProps"]);
|
|
123
|
+
return ((0, jsx_runtime_1.jsx)(panels_1.ListPanel, Object.assign({ className: (0, classnames_1.default)(className, listPanelClassname), panel: panel, layout: ((_k = funnel_core_1.Schema.EnumField.Value.fromData(listPanelConfig.listLayout)) !== null && _k !== void 0 ? _k : 'card'), items: (_l = listPanelFields.list) === null || _l === void 0 ? void 0 : _l.value }, listPanelProps, { children: item => { var _a; return (_a = args.list) === null || _a === void 0 ? void 0 : _a.itemRenderer(item, itemProps); } })));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
// render block
|
|
128
|
+
return ((0, jsx_runtime_1.jsx)(Block, { className: (0, classnames_1.default)(className, args.className), config: config, layout: layout, renderPanel: getPanel }));
|
|
129
|
+
};
|
|
130
|
+
// return
|
|
131
|
+
return {
|
|
132
|
+
Component,
|
|
133
|
+
schema
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
Block.create = create;
|
|
137
|
+
})(Block || (exports.Block = Block = {}));
|
|
50
138
|
function renderLayout({ renderPanel, layout }) {
|
|
51
139
|
// render root container (row/column/stack)
|
|
52
140
|
const { root } = layout;
|
|
@@ -1,33 +1,24 @@
|
|
|
1
1
|
import { Schema } from '@nascentdigital/funnel-core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export declare function Clients({ className, headlineTag, captionTag, clientsTag, clientTag, clientProps, clients: clientData, ...props }: Clients.Props): import("react/jsx-runtime").JSX.Element | null;
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
import { Block } from './Block';
|
|
4
|
+
export declare function Clients(props: ComponentProps<typeof Clients.Component>): import("react/jsx-runtime").JSX.Element;
|
|
6
5
|
export declare namespace Clients {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
captionTag?: Caption.Tag;
|
|
25
|
-
clientsTag?: HTMLElements.Standard.Container;
|
|
26
|
-
clientTag?: Client.Tag;
|
|
27
|
-
clientProps?: Client.Props.Configuration;
|
|
28
|
-
clients: Model;
|
|
29
|
-
};
|
|
30
|
-
type Tag = HTMLElements.Standard.Container;
|
|
6
|
+
const Component: import("react").FunctionComponent<Block.Create.Result.Component<true, undefined, Schema.ListField<{
|
|
7
|
+
item: Schema.CollectionField<Schema.Collection<{
|
|
8
|
+
division: Schema.Optional<Schema.TextField>;
|
|
9
|
+
location: Schema.Optional<Schema.TextField>;
|
|
10
|
+
logo: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
|
|
11
|
+
badge: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
|
|
12
|
+
badgeText: Schema.Optional<Schema.TextField>;
|
|
13
|
+
}>>;
|
|
14
|
+
}>, Schema.Block.Config>>, schema: Block.Create.Result.Schema<true, undefined, Schema.ListField<{
|
|
15
|
+
item: Schema.CollectionField<Schema.Collection<{
|
|
16
|
+
division: Schema.Optional<Schema.TextField>;
|
|
17
|
+
location: Schema.Optional<Schema.TextField>;
|
|
18
|
+
logo: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
|
|
19
|
+
badge: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
|
|
20
|
+
badgeText: Schema.Optional<Schema.TextField>;
|
|
21
|
+
}>>;
|
|
22
|
+
}>, Schema.Block.Config>;
|
|
31
23
|
type Model = Schema.Block.LinkedData<typeof schema>;
|
|
32
|
-
type ItemModel = Model['fields']['items']['value'][number];
|
|
33
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.Clients = Clients;
|
|
18
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
5
|
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
20
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
21
|
-
const react_1 = require("react");
|
|
22
6
|
const entities_1 = require("../entities");
|
|
23
|
-
const
|
|
24
|
-
const schema_1 = require("../schema");
|
|
7
|
+
const Block_1 = require("./Block");
|
|
25
8
|
// component
|
|
26
|
-
function Clients(
|
|
27
|
-
|
|
28
|
-
var { className, headlineTag = 'h2', captionTag = 'div', clientsTag = 'ul', clientTag = 'li', clientProps = {}, clients: clientData } = _a, props = __rest(_a, ["className", "headlineTag", "captionTag", "clientsTag", "clientTag", "clientProps", "clients"]);
|
|
29
|
-
// dont render if missing model
|
|
30
|
-
const { config, fields } = clientData !== null && clientData !== void 0 ? clientData : {};
|
|
31
|
-
const items = (_c = (_b = fields === null || fields === void 0 ? void 0 : fields.items) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : [];
|
|
32
|
-
if (!clientData) {
|
|
33
|
-
console.warn('[Clients] attempted to render without clients model');
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
// slice clients for layout
|
|
37
|
-
let clients;
|
|
38
|
-
let trailingClients;
|
|
39
|
-
if (items.length >= 4) {
|
|
40
|
-
const trailingLogoOffset = items.length - 2;
|
|
41
|
-
clients = items.slice(0, trailingLogoOffset);
|
|
42
|
-
trailingClients = items.slice(trailingLogoOffset);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
clients = items;
|
|
46
|
-
trailingClients = undefined;
|
|
47
|
-
}
|
|
48
|
-
// render
|
|
49
|
-
const { headline: headlineRaw, caption: captionRaw } = fields;
|
|
50
|
-
const headline = headlineRaw === null || headlineRaw === void 0 ? void 0 : headlineRaw.value;
|
|
51
|
-
const caption = captionRaw === null || captionRaw === void 0 ? void 0 : captionRaw.value;
|
|
52
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)(className, 'nd-Clients', schema_1.BlockConfig.Presets.ThemeOnly.getClassName(config)) }, props, { children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-Clients-content", children: [(headline || caption) &&
|
|
53
|
-
(0, jsx_runtime_1.jsx)("div", { className: "nd-Clients-copyWrap", children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-Clients-copy", children: [headline &&
|
|
54
|
-
(0, jsx_runtime_1.jsx)(fields_1.Headline, { className: "nd-Clients-headline", as: headlineTag, headline: headline }), caption &&
|
|
55
|
-
(0, jsx_runtime_1.jsx)(fields_1.Caption, { className: "nd-Clients-caption", as: captionTag, caption: caption })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "nd-Clients-clientsWrap", children: (0, react_1.createElement)(clientsTag, { className: 'nd-Clients-clients' }, (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [clients.map((client) => (0, jsx_runtime_1.jsx)(entities_1.Client, Object.assign({}, clientProps, { as: clientTag, className: "nd-Clients-client", client: client.value }), client.id)), trailingClients && (0, react_1.createElement)(clientTag, { className: 'nd-Clients-trailingClients' }, (0, react_1.createElement)(clientsTag, { className: 'nd-Clients-clients' }, trailingClients.map(client => (0, jsx_runtime_1.jsx)(entities_1.Client, Object.assign({}, clientProps, { as: clientTag, className: "nd-Clients-client", client: client.value }), client.id))))] })) })] }) })));
|
|
9
|
+
function Clients(props) {
|
|
10
|
+
return (0, jsx_runtime_1.jsx)(Clients.Component, Object.assign({}, props));
|
|
56
11
|
}
|
|
57
12
|
// extension
|
|
58
13
|
(function (Clients) {
|
|
59
|
-
|
|
60
|
-
|
|
14
|
+
var _a;
|
|
15
|
+
// factory
|
|
16
|
+
_a = Block_1.Block.create({
|
|
61
17
|
id: '_nd-clients',
|
|
62
18
|
name: 'Clients',
|
|
63
19
|
version: 1,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
items: funnel_core_1.Schema.Field.list({
|
|
20
|
+
className: 'nd-Clients',
|
|
21
|
+
message: true,
|
|
22
|
+
list: {
|
|
23
|
+
schema: funnel_core_1.Schema.Field.list({
|
|
69
24
|
name: 'Clients',
|
|
70
25
|
description: 'Client brands will be displayed in the order you present them.',
|
|
71
26
|
itemTypes: {
|
|
@@ -76,7 +31,8 @@ function Clients(_a) {
|
|
|
76
31
|
},
|
|
77
32
|
min: 3,
|
|
78
33
|
max: 20
|
|
79
|
-
})
|
|
34
|
+
}),
|
|
35
|
+
itemRenderer: (item, itemProps) => ((0, jsx_runtime_1.jsx)(entities_1.Client, Object.assign({ as: "li", className: "nd-Clients-client", client: item.value }, itemProps)))
|
|
80
36
|
}
|
|
81
|
-
});
|
|
37
|
+
}), Clients.Component = _a.Component, Clients.schema = _a.schema;
|
|
82
38
|
})(Clients || (exports.Clients = Clients = {}));
|
|
@@ -2,6 +2,7 @@ import { Schema } from '@nascentdigital/funnel-core';
|
|
|
2
2
|
import { HTMLAttributes, JSXElementConstructor } from 'react';
|
|
3
3
|
import { EmbeddedVideo } from '../../client/refs';
|
|
4
4
|
import { HTMLElements } from '../../types';
|
|
5
|
+
import { BlockPanel } from '../panels';
|
|
5
6
|
export declare function MediaLayout<T extends MediaLayout.Tag>({ className, as, EmbeddedVideoElement, layout, ...props }: MediaLayout.Props<T>): import("react").DetailedReactHTMLElement<{
|
|
6
7
|
prefix?: string | undefined | undefined;
|
|
7
8
|
content?: string | undefined | undefined;
|
|
@@ -291,14 +292,18 @@ export declare namespace MediaLayout {
|
|
|
291
292
|
function getClassName(layout?: Layout): string;
|
|
292
293
|
}
|
|
293
294
|
const schema: Schema.Block<"_nd-mediaLayout", {
|
|
294
|
-
|
|
295
|
+
list: Schema.ListField<{
|
|
295
296
|
visual: Schema.AssetField<Schema.AssetField.LinkedValue.Visual>;
|
|
296
297
|
embedded: Schema.EmbeddedVideoField;
|
|
297
298
|
}>;
|
|
298
|
-
}, {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
299
|
+
}, BlockPanel.GetConfigSchema.Result<{
|
|
300
|
+
list: Schema.ListField<{
|
|
301
|
+
visual: Schema.AssetField<Schema.AssetField.LinkedValue.Visual>;
|
|
302
|
+
embedded: Schema.EmbeddedVideoField;
|
|
303
|
+
}>;
|
|
304
|
+
}, undefined, undefined, "list", {
|
|
305
|
+
mediaLayout: Schema.EnumField<Schema.EnumField.Options<Layout>>;
|
|
306
|
+
}>>;
|
|
302
307
|
type Props<T extends Tag> = Omit<HTMLAttributes<HTMLElements.Standard[T]>, 'children'> & {
|
|
303
308
|
as: T;
|
|
304
309
|
EmbeddedVideoElement?: JSXElementConstructor<EmbeddedVideo.Props>;
|
|
@@ -21,20 +21,23 @@ const classnames_1 = __importDefault(require("classnames"));
|
|
|
21
21
|
const react_1 = require("react");
|
|
22
22
|
const refs_1 = require("../../client/refs");
|
|
23
23
|
const fields_1 = require("../fields");
|
|
24
|
+
const panels_1 = require("../panels");
|
|
24
25
|
const schema_1 = require("../schema");
|
|
25
26
|
// block
|
|
26
27
|
function MediaLayout(_a) {
|
|
27
|
-
var _b, _c
|
|
28
|
+
var _b, _c;
|
|
28
29
|
var { className, as, EmbeddedVideoElement = refs_1.EmbeddedVideo, layout } = _a, props = __rest(_a, ["className", "as", "EmbeddedVideoElement", "layout"]);
|
|
29
30
|
// dont render if missing model
|
|
30
31
|
const { config, fields } = layout !== null && layout !== void 0 ? layout : {};
|
|
31
|
-
const items = (_c = (_b = fields === null || fields === void 0 ? void 0 : fields.
|
|
32
|
+
const items = (_c = (_b = fields === null || fields === void 0 ? void 0 : fields.list) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : [];
|
|
32
33
|
if (!layout) {
|
|
33
34
|
console.warn('[MediaLayout] attempted to render without items model');
|
|
34
35
|
return null;
|
|
35
36
|
}
|
|
36
37
|
// render
|
|
37
|
-
return (0, react_1.createElement)(as, Object.assign({ className: (0, classnames_1.default)(className, 'nd-MediaLayout nd-Block-fullbleed',
|
|
38
|
+
return (0, react_1.createElement)(as, Object.assign({ className: (0, classnames_1.default)(className, 'nd-MediaLayout nd-Block-fullbleed',
|
|
39
|
+
// MediaLayout.Layout.getClassName(config?.layout?.value),
|
|
40
|
+
schema_1.BlockConfig.Presets.ThemeOnly.getClassName(config)) }, props), (0, jsx_runtime_1.jsx)("div", { className: "nd-MediaLayout-content", children: items.map(({ schema, id, value: item }) => (0, jsx_runtime_1.jsx)("div", { className: "nd-MediaLayout-itemWrap", children: funnel_core_1.Schema.EmbeddedVideoField.Value.filter(item)
|
|
38
41
|
?
|
|
39
42
|
(0, jsx_runtime_1.jsx)(EmbeddedVideoElement, { className: "nd-MediaLayout-item", video: item })
|
|
40
43
|
:
|
|
@@ -57,7 +60,8 @@ function MediaLayout(_a) {
|
|
|
57
60
|
name: 'Layout',
|
|
58
61
|
hint: 'Select a media layout',
|
|
59
62
|
description: 'Determine how your assets will be presented.',
|
|
60
|
-
options: Layout.Enum
|
|
63
|
+
options: Layout.Enum,
|
|
64
|
+
defaultOption: '1col'
|
|
61
65
|
});
|
|
62
66
|
// helpers
|
|
63
67
|
function getClassName(layout) {
|
|
@@ -79,27 +83,42 @@ function MediaLayout(_a) {
|
|
|
79
83
|
}
|
|
80
84
|
Layout.getClassName = getClassName;
|
|
81
85
|
})(Layout = MediaLayout.Layout || (MediaLayout.Layout = {}));
|
|
82
|
-
|
|
86
|
+
const fieldsSchema = {
|
|
87
|
+
list: funnel_core_1.Schema.Field.list({
|
|
88
|
+
name: 'Assets',
|
|
89
|
+
description: 'Add one or more assets and then configure the layout.',
|
|
90
|
+
itemTypes: {
|
|
91
|
+
visual: panels_1.VisualPanel.Fields.visual.unwrap(),
|
|
92
|
+
embedded: funnel_core_1.Schema.Field.embeddedVideo({
|
|
93
|
+
name: 'Embedded Video',
|
|
94
|
+
description: 'A remote streaming video (e.g. YouTube)',
|
|
95
|
+
allowMuting: true
|
|
96
|
+
})
|
|
97
|
+
},
|
|
98
|
+
min: 1,
|
|
99
|
+
max: 20
|
|
100
|
+
})
|
|
101
|
+
};
|
|
102
|
+
const configSchema = panels_1.BlockPanel.getConfigSchema({
|
|
103
|
+
fields: fieldsSchema,
|
|
104
|
+
listKey: 'list',
|
|
105
|
+
extend: {
|
|
106
|
+
mediaLayout: Layout.schema
|
|
107
|
+
}
|
|
108
|
+
});
|
|
83
109
|
MediaLayout.schema = funnel_core_1.Schema.Block.create({
|
|
84
110
|
id: '_nd-mediaLayout',
|
|
85
111
|
name: 'MediaLayout',
|
|
86
112
|
version: 1,
|
|
87
|
-
config:
|
|
88
|
-
fields:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
allowMuting: true
|
|
98
|
-
})
|
|
99
|
-
},
|
|
100
|
-
min: 1,
|
|
101
|
-
max: 20
|
|
102
|
-
})
|
|
103
|
-
}
|
|
113
|
+
config: configSchema,
|
|
114
|
+
fields: fieldsSchema,
|
|
115
|
+
getConfig: args => panels_1.BlockPanel.getConfig({
|
|
116
|
+
args,
|
|
117
|
+
listKey: 'list'
|
|
118
|
+
}),
|
|
119
|
+
getLayout: args => panels_1.BlockPanel.getLayout({
|
|
120
|
+
args,
|
|
121
|
+
listKey: 'list'
|
|
122
|
+
})
|
|
104
123
|
});
|
|
105
124
|
})(MediaLayout || (exports.MediaLayout = MediaLayout = {}));
|
|
@@ -1,76 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { Anchor, ItemAlignment, ItemPosition, ItemSize, TextAlignment } from '../schema';
|
|
6
|
-
export declare function Message({ className, titleTag, headlineTag, captionTag, message, visualDecorator, visualLoading, ...props }: Message.Props): import("react/jsx-runtime").JSX.Element | null;
|
|
1
|
+
import { Schema } from '@nascentdigital/funnel-core';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
import { Block } from './Block';
|
|
4
|
+
export declare function Message({ className, ...props }: ComponentProps<typeof Message.Component>): import("react/jsx-runtime").JSX.Element;
|
|
7
5
|
export declare namespace Message {
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
type Variant = 'featured' | 'branding' | 'action';
|
|
7
|
+
namespace Variant {
|
|
10
8
|
const Enum: Schema.EnumField.Options<Variant>;
|
|
11
9
|
const schema: Schema.EnumField<Schema.EnumField.Options<Variant>>;
|
|
12
10
|
function getClassName(variant?: Variant): string;
|
|
13
11
|
}
|
|
14
|
-
|
|
15
|
-
export namespace VisualWidth {
|
|
16
|
-
const Enum: Schema.EnumField.Options<VisualWidth>;
|
|
17
|
-
const schema: Schema.EnumField<Schema.EnumField.Options<VisualWidth>>;
|
|
18
|
-
function getClassName(width?: VisualWidth): string;
|
|
19
|
-
}
|
|
20
|
-
const configSchema: {
|
|
12
|
+
const Component: import("react").FunctionComponent<Block.Create.Result.Component<true, true, undefined, {
|
|
21
13
|
variant: Schema.EnumField<Schema.EnumField.Options<Variant>>;
|
|
22
|
-
|
|
23
|
-
messageHorizontalPosition: Schema.Optional<Schema.EnumField<Schema.EnumField.Options<ItemAlignment>>>;
|
|
24
|
-
messageVerticalPosition: Schema.Optional<Schema.EnumField<Schema.EnumField.Options<ItemAlignment>>>;
|
|
25
|
-
messageWidth: Schema.Optional<Schema.EnumField<Schema.EnumField.Options<ItemSize>>>;
|
|
26
|
-
visualPosition: Schema.Optional<Schema.EnumField<Schema.EnumField.Options<ItemPosition>>>;
|
|
27
|
-
visualAspect: Schema.Optional<Schema.EnumField<Schema.EnumField.Options<BlockLayout.AspectRatio>>>;
|
|
28
|
-
visualAnchor: Schema.Optional<Schema.EnumField<Schema.EnumField.Options<Anchor>>>;
|
|
29
|
-
visualWidth: Schema.Optional<Schema.EnumField<Schema.EnumField.Options<VisualWidth>>>;
|
|
30
|
-
contentAlignment: Schema.Optional<Schema.EnumField<Schema.EnumField.Options<ItemAlignment>>>;
|
|
31
|
-
theme: Schema.EnumField<Readonly<import("@nascentdigital/funnel-core").BlockThemes.Options>>;
|
|
32
|
-
};
|
|
33
|
-
const fieldsSchema: {
|
|
34
|
-
visual: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
|
|
35
|
-
title: Schema.Optional<Schema.TextField>;
|
|
36
|
-
headline: Schema.RichTextField;
|
|
37
|
-
caption: Schema.Optional<Schema.RichTextField>;
|
|
38
|
-
ctas: Schema.Optional<Schema.ListField<{
|
|
39
|
-
cta: Schema.LinkField;
|
|
40
|
-
}>>;
|
|
41
|
-
};
|
|
42
|
-
export const schema: Schema.Block<"_nd-message", {
|
|
43
|
-
visual: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
|
|
44
|
-
title: Schema.Optional<Schema.TextField>;
|
|
45
|
-
headline: Schema.RichTextField;
|
|
46
|
-
caption: Schema.Optional<Schema.RichTextField>;
|
|
47
|
-
ctas: Schema.Optional<Schema.ListField<{
|
|
48
|
-
cta: Schema.LinkField;
|
|
49
|
-
}>>;
|
|
50
|
-
}, {
|
|
14
|
+
}>>, schema: Block.Create.Result.Schema<true, true, undefined, {
|
|
51
15
|
variant: Schema.EnumField<Schema.EnumField.Options<Variant>>;
|
|
52
|
-
messageTextAlignment: Schema.Optional<Schema.EnumField<Schema.EnumField.Options<TextAlignment>>>;
|
|
53
|
-
messageHorizontalPosition: Schema.Optional<Schema.EnumField<Schema.EnumField.Options<ItemAlignment>>>;
|
|
54
|
-
messageVerticalPosition: Schema.Optional<Schema.EnumField<Schema.EnumField.Options<ItemAlignment>>>;
|
|
55
|
-
messageWidth: Schema.Optional<Schema.EnumField<Schema.EnumField.Options<ItemSize>>>;
|
|
56
|
-
visualPosition: Schema.Optional<Schema.EnumField<Schema.EnumField.Options<ItemPosition>>>;
|
|
57
|
-
visualAspect: Schema.Optional<Schema.EnumField<Schema.EnumField.Options<BlockLayout.AspectRatio>>>;
|
|
58
|
-
visualAnchor: Schema.Optional<Schema.EnumField<Schema.EnumField.Options<Anchor>>>;
|
|
59
|
-
visualWidth: Schema.Optional<Schema.EnumField<Schema.EnumField.Options<VisualWidth>>>;
|
|
60
|
-
contentAlignment: Schema.Optional<Schema.EnumField<Schema.EnumField.Options<ItemAlignment>>>;
|
|
61
|
-
theme: Schema.EnumField<Readonly<import("@nascentdigital/funnel-core").BlockThemes.Options>>;
|
|
62
16
|
}>;
|
|
63
|
-
|
|
64
|
-
titleTag?: Title.Tag;
|
|
65
|
-
headlineTag?: Headline.Tag;
|
|
66
|
-
captionTag?: Caption.Tag;
|
|
67
|
-
message: Model;
|
|
68
|
-
visualDecorator?: ReactNode;
|
|
69
|
-
visualLoading?: Visual.Loading;
|
|
70
|
-
};
|
|
71
|
-
export type Model = Schema.Block.LinkedData<typeof schema>;
|
|
72
|
-
export type GetConfigArgs = Schema.Block.GetConfig.Args<typeof configSchema, typeof fieldsSchema>;
|
|
73
|
-
export type GetConfigResult = Schema.Block.GetConfig.Result<typeof configSchema>;
|
|
74
|
-
export type GetLayoutArgs = Schema.Block.GetLayout.Args<typeof configSchema, typeof fieldsSchema>;
|
|
75
|
-
export {};
|
|
17
|
+
type Model = Schema.Block.LinkedData<typeof schema>;
|
|
76
18
|
}
|