@nascentdigital/funnel-editor 4.5.2 → 4.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EditorApp.js +1 -1
- package/dist/core/components/ColorModeToggle.d.ts +2 -2
- package/dist/core/components/feedback/Note.d.ts +3 -1
- package/dist/core/components/feedback/Note.js +6 -3
- package/dist/core/components/fields/BooleanField.d.ts +3 -1
- package/dist/core/components/fields/BooleanField.js +2 -2
- package/dist/core/components/fields/DateField.d.ts +3 -1
- package/dist/core/components/fields/DateField.js +2 -2
- package/dist/core/components/fields/EnumField.d.ts +3 -1
- package/dist/core/components/fields/EnumField.js +4 -4
- package/dist/core/components/fields/FieldEditor.d.ts +3 -1
- package/dist/core/components/fields/FieldEditor.js +7 -7
- package/dist/core/components/fields/FieldHeader.d.ts +3 -1
- package/dist/core/components/fields/FieldHeader.js +18 -5
- package/dist/core/components/fields/FieldLayout.d.ts +3 -1
- package/dist/core/components/fields/FieldLayout.js +17 -4
- package/dist/core/components/fields/FieldSize.d.ts +1 -0
- package/dist/core/components/fields/FieldSize.js +2 -0
- package/dist/core/components/fields/FieldsPanel.js +5 -4
- package/dist/core/components/fields/RichTextEditor.d.ts +2 -3
- package/dist/core/components/fields/RichTextEditor.js +13 -10
- package/dist/core/components/fields/RichTextField.d.ts +1 -2
- package/dist/core/components/fields/RichTextField.js +4 -16
- package/dist/core/components/fields/TextField.d.ts +3 -2
- package/dist/core/components/fields/TextField.js +8 -7
- package/dist/core/components/fields/TimestampField.d.ts +3 -1
- package/dist/core/components/fields/TimestampField.js +2 -2
- package/dist/core/components/fields/collection/CollectionPicker.js +3 -4
- package/dist/core/components/fields/index.d.ts +2 -0
- package/dist/core/components/fields/index.js +2 -0
- package/dist/core/components/fields/page/PagePicker.js +2 -3
- package/dist/core/components/fields/richtext/Theme.d.ts +1 -2
- package/dist/core/components/fields/richtext/Theme.js +2 -2
- package/dist/core/components/interaction/Animate.d.ts +1 -1
- package/dist/core/components/interaction/Animate.js +12 -2
- package/dist/core/components/interaction/Button.js +3 -3
- package/dist/core/components/interaction/Combobox.d.ts +8 -1
- package/dist/core/components/interaction/Combobox.js +39 -12
- package/dist/core/components/interaction/IconButton.d.ts +2 -2
- package/dist/core/components/interaction/IconButton.js +2 -1
- package/dist/core/components/interaction/QuickEditor.d.ts +11 -0
- package/dist/core/components/interaction/QuickEditor.js +33 -0
- package/dist/core/components/interaction/QuickInput.js +1 -1
- package/dist/core/components/interaction/QuickPicker.js +5 -3
- package/dist/core/components/interaction/SegmentedButton.d.ts +3 -1
- package/dist/core/components/interaction/SegmentedButton.js +4 -1
- package/dist/core/components/interaction/SideSheet.d.ts +5 -5
- package/dist/core/components/interaction/SideSheet.js +15 -43
- package/dist/core/components/interaction/centersheet/CenterSheet.js +1 -1
- package/dist/core/components/interaction/centersheet/CenterSheetContainer.js +1 -1
- package/dist/core/components/interaction/index.d.ts +1 -0
- package/dist/core/components/interaction/index.js +1 -0
- package/dist/core/components/visuals/Icon.d.ts +2 -2
- package/dist/core/components/visuals/Icon.js +5 -0
- package/dist/core/domain/BlockConfiguration.d.ts +16 -1
- package/dist/core/domain/BlockConfiguration.js +109 -5
- package/dist/page/components/config/BlockConfig.js +1 -1
- package/dist/page/components/config/BlockConfigEditor.d.ts +1 -1
- package/dist/page/components/config/BlockConfigEditor.js +40 -13
- package/dist/page/components/config/BlockPreview.js +23 -17
- package/dist/page/components/config/LegacyBlockConfigEditor.js +1 -9
- package/dist/page/components/config/ListPanelEditor.d.ts +4 -2
- package/dist/page/components/config/ListPanelEditor.js +52 -2
- package/dist/page/components/config/MessagePanelEditor.d.ts +4 -2
- package/dist/page/components/config/MessagePanelEditor.js +6 -2
- package/dist/page/components/config/VisualPanelEditor.d.ts +4 -2
- package/dist/page/components/config/VisualPanelEditor.js +65 -2
- package/dist/styles/index.css +367 -193
- package/dist/styles/tailwind.js +11 -16
- package/package.json +2 -2
|
@@ -5,9 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MessagePanelEditor = MessagePanelEditor;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
8
9
|
const classnames_1 = __importDefault(require("classnames"));
|
|
10
|
+
const core_1 = require("../../../core");
|
|
9
11
|
// component
|
|
10
|
-
function MessagePanelEditor({ className }) {
|
|
12
|
+
function MessagePanelEditor({ className, anchor, open, onClose, configuration }) {
|
|
11
13
|
// render
|
|
12
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(core_1.QuickEditor, { className: (0, classnames_1.default)(className), title: "Message Configuration", tip: "Medium and Large are relative to this block's text area, not the page width.", anchor: anchor, placement: "left", anchorOffset: 4, viewportPadding: 4, open: open, onClose: onClose, size: "sm", children: (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-l4", children: Object.values(configuration.messageFields)
|
|
15
|
+
.filter(funnel_core_1.Value.isDefined)
|
|
16
|
+
.map(field => (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: field, size: "xs" }, field.id)) }) }));
|
|
13
17
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { BlockConfiguration, Popup } from '../../../core';
|
|
2
|
+
export declare function VisualPanelEditor({ className, anchor, open, onClose, configuration }: VisualPanelEditor.Props): import("react/jsx-runtime").JSX.Element;
|
|
2
3
|
export declare namespace VisualPanelEditor {
|
|
3
|
-
type Props = {
|
|
4
|
+
type Props = Pick<Popup.Props, 'open' | 'onClose' | 'anchor'> & {
|
|
4
5
|
className?: string;
|
|
6
|
+
configuration: BlockConfiguration;
|
|
5
7
|
};
|
|
6
8
|
}
|
|
@@ -6,8 +6,71 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.VisualPanelEditor = VisualPanelEditor;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const classnames_1 = __importDefault(require("classnames"));
|
|
9
|
+
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
10
|
+
const core_1 = require("../../../core");
|
|
11
|
+
const FieldHeader_1 = require("../../../core/components/fields/FieldHeader");
|
|
12
|
+
const framer_motion_1 = require("framer-motion");
|
|
9
13
|
// component
|
|
10
|
-
function VisualPanelEditor({ className }) {
|
|
14
|
+
function VisualPanelEditor({ className, anchor, open, onClose, configuration }) {
|
|
15
|
+
var _a;
|
|
16
|
+
// get fields
|
|
17
|
+
const { visualFields: { aspect: aspectField, anchor: anchorField, width: widthField, horizontalAlign: horizontalAlignField } } = configuration;
|
|
18
|
+
const { value } = (_a = configuration.getFieldData('visual')) !== null && _a !== void 0 ? _a : {};
|
|
19
|
+
const visual = funnel_core_1.Schema.AssetField.LinkedValue.Visual.filter(value)
|
|
20
|
+
? value
|
|
21
|
+
: undefined;
|
|
22
|
+
// sync config
|
|
23
|
+
(0, core_1.useBlockConfiguration)(configuration);
|
|
11
24
|
// render
|
|
12
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(core_1.QuickEditor, { className: (0, classnames_1.default)(className), title: "Visual Configuration", tip: "Cropping changes how the image appears on your site, not your original file.", anchor: anchor, placement: "left", anchorOffset: 4, viewportPadding: 4, open: open, onClose: onClose, size: "sm", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l9", children: [(0, jsx_runtime_1.jsxs)("section", { className: "flex flex-col gap-l4", children: [aspectField &&
|
|
26
|
+
(0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: aspectField, size: "xs" }), anchorField
|
|
27
|
+
? (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: anchorField, size: "xs" })
|
|
28
|
+
:
|
|
29
|
+
(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(FieldHeader_1.FieldHeader, { label: "Anchor", size: "xs" }), (0, jsx_runtime_1.jsx)("p", { className: "label-xs text-content-secondary text-pretty", children: "Your current image size and aspect ratio don't require and anchor (there's no cropping)." })] })] }), visual && renderVisual({
|
|
30
|
+
configuration,
|
|
31
|
+
visual,
|
|
32
|
+
aspectField: aspectField,
|
|
33
|
+
anchorField: anchorField
|
|
34
|
+
})] }) }));
|
|
35
|
+
}
|
|
36
|
+
function renderVisual({ configuration, visual, aspectField, anchorField }) {
|
|
37
|
+
var _a, _b, _c;
|
|
38
|
+
// determine layout info
|
|
39
|
+
const { metadata, name, description } = visual;
|
|
40
|
+
const { dimensions: { width, height } } = metadata;
|
|
41
|
+
const isPortrait = width < height;
|
|
42
|
+
const aspect = (_b = (_a = aspectField === null || aspectField === void 0 ? void 0 : aspectField.value) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 'auto';
|
|
43
|
+
const anchor = (_c = anchorField === null || anchorField === void 0 ? void 0 : anchorField.value) === null || _c === void 0 ? void 0 : _c.value;
|
|
44
|
+
const anchorDirection = anchorField
|
|
45
|
+
? anchorField.schema.isValidOption('left')
|
|
46
|
+
? 'x'
|
|
47
|
+
: 'y'
|
|
48
|
+
: undefined;
|
|
49
|
+
// render
|
|
50
|
+
return ((0, jsx_runtime_1.jsx)("section", { className: (0, classnames_1.default)('w-full h-[210px]', 'flex flex-col justify-center items-center', 'bg-background rounded-xs'), children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)('relative bg-destructive', {
|
|
51
|
+
'h-full max-h-full w-auto': isPortrait,
|
|
52
|
+
'w-full': !isPortrait
|
|
53
|
+
}), children: [funnel_core_1.Schema.AssetField.LinkedValue.Image.filter(visual)
|
|
54
|
+
? renderImage({ configuration, visual })
|
|
55
|
+
: renderVideo({ configuration, visual }), aspect !== 'auto' && anchor && anchorDirection &&
|
|
56
|
+
(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('absolute inset-0 z-supersurface flex', {
|
|
57
|
+
'flex-col': anchorDirection === 'y'
|
|
58
|
+
}), children: (0, jsx_runtime_1.jsxs)(framer_motion_1.AnimatePresence, { mode: "popLayout", children: [anchor !== 'left' && anchor !== 'top' &&
|
|
59
|
+
(0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { className: "flex-1 bg-content-button-contrast/backdrop", layout: true, variants: core_1.Animate.Variants.fade, initial: "initial", animate: "animate", exit: "exit" }, "crop.start"), (0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { className: (0, classnames_1.default)('shrink-0 outline outline-1 outline-ix-primary', {
|
|
60
|
+
'h-full w-auto': anchorDirection === 'x',
|
|
61
|
+
'w-full h-auto': anchorDirection === 'y',
|
|
62
|
+
'aspect-square': aspect === 'square',
|
|
63
|
+
'aspect-phone': aspect === 'phone',
|
|
64
|
+
'aspect-tv': aspect === 'tv',
|
|
65
|
+
'aspect-widescreen': aspect === 'widescreen',
|
|
66
|
+
'aspect-cinema': aspect === 'cinema'
|
|
67
|
+
}), layout: true }, "visible"), anchor !== 'right' && anchor !== 'bottom' &&
|
|
68
|
+
(0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { className: "flex-1 bg-content-button-contrast/backdrop", layout: true, variants: core_1.Animate.Variants.fade, initial: "initial", animate: "animate", exit: "exit" }, "crop.end")] }) })] }) }));
|
|
69
|
+
}
|
|
70
|
+
function renderImage({ visual }) {
|
|
71
|
+
var _a;
|
|
72
|
+
return ((0, jsx_runtime_1.jsx)("img", { className: "max-w-full max-h-full", src: visual.url, alt: (_a = visual.description) !== null && _a !== void 0 ? _a : visual.name }));
|
|
73
|
+
}
|
|
74
|
+
function renderVideo({ visual }) {
|
|
75
|
+
return ((0, jsx_runtime_1.jsx)("video", { className: "max-w-full max-h-full", src: visual.url, autoPlay: true, muted: true, loop: true, playsInline: true }));
|
|
13
76
|
}
|