@nascentdigital/funnel-ui 4.5.2 → 4.5.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.
Files changed (66) hide show
  1. package/dist/client/hooks/breakpoint/BreakpointContainer.d.ts +1 -1
  2. package/dist/client/hooks/breakpoint/BreakpointContainer.js +3 -1
  3. package/dist/client/interaction/index.d.ts +0 -6
  4. package/dist/client/interaction/index.js +0 -6
  5. package/dist/server/blocks/Block.js +2 -2
  6. package/dist/server/blocks/Message.js +2 -1
  7. package/dist/server/blocks/Testimonial.js +13 -10
  8. package/dist/server/blocks/Testimonials.d.ts +35 -35
  9. package/dist/server/blocks/Testimonials.js +21 -66
  10. package/dist/server/blocks/index.d.ts +1 -0
  11. package/dist/server/blocks/index.js +1 -0
  12. package/dist/server/fields/CallToActions.d.ts +12 -0
  13. package/dist/server/fields/CallToActions.js +27 -0
  14. package/dist/server/fields/index.d.ts +1 -0
  15. package/dist/server/fields/index.js +1 -0
  16. package/dist/server/panels/BlockPanel.js +1 -2
  17. package/dist/server/panels/MessagePanel.d.ts +2 -6
  18. package/dist/server/panels/MessagePanel.js +2 -9
  19. package/dist/server/panels/TestimonialPanel.d.ts +44 -18
  20. package/dist/server/panels/TestimonialPanel.js +44 -19
  21. package/dist/server/panels/VisualPanel.d.ts +1 -1
  22. package/package.json +2 -2
  23. package/dist/client/interaction/Popup.d.ts +0 -36
  24. package/dist/client/interaction/Popup.js +0 -244
  25. package/dist/client/interaction/Tooltip.d.ts +0 -16
  26. package/dist/client/interaction/Tooltip.js +0 -122
  27. package/dist/client/interaction/UILevel.d.ts +0 -1
  28. package/dist/client/interaction/UILevel.js +0 -2
  29. package/dist/client/interaction/backdrop/BackdropContainer.d.ts +0 -5
  30. package/dist/client/interaction/backdrop/BackdropContainer.js +0 -114
  31. package/dist/client/interaction/backdrop/BackdropContext.d.ts +0 -8
  32. package/dist/client/interaction/backdrop/BackdropContext.js +0 -6
  33. package/dist/client/interaction/backdrop/BackdropEvent.d.ts +0 -64
  34. package/dist/client/interaction/backdrop/BackdropEvent.js +0 -92
  35. package/dist/client/interaction/backdrop/index.d.ts +0 -4
  36. package/dist/client/interaction/backdrop/index.js +0 -20
  37. package/dist/client/interaction/backdrop/useBackdrop.d.ts +0 -13
  38. package/dist/client/interaction/backdrop/useBackdrop.js +0 -58
  39. package/dist/client/interaction/backdrop/useBackdropClick.d.ts +0 -2
  40. package/dist/client/interaction/backdrop/useBackdropClick.js +0 -21
  41. package/dist/client/interaction/backdrop/useBackdropVisible.d.ts +0 -1
  42. package/dist/client/interaction/backdrop/useBackdropVisible.js +0 -30
  43. package/dist/client/interaction/focus/FocusArea.d.ts +0 -10
  44. package/dist/client/interaction/focus/FocusArea.js +0 -38
  45. package/dist/client/interaction/focus/FocusContext.d.ts +0 -7
  46. package/dist/client/interaction/focus/FocusContext.js +0 -7
  47. package/dist/client/interaction/focus/FocusController.d.ts +0 -9
  48. package/dist/client/interaction/focus/FocusController.js +0 -40
  49. package/dist/client/interaction/focus/FocusService.d.ts +0 -20
  50. package/dist/client/interaction/focus/FocusService.js +0 -204
  51. package/dist/client/interaction/focus/LinkedList.d.ts +0 -18
  52. package/dist/client/interaction/focus/LinkedList.js +0 -122
  53. package/dist/client/interaction/focus/index.d.ts +0 -2
  54. package/dist/client/interaction/focus/index.js +0 -18
  55. package/dist/client/interaction/focus/useFocusService.d.ts +0 -2
  56. package/dist/client/interaction/focus/useFocusService.js +0 -14
  57. package/dist/client/interaction/modal/Modal.d.ts +0 -29
  58. package/dist/client/interaction/modal/Modal.js +0 -136
  59. package/dist/client/interaction/modal/ModalContainer.d.ts +0 -5
  60. package/dist/client/interaction/modal/ModalContainer.js +0 -104
  61. package/dist/client/interaction/modal/ModalContext.d.ts +0 -8
  62. package/dist/client/interaction/modal/ModalContext.js +0 -6
  63. package/dist/client/interaction/modal/ModalEvent.d.ts +0 -39
  64. package/dist/client/interaction/modal/ModalEvent.js +0 -53
  65. package/dist/client/interaction/modal/index.d.ts +0 -2
  66. package/dist/client/interaction/modal/index.js +0 -18
@@ -1,6 +1,6 @@
1
1
  import { Breakpoints } from '@nascentdigital/funnel-core';
2
2
  import { ReactNode } from 'react';
3
- export declare function BreakpointContainer({ breakpoints, children }: BreakpointContainer.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare function BreakpointContainer({ breakpoints: breakpointsRaw, children }: BreakpointContainer.Props): import("react/jsx-runtime").JSX.Element;
4
4
  export declare namespace BreakpointContainer {
5
5
  type Props = {
6
6
  breakpoints?: Readonly<Breakpoints>;
@@ -4,10 +4,12 @@ exports.BreakpointContainer = BreakpointContainer;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const funnel_core_1 = require("@nascentdigital/funnel-core");
6
6
  const react_1 = require("react");
7
+ const useLatestValue_1 = require("../useLatestValue");
7
8
  const BreakpointContext_1 = require("./BreakpointContext");
8
9
  // container
9
- function BreakpointContainer({ breakpoints = funnel_core_1.Breakpoints.defaults, children }) {
10
+ function BreakpointContainer({ breakpoints: breakpointsRaw = funnel_core_1.Breakpoints.defaults, children }) {
10
11
  // bind state + observer
12
+ const breakpoints = (0, useLatestValue_1.useLatestValue)(breakpointsRaw);
11
13
  const [context, setContext] = (0, react_1.useState)({
12
14
  breakpoints
13
15
  });
@@ -3,10 +3,4 @@ export * from './ClickObserver';
3
3
  export * from './InfiniteScroller';
4
4
  export * from './Loader';
5
5
  export * from './Marquee';
6
- export * from './Popup';
7
- export * from './Tooltip';
8
- export * from './UILevel';
9
- export * from './backdrop';
10
- export * from './focus';
11
- export * from './modal/index';
12
6
  export * from './paginator/index';
@@ -19,10 +19,4 @@ __exportStar(require("./ClickObserver"), exports);
19
19
  __exportStar(require("./InfiniteScroller"), exports);
20
20
  __exportStar(require("./Loader"), exports);
21
21
  __exportStar(require("./Marquee"), exports);
22
- __exportStar(require("./Popup"), exports);
23
- __exportStar(require("./Tooltip"), exports);
24
- __exportStar(require("./UILevel"), exports);
25
- __exportStar(require("./backdrop"), exports);
26
- __exportStar(require("./focus"), exports);
27
- __exportStar(require("./modal/index"), exports);
28
22
  __exportStar(require("./paginator/index"), exports);
@@ -50,7 +50,7 @@ function Block(_a) {
50
50
  }
51
51
  // extension
52
52
  (function (Block) {
53
- function createSchema({ id, name, version, message, visual, list }) {
53
+ function createSchema({ id, name, version, message, visual, list, extendConfigSchema }) {
54
54
  // build fields schema and panel key mapping
55
55
  let fieldsSchema = {};
56
56
  const panelKeyMapping = {};
@@ -67,7 +67,7 @@ function Block(_a) {
67
67
  panelKeyMapping.listKey = 'list';
68
68
  }
69
69
  // create config schema
70
- const configSchema = panels_1.BlockPanel.getConfigSchema(Object.assign({ fields: fieldsSchema }, panelKeyMapping));
70
+ const configSchema = panels_1.BlockPanel.getConfigSchema(Object.assign(Object.assign({ fields: fieldsSchema }, panelKeyMapping), { extend: extendConfigSchema }));
71
71
  // create block schema
72
72
  const schema = funnel_core_1.Schema.Block.create({
73
73
  id,
@@ -21,9 +21,10 @@ const classnames_1 = __importDefault(require("classnames"));
21
21
  const Block_1 = require("./Block");
22
22
  // component
23
23
  function Message(_a) {
24
+ var _b;
24
25
  var { className } = _a, props = __rest(_a, ["className"]);
25
26
  // extract variant
26
- const variant = funnel_core_1.Schema.EnumField.Value.fromData(props.model.config.variant);
27
+ const variant = funnel_core_1.Schema.EnumField.Value.fromData((_b = props.model) === null || _b === void 0 ? void 0 : _b.config.variant);
27
28
  // render
28
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
30
  }
@@ -40,8 +40,9 @@ function Testimonial(_a) {
40
40
  const ctas = ctasRaw === null || ctasRaw === void 0 ? void 0 : ctasRaw.value;
41
41
  const { className: testimonialPanelClassname } = testimonialPanelProps, testimonialPanelPropsRest = __rest(testimonialPanelProps, ["className"]);
42
42
  const { className: visualPanelClassname } = visualPanelProps, visualPanelPropsRest = __rest(visualPanelProps
43
- // panel layout
43
+ // FIXME: this is a hack to force the message panel to show (should always be rendered since quote is required)
44
44
  , ["className"]);
45
+ fields.headline = {};
45
46
  // panel layout
46
47
  const layout = panels_1.BlockPanel.getLayout({
47
48
  args: { fields, config },
@@ -54,10 +55,7 @@ function Testimonial(_a) {
54
55
  case 'message':
55
56
  return ((0, jsx_runtime_1.jsx)(panels_1.TestimonialPanel, Object.assign({ className: (0, classnames_1.default)(className, testimonialPanelClassname, 'nd-Testimonial-message'), panel: panel, title: title, quote: quote, author: author, ctas: ctas }, testimonialPanelPropsRest)));
56
57
  case 'visual':
57
- return visual
58
- ?
59
- (0, jsx_runtime_1.jsx)(panels_1.VisualPanel, Object.assign({ className: (0, classnames_1.default)(className, visualPanelClassname, 'nd-Testimonial-visual'), panel: panel, visual: visual, anchor: (_a = funnel_core_1.Schema.EnumField.Value.fromData(config.visualAnchor)) !== null && _a !== void 0 ? _a : 'center' }, visualPanelPropsRest))
60
- : undefined;
58
+ return ((0, jsx_runtime_1.jsx)(panels_1.VisualPanel, Object.assign({ className: (0, classnames_1.default)(className, visualPanelClassname, 'nd-Testimonial-visual'), panel: panel, visual: visual, anchor: (_a = funnel_core_1.Schema.EnumField.Value.fromData(config.visualAnchor)) !== null && _a !== void 0 ? _a : 'center' }, visualPanelPropsRest)));
61
59
  default:
62
60
  return undefined;
63
61
  }
@@ -86,11 +84,16 @@ function Testimonial(_a) {
86
84
  version: 1,
87
85
  config: configSchema,
88
86
  fields: fieldsSchema,
89
- getConfig: args => panels_1.BlockPanel.getConfig({
90
- args,
91
- messageKey: 'message',
92
- visualKey: 'visual'
93
- }),
87
+ getConfig: args => {
88
+ // FIXME: this is a hack to force the message panel configs (message panel should always exist)
89
+ ;
90
+ args.fields.headline = {};
91
+ return panels_1.BlockPanel.getConfig({
92
+ args,
93
+ messageKey: 'message',
94
+ visualKey: 'visual'
95
+ });
96
+ },
94
97
  getLayout: args => panels_1.BlockPanel.getLayout({
95
98
  args,
96
99
  messageKey: 'message',
@@ -1,41 +1,41 @@
1
1
  import { Schema } from '@nascentdigital/funnel-core';
2
- import { HTMLBlockElement, HTMLElements } from '../../types';
3
- import { MessagePanel } from '../panels';
4
- export declare function Testimonials({ className, testimonials, messagePanelProps, testimonialsPanelProps, ...props }: Testimonials.Props): import("react/jsx-runtime").JSX.Element | null;
2
+ import { ComponentProps } from 'react';
3
+ import { TestimonialPanel } from '../panels';
4
+ import { Block } from './Block';
5
+ export declare function Testimonials(props: ComponentProps<typeof Testimonials.Component>): import("react/jsx-runtime").JSX.Element;
5
6
  export declare namespace Testimonials {
6
- const schema: Schema.Block<"_nd-testimonials", {
7
- title: Schema.Optional<Schema.TextField>;
8
- headline: Schema.Optional<Schema.RichTextField>;
9
- caption: Schema.Optional<Schema.RichTextField>;
10
- ctas: Schema.Optional<Schema.ListField<{
11
- cta: Schema.LinkField;
12
- }>>;
13
- testimonials: Schema.ListField<{
14
- testimonial: Schema.ObjectField<{
15
- quote: Schema.RichTextField;
16
- author: Schema.CollectionField<Schema.Collection<{
17
- title: Schema.Optional<Schema.TextField>;
18
- company: Schema.Optional<Schema.CollectionField<Schema.Collection<{
19
- division: Schema.Optional<Schema.TextField>;
20
- location: Schema.Optional<Schema.TextField>;
21
- logo: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
22
- badge: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
23
- badgeText: Schema.Optional<Schema.TextField>;
24
- }>>>;
7
+ const Component: import("react").FunctionComponent<Block.Create.Result.Component<"_nd-testimonials", true, undefined, Schema.ListField<{
8
+ testimonial: Schema.ObjectField<{
9
+ quote: Schema.RichTextField;
10
+ author: Schema.CollectionField<Schema.Collection<{
11
+ title: Schema.Optional<Schema.TextField>;
12
+ company: Schema.Optional<Schema.CollectionField<Schema.Collection<{
13
+ division: Schema.Optional<Schema.TextField>;
25
14
  location: Schema.Optional<Schema.TextField>;
26
- picture: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
27
- }>>;
28
- }>;
15
+ logo: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
16
+ badge: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
17
+ badgeText: Schema.Optional<Schema.TextField>;
18
+ }>>>;
19
+ location: Schema.Optional<Schema.TextField>;
20
+ picture: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
21
+ }>>;
29
22
  }>;
30
- }, Schema.Block.Config>;
31
- type Props = HTMLBlockElement<'div'> & {
32
- testimonials: Model;
33
- messagePanelProps?: MessagePanel.Props.Configuration;
34
- testimonialsPanelProps?: TestimonialsPanelProps;
35
- };
36
- type TestimonialsPanelProps = {
37
- className?: string;
38
- tag?: HTMLElements.Standard.Container;
39
- };
23
+ }>, Schema.Block.Config, TestimonialPanel.Testimonial.Props.Configuration>>, schema: Block.Create.Result.Schema<"_nd-testimonials", true, undefined, Schema.ListField<{
24
+ testimonial: Schema.ObjectField<{
25
+ quote: Schema.RichTextField;
26
+ author: Schema.CollectionField<Schema.Collection<{
27
+ title: Schema.Optional<Schema.TextField>;
28
+ company: Schema.Optional<Schema.CollectionField<Schema.Collection<{
29
+ division: Schema.Optional<Schema.TextField>;
30
+ location: Schema.Optional<Schema.TextField>;
31
+ logo: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
32
+ badge: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
33
+ badgeText: Schema.Optional<Schema.TextField>;
34
+ }>>>;
35
+ location: Schema.Optional<Schema.TextField>;
36
+ picture: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
37
+ }>>;
38
+ }>;
39
+ }>, Schema.Block.Config>;
40
40
  type Model = Schema.Block.LinkedData<typeof schema>;
41
41
  }
@@ -1,62 +1,18 @@
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.Testimonials = Testimonials;
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
6
  const panels_1 = require("../panels");
22
7
  const Block_1 = require("./Block");
23
- // block
24
- function Testimonials(_a) {
25
- var _b, _c, _d;
26
- var { className, testimonials, messagePanelProps = {}, testimonialsPanelProps = {} } = _a, props = __rest(_a, ["className", "testimonials", "messagePanelProps", "testimonialsPanelProps"]);
27
- // don't render if missing model
28
- if (!testimonials) {
29
- console.warn('[Testimonials] attempted to render without testimonials model');
30
- return null;
31
- }
32
- // destructure props
33
- const config = (_b = testimonials.config) !== null && _b !== void 0 ? _b : {};
34
- const fields = (_c = testimonials.fields) !== null && _c !== void 0 ? _c : {};
35
- const { title: titleRaw, headline: headlineRaw, caption: captionRaw, ctas: ctasRaw, testimonials: testimonialsRaw } = fields;
36
- const title = titleRaw === null || titleRaw === void 0 ? void 0 : titleRaw.value;
37
- const headline = headlineRaw === null || headlineRaw === void 0 ? void 0 : headlineRaw.value;
38
- const caption = captionRaw === null || captionRaw === void 0 ? void 0 : captionRaw.value;
39
- const ctas = ctasRaw === null || ctasRaw === void 0 ? void 0 : ctasRaw.value;
40
- const testimonialItems = (_d = testimonialsRaw === null || testimonialsRaw === void 0 ? void 0 : testimonialsRaw.value) !== null && _d !== void 0 ? _d : [];
41
- const { className: messagePanelClassname } = messagePanelProps, messagePanelPropsRest = __rest(messagePanelProps, ["className"]);
42
- const { className: testimonialsPanelClassname } = testimonialsPanelProps;
43
- // panel layout
44
- const layout = {};
45
- const getPanel = ({ className, panel }) => {
46
- var _a;
47
- switch (panel.type) {
48
- case 'message':
49
- return ((0, jsx_runtime_1.jsx)(panels_1.MessagePanel, Object.assign({ className: (0, classnames_1.default)(className, messagePanelClassname, 'nd-Testimonials-message'), panel: panel, title: title, headline: headline, caption: caption, ctas: ctas }, messagePanelPropsRest)));
50
- case 'list':
51
- return ((0, jsx_runtime_1.jsx)(panels_1.ListPanel, { as: (_a = testimonialsPanelProps.tag) !== null && _a !== void 0 ? _a : 'ul', className: (0, classnames_1.default)(className, testimonialsPanelClassname, 'nd-Testimonials-list'), panel: panel, items: testimonialItems, layout: "horizontalStack", children: testimonial => (0, jsx_runtime_1.jsx)(panels_1.TestimonialPanel, { panel: {}, quote: testimonial.value.quote.value, author: testimonial.value.author.value }) }));
52
- }
53
- };
54
- // render block
55
- return ((0, jsx_runtime_1.jsx)(Block_1.Block, Object.assign({ className: (0, classnames_1.default)(className, 'nd-Testimonials'), layout: layout, renderPanel: getPanel }, props)));
8
+ // component
9
+ function Testimonials(props) {
10
+ return (0, jsx_runtime_1.jsx)(Testimonials.Component, Object.assign({}, props));
56
11
  }
57
12
  // extension
58
13
  (function (Testimonials) {
59
- // schema
14
+ var _a;
15
+ // testimonial schema
60
16
  const testimonialSchema = funnel_core_1.Schema.Field.object({
61
17
  name: 'Testimonial',
62
18
  preview: {
@@ -67,24 +23,23 @@ function Testimonials(_a) {
67
23
  author: panels_1.TestimonialPanel.Fields.author
68
24
  }
69
25
  });
70
- const fieldsSchema = {
71
- title: panels_1.MessagePanel.Fields.title,
72
- headline: panels_1.MessagePanel.Fields.headline,
73
- caption: panels_1.MessagePanel.Fields.caption,
74
- ctas: panels_1.MessagePanel.Fields.ctas,
75
- testimonials: funnel_core_1.Schema.Field.list({
76
- name: 'Testimonials',
77
- min: 1,
78
- max: 3,
79
- itemTypes: {
80
- testimonial: testimonialSchema
81
- }
82
- })
83
- };
84
- Testimonials.schema = funnel_core_1.Schema.Block.create({
26
+ // factory
27
+ _a = Block_1.Block.create({
85
28
  id: '_nd-testimonials',
86
29
  name: 'Testimonials',
87
30
  version: 1,
88
- fields: fieldsSchema
89
- });
31
+ className: 'nd-Testimonials',
32
+ message: true,
33
+ list: {
34
+ schema: funnel_core_1.Schema.Field.list({
35
+ name: 'Testimonials',
36
+ min: 1,
37
+ max: 3,
38
+ itemTypes: {
39
+ testimonial: testimonialSchema
40
+ }
41
+ }),
42
+ itemRenderer: ({ value }, itemProps) => ((0, jsx_runtime_1.jsx)(panels_1.TestimonialPanel.Testimonial, Object.assign({ quote: value.quote.value, author: value.author.value }, itemProps)))
43
+ }
44
+ }), Testimonials.Component = _a.Component, Testimonials.schema = _a.schema;
90
45
  })(Testimonials || (exports.Testimonials = Testimonials = {}));
@@ -10,5 +10,6 @@ export * from './Projects';
10
10
  export * from './Stat';
11
11
  export * from './Stats';
12
12
  export * from './Testimonial';
13
+ export * from './Testimonials';
13
14
  export * from './ValueProp';
14
15
  export * from './summary';
@@ -26,5 +26,6 @@ __exportStar(require("./Projects"), exports);
26
26
  __exportStar(require("./Stat"), exports);
27
27
  __exportStar(require("./Stats"), exports);
28
28
  __exportStar(require("./Testimonial"), exports);
29
+ __exportStar(require("./Testimonials"), exports);
29
30
  __exportStar(require("./ValueProp"), exports);
30
31
  __exportStar(require("./summary"), exports);
@@ -0,0 +1,12 @@
1
+ import { Schema } from '@nascentdigital/funnel-core';
2
+ export declare function CallToActions({ className, ctas }: CallToActions.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace CallToActions {
4
+ const schema: Schema.ListField<{
5
+ cta: Schema.LinkField;
6
+ }>;
7
+ type Props = {
8
+ className?: string;
9
+ ctas: Value;
10
+ };
11
+ type Value = Schema.Field.LinkedValue.ForOptionalType<typeof schema>;
12
+ }
@@ -0,0 +1,27 @@
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.CallToActions = CallToActions;
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 Link_1 = require("./Link");
11
+ // component
12
+ function CallToActions({ className, ctas }) {
13
+ // render
14
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(className, 'nd-CallToActions'), children: ctas.map(cta => (0, jsx_runtime_1.jsx)(Link_1.Link, { link: cta.value }, cta.id)) }));
15
+ }
16
+ // extension
17
+ (function (CallToActions) {
18
+ // schema
19
+ const cta = funnel_core_1.Schema.Field.link({ name: 'Call to Action' });
20
+ CallToActions.schema = funnel_core_1.Schema.Field.list({
21
+ name: 'CTAs',
22
+ description: 'Add your call-to-actions in the order you\'d like them to appear *(these are optional)*.',
23
+ itemTypes: { cta },
24
+ min: 1,
25
+ max: 2
26
+ });
27
+ })(CallToActions || (exports.CallToActions = CallToActions = {}));
@@ -1,3 +1,4 @@
1
+ export * from './CallToActions';
1
2
  export * from './Caption';
2
3
  export * from './Description';
3
4
  export * from './FreeFormContent';
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./CallToActions"), exports);
17
18
  __exportStar(require("./Caption"), exports);
18
19
  __exportStar(require("./Description"), exports);
19
20
  __exportStar(require("./FreeFormContent"), exports);
@@ -435,9 +435,8 @@ var BlockPanel;
435
435
  if (panelCount < 2) {
436
436
  delete updatedConfigSchema.layout;
437
437
  }
438
- // FIXME: add missing layout config
439
438
  // create default config
440
- const defaultConfig = Object.assign(Object.assign(Object.assign({ theme: funnel_core_1.Schema.EnumField.Value.toData('default'), contentAlign: funnel_core_1.Schema.EnumField.Value.toData('start') }, messageConfig === null || messageConfig === void 0 ? void 0 : messageConfig.defaultConfig), visualConfig === null || visualConfig === void 0 ? void 0 : visualConfig.defaultConfig), listConfig === null || listConfig === void 0 ? void 0 : listConfig.defaultConfig);
439
+ const defaultConfig = Object.assign(Object.assign(Object.assign(Object.assign({ theme: funnel_core_1.Schema.EnumField.Value.toData('default'), contentAlign: funnel_core_1.Schema.EnumField.Value.toData('start') }, messageConfig === null || messageConfig === void 0 ? void 0 : messageConfig.defaultConfig), visualConfig === null || visualConfig === void 0 ? void 0 : visualConfig.defaultConfig), listConfig === null || listConfig === void 0 ? void 0 : listConfig.defaultConfig), { layout: layoutSchema.defaultOption, slotVariation: slotVariationSchema.defaultOption });
441
440
  // create new config
442
441
  const updatedConfig = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, config), messageConfig === null || messageConfig === void 0 ? void 0 : messageConfig.config), visualConfig === null || visualConfig === void 0 ? void 0 : visualConfig.config), listConfig === null || listConfig === void 0 ? void 0 : listConfig.config), { layout: funnel_core_1.Schema.EnumField.Value.toData(layout), slotVariation: funnel_core_1.Schema.EnumField.Value.toData(slotVariation) });
443
442
  // return config
@@ -1,6 +1,6 @@
1
1
  import { BlockLayout, Schema } from '@nascentdigital/funnel-core';
2
2
  import { ReactNode } from 'react';
3
- import { Caption, Headline, Title } from '../fields';
3
+ import { CallToActions, Caption, Headline, Title } from '../fields';
4
4
  import { ItemAlignment, ItemSize, TextAlignment } from '../schema';
5
5
  import { BlockPanel } from './BlockPanel';
6
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;
@@ -14,7 +14,7 @@ export declare namespace MessagePanel {
14
14
  headline?: Headline.Value;
15
15
  caption?: Caption.Value;
16
16
  captionTag?: Caption.Tag;
17
- ctas?: Schema.LinkField.LinkedValue | Fields.ctas.Value;
17
+ ctas?: Schema.LinkField.LinkedValue | CallToActions.Value;
18
18
  textAlign?: TextAlignment;
19
19
  decorator?: ReactNode;
20
20
  };
@@ -48,13 +48,9 @@ export declare namespace MessagePanel {
48
48
  const title: Schema.Optional<Schema.TextField>;
49
49
  const headline: Schema.Optional<Schema.RichTextField>;
50
50
  const caption: Schema.Optional<Schema.RichTextField>;
51
- const cta: Schema.LinkField;
52
51
  const ctas: Schema.Optional<Schema.ListField<{
53
52
  cta: Schema.LinkField;
54
53
  }>>;
55
- namespace ctas {
56
- type Value = Schema.Field.LinkedValue.ForOptionalType<typeof ctas>;
57
- }
58
54
  const all: {
59
55
  readonly title: Schema.Optional<Schema.TextField>;
60
56
  readonly headline: Schema.Optional<Schema.RichTextField>;
@@ -60,7 +60,7 @@ function MessagePanel({ className, panel, titleTag = 'span', title, headlineTag
60
60
  (0, jsx_runtime_1.jsx)(fields_1.Title, { className: "nd-MessagePanel-title", as: titleTag, title: title }), headline &&
61
61
  (0, jsx_runtime_1.jsx)(fields_1.Headline, { className: "nd-MessagePanel-headline", as: headlineTag, headline: headline }), caption &&
62
62
  (0, jsx_runtime_1.jsx)(fields_1.Caption, { className: "nd-MessagePanel-caption", as: captionTag, caption: caption }), ctas.length > 0 &&
63
- (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 &&
63
+ (0, jsx_runtime_1.jsx)(fields_1.CallToActions, { className: "nd-MessagePanel-ctas", ctas: ctas }), decorator &&
64
64
  (0, jsx_runtime_1.jsx)("div", { className: "nd-MessagePanel-decorator", children: decorator })] }) }));
65
65
  }
66
66
  // extension
@@ -110,14 +110,7 @@ function MessagePanel({ className, panel, titleTag = 'span', title, headlineTag
110
110
  }).optional();
111
111
  Fields.headline = fields_1.Headline.schema.optional();
112
112
  Fields.caption = fields_1.Caption.schema.optional();
113
- Fields.cta = funnel_core_1.Schema.Field.link({ name: 'Call to Action' });
114
- Fields.ctas = funnel_core_1.Schema.Field.list({
115
- name: 'CTAs',
116
- description: 'Add your call-to-actions in the order you\'d like them to appear *(these are optional)*.',
117
- itemTypes: { cta: Fields.cta },
118
- min: 1,
119
- max: 2
120
- }).optional();
113
+ Fields.ctas = fields_1.CallToActions.schema.optional();
121
114
  Fields.all = {
122
115
  title: Fields.title,
123
116
  headline: Fields.headline,
@@ -1,25 +1,15 @@
1
1
  import { BlockLayout, Schema } from '@nascentdigital/funnel-core';
2
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;
3
+ import { Client, Person } from '../entities';
4
+ import { CallToActions, Quote, Title } from '../fields';
5
+ export declare function TestimonialPanel({ className, panel, ...testimonialProps }: TestimonialPanel.Props): import("react/jsx-runtime").JSX.Element;
6
6
  export declare namespace TestimonialPanel {
7
- type Layout = 'companyQuoteAuthor' | 'quoteAuthor';
8
- type Props = {
7
+ type Props = Testimonial.Props & {
9
8
  className?: string;
10
9
  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
10
  };
21
11
  namespace Props {
22
- type Configuration = Pick<Props, 'className' | 'layout' | 'titleTag' | 'quoteTag' | 'authorTag' | 'decorator'>;
12
+ type Configuration = Testimonial.Props.Configuration;
23
13
  }
24
14
  namespace Fields {
25
15
  const title: Schema.Optional<Schema.TextField>;
@@ -36,12 +26,48 @@ export declare namespace TestimonialPanel {
36
26
  location: Schema.Optional<Schema.TextField>;
37
27
  picture: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
38
28
  }>>;
39
- const cta: Schema.LinkField;
40
29
  const ctas: Schema.Optional<Schema.ListField<{
41
30
  cta: Schema.LinkField;
42
31
  }>>;
43
- namespace ctas {
44
- type Value = Schema.Field.LinkedValue.ForOptionalType<typeof ctas>;
32
+ const all: {
33
+ readonly title: Schema.Optional<Schema.TextField>;
34
+ readonly quote: Schema.RichTextField;
35
+ readonly author: Schema.CollectionField<Schema.Collection<{
36
+ title: Schema.Optional<Schema.TextField>;
37
+ company: Schema.Optional<Schema.CollectionField<Schema.Collection<{
38
+ division: Schema.Optional<Schema.TextField>;
39
+ location: Schema.Optional<Schema.TextField>;
40
+ logo: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
41
+ badge: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
42
+ badgeText: Schema.Optional<Schema.TextField>;
43
+ }>>>;
44
+ location: Schema.Optional<Schema.TextField>;
45
+ picture: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
46
+ }>>;
47
+ readonly ctas: Schema.Optional<Schema.ListField<{
48
+ cta: Schema.LinkField;
49
+ }>>;
50
+ };
51
+ }
52
+ function Testimonial({ className, layout, titleTag, title, quoteTag, quote, authorTag, author, ctas, companyDisplayFields, decorator }: Testimonial.Props): import("react/jsx-runtime").JSX.Element;
53
+ namespace Testimonial {
54
+ type Layout = 'companyQuoteAuthor' | 'quoteAuthor';
55
+ type Props = {
56
+ className?: string;
57
+ layout?: Layout;
58
+ titleTag?: Title.Tag;
59
+ title?: Title.Value;
60
+ quoteTag?: Quote.Tag;
61
+ quote: Quote.Value;
62
+ authorTag?: Person.Tag;
63
+ author: Person.Value;
64
+ ctas?: CallToActions.Value;
65
+ companyDisplayFields?: Client.DisplayFields.Id[];
66
+ decorator?: ReactNode;
67
+ };
68
+ namespace Props {
69
+ type Configuration = Pick<Props, 'className' | 'layout' | 'titleTag' | 'quoteTag' | 'authorTag' | 'companyDisplayFields' | 'decorator'>;
45
70
  }
71
+ function Placeholder(): import("react/jsx-runtime").JSX.Element;
46
72
  }
47
73
  }
@@ -1,4 +1,15 @@
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
+ };
2
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
15
  };
@@ -11,10 +22,8 @@ const entities_1 = require("../entities");
11
22
  const fields_1 = require("../fields");
12
23
  const BlockPanel_1 = require("./BlockPanel");
13
24
  // 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;
25
+ function TestimonialPanel(_a) {
26
+ var { className, panel } = _a, testimonialProps = __rest(_a, ["className", "panel"]);
18
27
  // render
19
28
  return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(className, 'nd-TestimonialPanel',
20
29
  // base layout
@@ -37,13 +46,7 @@ function TestimonialPanel({ className, panel, layout = 'quoteAuthor', title, tit
37
46
  center: 'lg:nd-TestimonialPanel-textCenter',
38
47
  right: 'lg:nd-TestimonialPanel-textEnd'
39
48
  }
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 })] }) }));
49
+ })), children: (0, jsx_runtime_1.jsx)(TestimonialPanel.Testimonial, Object.assign({ className: "nd-BlockPanel-content nd-TestimonialPanel-content" }, testimonialProps)) }));
47
50
  }
48
51
  // extension
49
52
  (function (TestimonialPanel) {
@@ -59,13 +62,35 @@ function TestimonialPanel({ className, panel, layout = 'quoteAuthor', title, tit
59
62
  hint: 'Who said it?',
60
63
  collections: [entities_1.Person.schema]
61
64
  });
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();
65
+ Fields.ctas = fields_1.CallToActions.schema.optional();
66
+ Fields.all = {
67
+ title: Fields.title,
68
+ quote: Fields.quote,
69
+ author: Fields.author,
70
+ ctas: Fields.ctas
71
+ };
70
72
  })(Fields = TestimonialPanel.Fields || (TestimonialPanel.Fields = {}));
73
+ // component
74
+ function Testimonial({ className, layout, titleTag = 'span', title, quoteTag = 'h2', quote, authorTag = 'div', author, ctas = [], companyDisplayFields = ['logo'], decorator }) {
75
+ var _a, _b;
76
+ // extract company from author
77
+ const company = (_b = (_a = author === null || author === void 0 ? void 0 : author.fields) === null || _a === void 0 ? void 0 : _a.company) === null || _b === void 0 ? void 0 : _b.value;
78
+ // render
79
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(className, 'nd-Testimonial'), children: [!title && !quote && !author && ctas.length === 0 &&
80
+ (0, jsx_runtime_1.jsx)(Testimonial.Placeholder, {}), company && layout === 'companyQuoteAuthor' &&
81
+ (0, jsx_runtime_1.jsx)(entities_1.Client, { as: "div", className: "nd-TestimonialPanel-company", client: company, displayFields: companyDisplayFields }), title &&
82
+ (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'
83
+ ? entities_1.Person.DisplayFields.exclude('company')
84
+ : entities_1.Person.DisplayFields.Id.values }), ctas.length > 0 &&
85
+ (0, jsx_runtime_1.jsx)(fields_1.CallToActions, { className: "nd-TestimonialPanel-ctas", ctas: ctas }), decorator &&
86
+ (0, jsx_runtime_1.jsx)("div", { className: "nd-TestimonialPanel-decorator", children: decorator })] }));
87
+ }
88
+ TestimonialPanel.Testimonial = Testimonial;
89
+ (function (Testimonial) {
90
+ // placeholder
91
+ function Placeholder() {
92
+ return ((0, jsx_runtime_1.jsx)("div", { className: "nd-Testimonial-placeholder", children: "No testimonial content" }));
93
+ }
94
+ Testimonial.Placeholder = Placeholder;
95
+ })(Testimonial = TestimonialPanel.Testimonial || (TestimonialPanel.Testimonial = {}));
71
96
  })(TestimonialPanel || (exports.TestimonialPanel = TestimonialPanel = {}));