@nascentdigital/funnel-editor 4.5.6 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/collection/hooks/CollectionController.d.ts +1 -1
- package/dist/core/components/ColorModeToggle.js +6 -4
- package/dist/core/components/Header.js +3 -2
- package/dist/core/components/UserEditor.d.ts +2 -2
- package/dist/core/components/feedback/Badge.d.ts +2 -1
- package/dist/core/components/feedback/Badge.js +4 -3
- package/dist/core/components/fields/DynamicPagesEditor.js +7 -6
- package/dist/core/components/fields/EmptyFieldCard.js +4 -4
- package/dist/core/components/fields/FieldCardLayout.js +5 -5
- package/dist/core/components/fields/FieldHeader.js +3 -2
- package/dist/core/components/fields/FieldsPanel.js +4 -4
- package/dist/core/components/fields/FormEditor.js +5 -4
- package/dist/core/components/fields/asset/AssetEditor.d.ts +3 -2
- package/dist/core/components/fields/asset/AssetEditor.js +1 -1
- package/dist/core/components/fields/asset/AssetUploader.d.ts +3 -2
- package/dist/core/components/fields/asset/AssetUploader.js +1 -1
- package/dist/core/components/fields/collection/CollectionCard.js +1 -11
- package/dist/core/components/fields/collection/CollectionPicker.js +3 -2
- package/dist/core/components/fields/collection/previews/index.d.ts +0 -1
- package/dist/core/components/fields/collection/previews/index.js +0 -1
- package/dist/core/components/fields/embed/EmbeddedVideoEditor.d.ts +2 -2
- package/dist/core/components/fields/factories/AssetFactory.d.ts +1 -1
- package/dist/core/components/fields/factories/CollectionFactory.d.ts +1 -1
- package/dist/core/components/fields/factories/EmbeddedVideoFactory.d.ts +2 -2
- package/dist/core/components/fields/factories/FieldValueFactory.d.ts +1 -1
- package/dist/core/components/fields/factories/FieldValueFactory.js +1 -1
- package/dist/core/components/fields/factories/LinkFactory.d.ts +2 -2
- package/dist/core/components/fields/factories/TextFactory.d.ts +2 -2
- package/dist/core/components/fields/form/FormFieldEditor.d.ts +3 -2
- package/dist/core/components/fields/index.d.ts +1 -0
- package/dist/core/components/fields/index.js +1 -0
- package/dist/core/components/fields/link/LinkEditor.d.ts +2 -2
- package/dist/core/components/fields/link/LinkEditor.js +4 -0
- package/dist/core/components/fields/list/CreateFieldButton.d.ts +1 -1
- package/dist/core/components/fields/list/CreateFieldButton.js +4 -5
- package/dist/core/components/fields/list/CreateFieldCard.js +4 -4
- package/dist/core/components/fields/page/PagePicker.js +4 -2
- package/dist/core/components/fields/richtext/FloatingToolbarPlugin.js +3 -2
- package/dist/core/components/fields/richtext/LinkEditor.js +17 -4
- package/dist/core/components/fields/richtext/LinkPopup.js +11 -7
- package/dist/core/components/interaction/AvatarButton.d.ts +2 -1
- package/dist/core/components/interaction/AvatarButton.js +3 -2
- package/dist/core/components/interaction/Button.d.ts +2 -0
- package/dist/core/components/interaction/Button.js +3 -2
- package/dist/core/components/interaction/Combobox.js +2 -2
- package/dist/core/components/interaction/IconButton.d.ts +2 -0
- package/dist/core/components/interaction/IconButton.js +3 -2
- package/dist/core/components/interaction/IconLink.d.ts +1 -1
- package/dist/core/components/interaction/MiniEditor.d.ts +3 -2
- package/dist/core/components/interaction/MiniEditor.js +7 -5
- package/dist/core/components/interaction/Popup.d.ts +20 -15
- package/dist/core/components/interaction/Popup.js +63 -66
- package/dist/core/components/interaction/QuickInput.js +2 -0
- package/dist/core/components/interaction/QuickPicker.d.ts +1 -0
- package/dist/core/components/interaction/QuickPicker.js +5 -5
- package/dist/core/components/interaction/Tabs.d.ts +5 -1
- package/dist/core/components/interaction/Tabs.js +18 -8
- package/dist/core/components/interaction/menu/useMenuController.d.ts +2 -2
- package/dist/core/components/interaction/table/TableItem.d.ts +2 -1
- package/dist/core/components/interaction/table/TableItem.js +5 -3
- package/dist/core/components/layout/InfoPanel.js +4 -2
- package/dist/core/components/visuals/Icon.d.ts +1 -1
- package/dist/core/components/visuals/Icon.js +6 -0
- package/dist/core/components/visuals/index.d.ts +0 -1
- package/dist/core/components/visuals/index.js +0 -1
- package/dist/core/domain/Block.d.ts +4 -0
- package/dist/core/domain/Block.js +7 -0
- package/dist/core/domain/BlockConfiguration.d.ts +11 -3
- package/dist/core/domain/BlockConfiguration.js +77 -14
- package/dist/core/domain/CollectionBrowser.d.ts +2 -2
- package/dist/core/domain/CollectionFieldProxy.d.ts +7 -2
- package/dist/core/domain/CollectionFieldProxy.js +55 -66
- package/dist/core/domain/SectionBlock.d.ts +5 -0
- package/dist/core/domain/SectionBlock.js +15 -0
- package/dist/core/hooks/useBlockConfiguration.d.ts +7 -1
- package/dist/core/hooks/useBlockConfiguration.js +8 -1
- package/dist/core/hooks/usePage.d.ts +2 -2
- package/dist/core/hooks/usePage.js +5 -4
- package/dist/core/repository/CollectionRepository.js +1 -1
- package/dist/core/repository/CollectionSerializer.d.ts +3 -2
- package/dist/core/repository/CollectionSerializer.js +12 -7
- package/dist/core/repository/PageRepository.js +2 -2
- package/dist/core/repository/PageSerializer.d.ts +5 -3
- package/dist/core/repository/PageSerializer.js +10 -11
- package/dist/explore/components/CreateCollectionDialog.d.ts +2 -3
- package/dist/explore/components/CreateCollectionDialog.js +1 -1
- package/dist/explore/components/CreatePageDialog.d.ts +3 -3
- package/dist/explore/components/CreatePageDialog.js +2 -2
- package/dist/explore/screens/CollectionExplorer.js +4 -4
- package/dist/explore/screens/PageExplorer.js +4 -4
- package/dist/page/components/BlockEditor.js +10 -2
- package/dist/page/components/config/BlockConfigButton.d.ts +8 -0
- package/dist/page/components/config/BlockConfigButton.js +320 -0
- package/dist/page/components/config/BlockConfigurationProvider.d.ts +8 -0
- package/dist/page/components/config/BlockConfigurationProvider.js +17 -0
- package/dist/page/components/config/LegacyBlockPreview.d.ts +8 -0
- package/dist/page/components/config/{BlockPreview.js → LegacyBlockPreview.js} +30 -40
- package/dist/page/components/config/index.d.ts +3 -1
- package/dist/page/components/config/index.js +3 -1
- package/dist/page/components/index.d.ts +1 -1
- package/dist/page/components/index.js +1 -1
- package/dist/page/components/nav/NavSection.js +4 -3
- package/dist/page/components/panels/BlockConfigPanel.d.ts +1 -0
- package/dist/page/components/panels/BlockConfigPanel.js +25 -0
- package/dist/page/components/{PageStatus.d.ts → panels/PageStatus.d.ts} +3 -3
- package/dist/page/components/{PageStatus.js → panels/PageStatus.js} +10 -14
- package/dist/page/components/panels/index.d.ts +2 -0
- package/dist/page/components/{status → panels}/index.js +2 -1
- package/dist/page/hooks/PageController.d.ts +2 -2
- package/dist/page/screens/PageEditor.js +8 -1
- package/dist/styles/index.css +174 -56
- package/dist/styles/tailwind.js +7 -3
- package/dist/users/screens/UserExplorer.js +7 -6
- package/package.json +3 -2
- package/dist/core/components/fields/collection/previews/ClientPreview.d.ts +0 -10
- package/dist/core/components/fields/collection/previews/ClientPreview.js +0 -29
- package/dist/core/components/visuals/SkeletonLayout.d.ts +0 -9
- package/dist/core/components/visuals/SkeletonLayout.js +0 -429
- package/dist/page/components/config/BlockConfig.d.ts +0 -8
- package/dist/page/components/config/BlockConfig.js +0 -28
- package/dist/page/components/config/BlockConfigEditor.d.ts +0 -9
- package/dist/page/components/config/BlockConfigEditor.js +0 -114
- package/dist/page/components/config/BlockPreview.d.ts +0 -10
- package/dist/page/components/config/BlockView.d.ts +0 -4
- package/dist/page/components/config/BlockView.js +0 -9
- package/dist/page/components/config/LegacyBlockConfigEditor.d.ts +0 -9
- package/dist/page/components/config/LegacyBlockConfigEditor.js +0 -27
- package/dist/page/components/config/ListPanelEditor.d.ts +0 -8
- package/dist/page/components/config/ListPanelEditor.js +0 -89
- package/dist/page/components/config/MessagePanelEditor.d.ts +0 -8
- package/dist/page/components/config/MessagePanelEditor.js +0 -17
- package/dist/page/components/config/VisualPanelEditor.d.ts +0 -8
- package/dist/page/components/config/VisualPanelEditor.js +0 -76
- package/dist/page/components/status/index.d.ts +0 -1
- /package/dist/page/components/{status → panels}/AutoSave.d.ts +0 -0
- /package/dist/page/components/{status → panels}/AutoSave.js +0 -0
|
@@ -15,7 +15,7 @@ export declare class CollectionController {
|
|
|
15
15
|
private set state(value);
|
|
16
16
|
get ready(): boolean;
|
|
17
17
|
get target(): CollectionTarget;
|
|
18
|
-
get languages(): ("
|
|
18
|
+
get languages(): ("cy" | "fr" | "fy" | "to" | "br" | "hr" | "li" | "th" | "tr" | "id" | "is" | "tw" | "no" | "aa" | "ab" | "ae" | "af" | "ak" | "am" | "an" | "ar" | "as" | "av" | "ay" | "az" | "ba" | "be" | "bg" | "bh" | "bi" | "bm" | "bn" | "bo" | "bs" | "ca" | "ce" | "ch" | "co" | "cr" | "cs" | "cu" | "cv" | "da" | "de" | "dv" | "dz" | "ee" | "el" | "en" | "eo" | "es" | "et" | "eu" | "fa" | "ff" | "fi" | "fj" | "fo" | "ga" | "gd" | "gl" | "gn" | "gu" | "gv" | "ha" | "he" | "hi" | "ho" | "ht" | "hu" | "hy" | "hz" | "ia" | "ie" | "ig" | "ii" | "ik" | "io" | "it" | "iu" | "ja" | "jv" | "ka" | "kg" | "ki" | "kj" | "kk" | "kl" | "km" | "kn" | "ko" | "kr" | "ks" | "ku" | "kv" | "kw" | "ky" | "la" | "lb" | "lg" | "ln" | "lo" | "lt" | "lu" | "lv" | "mg" | "mh" | "mi" | "mk" | "ml" | "mn" | "mr" | "ms" | "mt" | "my" | "na" | "nb" | "nd" | "ne" | "ng" | "nl" | "nn" | "nr" | "nv" | "ny" | "oc" | "oj" | "om" | "or" | "os" | "pa" | "pi" | "pl" | "ps" | "pt" | "qu" | "rm" | "rn" | "ro" | "ru" | "rw" | "sa" | "sc" | "sd" | "se" | "sg" | "si" | "sk" | "sl" | "sm" | "sn" | "so" | "sq" | "sr" | "ss" | "st" | "su" | "sv" | "sw" | "ta" | "te" | "tg" | "ti" | "tk" | "tl" | "tn" | "ts" | "tt" | "ty" | "ug" | "uk" | "ur" | "uz" | "ve" | "vi" | "vo" | "wa" | "wo" | "xh" | "yi" | "yo" | "za" | "zh" | "zu")[];
|
|
19
19
|
get collectionGroup(): CollectionGroup | undefined;
|
|
20
20
|
private set collectionGroup(value);
|
|
21
21
|
get collection(): Collection | undefined;
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ColorModeToggle = ColorModeToggle;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
5
6
|
const settings_1 = require("../settings");
|
|
6
7
|
const interaction_1 = require("./interaction");
|
|
7
8
|
// component
|
|
8
|
-
function ColorModeToggle({ className, popupPlacement = '
|
|
9
|
+
function ColorModeToggle({ className, popupPlacement = 'bottom' }) {
|
|
9
10
|
// bind color mode
|
|
11
|
+
const id = (0, react_1.useId)();
|
|
10
12
|
const settings = (0, settings_1.useSettings)();
|
|
11
13
|
const { colorMode } = settings;
|
|
12
14
|
const icon = colorMode === 'light'
|
|
@@ -16,11 +18,11 @@ function ColorModeToggle({ className, popupPlacement = 'top' }) {
|
|
|
16
18
|
: 'MonitorCog';
|
|
17
19
|
const menu = (0, interaction_1.useMenuController)(colorOptions);
|
|
18
20
|
// helpers
|
|
19
|
-
const onOpenMenu = (
|
|
21
|
+
const onOpenMenu = () => {
|
|
20
22
|
// set selected item to current color
|
|
21
23
|
menu.selectedItem = settings.colorMode;
|
|
22
24
|
// open menu
|
|
23
|
-
menu.open(
|
|
25
|
+
menu.open(id);
|
|
24
26
|
};
|
|
25
27
|
const onColorModeSelect = (colorMode) => {
|
|
26
28
|
// set mode
|
|
@@ -30,7 +32,7 @@ function ColorModeToggle({ className, popupPlacement = 'top' }) {
|
|
|
30
32
|
menu.close();
|
|
31
33
|
};
|
|
32
34
|
// render
|
|
33
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(interaction_1.IconButton, { className: className, variant: "util", icon: icon, onClick: e => onOpenMenu(
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(interaction_1.IconButton, { anchorId: id, className: className, variant: "util", icon: icon, onClick: e => onOpenMenu() }), (0, jsx_runtime_1.jsx)(interaction_1.Menu, { controller: menu, placement: popupPlacement, onItemClick: onColorModeSelect })] }));
|
|
34
36
|
}
|
|
35
37
|
// helpers
|
|
36
38
|
const colorOptions = [
|
|
@@ -23,6 +23,7 @@ function Header({ className, title, breadcrumbs: breadcrumbsRaw, highlightBreadc
|
|
|
23
23
|
const brand = funnel_core_1.AppConfig.brandConfig();
|
|
24
24
|
const breadcrumbs = breadcrumbsRaw !== null && breadcrumbsRaw !== void 0 ? breadcrumbsRaw : [];
|
|
25
25
|
const breadcrumbsEndIndex = breadcrumbs.length - 1;
|
|
26
|
+
const anchorId = (0, react_2.useId)();
|
|
26
27
|
const authenticator = (0, auth_1.useAuthenticator)();
|
|
27
28
|
const menu = (0, interaction_1.useMenuController)(menuOptions);
|
|
28
29
|
const userEditorRef = (0, react_2.useRef)(null);
|
|
@@ -30,7 +31,7 @@ function Header({ className, title, breadcrumbs: breadcrumbsRaw, highlightBreadc
|
|
|
30
31
|
// helpers
|
|
31
32
|
const onMenuOpen = (e) => {
|
|
32
33
|
menu.selectedItem = undefined;
|
|
33
|
-
menu.open(
|
|
34
|
+
menu.open(anchorId);
|
|
34
35
|
};
|
|
35
36
|
const onMenuClick = (id) => {
|
|
36
37
|
var _a, _b;
|
|
@@ -60,7 +61,7 @@ function Header({ className, title, breadcrumbs: breadcrumbsRaw, highlightBreadc
|
|
|
60
61
|
(0, jsx_runtime_1.jsx)("span", { children: breadcrumb })
|
|
61
62
|
:
|
|
62
63
|
(0, jsx_runtime_1.jsx)(link_1.default, { href: breadcrumb.url, children: breadcrumb.label }) })] }, index)) }), (0, jsx_runtime_1.jsxs)("div", { className: "h-full flex items-center gap-l6", children: [!hideControls && children, (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: !hideControls &&
|
|
63
|
-
(0, jsx_runtime_1.jsxs)(transitions_1.FadeIn, { className: "h-full flex items-center gap-l6", children: [(0, jsx_runtime_1.jsx)(interaction_1.AvatarButton, { user: user, onClick: onMenuOpen }), (0, jsx_runtime_1.jsx)(interaction_1.Menu, { label: user.email, title: user.username, placement: "bottom", controller: menu, onItemClick: onMenuClick }), (0, jsx_runtime_1.jsx)(ColorModeToggle_1.ColorModeToggle, {})] }) })] })] }), (0, jsx_runtime_1.jsx)(UserEditor_1.UserEditor, { ref: userEditorRef })] }));
|
|
64
|
+
(0, jsx_runtime_1.jsxs)(transitions_1.FadeIn, { className: "h-full flex items-center gap-l6", children: [(0, jsx_runtime_1.jsx)(interaction_1.AvatarButton, { anchorId: anchorId, user: user, onClick: onMenuOpen }), (0, jsx_runtime_1.jsx)(interaction_1.Menu, { label: user.email, title: user.username, placement: "bottom", controller: menu, onItemClick: onMenuClick }), (0, jsx_runtime_1.jsx)(ColorModeToggle_1.ColorModeToggle, {})] }) })] })] }), (0, jsx_runtime_1.jsx)(UserEditor_1.UserEditor, { ref: userEditorRef })] }));
|
|
64
65
|
}
|
|
65
66
|
const menuOptions = [
|
|
66
67
|
{ id: 'profile', label: 'Edit Profile' },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { User } from '@nascentdigital/funnel-cms';
|
|
2
|
-
import {
|
|
2
|
+
import { Popup } from './interaction';
|
|
3
3
|
export declare const UserEditor: import("react").ForwardRefExoticComponent<import("react").RefAttributes<UserEditor.Ref>>;
|
|
4
4
|
export declare namespace UserEditor {
|
|
5
5
|
type Props = {};
|
|
@@ -9,6 +9,6 @@ export declare namespace UserEditor {
|
|
|
9
9
|
}
|
|
10
10
|
type EditOptions = {
|
|
11
11
|
user?: User;
|
|
12
|
-
anchor?:
|
|
12
|
+
anchor?: Popup.Anchor;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
import { Icon } from '../visuals';
|
|
3
|
-
export declare function Badge({ className, variant, status, icon, label, onClick, ...props }: Badge.Props): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function Badge({ anchorId, className, style, variant, status, icon, label, onClick, ...props }: Badge.Props): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export declare namespace Badge {
|
|
5
5
|
type Props = HTMLAttributes<HTMLSpanElement> & {
|
|
6
|
+
anchorId?: string;
|
|
6
7
|
variant?: Variant;
|
|
7
8
|
status?: Status;
|
|
8
9
|
icon?: Icon.Variant;
|
|
@@ -17,10 +17,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.Badge = Badge;
|
|
18
18
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
const classnames_1 = __importDefault(require("classnames"));
|
|
20
|
+
const Popup_1 = require("../interaction/Popup");
|
|
20
21
|
const visuals_1 = require("../visuals");
|
|
21
22
|
// component
|
|
22
23
|
function Badge(_a) {
|
|
23
|
-
var { className, variant = 'default', status = 'info', icon, label, onClick } = _a, props = __rest(_a, ["className", "variant", "status", "icon", "label", "onClick"]);
|
|
24
|
+
var { anchorId, className, style, variant = 'default', status = 'info', icon, label, onClick } = _a, props = __rest(_a, ["anchorId", "className", "style", "variant", "status", "icon", "label", "onClick"]);
|
|
24
25
|
// fail if trying to render icon when badge is small
|
|
25
26
|
const hasIcon = !!icon;
|
|
26
27
|
if (hasIcon && variant === 'tiny') {
|
|
@@ -31,7 +32,7 @@ function Badge(_a) {
|
|
|
31
32
|
const outlined = variant === 'outlined' || variant === 'outlinedTiny';
|
|
32
33
|
const dotted = variant === 'dotted' || variant === 'dottedTiny';
|
|
33
34
|
const tiny = variant === 'tiny' || variant === 'outlinedTiny' || variant === 'dottedTiny';
|
|
34
|
-
return ((0, jsx_runtime_1.jsxs)("span", Object.assign({ className: (0, classnames_1.default)(className, 'inline-flex items-center whitespace-nowrap', getStatusClassName(status), {
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)("span", Object.assign({ className: (0, classnames_1.default)(className, 'inline-flex items-center whitespace-nowrap', anchorId ? Popup_1.Popup.anchorClassName : undefined, getStatusClassName(status), {
|
|
35
36
|
'h-20 label-xs label-strong leading-[20px] px-l3 rounded-full': tiny,
|
|
36
37
|
'h-25 label-sm label-strong leading-[25px] rounded-full': !tiny,
|
|
37
38
|
'pl-l4 pr-l5 gap-l2': hasIcon,
|
|
@@ -41,7 +42,7 @@ function Badge(_a) {
|
|
|
41
42
|
'border-2': (outlined || dotted) && !tiny,
|
|
42
43
|
'border': (outlined || dotted) && tiny,
|
|
43
44
|
'cursor-pointer': onClick
|
|
44
|
-
}), tabIndex: onClick ? 0 : undefined, onClick: onClick }, props, { children: [icon &&
|
|
45
|
+
}), style: anchorId ? Popup_1.Popup.getAnchorStyle(anchorId, style) : style, tabIndex: onClick ? 0 : undefined, onClick: onClick }, props, { children: [icon &&
|
|
45
46
|
(0, jsx_runtime_1.jsx)(visuals_1.Icon, { variant: icon, size: "md" }), label] })));
|
|
46
47
|
}
|
|
47
48
|
// helpers
|
|
@@ -77,7 +77,8 @@ function DynamicPagesEditor({ className, dynamicPages }) {
|
|
|
77
77
|
// set initial value
|
|
78
78
|
dynamicPages.value = funnel_core_1.Schema.DynamicPagesField.Value.toData({
|
|
79
79
|
types: schema.types === 'all' ? undefined : schema.types,
|
|
80
|
-
sort: 'latest'
|
|
80
|
+
sort: 'latest',
|
|
81
|
+
schema: schema.meta
|
|
81
82
|
});
|
|
82
83
|
}, [dynamicPages, schema]);
|
|
83
84
|
// helpers
|
|
@@ -103,7 +104,7 @@ function DynamicPagesEditor({ className, dynamicPages }) {
|
|
|
103
104
|
}));
|
|
104
105
|
// update field value
|
|
105
106
|
const { value } = (_b = dynamicPages.value) !== null && _b !== void 0 ? _b : {};
|
|
106
|
-
dynamicPages.value = funnel_core_1.Schema.DynamicPagesField.Value.toData(Object.assign(Object.assign({}, value), { staticPages: [...(_c = value === null || value === void 0 ? void 0 : value.staticPages) !== null && _c !== void 0 ? _c : [], newPageItem] }));
|
|
107
|
+
dynamicPages.value = funnel_core_1.Schema.DynamicPagesField.Value.toData(Object.assign(Object.assign({}, value), { staticPages: [...(_c = value === null || value === void 0 ? void 0 : value.staticPages) !== null && _c !== void 0 ? _c : [], newPageItem], schema: schema.meta }));
|
|
107
108
|
};
|
|
108
109
|
const onPagePriorityChange = async () => {
|
|
109
110
|
var _a, _b;
|
|
@@ -116,7 +117,7 @@ function DynamicPagesEditor({ className, dynamicPages }) {
|
|
|
116
117
|
}
|
|
117
118
|
// update field value
|
|
118
119
|
const { value } = (_b = dynamicPages.value) !== null && _b !== void 0 ? _b : {};
|
|
119
|
-
dynamicPages.value = funnel_core_1.Schema.DynamicPagesField.Value.toData(Object.assign(Object.assign({}, value), { sort: result.length > 0 ? result : 'latest' }));
|
|
120
|
+
dynamicPages.value = funnel_core_1.Schema.DynamicPagesField.Value.toData(Object.assign(Object.assign({}, value), { sort: result.length > 0 ? result : 'latest', schema: schema.meta }));
|
|
120
121
|
};
|
|
121
122
|
const onPageReorder = ({ items, fromIndex, toIndex }) => {
|
|
122
123
|
var _a;
|
|
@@ -137,7 +138,7 @@ function DynamicPagesEditor({ className, dynamicPages }) {
|
|
|
137
138
|
setReorderedOn(Date.now());
|
|
138
139
|
// update field value
|
|
139
140
|
const { value } = (_a = dynamicPages.value) !== null && _a !== void 0 ? _a : {};
|
|
140
|
-
dynamicPages.value = funnel_core_1.Schema.DynamicPagesField.Value.toData(Object.assign(Object.assign({}, value), { staticPages: updatedItems }));
|
|
141
|
+
dynamicPages.value = funnel_core_1.Schema.DynamicPagesField.Value.toData(Object.assign(Object.assign({}, value), { staticPages: updatedItems, schema: schema.meta }));
|
|
141
142
|
};
|
|
142
143
|
const onSelectPageCard = (id) => {
|
|
143
144
|
// add/remove page id
|
|
@@ -172,7 +173,7 @@ function DynamicPagesEditor({ className, dynamicPages }) {
|
|
|
172
173
|
const staticPages = (_c = value === null || value === void 0 ? void 0 : value.staticPages) !== null && _c !== void 0 ? _c : [];
|
|
173
174
|
const replaceIndex = staticPages.findIndex(page => page.value.id === id);
|
|
174
175
|
const updatedStaticPages = staticPages.with(replaceIndex, newPageItem);
|
|
175
|
-
dynamicPages.value = funnel_core_1.Schema.DynamicPagesField.Value.toData(Object.assign(Object.assign({}, value), { staticPages: updatedStaticPages }));
|
|
176
|
+
dynamicPages.value = funnel_core_1.Schema.DynamicPagesField.Value.toData(Object.assign(Object.assign({}, value), { staticPages: updatedStaticPages, schema: schema.meta }));
|
|
176
177
|
};
|
|
177
178
|
const onDeleteSelected = async () => {
|
|
178
179
|
var _a, _b;
|
|
@@ -193,7 +194,7 @@ function DynamicPagesEditor({ className, dynamicPages }) {
|
|
|
193
194
|
// delete items
|
|
194
195
|
const { value } = (_a = dynamicPages.value) !== null && _a !== void 0 ? _a : {};
|
|
195
196
|
const updatedStaticPages = (_b = value === null || value === void 0 ? void 0 : value.staticPages) === null || _b === void 0 ? void 0 : _b.filter(page => !multiSelect.selectedIds.includes(page.value.id));
|
|
196
|
-
dynamicPages.value = funnel_core_1.Schema.DynamicPagesField.Value.toData(Object.assign(Object.assign({}, value), { staticPages: updatedStaticPages }));
|
|
197
|
+
dynamicPages.value = funnel_core_1.Schema.DynamicPagesField.Value.toData(Object.assign(Object.assign({}, value), { staticPages: updatedStaticPages, schema: schema.meta }));
|
|
197
198
|
// reset/close dialog
|
|
198
199
|
multiSelect.setSelectedIds([]);
|
|
199
200
|
multiSelect.setSelecting(false);
|
|
@@ -9,15 +9,15 @@ const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
|
9
9
|
const client_1 = require("@nascentdigital/funnel-ui/client");
|
|
10
10
|
const classnames_1 = __importDefault(require("classnames"));
|
|
11
11
|
const react_1 = require("react");
|
|
12
|
+
const interaction_1 = require("../interaction");
|
|
12
13
|
const visuals_1 = require("../visuals");
|
|
13
14
|
const factories_1 = require("./factories");
|
|
14
15
|
// component
|
|
15
16
|
function EmptyFieldCard({ className, schema, field, onClick, onCreated = funnel_core_1.Fn.NoOp, onEditing = funnel_core_1.Fn.NoOp }) {
|
|
16
17
|
// bind props + state
|
|
18
|
+
const id = (0, react_1.useId)();
|
|
17
19
|
const { name } = schema;
|
|
18
20
|
const [creating, setCreating] = (0, react_1.useState)(false);
|
|
19
|
-
const rootElementRef = (0, react_1.useRef)(null);
|
|
20
|
-
const rootElement = rootElementRef.current;
|
|
21
21
|
const onCreatedRef = (0, react_1.useRef)(onCreated);
|
|
22
22
|
onCreatedRef.current = onCreated;
|
|
23
23
|
// helpers
|
|
@@ -47,6 +47,6 @@ function EmptyFieldCard({ className, schema, field, onClick, onCreated = funnel_
|
|
|
47
47
|
onCreatedRef.current(data);
|
|
48
48
|
};
|
|
49
49
|
// render
|
|
50
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("section",
|
|
51
|
-
(0, jsx_runtime_1.jsx)(factories_1.FieldValueFactory, { anchor:
|
|
50
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(interaction_1.Popup.AnchorElement, { tag: "section", anchorId: id, className: (0, classnames_1.default)(className, 'h-full outline outline-1 outline-transparent overflow-hidden cursor-pointer interpolate', 'bg-surface1 border border-dashed border-border-l1 rounded-md', 'hover:bg-ix-primary-hover/tint0 hover:border-ix-primary hover:border-solid', 'focus-visible:bg-ix-primary-hover/tint0 focus-visible:border-ix-primary focus-visible:border-solid focus-visible:outline-ix-primary', 'active:scale-[.97] active:interpolate-fast'), onClick: onCreateStart, onKeyDown: client_1.OnKey.enter(onCreateStart), tabIndex: 0, children: (0, jsx_runtime_1.jsx)("div", { className: "h-full flex flex-col justify-center items-center pointer-events-none interpolate", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center gap-l5 p-l5", children: [(0, jsx_runtime_1.jsx)("div", { className: "p-l5 text-ix-secondary bg-ix-primary rounded-full", children: (0, jsx_runtime_1.jsx)(visuals_1.Icon, { variant: "Plus", size: "sm" }) }), (0, jsx_runtime_1.jsxs)("span", { className: "block label-md text-content-primary text-center", children: ["Select ", name] })] }) }) }), !onClick && creating &&
|
|
51
|
+
(0, jsx_runtime_1.jsx)(factories_1.FieldValueFactory, { anchor: id, itemSchema: schema, field: field, onCommit: onCreateComplete, onCancel: onCreateCancel })] }));
|
|
52
52
|
}
|
|
@@ -10,6 +10,7 @@ const client_1 = require("@nascentdigital/funnel-ui/client");
|
|
|
10
10
|
const classnames_1 = __importDefault(require("classnames"));
|
|
11
11
|
const react_1 = require("react");
|
|
12
12
|
const hooks_1 = require("../../hooks");
|
|
13
|
+
const index_1 = require("../../index");
|
|
13
14
|
const factories_1 = require("./factories");
|
|
14
15
|
const FieldHeader_1 = require("./FieldHeader");
|
|
15
16
|
// component
|
|
@@ -19,8 +20,7 @@ function FieldCardLayout({ className, tip, field, empty, deletable = false, embe
|
|
|
19
20
|
const [hovering, setHovering] = (0, react_1.useState)(false);
|
|
20
21
|
const [focused, setFocused] = (0, react_1.useState)(false);
|
|
21
22
|
const [editing, setEditing] = (0, react_1.useState)(false);
|
|
22
|
-
const
|
|
23
|
-
const rootElement = rootElementRef.current;
|
|
23
|
+
const id = (0, react_1.useId)();
|
|
24
24
|
const active = hovering || focused;
|
|
25
25
|
const onActiveChangedRef = (0, react_1.useRef)(onActiveChanged);
|
|
26
26
|
onActiveChangedRef.current = onActiveChanged;
|
|
@@ -56,9 +56,9 @@ function FieldCardLayout({ className, tip, field, empty, deletable = false, embe
|
|
|
56
56
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(className, 'relative w-[212px] flex flex-col'), onPointerEnter: () => setHovering(true), onPointerLeave: () => setHovering(false), children: [!embedded &&
|
|
57
57
|
(0, jsx_runtime_1.jsx)(FieldHeader_1.FieldHeader, { className: "w-full", label: schema.name, tip: tip !== null && tip !== void 0 ? tip : schema.description, active: active, onDelete: deletable
|
|
58
58
|
? () => onDelete(field)
|
|
59
|
-
: undefined }), (0, jsx_runtime_1.jsx)("div",
|
|
59
|
+
: undefined }), (0, jsx_runtime_1.jsx)(index_1.Popup.AnchorElement, { tag: "div", anchorId: id, className: (0, classnames_1.default)('FieldCard h-[170px]', {
|
|
60
60
|
'pointer-events-none': selecting,
|
|
61
61
|
'FieldCard-empty': empty !== null && empty !== void 0 ? empty : !field.hasValue
|
|
62
|
-
}), onClick: selecting ? undefined : onEdit, onKeyDown: selecting ? undefined : client_1.OnKey.enter(onEdit), tabIndex: selecting ? -1 : 0, onFocus: () => setFocused(true), onBlur: () => setFocused(false), children: children })] }), editing &&
|
|
63
|
-
(0, jsx_runtime_1.jsx)(factories_1.FieldValueFactory, { itemSchema: schema, field: field, anchor:
|
|
62
|
+
}), onClick: selecting ? undefined : onEdit, onKeyDown: selecting ? undefined : client_1.OnKey.enter(onEdit), tabIndex: selecting ? -1 : 0, onFocus: () => setFocused(true), onBlur: () => setFocused(false), children: children })] }), editing &&
|
|
63
|
+
(0, jsx_runtime_1.jsx)(factories_1.FieldValueFactory, { itemSchema: schema, field: field, anchor: id, onCommit: onEdited, onCancel: onCancel })] }));
|
|
64
64
|
}
|
|
@@ -17,6 +17,7 @@ function FieldHeader({ className, size = 'md', fieldId, label, tip, embedded = f
|
|
|
17
17
|
const [tipAnchor, setTipAnchor] = (0, react_1.useState)();
|
|
18
18
|
const [focused, setFocused] = (0, react_1.useState)(false);
|
|
19
19
|
const [active, setActive] = (0, react_1.useState)(fieldActive || focused);
|
|
20
|
+
const id = (0, react_1.useId)();
|
|
20
21
|
const activeRef = (0, react_1.useRef)(active);
|
|
21
22
|
activeRef.current = active;
|
|
22
23
|
// update active (with delay if deactivating)
|
|
@@ -58,10 +59,10 @@ function FieldHeader({ className, size = 'md', fieldId, label, tip, embedded = f
|
|
|
58
59
|
}), children: [fieldId && !embedded
|
|
59
60
|
? (0, jsx_runtime_1.jsx)("label", { className: labelClassName, htmlFor: fieldId, children: label })
|
|
60
61
|
: (0, jsx_runtime_1.jsx)("span", { className: labelClassName, children: embedded ? '' : label }), tip && !embedded &&
|
|
61
|
-
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("
|
|
62
|
+
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(interaction_1.Popup.AnchorElement, { tag: "div", anchorId: id, className: (0, classnames_1.default)({
|
|
62
63
|
'opacity-none pointer-events-none interpolate-fast': !active,
|
|
63
64
|
'opacity-full pointer-events-auto interpolate': active
|
|
64
|
-
}), onPointerEnter: e => setTipAnchor(
|
|
65
|
+
}), onPointerEnter: e => setTipAnchor(id), onPointerLeave: () => setTipAnchor(undefined), children: (0, jsx_runtime_1.jsx)(visuals_1.Icon, { variant: "Info", size: size === 'md' ? 'sm' : 'xs' }) }), (0, jsx_runtime_1.jsx)(interaction_1.Popup, { className: (0, classnames_1.default)('max-w-[200px] bg-surface2 pointer-events-none', 'border border-solid border-border-l1 rounded-sm shadow-tooltip', {
|
|
65
66
|
'px-l5 py-l4': size === 'md',
|
|
66
67
|
'px-l4 py-l3': size !== 'md'
|
|
67
68
|
}), open: !!tipAnchor, anchor: tipAnchor, anchorOffset: 4, placement: "top", disableOverlay: true, onClose: () => setTipAnchor(undefined), children: (0, jsx_runtime_1.jsx)(funnel_ui_1.Markup, { className: (0, classnames_1.default)('block text-content-primary text-pretty', {
|
|
@@ -14,15 +14,15 @@ function FieldsPanel({ className, title, actions, fields, autoFocus = false }) {
|
|
|
14
14
|
const fieldGroups = groupFields(fields);
|
|
15
15
|
// create header
|
|
16
16
|
const header = (title || actions) && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [title &&
|
|
17
|
-
(0, jsx_runtime_1.jsx)("
|
|
17
|
+
(0, jsx_runtime_1.jsx)("h3", { className: "heading-md flex-1", children: title }), actions &&
|
|
18
18
|
(0, jsx_runtime_1.jsx)("div", { className: "shrink-0 flex items-center gap-l5", children: actions })] }));
|
|
19
|
-
//
|
|
20
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(className, '
|
|
19
|
+
// render panel
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(className, 'flex flex-col gap-l9 p-l9 shrink-0', 'bg-surface1 rounded-xxl'), children: [header, (0, jsx_runtime_1.jsx)("section", { className: (0, classnames_1.default)('@container flex flex-col gap-l8'), children: fieldGroups.map(({ type, id, fields }, groupIndex) => {
|
|
21
21
|
switch (type) {
|
|
22
22
|
case 'opt-in':
|
|
23
23
|
return ((0, jsx_runtime_1.jsx)("section", { className: (0, classnames_1.default)('', 'flex flex-wrap items-center gap-l8'), children: fields.map(field => (0, jsx_runtime_1.jsx)(OptInField_1.OptInField, { field: field }, field.id)) }, id));
|
|
24
24
|
case 'input':
|
|
25
|
-
return ((0, jsx_runtime_1.jsx)("section", { className: "flex flex-wrap items-center gap-l6", children: fields.map((field, fieldIndex) => (0, jsx_runtime_1.jsx)("div", { className: "w-full @fieldPanel2:w-[440px] flex justify-start", children: (0, jsx_runtime_1.jsx)(FieldEditor_1.FieldEditor, { className: "max-w-full", field: field, autoFocus: autoFocus && groupIndex === 0 && fieldIndex === 0 }) }, field.id)) }, id));
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)("section", { className: "flex flex-wrap items-center gap-l6", children: fields.map((field, fieldIndex) => (0, jsx_runtime_1.jsx)("div", { className: "w-full @fieldPanel2:w-[440px] flex justify-start", children: (0, jsx_runtime_1.jsx)(FieldEditor_1.FieldEditor, { className: "w-full max-w-full", field: field, autoFocus: autoFocus && groupIndex === 0 && fieldIndex === 0 }) }, field.id)) }, id));
|
|
26
26
|
case 'card':
|
|
27
27
|
return ((0, jsx_runtime_1.jsx)("section", { className: "flex flex-wrap items-center gap-l6", children: fields.map((field, fieldIndex) => (0, jsx_runtime_1.jsx)(FieldEditor_1.FieldEditor, { field: field }, field.id)) }, id));
|
|
28
28
|
case 'editor-sm':
|
|
@@ -16,6 +16,7 @@ const form_1 = require("./form");
|
|
|
16
16
|
function FormEditor({ className, form }) {
|
|
17
17
|
// bind props + memos
|
|
18
18
|
const [reorderedOn, setReorderedOn] = (0, react_1.useState)(0);
|
|
19
|
+
const id = (0, react_1.useId)();
|
|
19
20
|
const { schema } = form;
|
|
20
21
|
const formSchema = (0, react_1.useMemo)(() => funnel_core_1.Forms.current().configs[schema.formId], [schema]);
|
|
21
22
|
const { description } = schema;
|
|
@@ -25,7 +26,7 @@ function FormEditor({ className, form }) {
|
|
|
25
26
|
// sync field
|
|
26
27
|
(0, hooks_1.useField)(form);
|
|
27
28
|
// helpers
|
|
28
|
-
const onEditField = async (e, item) => {
|
|
29
|
+
const onEditField = async (e, item, anchorId) => {
|
|
29
30
|
var _a;
|
|
30
31
|
// skip if updating
|
|
31
32
|
if (updating) {
|
|
@@ -42,7 +43,7 @@ function FormEditor({ className, form }) {
|
|
|
42
43
|
form,
|
|
43
44
|
schema: item.schema,
|
|
44
45
|
initialValue,
|
|
45
|
-
anchor:
|
|
46
|
+
anchor: anchorId
|
|
46
47
|
});
|
|
47
48
|
if (!updatedValue || funnel_core_1.Value.equals(updatedValue, initialValue)) {
|
|
48
49
|
return;
|
|
@@ -98,8 +99,8 @@ function FormEditor({ className, form }) {
|
|
|
98
99
|
};
|
|
99
100
|
// render
|
|
100
101
|
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(className, 'flex flex-col overflow-hidden', 'border border-solid border-border-l1 rounded-lg'), children: [(0, jsx_runtime_1.jsx)("header", { className: "flex items-center gap-l4 p-l5 label-md bg-surface2", children: (0, jsx_runtime_1.jsx)("span", { className: "text-content-primary", children: schema.name }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l6 py-l6", children: [description &&
|
|
101
|
-
(0, jsx_runtime_1.jsx)(feedback_1.Note, { className: "mx-l6", variant: "tip", children: description }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-[10px]", children: [(0, jsx_runtime_1.jsx)("h4", { className: "label-sm label-strong text-content-secondary mx-l6", children: "Form Fields" }), (0, jsx_runtime_1.jsx)(interaction_1.Sortable, { className: "grid grid-cols-1 grid-rows-[1fr] gap-[10px] mx-l6", items: editableFields, renderItem: item => (0, jsx_runtime_1.jsx)(form_1.FormFieldItem, { id: item.id, form: form, formSchema: formSchema, schema: item.schema, value: item.initialValue, onClick: e => onEditField(e, item), disabled: updating }, item.id), onChange: onFieldReorder, enableItemClick: true, disabled: updating }), (0, jsx_runtime_1.jsx)("hr", { className: "divider my-l4 bg-border-l1" }), consentFields.length > 0 &&
|
|
102
|
-
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h4", { className: "label-sm label-strong text-content-secondary mx-l6", children: "Consent Fields" }), (0, jsx_runtime_1.jsx)(interaction_1.Sortable, { className: "grid grid-cols-1 grid-rows-[1fr] gap-[10px] mx-l6", items: consentFields, renderItem: item => (0, jsx_runtime_1.jsx)(form_1.FormFieldItem, { id: item.id, form: form, formSchema: formSchema, schema: item.schema, value: item.initialValue, onClick: e => onEditField(e, item), disabled: updating }, item.id), onChange: onFieldReorder, enableItemClick: true, disabled: updating })] })] })] }), (0, jsx_runtime_1.jsx)(form_1.FormFieldEditor, { ref: editorRef })] }));
|
|
102
|
+
(0, jsx_runtime_1.jsx)(feedback_1.Note, { className: "mx-l6", variant: "tip", children: description }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-[10px]", children: [(0, jsx_runtime_1.jsx)("h4", { className: "label-sm label-strong text-content-secondary mx-l6", children: "Form Fields" }), (0, jsx_runtime_1.jsx)(interaction_1.Sortable, { className: "grid grid-cols-1 grid-rows-[1fr] gap-[10px] mx-l6", items: editableFields, renderItem: item => (0, jsx_runtime_1.jsx)(interaction_1.Popup.AnchorElement, { tag: "div", id: item.id, anchorId: `formItem-anchor-${item.id}`, children: (0, jsx_runtime_1.jsx)(form_1.FormFieldItem, { id: item.id, form: form, formSchema: formSchema, schema: item.schema, value: item.initialValue, onClick: e => onEditField(e, item, `formItem-anchor-${item.id}`), disabled: updating }) }, item.id), onChange: onFieldReorder, enableItemClick: true, disabled: updating }), (0, jsx_runtime_1.jsx)("hr", { className: "divider my-l4 bg-border-l1" }), consentFields.length > 0 &&
|
|
103
|
+
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h4", { className: "label-sm label-strong text-content-secondary mx-l6", children: "Consent Fields" }), (0, jsx_runtime_1.jsx)(interaction_1.Sortable, { className: "grid grid-cols-1 grid-rows-[1fr] gap-[10px] mx-l6", items: consentFields, renderItem: item => (0, jsx_runtime_1.jsx)(interaction_1.Popup.AnchorElement, { tag: "div", id: item.id, anchorId: `formConsent-anchor-${item.id}`, children: (0, jsx_runtime_1.jsx)(form_1.FormFieldItem, { id: item.id, form: form, formSchema: formSchema, schema: item.schema, value: item.initialValue, onClick: e => onEditField(e, item, `formConsent-anchor-${item.id}`), disabled: updating }) }, item.id), onChange: onFieldReorder, enableItemClick: true, disabled: updating })] })] })] }), (0, jsx_runtime_1.jsx)(form_1.FormFieldEditor, { ref: editorRef })] }));
|
|
103
104
|
}
|
|
104
105
|
function createItems({ form, formSchema }) {
|
|
105
106
|
var _a, _b;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Schema } from '@nascentdigital/funnel-core';
|
|
2
|
+
import { Popup } from '../../interaction';
|
|
2
3
|
export declare const AssetEditor: import("react").ForwardRefExoticComponent<import("react").RefAttributes<AssetEditor.Ref>>;
|
|
3
4
|
export declare namespace AssetEditor {
|
|
4
5
|
type Props = {};
|
|
@@ -8,6 +9,6 @@ export declare namespace AssetEditor {
|
|
|
8
9
|
type Options = {
|
|
9
10
|
schema: Schema.AssetField;
|
|
10
11
|
asset: Schema.AssetField.LinkedValue;
|
|
11
|
-
anchor:
|
|
12
|
+
anchor: Popup.Anchor;
|
|
12
13
|
};
|
|
13
14
|
}
|
|
@@ -132,7 +132,7 @@ exports.AssetEditor = (0, react_2.forwardRef)(function AssetEditor(_, ref) {
|
|
|
132
132
|
deferral.resolve(result !== null && result !== void 0 ? result : undefined);
|
|
133
133
|
};
|
|
134
134
|
// skip if we don't have any params
|
|
135
|
-
if (!deferral || !schema) {
|
|
135
|
+
if (!deferral || !schema || !anchor) {
|
|
136
136
|
return null;
|
|
137
137
|
}
|
|
138
138
|
// render
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Schema } from '@nascentdigital/funnel-core';
|
|
2
|
+
import { Popup } from '../../interaction';
|
|
2
3
|
export declare const AssetUploader: import("react").ForwardRefExoticComponent<import("react").RefAttributes<AssetUploader.Ref>>;
|
|
3
4
|
export declare namespace AssetUploader {
|
|
4
5
|
type Props = {};
|
|
@@ -7,7 +8,7 @@ export declare namespace AssetUploader {
|
|
|
7
8
|
}
|
|
8
9
|
type Options = {
|
|
9
10
|
schema: Schema.AssetField;
|
|
10
|
-
anchor:
|
|
11
|
+
anchor: Popup.Anchor;
|
|
11
12
|
};
|
|
12
13
|
type Result = Schema.Field.LinkedData<Schema.AssetField> | 'pick' | undefined;
|
|
13
14
|
}
|
|
@@ -129,7 +129,7 @@ exports.AssetUploader = (0, react_2.forwardRef)(function AssetUploader(_, ref) {
|
|
|
129
129
|
deferral.resolve(result !== null && result !== void 0 ? result : undefined);
|
|
130
130
|
};
|
|
131
131
|
// skip if we don't have any params
|
|
132
|
-
if (!deferral || !schema) {
|
|
132
|
+
if (!deferral || !schema || !anchor) {
|
|
133
133
|
return null;
|
|
134
134
|
}
|
|
135
135
|
// render
|
|
@@ -14,7 +14,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.CollectionCard = CollectionCard;
|
|
15
15
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
16
|
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
17
|
-
const funnel_ui_1 = require("@nascentdigital/funnel-ui");
|
|
18
17
|
const hooks_1 = require("../../../hooks");
|
|
19
18
|
const feedback_1 = require("../../feedback");
|
|
20
19
|
const interaction_1 = require("../../interaction");
|
|
@@ -47,16 +46,7 @@ function CollectionCard(_a) {
|
|
|
47
46
|
}
|
|
48
47
|
// create preview
|
|
49
48
|
else {
|
|
50
|
-
|
|
51
|
-
// client
|
|
52
|
-
case funnel_ui_1.Client.schema.type:
|
|
53
|
-
content = ((0, jsx_runtime_1.jsx)(previews_1.ClientPreview, { schema: schema, client: collection }));
|
|
54
|
-
break;
|
|
55
|
-
// generic
|
|
56
|
-
default:
|
|
57
|
-
content = ((0, jsx_runtime_1.jsx)(previews_1.GenericPreview, { schema: schema, collection: collection }));
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
49
|
+
content = ((0, jsx_runtime_1.jsx)(previews_1.GenericPreview, { schema: schema, collection: collection }));
|
|
60
50
|
}
|
|
61
51
|
// render
|
|
62
52
|
return ((0, jsx_runtime_1.jsx)(FieldCardLayout_1.FieldCardLayout, Object.assign({}, props, { className: className, field: field, tip: (_b = schema.description) !== null && _b !== void 0 ? _b : collectionSchema === null || collectionSchema === void 0 ? void 0 : collectionSchema.description, children: content })));
|
|
@@ -154,7 +154,7 @@ exports.CollectionPicker = (0, react_1.forwardRef)(function CollectionPicker({ l
|
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
156
|
// add collection
|
|
157
|
-
collectionStore.addCollection(collection);
|
|
157
|
+
collectionStore.addCollection(collection.data);
|
|
158
158
|
// set result (triggers picker to close)
|
|
159
159
|
setResult(collectionRef);
|
|
160
160
|
};
|
|
@@ -241,11 +241,12 @@ function renderCollectionRef({ language, template, ref, onPick, setTagTooltip })
|
|
|
241
241
|
}
|
|
242
242
|
};
|
|
243
243
|
// render
|
|
244
|
+
const anchorId = `col-pick-tip-${ref.id}`;
|
|
244
245
|
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('flex items-center px-l7 py-l4 select-none interpolate', 'even:bg-modal-background rounded-md', {
|
|
245
246
|
'hover:bg-modal-surface2/tint2 cursor-pointer': !disabled,
|
|
246
247
|
'cursor-default': disabled
|
|
247
248
|
}), onClick: onClick, tabIndex: disabled ? undefined : 0, children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)('w-full flex items-center gap-l8 select-none interpolate', {
|
|
248
249
|
'opacity-disabled': disabled
|
|
249
250
|
}), onClick: onClick, children: [(0, jsx_runtime_1.jsx)("h3", { className: "flex-1 label-sm text-content-primary ellipsis", children: title }), tags.length > 0 &&
|
|
250
|
-
(0, jsx_runtime_1.jsxs)("div", { className: "shrink-0 flex items-center gap-l4", children: [visibleTags.map(tag => (0, jsx_runtime_1.jsx)(feedback_1.Badge, { variant: "outlinedTiny", status: "draft", label: tag.name }, tag.data)), tooltipTags.length > 0 && ((0, jsx_runtime_1.jsx)(feedback_1.Badge, { variant: "outlinedTiny", status: "draft", label: `+${tooltipTags.length}`, onPointerEnter: e => setTagTooltip({ anchor:
|
|
251
|
+
(0, jsx_runtime_1.jsxs)("div", { className: "shrink-0 flex items-center gap-l4", children: [visibleTags.map(tag => (0, jsx_runtime_1.jsx)(feedback_1.Badge, { variant: "outlinedTiny", status: "draft", label: tag.name }, tag.data)), tooltipTags.length > 0 && ((0, jsx_runtime_1.jsx)(feedback_1.Badge, { anchorId: anchorId, variant: "outlinedTiny", status: "draft", label: `+${tooltipTags.length}`, onPointerEnter: e => setTagTooltip({ anchor: anchorId, tags: tooltipTags }), onPointerLeave: () => setTagTooltip(undefined) }))] })] }) }, ref.id));
|
|
251
252
|
}
|
|
@@ -14,5 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./ClientPreview"), exports);
|
|
18
17
|
__exportStar(require("./GenericPreview"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Language,
|
|
1
|
+
import { Language, Schema } from '@nascentdigital/funnel-core';
|
|
2
2
|
export declare const EmbeddedVideoEditor: import("react").ForwardRefExoticComponent<EmbeddedVideoEditor.Props & import("react").RefAttributes<EmbeddedVideoEditor.Ref>>;
|
|
3
3
|
export declare namespace EmbeddedVideoEditor {
|
|
4
4
|
type Props = {
|
|
@@ -10,6 +10,6 @@ export declare namespace EmbeddedVideoEditor {
|
|
|
10
10
|
type Options = {
|
|
11
11
|
schema: Schema.EmbeddedVideoField;
|
|
12
12
|
initialValue?: Schema.Field.Data<Schema.EmbeddedVideoField>;
|
|
13
|
-
anchor:
|
|
13
|
+
anchor: string;
|
|
14
14
|
};
|
|
15
15
|
}
|
|
@@ -5,7 +5,7 @@ export declare namespace CollectionFactory {
|
|
|
5
5
|
schema: Schema.CollectionField;
|
|
6
6
|
language: Language;
|
|
7
7
|
collection?: Schema.CollectionField.Value;
|
|
8
|
-
anchor:
|
|
8
|
+
anchor: string;
|
|
9
9
|
onCommit: Callback<Schema.Field.Data<Schema.CollectionField>>;
|
|
10
10
|
onCancel: Callback.Void;
|
|
11
11
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Callback, Language,
|
|
1
|
+
import { Callback, Language, Schema } from '@nascentdigital/funnel-core';
|
|
2
2
|
export declare function EmbeddedVideoFactory({ schema, initialValue, language, anchor, onCommit, onCancel }: EmbeddedVideoFactory.Props): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export declare namespace EmbeddedVideoFactory {
|
|
4
4
|
type Props = {
|
|
5
5
|
schema: Schema.EmbeddedVideoField;
|
|
6
6
|
initialValue?: Schema.Field.Data<Schema.EmbeddedVideoField>;
|
|
7
7
|
language: Language;
|
|
8
|
-
anchor:
|
|
8
|
+
anchor: string;
|
|
9
9
|
onCommit: Callback<Schema.Field.Data<Schema.EmbeddedVideoField>>;
|
|
10
10
|
onCancel: Callback.Void;
|
|
11
11
|
};
|
|
@@ -2,7 +2,7 @@ import { Callback, Field, ObjectField, Schema } from '@nascentdigital/funnel-cor
|
|
|
2
2
|
export declare function FieldValueFactory<T extends Schema.Field.Type>({ anchor, itemSchema, field, onCommit, onCancel }: FieldValueFactory.Props<T>): import("react/jsx-runtime").JSX.Element | null;
|
|
3
3
|
export declare namespace FieldValueFactory {
|
|
4
4
|
type Props<T extends Schema.Field.Type = Schema.Field.Type> = {
|
|
5
|
-
anchor:
|
|
5
|
+
anchor: string;
|
|
6
6
|
itemSchema: T;
|
|
7
7
|
field?: Field<T> | ObjectField;
|
|
8
8
|
onCommit?: Callback<Schema.Field.Data<T>>;
|
|
@@ -11,13 +11,13 @@ const LinkFactory_1 = require("./LinkFactory");
|
|
|
11
11
|
const ObjectFactory_1 = require("./ObjectFactory");
|
|
12
12
|
const PageFactory_1 = require("./PageFactory");
|
|
13
13
|
const TextFactory_1 = require("./TextFactory");
|
|
14
|
+
// factory
|
|
14
15
|
function FieldValueFactory({ anchor, itemSchema, field, onCommit = funnel_core_1.Fn.NoOp, onCancel = funnel_core_1.Fn.NoOp }) {
|
|
15
16
|
var _a, _b, _c, _d, _e, _f;
|
|
16
17
|
// bind language
|
|
17
18
|
const brandConfig = funnel_core_1.AppConfig.brandConfig();
|
|
18
19
|
const page = (0, hooks_1.usePossiblePage)();
|
|
19
20
|
const collection = (0, hooks_1.usePossibleCollection)();
|
|
20
|
-
const store = collection !== null && collection !== void 0 ? collection : page;
|
|
21
21
|
const region = (_a = page === null || page === void 0 ? void 0 : page.region) !== null && _a !== void 0 ? _a : funnel_core_1.RegionsConfig.getDefaultRegion(brandConfig.regionalization);
|
|
22
22
|
const language = (_c = (_b = page === null || page === void 0 ? void 0 : page.language) !== null && _b !== void 0 ? _b : collection === null || collection === void 0 ? void 0 : collection.language) !== null && _c !== void 0 ? _c : funnel_core_1.RegionsConfig.getDefaultLanguage(brandConfig.regionalization);
|
|
23
23
|
const commit = (item) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Callback, Language,
|
|
1
|
+
import { Callback, Language, Schema } from '@nascentdigital/funnel-core';
|
|
2
2
|
export declare function LinkFactory({ schema, initialValue, region, language, anchor, onCommit, onCancel }: LinkFactory.Props): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export declare namespace LinkFactory {
|
|
4
4
|
type Props = {
|
|
@@ -6,7 +6,7 @@ export declare namespace LinkFactory {
|
|
|
6
6
|
initialValue?: Schema.Field.Data<Schema.LinkField>;
|
|
7
7
|
region: string;
|
|
8
8
|
language: Language;
|
|
9
|
-
anchor:
|
|
9
|
+
anchor: string;
|
|
10
10
|
onCommit: Callback<Schema.Field.Data<Schema.LinkField>>;
|
|
11
11
|
onCancel: Callback.Void;
|
|
12
12
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Callback,
|
|
1
|
+
import { Callback, Schema } from '@nascentdigital/funnel-core';
|
|
2
2
|
export declare function TextFactory({ schema, initialValue, anchor, onCommit, onCancel }: TextFactory.Props): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export declare namespace TextFactory {
|
|
4
4
|
type Props = {
|
|
5
5
|
schema: Schema.TextField;
|
|
6
6
|
initialValue?: Schema.Field.Data<Schema.TextField>;
|
|
7
|
-
anchor:
|
|
7
|
+
anchor: string;
|
|
8
8
|
onCommit: Callback<Schema.Field.Data<Schema.TextField>>;
|
|
9
9
|
onCancel: Callback.Void;
|
|
10
10
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Field, PartialBy,
|
|
1
|
+
import { Field, PartialBy, Schema } from '@nascentdigital/funnel-core';
|
|
2
|
+
import { Popup } from '../../interaction';
|
|
2
3
|
export declare const FormFieldEditor: import("react").ForwardRefExoticComponent<import("react").RefAttributes<FormFieldEditor.Ref>>;
|
|
3
4
|
export declare namespace FormFieldEditor {
|
|
4
5
|
type Data = {
|
|
@@ -13,6 +14,6 @@ export declare namespace FormFieldEditor {
|
|
|
13
14
|
form: Field<Schema.FormField>;
|
|
14
15
|
schema: Schema.Field.Type;
|
|
15
16
|
initialValue: PartialBy<Data, 'value'>;
|
|
16
|
-
anchor:
|
|
17
|
+
anchor: Popup.Anchor;
|
|
17
18
|
};
|
|
18
19
|
}
|
|
@@ -2,6 +2,7 @@ export * from './asset/AssetPreview';
|
|
|
2
2
|
export * from './DateField';
|
|
3
3
|
export * from './FieldEditor';
|
|
4
4
|
export * from './FieldErrorController';
|
|
5
|
+
export * from './FieldHeader';
|
|
5
6
|
export * from './FieldSize';
|
|
6
7
|
export * from './FieldsPanel';
|
|
7
8
|
export * from './RichTextEditor';
|