@nascentdigital/funnel-ui 4.4.21 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/Tailwind.d.ts +5 -1
  2. package/dist/Tailwind.js +9 -0
  3. package/dist/server/blocks/Block.d.ts +42 -2
  4. package/dist/server/blocks/Block.js +88 -0
  5. package/dist/server/blocks/Clients.d.ts +20 -29
  6. package/dist/server/blocks/Clients.js +13 -57
  7. package/dist/server/blocks/MediaLayout.d.ts +10 -5
  8. package/dist/server/blocks/MediaLayout.js +41 -22
  9. package/dist/server/blocks/Message.d.ts +9 -67
  10. package/dist/server/blocks/Message.js +15 -292
  11. package/dist/server/blocks/Outcome.d.ts +22 -82
  12. package/dist/server/blocks/Outcome.js +20 -474
  13. package/dist/server/blocks/Testimonial.d.ts +81 -16
  14. package/dist/server/blocks/Testimonial.js +59 -27
  15. package/dist/server/blocks/Testimonials.d.ts +41 -0
  16. package/dist/server/blocks/Testimonials.js +90 -0
  17. package/dist/server/blocks/ValueProp.d.ts +19 -38
  18. package/dist/server/blocks/ValueProp.js +14 -100
  19. package/dist/server/blocks/index.d.ts +1 -0
  20. package/dist/server/blocks/index.js +1 -0
  21. package/dist/server/blocks/summary/Statement.d.ts +304 -0
  22. package/dist/server/blocks/summary/Statement.js +52 -0
  23. package/dist/server/blocks/summary/Summary.d.ts +18 -0
  24. package/dist/server/blocks/summary/Summary.js +34 -0
  25. package/dist/server/blocks/summary/index.d.ts +1 -0
  26. package/dist/server/blocks/summary/index.js +17 -0
  27. package/dist/server/entities/Person.d.ts +27 -2
  28. package/dist/server/entities/Person.js +55 -5
  29. package/dist/server/layouts/BrickLayout.d.ts +290 -0
  30. package/dist/server/layouts/BrickLayout.js +25 -0
  31. package/dist/server/layouts/CardLayout.d.ts +291 -0
  32. package/dist/server/layouts/CardLayout.js +25 -0
  33. package/dist/server/layouts/FlexWrapLayout.d.ts +290 -0
  34. package/dist/server/layouts/FlexWrapLayout.js +41 -0
  35. package/dist/server/layouts/StackLayout.d.ts +290 -0
  36. package/dist/server/layouts/StackLayout.js +25 -0
  37. package/dist/server/layouts/grid/GridItem.d.ts +8 -0
  38. package/dist/server/layouts/grid/GridItem.js +9 -0
  39. package/dist/server/layouts/grid/GridLayout.d.ts +293 -0
  40. package/dist/server/layouts/grid/GridLayout.js +25 -0
  41. package/dist/server/layouts/grid/index.d.ts +2 -0
  42. package/dist/server/layouts/grid/index.js +18 -0
  43. package/dist/server/layouts/index.d.ts +5 -0
  44. package/dist/server/layouts/index.js +21 -0
  45. package/dist/server/panels/BlockPanel.d.ts +80 -1
  46. package/dist/server/panels/BlockPanel.js +831 -0
  47. package/dist/server/panels/ListPanel.d.ts +62 -0
  48. package/dist/server/panels/ListPanel.js +137 -0
  49. package/dist/server/panels/MessagePanel.d.ts +69 -5
  50. package/dist/server/panels/MessagePanel.js +128 -5
  51. package/dist/server/panels/TestimonialPanel.d.ts +47 -0
  52. package/dist/server/panels/TestimonialPanel.js +71 -0
  53. package/dist/server/panels/VisualPanel.d.ts +45 -13
  54. package/dist/server/panels/VisualPanel.js +75 -16
  55. package/dist/server/panels/index.d.ts +2 -0
  56. package/dist/server/panels/index.js +2 -0
  57. package/dist/server/schema/BlockConfig.d.ts +3 -1
  58. package/dist/server/schema/BlockConfig.js +2 -1
  59. package/dist/server/schema/ItemAlignment.d.ts +2 -0
  60. package/dist/server/schema/ItemPosition.d.ts +1 -0
  61. package/dist/server/schema/ItemSize.d.ts +2 -1
  62. package/dist/server/schema/ItemSize.js +2 -1
  63. package/dist/server/schema/ListPanelLayout.d.ts +34 -0
  64. package/dist/server/schema/ListPanelLayout.js +24 -0
  65. package/dist/server/schema/PanelLayout.d.ts +14 -0
  66. package/dist/server/schema/PanelLayout.js +70 -0
  67. package/dist/server/schema/SlotVariation.d.ts +9 -0
  68. package/dist/server/schema/SlotVariation.js +48 -0
  69. package/dist/server/schema/TextAlignment.d.ts +1 -0
  70. package/dist/server/schema/index.d.ts +3 -0
  71. package/dist/server/schema/index.js +3 -0
  72. package/dist/styles/blocks/Clients.css +0 -1
  73. package/dist/styles/blocks/Message.css +0 -343
  74. package/dist/styles/blocks/Outcome.css +13 -50
  75. package/dist/styles/blocks/Summary.css +15 -0
  76. package/dist/styles/blocks/Testimonial.css +1 -318
  77. package/dist/styles/blocks/ValueProp.css +0 -126
  78. package/dist/styles/blocks/_index.css +1 -0
  79. package/dist/styles/layouts/BrickLayout.css +43 -0
  80. package/dist/styles/layouts/CardLayout.css +46 -0
  81. package/dist/styles/layouts/FlexWrapLayout.css +38 -0
  82. package/dist/styles/layouts/GridLayout.css +25 -0
  83. package/dist/styles/layouts/StackLayout.css +46 -0
  84. package/dist/styles/layouts/_index.css +6 -1
  85. package/dist/styles/panels/ListPanel.css +3 -0
  86. package/dist/styles/panels/TestimonialPanel.css +64 -0
  87. package/dist/styles/panels/_index.css +2 -0
  88. package/package.json +3 -2
@@ -0,0 +1,62 @@
1
+ import { BlockLayout, Schema, Transform } from '@nascentdigital/funnel-core';
2
+ import { ReactNode } from 'react';
3
+ import { HTMLElements } from '../../types';
4
+ import { ItemAlignment, ItemSize, ListPanelLayout } from '../schema';
5
+ import { BlockPanel } from './BlockPanel';
6
+ export declare function ListPanel<TItem extends ListPanel.Item>({ as, className, panel, layout, items, overrides, children }: ListPanel.Props<TItem>): import("react/jsx-runtime").JSX.Element | undefined;
7
+ export declare namespace ListPanel {
8
+ namespace Config {
9
+ type Key<TPrefix extends string = string> = Key.HorizontalAlign<TPrefix> | Key.VerticalAlign<TPrefix> | Key.Width<TPrefix>;
10
+ namespace Key {
11
+ type Layout<TPrefix extends string> = `${TPrefix}Layout`;
12
+ function layout<TPrefix extends string>(prefix: TPrefix): Layout<TPrefix>;
13
+ type Width<TPrefix extends string> = `${TPrefix}Width`;
14
+ function width<TPrefix extends string>(prefix: TPrefix): Width<TPrefix>;
15
+ type HorizontalAlign<TPrefix extends string> = `${TPrefix}HorizontalAlign`;
16
+ function horizontalAlign<TPrefix extends string>(prefix: TPrefix): HorizontalAlign<TPrefix>;
17
+ type VerticalAlign<TPrefix extends string> = `${TPrefix}VerticalAlign`;
18
+ function verticalAlign<TPrefix extends string>(prefix: TPrefix): VerticalAlign<TPrefix>;
19
+ }
20
+ type Keys<TPrefix extends string> = {
21
+ layout: Key.Layout<TPrefix>;
22
+ width: Key.Width<TPrefix>;
23
+ horizontalAlign: Key.HorizontalAlign<TPrefix>;
24
+ verticalAlign: Key.VerticalAlign<TPrefix>;
25
+ };
26
+ function getKeys<TPrefix extends string>(prefix: TPrefix): Keys<TPrefix>;
27
+ type Entries<TPrefix extends string> = Record<Key.Width<TPrefix>, ItemSize.Schema> & Record<Key.HorizontalAlign<TPrefix>, ItemAlignment.Horizontal.Schema> & Record<Key.VerticalAlign<TPrefix>, ItemAlignment.Vertical.Schema>;
28
+ }
29
+ type Item = {
30
+ id: string;
31
+ };
32
+ type Props<TItem extends Item> = {
33
+ as?: HTMLElements.Standard.Container;
34
+ className?: string;
35
+ panel: BlockLayout.List;
36
+ layout: ListPanelLayout;
37
+ items: ReadonlyArray<TItem>;
38
+ overrides?: Overrides;
39
+ children: Transform<TItem, ReactNode>;
40
+ };
41
+ namespace Props {
42
+ type Configuration = Pick<Partial<Props<any>>, 'className' | 'layout' | 'overrides'>;
43
+ }
44
+ type Overrides = {
45
+ [TKey in keyof ListPanelLayout.Configs]?: Partial<ListPanelLayout.Configs[TKey]>;
46
+ };
47
+ namespace GetConfig {
48
+ type ConfigSchema<TPrefix extends string> = Record<Config.Key.Layout<TPrefix>, ListPanelLayout.Schema> & Record<Config.Key.Width<TPrefix>, ItemSize.Schema> & Record<Config.Key.HorizontalAlign<TPrefix>, ItemAlignment.Horizontal.Schema> & Record<Config.Key.VerticalAlign<TPrefix>, ItemAlignment.Vertical.Schema>;
49
+ type ConfigData<TPrefix extends string> = Schema.Block.Data.ForConfig<ConfigSchema<TPrefix>>;
50
+ type Args<TPrefix extends string> = {
51
+ listKey: TPrefix;
52
+ config?: Partial<ConfigData<TPrefix>>;
53
+ flexDirection?: BlockPanel.Slots.FlexDirection;
54
+ };
55
+ type Result<TPrefix extends string> = {
56
+ configSchema: Partial<ConfigSchema<TPrefix>>;
57
+ config: Partial<ConfigData<TPrefix>>;
58
+ defaultConfig: Partial<ConfigData<TPrefix>>;
59
+ };
60
+ }
61
+ function getConfig<TPrefix extends string>({ listKey, config, flexDirection }: GetConfig.Args<TPrefix>): GetConfig.Result<TPrefix>;
62
+ }
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ListPanel = ListPanel;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const funnel_core_1 = require("@nascentdigital/funnel-core");
9
+ const classnames_1 = __importDefault(require("classnames"));
10
+ const react_1 = require("react");
11
+ const layouts_1 = require("../layouts");
12
+ const schema_1 = require("../schema");
13
+ const BlockPanel_1 = require("./BlockPanel");
14
+ // component
15
+ function ListPanel({ as = 'ul', className, panel, layout, items, overrides = {}, children }) {
16
+ // skip if there's no items
17
+ if (items.length === 0) {
18
+ return undefined;
19
+ }
20
+ // render items
21
+ const itemsComponent = items.map(item => (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: children(item) }, item.id));
22
+ // build layout options
23
+ const { brick, brickFlipped, card, flexWrap, grid, horizontalStack, verticalStack, } = overrides;
24
+ // render layout
25
+ let layoutComponent;
26
+ switch (layout) {
27
+ case 'brick':
28
+ layoutComponent = ((0, jsx_runtime_1.jsx)(layouts_1.BrickLayout, Object.assign({ as: as }, brick, { children: itemsComponent })));
29
+ break;
30
+ case 'brickFlipped':
31
+ layoutComponent = ((0, jsx_runtime_1.jsx)(layouts_1.BrickLayout, Object.assign({ as: as, flipped: true }, brickFlipped, { children: itemsComponent })));
32
+ break;
33
+ case 'card':
34
+ layoutComponent = ((0, jsx_runtime_1.jsx)(layouts_1.CardLayout, Object.assign({ as: as }, card, { children: itemsComponent })));
35
+ break;
36
+ case 'flexWrap':
37
+ layoutComponent = ((0, jsx_runtime_1.jsx)(layouts_1.FlexWrapLayout, Object.assign({ as: as }, flexWrap, { children: itemsComponent })));
38
+ break;
39
+ case 'grid':
40
+ layoutComponent = ((0, jsx_runtime_1.jsx)(layouts_1.GridLayout, Object.assign({ as: as, columns: 3 }, grid, { children: itemsComponent })));
41
+ break;
42
+ case 'horizontalStack':
43
+ layoutComponent = ((0, jsx_runtime_1.jsx)(layouts_1.StackLayout, Object.assign({ as: as, direction: "horizontal" }, horizontalStack, { children: itemsComponent })));
44
+ break;
45
+ case 'verticalStack':
46
+ layoutComponent = ((0, jsx_runtime_1.jsx)(layouts_1.StackLayout, Object.assign({ as: as, direction: "vertical" }, verticalStack, { children: itemsComponent })));
47
+ }
48
+ // render
49
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(className, '@container nd-ListPanel',
50
+ // base layout
51
+ BlockPanel_1.BlockPanel.getClassNames({ panel })), children: (0, jsx_runtime_1.jsx)("div", { className: "nd-BlockPanel-content nd-ListPanel-content", children: layoutComponent }) }));
52
+ }
53
+ // extension
54
+ (function (ListPanel) {
55
+ // config
56
+ let Config;
57
+ (function (Config) {
58
+ let Key;
59
+ (function (Key) {
60
+ function layout(prefix) {
61
+ return `${prefix}Layout`;
62
+ }
63
+ Key.layout = layout;
64
+ function width(prefix) {
65
+ return `${prefix}Width`;
66
+ }
67
+ Key.width = width;
68
+ function horizontalAlign(prefix) {
69
+ return `${prefix}HorizontalAlign`;
70
+ }
71
+ Key.horizontalAlign = horizontalAlign;
72
+ function verticalAlign(prefix) {
73
+ return `${prefix}VerticalAlign`;
74
+ }
75
+ Key.verticalAlign = verticalAlign;
76
+ })(Key = Config.Key || (Config.Key = {}));
77
+ function getKeys(prefix) {
78
+ return {
79
+ layout: `${prefix}Layout`,
80
+ width: `${prefix}Width`,
81
+ horizontalAlign: `${prefix}HorizontalAlign`,
82
+ verticalAlign: `${prefix}VerticalAlign`
83
+ };
84
+ }
85
+ Config.getKeys = getKeys;
86
+ })(Config = ListPanel.Config || (ListPanel.Config = {}));
87
+ function getConfig({ listKey, config = {}, flexDirection }) {
88
+ var _a, _b, _c, _d, _e, _f, _g, _h;
89
+ const keys = Config.getKeys(listKey);
90
+ const configSchema = {
91
+ [keys.layout]: schema_1.ListPanelLayout.schema,
92
+ [keys.width]: schema_1.ItemSize.schema,
93
+ [keys.horizontalAlign]: schema_1.ItemAlignment.Horizontal.schema,
94
+ [keys.verticalAlign]: schema_1.ItemAlignment.Vertical.schema
95
+ };
96
+ // resolve values
97
+ const defaultLayout = 'card';
98
+ const layout = (_b = (_a = config[keys.layout]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : defaultLayout;
99
+ const defaultWidth = 'md';
100
+ const width = (_d = (_c = config[keys.width]) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : defaultWidth;
101
+ const defaultHorizontalAlign = 'start';
102
+ const horizontalAlign = (_f = (_e = config[keys.horizontalAlign]) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : defaultHorizontalAlign;
103
+ const defaultVerticalAlign = 'start';
104
+ const verticalAlign = (_h = (_g = config[keys.verticalAlign]) === null || _g === void 0 ? void 0 : _g.value) !== null && _h !== void 0 ? _h : defaultVerticalAlign;
105
+ if (width === 'full') {
106
+ delete configSchema[keys.horizontalAlign];
107
+ }
108
+ if (flexDirection === 'x') {
109
+ delete configSchema[keys.verticalAlign];
110
+ }
111
+ else if (flexDirection === 'y') {
112
+ delete configSchema[keys.width];
113
+ delete configSchema[keys.horizontalAlign];
114
+ }
115
+ else if (flexDirection === 'none') {
116
+ delete configSchema[keys.width];
117
+ delete configSchema[keys.horizontalAlign];
118
+ delete configSchema[keys.verticalAlign];
119
+ }
120
+ return {
121
+ configSchema,
122
+ config: {
123
+ [keys.layout]: funnel_core_1.Schema.EnumField.Value.toData(layout),
124
+ [keys.width]: funnel_core_1.Schema.EnumField.Value.toData(width),
125
+ [keys.verticalAlign]: funnel_core_1.Schema.EnumField.Value.toData(verticalAlign),
126
+ [keys.horizontalAlign]: funnel_core_1.Schema.EnumField.Value.toData(horizontalAlign)
127
+ },
128
+ defaultConfig: {
129
+ [keys.layout]: funnel_core_1.Schema.EnumField.Value.toData(defaultLayout),
130
+ [keys.width]: funnel_core_1.Schema.EnumField.Value.toData(defaultWidth),
131
+ [keys.verticalAlign]: funnel_core_1.Schema.EnumField.Value.toData(defaultVerticalAlign),
132
+ [keys.horizontalAlign]: funnel_core_1.Schema.EnumField.Value.toData(defaultHorizontalAlign)
133
+ },
134
+ };
135
+ }
136
+ ListPanel.getConfig = getConfig;
137
+ })(ListPanel || (exports.ListPanel = ListPanel = {}));
@@ -1,8 +1,9 @@
1
1
  import { BlockLayout, Schema } from '@nascentdigital/funnel-core';
2
+ import { ReactNode } from 'react';
2
3
  import { Caption, Headline, Title } from '../fields';
3
- import { TextAlignment } from '../schema';
4
+ import { ItemAlignment, ItemSize, TextAlignment } from '../schema';
4
5
  import { BlockPanel } from './BlockPanel';
5
- export declare function MessagePanel({ className, panel, titleTag, title, headlineTag, headline, captionTag, caption, ctas: ctasRaw, textAlign, alignX, alignY, size, fullbleed, mobileOrder }: MessagePanel.Props): import("react/jsx-runtime").JSX.Element;
6
+ export declare function MessagePanel({ className, panel, titleTag, title, headlineTag, headline, captionTag, caption, ctas: ctasRaw, textAlign, alignX, alignY, size, fullbleed, mobileOrder, decorator }: MessagePanel.Props): import("react/jsx-runtime").JSX.Element | null;
6
7
  export declare namespace MessagePanel {
7
8
  type Props = BlockPanel.Props & {
8
9
  className?: string;
@@ -10,15 +11,42 @@ export declare namespace MessagePanel {
10
11
  titleTag?: Title.Tag;
11
12
  title?: Title.Value;
12
13
  headlineTag?: Headline.Tag;
13
- headline: Headline.Value;
14
+ headline?: Headline.Value;
14
15
  caption?: Caption.Value;
15
16
  captionTag?: Caption.Tag;
16
17
  ctas?: Schema.LinkField.LinkedValue | Fields.ctas.Value;
17
18
  textAlign?: TextAlignment;
19
+ decorator?: ReactNode;
18
20
  };
21
+ namespace Props {
22
+ type Configuration = Pick<Props, 'className' | 'titleTag' | 'headlineTag' | 'captionTag' | 'decorator'>;
23
+ }
24
+ namespace Config {
25
+ type Key<TPrefix extends string = string> = Key.TextAlign<TPrefix> | Key.HorizontalAlign<TPrefix> | Key.VerticalAlign<TPrefix> | Key.Width<TPrefix>;
26
+ namespace Key {
27
+ type Position<TPrefix extends string> = `${TPrefix}Position`;
28
+ function position<TPrefix extends string>(prefix: TPrefix): Position<TPrefix>;
29
+ type TextAlign<TPrefix extends string> = `${TPrefix}TextAlign`;
30
+ function textAlign<TPrefix extends string>(prefix: TPrefix): TextAlign<TPrefix>;
31
+ type Width<TPrefix extends string> = `${TPrefix}Width`;
32
+ function width<TPrefix extends string>(prefix: TPrefix): Width<TPrefix>;
33
+ type HorizontalAlign<TPrefix extends string> = `${TPrefix}HorizontalAlign`;
34
+ function horizontalAlign<TPrefix extends string>(prefix: TPrefix): HorizontalAlign<TPrefix>;
35
+ type VerticalAlign<TPrefix extends string> = `${TPrefix}VerticalAlign`;
36
+ function verticalAlign<TPrefix extends string>(prefix: TPrefix): VerticalAlign<TPrefix>;
37
+ }
38
+ type Keys<TPrefix extends string> = {
39
+ textAlign: Key.TextAlign<TPrefix>;
40
+ width: Key.Width<TPrefix>;
41
+ horizontalAlign: Key.HorizontalAlign<TPrefix>;
42
+ verticalAlign: Key.VerticalAlign<TPrefix>;
43
+ };
44
+ function getKeys<TPrefix extends string>(prefix: TPrefix): Keys<TPrefix>;
45
+ type Entries<TPrefix extends string> = Record<Key.TextAlign<TPrefix>, TextAlignment.Schema> & Record<Key.Width<TPrefix>, ItemSize.Schema> & Record<Key.HorizontalAlign<TPrefix>, ItemAlignment.Horizontal.Schema> & Record<Key.VerticalAlign<TPrefix>, ItemAlignment.Vertical.Schema>;
46
+ }
19
47
  namespace Fields {
20
- const title: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
21
- const headline: Schema.RichTextField;
48
+ const title: Schema.Optional<Schema.TextField>;
49
+ const headline: Schema.Optional<Schema.RichTextField>;
22
50
  const caption: Schema.Optional<Schema.RichTextField>;
23
51
  const cta: Schema.LinkField;
24
52
  const ctas: Schema.Optional<Schema.ListField<{
@@ -27,5 +55,41 @@ export declare namespace MessagePanel {
27
55
  namespace ctas {
28
56
  type Value = Schema.Field.LinkedValue.ForOptionalType<typeof ctas>;
29
57
  }
58
+ const all: {
59
+ readonly title: Schema.Optional<Schema.TextField>;
60
+ readonly headline: Schema.Optional<Schema.RichTextField>;
61
+ readonly caption: Schema.Optional<Schema.RichTextField>;
62
+ readonly ctas: Schema.Optional<Schema.ListField<{
63
+ cta: Schema.LinkField;
64
+ }>>;
65
+ };
66
+ type Keys<TitleKey extends string | undefined = string | undefined, HeadlineKey extends string | undefined = string | undefined, CaptionKey extends string | undefined = string | undefined, CtasKey extends string | undefined = string | undefined> = {
67
+ title: TitleKey;
68
+ headline: HeadlineKey;
69
+ caption: CaptionKey;
70
+ ctas: CtasKey;
71
+ };
72
+ namespace GetSchema {
73
+ type Result<TKeys extends Partial<Keys> = {}> = Record<TKeys['title'] extends string ? TKeys['title'] : 'title', typeof title> & Record<TKeys['headline'] extends string ? TKeys['headline'] : 'headline', typeof headline> & Record<TKeys['caption'] extends string ? TKeys['caption'] : 'caption', typeof caption> & Record<TKeys['ctas'] extends string ? TKeys['ctas'] : 'ctas', typeof ctas>;
74
+ }
75
+ function getSchema<TitleKey extends string | undefined, HeadlineKey extends string | undefined, CaptionKey extends string | undefined, CtasKey extends string | undefined>(keys?: Partial<Keys<TitleKey, HeadlineKey, CaptionKey, CtasKey>>): GetSchema.Result<Keys<TitleKey, HeadlineKey, CaptionKey, CtasKey>>;
76
+ function exists(fields: Record<string, Schema.Field.Data | Schema.Field.LinkedData>, keys?: Partial<Keys>): boolean;
77
+ }
78
+ namespace GetConfig {
79
+ type ConfigSchema<TPrefix extends string> = Record<Config.Key.TextAlign<TPrefix>, TextAlignment.Schema> & Record<Config.Key.Width<TPrefix>, ItemSize.Schema> & Record<Config.Key.HorizontalAlign<TPrefix>, ItemAlignment.Horizontal.Schema> & Record<Config.Key.VerticalAlign<TPrefix>, ItemAlignment.Vertical.Schema>;
80
+ type ConfigData<TPrefix extends string> = Schema.Block.Data.ForConfig<ConfigSchema<TPrefix>>;
81
+ type Args<TPrefix extends string, TFields extends Schema.Fields = Schema.Fields> = {
82
+ messageKey: TPrefix;
83
+ config?: Partial<ConfigData<TPrefix>>;
84
+ fields: TFields;
85
+ flexDirection?: BlockPanel.Slots.FlexDirection;
86
+ };
87
+ type Result<TPrefix extends string> = {
88
+ configSchema: Partial<ConfigSchema<TPrefix>>;
89
+ config: Partial<ConfigData<TPrefix>>;
90
+ defaultConfig: Partial<ConfigData<TPrefix>>;
91
+ isInline: boolean;
92
+ };
30
93
  }
94
+ function getConfig<TPrefix extends string, TFields extends Schema.Fields = Schema.Fields>({ messageKey, config, flexDirection }: GetConfig.Args<TPrefix, TFields>): GetConfig.Result<TPrefix>;
31
95
  }
@@ -8,9 +8,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const funnel_core_1 = require("@nascentdigital/funnel-core");
9
9
  const classnames_1 = __importDefault(require("classnames"));
10
10
  const fields_1 = require("../fields");
11
+ const schema_1 = require("../schema");
11
12
  const BlockPanel_1 = require("./BlockPanel");
12
13
  // component
13
- function MessagePanel({ className, panel, titleTag = 'span', title, headlineTag = 'h2', headline, captionTag = 'div', caption, ctas: ctasRaw = [], textAlign, alignX, alignY, size, fullbleed, mobileOrder }) {
14
+ function MessagePanel({ className, panel, titleTag = 'span', title, headlineTag = 'h2', headline, captionTag = 'div', caption, ctas: ctasRaw = [], textAlign, alignX, alignY, size, fullbleed, mobileOrder, decorator }) {
14
15
  // normalize ctas
15
16
  let ctas;
16
17
  if (Array.isArray(ctasRaw)) {
@@ -26,6 +27,10 @@ function MessagePanel({ className, panel, titleTag = 'span', title, headlineTag
26
27
  }
27
28
  ];
28
29
  }
30
+ // don't render if no fields are active
31
+ if (!title && !headline && !caption && ctas.length === 0) {
32
+ return null;
33
+ }
29
34
  // render
30
35
  return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(className, 'nd-MessagePanel',
31
36
  // base layout
@@ -55,19 +60,58 @@ function MessagePanel({ className, panel, titleTag = 'span', title, headlineTag
55
60
  right: 'lg:nd-MessagePanel-textEnd'
56
61
  }
57
62
  })), children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-BlockPanel-content nd-MessagePanel-content", children: [title &&
58
- (0, jsx_runtime_1.jsx)(fields_1.Title, { className: "nd-MessagePanel-title", as: titleTag, title: title }), (0, jsx_runtime_1.jsx)(fields_1.Headline, { className: "nd-MessagePanel-headline", as: headlineTag, headline: headline }), caption &&
63
+ (0, jsx_runtime_1.jsx)(fields_1.Title, { className: "nd-MessagePanel-title", as: titleTag, title: title }), headline &&
64
+ (0, jsx_runtime_1.jsx)(fields_1.Headline, { className: "nd-MessagePanel-headline", as: headlineTag, headline: headline }), caption &&
59
65
  (0, jsx_runtime_1.jsx)(fields_1.Caption, { className: "nd-MessagePanel-caption", as: captionTag, caption: caption }), ctas.length > 0 &&
60
- (0, jsx_runtime_1.jsx)("div", { className: "nd-MessagePanel-ctas", children: ctas.map(cta => (0, jsx_runtime_1.jsx)(fields_1.Link, { className: "nd-MessagePanel-cta", link: cta.value }, cta.id)) })] }) }));
66
+ (0, jsx_runtime_1.jsx)("div", { className: "nd-MessagePanel-ctas", children: ctas.map(cta => (0, jsx_runtime_1.jsx)(fields_1.Link, { className: "nd-MessagePanel-cta", link: cta.value }, cta.id)) }), decorator &&
67
+ (0, jsx_runtime_1.jsx)("div", { className: "nd-MessagePanel-decorator", children: decorator })] }) }));
61
68
  }
62
69
  // extension
63
70
  (function (MessagePanel) {
71
+ // config
72
+ let Config;
73
+ (function (Config) {
74
+ let Key;
75
+ (function (Key) {
76
+ function position(prefix) {
77
+ return `${prefix}Position`;
78
+ }
79
+ Key.position = position;
80
+ function textAlign(prefix) {
81
+ return `${prefix}TextAlign`;
82
+ }
83
+ Key.textAlign = textAlign;
84
+ function width(prefix) {
85
+ return `${prefix}Width`;
86
+ }
87
+ Key.width = width;
88
+ function horizontalAlign(prefix) {
89
+ return `${prefix}HorizontalAlign`;
90
+ }
91
+ Key.horizontalAlign = horizontalAlign;
92
+ function verticalAlign(prefix) {
93
+ return `${prefix}VerticalAlign`;
94
+ }
95
+ Key.verticalAlign = verticalAlign;
96
+ })(Key = Config.Key || (Config.Key = {}));
97
+ function getKeys(prefix) {
98
+ return {
99
+ textAlign: `${prefix}TextAlign`,
100
+ width: `${prefix}Width`,
101
+ horizontalAlign: `${prefix}HorizontalAlign`,
102
+ verticalAlign: `${prefix}VerticalAlign`
103
+ };
104
+ }
105
+ Config.getKeys = getKeys;
106
+ })(Config = MessagePanel.Config || (MessagePanel.Config = {}));
64
107
  // fields
65
108
  let Fields;
66
109
  (function (Fields) {
67
- Fields.title = fields_1.Visual.schema.modify({
110
+ // schemas
111
+ Fields.title = fields_1.Title.schema.modify({
68
112
  description: 'A short intro or heading for the message'
69
113
  }).optional();
70
- Fields.headline = fields_1.Headline.schema;
114
+ Fields.headline = fields_1.Headline.schema.optional();
71
115
  Fields.caption = fields_1.Caption.schema.optional();
72
116
  Fields.cta = funnel_core_1.Schema.Field.link({ name: 'Call to Action' });
73
117
  Fields.ctas = funnel_core_1.Schema.Field.list({
@@ -77,5 +121,84 @@ function MessagePanel({ className, panel, titleTag = 'span', title, headlineTag
77
121
  min: 1,
78
122
  max: 2
79
123
  }).optional();
124
+ Fields.all = {
125
+ title: Fields.title,
126
+ headline: Fields.headline,
127
+ caption: Fields.caption,
128
+ ctas: Fields.ctas
129
+ };
130
+ function getSchema(keys = {}) {
131
+ var _a, _b, _c, _d;
132
+ return {
133
+ [(_a = keys.title) !== null && _a !== void 0 ? _a : 'title']: Fields.title,
134
+ [(_b = keys.headline) !== null && _b !== void 0 ? _b : 'headline']: Fields.headline,
135
+ [(_c = keys.caption) !== null && _c !== void 0 ? _c : 'caption']: Fields.caption,
136
+ [(_d = keys.ctas) !== null && _d !== void 0 ? _d : 'ctas']: Fields.ctas
137
+ };
138
+ }
139
+ Fields.getSchema = getSchema;
140
+ // exists
141
+ function exists(fields, keys = {}) {
142
+ var _a, _b, _c, _d;
143
+ return !!fields[((_a = keys.title) !== null && _a !== void 0 ? _a : 'title')]
144
+ || !!fields[((_b = keys.headline) !== null && _b !== void 0 ? _b : 'headline')]
145
+ || !!fields[((_c = keys.caption) !== null && _c !== void 0 ? _c : 'caption')]
146
+ || !!fields[((_d = keys.ctas) !== null && _d !== void 0 ? _d : 'ctas')];
147
+ }
148
+ Fields.exists = exists;
80
149
  })(Fields = MessagePanel.Fields || (MessagePanel.Fields = {}));
150
+ function getConfig({ messageKey, config = {}, flexDirection }) {
151
+ var _a, _b, _c, _d, _e, _f, _g, _h;
152
+ // create schema
153
+ const keys = Config.getKeys(messageKey);
154
+ const configSchema = {
155
+ [keys.textAlign]: schema_1.TextAlignment.schema,
156
+ [keys.width]: schema_1.ItemSize.schema.removeOption('fullBleed'),
157
+ [keys.horizontalAlign]: schema_1.ItemAlignment.Horizontal.schema,
158
+ [keys.verticalAlign]: schema_1.ItemAlignment.Vertical.schema
159
+ };
160
+ // resolve values
161
+ const defaultTextAlign = 'left';
162
+ const textAlign = (_b = (_a = config[keys.textAlign]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : defaultTextAlign;
163
+ const defaultWidth = 'full';
164
+ const width = (_d = (_c = config[keys.width]) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : defaultWidth;
165
+ const defaultHorizontalAlign = 'start';
166
+ const horizontalAlign = (_f = (_e = config[keys.horizontalAlign]) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : defaultHorizontalAlign;
167
+ const defaultVerticalAlign = 'start';
168
+ const verticalAlign = (_h = (_g = config[keys.verticalAlign]) === null || _g === void 0 ? void 0 : _g.value) !== null && _h !== void 0 ? _h : defaultVerticalAlign;
169
+ if (width === 'full') {
170
+ delete configSchema[keys.horizontalAlign];
171
+ }
172
+ if (flexDirection === 'x') {
173
+ delete configSchema[keys.verticalAlign];
174
+ }
175
+ else if (flexDirection === 'y') {
176
+ delete configSchema[keys.textAlign];
177
+ delete configSchema[keys.width];
178
+ delete configSchema[keys.horizontalAlign];
179
+ }
180
+ else if (flexDirection === 'none') {
181
+ delete configSchema[keys.textAlign];
182
+ delete configSchema[keys.width];
183
+ delete configSchema[keys.horizontalAlign];
184
+ delete configSchema[keys.verticalAlign];
185
+ }
186
+ // return result
187
+ return {
188
+ configSchema,
189
+ config: {
190
+ [keys.textAlign]: funnel_core_1.Schema.EnumField.Value.toData(textAlign),
191
+ [keys.width]: funnel_core_1.Schema.EnumField.Value.toData(width),
192
+ [keys.verticalAlign]: funnel_core_1.Schema.EnumField.Value.toData(verticalAlign),
193
+ [keys.horizontalAlign]: funnel_core_1.Schema.EnumField.Value.toData(horizontalAlign)
194
+ },
195
+ defaultConfig: {
196
+ [keys.textAlign]: funnel_core_1.Schema.EnumField.Value.toData(defaultTextAlign),
197
+ [keys.width]: funnel_core_1.Schema.EnumField.Value.toData(defaultWidth),
198
+ [keys.verticalAlign]: funnel_core_1.Schema.EnumField.Value.toData(defaultVerticalAlign),
199
+ [keys.horizontalAlign]: funnel_core_1.Schema.EnumField.Value.toData(defaultHorizontalAlign)
200
+ },
201
+ };
202
+ }
203
+ MessagePanel.getConfig = getConfig;
81
204
  })(MessagePanel || (exports.MessagePanel = MessagePanel = {}));
@@ -0,0 +1,47 @@
1
+ import { BlockLayout, Schema } from '@nascentdigital/funnel-core';
2
+ import { ReactNode } from 'react';
3
+ import { Person } from '../entities';
4
+ import { Quote, Title } from '../fields';
5
+ export declare function TestimonialPanel({ className, panel, layout, title, titleTag, quote, quoteTag, author, authorTag, ctas, decorator }: TestimonialPanel.Props): import("react/jsx-runtime").JSX.Element;
6
+ export declare namespace TestimonialPanel {
7
+ type Layout = 'companyQuoteAuthor' | 'quoteAuthor';
8
+ type Props = {
9
+ className?: string;
10
+ panel: BlockLayout.Message;
11
+ layout?: Layout;
12
+ titleTag?: Title.Tag;
13
+ title?: Title.Value;
14
+ quoteTag?: Quote.Tag;
15
+ quote: Quote.Value;
16
+ authorTag?: Person.Tag;
17
+ author: Person.Value;
18
+ ctas?: Fields.ctas.Value;
19
+ decorator?: ReactNode;
20
+ };
21
+ namespace Props {
22
+ type Configuration = Pick<Props, 'className' | 'layout' | 'titleTag' | 'quoteTag' | 'authorTag' | 'decorator'>;
23
+ }
24
+ namespace Fields {
25
+ const title: Schema.Optional<Schema.TextField>;
26
+ const quote: Schema.RichTextField;
27
+ const author: Schema.CollectionField<Schema.Collection<{
28
+ title: Schema.Optional<Schema.TextField>;
29
+ company: Schema.Optional<Schema.CollectionField<Schema.Collection<{
30
+ division: Schema.Optional<Schema.TextField>;
31
+ location: Schema.Optional<Schema.TextField>;
32
+ logo: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
33
+ badge: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
34
+ badgeText: Schema.Optional<Schema.TextField>;
35
+ }>>>;
36
+ location: Schema.Optional<Schema.TextField>;
37
+ picture: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
38
+ }>>;
39
+ const cta: Schema.LinkField;
40
+ const ctas: Schema.Optional<Schema.ListField<{
41
+ cta: Schema.LinkField;
42
+ }>>;
43
+ namespace ctas {
44
+ type Value = Schema.Field.LinkedValue.ForOptionalType<typeof ctas>;
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.TestimonialPanel = TestimonialPanel;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const funnel_core_1 = require("@nascentdigital/funnel-core");
9
+ const classnames_1 = __importDefault(require("classnames"));
10
+ const entities_1 = require("../entities");
11
+ const fields_1 = require("../fields");
12
+ const BlockPanel_1 = require("./BlockPanel");
13
+ // component
14
+ function TestimonialPanel({ className, panel, layout = 'quoteAuthor', title, titleTag = 'span', quote, quoteTag = 'h2', author, authorTag = 'div', ctas = [], decorator }) {
15
+ var _a, _b;
16
+ // extract company from author
17
+ const company = (_b = (_a = author.fields) === null || _a === void 0 ? void 0 : _a.company) === null || _b === void 0 ? void 0 : _b.value;
18
+ // render
19
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(className, 'nd-TestimonialPanel',
20
+ // base layout
21
+ BlockPanel_1.BlockPanel.getClassNames({ panel }),
22
+ // text-align
23
+ funnel_core_1.BlockLayout.ResponsiveClassNames.parse({
24
+ value: panel.textAlign,
25
+ mobile: {
26
+ left: 'max-md:nd-TestimonialPanel-textStart',
27
+ center: 'max-md:nd-TestimonialPanel-textCenter',
28
+ right: 'max-md:nd-TestimonialPanel-textEnd'
29
+ },
30
+ base: {
31
+ left: 'md:nd-TestimonialPanel-textStart',
32
+ center: 'md:nd-TestimonialPanel-textCenter',
33
+ right: 'md:nd-TestimonialPanel-textEnd'
34
+ },
35
+ desktop: {
36
+ left: 'lg:nd-TestimonialPanel-textStart',
37
+ center: 'lg:nd-TestimonialPanel-textCenter',
38
+ right: 'lg:nd-TestimonialPanel-textEnd'
39
+ }
40
+ })), children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-BlockPanel-content nd-TestimonialPanel-content", children: [company && layout === 'companyQuoteAuthor' &&
41
+ (0, jsx_runtime_1.jsx)(entities_1.Client, { as: "div", className: "nd-TestimonialPanel-company", client: company, displayFields: ['name', 'logo'] }), title &&
42
+ (0, jsx_runtime_1.jsx)(fields_1.Title, { className: "nd-TestimonialPanel-title", as: titleTag, title: title }), (0, jsx_runtime_1.jsx)(fields_1.Quote, { className: "nd-TestimonialPanel-quote", as: quoteTag, quote: quote }), (0, jsx_runtime_1.jsx)(entities_1.Person, { as: authorTag, className: "nd-TestimonialPanel-author", person: author, displayFields: layout === 'companyQuoteAuthor'
43
+ ? entities_1.Person.DisplayFields.exclude('company')
44
+ : entities_1.Person.DisplayFields.Id.values }), ctas.length > 0 &&
45
+ (0, jsx_runtime_1.jsx)("div", { className: "nd-TestimonialPanel-ctas", children: ctas.map(cta => (0, jsx_runtime_1.jsx)(fields_1.Link, { className: "nd-TestimonialPanel-cta", link: cta.value }, cta.id)) }), decorator &&
46
+ (0, jsx_runtime_1.jsx)("div", { className: "nd-TestimonialPanel-decorator", children: decorator })] }) }));
47
+ }
48
+ // extension
49
+ (function (TestimonialPanel) {
50
+ // fields
51
+ let Fields;
52
+ (function (Fields) {
53
+ Fields.title = fields_1.Title.schema.modify({
54
+ description: 'A short intro or heading for the message'
55
+ }).optional();
56
+ Fields.quote = fields_1.Quote.schema;
57
+ Fields.author = funnel_core_1.Schema.Field.collection({
58
+ name: 'Author',
59
+ hint: 'Who said it?',
60
+ collections: [entities_1.Person.schema]
61
+ });
62
+ Fields.cta = funnel_core_1.Schema.Field.link({ name: 'Call to Action' });
63
+ Fields.ctas = funnel_core_1.Schema.Field.list({
64
+ name: 'CTAs',
65
+ description: 'Add your call-to-actions in the order you\'d like them to appear *(these are optional)*.',
66
+ itemTypes: { cta: Fields.cta },
67
+ min: 1,
68
+ max: 2
69
+ }).optional();
70
+ })(Fields = TestimonialPanel.Fields || (TestimonialPanel.Fields = {}));
71
+ })(TestimonialPanel || (exports.TestimonialPanel = TestimonialPanel = {}));