@nascentdigital/funnel-editor 4.5.7 → 4.6.1
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.js +4 -4
- 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 +9 -2
- package/dist/core/domain/BlockConfiguration.js +49 -12
- 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 +157 -46
- 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 -129
- 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 -102
- 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
|
@@ -1,429 +0,0 @@
|
|
|
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.SkeletonLayout = SkeletonLayout;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
9
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
10
|
-
const react_1 = require("react");
|
|
11
|
-
const Icon_1 = require("./Icon");
|
|
12
|
-
// component
|
|
13
|
-
function SkeletonLayout({ variant, layout }) {
|
|
14
|
-
// render
|
|
15
|
-
const tight = variant === 'mobile'
|
|
16
|
-
? layout === null || layout === void 0 ? void 0 : layout.tight.mobile
|
|
17
|
-
: layout === null || layout === void 0 ? void 0 : layout.tight.desktop;
|
|
18
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l3", children: [(0, jsx_runtime_1.jsx)("h5", { className: "label-xs text-content-primary leading-[100%]", children: variant === 'mobile' ? 'Mobile' : 'Desktop' }), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('bg-surface2 overflow-hidden rounded-xs', {
|
|
19
|
-
'min-h-[100px]': !layout,
|
|
20
|
-
'w-[120px]': variant === 'desktop',
|
|
21
|
-
'w-[64px]': variant === 'mobile',
|
|
22
|
-
'pb-l4': tight === 'above',
|
|
23
|
-
'pt-l4': tight === 'below',
|
|
24
|
-
'py-l4': tight === 'none'
|
|
25
|
-
}), children: renderLayout({ variant, layout }) })] }));
|
|
26
|
-
}
|
|
27
|
-
// helpers
|
|
28
|
-
var Skeleton;
|
|
29
|
-
(function (Skeleton) {
|
|
30
|
-
function HeadlinePart({ className, size }) {
|
|
31
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(className, 'bg-ix-primary rounded-xxs overflow-hidden', {
|
|
32
|
-
'h-6 ': size === 'sm',
|
|
33
|
-
'h-8': size === 'md'
|
|
34
|
-
}) }));
|
|
35
|
-
}
|
|
36
|
-
Skeleton.HeadlinePart = HeadlinePart;
|
|
37
|
-
function CaptionPart({ className, size }) {
|
|
38
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(className, 'h-4 bg-draft/tint3 rounded-px overflow-hidden', {
|
|
39
|
-
'': size === 'sm'
|
|
40
|
-
}) }));
|
|
41
|
-
}
|
|
42
|
-
Skeleton.CaptionPart = CaptionPart;
|
|
43
|
-
function MediaPart({ className, aspect }) {
|
|
44
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(className, 'flex justify-center items-center bg-draft/tint3 rounded-xxs overflow-hidden', {
|
|
45
|
-
'aspect-square': aspect === 'square' || aspect === 'auto',
|
|
46
|
-
'aspect-phone': aspect === 'phone',
|
|
47
|
-
'aspect-tv': aspect === 'tv',
|
|
48
|
-
'aspect-widescreen': aspect === 'widescreen',
|
|
49
|
-
'aspect-cinema': aspect === 'cinema'
|
|
50
|
-
}), children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { className: "text-content-tertiary", variant: "Image", size: {
|
|
51
|
-
size: 20,
|
|
52
|
-
strokeWidth: 1.5,
|
|
53
|
-
absoluteStrokeWidth: false
|
|
54
|
-
} }) }));
|
|
55
|
-
}
|
|
56
|
-
Skeleton.MediaPart = MediaPart;
|
|
57
|
-
function IconPart({ className, size }) {
|
|
58
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(className, 'bg-draft/tint3 rounded-full overflow-hidden', {
|
|
59
|
-
'w-10 h-10': size === 'sm',
|
|
60
|
-
'w-14 h-14': size === 'md'
|
|
61
|
-
}) }));
|
|
62
|
-
}
|
|
63
|
-
Skeleton.IconPart = IconPart;
|
|
64
|
-
function LogoPart({ className, size }) {
|
|
65
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(className, 'bg-draft/tint3 rounded-px overflow-hidden', {
|
|
66
|
-
'w-14 h-6': size === 'sm',
|
|
67
|
-
'w-20 h-9': size === 'md'
|
|
68
|
-
}) }));
|
|
69
|
-
}
|
|
70
|
-
Skeleton.LogoPart = LogoPart;
|
|
71
|
-
})(Skeleton || (Skeleton = {}));
|
|
72
|
-
function renderLayout({ className, variant, layout }) {
|
|
73
|
-
// TODO: render empty state if there's no layout
|
|
74
|
-
if (!layout) {
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
// render root layout
|
|
78
|
-
const { type, items } = layout.root;
|
|
79
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: getContainerClasses({ className, variant, siblingCount: 1, item: layout.root }), children: items.map((item, parentOffset) => (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: renderItem({
|
|
80
|
-
className: (0, classnames_1.default)({
|
|
81
|
-
'flex-1': type === 'row' && variant !== 'mobile'
|
|
82
|
-
}),
|
|
83
|
-
variant,
|
|
84
|
-
parent: type,
|
|
85
|
-
parentNested: false,
|
|
86
|
-
siblingCount: items.length,
|
|
87
|
-
item,
|
|
88
|
-
itemPosition: new ItemPosition({
|
|
89
|
-
parent: type,
|
|
90
|
-
parentOffset,
|
|
91
|
-
parentSize: items.length
|
|
92
|
-
})
|
|
93
|
-
}) }, `${item.type}.${parentOffset}`)) }));
|
|
94
|
-
}
|
|
95
|
-
function renderItem({ className, parent, parentNested, siblingCount, variant, item, itemPosition }) {
|
|
96
|
-
// render item
|
|
97
|
-
const { type: itemType } = item;
|
|
98
|
-
switch (itemType) {
|
|
99
|
-
case 'row':
|
|
100
|
-
case 'column':
|
|
101
|
-
case 'stack':
|
|
102
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: getContainerClasses({ className, parent, siblingCount, variant, item }), children: item.items.map((item, parentOffset, items) => (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: renderItem({
|
|
103
|
-
className: (0, classnames_1.default)({
|
|
104
|
-
'flex-1': itemType === 'row'
|
|
105
|
-
}),
|
|
106
|
-
variant,
|
|
107
|
-
parent: itemType,
|
|
108
|
-
parentNested: true,
|
|
109
|
-
siblingCount: items.length,
|
|
110
|
-
item: item,
|
|
111
|
-
itemPosition: new ItemPosition({
|
|
112
|
-
parent: itemType,
|
|
113
|
-
parentOffset,
|
|
114
|
-
parentSize: items.length
|
|
115
|
-
})
|
|
116
|
-
}) }, `${item.type}.${parentOffset}`)) }));
|
|
117
|
-
case 'message':
|
|
118
|
-
return renderMessage({ className, parent, parentNested, siblingCount, variant, item, itemPosition });
|
|
119
|
-
case 'visual':
|
|
120
|
-
return renderVisual({ className, parent, parentNested, siblingCount, variant, item, itemPosition });
|
|
121
|
-
case 'list':
|
|
122
|
-
return renderList({ className, parent, parentNested, siblingCount, variant, item, itemPosition });
|
|
123
|
-
default:
|
|
124
|
-
console.error('[SkeletonLayout] no support for BlockLayout item', item);
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
function getContainerClasses({ className, variant, parent, item }) {
|
|
129
|
-
const { type, alignY } = item;
|
|
130
|
-
// row style
|
|
131
|
-
if (type === 'row' && variant !== 'mobile') {
|
|
132
|
-
return (0, classnames_1.default)(className, 'grid gap-l3 px-l4', {
|
|
133
|
-
'items-start': alignY === 'start',
|
|
134
|
-
'items-center': alignY === 'center',
|
|
135
|
-
'items-end': alignY === 'end',
|
|
136
|
-
'grid-cols-[1fr,1fr]': item.ratio.desktop === '1/1',
|
|
137
|
-
'grid-cols-[1fr,2fr]': item.ratio.desktop === '1/2',
|
|
138
|
-
'grid-cols-[1fr,3fr]': item.ratio.desktop === '1/3',
|
|
139
|
-
'grid-cols-[2fr,1fr]': item.ratio.desktop === '2/1',
|
|
140
|
-
'grid-cols-[2fr,3fr]': item.ratio.desktop === '2/3',
|
|
141
|
-
'grid-cols-[3fr,1fr]': item.ratio.desktop === '3/1',
|
|
142
|
-
'grid-cols-[3fr,2fr]': item.ratio.desktop === '3/2'
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
// or stack
|
|
146
|
-
else if (type === 'stack') {
|
|
147
|
-
return (0, classnames_1.default)(className, 'stacked-stretch');
|
|
148
|
-
}
|
|
149
|
-
// or column
|
|
150
|
-
else {
|
|
151
|
-
return (0, classnames_1.default)(className, 'flex flex-col gap-l4');
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
function renderMessage(args) {
|
|
155
|
-
// resolve props
|
|
156
|
-
const { variant, item: { textAlign } } = args;
|
|
157
|
-
const messageClasses = variant === 'mobile'
|
|
158
|
-
? (0, classnames_1.default)({
|
|
159
|
-
'items-start': textAlign.mobile === 'left',
|
|
160
|
-
'items-center': textAlign.mobile === 'center',
|
|
161
|
-
'items-end': textAlign.mobile === 'right'
|
|
162
|
-
})
|
|
163
|
-
: (0, classnames_1.default)({
|
|
164
|
-
'items-start': textAlign.desktop === 'left',
|
|
165
|
-
'items-center': textAlign.desktop === 'center',
|
|
166
|
-
'items-end': textAlign.desktop === 'right'
|
|
167
|
-
});
|
|
168
|
-
// render
|
|
169
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: getPanelWrapClasses(args), children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(messageClasses, getPanelClasses(Object.assign(Object.assign({}, args), { className: 'flex flex-col' }))), children: [(0, jsx_runtime_1.jsx)(Skeleton.HeadlinePart, { className: "w-full mb-l2", size: "md" }), (0, jsx_runtime_1.jsx)(Skeleton.CaptionPart, { className: "w-full mb-px", size: "md" }), (0, jsx_runtime_1.jsx)(Skeleton.CaptionPart, { className: "w-full mb-px", size: "md" }), (0, jsx_runtime_1.jsx)(Skeleton.CaptionPart, { className: "w-20", size: "md" })] }) }));
|
|
170
|
-
}
|
|
171
|
-
function renderVisual(args) {
|
|
172
|
-
// resolve props
|
|
173
|
-
const { variant, item: { aspectRatio }, parent } = args;
|
|
174
|
-
const aspect = variant === 'mobile' ? aspectRatio.mobile : aspectRatio.desktop;
|
|
175
|
-
// render
|
|
176
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: getPanelWrapClasses(args), children: (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(getPanelClasses(Object.assign(Object.assign({}, args), { className: '' }))), children: (0, jsx_runtime_1.jsx)(Skeleton.MediaPart, { className: "w-full", aspect: aspect }) }) }));
|
|
177
|
-
}
|
|
178
|
-
function renderList(args) {
|
|
179
|
-
// resolve props
|
|
180
|
-
const { variant, parent, parentNested, item: { layout: layoutRaw, itemType, itemCount: itemCountRaw } } = args;
|
|
181
|
-
const layout = variant === 'mobile'
|
|
182
|
-
? layoutRaw.mobile
|
|
183
|
-
: layoutRaw.desktop;
|
|
184
|
-
// render a grid
|
|
185
|
-
if (layout === 'grid') {
|
|
186
|
-
return renderGrid(args);
|
|
187
|
-
}
|
|
188
|
-
// or render row/column
|
|
189
|
-
const itemCount = variant === 'mobile'
|
|
190
|
-
? itemCountRaw.mobile
|
|
191
|
-
: itemCountRaw.desktop;
|
|
192
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: getPanelWrapClasses(args), children: (0, jsx_runtime_1.jsx)("div", { className: getListPanelClasses(args), children: funnel_core_1.ArrayUtils.series(itemCount, 1).map(row => (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: renderListItem({ variant, parent, parentNested, layout, itemType, index: row, count: itemCount }) }, `list.${row}`)) }) }));
|
|
193
|
-
}
|
|
194
|
-
function getListPanelClasses(args) {
|
|
195
|
-
// resolve props
|
|
196
|
-
const { variant, item: { layout: layoutRaw } } = args;
|
|
197
|
-
const layout = variant === 'mobile'
|
|
198
|
-
? layoutRaw.mobile
|
|
199
|
-
: layoutRaw.desktop;
|
|
200
|
-
// determine list classes
|
|
201
|
-
let listClasses = '';
|
|
202
|
-
switch (layout) {
|
|
203
|
-
case 'row':
|
|
204
|
-
listClasses = 'grid grid-rows-1 auto-cols-auto grid-flow-col gap-l2';
|
|
205
|
-
break;
|
|
206
|
-
case 'column':
|
|
207
|
-
listClasses = 'flex flex-col gap-l2';
|
|
208
|
-
break;
|
|
209
|
-
}
|
|
210
|
-
// return completed classes
|
|
211
|
-
return getPanelClasses(Object.assign(Object.assign({}, args), { className: listClasses }));
|
|
212
|
-
}
|
|
213
|
-
function renderGrid(args) {
|
|
214
|
-
// determine props
|
|
215
|
-
const { variant, parent, parentNested, item: { itemType, itemCount: itemCountRaw } } = args;
|
|
216
|
-
const itemCount = variant === 'mobile'
|
|
217
|
-
? itemCountRaw.mobile
|
|
218
|
-
: itemCountRaw.desktop;
|
|
219
|
-
const { panelClassName, panelItemClassName } = getGridPanelClasses(args);
|
|
220
|
-
// render grid (really a flexbox layout with controlled item widths)
|
|
221
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: getPanelWrapClasses(args), children: (0, jsx_runtime_1.jsx)("div", { className: panelClassName, children: funnel_core_1.ArrayUtils.series(itemCount, 1).map(row => (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: renderListItem({
|
|
222
|
-
className: panelItemClassName,
|
|
223
|
-
variant,
|
|
224
|
-
parent,
|
|
225
|
-
parentNested,
|
|
226
|
-
layout: 'grid',
|
|
227
|
-
itemType, index: row,
|
|
228
|
-
count: itemCount
|
|
229
|
-
}) }, `list.${row}`)) }) }));
|
|
230
|
-
}
|
|
231
|
-
function getGridPanelClasses(args) {
|
|
232
|
-
// resolve props
|
|
233
|
-
const { variant, parent, parentNested, item: { itemType, itemCount: itemCountRaw, itemAlign: itemAlignRaw } } = args;
|
|
234
|
-
const itemAlign = variant === 'mobile'
|
|
235
|
-
? itemAlignRaw.mobile
|
|
236
|
-
: itemAlignRaw.desktop;
|
|
237
|
-
// determine list classes
|
|
238
|
-
const panelClasses = (0, classnames_1.default)('flex flex-wrap gap-l2', {
|
|
239
|
-
'justify-center': itemAlign === 'center',
|
|
240
|
-
'justify-end': itemAlign === 'end'
|
|
241
|
-
});
|
|
242
|
-
let panelItemClasses = '';
|
|
243
|
-
switch (itemType) {
|
|
244
|
-
case 'message':
|
|
245
|
-
case 'message+visual':
|
|
246
|
-
panelItemClasses = (0, classnames_1.default)({
|
|
247
|
-
'w-full': variant === 'mobile' || (variant === 'desktop' && (parent === 'row' || parentNested)),
|
|
248
|
-
'w-[50px]': variant === 'desktop' && parent !== 'row' && !parentNested
|
|
249
|
-
});
|
|
250
|
-
break;
|
|
251
|
-
case 'visual':
|
|
252
|
-
panelItemClasses = (0, classnames_1.default)({
|
|
253
|
-
'': variant === 'mobile' || (variant === 'desktop' && (parent === 'row' || parentNested)),
|
|
254
|
-
'flex-1': variant === 'desktop' && parent !== 'row' && !parentNested
|
|
255
|
-
});
|
|
256
|
-
break;
|
|
257
|
-
case 'icon':
|
|
258
|
-
panelItemClasses = (0, classnames_1.default)({});
|
|
259
|
-
break;
|
|
260
|
-
case 'logo':
|
|
261
|
-
panelItemClasses = (0, classnames_1.default)({
|
|
262
|
-
'': variant === 'desktop',
|
|
263
|
-
'': variant === 'mobile'
|
|
264
|
-
});
|
|
265
|
-
break;
|
|
266
|
-
}
|
|
267
|
-
// return completed classes
|
|
268
|
-
return {
|
|
269
|
-
panelClassName: getPanelClasses(Object.assign(Object.assign({}, args), { className: panelClasses })),
|
|
270
|
-
panelItemClassName: panelItemClasses
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
function renderListItem({ className, variant, parent, parentNested, layout, itemType, index, count }) {
|
|
274
|
-
let itemClassName = '';
|
|
275
|
-
switch (itemType) {
|
|
276
|
-
case 'message':
|
|
277
|
-
case 'message+visual':
|
|
278
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(className, 'flex flex-row p-3 bg-background rounded-xxs'), children: [itemType === 'message+visual' &&
|
|
279
|
-
(0, jsx_runtime_1.jsx)("div", { className: "flex justify-center items-center", children: (0, jsx_runtime_1.jsx)("div", { className: "bg-content-tertiary rounded-full w-4 h-4" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 flex flex-col", children: [(0, jsx_runtime_1.jsx)(Skeleton.HeadlinePart, { className: "w-11/12 mb-l1", size: "sm" }), (0, jsx_runtime_1.jsx)(Skeleton.CaptionPart, { className: "w-full mb-px", size: "sm" }), (0, jsx_runtime_1.jsx)(Skeleton.CaptionPart, { className: "w-8/12", size: "sm" })] })] }));
|
|
280
|
-
case 'visual': {
|
|
281
|
-
// determine aspect
|
|
282
|
-
let aspect;
|
|
283
|
-
switch (layout) {
|
|
284
|
-
case 'column':
|
|
285
|
-
aspect = parent === 'row' || parentNested
|
|
286
|
-
? 'widescreen'
|
|
287
|
-
: variant === 'mobile'
|
|
288
|
-
? 'widescreen'
|
|
289
|
-
: 'cinema';
|
|
290
|
-
break;
|
|
291
|
-
case 'row':
|
|
292
|
-
aspect = parent === 'row' || parentNested
|
|
293
|
-
? 'square'
|
|
294
|
-
: 'widescreen';
|
|
295
|
-
break;
|
|
296
|
-
case 'grid': {
|
|
297
|
-
// aspect for mobile/nested
|
|
298
|
-
if (variant === 'mobile' || parent === 'row' || parentNested) {
|
|
299
|
-
itemClassName = 'w-full';
|
|
300
|
-
aspect = count === 1
|
|
301
|
-
? 'square'
|
|
302
|
-
: count <= 3
|
|
303
|
-
? 'tv'
|
|
304
|
-
: 'widescreen';
|
|
305
|
-
}
|
|
306
|
-
// adjust aspect based on layout (if it's a grid)
|
|
307
|
-
else if (layout === 'grid') {
|
|
308
|
-
// set base class
|
|
309
|
-
itemClassName = 'min-w-[50px]';
|
|
310
|
-
// override base + pick aspect
|
|
311
|
-
switch (count) {
|
|
312
|
-
case 1:
|
|
313
|
-
aspect = 'widescreen';
|
|
314
|
-
break;
|
|
315
|
-
case 2:
|
|
316
|
-
aspect = 'widescreen';
|
|
317
|
-
break;
|
|
318
|
-
case 3:
|
|
319
|
-
itemClassName = index === 1
|
|
320
|
-
? 'min-w-full'
|
|
321
|
-
: 'min-w-[50px]';
|
|
322
|
-
aspect = index === 1
|
|
323
|
-
? 'cinema'
|
|
324
|
-
: 'tv';
|
|
325
|
-
break;
|
|
326
|
-
case 4:
|
|
327
|
-
aspect = 'tv';
|
|
328
|
-
break;
|
|
329
|
-
case 5:
|
|
330
|
-
itemClassName = index === 3
|
|
331
|
-
? 'min-w-full'
|
|
332
|
-
: 'min-w-[50px]';
|
|
333
|
-
aspect = index === 3
|
|
334
|
-
? 'cinema'
|
|
335
|
-
: 'tv';
|
|
336
|
-
break;
|
|
337
|
-
default:
|
|
338
|
-
aspect = 'widescreen';
|
|
339
|
-
break;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
// otherwise standard
|
|
343
|
-
else {
|
|
344
|
-
aspect = 'widescreen';
|
|
345
|
-
}
|
|
346
|
-
break;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
// create visual
|
|
350
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(className, itemClassName), children: (0, jsx_runtime_1.jsx)(Skeleton.MediaPart, { aspect: aspect }) }));
|
|
351
|
-
}
|
|
352
|
-
case 'icon':
|
|
353
|
-
return ((0, jsx_runtime_1.jsx)(Skeleton.IconPart, { className: (0, classnames_1.default)(className, itemClassName), size: variant === 'mobile' ? 'md' : 'sm' }));
|
|
354
|
-
case 'logo':
|
|
355
|
-
return ((0, jsx_runtime_1.jsx)(Skeleton.LogoPart, { className: (0, classnames_1.default)(className, itemClassName), size: variant === 'mobile' ? 'md' : 'sm' }));
|
|
356
|
-
default:
|
|
357
|
-
return null;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
function getPanelWrapClasses({ className, variant, parent, parentNested, item: { mobileOrder, alignY, fullBleed }, itemPosition }) {
|
|
361
|
-
return variant === 'mobile'
|
|
362
|
-
? (0, classnames_1.default)(className, 'w-full flex flex-col', {
|
|
363
|
-
'justify-start': alignY === 'start',
|
|
364
|
-
'justify-center': alignY === 'center',
|
|
365
|
-
'justify-end': alignY === 'end',
|
|
366
|
-
'order-first': mobileOrder === 'first',
|
|
367
|
-
'order-last': mobileOrder === 'last',
|
|
368
|
-
'px-l4': !fullBleed.mobile
|
|
369
|
-
})
|
|
370
|
-
: (0, classnames_1.default)(className, 'grid grid-cols-12', {
|
|
371
|
-
'items-start': alignY === 'start',
|
|
372
|
-
'items-center': alignY === 'center',
|
|
373
|
-
'items-end': alignY === 'end',
|
|
374
|
-
'px-l4': parent !== 'row' && !fullBleed.desktop && !parentNested,
|
|
375
|
-
'-ml-l4': itemPosition.left && fullBleed.desktop,
|
|
376
|
-
'-mr-l4': itemPosition.right && fullBleed.desktop
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
function getPanelClasses({ className, variant, parent, parentNested, item: { alignX, size } }) {
|
|
380
|
-
// force full width for mobile
|
|
381
|
-
if (variant === 'mobile') {
|
|
382
|
-
return (0, classnames_1.default)(className);
|
|
383
|
-
}
|
|
384
|
-
// or size for desktop
|
|
385
|
-
switch (parent === 'row' || parentNested ? 'full' : size) {
|
|
386
|
-
case 'xs':
|
|
387
|
-
return (0, classnames_1.default)(className, 'col-span-4', {
|
|
388
|
-
'col-start-1': alignX === 'start',
|
|
389
|
-
'col-start-5': alignX === 'center',
|
|
390
|
-
'col-end-13': alignX === 'end'
|
|
391
|
-
});
|
|
392
|
-
case 'sm':
|
|
393
|
-
return (0, classnames_1.default)(className, 'col-span-6', {
|
|
394
|
-
'col-start-1': alignX === 'start',
|
|
395
|
-
'col-start-4': alignX === 'center',
|
|
396
|
-
'col-end-13': alignX === 'end'
|
|
397
|
-
});
|
|
398
|
-
case 'md':
|
|
399
|
-
return (0, classnames_1.default)(className, 'col-span-8', {
|
|
400
|
-
'col-start-1': alignX === 'start',
|
|
401
|
-
'col-start-3': alignX === 'center',
|
|
402
|
-
'col-end-13': alignX === 'end'
|
|
403
|
-
});
|
|
404
|
-
case 'lg':
|
|
405
|
-
return (0, classnames_1.default)(className, 'col-span-10', {
|
|
406
|
-
'col-start-1': alignX === 'start',
|
|
407
|
-
'col-start-2': alignX === 'center',
|
|
408
|
-
'col-end-13': alignX === 'end'
|
|
409
|
-
});
|
|
410
|
-
case 'full':
|
|
411
|
-
return (0, classnames_1.default)(className, 'col-span-full');
|
|
412
|
-
default:
|
|
413
|
-
return className;
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
class ItemPosition {
|
|
417
|
-
constructor(args) {
|
|
418
|
-
// initialize instance variables
|
|
419
|
-
this.parent = args.parent;
|
|
420
|
-
this.parentOffset = args.parentOffset;
|
|
421
|
-
this.parentSize = args.parentSize;
|
|
422
|
-
}
|
|
423
|
-
get left() {
|
|
424
|
-
return this.parent === 'row' && this.parentOffset === 0;
|
|
425
|
-
}
|
|
426
|
-
get right() {
|
|
427
|
-
return this.parent === 'row' && this.parentOffset === 1;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Block, SectionBlock } from '../../../core';
|
|
2
|
-
export declare function BlockConfig({ className, block: blockOrSectionBlock }: BlockConfig.Props): import("react/jsx-runtime").JSX.Element | undefined;
|
|
3
|
-
export declare namespace BlockConfig {
|
|
4
|
-
type Props = {
|
|
5
|
-
className?: string;
|
|
6
|
-
block: Block | SectionBlock;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BlockConfig = BlockConfig;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const core_1 = require("../../../core");
|
|
7
|
-
const BlockConfigEditor_1 = require("./BlockConfigEditor");
|
|
8
|
-
const LegacyBlockConfigEditor_1 = require("./LegacyBlockConfigEditor");
|
|
9
|
-
// component
|
|
10
|
-
function BlockConfig({ className, block: blockOrSectionBlock }) {
|
|
11
|
-
// bind ref
|
|
12
|
-
const [configuration, setConfiguration] = (0, react_1.useState)();
|
|
13
|
-
// skip if there's no config
|
|
14
|
-
const block = blockOrSectionBlock instanceof core_1.SectionBlock
|
|
15
|
-
? blockOrSectionBlock.block
|
|
16
|
-
: blockOrSectionBlock;
|
|
17
|
-
const { config } = block;
|
|
18
|
-
if (config.length === 0) {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
// render
|
|
22
|
-
const valid = config.every(field => field.valid);
|
|
23
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(core_1.StatusChip, { className: className, variant: valid ? 'success' : 'error', onClick: () => setConfiguration(blockOrSectionBlock.getConfiguration()), children: "Configure" }), process.env.NEXT_PUBLIC_EDITOR_BLOCK_CONFIG === 'experimental'
|
|
24
|
-
?
|
|
25
|
-
(0, jsx_runtime_1.jsx)(BlockConfigEditor_1.BlockConfigEditor, { configuration: configuration, onClose: () => setConfiguration(undefined) })
|
|
26
|
-
:
|
|
27
|
-
(0, jsx_runtime_1.jsx)(LegacyBlockConfigEditor_1.LegacyBlockConfigEditor, { configuration: configuration, onClose: () => setConfiguration(undefined) })] }));
|
|
28
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Callback } from '@nascentdigital/funnel-core';
|
|
2
|
-
import { BlockConfiguration } from '../../../core';
|
|
3
|
-
export declare function BlockConfigEditor({ configuration, onClose }: BlockConfigEditor.Props): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export declare namespace BlockConfigEditor {
|
|
5
|
-
type Props = {
|
|
6
|
-
configuration?: BlockConfiguration;
|
|
7
|
-
onClose: Callback.Void;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
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.BlockConfigEditor = BlockConfigEditor;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
9
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
10
|
-
const react_1 = require("motion/react");
|
|
11
|
-
const react_2 = require("react");
|
|
12
|
-
const rxjs_1 = require("rxjs");
|
|
13
|
-
const core_1 = require("../../../core");
|
|
14
|
-
const FieldHeader_1 = require("../../../core/components/fields/FieldHeader");
|
|
15
|
-
const hooks_1 = require("../../hooks");
|
|
16
|
-
const BlockPreview_1 = require("./BlockPreview");
|
|
17
|
-
// editor
|
|
18
|
-
function BlockConfigEditor({ configuration, onClose }) {
|
|
19
|
-
var _a;
|
|
20
|
-
// bind state + hooks
|
|
21
|
-
const [blockView, setBlockView] = (0, react_2.useState)('desktop');
|
|
22
|
-
const pageController = (0, hooks_1.usePageController)();
|
|
23
|
-
const panelLayoutPickerRef = (0, react_2.useRef)(null);
|
|
24
|
-
const { layoutField, modified = false, valid = false, blocksFields = [], desktopFields = [], mobileFields = [] } = configuration !== null && configuration !== void 0 ? configuration : {};
|
|
25
|
-
const settingsFields = blockView === 'desktop' ? desktopFields : mobileFields;
|
|
26
|
-
// sync w/ configuration
|
|
27
|
-
(0, core_1.useBlockConfiguration)(configuration);
|
|
28
|
-
// reset to desktop when open
|
|
29
|
-
(0, react_2.useEffect)(() => {
|
|
30
|
-
if (configuration) {
|
|
31
|
-
setBlockView('desktop');
|
|
32
|
-
}
|
|
33
|
-
}, [configuration]);
|
|
34
|
-
// helpers
|
|
35
|
-
const onSave = async () => {
|
|
36
|
-
// save config
|
|
37
|
-
configuration === null || configuration === void 0 ? void 0 : configuration.save();
|
|
38
|
-
// wait for page to save
|
|
39
|
-
await (0, rxjs_1.firstValueFrom)(pageController.saved$);
|
|
40
|
-
// complete
|
|
41
|
-
onClose();
|
|
42
|
-
};
|
|
43
|
-
const onChangePanelLayout = async (e) => {
|
|
44
|
-
var _a;
|
|
45
|
-
// skip if there's no layout field (shouldn't happen)
|
|
46
|
-
if (!layoutField) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
// pick new layout
|
|
50
|
-
const { schema: layoutSchema, value: layoutData } = layoutField;
|
|
51
|
-
const selectedLayout = await ((_a = panelLayoutPickerRef.current) === null || _a === void 0 ? void 0 : _a.open({
|
|
52
|
-
anchor: e.currentTarget,
|
|
53
|
-
anchorOffset: 4,
|
|
54
|
-
placement: 'top',
|
|
55
|
-
items: Object.entries(layoutSchema.options).map(([layout, option]) => ({
|
|
56
|
-
id: layout,
|
|
57
|
-
label: option.name
|
|
58
|
-
})),
|
|
59
|
-
selectedItem: layoutData === null || layoutData === void 0 ? void 0 : layoutData.value
|
|
60
|
-
}));
|
|
61
|
-
// update if something was picked
|
|
62
|
-
if (selectedLayout) {
|
|
63
|
-
layoutField.value = funnel_core_1.Schema.EnumField.Value.toData(selectedLayout);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
// render
|
|
67
|
-
const { options: slotOptions = [], currentIndex: slotIndex = 0 } = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.slotState) !== null && _a !== void 0 ? _a : {};
|
|
68
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(core_1.SideSheet, { title: "Block Configuration", size: "xs", backdrop: "glass", open: !!configuration, onSave: onSave, onClose: onClose, disableDismiss: modified, disableSave: !modified || !valid, customActions: (0, jsx_runtime_1.jsx)(core_1.Button, { variant: "secondary", size: "sm", disabled: configuration === null || configuration === void 0 ? void 0 : configuration.isConfigInDefault, onClick: () => configuration === null || configuration === void 0 ? void 0 : configuration.reset(), children: "Reset to Default" }), children: (0, jsx_runtime_1.jsxs)("div", { className: "h-full flex flex-col gap-l6", children: [(0, jsx_runtime_1.jsxs)("section", { className: "grid grid-cols-2 gap-x-l5 gap-y-l4", children: [blocksFields.length > 0 &&
|
|
69
|
-
(0, jsx_runtime_1.jsx)(core_1.FieldErrorController, { children: blocksFields.map(field => (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { className: "col-span-full", field: field, size: "xs" }, field.id)) }), layoutField && layoutField.schema.enum.length > 1 &&
|
|
70
|
-
(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l2", children: [(0, jsx_runtime_1.jsx)(FieldHeader_1.FieldHeader, { label: "Layout", size: "xs" }), (0, jsx_runtime_1.jsx)(core_1.Button, { variant: "secondary", size: "xs", iconLeft: "LayoutTemplate", onClick: onChangePanelLayout, children: "Change" })] }), slotOptions.length > 1 &&
|
|
71
|
-
(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l2", children: [(0, jsx_runtime_1.jsx)(FieldHeader_1.FieldHeader, { label: "Arrangement", size: "xs" }), slotOptions.length === 2
|
|
72
|
-
?
|
|
73
|
-
(0, jsx_runtime_1.jsx)(core_1.Button, { variant: "secondary", size: "xs", iconLeft: "ArrowLeftRight", onClick: () => configuration === null || configuration === void 0 ? void 0 : configuration.gotToNextSlot(), children: "Swap" })
|
|
74
|
-
:
|
|
75
|
-
(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-l4", children: [(0, jsx_runtime_1.jsx)(core_1.Button, { variant: "secondary", size: "xs", onClick: () => configuration === null || configuration === void 0 ? void 0 : configuration.gotToPreviousSlot(), children: (0, jsx_runtime_1.jsx)(core_1.Icon, { variant: "ArrowLeft", size: { size: 16, strokeWidth: 1, absoluteStrokeWidth: true } }) }), (0, jsx_runtime_1.jsxs)("span", { className: "label-xs", children: [slotIndex + 1, " of ", slotOptions.length] }), (0, jsx_runtime_1.jsx)(core_1.Button, { variant: "secondary", size: "xs", onClick: () => configuration === null || configuration === void 0 ? void 0 : configuration.gotToNextSlot(), children: (0, jsx_runtime_1.jsx)(core_1.Icon, { variant: "ArrowRight", size: { size: 16, strokeWidth: 1, absoluteStrokeWidth: true } }) })] })] })] }), (0, jsx_runtime_1.jsx)(core_1.Tabs, { items: blockViews, selectedItem: blockView, onSelect: setBlockView }), (0, jsx_runtime_1.jsx)(react_1.motion.section, { className: "p-l6 bg-surface-placeholder-raised rounded-md", layout: true, children: configuration &&
|
|
76
|
-
(0, jsx_runtime_1.jsx)(BlockPreview_1.BlockPreview, { variant: blockView, configuration: configuration }) }), settingsFields.length > 0 &&
|
|
77
|
-
(0, jsx_runtime_1.jsx)("section", { className: "grid grid-cols-2 auto-rows-auto items-start gap-l6", children: (0, jsx_runtime_1.jsx)(core_1.FieldErrorController, { children: settingsFields.map(field => (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { className: "col-span-2", field: field, size: "xs" }, field.id)) }) })] }) }), (0, jsx_runtime_1.jsx)(core_1.QuickPicker, { ref: panelLayoutPickerRef, variant: "card", title: "Pick Block Layout", description: "Select an available layout for this block.", renderItem: (item) => renderPanelLayoutItem(item) })] }));
|
|
78
|
-
}
|
|
79
|
-
function renderPanelLayoutItem(item) {
|
|
80
|
-
const panel = (className = 'flex-1') => ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('bg-surface-placeholder rounded-[2px]', className) }));
|
|
81
|
-
const panelPaddedX = 'px-l4';
|
|
82
|
-
const panelPaddedY = 'py-l4';
|
|
83
|
-
const panelPadded = (0, classnames_1.default)(panelPaddedX, panelPaddedY);
|
|
84
|
-
const panelGap = 'gap-l1';
|
|
85
|
-
const nestedPanel = (config = {}) => {
|
|
86
|
-
// unpack config
|
|
87
|
-
const { panelClassName, nestedPanelClassName, multipleItems = false } = config;
|
|
88
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)('flex h-full bg-surface-placeholder rounded-[2px]', panelClassName, panelGap, { 'p-l2': multipleItems }), children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('flex-1 bg-surface-placeholder-raised rounded-[2px]', nestedPanelClassName, { 'm-l2': !multipleItems }) }), multipleItems &&
|
|
89
|
-
(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('flex-1 bg-surface-placeholder-raised rounded-[2px]', nestedPanelClassName) })] }));
|
|
90
|
-
};
|
|
91
|
-
switch (item.id) {
|
|
92
|
-
case 'solo':
|
|
93
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('size-full', panelPadded), children: panel('size-full') }));
|
|
94
|
-
case 'stack.v':
|
|
95
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)("flex h-full", panelPadded, panelGap), children: [panel(), panel()] }));
|
|
96
|
-
case 'stack.h':
|
|
97
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)("flex flex-col h-full", panelPadded, panelGap), children: [panel(), panel()] }));
|
|
98
|
-
case 'brick.v':
|
|
99
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)("flex flex-col h-full", panelPadded, panelGap), children: [panel(), panel(), panel()] }));
|
|
100
|
-
case 'brick.t':
|
|
101
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)("flex flex-col h-full", panelPadded, panelGap), children: [panel('flex-1 w-full h-[20px]'), (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)('flex flex-1', panelGap), children: [panel(), panel()] })] }));
|
|
102
|
-
case 'brick.r':
|
|
103
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)('flex h-full', panelPadded, panelGap), children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)('flex h-full flex-1 flex-col', panelGap), children: [panel(), panel()] }), panel('h-full w-[30px]')] }));
|
|
104
|
-
case 'brick.b':
|
|
105
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)("flex flex-col h-full", panelPadded, panelGap), children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)('flex flex-1', panelGap), children: [panel(), panel()] }), panel('flex-1 w-full h-[20px]')] }));
|
|
106
|
-
case 'brick.l':
|
|
107
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)('flex h-full', panelPadded, panelGap), children: [panel('h-full w-[30px]'), (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)('flex h-full flex-1 flex-col', panelGap), children: [panel(), panel()] })] }));
|
|
108
|
-
case 'nested':
|
|
109
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('size-full', panelPadded), children: nestedPanel() }));
|
|
110
|
-
case 'nested.v':
|
|
111
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('size-full', panelPadded), children: nestedPanel({ panelClassName: 'flex-col', multipleItems: true }) }));
|
|
112
|
-
case 'nested.h':
|
|
113
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('size-full', panelPadded), children: nestedPanel({ multipleItems: true }) }));
|
|
114
|
-
case 'nested.t':
|
|
115
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)("flex h-full flex-col", panelPadded, panelGap), children: [nestedPanel({ panelClassName: 'flex-1' }), panel()] }));
|
|
116
|
-
case 'nested.r':
|
|
117
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)("flex h-full", panelPadded, panelGap), children: [panel(), nestedPanel({ panelClassName: 'flex-1' })] }));
|
|
118
|
-
case 'nested.b':
|
|
119
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)("flex h-full flex-col", panelPadded, panelGap), children: [panel(), nestedPanel({ panelClassName: 'flex-1' })] }));
|
|
120
|
-
case 'nested.l':
|
|
121
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)("flex h-full", panelPadded, panelGap), children: [nestedPanel({ panelClassName: 'flex-1' }), panel()] }));
|
|
122
|
-
default:
|
|
123
|
-
return ((0, jsx_runtime_1.jsx)("div", { children: item.id }));
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
const blockViews = [
|
|
127
|
-
{ id: 'desktop', label: 'Desktop' },
|
|
128
|
-
{ id: 'mobile', label: 'Mobile' },
|
|
129
|
-
];
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BlockConfiguration } from '../../../core';
|
|
2
|
-
export declare function BlockPreview({ className, variant, configuration }: BlockPreview.Props): import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
export declare namespace BlockPreview {
|
|
4
|
-
type Variant = 'desktop' | 'mobile';
|
|
5
|
-
type Props = {
|
|
6
|
-
className?: string;
|
|
7
|
-
variant: Variant;
|
|
8
|
-
configuration: BlockConfiguration;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BlockView = void 0;
|
|
4
|
-
// extension
|
|
5
|
-
var BlockView;
|
|
6
|
-
(function (BlockView) {
|
|
7
|
-
// values
|
|
8
|
-
BlockView.values = ['desktop', 'mobile'];
|
|
9
|
-
})(BlockView || (exports.BlockView = BlockView = {}));
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Callback } from '@nascentdigital/funnel-core';
|
|
2
|
-
import { BlockConfiguration } from '../../../core';
|
|
3
|
-
export declare function LegacyBlockConfigEditor({ configuration, onClose }: LegacyBlockConfigEditor.Props): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export declare namespace LegacyBlockConfigEditor {
|
|
5
|
-
type Props = {
|
|
6
|
-
configuration?: BlockConfiguration;
|
|
7
|
-
onClose: Callback.Void;
|
|
8
|
-
};
|
|
9
|
-
}
|