@nascentdigital/funnel-editor 6.1.5 → 6.1.6

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 (28) hide show
  1. package/dist/core/client/EditorApiClient.js +5 -2
  2. package/dist/core/components/feedback/Status.d.ts +1 -0
  3. package/dist/core/components/feedback/Status.js +2 -0
  4. package/dist/core/components/feedback/StatusBadge.d.ts +2 -2
  5. package/dist/core/components/feedback/StatusChip.d.ts +2 -3
  6. package/dist/core/components/feedback/StatusChip.js +2 -6
  7. package/dist/core/components/feedback/StatusDot.d.ts +8 -0
  8. package/dist/core/components/feedback/StatusDot.js +19 -0
  9. package/dist/core/components/feedback/index.d.ts +2 -0
  10. package/dist/core/components/feedback/index.js +2 -0
  11. package/dist/core/components/fields/collection/CollectionPicker.js +4 -1
  12. package/dist/core/components/fields/page/PagePicker.js +3 -1
  13. package/dist/core/components/interaction/Combobox.d.ts +14 -10
  14. package/dist/core/components/interaction/Combobox.js +4 -0
  15. package/dist/core/components/interaction/Popup.d.ts +1 -1
  16. package/dist/core/components/interaction/Popup.js +18 -10
  17. package/dist/core/components/interaction/table/Table.js +4 -4
  18. package/dist/core/components/interaction/table/TableItem.js +10 -20
  19. package/dist/core/domain/BlockConfiguration.js +1 -0
  20. package/dist/core/domain/PageOverview.d.ts +6 -6
  21. package/dist/core/domain/PageOverview.js +8 -8
  22. package/dist/core/domain/PageSummary.d.ts +1 -1
  23. package/dist/core/domain/Pages.js +2 -0
  24. package/dist/core/repository/PageSerializer.js +1 -1
  25. package/dist/explore/screens/SiteExplorer.js +3 -1
  26. package/dist/page/components/PageHeader.js +15 -4
  27. package/dist/styles/index.css +220 -18
  28. package/package.json +2 -2
@@ -81,8 +81,11 @@ class EditorApiClient {
81
81
  // extract static page overview
82
82
  const { type } = template;
83
83
  if (template.variant === 'static') {
84
- return new domain_1.StaticPageOverview(Object.assign({ template,
85
- type, refs: {} }, ((_a = overview.static.find(page => page.type === type)) !== null && _a !== void 0 ? _a : {})));
84
+ return new domain_1.StaticPageOverview({
85
+ template,
86
+ type,
87
+ refs: Object.values(((_a = overview.static.find(page => page.type === type)) !== null && _a !== void 0 ? _a : { refs: {} }).refs),
88
+ });
86
89
  }
87
90
  // or dynamic one
88
91
  else {
@@ -0,0 +1 @@
1
+ export type Status = 'default' | 'info' | 'success' | 'warn' | 'error';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +1,9 @@
1
1
  import { HTMLAttributes } from 'react';
2
+ import { Status } from './Status';
2
3
  export declare function StatusBadge({ className, color, label, variant, onClick, ...props }: StatusBadge.Props): import("react/jsx-runtime").JSX.Element;
3
4
  export declare namespace StatusBadge {
4
5
  type Props = HTMLAttributes<HTMLSpanElement> & {
5
- variant?: Variant;
6
+ variant?: Status;
6
7
  label: string;
7
8
  };
8
- type Variant = 'default' | 'info' | 'success' | 'warn' | 'error';
9
9
  }
@@ -1,9 +1,8 @@
1
1
  import { HTMLAttributes } from 'react';
2
+ import { Status } from './Status';
2
3
  export declare function StatusChip({ className, variant, onClick, children, ...props }: StatusChip.Props): import("react/jsx-runtime").JSX.Element;
3
4
  export declare namespace StatusChip {
4
5
  type Props = HTMLAttributes<HTMLSpanElement> & {
5
- variant: Variant;
6
+ variant: Status;
6
7
  };
7
- type Variant = 'info' | 'success' | 'warn' | 'error';
8
- type Size = 'lg' | 'md';
9
8
  }
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.StatusChip = StatusChip;
18
18
  const jsx_runtime_1 = require("react/jsx-runtime");
19
19
  const classnames_1 = __importDefault(require("classnames"));
20
+ const StatusDot_1 = require("./StatusDot");
20
21
  // component
21
22
  function StatusChip(_a) {
22
23
  var { className, variant, onClick, children } = _a, props = __rest(_a, ["className", "variant", "onClick", "children"]);
@@ -24,10 +25,5 @@ function StatusChip(_a) {
24
25
  return ((0, jsx_runtime_1.jsxs)("span", Object.assign({ className: (0, classnames_1.default)(className, 'h-25 inline-flex justify-center items-center gap-l3 px-l4 select-none interpolate', 'border border-solid border-border-l1 rounded-full', 'label-sm text-content-primary bg-surface1 text-nowrap', 'hover:border-ix-primary-hover', {
25
26
  'cursor-pointer': !!onClick,
26
27
  'pointer-events-none': !onClick
27
- }), onClick: onClick }, props, { children: [(0, jsx_runtime_1.jsx)("span", { className: (0, classnames_1.default)('w-6 h-6 rounded-full shrink-0', {
28
- 'bg-info-content': variant === 'info',
29
- 'bg-success-content': variant === 'success',
30
- 'bg-destructive-content': variant === 'error',
31
- 'bg-warn-content': variant === 'warn',
32
- }) }), (0, jsx_runtime_1.jsx)("span", { children: children })] })));
28
+ }), onClick: onClick }, props, { children: [(0, jsx_runtime_1.jsx)(StatusDot_1.StatusDot, { className: "shrink-0", variant: variant }), (0, jsx_runtime_1.jsx)("span", { children: children })] })));
33
29
  }
@@ -0,0 +1,8 @@
1
+ import { Status } from './Status';
2
+ export declare function StatusDot({ className, variant }: StatusDot.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace StatusDot {
4
+ type Props = {
5
+ className?: string;
6
+ variant: Status;
7
+ };
8
+ }
@@ -0,0 +1,19 @@
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.StatusDot = StatusDot;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ // component
10
+ function StatusDot({ className, variant }) {
11
+ // render
12
+ return ((0, jsx_runtime_1.jsx)("span", { className: (0, classnames_1.default)(className, 'w-6 h-6 select-none interpolate rounded-full', {
13
+ 'bg-ix-disabled': variant === 'default',
14
+ 'bg-info-content': variant === 'info',
15
+ 'bg-success-content': variant === 'success',
16
+ 'bg-destructive-content': variant === 'error',
17
+ 'bg-warn-content': variant === 'warn',
18
+ }) }));
19
+ }
@@ -6,6 +6,8 @@ export * from './ErrorMessage';
6
6
  export * from './Note';
7
7
  export * from './ProgressBar';
8
8
  export * from './SelectionDecorator';
9
+ export * from './Status';
9
10
  export * from './StatusBadge';
10
11
  export * from './StatusChip';
12
+ export * from './StatusDot';
11
13
  export * from './StatusIcon';
@@ -22,6 +22,8 @@ __exportStar(require("./ErrorMessage"), exports);
22
22
  __exportStar(require("./Note"), exports);
23
23
  __exportStar(require("./ProgressBar"), exports);
24
24
  __exportStar(require("./SelectionDecorator"), exports);
25
+ __exportStar(require("./Status"), exports);
25
26
  __exportStar(require("./StatusBadge"), exports);
26
27
  __exportStar(require("./StatusChip"), exports);
28
+ __exportStar(require("./StatusDot"), exports);
27
29
  __exportStar(require("./StatusIcon"), exports);
@@ -135,7 +135,10 @@ exports.CollectionPicker = (0, react_1.forwardRef)(function CollectionPicker({ l
135
135
  }
136
136
  })
137
137
  // or capture error
138
- .catch(e => setError(feedback_1.ErrorMessage.coerce(e)));
138
+ .catch(e => {
139
+ console.error('[CollectionPicker] error syncing', e);
140
+ setError(feedback_1.ErrorMessage.coerce(e));
141
+ });
139
142
  }, [language, collectionGroup]);
140
143
  // helpers
141
144
  const onPick = async (collectionRef) => {
@@ -219,7 +219,9 @@ function renderPicker({ site, language, disabledIds, error, pageFilters, pageFil
219
219
  // show static pages if selected
220
220
  else if (pageFilter === 'static') {
221
221
  return ((0, jsx_runtime_1.jsx)(transitions_1.FadeIn, { className: "flex flex-col gap-l3", children: pageFilters.static.map(page => {
222
- const ref = page.getClosestPageRef(language, site.defaultLanguage);
222
+ const locale = { region: site.region.id, language };
223
+ const defaultLocale = { region: site.region.id, language: site.defaultLanguage };
224
+ const ref = page.getClosestPageRef(locale, defaultLocale);
223
225
  return renderPageRef({ site, language, disabledIds, template: page.template, ref, onPick, setTagTooltip });
224
226
  }) }, "pages.static"));
225
227
  }
@@ -2,27 +2,27 @@ import { Callback, Transform } from '@nascentdigital/funnel-core';
2
2
  import { ReactNode } from 'react';
3
3
  import { FieldSize } from '../fields';
4
4
  import { Icon } from '../visuals';
5
- export declare function Combobox<TOptionId extends string>({ id: externalId, className, size, maxRows, rowHeight: rowHeightRaw, disabled, options, noSelectionText, selectedOption: selectedOptionId, onSelect, renderSelection: renderSelectionRaw, renderOption, }: Combobox.Props<TOptionId>): import("react/jsx-runtime").JSX.Element;
5
+ export declare function Combobox<TOptionId extends string, TContext = any>({ id: externalId, className, size, maxRows, rowHeight: rowHeightRaw, disabled, options, noSelectionText, selectedOption: selectedOptionId, onSelect, renderSelection: renderSelectionRaw, renderOption, }: Combobox.Props<TOptionId, TContext>): import("react/jsx-runtime").JSX.Element;
6
6
  export declare namespace Combobox {
7
- type Props<TOptionId extends string> = {
7
+ type Props<TOptionId extends string, TContext = any> = {
8
8
  id?: string;
9
9
  className?: string;
10
10
  size?: FieldSize;
11
11
  maxRows?: number;
12
12
  rowHeight?: number;
13
13
  disabled?: boolean;
14
- options: ReadonlyArray<Option<TOptionId>>;
14
+ options: ReadonlyArray<Option<TOptionId, TContext>>;
15
15
  noSelectionText?: string;
16
16
  selectedOption?: TOptionId | undefined;
17
17
  onSelect?: Callback<TOptionId>;
18
- renderSelection?: Transform<Option<TOptionId> | undefined, ReactNode>;
19
- renderOption?: Transform<RenderOptionArgs<TOptionId>, ReactNode>;
18
+ renderSelection?: Transform<Option<TOptionId, TContext> | undefined, ReactNode>;
19
+ renderOption?: Transform<RenderOptionArgs<TOptionId, TContext>, ReactNode>;
20
20
  };
21
- type RenderSelectionArgs<TOptionId extends string> = {
22
- option?: Option<TOptionId>;
21
+ type RenderSelectionArgs<TOptionId extends string, TContext> = {
22
+ option?: Option<TOptionId, TContext>;
23
23
  size: FieldSize;
24
24
  };
25
- type Option<TOptionId extends string = string> = Option.Standard<TOptionId> | Option.WithIcon<TOptionId>;
25
+ type Option<TOptionId extends string = string, TContext = undefined> = Option.Standard<TOptionId> | Option.WithIcon<TOptionId> | Option.WithContext<TOptionId, TContext>;
26
26
  namespace Option {
27
27
  type Standard<TOptionId extends string> = {
28
28
  id: TOptionId;
@@ -31,10 +31,14 @@ export declare namespace Combobox {
31
31
  type WithIcon<TOptionId extends string> = Standard<TOptionId> & {
32
32
  icon: Icon.Variant;
33
33
  };
34
+ type WithContext<TOptionId extends string, TContext> = Standard<TOptionId> & {
35
+ context: TContext;
36
+ };
34
37
  function hasIcon<TOptionId extends string>(option: Option<TOptionId>): option is WithIcon<TOptionId>;
38
+ function hasContext<TOptionId extends string, TContext>(option: Option<TOptionId>): option is WithContext<TOptionId, TContext>;
35
39
  }
36
- type RenderOptionArgs<TOptionId extends string = string> = {
37
- option: Option<TOptionId>;
40
+ type RenderOptionArgs<TOptionId extends string = string, TContext = any> = {
41
+ option: Option<TOptionId, TContext>;
38
42
  selected: boolean;
39
43
  size: FieldSize;
40
44
  };
@@ -96,6 +96,10 @@ function Combobox({ id: externalId, className, size = 'md', maxRows = 6, rowHeig
96
96
  return 'icon' in option;
97
97
  }
98
98
  Option.hasIcon = hasIcon;
99
+ function hasContext(option) {
100
+ return 'context' in option;
101
+ }
102
+ Option.hasContext = hasContext;
99
103
  })(Option = Combobox.Option || (Combobox.Option = {}));
100
104
  })(Combobox || (exports.Combobox = Combobox = {}));
101
105
  // helpers
@@ -1,7 +1,7 @@
1
1
  import { Callback, Placement, Rect } from '@nascentdigital/funnel-core';
2
2
  import { HTMLContainer } from '@nascentdigital/funnel-ui';
3
3
  import { CSSProperties, HTMLAttributes, ReactNode } from 'react';
4
- export declare function Popup({ className, style, anchor, anchorOffset, placement, animation, backdrop, disabled, disableDismiss, disableOverlay, open, onOpened: onOpenedRaw, onClose, onClosed: onClosedRaw, onKeyDown: onKeyDownRaw, children, ...props }: Popup.Props): import("react/jsx-runtime").JSX.Element | null;
4
+ export declare function Popup({ className, style, anchor, anchorOffset, placement, animation, backdrop, disabled, disableDismiss, disableOverlay, open, onOpened: onOpenedRaw, onClose, onClosed: onClosedRaw, onKeyDown: onKeyDownRaw, onClick, children, ...props }: Popup.Props): import("react/jsx-runtime").JSX.Element | null;
5
5
  export declare namespace Popup {
6
6
  type Anchor = string;
7
7
  type Animation = 'in' | 'out' | 'in-out';
@@ -26,7 +26,7 @@ const react_dom_1 = require("react-dom");
26
26
  const Animate_1 = require("./Animate");
27
27
  // component
28
28
  function Popup(_a) {
29
- var { className, style = {}, anchor, anchorOffset = 4, placement = 'bottom', animation = 'in-out', backdrop = 'none', disabled = false, disableDismiss = false, disableOverlay = false, open = false, onOpened: onOpenedRaw = funnel_core_1.Fn.NoOp, onClose = funnel_core_1.Fn.NoOp, onClosed: onClosedRaw = funnel_core_1.Fn.NoOp, onKeyDown: onKeyDownRaw, children } = _a, props = __rest(_a, ["className", "style", "anchor", "anchorOffset", "placement", "animation", "backdrop", "disabled", "disableDismiss", "disableOverlay", "open", "onOpened", "onClose", "onClosed", "onKeyDown", "children"]);
29
+ var { className, style = {}, anchor, anchorOffset = 4, placement = 'bottom', animation = 'in-out', backdrop = 'none', disabled = false, disableDismiss = false, disableOverlay = false, open = false, onOpened: onOpenedRaw = funnel_core_1.Fn.NoOp, onClose = funnel_core_1.Fn.NoOp, onClosed: onClosedRaw = funnel_core_1.Fn.NoOp, onKeyDown: onKeyDownRaw, onClick, children } = _a, props = __rest(_a, ["className", "style", "anchor", "anchorOffset", "placement", "animation", "backdrop", "disabled", "disableDismiss", "disableOverlay", "open", "onOpened", "onClose", "onClosed", "onKeyDown", "onClick", "children"]);
30
30
  // bind context
31
31
  const containerId = (0, react_1.useId)();
32
32
  const backdropId = (0, react_1.useId)();
@@ -80,38 +80,46 @@ function Popup(_a) {
80
80
  }
81
81
  };
82
82
  const onContainerClick = (e) => {
83
+ // stop bubbling
84
+ e.stopPropagation();
83
85
  // close only if the container is directly clicked
84
86
  const target = e.target;
85
- if ((target === null || target === void 0 ? void 0 : target.id) === containerId) {
86
- // stop bubbling
87
- e.stopPropagation();
87
+ if (!disableDismiss && (target === null || target === void 0 ? void 0 : target.id) === containerId) {
88
88
  // close
89
89
  onClose();
90
90
  }
91
91
  };
92
92
  const onBackdropClick = (e) => {
93
+ // stop bubbling
94
+ e.stopPropagation();
93
95
  // close only if the backdrop is directly clicked
94
96
  const target = e.target;
95
- if ((target === null || target === void 0 ? void 0 : target.id) === backdropId) {
96
- // stop bubbling
97
- e.stopPropagation();
97
+ if (!disableDismiss && (target === null || target === void 0 ? void 0 : target.id) === backdropId) {
98
98
  // close
99
99
  onClose();
100
100
  }
101
101
  };
102
+ const onGuardClick = (e) => {
103
+ // stop propagation
104
+ e.stopPropagation();
105
+ e.preventDefault();
106
+ if (onClick) {
107
+ onClick(e);
108
+ }
109
+ };
102
110
  // render
103
111
  const { popupContainerClassName, popupClassName, popupStyles } = getPopupClassNames({ anchor, anchorId, anchorOffset, placement });
104
112
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [anchor && typeof anchor !== 'string' &&
105
113
  (0, jsx_runtime_1.jsx)(Popup.AnchorElement, { tag: "div", anchorId: anchorId, children: anchor }), (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { mode: "wait", children: open &&
106
114
  (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, { id: containerId, className: (0, classnames_1.default)(popupContainerClassName, 'fixed inset-0 z-popup', {
107
115
  'pointer-events-none': disableOverlay
108
- }), variants: Animate_1.Animate.Variants.fade, initial: animation !== 'out' ? 'initial' : 'animate', animate: "animate", exit: animation !== 'in' ? 'exit' : 'animate', onAnimationComplete: definition => onAnimationComplete(definition), onClick: disableDismiss ? undefined : onContainerClick, children: [backdrop !== 'none' &&
116
+ }), variants: Animate_1.Animate.Variants.fade, initial: animation !== 'out' ? 'initial' : 'animate', animate: "animate", exit: animation !== 'in' ? 'exit' : 'animate', onAnimationComplete: definition => onAnimationComplete(definition), onClick: onContainerClick, children: [backdrop !== 'none' &&
109
117
  (0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { id: backdropId, className: (0, classnames_1.default)('fixed inset-0 z-backdrop', {
110
118
  'backdrop-blur-[9px] bg-glass/backdrop will-change-[backdrop-filter]': backdrop === 'glass',
111
119
  'pointer-events-auto': !disableDismiss
112
- }), onClick: disableDismiss ? undefined : onBackdropClick }, "backdrop"), (0, jsx_runtime_1.jsx)("div", Object.assign({}, props, { ref: contentRef, className: (0, classnames_1.default)(className, popupClassName, 'pointer-events-auto'), style: anchor
120
+ }), onClick: onBackdropClick }, "backdrop"), (0, jsx_runtime_1.jsx)("div", Object.assign({}, props, { ref: contentRef, className: (0, classnames_1.default)(className, popupClassName, 'pointer-events-auto'), style: anchor
113
121
  ? Popup.getAnchorStyle(anchorId, Object.assign({ margin: `${anchorOffset !== null && anchorOffset !== void 0 ? anchorOffset : 0}px` }, popupStyles))
114
- : popupStyles, onKeyDown: onKeyDown, children: children }))] }, containerId) }) }), document.body)] }));
122
+ : popupStyles, onClick: onGuardClick, onKeyDown: onKeyDown, children: children }))] }, containerId) }) }), document.body)] }));
115
123
  }
116
124
  // extension
117
125
  (function (Popup) {
@@ -9,13 +9,13 @@ const classnames_1 = __importDefault(require("classnames"));
9
9
  // component
10
10
  function Table({ className, title, actions, nested = false, children }) {
11
11
  // bind header
12
- const header = ((0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-center gap-l8", children: [title &&
13
- (0, jsx_runtime_1.jsx)("h3", { className: "heading-xs text-content-primary", children: title }), actions] }));
12
+ const header = ((0, jsx_runtime_1.jsxs)("div", { className: "nd-Table-header", children: [title &&
13
+ (0, jsx_runtime_1.jsx)("h3", { className: "nd-Table-title", children: title }), actions] }));
14
14
  // render
15
15
  if (nested) {
16
- return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(className, 'flex'), children: [(0, jsx_runtime_1.jsx)("div", { className: "w-48 flex justify-center items-stretch", children: (0, jsx_runtime_1.jsx)("span", { className: "block w-2 h-full bg-border-l1" }) }), (0, jsx_runtime_1.jsx)("ul", { className: (0, classnames_1.default)(className, 'flex-1 flex flex-col gap-l4'), children: children })] }));
16
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(className, 'nd-Table-nested'), children: [(0, jsx_runtime_1.jsx)("div", { className: "nd-Table-guideWrap", children: (0, jsx_runtime_1.jsx)("span", { className: "nd-Table-guide" }) }), (0, jsx_runtime_1.jsx)("ul", { className: (0, classnames_1.default)(className, 'nd-TableItems'), children: children })] }));
17
17
  }
18
18
  else {
19
- return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(className, 'flex flex-col gap-l6 p-l8 bg-transparent border border-solid border-border-l1 rounded-sm'), children: [header, (0, jsx_runtime_1.jsx)("ul", { className: (0, classnames_1.default)(className, 'flex-1 flex flex-col gap-l4'), children: children })] }));
19
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(className, 'nd-Table'), children: [header, (0, jsx_runtime_1.jsx)("ul", { className: (0, classnames_1.default)(className, 'nd-TableItems'), children: children })] }));
20
20
  }
21
21
  }
@@ -14,31 +14,21 @@ function TableItem({ className, anchorId, nested = false, details, iconLeft, ico
14
14
  // render
15
15
  const labelOnly = !details && !iconRight;
16
16
  const interactive = !!onClick;
17
- return ((0, jsx_runtime_1.jsxs)("li", { className: (0, classnames_1.default)(className, 'group interactive rounded-sm', 'flex items-center px-l5', {
18
- 'bg-surface1': !nested,
19
- 'bg-transparent': nested,
20
- 'interactive-disabled': !interactive && !disabled,
21
- 'bg-ix-disabled/tint1 pointer-events-none': disabled,
17
+ return ((0, jsx_runtime_1.jsxs)("li", { id: anchorId, className: (0, classnames_1.default)(className, 'nd-TableItem', {
18
+ 'nd-TableItem-nested': nested,
19
+ 'nd-TableItem-static': !interactive && !disabled,
20
+ 'nd-TableItem-disabled': disabled,
22
21
  [interaction_1.Popup.anchorClassName]: !!anchorId
23
- }), style: anchorId ? interaction_1.Popup.getAnchorStyle(anchorId) : undefined, tabIndex: 0, onClick: onClick, children: [(0, jsx_runtime_1.jsx)("div", { className: "interactive-tint" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 flex items-center", children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)('flex-1 flex items-center gap-l3 py-l5'), children: [visuals_1.Icon.Variant.filter(iconLeft)
22
+ }), style: anchorId ? interaction_1.Popup.getAnchorStyle(anchorId) : undefined, tabIndex: 0, onClick: onClick, children: [(0, jsx_runtime_1.jsx)("div", { className: "nd-TableItem-tint" }), (0, jsx_runtime_1.jsxs)("div", { className: "nd-TableItem-contentWrap", children: [(0, jsx_runtime_1.jsxs)("div", { className: "nd-TableItem-content", children: [visuals_1.Icon.Variant.filter(iconLeft)
24
23
  ?
25
- (0, jsx_runtime_1.jsx)(visuals_1.Icon, { className: (0, classnames_1.default)({
26
- 'text-content-secondary': !disabled,
27
- 'text-ix-disabled-content': disabled
28
- }), variant: iconLeft })
24
+ (0, jsx_runtime_1.jsx)(visuals_1.Icon, { className: "nd-TableItem-icon", variant: iconLeft })
29
25
  : iconLeft, typeof children === 'string'
30
26
  ?
31
- (0, jsx_runtime_1.jsx)("h3", { className: (0, classnames_1.default)('label-sm ellipsis', {
32
- 'text-content-primary': !disabled,
33
- 'text-ix-disabled-content': disabled
34
- }), children: children })
27
+ (0, jsx_runtime_1.jsx)("h3", { className: "nd-TableItem-label", children: children })
35
28
  : children] }), !labelOnly &&
36
- (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-end items-center gap-l3", children: [renderDetails(details), visuals_1.Icon.Variant.filter(iconRight)
29
+ (0, jsx_runtime_1.jsxs)("div", { className: "nd-TableItem-details", children: [renderDetails(details), visuals_1.Icon.Variant.filter(iconRight)
37
30
  ?
38
- (0, jsx_runtime_1.jsx)(visuals_1.Icon, { className: (0, classnames_1.default)({
39
- 'text-content-primary': !disabled,
40
- 'text-ix-disabled-content': disabled
41
- }), variant: iconRight })
31
+ (0, jsx_runtime_1.jsx)(visuals_1.Icon, { className: "nd-TableItem-icon", variant: iconRight })
42
32
  : iconRight] })] })] }));
43
33
  }
44
34
  // helpers
@@ -49,7 +39,7 @@ function renderDetails(details) {
49
39
  }
50
40
  // render text if a string is provided
51
41
  else if (funnel_core_1.Value.typeOf(details) === 'string') {
52
- return ((0, jsx_runtime_1.jsx)("p", { className: "body-sm text-content-secondary", children: details }));
42
+ return ((0, jsx_runtime_1.jsx)("p", { children: details }));
53
43
  }
54
44
  // or render details inline
55
45
  else {
@@ -514,6 +514,7 @@ class BlockConfiguration {
514
514
  this.sync();
515
515
  }
516
516
  setConfigValues(config) {
517
+ console.trace('[BlockConfiguration] setting config', config);
517
518
  Object.entries(config).forEach(([fieldId, value]) => {
518
519
  const field = this.getEditableField(fieldId);
519
520
  if (field) {
@@ -1,4 +1,4 @@
1
- import { Language, Schema } from '@nascentdigital/funnel-core';
1
+ import { Language, Locale, Schema } from '@nascentdigital/funnel-core';
2
2
  import { IPage } from './IPage';
3
3
  export type PageOverview = StaticPageOverview | DynamicPageOverview;
4
4
  export declare abstract class PageOverviewBase {
@@ -14,18 +14,18 @@ export declare namespace PageOverviewBase {
14
14
  };
15
15
  }
16
16
  export declare class StaticPageOverview extends PageOverviewBase {
17
- readonly refs: Readonly<Record<Language, Schema.Page.Data.AsLink>>;
18
- readonly languages: ReadonlyArray<Language>;
17
+ readonly refs: ReadonlyArray<Schema.Page.Data.AsLink>;
18
+ readonly locales: ReadonlyArray<Locale>;
19
19
  constructor({ refs, ...args }: StaticPageOverview.ConstructorArgs);
20
20
  get pages(): Schema.Page.Data.AsLink<Schema.Page<any, any>, string>[];
21
21
  get isEmpty(): boolean;
22
- hasLanguage(language: Language): boolean;
22
+ hasLocale(match: Locale): boolean;
23
23
  findPage({ region, language }: StaticPageOverview.FindPageArgs): Schema.Page.Data.AsLink | undefined;
24
- getClosestPageRef(language: Language, fallback?: Language): IPage.Ref | undefined;
24
+ getClosestPageRef(locale: Locale, fallback?: Locale): IPage.Ref | undefined;
25
25
  }
26
26
  export declare namespace StaticPageOverview {
27
27
  type ConstructorArgs = Omit<PageOverviewBase.ConstructorArgs, 'variant'> & {
28
- refs: Record<Language, Schema.Page.Data.AsLink>;
28
+ refs: ReadonlyArray<Schema.Page.Data.AsLink>;
29
29
  };
30
30
  type FindPageArgs = {
31
31
  region: string;
@@ -30,16 +30,16 @@ class StaticPageOverview extends PageOverviewBase {
30
30
  super(args);
31
31
  // initialize instance variables
32
32
  this.refs = refs;
33
- this.languages = Object.keys(refs).map(funnel_core_1.Language.parse);
33
+ this.locales = refs.map(({ region, language }) => ({ region, language }));
34
34
  }
35
35
  get pages() {
36
36
  return Object.values(this.refs);
37
37
  }
38
38
  get isEmpty() {
39
- return this.languages.length === 0;
39
+ return this.locales.length === 0;
40
40
  }
41
- hasLanguage(language) {
42
- return this.languages.includes(language);
41
+ hasLocale(match) {
42
+ return this.locales.some(locale => funnel_core_1.Locale.isEqual(locale, match));
43
43
  }
44
44
  findPage({ region, language }) {
45
45
  var _a;
@@ -55,11 +55,11 @@ class StaticPageOverview extends PageOverviewBase {
55
55
  return (_a = pages.find(page => page.language === defaultLanguage)) !== null && _a !== void 0 ? _a : pages[0];
56
56
  }
57
57
  }
58
- getClosestPageRef(language, fallback) {
58
+ getClosestPageRef(locale, fallback) {
59
59
  var _a, _b;
60
- const { template, languages, refs } = this;
61
- const [firstLanguage] = languages;
62
- const ref = (_b = (_a = refs[language]) !== null && _a !== void 0 ? _a : (fallback && refs[fallback])) !== null && _b !== void 0 ? _b : (firstLanguage && refs[firstLanguage]);
60
+ const { template, locales, refs } = this;
61
+ const [firstLocale] = locales;
62
+ const ref = (_b = (_a = refs.find(ref => ref.region === locale.region && ref.language === locale.language)) !== null && _a !== void 0 ? _a : (fallback && refs.find(ref => ref.region === fallback.region && ref.language === fallback.language))) !== null && _b !== void 0 ? _b : (firstLocale && refs.find(ref => ref.region === firstLocale.region && ref.language === firstLocale.language));
63
63
  return ref && Object.assign(Object.assign({}, ref), { template, tags: template.tags.flatMap(tagGroup => tagGroup.parse(ref.tags)) });
64
64
  }
65
65
  }
@@ -25,7 +25,7 @@ export declare namespace PageSummary {
25
25
  slug?: string;
26
26
  pages: PageSummary.PageRef[];
27
27
  };
28
- type PageRef = Schema.Page.Data.AsGroup.Instance & Pick<Schema.Page.Data.AsLink, 'state' | 'errors' | 'createdOn' | 'updatedOn' | 'publishedOn'>;
28
+ type PageRef = Schema.Page.Data.AsGroup.Instance & Pick<Schema.Page.Data.AsLink, 'brand' | 'groupId' | 'state' | 'errors' | 'createdOn' | 'updatedOn' | 'publishedOn'>;
29
29
  type GetClosestPageRefArgs = {
30
30
  region: string;
31
31
  language: Language;
@@ -83,7 +83,9 @@ class Pages {
83
83
  }
84
84
  // add page to args
85
85
  args.pages.push({
86
+ brand: page.brand,
86
87
  id: page.id,
88
+ groupId: page.groupId,
87
89
  region: page.region,
88
90
  language: page.language,
89
91
  slug: page.slug,
@@ -26,7 +26,7 @@ var PageSerializer;
26
26
  // deserialize summary
27
27
  const { brand, groupId, instances } = groupData;
28
28
  const summary = new domain_1.PageSummary(Object.assign(Object.assign({}, target), { brand,
29
- groupId, pages: instances }));
29
+ groupId, pages: instances.map(instance => (Object.assign({ brand, groupId }, instance))) }));
30
30
  // return result
31
31
  return { summary, page };
32
32
  }
@@ -21,7 +21,9 @@ function SiteExplorer({ region }) {
21
21
  // helpers
22
22
  const onPageClicked = async (overview) => {
23
23
  if (overview instanceof core_1.StaticPageOverview) {
24
- const language = site.getClosestLanguage(overview.languages);
24
+ const language = site.getClosestLanguage(overview.locales
25
+ .filter(locale => locale.region === site.region.id)
26
+ .map(locale => locale.language));
25
27
  await router.navigateToPage({ page: overview.type, region, language });
26
28
  }
27
29
  else {
@@ -61,12 +61,23 @@ function PageHeader({ className, target, onBack }) {
61
61
  });
62
62
  };
63
63
  const onDuplicate = async (source, targetLanguage) => {
64
+ // skip if there's no page
65
+ const page = groupItems.find(page => page.id === source);
66
+ if (!page) {
67
+ console.warn('[PageHeader/onDuplicate] cannot find page in group', { groupItems, source });
68
+ return;
69
+ }
70
+ // or skip if we don't have a slug
64
71
  // duplicate page
65
72
  await editorApi.duplicatePage({
66
- source: source,
67
- targetLanguage,
68
- targetPage: 'current',
69
- targetSlug: target.slug
73
+ source: {
74
+ groupId: page.groupId,
75
+ region: page.region,
76
+ language: page.language
77
+ },
78
+ operation: 'extend',
79
+ region: target.region,
80
+ language: targetLanguage
70
81
  });
71
82
  };
72
83
  // render
@@ -501,10 +501,10 @@ video {
501
501
  }
502
502
 
503
503
  [popover]{
504
- inset: var(--toolwind-toggle-wrtbt8ZKY2, 0px);
505
- background-color: var(--toolwind-toggle-x97g0FbT5G, canvas);
506
- color: var(--toolwind-toggle-PleWOGPwR6, canvastext);
507
- margin: var(--toolwind-toggle-SZfCM678rP, auto);
504
+ inset: var(--toolwind-toggle-0uMnUczbDF, 0px);
505
+ background-color: var(--toolwind-toggle-XNg4I8q96j, canvas);
506
+ color: var(--toolwind-toggle-HhduZveBN2, canvastext);
507
+ margin: var(--toolwind-toggle-d2DVrTGX4f, auto);
508
508
  }
509
509
  html, body, #__next, #root, .Editor-wrap{
510
510
  position: relative;
@@ -3243,6 +3243,19 @@ video {
3243
3243
  .interactive.interactive-selected > .interactive-tint{
3244
3244
  background-color: rgb(var(--color-ix-primary) / .05);
3245
3245
  }
3246
+ /* child */
3247
+ .\!interactive .interactive-child{
3248
+ pointer-events: auto;
3249
+ }
3250
+ .interactive .interactive-child{
3251
+ pointer-events: auto;
3252
+ }
3253
+ .\!interactive:has(.interactive-child:hover, .interactive-child:focus-within, .interactive-child:active){
3254
+ pointer-events: none;
3255
+ }
3256
+ .interactive:has(.interactive-child:hover, .interactive-child:focus-within, .interactive-child:active){
3257
+ pointer-events: none;
3258
+ }
3246
3259
  .nd-Loader{
3247
3260
  stroke: currentColor;
3248
3261
  }
@@ -3705,6 +3718,205 @@ video {
3705
3718
  --tw-text-opacity: 1;
3706
3719
  color: rgb(var(--color-destructive-content) / var(--tw-text-opacity, 1));
3707
3720
  }
3721
+ /* top-level table */
3722
+ .nd-Table{
3723
+ display: flex;
3724
+ flex-direction: column;
3725
+ gap: 16px;
3726
+ padding: 24px;
3727
+ border-radius: 8px;
3728
+ border-width: 1px;
3729
+ border-style: solid;
3730
+ --tw-border-opacity: 1;
3731
+ border-color: rgb(var(--color-border-l1) / var(--tw-border-opacity, 1));
3732
+ background-color: transparent;
3733
+ }
3734
+ /* header */
3735
+ .nd-Table-header{
3736
+ display: flex;
3737
+ align-items: center;
3738
+ justify-content: space-between;
3739
+ gap: 24px;
3740
+ }
3741
+ .nd-Table-title{
3742
+ font-family: var(--font-primary), sans-serif;
3743
+ font-size: 14px;
3744
+ font-weight: 600;
3745
+ line-height: 1.4;
3746
+ --tw-text-opacity: 1;
3747
+ color: rgb(var(--color-content-primary) / var(--tw-text-opacity, 1));
3748
+ }
3749
+ /* nested tables */
3750
+ .nd-Table-nested{
3751
+ display: flex;
3752
+ }
3753
+ .nd-Table-guideWrap{
3754
+ display: flex;
3755
+ width: 48px;
3756
+ align-items: stretch;
3757
+ justify-content: center;
3758
+ }
3759
+ .nd-Table-guide{
3760
+ display: block;
3761
+ height: 100%;
3762
+ width: 2px;
3763
+ --tw-bg-opacity: 1;
3764
+ background-color: rgb(var(--color-border-l1) / var(--tw-bg-opacity, 1));
3765
+ }
3766
+ /* items */
3767
+ .nd-TableItems{
3768
+ display: flex;
3769
+ flex: 1 1 0%;
3770
+ flex-direction: column;
3771
+ gap: 8px;
3772
+ }
3773
+ .nd-TableItem{
3774
+ cursor: pointer;
3775
+ -webkit-user-select: none;
3776
+ -moz-user-select: none;
3777
+ user-select: none;
3778
+ -webkit-appearance: none;
3779
+ -moz-appearance: none;
3780
+ appearance: none;
3781
+ transition-duration: 500ms;
3782
+ transition-timing-function: cubic-bezier(0.5, 1, 0.89, 1);
3783
+ transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, backdrop-filter, display, content-visibility, overlay, pointer-events;
3784
+ display: grid;
3785
+ grid-template-columns: repeat(1, minmax(0, 1fr));
3786
+ grid-template-rows: max-content;
3787
+ }
3788
+ .nd-TableItem > * {
3789
+ grid-area: 1 / 1 / 1 / 1;
3790
+ }
3791
+ .nd-TableItem{
3792
+ outline-style: solid;
3793
+ outline-width: 1px;
3794
+ outline-color: rgb(var(--color-border-l1) / 1);
3795
+ --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
3796
+ --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
3797
+ box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
3798
+ --tw-ring-color: transparent;
3799
+ }
3800
+ .nd-TableItem:not(:has(.interactive-child:hover)):not(.interactive-selected):hover{
3801
+ outline-color: rgb(var(--color-ix-primary) / 1);
3802
+ }
3803
+ .nd-TableItem:not(:has(.interactive-child:hover)):not(.interactive-selected):active{
3804
+ --tw-scale-x: .99;
3805
+ --tw-scale-y: .99;
3806
+ transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
3807
+ outline-color: rgb(var(--color-border-l1) / 1);
3808
+ transition-duration: 200ms;
3809
+ }
3810
+ .nd-TableItem:not(:has(.interactive-child:hover)):not(.interactive-selected):focus-visible{
3811
+ outline-color: rgb(var(--color-ix-primary) / 1);
3812
+ --tw-ring-opacity: 1;
3813
+ --tw-ring-color: rgb(var(--color-ix-primary) / var(--tw-ring-opacity, 1));
3814
+ }
3815
+ .nd-TableItem.interactive-selected{
3816
+ cursor: default;
3817
+ outline-color: rgb(var(--color-border-l2) / 1);
3818
+ --tw-ring-opacity: 1;
3819
+ --tw-ring-color: rgb(var(--color-border-l2) / var(--tw-ring-opacity, 1));
3820
+ }
3821
+ .nd-TableItem.interactive-selected > .interactive-tint{
3822
+ background-color: rgb(var(--color-ix-primary) / .05);
3823
+ }
3824
+ .nd-TableItem .interactive-child{
3825
+ pointer-events: auto;
3826
+ }
3827
+ .nd-TableItem:has(.interactive-child:hover, .interactive-child:focus-within, .interactive-child:active){
3828
+ pointer-events: none;
3829
+ }
3830
+ .nd-TableItem{
3831
+ display: flex;
3832
+ align-items: center;
3833
+ border-radius: 8px;
3834
+ padding-left: 12px;
3835
+ padding-right: 12px;
3836
+ }
3837
+ /* background */
3838
+ .nd-TableItem.nd-TableItem-nested{
3839
+ background-color: transparent;
3840
+ }
3841
+ .nd-TableItem:not(.nd-TableItem-nested){
3842
+ --tw-bg-opacity: 1;
3843
+ background-color: rgb(var(--color-surface1) / var(--tw-bg-opacity, 1));
3844
+ }
3845
+ /* icon */
3846
+ .nd-TableItem .nd-TableItem-icon{
3847
+ --tw-text-opacity: 1;
3848
+ color: rgb(var(--color-content-secondary) / var(--tw-text-opacity, 1));
3849
+ }
3850
+ /* label */
3851
+ .nd-TableItem .nd-TableItem-label{
3852
+ font-family: var(--font-primary), sans-serif;
3853
+ }
3854
+ .nd-TableItem .nd-TableItem-label.label-strong{
3855
+ font-weight: 600;
3856
+ }
3857
+ .nd-TableItem .nd-TableItem-label{
3858
+ font-size: 13px;
3859
+ font-weight: 400;
3860
+ line-height: 1.4;
3861
+ --tw-text-opacity: 1;
3862
+ color: rgb(var(--color-content-primary) / var(--tw-text-opacity, 1));
3863
+ min-width: 0px;
3864
+ max-width: 100%;
3865
+ overflow: hidden;
3866
+ text-overflow: ellipsis;
3867
+ text-wrap: nowrap;
3868
+ }
3869
+ /* non-interactive */
3870
+ .nd-TableItem.nd-TableItem-static {
3871
+ }
3872
+ /* disabled */
3873
+ .nd-TableItem.nd-TableItem-disabled{
3874
+ pointer-events: none;
3875
+ background-color: rgb(var(--color-ix-disabled) / .1);
3876
+ }
3877
+ /* icon */
3878
+ .nd-TableItem.nd-TableItem-disabled .nd-TableItem-icon{
3879
+ --tw-text-opacity: 1;
3880
+ color: rgb(var(--color-ix-disabled-content) / var(--tw-text-opacity, 1));
3881
+ }
3882
+ /* label */
3883
+ .nd-TableItem.nd-TableItem-disabled .nd-TableItem-label{
3884
+ --tw-text-opacity: 1;
3885
+ color: rgb(var(--color-ix-disabled-content) / var(--tw-text-opacity, 1));
3886
+ }
3887
+ .interactive.interactive-selected > .nd-TableItem-tint{
3888
+ background-color: rgb(var(--color-ix-primary) / .05);
3889
+ }
3890
+ .nd-TableItem-contentWrap{
3891
+ display: flex;
3892
+ flex: 1 1 0%;
3893
+ align-items: center;
3894
+ }
3895
+ .nd-TableItem-content{
3896
+ display: flex;
3897
+ flex: 1 1 0%;
3898
+ align-items: center;
3899
+ gap: 6px;
3900
+ padding-top: 12px;
3901
+ padding-bottom: 12px;
3902
+ }
3903
+ .nd-TableItem-details{
3904
+ display: flex;
3905
+ align-items: center;
3906
+ justify-content: flex-end;
3907
+ gap: 6px;
3908
+ font-family: var(--font-primary), sans-serif;
3909
+ }
3910
+ .nd-TableItem-details.body-strong{
3911
+ font-weight: 600;
3912
+ }
3913
+ .nd-TableItem-details{
3914
+ font-size: 13px;
3915
+ font-weight: 400;
3916
+ line-height: 1.4;
3917
+ --tw-text-opacity: 1;
3918
+ color: rgb(var(--color-content-secondary) / var(--tw-text-opacity, 1));
3919
+ }
3708
3920
  /* base*/
3709
3921
  .nd-Tabs{
3710
3922
  display: grid;
@@ -4882,9 +5094,6 @@ img.nd-Visual-image {
4882
5094
  .w-44{
4883
5095
  width: 44px;
4884
5096
  }
4885
- .w-48{
4886
- width: 48px;
4887
- }
4888
5097
  .w-58{
4889
5098
  width: 58px;
4890
5099
  }
@@ -5430,9 +5639,6 @@ img.nd-Visual-image {
5430
5639
  --tw-bg-opacity: 1;
5431
5640
  background-color: rgb(var(--color-ix-disabled) / var(--tw-bg-opacity, 1));
5432
5641
  }
5433
- .bg-ix-disabled\/tint1{
5434
- background-color: rgb(var(--color-ix-disabled) / .1);
5435
- }
5436
5642
  .bg-ix-primary{
5437
5643
  --tw-bg-opacity: 1;
5438
5644
  background-color: rgb(var(--color-ix-primary) / var(--tw-bg-opacity, 1));
@@ -5663,10 +5869,6 @@ img.nd-Visual-image {
5663
5869
  padding-top: 8px;
5664
5870
  padding-bottom: 8px;
5665
5871
  }
5666
- .py-l5{
5667
- padding-top: 12px;
5668
- padding-bottom: 12px;
5669
- }
5670
5872
  .py-l6{
5671
5873
  padding-top: 16px;
5672
5874
  padding-bottom: 16px;
@@ -6012,10 +6214,10 @@ img.nd-Visual-image {
6012
6214
  .anchored\/\[--nd-popup-anchor\]:where(.anchored\/\[--nd-popup-anchor\]){
6013
6215
  position: absolute;
6014
6216
  view-transition-name: --tw-anchor-view-transition-2j1919322s193433343934192p322r2w33362l;
6015
- --toolwind-toggle-wrtbt8ZKY2: auto;
6016
- --toolwind-toggle-x97g0FbT5G: transparent;
6017
- --toolwind-toggle-PleWOGPwR6: inherit;
6018
- --toolwind-toggle-SZfCM678rP: 0px;
6217
+ --toolwind-toggle-0uMnUczbDF: auto;
6218
+ --toolwind-toggle-XNg4I8q96j: transparent;
6219
+ --toolwind-toggle-HhduZveBN2: inherit;
6220
+ --toolwind-toggle-d2DVrTGX4f: 0px;
6019
6221
  }
6020
6222
  .counter-l1{
6021
6223
  counter-reset: l1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nascentdigital/funnel-editor",
3
- "version": "6.1.5",
3
+ "version": "6.1.6",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -92,5 +92,5 @@
92
92
  "ts-jest": "^29",
93
93
  "type-fest": "^4"
94
94
  },
95
- "gitHead": "567edc7796b910ef548506fd659f267b80187c29"
95
+ "gitHead": "63e7e3fa90a0d490576311a388e8a0d99bd4b5e4"
96
96
  }