@nascentdigital/funnel-editor 4.6.0 → 4.6.7

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 (68) hide show
  1. package/dist/components.d.ts +9 -0
  2. package/dist/components.js +27 -0
  3. package/dist/core/components/fields/page/PagePicker.d.ts +2 -2
  4. package/dist/core/components/interaction/DateTimePicker.d.ts +0 -1
  5. package/dist/core/components/interaction/DateTimePicker.js +0 -2
  6. package/dist/core/components/interaction/Popup.js +1 -0
  7. package/dist/core/components/transitions/FadeIn.js +2 -14
  8. package/dist/core/domain/Block.d.ts +1 -0
  9. package/dist/core/domain/Block.js +6 -4
  10. package/dist/core/domain/BlockConfiguration.js +5 -0
  11. package/dist/core/domain/Collection.d.ts +3 -3
  12. package/dist/core/domain/IPage.d.ts +58 -0
  13. package/dist/core/domain/IPage.js +20 -0
  14. package/dist/core/domain/IPageRefStore.d.ts +3 -3
  15. package/dist/core/domain/ItemBase.d.ts +6 -6
  16. package/dist/core/domain/ItemBase.js +5 -5
  17. package/dist/core/domain/Page.d.ts +9 -22
  18. package/dist/core/domain/Page.js +1 -16
  19. package/dist/core/domain/PageOverview.d.ts +2 -2
  20. package/dist/core/domain/PageRefStoreProxy.d.ts +4 -4
  21. package/dist/core/domain/PageSettings.d.ts +3 -3
  22. package/dist/core/domain/PageSummary.d.ts +2 -2
  23. package/dist/core/domain/index.d.ts +1 -0
  24. package/dist/core/domain/index.js +1 -0
  25. package/dist/core/hooks/usePage.d.ts +4 -4
  26. package/dist/core/hooks/usePageRef.d.ts +1 -1
  27. package/dist/core/repository/PageRepository.d.ts +2 -2
  28. package/dist/core/repository/PageSerializer.d.ts +34 -1
  29. package/dist/core/repository/PageSerializer.js +4 -0
  30. package/dist/page/components/PageHeader.d.ts +2 -2
  31. package/dist/page/components/PageNotCreated.d.ts +2 -2
  32. package/dist/page/components/PageNotFound.d.ts +2 -2
  33. package/dist/page/components/config/BlockConfigButton.d.ts +2 -1
  34. package/dist/page/components/config/BlockConfigButton.js +14 -11
  35. package/dist/page/components/config/BlockPreview.d.ts +8 -0
  36. package/dist/page/components/config/BlockPreview.js +53 -0
  37. package/dist/page/components/config/index.d.ts +1 -1
  38. package/dist/page/components/config/index.js +1 -1
  39. package/dist/page/components/config/preview/ColumnLayout.d.ts +10 -0
  40. package/dist/page/components/config/preview/ColumnLayout.js +15 -0
  41. package/dist/page/components/config/preview/ItemLayout.d.ts +12 -0
  42. package/dist/page/components/config/preview/ItemLayout.js +45 -0
  43. package/dist/page/components/config/preview/ListPanel.d.ts +12 -0
  44. package/dist/page/components/config/preview/ListPanel.js +14 -0
  45. package/dist/page/components/config/preview/MessagePanel.d.ts +12 -0
  46. package/dist/page/components/config/preview/MessagePanel.js +21 -0
  47. package/dist/page/components/config/preview/Panel.d.ts +15 -0
  48. package/dist/page/components/config/preview/Panel.js +74 -0
  49. package/dist/page/components/config/preview/RowLayout.d.ts +10 -0
  50. package/dist/page/components/config/preview/RowLayout.js +26 -0
  51. package/dist/page/components/config/preview/StackLayout.d.ts +10 -0
  52. package/dist/page/components/config/preview/StackLayout.js +15 -0
  53. package/dist/page/components/config/preview/VisualPanel.d.ts +12 -0
  54. package/dist/page/components/config/preview/VisualPanel.js +27 -0
  55. package/dist/page/components/config/preview/index.d.ts +3 -0
  56. package/dist/page/components/config/preview/index.js +19 -0
  57. package/dist/page/components/panels/BlockConfigPanel.js +4 -4
  58. package/dist/page/hooks/IPageController.d.ts +42 -0
  59. package/dist/page/hooks/IPageController.js +32 -0
  60. package/dist/page/hooks/PageController.d.ts +11 -36
  61. package/dist/page/hooks/PageController.js +7 -33
  62. package/dist/page/hooks/index.d.ts +1 -0
  63. package/dist/page/hooks/index.js +1 -0
  64. package/dist/page/hooks/usePageController.d.ts +3 -3
  65. package/dist/styles/index.css +805 -54
  66. package/package.json +3 -2
  67. package/dist/page/components/config/LegacyBlockPreview.d.ts +0 -8
  68. package/dist/page/components/config/LegacyBlockPreview.js +0 -452
@@ -103,6 +103,7 @@ var PageSerializer;
103
103
  });
104
104
  }
105
105
  }
106
+ PageSerializer.deserializeContent = deserializeContent;
106
107
  function deserializeSection({ key, eventBus, schema, content, snapshot }) {
107
108
  // TODO: handle version mismatch (between schema + content) and upgrading
108
109
  if (content && content.version !== schema.version) {
@@ -132,6 +133,7 @@ var PageSerializer;
132
133
  exists: content !== undefined
133
134
  });
134
135
  }
136
+ PageSerializer.deserializeSection = deserializeSection;
135
137
  function deserializeSectionBlock({ id, key, eventBus, schema, content, snapshot }) {
136
138
  // create block and return it (upgrade is handled in block deserialization)
137
139
  return new domain_1.SectionBlock({
@@ -143,6 +145,7 @@ var PageSerializer;
143
145
  exists: true
144
146
  });
145
147
  }
148
+ PageSerializer.deserializeSectionBlock = deserializeSectionBlock;
146
149
  function deserializeBlock({ key, eventBus, schema, content: blockContent, snapshot }) {
147
150
  // throw if there's a type mismatch
148
151
  const { type = schema.type, version = schema.version, config = {}, fields = {} } = blockContent !== null && blockContent !== void 0 ? blockContent : {};
@@ -178,4 +181,5 @@ var PageSerializer;
178
181
  name: config.name
179
182
  });
180
183
  }
184
+ PageSerializer.deserializeBlock = deserializeBlock;
181
185
  })(PageSerializer || (exports.PageSerializer = PageSerializer = {}));
@@ -1,11 +1,11 @@
1
1
  import { Callback } from '@nascentdigital/funnel-core';
2
2
  import { Block, PageSettings, Section, SectionBlock } from '../../core';
3
- import { PageController } from '../hooks';
3
+ import { IPageController } from '../hooks';
4
4
  export declare function PageHeader({ className, target, onBack }: PageHeader.Props): import("react/jsx-runtime").JSX.Element;
5
5
  export declare namespace PageHeader {
6
6
  type Props = {
7
7
  className?: string;
8
- target: PageController.Target;
8
+ target: IPageController.Target;
9
9
  selectedItem?: Block | SectionBlock | Section | PageSettings | undefined;
10
10
  onBack: Callback.Void;
11
11
  };
@@ -1,8 +1,8 @@
1
- import { PageController } from '../hooks';
1
+ import { IPageController } from '../hooks';
2
2
  export declare function PageNotCreated({ className, target }: PageNotCreated.Props): import("react/jsx-runtime").JSX.Element | null;
3
3
  export declare namespace PageNotCreated {
4
4
  type Props = {
5
5
  className?: string;
6
- target: PageController.Target;
6
+ target: IPageController.Target;
7
7
  };
8
8
  }
@@ -1,8 +1,8 @@
1
- import { PageController } from '../hooks';
1
+ import { IPageController } from '../hooks';
2
2
  export declare function PageNotFound({ className, target }: PageNotFound.Props): import("react/jsx-runtime").JSX.Element;
3
3
  export declare namespace PageNotFound {
4
4
  type Props = {
5
5
  className?: string;
6
- target: PageController.Target;
6
+ target: IPageController.Target;
7
7
  };
8
8
  }
@@ -1,8 +1,9 @@
1
1
  import { PropsWithChildren } from 'react';
2
- export declare function BlockConfigButton({ target, children }: BlockConfigButton.Props): import("react/jsx-runtime").JSX.Element | null;
2
+ export declare function BlockConfigButton({ target, anchorId: anchorOverrideId, children }: BlockConfigButton.Props): import("react/jsx-runtime").JSX.Element | null;
3
3
  export declare namespace BlockConfigButton {
4
4
  type Target = 'block' | 'message' | 'visual' | 'list';
5
5
  type Props = PropsWithChildren & {
6
6
  target: Target;
7
+ anchorId?: string;
7
8
  };
8
9
  }
@@ -25,11 +25,12 @@ const rxjs_1 = require("rxjs");
25
25
  const core_1 = require("../../../core");
26
26
  const hooks_1 = require("../../hooks");
27
27
  // component
28
- function BlockConfigButton({ target, children = 'Configure' }) {
28
+ function BlockConfigButton({ target, anchorId: anchorOverrideId, children = 'Configure' }) {
29
29
  var _a;
30
30
  // bind state + hooks
31
31
  const [open, setOpen] = (0, react_2.useState)(false);
32
32
  const anchorId = (0, react_2.useId)();
33
+ const nestedAnchorId = (0, react_2.useId)();
33
34
  const panelLayoutPickerRef = (0, react_2.useRef)(null);
34
35
  const listLayoutPickerRef = (0, react_2.useRef)(null);
35
36
  const configuration = (0, core_1.useBlockConfiguration)();
@@ -56,7 +57,7 @@ function BlockConfigButton({ target, children = 'Configure' }) {
56
57
  // pick new layout
57
58
  const { schema: layoutSchema, value: layoutData } = layoutField;
58
59
  const selectedLayout = await ((_a = panelLayoutPickerRef.current) === null || _a === void 0 ? void 0 : _a.open({
59
- anchor: anchorId,
60
+ anchor: nestedAnchorId,
60
61
  anchorOffset: 4,
61
62
  placement: 'top',
62
63
  items: Object.entries(layoutSchema.options).map(([layout, option]) => ({
@@ -72,7 +73,7 @@ function BlockConfigButton({ target, children = 'Configure' }) {
72
73
  };
73
74
  // set variables
74
75
  size = 'sm';
75
- placement = 'left';
76
+ placement = anchorOverrideId ? 'left-start' : 'left';
76
77
  title = 'Block Configuration';
77
78
  // render content
78
79
  const { scope, layoutField, blocksFields = [], desktopFields = [], mobileFields = [] } = configuration;
@@ -82,7 +83,7 @@ function BlockConfigButton({ target, children = 'Configure' }) {
82
83
  const { options: slotOptions = [], currentIndex: slotIndex = 0 } = configuration.slotState;
83
84
  content = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("section", { className: "grid grid-cols-2 gap-x-l5 gap-y-l4", children: [blocksFields.length > 0 &&
84
85
  (0, jsx_runtime_1.jsx)(core_1.FieldErrorController, { children: blocksFields.map(field => (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { className: "col-span-full", field: field, size: "xs" }, field.id)) }), layoutField && layoutField.schema.enum.length > 1 &&
85
- (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l2", children: [(0, jsx_runtime_1.jsx)(core_1.FieldHeader, { label: "Layout", size: "xs" }), (0, jsx_runtime_1.jsx)(core_1.Button, { anchorId: anchorId, variant: "secondary", size: "xs", iconLeft: "LayoutTemplate", onClick: onChangePanelLayout, children: "Change" })] }), slotOptions.length > 1 &&
86
+ (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l2", children: [(0, jsx_runtime_1.jsx)(core_1.FieldHeader, { label: "Layout", size: "xs" }), (0, jsx_runtime_1.jsx)(core_1.Button, { anchorId: nestedAnchorId, variant: "secondary", size: "xs", iconLeft: "LayoutTemplate", onClick: onChangePanelLayout, children: "Change" })] }), slotOptions.length > 1 &&
86
87
  (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l2", children: [(0, jsx_runtime_1.jsx)(core_1.FieldHeader, { label: "Arrangement", size: "xs" }), slotOptions.length === 2
87
88
  ?
88
89
  (0, jsx_runtime_1.jsx)(core_1.Button, { variant: "secondary", size: "xs", iconLeft: "ArrowLeftRight", onClick: () => configuration === null || configuration === void 0 ? void 0 : configuration.gotToNextSlot(), children: "Swap" })
@@ -113,7 +114,7 @@ function BlockConfigButton({ target, children = 'Configure' }) {
113
114
  // pick new layout
114
115
  const { value: layoutData } = layoutField;
115
116
  const selectedLayout = await ((_a = listLayoutPickerRef.current) === null || _a === void 0 ? void 0 : _a.open({
116
- anchor: anchorId,
117
+ anchor: nestedAnchorId,
117
118
  anchorOffset: 4,
118
119
  placement: 'top',
119
120
  items: Object.entries(layoutSchema.options).map(([layout, option]) => ({
@@ -132,7 +133,7 @@ function BlockConfigButton({ target, children = 'Configure' }) {
132
133
  placement = 'bottom-end';
133
134
  title = 'List Configuration';
134
135
  // render content
135
- content = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l4", children: [(0, jsx_runtime_1.jsx)(core_1.Button, { anchorId: anchorId, variant: "secondary", size: "xs", iconLeft: "LayoutTemplate", onClick: onChangeLayout, children: "Change" }), Object.values(listFields)
136
+ content = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l4", children: [(0, jsx_runtime_1.jsx)(core_1.Button, { anchorId: nestedAnchorId, variant: "secondary", size: "xs", iconLeft: "LayoutTemplate", onClick: onChangeLayout, children: "Change" }), Object.values(listFields)
136
137
  .filter(funnel_core_1.Value.isDefined)
137
138
  .map(field => (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: field, size: "xs" }, field.id))] }), (0, jsx_runtime_1.jsx)(core_1.QuickPicker, { ref: listLayoutPickerRef, variant: "card", title: "Pick List Layout", description: "Select an available layout for this list.", renderItem: (item) => renderListLayoutItem(item) })] }));
138
139
  break;
@@ -153,7 +154,9 @@ function BlockConfigButton({ target, children = 'Configure' }) {
153
154
  (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: aspectField, size: "xs" }), anchorField
154
155
  ? (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: anchorField, size: "xs" })
155
156
  :
156
- (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(core_1.FieldHeader, { label: "Anchor", size: "xs" }), (0, jsx_runtime_1.jsx)("p", { className: "label-xs text-content-secondary text-pretty", children: "Your current image size and aspect ratio don't require and anchor (there's no cropping)." })] })] }), visual && renderVisual({
157
+ (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(core_1.FieldHeader, { label: "Anchor", size: "xs" }), (0, jsx_runtime_1.jsx)("p", { className: "label-xs text-content-secondary text-pretty", children: "Your current image size and aspect ratio don't require and anchor (there's no cropping)." })] }), widthField &&
158
+ (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: widthField, size: "xs" }, widthField.id), horizontalAlignField &&
159
+ (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: horizontalAlignField, size: "xs" }, horizontalAlignField.id)] }), visual && renderVisual({
157
160
  configuration,
158
161
  visual,
159
162
  aspectField: aspectField,
@@ -180,10 +183,10 @@ function BlockConfigButton({ target, children = 'Configure' }) {
180
183
  configuration.reset();
181
184
  };
182
185
  // render
183
- return ((0, jsx_runtime_1.jsx)(core_1.MiniEditor, { title: title, size: size, anchor: (0, jsx_runtime_1.jsx)(core_1.Button, { variant: "secondary", size: "xs", onClick: () => setOpen(true), children: children }), anchorOffset: 4, placement: placement, open: open, onSave: onSave, disableSave: !configuration.modified, onClose: () => setOpen(false), onClosed: onClosed, customActions: (0, jsx_runtime_1.jsx)(core_1.Button, { variant: "secondary", size: "xs", iconLeft: configuration.scope === 'mobile'
184
- ? 'Smartphone'
185
- : 'Monitor', onClick: () => configuration.scope = configuration.scope === 'desktop' ? 'mobile' : 'desktop', children: configuration.scope === 'mobile' ? 'Mobile' : 'Desktop' }), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l4", children: [tip &&
186
- (0, jsx_runtime_1.jsx)(core_1.Note, { variant: "tip", size: size, children: (0, jsx_runtime_1.jsx)(funnel_ui_1.Markup, { markdown: `**Tip:** ${tip}` }) }), content] }) }));
186
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(core_1.Button, { anchorId: anchorId, variant: "secondary", size: "xs", onClick: () => setOpen(true), children: children }), (0, jsx_runtime_1.jsx)(core_1.MiniEditor, { title: title, size: size, anchor: anchorOverrideId || anchorId, anchorOffset: 4, placement: placement, open: open, onSave: onSave, disableSave: !configuration.modified, onClose: () => setOpen(false), onClosed: onClosed, customActions: (0, jsx_runtime_1.jsx)(core_1.Button, { variant: "secondary", size: "xs", iconLeft: configuration.scope === 'mobile'
187
+ ? 'Smartphone'
188
+ : 'Monitor', onClick: () => configuration.scope = configuration.scope === 'desktop' ? 'mobile' : 'desktop', children: configuration.scope === 'mobile' ? 'Mobile' : 'Desktop' }), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l4", children: [tip &&
189
+ (0, jsx_runtime_1.jsx)(core_1.Note, { variant: "tip", size: size, children: (0, jsx_runtime_1.jsx)(funnel_ui_1.Markup, { markdown: `**Tip:** ${tip}` }) }), content] }) })] }));
187
190
  }
188
191
  function renderPanelLayoutItem(item) {
189
192
  const panel = (className = 'flex-1') => ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('bg-surface-placeholder rounded-[2px]', className) }));
@@ -0,0 +1,8 @@
1
+ import { BlockConfiguration } from '../../../core';
2
+ export declare function BlockPreview({ className, configuration }: BlockPreview.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace BlockPreview {
4
+ type Props = {
5
+ className?: string;
6
+ configuration?: BlockConfiguration;
7
+ };
8
+ }
@@ -0,0 +1,53 @@
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.BlockPreview = BlockPreview;
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("motion/react");
11
+ const preview_1 = require("./preview");
12
+ // components
13
+ function BlockPreview({ className, configuration }) {
14
+ // bind props
15
+ const { scope = 'desktop', layout } = configuration !== null && configuration !== void 0 ? configuration : {};
16
+ const tight = scope === 'mobile'
17
+ ? layout === null || layout === void 0 ? void 0 : layout.tight.mobile
18
+ : layout === null || layout === void 0 ? void 0 : layout.tight.desktop;
19
+ // render
20
+ return ((0, jsx_runtime_1.jsx)(react_1.motion.section, { className: (0, classnames_1.default)(className, 'bg-surface2 rounded-xs interpolate-all', {
21
+ 'min-h-[100px]': !layout,
22
+ 'w-[240px]': scope === 'desktop',
23
+ 'w-[136px]': scope === 'mobile',
24
+ 'pb-l4': tight === 'above',
25
+ 'pt-l4': tight === 'below',
26
+ 'py-l4': tight === 'none'
27
+ }), layoutRoot: true, layout: true, children: configuration && renderLayout({ configuration }) }));
28
+ }
29
+ function renderLayout({ configuration }) {
30
+ // skip if there's no layout
31
+ const { scope, layout } = configuration;
32
+ if (!layout) {
33
+ return null;
34
+ }
35
+ // render layout based on root type
36
+ const mobile = scope === 'mobile';
37
+ const { root } = layout;
38
+ switch (root.type) {
39
+ // row (force column if mobile)
40
+ case 'row':
41
+ return mobile
42
+ ? (0, jsx_runtime_1.jsx)(preview_1.ColumnLayout, { layout: root, mobile: mobile })
43
+ : (0, jsx_runtime_1.jsx)(preview_1.RowLayout, { layout: root, mobile: mobile });
44
+ // column
45
+ case 'column':
46
+ return (0, jsx_runtime_1.jsx)(preview_1.ColumnLayout, { layout: root, mobile: mobile });
47
+ // stack
48
+ case 'stack':
49
+ return (0, jsx_runtime_1.jsx)(preview_1.StackLayout, { layout: root, mobile: mobile });
50
+ default:
51
+ throw new funnel_core_1.NotImplementedError(`Unsupported layout: ${layout.root.type}`);
52
+ }
53
+ }
@@ -1,3 +1,3 @@
1
1
  export * from './BlockConfigButton';
2
2
  export * from './BlockConfigurationProvider';
3
- export * from './LegacyBlockPreview';
3
+ export * from './BlockPreview';
@@ -16,4 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./BlockConfigButton"), exports);
18
18
  __exportStar(require("./BlockConfigurationProvider"), exports);
19
- __exportStar(require("./LegacyBlockPreview"), exports);
19
+ __exportStar(require("./BlockPreview"), exports);
@@ -0,0 +1,10 @@
1
+ import { BlockLayout } from '@nascentdigital/funnel-core';
2
+ export declare function ColumnLayout({ className, layout, mobile, nested }: ColumnLayout.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace ColumnLayout {
4
+ type Props = {
5
+ className?: string;
6
+ layout: BlockLayout.Container;
7
+ mobile: boolean;
8
+ nested?: boolean;
9
+ };
10
+ }
@@ -0,0 +1,15 @@
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.ColumnLayout = ColumnLayout;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const ItemLayout_1 = require("./ItemLayout");
10
+ // components
11
+ function ColumnLayout({ className, layout, mobile, nested = false }) {
12
+ // render
13
+ const { items } = layout;
14
+ return ((0, jsx_runtime_1.jsx)(ItemLayout_1.ItemLayout, { className: (0, classnames_1.default)(className, 'flex flex-col gap-l4'), parentType: "column", items: items, mobile: mobile, nested: nested }));
15
+ }
@@ -0,0 +1,12 @@
1
+ import { BlockLayout, Transform } from '@nascentdigital/funnel-core';
2
+ export declare function ItemLayout({ className, itemClassName, parentType, items, mobile, nested }: ItemLayout.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace ItemLayout {
4
+ type Props = {
5
+ className?: string;
6
+ itemClassName?: Transform<BlockLayout.NestedItem, string>;
7
+ parentType: BlockLayout.Container['type'];
8
+ items: ReadonlyArray<BlockLayout.NestedItem>;
9
+ mobile: boolean;
10
+ nested: boolean;
11
+ };
12
+ }
@@ -0,0 +1,45 @@
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.ItemLayout = ItemLayout;
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("motion/react");
11
+ const ColumnLayout_1 = require("./ColumnLayout");
12
+ const ListPanel_1 = require("./ListPanel");
13
+ const MessagePanel_1 = require("./MessagePanel");
14
+ const RowLayout_1 = require("./RowLayout");
15
+ const StackLayout_1 = require("./StackLayout");
16
+ const VisualPanel_1 = require("./VisualPanel");
17
+ // components
18
+ function ItemLayout({ className, itemClassName = () => '', parentType, items, mobile, nested }) {
19
+ // render
20
+ return ((0, jsx_runtime_1.jsx)(react_1.motion.div, { className: (0, classnames_1.default)(className), layout: true, children: items.map((item, itemOffset) => renderItem({ className: itemClassName(item), parentType, item, itemOffset, mobile, nested })) }));
21
+ }
22
+ function renderItem({ className, parentType, item, itemOffset, mobile, nested }) {
23
+ // render based on type
24
+ const key = funnel_core_1.BlockLayout.Container.filter(item)
25
+ ? `${item.type}.${itemOffset}`
26
+ : item.key;
27
+ switch (item.type) {
28
+ // containers (nested)
29
+ case 'row':
30
+ return mobile
31
+ ? (0, jsx_runtime_1.jsx)(ColumnLayout_1.ColumnLayout, { layout: item, mobile: mobile, nested: true }, key)
32
+ : (0, jsx_runtime_1.jsx)(RowLayout_1.RowLayout, { layout: item, mobile: mobile, nested: true }, key);
33
+ case 'column':
34
+ return (0, jsx_runtime_1.jsx)(ColumnLayout_1.ColumnLayout, { layout: item, mobile: mobile, nested: true }, key);
35
+ case 'stack':
36
+ return (0, jsx_runtime_1.jsx)(StackLayout_1.StackLayout, { layout: item, mobile: mobile, nested: true }, key);
37
+ // panels
38
+ case 'message':
39
+ return ((0, jsx_runtime_1.jsx)(MessagePanel_1.MessagePanel, { className: className, parentType: parentType, itemOffset: itemOffset, panel: item, mobile: mobile, nested: nested }, key));
40
+ case 'list':
41
+ return ((0, jsx_runtime_1.jsx)(ListPanel_1.ListPanel, { className: className, parentType: parentType, itemOffset: itemOffset, panel: item, mobile: mobile, nested: nested }, key));
42
+ case 'visual':
43
+ return ((0, jsx_runtime_1.jsx)(VisualPanel_1.VisualPanel, { className: className, parentType: parentType, itemOffset: itemOffset, panel: item, mobile: mobile, nested: nested }, key));
44
+ }
45
+ }
@@ -0,0 +1,12 @@
1
+ import { BlockLayout } from '@nascentdigital/funnel-core';
2
+ export declare function ListPanel({ className, parentType, itemOffset, panel, mobile, nested }: ListPanel.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace ListPanel {
4
+ type Props = {
5
+ className?: string;
6
+ parentType: BlockLayout.Container['type'];
7
+ itemOffset: number;
8
+ panel: BlockLayout.List;
9
+ mobile: boolean;
10
+ nested: boolean;
11
+ };
12
+ }
@@ -0,0 +1,14 @@
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 classnames_1 = __importDefault(require("classnames"));
9
+ const Panel_1 = require("./Panel");
10
+ // components
11
+ function ListPanel({ className, parentType, itemOffset, panel, mobile, nested }) {
12
+ // render
13
+ return ((0, jsx_runtime_1.jsx)(Panel_1.Panel, { className: className, contentClassName: (0, classnames_1.default)('flex flex-col p-6 bg-background rounded-xs', {}), parentType: parentType, itemOffset: itemOffset, panel: panel, mobile: mobile, nested: nested, disableSizing: mobile, children: (0, jsx_runtime_1.jsx)("div", { children: "List Panel" }) }));
14
+ }
@@ -0,0 +1,12 @@
1
+ import { BlockLayout } from '@nascentdigital/funnel-core';
2
+ export declare function MessagePanel({ className, parentType, itemOffset, panel, mobile, nested }: MessagePanel.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace MessagePanel {
4
+ type Props = {
5
+ className?: string;
6
+ parentType: BlockLayout.Container['type'];
7
+ itemOffset: number;
8
+ panel: BlockLayout.Message;
9
+ mobile: boolean;
10
+ nested: boolean;
11
+ };
12
+ }
@@ -0,0 +1,21 @@
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.MessagePanel = MessagePanel;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const react_1 = require("motion/react");
10
+ const Panel_1 = require("./Panel");
11
+ // components
12
+ function MessagePanel({ className, parentType, itemOffset, panel, mobile, nested }) {
13
+ // render
14
+ const { textAlign: { mobile: textAlignMobile, desktop: textAlignDesktop } } = panel;
15
+ const textAlign = mobile ? textAlignMobile : textAlignDesktop;
16
+ return ((0, jsx_runtime_1.jsxs)(Panel_1.Panel, { className: className, contentClassName: (0, classnames_1.default)('flex flex-col p-6 bg-background rounded-xs', {
17
+ 'items-start': textAlign === 'left',
18
+ 'items-center': textAlign === 'center',
19
+ 'items-end': textAlign === 'right'
20
+ }), parentType: parentType, itemOffset: itemOffset, panel: panel, mobile: mobile, nested: nested, disableSizing: mobile, children: [(0, jsx_runtime_1.jsx)(react_1.motion.div, { className: "w-full h-8 mb-4 bg-ix-primary rounded-xxs overflow-hidden", layout: true }), (0, jsx_runtime_1.jsx)(react_1.motion.div, { className: "w-full h-4 mb-3 bg-draft/tint3 rounded-px overflow-hidden", layout: true }), (0, jsx_runtime_1.jsx)(react_1.motion.div, { className: "w-full h-4 mb-3 bg-draft/tint3 rounded-px overflow-hidden", layout: true }), (0, jsx_runtime_1.jsx)(react_1.motion.div, { className: "w-1/2 h-4 bg-draft/tint3 rounded-px overflow-hidden", layout: true })] }));
21
+ }
@@ -0,0 +1,15 @@
1
+ import { BlockLayout } from '@nascentdigital/funnel-core';
2
+ import { PropsWithChildren } from 'react';
3
+ export declare function Panel({ className, contentClassName, parentType, itemOffset, panel, mobile, nested, disableSizing, children }: Panel.Props): import("react/jsx-runtime").JSX.Element;
4
+ export declare namespace Panel {
5
+ type Props = PropsWithChildren & {
6
+ className?: string;
7
+ contentClassName?: string;
8
+ parentType: BlockLayout.Container['type'];
9
+ itemOffset: number;
10
+ panel: BlockLayout.Panel;
11
+ mobile: boolean;
12
+ nested: boolean;
13
+ disableSizing: boolean;
14
+ };
15
+ }
@@ -0,0 +1,74 @@
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.Panel = Panel;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const react_1 = require("motion/react");
10
+ // components
11
+ function Panel({ className, contentClassName, parentType, itemOffset, panel, mobile, nested, disableSizing, children }) {
12
+ // render
13
+ const { key, mobileOrder, alignY, fullBleed: { mobile: fullBleedMobile, desktop: fullBleedDesktop } } = panel;
14
+ const fullBleed = mobile ? fullBleedMobile : fullBleedDesktop;
15
+ return ((0, jsx_runtime_1.jsx)(react_1.motion.div, { className: (0, classnames_1.default)(className, {
16
+ // mobile
17
+ 'flex flex-col': mobile,
18
+ 'justify-start': mobile && alignY === 'start',
19
+ 'justify-center': mobile && alignY === 'center',
20
+ 'justify-end': mobile && alignY === 'end',
21
+ 'order-first': mobile && mobileOrder === 'first',
22
+ 'order-last': mobile && mobileOrder === 'last',
23
+ // desktop
24
+ 'grid grid-cols-12': !mobile,
25
+ 'items-start': !mobile && alignY === 'start',
26
+ 'items-center': !mobile && alignY === 'center',
27
+ 'items-end': !mobile && alignY === 'end',
28
+ // '-ml-l4': itemPosition.left && fullBleed.desktop,
29
+ // '-mr-l4': itemPosition.right && fullBleed.desktop
30
+ // spacing (row)
31
+ 'pl-l4': parentType === 'row' && itemOffset === 0 && !fullBleed,
32
+ 'pr-l4': parentType === 'row' && itemOffset === 1 && !fullBleed,
33
+ // spacing (column/stack)
34
+ 'px-l4': (parentType === 'column' || (parentType === 'stack' && panel.type === 'visual')) && !fullBleed,
35
+ 'px-l6 py-l4': parentType === 'stack' && panel.type !== 'visual' && !fullBleed
36
+ }), layoutId: key, layout: true, children: (0, jsx_runtime_1.jsx)(react_1.motion.div, { className: getContentClasses({ className: (0, classnames_1.default)(contentClassName, 'relative'), panel, disableSizing }), layout: true, children: children }) }, key));
37
+ }
38
+ function getContentClasses({ className, panel: { alignX, size }, disableSizing }) {
39
+ // force full width for mobile
40
+ if (disableSizing) {
41
+ return className;
42
+ }
43
+ // or size for desktop
44
+ switch (size) {
45
+ case 'xs':
46
+ return (0, classnames_1.default)(className, 'col-span-4', {
47
+ 'col-start-1': alignX === 'start',
48
+ 'col-start-5': alignX === 'center',
49
+ 'col-end-13': alignX === 'end'
50
+ });
51
+ case 'sm':
52
+ return (0, classnames_1.default)(className, 'col-span-6', {
53
+ 'col-start-1': alignX === 'start',
54
+ 'col-start-4': alignX === 'center',
55
+ 'col-end-13': alignX === 'end'
56
+ });
57
+ case 'md':
58
+ return (0, classnames_1.default)(className, 'col-span-8', {
59
+ 'col-start-1': alignX === 'start',
60
+ 'col-start-3': alignX === 'center',
61
+ 'col-end-13': alignX === 'end'
62
+ });
63
+ case 'lg':
64
+ return (0, classnames_1.default)(className, 'col-span-10', {
65
+ 'col-start-1': alignX === 'start',
66
+ 'col-start-2': alignX === 'center',
67
+ 'col-end-13': alignX === 'end'
68
+ });
69
+ case 'full':
70
+ return (0, classnames_1.default)(className, 'col-span-full');
71
+ default:
72
+ return className;
73
+ }
74
+ }
@@ -0,0 +1,10 @@
1
+ import { BlockLayout } from '@nascentdigital/funnel-core';
2
+ export declare function RowLayout({ className, layout, mobile, nested }: RowLayout.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace RowLayout {
4
+ type Props = {
5
+ className?: string;
6
+ layout: BlockLayout.Row | BlockLayout.Row.Nested;
7
+ mobile: boolean;
8
+ nested?: boolean;
9
+ };
10
+ }
@@ -0,0 +1,26 @@
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.RowLayout = RowLayout;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const ItemLayout_1 = require("./ItemLayout");
10
+ // components
11
+ function RowLayout({ className, layout, mobile, nested = false }) {
12
+ // render
13
+ const { alignY, ratio, items } = layout;
14
+ return ((0, jsx_runtime_1.jsx)(ItemLayout_1.ItemLayout, { className: (0, classnames_1.default)(className, 'grid gap-l5', {
15
+ 'items-start': alignY === 'start',
16
+ 'items-center': alignY === 'center',
17
+ 'items-end': alignY === 'end',
18
+ 'grid-cols-[1fr,1fr]': ratio.desktop === '1/1',
19
+ 'grid-cols-[1fr,2fr]': ratio.desktop === '1/2',
20
+ 'grid-cols-[1fr,3fr]': ratio.desktop === '1/3',
21
+ 'grid-cols-[2fr,1fr]': ratio.desktop === '2/1',
22
+ 'grid-cols-[2fr,3fr]': ratio.desktop === '2/3',
23
+ 'grid-cols-[3fr,1fr]': ratio.desktop === '3/1',
24
+ 'grid-cols-[3fr,2fr]': ratio.desktop === '3/2'
25
+ }), itemClassName: () => 'flex-1', parentType: "row", items: items, mobile: mobile, nested: nested }));
26
+ }
@@ -0,0 +1,10 @@
1
+ import { BlockLayout } from '@nascentdigital/funnel-core';
2
+ export declare function StackLayout({ className, layout, mobile, nested }: StackLayout.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace StackLayout {
4
+ type Props = {
5
+ className?: string;
6
+ layout: BlockLayout.Container;
7
+ mobile: boolean;
8
+ nested?: boolean;
9
+ };
10
+ }
@@ -0,0 +1,15 @@
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.StackLayout = StackLayout;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const ItemLayout_1 = require("./ItemLayout");
10
+ // components
11
+ function StackLayout({ className, layout, mobile, nested = false }) {
12
+ // render
13
+ const { items } = layout;
14
+ return ((0, jsx_runtime_1.jsx)(ItemLayout_1.ItemLayout, { className: (0, classnames_1.default)(className, 'stacked-stretch'), parentType: "stack", items: items, mobile: mobile, nested: nested }));
15
+ }
@@ -0,0 +1,12 @@
1
+ import { BlockLayout } from '@nascentdigital/funnel-core';
2
+ export declare function VisualPanel({ className, parentType, itemOffset, panel, mobile, nested }: VisualPanel.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace VisualPanel {
4
+ type Props = {
5
+ className?: string;
6
+ parentType: BlockLayout.Container['type'];
7
+ itemOffset: number;
8
+ panel: BlockLayout.Visual;
9
+ mobile: boolean;
10
+ nested: boolean;
11
+ };
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.VisualPanel = VisualPanel;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const core_1 = require("../../../../core");
10
+ const Panel_1 = require("./Panel");
11
+ // components
12
+ function VisualPanel({ className, parentType, itemOffset, panel, mobile, nested }) {
13
+ // render
14
+ const { aspectRatio: { mobile: aspectRatioMobile, desktop: aspectRatioDesktop } } = panel;
15
+ const aspectRatio = mobile ? aspectRatioMobile : aspectRatioDesktop;
16
+ return ((0, jsx_runtime_1.jsx)(Panel_1.Panel, { className: className, parentType: parentType, itemOffset: itemOffset, panel: panel, mobile: mobile, nested: nested, disableSizing: mobile, children: (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('flex justify-center items-center bg-draft/tint3 rounded-xxs overflow-hidden', {
17
+ 'aspect-square': aspectRatio === 'square' || aspectRatio === 'auto',
18
+ 'aspect-phone': aspectRatio === 'phone',
19
+ 'aspects-tv': aspectRatio === 'tv',
20
+ 'aspect-widescreen': aspectRatio === 'widescreen',
21
+ 'aspect-cinema': aspectRatio === 'cinema'
22
+ }), children: (0, jsx_runtime_1.jsx)(core_1.Icon, { className: "text-content-tertiary", variant: "Image", size: {
23
+ size: 20,
24
+ strokeWidth: 1.5,
25
+ absoluteStrokeWidth: false
26
+ } }) }) }));
27
+ }
@@ -0,0 +1,3 @@
1
+ export * from './ColumnLayout';
2
+ export * from './RowLayout';
3
+ export * from './StackLayout';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ColumnLayout"), exports);
18
+ __exportStar(require("./RowLayout"), exports);
19
+ __exportStar(require("./StackLayout"), exports);