@nascentdigital/funnel-ui 4.5.2 → 4.5.4

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 (132) hide show
  1. package/dist/Tailwind.d.ts +1 -1
  2. package/dist/Tailwind.js +70 -24
  3. package/dist/client/hooks/breakpoint/BreakpointContainer.d.ts +1 -1
  4. package/dist/client/hooks/breakpoint/BreakpointContainer.js +3 -1
  5. package/dist/client/interaction/Carousel.d.ts +1 -1
  6. package/dist/client/interaction/Carousel.js +28 -30
  7. package/dist/client/interaction/index.d.ts +0 -6
  8. package/dist/client/interaction/index.js +0 -6
  9. package/dist/server/Page.d.ts +15 -0
  10. package/dist/server/Page.js +70 -0
  11. package/dist/server/blocks/Block.d.ts +4 -2
  12. package/dist/server/blocks/Block.js +10 -3
  13. package/dist/server/blocks/Editorial.d.ts +2 -2
  14. package/dist/server/blocks/Editorial.js +4 -4
  15. package/dist/server/blocks/Form.d.ts +2 -2
  16. package/dist/server/blocks/Form.js +3 -3
  17. package/dist/server/blocks/Message.js +2 -1
  18. package/dist/server/blocks/Projects.d.ts +29 -37
  19. package/dist/server/blocks/Projects.js +13 -84
  20. package/dist/server/blocks/RelatedPages.d.ts +58 -0
  21. package/dist/server/blocks/RelatedPages.js +99 -0
  22. package/dist/server/blocks/Stats.d.ts +19 -31
  23. package/dist/server/blocks/Stats.js +13 -57
  24. package/dist/server/blocks/Testimonial.d.ts +2 -2
  25. package/dist/server/blocks/Testimonial.js +17 -14
  26. package/dist/server/blocks/Testimonials.d.ts +35 -35
  27. package/dist/server/blocks/Testimonials.js +21 -66
  28. package/dist/server/blocks/index.d.ts +2 -0
  29. package/dist/server/blocks/index.js +2 -0
  30. package/dist/server/entities/previews/MessagePreview.d.ts +2 -2
  31. package/dist/server/entities/previews/MessagePreview.js +1 -1
  32. package/dist/server/fields/CallToActions.d.ts +12 -0
  33. package/dist/server/fields/CallToActions.js +27 -0
  34. package/dist/server/fields/Caption.js +3 -2
  35. package/dist/server/fields/Description.js +1 -1
  36. package/dist/server/fields/FreeFormContent.js +1 -1
  37. package/dist/server/fields/Headline.js +1 -1
  38. package/dist/server/fields/Quote.js +1 -1
  39. package/dist/server/fields/RichText.js +1 -0
  40. package/dist/server/fields/index.d.ts +1 -0
  41. package/dist/server/fields/index.js +1 -0
  42. package/dist/server/index.d.ts +2 -0
  43. package/dist/server/index.js +2 -0
  44. package/dist/server/layouts/BentoLayout.d.ts +289 -0
  45. package/dist/server/layouts/BentoLayout.js +25 -0
  46. package/dist/server/layouts/index.d.ts +1 -0
  47. package/dist/server/layouts/index.js +1 -0
  48. package/dist/server/panels/BlockPanel.js +1 -3
  49. package/dist/server/panels/ListPanel.d.ts +4 -4
  50. package/dist/server/panels/ListPanel.js +13 -2
  51. package/dist/server/panels/MessagePanel.d.ts +2 -6
  52. package/dist/server/panels/MessagePanel.js +2 -12
  53. package/dist/server/panels/TestimonialPanel.d.ts +44 -18
  54. package/dist/server/panels/TestimonialPanel.js +44 -19
  55. package/dist/server/panels/VisualPanel.d.ts +1 -1
  56. package/dist/server/panels/VisualPanel.js +0 -2
  57. package/dist/server/schema/Anchor.d.ts +1 -1
  58. package/dist/server/schema/Anchor.js +2 -2
  59. package/dist/server/schema/BlockConfig.js +1 -1
  60. package/dist/server/schema/ListPanelLayout.d.ts +6 -0
  61. package/dist/server/schema/ListPanelLayout.js +3 -0
  62. package/dist/server/utils/ReactUtils.d.ts +6 -0
  63. package/dist/server/utils/ReactUtils.js +25 -0
  64. package/dist/server/utils/index.d.ts +1 -0
  65. package/dist/{client/interaction/modal → server/utils}/index.js +1 -2
  66. package/dist/styles/Page.css +5 -0
  67. package/dist/styles/Section.css +52 -0
  68. package/dist/styles/blocks/Block-spacing.css +31 -38
  69. package/dist/styles/blocks/Block-theming.css +2 -4
  70. package/dist/styles/blocks/MediaLayout.css +16 -0
  71. package/dist/styles/blocks/Projects.css +0 -9
  72. package/dist/styles/blocks/RelatedPages.css +13 -0
  73. package/dist/styles/blocks/Stats.css +1 -30
  74. package/dist/styles/components/Carousel.css +128 -0
  75. package/dist/styles/components/_index.css +2 -1
  76. package/dist/styles/entities/Person.css +4 -4
  77. package/dist/styles/entities/Project.css +8 -2
  78. package/dist/styles/entities/UniqueSellingPoint.css +3 -3
  79. package/dist/styles/fields/Caption.css +2 -2
  80. package/dist/styles/fields/Description.css +2 -2
  81. package/dist/styles/fields/Icon.css +1 -1
  82. package/dist/styles/fields/Link.css +1 -1
  83. package/dist/styles/fields/Quote.css +2 -2
  84. package/dist/styles/fields/Title.css +1 -1
  85. package/dist/styles/index.css +2 -0
  86. package/dist/styles/layouts/BentoLayout.css +41 -0
  87. package/dist/styles/layouts/_index.css +1 -0
  88. package/dist/styles/panels/TestimonialPanel.css +4 -0
  89. package/package.json +2 -3
  90. package/dist/client/interaction/Popup.d.ts +0 -36
  91. package/dist/client/interaction/Popup.js +0 -244
  92. package/dist/client/interaction/Tooltip.d.ts +0 -16
  93. package/dist/client/interaction/Tooltip.js +0 -122
  94. package/dist/client/interaction/UILevel.d.ts +0 -1
  95. package/dist/client/interaction/UILevel.js +0 -2
  96. package/dist/client/interaction/backdrop/BackdropContainer.d.ts +0 -5
  97. package/dist/client/interaction/backdrop/BackdropContainer.js +0 -114
  98. package/dist/client/interaction/backdrop/BackdropContext.d.ts +0 -8
  99. package/dist/client/interaction/backdrop/BackdropContext.js +0 -6
  100. package/dist/client/interaction/backdrop/BackdropEvent.d.ts +0 -64
  101. package/dist/client/interaction/backdrop/BackdropEvent.js +0 -92
  102. package/dist/client/interaction/backdrop/index.d.ts +0 -4
  103. package/dist/client/interaction/backdrop/index.js +0 -20
  104. package/dist/client/interaction/backdrop/useBackdrop.d.ts +0 -13
  105. package/dist/client/interaction/backdrop/useBackdrop.js +0 -58
  106. package/dist/client/interaction/backdrop/useBackdropClick.d.ts +0 -2
  107. package/dist/client/interaction/backdrop/useBackdropClick.js +0 -21
  108. package/dist/client/interaction/backdrop/useBackdropVisible.d.ts +0 -1
  109. package/dist/client/interaction/backdrop/useBackdropVisible.js +0 -30
  110. package/dist/client/interaction/focus/FocusArea.d.ts +0 -10
  111. package/dist/client/interaction/focus/FocusArea.js +0 -38
  112. package/dist/client/interaction/focus/FocusContext.d.ts +0 -7
  113. package/dist/client/interaction/focus/FocusContext.js +0 -7
  114. package/dist/client/interaction/focus/FocusController.d.ts +0 -9
  115. package/dist/client/interaction/focus/FocusController.js +0 -40
  116. package/dist/client/interaction/focus/FocusService.d.ts +0 -20
  117. package/dist/client/interaction/focus/FocusService.js +0 -204
  118. package/dist/client/interaction/focus/LinkedList.d.ts +0 -18
  119. package/dist/client/interaction/focus/LinkedList.js +0 -122
  120. package/dist/client/interaction/focus/index.d.ts +0 -2
  121. package/dist/client/interaction/focus/index.js +0 -18
  122. package/dist/client/interaction/focus/useFocusService.d.ts +0 -2
  123. package/dist/client/interaction/focus/useFocusService.js +0 -14
  124. package/dist/client/interaction/modal/Modal.d.ts +0 -29
  125. package/dist/client/interaction/modal/Modal.js +0 -136
  126. package/dist/client/interaction/modal/ModalContainer.d.ts +0 -5
  127. package/dist/client/interaction/modal/ModalContainer.js +0 -104
  128. package/dist/client/interaction/modal/ModalContext.d.ts +0 -8
  129. package/dist/client/interaction/modal/ModalContext.js +0 -6
  130. package/dist/client/interaction/modal/ModalEvent.d.ts +0 -39
  131. package/dist/client/interaction/modal/ModalEvent.js +0 -53
  132. package/dist/client/interaction/modal/index.d.ts +0 -2
@@ -1,43 +1,35 @@
1
1
  import { Schema } from '@nascentdigital/funnel-core';
2
- import { HTMLBlockElement, HTMLElements } from '../../types';
2
+ import { ComponentProps } from 'react';
3
3
  import { Project } from '../entities';
4
- import { Caption, Headline } from '../fields';
5
- export declare function Projects({ className, headlineTag, captionTag, projectProps, projects: projectData, ...props }: Projects.Props): import("react/jsx-runtime").JSX.Element | null;
4
+ import { Block } from './Block';
5
+ export declare function Projects(props: ComponentProps<typeof Projects.Component>): import("react/jsx-runtime").JSX.Element;
6
6
  export declare namespace Projects {
7
- type Layout = 'masonry';
8
- namespace Layout {
9
- const Enum: Schema.EnumField.Options<Layout>;
10
- const schema: Schema.EnumField<Schema.EnumField.Options<"masonry">>;
11
- function getClassName(layout?: Layout): string;
12
- }
13
- const schema: Schema.Block<"_nd-projects", {
14
- headline: Schema.Optional<Schema.RichTextField>;
15
- caption: Schema.Optional<Schema.RichTextField>;
16
- items: Schema.ListField<{
17
- item: Schema.CollectionField<Schema.Collection<{
18
- client: 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
- }>>;
25
- headline: Schema.RichTextField;
26
- visual: Schema.AssetField<Schema.AssetField.LinkedValue.Visual>;
27
- link: Schema.Optional<Schema.LinkField>;
7
+ const Component: import("react").FunctionComponent<Block.Create.Result.Component<"_nd-projects", true, undefined, Schema.ListField<{
8
+ item: Schema.CollectionField<Schema.Collection<{
9
+ client: Schema.CollectionField<Schema.Collection<{
10
+ division: Schema.Optional<Schema.TextField>;
11
+ location: Schema.Optional<Schema.TextField>;
12
+ logo: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
13
+ badge: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
14
+ badgeText: Schema.Optional<Schema.TextField>;
28
15
  }>>;
29
- }>;
30
- }, {
31
- layout: Schema.EnumField<Schema.EnumField.Options<"masonry">>;
32
- theme: Schema.EnumField<Readonly<import("@nascentdigital/funnel-core").BlockThemes.Options>>;
33
- }>;
34
- type Props = HTMLBlockElement<'div'> & {
35
- headlineTag?: Headline.Tag;
36
- captionTag?: Caption.Tag;
37
- projectProps?: Project.Props.Configuration;
38
- projects: Model;
39
- };
40
- type Tag = HTMLElements.Standard.Container;
16
+ headline: Schema.RichTextField;
17
+ visual: Schema.AssetField<Schema.AssetField.LinkedValue.Visual>;
18
+ link: Schema.Optional<Schema.LinkField>;
19
+ }>>;
20
+ }>, Schema.Block.Config, Project.Props.Configuration>>, schema: Block.Create.Result.Schema<"_nd-projects", true, undefined, Schema.ListField<{
21
+ item: Schema.CollectionField<Schema.Collection<{
22
+ client: Schema.CollectionField<Schema.Collection<{
23
+ division: Schema.Optional<Schema.TextField>;
24
+ location: Schema.Optional<Schema.TextField>;
25
+ logo: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
26
+ badge: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Image>>;
27
+ badgeText: Schema.Optional<Schema.TextField>;
28
+ }>>;
29
+ headline: Schema.RichTextField;
30
+ visual: Schema.AssetField<Schema.AssetField.LinkedValue.Visual>;
31
+ link: Schema.Optional<Schema.LinkField>;
32
+ }>>;
33
+ }>, Schema.Block.Config>;
41
34
  type Model = Schema.Block.LinkedData<typeof schema>;
42
- type ItemModel = Model['fields']['items']['value'][number];
43
35
  }
@@ -1,86 +1,26 @@
1
1
  "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
3
  exports.Projects = Projects;
18
4
  const jsx_runtime_1 = require("react/jsx-runtime");
19
5
  const funnel_core_1 = require("@nascentdigital/funnel-core");
20
- const classnames_1 = __importDefault(require("classnames"));
21
- const refs_1 = require("../../client/refs");
22
6
  const entities_1 = require("../entities");
23
- const fields_1 = require("../fields");
24
- const schema_1 = require("../schema");
7
+ const Block_1 = require("./Block");
25
8
  // component
26
- function Projects(_a) {
27
- var _b, _c, _d, _e;
28
- var { className, headlineTag = 'h2', captionTag = 'div', projectProps = {}, projects: projectData } = _a, props = __rest(_a, ["className", "headlineTag", "captionTag", "projectProps", "projects"]);
29
- // dont render if missing model
30
- const { config, fields } = projectData !== null && projectData !== void 0 ? projectData : {};
31
- const items = (_c = (_b = fields === null || fields === void 0 ? void 0 : fields.items) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : [];
32
- if (!projectData) {
33
- console.warn('[Projects] attempted to render without projects model');
34
- return null;
35
- }
36
- // render
37
- const { headline: headlineRaw, caption: captionRaw } = fields;
38
- const headline = headlineRaw === null || headlineRaw === void 0 ? void 0 : headlineRaw.value;
39
- const caption = captionRaw === null || captionRaw === void 0 ? void 0 : captionRaw.value;
40
- const layout = (_e = (_d = config === null || config === void 0 ? void 0 : config.layout) === null || _d === void 0 ? void 0 : _d.value) !== null && _e !== void 0 ? _e : 'masonry';
41
- return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)(className, 'nd-Projects', Projects.Layout.getClassName(layout), schema_1.BlockConfig.Presets.ThemeOnly.getClassName(config)) }, props, { children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-Projects-content", children: [(headline || caption) &&
42
- (0, jsx_runtime_1.jsx)("div", { className: "nd-Projects-copyWrap", children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-Projects-copy", children: [headline &&
43
- (0, jsx_runtime_1.jsx)(fields_1.Headline, { className: "nd-Projects-headline", as: headlineTag, headline: headline }), caption &&
44
- (0, jsx_runtime_1.jsx)(fields_1.Caption, { className: "nd-Projects-caption", as: captionTag, caption: caption })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "nd-Projects-projectsWrap", children: renderProjects({ layout, projects: items, projectProps }) })] }) })));
9
+ function Projects(props) {
10
+ return (0, jsx_runtime_1.jsx)(Projects.Component, Object.assign({}, props));
45
11
  }
46
12
  // extension
47
13
  (function (Projects) {
48
- let Layout;
49
- (function (Layout) {
50
- // enum
51
- Layout.Enum = {
52
- masonry: { name: 'Masonry', hint: 'A vertical brick-like layout.' }
53
- };
54
- // schema
55
- Layout.schema = funnel_core_1.Schema.Field.enumeration({
56
- name: 'Layout',
57
- hint: 'Select you project layout',
58
- description: 'Determine how your projects will be presented.',
59
- options: Layout.Enum,
60
- defaultOption: 'masonry'
61
- });
62
- // helpers
63
- function getClassName(layout) {
64
- switch (layout) {
65
- case 'masonry':
66
- return 'nd-Projects-layout-masonry';
67
- default:
68
- console.warn('[Projects] unrecognized layout:', layout);
69
- return 'nd-Projects-layout-masonry';
70
- }
71
- }
72
- Layout.getClassName = getClassName;
73
- })(Layout = Projects.Layout || (Projects.Layout = {}));
74
- // schema
75
- Projects.schema = funnel_core_1.Schema.Block.create({
14
+ var _a;
15
+ // factory
16
+ _a = Block_1.Block.create({
76
17
  id: '_nd-projects',
77
18
  name: 'Projects',
78
19
  version: 1,
79
- config: Object.assign(Object.assign({}, schema_1.BlockConfig.Presets.ThemeOnly.schema), { layout: Layout.schema }),
80
- fields: {
81
- headline: fields_1.Headline.schema.optional(),
82
- caption: fields_1.Caption.schema.optional(),
83
- items: funnel_core_1.Schema.Field.list({
20
+ className: 'nd-Projects',
21
+ message: true,
22
+ list: {
23
+ schema: funnel_core_1.Schema.Field.list({
84
24
  name: 'Projects',
85
25
  description: 'Project will be displayed in the order you present them.',
86
26
  itemTypes: {
@@ -91,19 +31,8 @@ function Projects(_a) {
91
31
  },
92
32
  min: 3,
93
33
  max: 300
94
- })
34
+ }),
35
+ itemRenderer: (item, itemProps) => ((0, jsx_runtime_1.jsx)(entities_1.Project, Object.assign({ as: "div", className: "nd-Projects-project", project: item.value }, itemProps)))
95
36
  }
96
- });
37
+ }), Projects.Component = _a.Component, Projects.schema = _a.schema;
97
38
  })(Projects || (exports.Projects = Projects = {}));
98
- function renderProjects(args) {
99
- var _a;
100
- switch (args.layout) {
101
- case 'masonry':
102
- return renderMasonryLayout(args);
103
- default:
104
- return ((0, jsx_runtime_1.jsxs)("div", { children: ["Unsupported Projects layout: ", (_a = args.layout) !== null && _a !== void 0 ? _a : 'undefined'] }));
105
- }
106
- }
107
- function renderMasonryLayout({ projects, projectProps }) {
108
- return ((0, jsx_runtime_1.jsx)(refs_1.MasonryLayout, { className: "nd-Projects-projects", children: projects.map(project => (0, jsx_runtime_1.jsx)(entities_1.Project, Object.assign({}, projectProps, { as: "div", className: "nd-Projects-project", project: project.value }), project.id)) }));
109
- }
@@ -0,0 +1,58 @@
1
+ import { Schema, Transform } from '@nascentdigital/funnel-core';
2
+ import { ReactNode } from 'react';
3
+ import { HTMLBlockElement } from '../../types';
4
+ import { Caption, Headline, Title } from '../fields';
5
+ export declare function RelatedPages<TPage extends Schema.Page>({ className, model, children, titleTag, headlineTag, captionTag, ...props }: RelatedPages.Props<TPage>): import("react/jsx-runtime").JSX.Element | null;
6
+ export declare namespace RelatedPages {
7
+ function schema(args: schema.Args): Schema.Block<"_nd-relatedPages", {
8
+ list: Schema.DynamicPagesField;
9
+ title: Schema.Optional<Schema.TextField>;
10
+ headline: Schema.Optional<Schema.RichTextField>;
11
+ caption: Schema.Optional<Schema.RichTextField>;
12
+ ctas: Schema.Optional<Schema.ListField<{
13
+ cta: Schema.LinkField;
14
+ }>>;
15
+ }, ({
16
+ readonly theme: Schema.EnumField<Readonly<import("@nascentdigital/funnel-core").BlockThemes.Options>>;
17
+ } & {
18
+ layout: import("..").PanelLayout.Schema;
19
+ } & {
20
+ slotVariation: import("..").SlotVariation.Schema;
21
+ } & Record<"messageTextAlign", Schema.EnumField<Schema.EnumField.Options<import("..").TextAlignment>>> & Record<"messageWidth", Schema.EnumField<Schema.EnumField.Options<import("..").ItemSize>>> & Record<"messageHorizontalAlign", Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Record<"messageVerticalAlign", Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Schema.Block.Config) | ({
22
+ readonly theme: Schema.EnumField<Readonly<import("@nascentdigital/funnel-core").BlockThemes.Options>>;
23
+ } & {
24
+ layout: import("..").PanelLayout.Schema;
25
+ } & {
26
+ slotVariation: import("..").SlotVariation.Schema;
27
+ } & Record<"messageTextAlign", Schema.EnumField<Schema.EnumField.Options<import("..").TextAlignment>>> & Record<"messageWidth", Schema.EnumField<Schema.EnumField.Options<import("..").ItemSize>>> & Record<"messageHorizontalAlign", Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Record<"messageVerticalAlign", Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & {
28
+ contentAlign: import("..").ItemAlignment.Vertical.Schema;
29
+ } & Schema.Block.Config) | ({
30
+ readonly theme: Schema.EnumField<Readonly<import("@nascentdigital/funnel-core").BlockThemes.Options>>;
31
+ } & {
32
+ layout: import("..").PanelLayout.Schema;
33
+ } & {
34
+ slotVariation: import("..").SlotVariation.Schema;
35
+ } & Record<"messageTextAlign", Schema.EnumField<Schema.EnumField.Options<import("..").TextAlignment>>> & Record<"messageWidth", Schema.EnumField<Schema.EnumField.Options<import("..").ItemSize>>> & Record<"messageHorizontalAlign", Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Record<"messageVerticalAlign", Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Record<`${any}Width`, Schema.EnumField<Schema.EnumField.Options<import("..").ItemSize>>> & Record<`${any}HorizontalAlign`, Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Record<`${any}VerticalAlign`, Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Schema.Block.Config) | ({
36
+ readonly theme: Schema.EnumField<Readonly<import("@nascentdigital/funnel-core").BlockThemes.Options>>;
37
+ } & {
38
+ layout: import("..").PanelLayout.Schema;
39
+ } & {
40
+ slotVariation: import("..").SlotVariation.Schema;
41
+ } & Record<"messageTextAlign", Schema.EnumField<Schema.EnumField.Options<import("..").TextAlignment>>> & Record<"messageWidth", Schema.EnumField<Schema.EnumField.Options<import("..").ItemSize>>> & Record<"messageHorizontalAlign", Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Record<"messageVerticalAlign", Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Record<`${any}Width`, Schema.EnumField<Schema.EnumField.Options<import("..").ItemSize>>> & Record<`${any}HorizontalAlign`, Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & Record<`${any}VerticalAlign`, Schema.EnumField<Schema.EnumField.Options<import("..").ItemAlignment>>> & {
42
+ contentAlign: import("..").ItemAlignment.Vertical.Schema;
43
+ } & Schema.Block.Config)>;
44
+ namespace schema {
45
+ type Args = {
46
+ pageType: string;
47
+ size: number;
48
+ };
49
+ }
50
+ type Props<TPage extends Schema.Page> = HTMLBlockElement<'div'> & {
51
+ model: Model;
52
+ children?: Transform<Schema.Page.LinkedData.AsPreview<TPage>, ReactNode>;
53
+ titleTag?: Title.Tag;
54
+ headlineTag?: Headline.Tag;
55
+ captionTag?: Caption.Tag;
56
+ };
57
+ type Model = Schema.Block.LinkedData<ReturnType<typeof schema>>;
58
+ }
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.RelatedPages = RelatedPages;
18
+ const jsx_runtime_1 = require("react/jsx-runtime");
19
+ const funnel_core_1 = require("@nascentdigital/funnel-core");
20
+ const classnames_1 = __importDefault(require("classnames"));
21
+ const entities_1 = require("../entities");
22
+ const panels_1 = require("../panels");
23
+ const Block_1 = require("./Block");
24
+ // component
25
+ function RelatedPages(_a) {
26
+ var _b, _c, _d, _e, _f;
27
+ var { className, model, children, titleTag = 'span', headlineTag = 'h2', captionTag = 'div' } = _a, props = __rest(_a, ["className", "model", "children", "titleTag", "headlineTag", "captionTag"]);
28
+ // don't render if missing model
29
+ if (!model) {
30
+ console.warn('[RelatedPages] attempted to render without related model');
31
+ return null;
32
+ }
33
+ // extract fields
34
+ const config = (_b = model.config) !== null && _b !== void 0 ? _b : {};
35
+ const fields = (_c = model.fields) !== null && _c !== void 0 ? _c : {};
36
+ const { title: titleRaw, headline: headlineRaw, caption: captionRaw, ctas: ctasRaw, list: listRaw } = fields;
37
+ const title = titleRaw === null || titleRaw === void 0 ? void 0 : titleRaw.value;
38
+ const headline = headlineRaw === null || headlineRaw === void 0 ? void 0 : headlineRaw.value;
39
+ const caption = captionRaw === null || captionRaw === void 0 ? void 0 : captionRaw.value;
40
+ const ctas = ctasRaw === null || ctasRaw === void 0 ? void 0 : ctasRaw.value;
41
+ const pages = (_e = (_d = listRaw === null || listRaw === void 0 ? void 0 : listRaw.value) === null || _d === void 0 ? void 0 : _d.pages) !== null && _e !== void 0 ? _e : [];
42
+ const schema = (_f = listRaw === null || listRaw === void 0 ? void 0 : listRaw.value.__schema) !== null && _f !== void 0 ? _f : {};
43
+ // panel layout
44
+ const layout = panels_1.BlockPanel.getLayout({
45
+ args: { fields, config },
46
+ messageKey: 'message',
47
+ listKey: 'list'
48
+ });
49
+ const getPanel = ({ className, panel }) => {
50
+ var _a;
51
+ switch (panel.type) {
52
+ case 'message':
53
+ return ((0, jsx_runtime_1.jsx)(panels_1.MessagePanel, { panel: panel, title: title, headline: headline, caption: caption, ctas: ctas }));
54
+ case 'list': {
55
+ const listPanelConfig = config;
56
+ return ((0, jsx_runtime_1.jsx)(panels_1.ListPanel, { panel: panel, items: pages, layout: ((_a = funnel_core_1.Schema.EnumField.Value.fromData(listPanelConfig.listLayout)) !== null && _a !== void 0 ? _a : 'card'), children: page => { var _a; return (_a = children === null || children === void 0 ? void 0 : children(page)) !== null && _a !== void 0 ? _a : (0, jsx_runtime_1.jsx)(entities_1.PagePreview, { page: page }); } }));
57
+ }
58
+ }
59
+ };
60
+ // render
61
+ return ((0, jsx_runtime_1.jsx)(Block_1.Block, Object.assign({ className: (0, classnames_1.default)(className, "nd-RelatedPages"), config: config, layout: layout, renderPanel: getPanel }, props)));
62
+ }
63
+ // extension
64
+ (function (RelatedPages) {
65
+ // schema
66
+ function fieldsSchema({ size, pageType }) {
67
+ return Object.assign(Object.assign({}, panels_1.MessagePanel.Fields.all), { list: funnel_core_1.Schema.Field.dynamicPages({
68
+ name: 'Related Content',
69
+ description: 'Pin pages to feature specific links in your preferred order. Priority settings will automatically fill any remaining slots with relevant content. If all slots are pinned, priority settings will have no effect.',
70
+ types: [pageType],
71
+ size
72
+ }) });
73
+ }
74
+ const configSchema = panels_1.BlockPanel.getConfigSchema({
75
+ fields: fieldsSchema({ pageType: 'any', size: 0 }),
76
+ messageKey: 'message',
77
+ listKey: 'list'
78
+ });
79
+ function schema(args) {
80
+ return funnel_core_1.Schema.Block.create({
81
+ id: '_nd-relatedPages',
82
+ name: 'Related',
83
+ version: 1,
84
+ fields: fieldsSchema(args),
85
+ config: configSchema,
86
+ getConfig: args => panels_1.BlockPanel.getConfig({
87
+ args,
88
+ messageKey: 'message',
89
+ listKey: 'list'
90
+ }),
91
+ getLayout: args => panels_1.BlockPanel.getLayout({
92
+ args,
93
+ messageKey: 'message',
94
+ listKey: 'list'
95
+ })
96
+ });
97
+ }
98
+ RelatedPages.schema = schema;
99
+ })(RelatedPages || (exports.RelatedPages = RelatedPages = {}));
@@ -1,36 +1,24 @@
1
1
  import { Schema } from '@nascentdigital/funnel-core';
2
- import { HTMLBlockElement, HTMLElements } from '../../types';
3
- import { Caption, Headline, Title } from '../fields';
4
- import { Stat } from './Stat';
5
- export declare function Stats({ className, titleTag, headlineTag, captionTag, statTag, statProps, stats, ...props }: Stats.Props): import("react/jsx-runtime").JSX.Element | null;
2
+ import { ComponentProps } from 'react';
3
+ import { Block } from './Block';
4
+ export declare function Stats(props: ComponentProps<typeof Stats.Component>): import("react/jsx-runtime").JSX.Element;
6
5
  export declare namespace Stats {
7
- const schema: Schema.Block<"_nd-stats", {
8
- title: Schema.Optional<Schema.TextField>;
9
- headline: Schema.Optional<Schema.RichTextField>;
10
- caption: Schema.Optional<Schema.RichTextField>;
11
- ctas: Schema.Optional<Schema.ListField<{
12
- cta: Schema.LinkField;
13
- }>>;
14
- stats: Schema.ListField<{
15
- stat: Schema.ObjectField<{
16
- value: Schema.TextField;
17
- label: Schema.TextField;
18
- description: Schema.Optional<Schema.RichTextField>;
19
- icon: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
20
- link: Schema.Optional<Schema.LinkField>;
21
- }>;
6
+ const Component: import("react").FunctionComponent<Block.Create.Result.Component<"_nd-stats", true, undefined, Schema.ListField<{
7
+ stat: Schema.ObjectField<{
8
+ value: Schema.TextField;
9
+ label: Schema.TextField;
10
+ description: Schema.Optional<Schema.RichTextField>;
11
+ icon: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
12
+ link: Schema.Optional<Schema.LinkField>;
22
13
  }>;
23
- }, {
24
- theme: Schema.EnumField<Readonly<import("@nascentdigital/funnel-core").BlockThemes.Options>>;
25
- }>;
26
- type Props = HTMLBlockElement<'div'> & {
27
- titleTag?: Title.Tag;
28
- headlineTag?: Headline.Tag;
29
- captionTag?: Caption.Tag;
30
- statTag?: Stat.Tag;
31
- statProps?: Stat.Props.Configuration;
32
- stats: Model;
33
- };
34
- type Tag = HTMLElements.Standard.Container;
14
+ }>, Schema.Block.Config, any>>, schema: Block.Create.Result.Schema<"_nd-stats", true, undefined, Schema.ListField<{
15
+ stat: Schema.ObjectField<{
16
+ value: Schema.TextField;
17
+ label: Schema.TextField;
18
+ description: Schema.Optional<Schema.RichTextField>;
19
+ icon: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
20
+ link: Schema.Optional<Schema.LinkField>;
21
+ }>;
22
+ }>, Schema.Block.Config>;
35
23
  type Model = Schema.Block.LinkedData<typeof schema>;
36
24
  }
@@ -1,71 +1,26 @@
1
1
  "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
3
  exports.Stats = Stats;
18
4
  const jsx_runtime_1 = require("react/jsx-runtime");
19
5
  const funnel_core_1 = require("@nascentdigital/funnel-core");
20
- const classnames_1 = __importDefault(require("classnames"));
21
- const fields_1 = require("../fields");
22
- const schema_1 = require("../schema");
6
+ const Block_1 = require("./Block");
23
7
  const Stat_1 = require("./Stat");
24
8
  // component
25
- function Stats(_a) {
26
- var _b, _c, _d;
27
- var { className, titleTag = 'span', headlineTag = 'h2', captionTag = 'div', statTag = 'div', statProps = {}, stats } = _a, props = __rest(_a, ["className", "titleTag", "headlineTag", "captionTag", "statTag", "statProps", "stats"]);
28
- // dont render if missing model
29
- if (!stats) {
30
- console.warn('[ValueProp] attempted to render without valueProp model');
31
- return null;
32
- }
33
- const { config, fields } = stats !== null && stats !== void 0 ? stats : {};
34
- const statsList = (_c = (_b = fields === null || fields === void 0 ? void 0 : fields.stats) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : [];
35
- // render
36
- const { title: titleRaw, headline: headlineRaw, caption: captionRaw, ctas: ctasRaw } = fields;
37
- const title = titleRaw === null || titleRaw === void 0 ? void 0 : titleRaw.value;
38
- const headline = headlineRaw === null || headlineRaw === void 0 ? void 0 : headlineRaw.value;
39
- const caption = captionRaw === null || captionRaw === void 0 ? void 0 : captionRaw.value;
40
- const ctas = (_d = ctasRaw === null || ctasRaw === void 0 ? void 0 : ctasRaw.value) !== null && _d !== void 0 ? _d : [];
41
- return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)(className, 'nd-Stats', schema_1.BlockConfig.Presets.ThemeOnly.getClassName(config)) }, props, { children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-Stats-content", children: [(title || headline || caption || ctas.length > 0) &&
42
- (0, jsx_runtime_1.jsx)("div", { className: "nd-Stats-copyWrap", children: (0, jsx_runtime_1.jsxs)("div", { className: "nd-Stats-copy", children: [title &&
43
- (0, jsx_runtime_1.jsx)(fields_1.Title, { className: "nd-Stats-title", as: titleTag, title: title }), (0, jsx_runtime_1.jsx)(fields_1.Headline, { className: "nd-Stats-headline", as: headlineTag, headline: headline }), caption &&
44
- (0, jsx_runtime_1.jsx)(fields_1.Caption, { className: "nd-Stats-caption", as: captionTag, caption: caption }), ctas.length > 0 &&
45
- (0, jsx_runtime_1.jsx)("div", { className: "nd-Stats-ctas", children: ctas.map(cta => (0, jsx_runtime_1.jsx)(fields_1.Link, { className: "nd-Stats-cta", link: cta.value }, cta.id)) })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "nd-Stats-statsWrap", children: (0, jsx_runtime_1.jsx)("div", { className: "nd-Stats-stats", "data-stats-count": statsList.length, children: statsList.map(stat => (0, jsx_runtime_1.jsx)(Stat_1.Stat, Object.assign({ as: statTag, stat: stat }, statProps), stat.id)) }) })] }) })));
9
+ function Stats(props) {
10
+ return (0, jsx_runtime_1.jsx)(Stats.Component, Object.assign({}, props));
46
11
  }
47
12
  // extension
48
13
  (function (Stats) {
49
- // schema
50
- Stats.schema = funnel_core_1.Schema.Block.create({
14
+ var _a;
15
+ // factory
16
+ _a = Block_1.Block.create({
51
17
  id: '_nd-stats',
52
18
  name: 'Statistics',
53
19
  version: 1,
54
- config: Object.assign({}, schema_1.BlockConfig.Presets.ThemeOnly.schema),
55
- fields: {
56
- title: fields_1.Title.schema.optional(),
57
- headline: fields_1.Headline.schema.optional(),
58
- caption: fields_1.Caption.schema.optional(),
59
- ctas: funnel_core_1.Schema.Field.list({
60
- name: 'CTAs',
61
- description: 'Add your call-to-actions in the order you\'d like them to appear *(these are optional)*.',
62
- itemTypes: {
63
- cta: funnel_core_1.Schema.Field.link({ name: 'Call to Action' })
64
- },
65
- min: 1,
66
- max: 2
67
- }).optional(),
68
- stats: funnel_core_1.Schema.Field.list({
20
+ className: 'nd-Stats',
21
+ message: true,
22
+ list: {
23
+ schema: funnel_core_1.Schema.Field.list({
69
24
  name: 'Stat',
70
25
  description: 'Stat will be displayed in the order you present them.',
71
26
  itemTypes: {
@@ -73,7 +28,8 @@ function Stats(_a) {
73
28
  },
74
29
  min: 1,
75
30
  max: 6
76
- })
31
+ }),
32
+ itemRenderer: (item, itemProps) => ((0, jsx_runtime_1.jsx)(Stat_1.Stat, Object.assign({ as: "li", stat: item }, itemProps)))
77
33
  }
78
- });
34
+ }), Stats.Component = _a.Component, Stats.schema = _a.schema;
79
35
  })(Stats || (exports.Stats = Stats = {}));
@@ -1,7 +1,7 @@
1
1
  import { Schema } from '@nascentdigital/funnel-core';
2
2
  import { HTMLBlockElement } from '../../types';
3
3
  import { BlockPanel, TestimonialPanel, VisualPanel } from '../panels';
4
- export declare function Testimonial({ className, testimonial, testimonialPanelProps, visualPanelProps, ...props }: Testimonial.Props): import("react/jsx-runtime").JSX.Element | null;
4
+ export declare function Testimonial({ className, model, testimonialPanelProps, visualPanelProps, ...props }: Testimonial.Props): import("react/jsx-runtime").JSX.Element | null;
5
5
  export declare namespace Testimonial {
6
6
  const fieldsSchema: {
7
7
  visual: Schema.Optional<Schema.AssetField<Schema.AssetField.LinkedValue.Visual>>;
@@ -83,7 +83,7 @@ export declare namespace Testimonial {
83
83
  }>>;
84
84
  }, "message", "visual", undefined, Schema.Block.Config>>;
85
85
  export type Props = HTMLBlockElement<'div'> & {
86
- testimonial: Model;
86
+ model: Model;
87
87
  testimonialPanelProps?: TestimonialPanel.Props.Configuration;
88
88
  visualPanelProps?: VisualPanel.Props.Configuration;
89
89
  };
@@ -23,15 +23,15 @@ const Block_1 = require("./Block");
23
23
  // block
24
24
  function Testimonial(_a) {
25
25
  var _b, _c;
26
- var { className, testimonial, testimonialPanelProps = {}, visualPanelProps = {} } = _a, props = __rest(_a, ["className", "testimonial", "testimonialPanelProps", "visualPanelProps"]);
26
+ var { className, model, testimonialPanelProps = {}, visualPanelProps = {} } = _a, props = __rest(_a, ["className", "model", "testimonialPanelProps", "visualPanelProps"]);
27
27
  // dont render if missing model
28
- if (!testimonial) {
28
+ if (!model) {
29
29
  console.warn('[Testimonial] attempted to render without testimonial model');
30
30
  return null;
31
31
  }
32
32
  // destructure props
33
- const config = (_b = testimonial.config) !== null && _b !== void 0 ? _b : {};
34
- const fields = (_c = testimonial.fields) !== null && _c !== void 0 ? _c : {};
33
+ const config = (_b = model.config) !== null && _b !== void 0 ? _b : {};
34
+ const fields = (_c = model.fields) !== null && _c !== void 0 ? _c : {};
35
35
  const { visual: visualRaw, title: titleRaw, quote: quoteRaw, author: authorRaw, ctas: ctasRaw } = fields;
36
36
  const visual = visualRaw === null || visualRaw === void 0 ? void 0 : visualRaw.value;
37
37
  const title = titleRaw === null || titleRaw === void 0 ? void 0 : titleRaw.value;
@@ -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',