@phis/ui 0.4.4 → 0.4.5
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/README.md +9 -3
- package/cms/plugins.d.ts +1 -0
- package/cms/plugins.js +2 -0
- package/components/cms/phi-cms-root-layout.js +30 -1
- package/components/controls/phi-background-control.d.ts +6 -1
- package/components/controls/phi-background-control.js +12 -4
- package/components/controls/phi-button-control.d.ts +13 -1
- package/components/controls/phi-button-control.js +21 -3
- package/components/controls/phi-dropdown-control.js +2 -2
- package/components/controls/phi-media-asset-tile-control.js +10 -10
- package/components/controls/phi-progress-control.d.ts +10 -2
- package/components/controls/phi-progress-control.js +6 -2
- package/components/controls/phi-ribbon-control.d.ts +4 -1
- package/components/controls/phi-ribbon-control.js +5 -3
- package/components/controls/phi-ribbon-wrap-control.d.ts +7 -1
- package/components/controls/phi-ribbon-wrap-control.js +8 -2
- package/components/controls/phi-segmented-control.d.ts +4 -1
- package/components/controls/phi-segmented-control.js +13 -2
- package/components/controls/phi-surface-control.d.ts +2 -0
- package/components/controls/phi-surface-control.js +16 -1
- package/components/controls/phi-switch-control.d.ts +4 -1
- package/components/controls/phi-switch-control.js +8 -2
- package/components/controls/phi-tag-control.d.ts +4 -1
- package/components/controls/phi-tag-control.js +11 -3
- package/components/layouts/phi-layout-view-model.js +10 -1
- package/components/regions/clients/cms-region-container-client.js +11 -1
- package/components/regions/phi-cms-region-container.js +5 -1
- package/components/regions/phi-cms-region-shell.d.ts +10 -0
- package/components/regions/phi-cms-region-shell.js +53 -7
- package/components/root/phi-root-layout.d.ts +1 -0
- package/components/root/phi-root-layout.js +1 -0
- package/components/root/phi-root-theme-resolver.js +12 -1
- package/components/root/phi-shell-chrome-overlay.d.ts +6 -0
- package/components/root/phi-shell-chrome-overlay.js +7 -1
- package/components/runtime/runtime-module-context.d.ts +12 -1
- package/components/runtime/runtime-module-context.js +6 -1
- package/components/shell/phi-cms-shell.d.ts +7 -1
- package/components/shell/phi-cms-shell.js +4 -2
- package/components/shell/use-phi-shell-header-bands.d.ts +5 -0
- package/components/shell/use-phi-shell-header-bands.js +64 -0
- package/components/shell/use-phi-shell-sticky-bottom.d.ts +18 -0
- package/components/shell/use-phi-shell-sticky-bottom.js +54 -0
- package/components/tables/client/phi-table-binding.d.ts +1 -0
- package/components/tables/client/phi-table-binding.js +22 -3
- package/components/trees/client/phi-tree-binding.d.ts +1 -0
- package/components/trees/client/phi-tree-binding.js +11 -2
- package/components/widgets/client/shared/phi-collection-provider.js +4 -3
- package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
- package/components/widgets/client/shared/phi-collection-view-binding.js +16 -2
- package/components/widgets/client/shared/phi-command-buttons.js +6 -2
- package/components/widgets/config/background.d.ts +20 -0
- package/components/widgets/config/background.js +44 -2
- package/components/widgets/config/button-variant.d.ts +22 -4
- package/components/widgets/config/button-variant.js +24 -5
- package/components/widgets/config/common-action-field.d.ts +1 -1
- package/components/widgets/config/parser-primitives.js +4 -2
- package/components/widgets/config/theme-gradient.d.ts +11 -0
- package/components/widgets/config/theme-gradient.js +12 -0
- package/components/widgets/label-sets/background.js +2 -0
- package/components/widgets/label-sets/geometry.js +2 -0
- package/components/widgets/label-sets/inspector.js +4 -0
- package/components/widgets/label-types/background.d.ts +1 -0
- package/components/widgets/label-types/background.js +1 -0
- package/components/widgets/label-types/common-controls.js +2 -2
- package/components/widgets/label-types/geometry.d.ts +1 -0
- package/components/widgets/label-types/geometry.js +1 -0
- package/components/widgets/label-types/inspector.d.ts +4 -0
- package/components/widgets/label-types/inspector.js +2 -0
- package/components/widgets/shared/card-body-client.d.ts +11 -0
- package/components/widgets/shared/card-body-client.js +32 -4
- package/components/widgets/shared/collection-source-failure.d.ts +26 -0
- package/components/widgets/shared/collection-source-failure.js +42 -0
- package/components/widgets/shared/markdown-render.js +16 -3
- package/components/widgets/shared/widget-failure-client.d.ts +10 -0
- package/components/widgets/shared/widget-failure-client.js +20 -0
- package/components/widgets/shared/widget-failure.d.ts +31 -0
- package/components/widgets/shared/widget-failure.js +20 -0
- package/components/widgets/shared/widget-failure.server.d.ts +9 -0
- package/components/widgets/shared/widget-failure.server.js +12 -0
- package/gateway/dashboard-card-memo.d.ts +3 -0
- package/gateway/dashboard-card-memo.js +25 -0
- package/helpers/cms-region-keys.d.ts +1 -1
- package/helpers/layout-style.d.ts +8 -4
- package/helpers/layout-style.js +3 -2
- package/helpers/mode-paint.d.ts +4 -0
- package/helpers/mode-paint.js +47 -0
- package/helpers/surface-style.js +33 -11
- package/module-dashboard-cards.d.ts +1 -0
- package/module-dashboard-cards.js +1 -0
- package/module-records.d.ts +7 -0
- package/module-records.js +6 -0
- package/package.json +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-surface-labels.js +1 -0
- package/plugins/runtime-modules/builder/clients/region-inspector.js +47 -2
- package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +1 -1
- package/plugins/runtime-modules/builder/controller/draft-command-controller.js +7 -4
- package/plugins/runtime-modules/builder/controller/page-controller.js +7 -0
- package/plugins/runtime-modules/builder/persistence.d.ts +3 -0
- package/plugins/runtime-modules/builder/persistence.js +9 -1
- package/plugins/runtime-modules/core/content-entries/record-source.server.d.ts +3 -1
- package/plugins/runtime-modules/core/content-entries/record-source.server.js +7 -4
- package/plugins/runtime-modules/core/widgets/button/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/button/config.d.ts +40 -4
- package/plugins/runtime-modules/core/widgets/button/config.js +12 -0
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +94 -0
- package/plugins/runtime-modules/core/widgets/card/config.js +38 -0
- package/plugins/runtime-modules/core/widgets/card/editor.js +8 -1
- package/plugins/runtime-modules/core/widgets/card/server.js +4 -0
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +10 -3
- package/plugins/runtime-modules/core/widgets/collection-view/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/client.d.ts +3 -0
- package/plugins/runtime-modules/core/widgets/collection-view/client.js +47 -11
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.js +2 -2
- package/plugins/runtime-modules/core/widgets/collection-view/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +6 -1
- package/plugins/runtime-modules/core/widgets/collection-view/server.js +21 -3
- package/plugins/runtime-modules/core/widgets/entry-detail/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-detail/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/entry-detail/server.js +5 -2
- package/plugins/runtime-modules/core/widgets/entry-header/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-header/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/entry-header/server.js +5 -2
- package/plugins/runtime-modules/core/widgets/entry-list/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-list/server.d.ts +6 -3
- package/plugins/runtime-modules/core/widgets/entry-list/server.js +13 -6
- package/plugins/runtime-modules/core/widgets/gallery/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +5 -3
- package/plugins/runtime-modules/core/widgets/gallery/server.js +8 -6
- package/plugins/runtime-modules/core/widgets/record/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/record/client.js +8 -3
- package/plugins/runtime-modules/core/widgets/record/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/record/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/record/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/segmented/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/segmented/config.d.ts +21 -1
- package/plugins/runtime-modules/core/widgets/segmented/config.js +11 -1
- package/plugins/runtime-modules/core/widgets/switch/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/switch/config.d.ts +19 -0
- package/plugins/runtime-modules/core/widgets/switch/config.js +11 -0
- package/plugins/runtime-modules/core/widgets/table/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/table/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +16 -3
- package/plugins/runtime-modules/core/widgets/table/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/table/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/table/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/table/static-resource-editor.js +2 -1
- package/plugins/runtime-modules/core/widgets/timeline/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/timeline/client.d.ts +1 -3
- package/plugins/runtime-modules/core/widgets/timeline/client.js +14 -4
- package/plugins/runtime-modules/core/widgets/tree/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/tree/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/tree/client.js +13 -2
- package/plugins/runtime-modules/core/widgets/tree/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/tree/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/tree/server.js +2 -2
- package/plugins/runtime-modules/theme/presets.d.ts +9 -1
- package/plugins/runtime-modules/theme/tour.d.ts +9 -1
- package/plugins/runtime-modules/theme/tour.js +10 -1
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +138 -7
- package/runtime-data-provider-client.d.ts +2 -0
- package/runtime-data-provider-client.js +7 -0
- package/styles/controls.css +10 -5
- package/styles/gradients.css +101 -0
- package/styles/root.css +18 -0
- package/styles/shell.css +64 -0
- package/theme/phi-button-shadow.d.ts +6 -0
- package/theme/phi-theme-gradients.d.ts +96 -0
- package/theme/phi-theme-gradients.js +245 -0
- package/theme/phi-theme-presets.d.ts +3 -0
- package/theme/phi-theme-presets.js +3 -0
- package/theme/phi-theme-tokens.d.ts +5 -1
- package/theme/phi-theme-tokens.js +14 -0
- package/types/cms-presets.d.ts +7 -0
- package/types/core-widget-placements.d.ts +3 -0
- package/types/layout-style.d.ts +9 -8
- package/types/layout-style.js +9 -8
- package/types/surface.d.ts +4 -0
- package/types/surface.js +4 -0
- package/types.d.ts +1 -1
- package/types.js +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { PhiSurfaceControl } from "../../../../components/controls/phi-surface-control";
|
|
4
4
|
import { PhiGeometryControl } from "../../../../components/controls/phi-geometry-control";
|
|
5
5
|
import { PhiViewportVisibilityControl } from "../../../../components/controls/phi-viewport-visibility-control";
|
|
@@ -10,6 +10,7 @@ import { normalizePhiPaddingWidgetConfig, } from "../../../../types/cms-config";
|
|
|
10
10
|
import { PhiTypographyControl } from "../../../../components/controls/phi-typography-control";
|
|
11
11
|
import { PHI_INSPECTOR_WIDGET_DEFAULT_LABELS } from "../../../../components/widgets/label-types/inspector";
|
|
12
12
|
import { PhiRegionVisibilityFields } from "./region-visibility-fields";
|
|
13
|
+
import { renderPhiInspectorConfigField } from "./inspector-config-field";
|
|
13
14
|
const PHI_GAP_SM = "var(--ant-padding-sm)";
|
|
14
15
|
const REGION_PADDING_KEYS = [
|
|
15
16
|
"padding",
|
|
@@ -33,6 +34,18 @@ function patchRegionConfigPadding(regionConfig, padding) {
|
|
|
33
34
|
export function PhiDeveloperBuilderRegionInspectorWidgetClient({ section, builderMode = "editor", selectedStructureNodeKind = null, selectedRegionKey = null, currentDraft = null, onDraftChange, geometryLabels, backgroundLabels, borderLabels, colorPickerLabels, paddingLabels, surfaceLabels, visibilityLabels = PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.regionVisibility, renderMediaPicker, }) {
|
|
34
35
|
const isPreviewMode = builderMode === "preview";
|
|
35
36
|
const effectiveDraft = currentDraft ?? (selectedRegionKey ? getDefaultRegionDraft(selectedRegionKey) : null);
|
|
37
|
+
/*
|
|
38
|
+
* Which edge the selected Region can stick to, if any. The Header bands and the Siders stick at the top;
|
|
39
|
+
* `footer_bottom` sticks at the bottom (`phiCmsRegionFooterSticks`); every other Region ignores the flag,
|
|
40
|
+
* so it is not offered there.
|
|
41
|
+
*/
|
|
42
|
+
const stickyEdge = selectedRegionKey == null
|
|
43
|
+
? null
|
|
44
|
+
: selectedRegionKey === "footer_bottom"
|
|
45
|
+
? "bottom"
|
|
46
|
+
: selectedRegionKey.startsWith("header_") || selectedRegionKey.startsWith("sider_")
|
|
47
|
+
? "top"
|
|
48
|
+
: null;
|
|
36
49
|
function updateDraft(patch) {
|
|
37
50
|
if (!selectedRegionKey || !effectiveDraft || !onDraftChange) {
|
|
38
51
|
return;
|
|
@@ -43,7 +56,39 @@ export function PhiDeveloperBuilderRegionInspectorWidgetClient({ section, builde
|
|
|
43
56
|
{
|
|
44
57
|
key: "geometry",
|
|
45
58
|
title: "Geometry",
|
|
46
|
-
children: (
|
|
59
|
+
children: (_jsxs("div", { style: { display: "grid", gap: PHI_GAP_SM, width: "100%" }, children: [_jsx(PhiGeometryControl, { mode: "control", disabled: isPreviewMode, showViewport: false, showSticky: stickyEdge !== null, showOffsetTop: stickyEdge === "top", value: effectiveDraft, onChange: (geometry) => updateDraft(geometry), labels: geometryLabels }), stickyEdge === "bottom" ? renderPhiInspectorConfigField({
|
|
60
|
+
field: { key: "offsetBottom", type: "length", label: geometryLabels?.fields.offsetBottom ?? "Offset bottom", min: 0 },
|
|
61
|
+
value: effectiveDraft.regionConfig?.offsetBottom,
|
|
62
|
+
defaultValue: undefined,
|
|
63
|
+
config: effectiveDraft.regionConfig ?? {},
|
|
64
|
+
disabled: isPreviewMode || !onDraftChange || !effectiveDraft.sticky,
|
|
65
|
+
onChange: (patch) => {
|
|
66
|
+
const next = { ...(effectiveDraft.regionConfig ?? {}) };
|
|
67
|
+
if (patch.offsetBottom == null || patch.offsetBottom === 0) {
|
|
68
|
+
delete next.offsetBottom;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
next.offsetBottom = patch.offsetBottom;
|
|
72
|
+
}
|
|
73
|
+
updateDraft({ regionConfig: next });
|
|
74
|
+
},
|
|
75
|
+
}) : null, selectedRegionKey === "content" ? renderPhiInspectorConfigField({
|
|
76
|
+
field: { key: "heroOverlap", type: "length", label: visibilityLabels.heroOverlap, min: 0 },
|
|
77
|
+
value: effectiveDraft.regionConfig?.heroOverlap,
|
|
78
|
+
defaultValue: undefined,
|
|
79
|
+
config: effectiveDraft.regionConfig ?? {},
|
|
80
|
+
disabled: isPreviewMode || !onDraftChange,
|
|
81
|
+
onChange: (patch) => {
|
|
82
|
+
const next = { ...(effectiveDraft.regionConfig ?? {}) };
|
|
83
|
+
if (patch.heroOverlap == null || patch.heroOverlap === 0) {
|
|
84
|
+
delete next.heroOverlap;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
next.heroOverlap = patch.heroOverlap;
|
|
88
|
+
}
|
|
89
|
+
updateDraft({ regionConfig: next });
|
|
90
|
+
},
|
|
91
|
+
}) : null] })),
|
|
47
92
|
},
|
|
48
93
|
{
|
|
49
94
|
key: "viewport",
|
|
@@ -44,5 +44,5 @@ export function PhiBuilderRuntimeModuleAuthoringBoundary({ targetArea, catalog,
|
|
|
44
44
|
targetArea,
|
|
45
45
|
videoProviderDescriptors,
|
|
46
46
|
]);
|
|
47
|
-
return (_jsx(PhiRuntimeModuleProvider, { moduleIds: moduleIds, widgetTypes: widgetDefinitions.map((definition) => definition.type), layoutTypes: layoutTypes, widgetDefinitions: widgetDefinitions, dataProviderDescriptors: dataProviderDescriptors, calendarAdapterDescriptors: calendarAdapterDescriptors, videoProviderDescriptors: videoProviderDescriptors, children: _jsx(PhiRuntimeModuleAuthoringDataProviderHost, { providerKeys: authoringDataProviderKeys, children: _jsx(PhiRuntimeModuleDataProviderClientHost, { providerKeys: pickerDataProviderKeys, mode: "live", children: _jsx(PhiRuntimeModuleAuthoringClientHost, { moduleIds: moduleIds, children: children }) }) }) }));
|
|
47
|
+
return (_jsx(PhiRuntimeModuleProvider, { moduleIds: moduleIds, widgetTypes: widgetDefinitions.map((definition) => definition.type), layoutTypes: layoutTypes, widgetDefinitions: widgetDefinitions, dataProviderDescriptors: dataProviderDescriptors, calendarAdapterDescriptors: calendarAdapterDescriptors, videoProviderDescriptors: videoProviderDescriptors, collectionItemRendererDescriptors: collectionItemRendererDescriptors, children: _jsx(PhiRuntimeModuleAuthoringDataProviderHost, { providerKeys: authoringDataProviderKeys, children: _jsx(PhiRuntimeModuleDataProviderClientHost, { providerKeys: pickerDataProviderKeys, mode: "live", children: _jsx(PhiRuntimeModuleAuthoringClientHost, { moduleIds: moduleIds, children: children }) }) }) }));
|
|
48
48
|
}
|
|
@@ -269,9 +269,10 @@ export function usePhiBuilderDraftCommandController({ effectiveArea, effectiveNa
|
|
|
269
269
|
pageKey: effectivePageKey,
|
|
270
270
|
};
|
|
271
271
|
/*
|
|
272
|
-
* A preview is of the saved draft or
|
|
273
|
-
* the
|
|
274
|
-
*
|
|
272
|
+
* A preview is of the saved draft, or -- when nothing is saved -- of what is published, which is then
|
|
273
|
+
* what the page is. A read that failed is the command's error rather than the live page: the author
|
|
274
|
+
* would take what is published for a draft that may exist. What the preview leaves out is said
|
|
275
|
+
* before it opens, and which of the two it shows.
|
|
275
276
|
*/
|
|
276
277
|
const result = await previewPhiDeveloperBuilderDraft(state, workspaceKind, {
|
|
277
278
|
pathname,
|
|
@@ -280,7 +281,9 @@ export function usePhiBuilderDraftCommandController({ effectiveArea, effectiveNa
|
|
|
280
281
|
if (hasUnsavedChanges) {
|
|
281
282
|
showMessage({
|
|
282
283
|
level: "warning",
|
|
283
|
-
content:
|
|
284
|
+
content: result.revisionId == null
|
|
285
|
+
? "Nothing is saved yet, so the preview shows the published page. Save to include your changes."
|
|
286
|
+
: "The preview shows the last saved draft. Save to include your latest changes.",
|
|
284
287
|
});
|
|
285
288
|
}
|
|
286
289
|
window.open(result.previewHref, "_blank", "noopener,noreferrer");
|
|
@@ -13,6 +13,7 @@ import { collectPhiDeveloperBuilderPageKeys, collectPhiDeveloperBuilderPageStora
|
|
|
13
13
|
import { createPhiDeveloperBuilderInitialPageDrafts, createPhiDeveloperBuilderPageDraft, PhiBuilderPageExistsError, } from "../persistence";
|
|
14
14
|
import { describePhiBuilderPageAddressConflict, findPhiBuilderSitePageAddressConflict, } from "../page-address-rule";
|
|
15
15
|
import { PHI_BUILDER_AREA_SEARCH_PARAM, PHI_BUILDER_PAGE_SEARCH_PARAM, } from "../../../../helpers/cms-scope-search-params";
|
|
16
|
+
import { PHI_BUILDER_PREVIEW_SEARCH_PARAM } from "../preview-transport";
|
|
16
17
|
import { mergePhiDeveloperRegionDrafts, openPhiBuilderPage, setPhiBuilderPageMetaDraft, startPhiBuilderNewPageDrafts, getPhiDeveloperBuilderStateSnapshot, } from "../developer-workspace-store";
|
|
17
18
|
import { getPhiBuilderRegionDraftKey } from "../region-keys";
|
|
18
19
|
import { capturePhiBuilderWorkspaceHistoryState, createPhiBuilderHistoryContext, phiBuilderHistory, } from "../history";
|
|
@@ -67,6 +68,12 @@ export function usePhiBuilderPageController({ emitCapability, effectiveArea, eff
|
|
|
67
68
|
const nextSearchParams = new URLSearchParams(searchParams.toString());
|
|
68
69
|
nextSearchParams.set(PHI_BUILDER_AREA_SEARCH_PARAM, effectiveArea);
|
|
69
70
|
nextSearchParams.set(PHI_BUILDER_PAGE_SEARCH_PARAM, pageKey);
|
|
71
|
+
/*
|
|
72
|
+
* Another Page opens in the Editor. The preview was of the Page that was open -- its snapshot holds
|
|
73
|
+
* that Page's drafts -- so carrying it over would show the new Page in a mode it was never put in,
|
|
74
|
+
* from a snapshot that is not its own.
|
|
75
|
+
*/
|
|
76
|
+
nextSearchParams.delete(PHI_BUILDER_PREVIEW_SEARCH_PARAM);
|
|
70
77
|
router.replace(`${pathname}?${nextSearchParams.toString()}`, { scroll: false });
|
|
71
78
|
}
|
|
72
79
|
}
|
|
@@ -813,8 +813,16 @@ export async function previewPhiDeveloperBuilderDraft(state, workspaceKind, opti
|
|
|
813
813
|
}
|
|
814
814
|
: { path: resolvePhiBuilderCmsStoragePath(area, pageKey, pages) }),
|
|
815
815
|
});
|
|
816
|
+
/*
|
|
817
|
+
* No saved draft is not a failure: what the preview has to show is then what is published, so it
|
|
818
|
+
* opens the live page. A read that failed still throws -- that is not knowing, which is different
|
|
819
|
+
* from there being nothing.
|
|
820
|
+
*/
|
|
816
821
|
if (!draft || !Number.isInteger(draft.revisionId) || draft.revisionId <= 0) {
|
|
817
|
-
|
|
822
|
+
return {
|
|
823
|
+
revisionId: null,
|
|
824
|
+
previewHref: buildPhiBuilderLiveHref(area, pageKey, pages, workspaceKind),
|
|
825
|
+
};
|
|
818
826
|
}
|
|
819
827
|
return {
|
|
820
828
|
revisionId: draft.revisionId,
|
|
@@ -6,7 +6,8 @@ import type { PhiRuntimeDataProviderBinding } from "../../../../types/runtime-da
|
|
|
6
6
|
/**
|
|
7
7
|
* The entry an entry Widget is bound to, as the three of them draw it: the record, none by that address,
|
|
8
8
|
* or none to be had. A record of another shape -- a binding to some other Module's Provider -- is no entry,
|
|
9
|
-
* and is said as unavailable rather than drawn as an empty one.
|
|
9
|
+
* and is said as unavailable rather than drawn as an empty one. An unavailable one says why, which is
|
|
10
|
+
* what the author reads in the Builder and the operator in the log.
|
|
10
11
|
*/
|
|
11
12
|
export declare function readPhiBoundContentEntry(input: {
|
|
12
13
|
registry: Pick<PhiCmsRuntimeRenderRegistry, "recordProviderLoadersByKey"> | undefined;
|
|
@@ -19,4 +20,5 @@ export declare function readPhiBoundContentEntry(input: {
|
|
|
19
20
|
status: "missing";
|
|
20
21
|
} | {
|
|
21
22
|
status: "unavailable";
|
|
23
|
+
reason: string;
|
|
22
24
|
}>;
|
|
@@ -4,16 +4,19 @@ import { readPhiContentEntryRecord } from "../../../../types/content-entries";
|
|
|
4
4
|
/**
|
|
5
5
|
* The entry an entry Widget is bound to, as the three of them draw it: the record, none by that address,
|
|
6
6
|
* or none to be had. A record of another shape -- a binding to some other Module's Provider -- is no entry,
|
|
7
|
-
* and is said as unavailable rather than drawn as an empty one.
|
|
7
|
+
* and is said as unavailable rather than drawn as an empty one. An unavailable one says why, which is
|
|
8
|
+
* what the author reads in the Builder and the operator in the log.
|
|
8
9
|
*/
|
|
9
10
|
export async function readPhiBoundContentEntry(input) {
|
|
10
11
|
if (!input.registry) {
|
|
11
|
-
return { status: "unavailable" };
|
|
12
|
+
return { status: "unavailable", reason: "No record providers are available outside a page render." };
|
|
12
13
|
}
|
|
13
14
|
const result = await resolvePhiRecordSource({ ...input, registry: input.registry });
|
|
14
15
|
if (result.status !== "ok") {
|
|
15
|
-
return result
|
|
16
|
+
return result;
|
|
16
17
|
}
|
|
17
18
|
const record = readPhiContentEntryRecord(result.record);
|
|
18
|
-
return record
|
|
19
|
+
return record
|
|
20
|
+
? { status: "ok", record }
|
|
21
|
+
: { status: "unavailable", reason: `The record bound from "${input.binding.providerKey}" is not a content entry.` };
|
|
19
22
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { resolvePhiButtonVariantPresentation } from "../../../../../components/widgets/config/button-variant";
|
|
4
4
|
import { usePhiControlSignalController } from "../../../../../components/widgets/client/shared/phi-control-signals";
|
|
5
5
|
import { usePhiControlBadgeController } from "../../../../../components/widgets/client/shared/phi-control-badge";
|
|
6
6
|
import { resolvePhiButtonIcon } from "../../../../../components/widgets/client/shared/phi-button-icons";
|
|
@@ -57,7 +57,7 @@ export function PhiButtonWidget({ config, labels, link, disabled, signalsEnabled
|
|
|
57
57
|
const tooltip = config?.tooltip;
|
|
58
58
|
return (_jsx(PhiButtonControl, { label: label, ...(label ? {} : { ariaLabel: tooltip ?? action?.label }), ...(link && !config?.signalRoutes?.emits?.length
|
|
59
59
|
? { href: link.href, newTab: link.newTab, external: link.external }
|
|
60
|
-
: {}), tooltip: tooltip,
|
|
60
|
+
: {}), tooltip: tooltip, ...resolvePhiButtonVariantPresentation(action ? action.variant : config?.variant, config?.gradient), danger: action ? action.danger === true : config?.danger === true, disabled: resolvedDisabled, size: config?.controlSize, icon: icon, onClick: publish, badge: {
|
|
61
61
|
enabled: badge.enabled,
|
|
62
62
|
value: badge.visible ? badge.value : 0,
|
|
63
63
|
color: badge.color,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type PhiThemeGradientKey } from "../../../../../theme/phi-theme-gradients";
|
|
1
2
|
import { type PhiButtonVariant } from "../../../../../components/widgets/config/button-variant";
|
|
2
3
|
import { type PhiCommonControlActionKey } from "../../../../../components/widgets/label-types/common-controls";
|
|
3
4
|
import { type PhiLinkTarget } from "../../../../../types/references";
|
|
@@ -15,6 +16,8 @@ export type PhiButtonWidgetConfig = PhiCmsWidgetConfigBase & PhiControlBadgeConf
|
|
|
15
16
|
icon?: string;
|
|
16
17
|
value?: string;
|
|
17
18
|
variant?: PhiButtonVariant;
|
|
19
|
+
/** The Theme gradient slot a `gradient` Button is filled with; absent, the first. */
|
|
20
|
+
gradient?: PhiThemeGradientKey;
|
|
18
21
|
/**
|
|
19
22
|
* Where it leads, for a Button that is a way somewhere rather than a command.
|
|
20
23
|
*
|
|
@@ -146,38 +149,69 @@ export declare const PHI_BUTTON_WIDGET_DEFINITION: {
|
|
|
146
149
|
} | {
|
|
147
150
|
readonly value: "link";
|
|
148
151
|
readonly label: "Link";
|
|
152
|
+
} | {
|
|
153
|
+
readonly value: "gradient";
|
|
154
|
+
readonly label: "Gradient";
|
|
155
|
+
} | {
|
|
156
|
+
readonly value: "glass";
|
|
157
|
+
readonly label: "Glass";
|
|
149
158
|
})[];
|
|
159
|
+
description?: undefined;
|
|
160
|
+
placeholder?: undefined;
|
|
161
|
+
visibleWhen?: undefined;
|
|
162
|
+
emptyValue?: undefined;
|
|
163
|
+
editorPlacement?: undefined;
|
|
164
|
+
heading?: undefined;
|
|
165
|
+
} | {
|
|
166
|
+
key: string;
|
|
167
|
+
type: "choice";
|
|
168
|
+
label: string;
|
|
169
|
+
description: string;
|
|
170
|
+
options: {
|
|
171
|
+
value: "gradient1" | "gradient2" | "gradient3";
|
|
172
|
+
label: string;
|
|
173
|
+
}[];
|
|
174
|
+
placeholder: string;
|
|
175
|
+
visibleWhen: {
|
|
176
|
+
field: string;
|
|
177
|
+
equals: string;
|
|
178
|
+
};
|
|
150
179
|
emptyValue?: undefined;
|
|
151
180
|
editorPlacement?: undefined;
|
|
152
181
|
heading?: undefined;
|
|
153
|
-
visibleWhen?: undefined;
|
|
154
182
|
} | {
|
|
155
183
|
key: string;
|
|
156
184
|
type: "string";
|
|
157
185
|
label: string;
|
|
158
186
|
emptyValue: "";
|
|
159
187
|
options?: undefined;
|
|
188
|
+
description?: undefined;
|
|
189
|
+
placeholder?: undefined;
|
|
190
|
+
visibleWhen?: undefined;
|
|
160
191
|
editorPlacement?: undefined;
|
|
161
192
|
heading?: undefined;
|
|
162
|
-
visibleWhen?: undefined;
|
|
163
193
|
} | {
|
|
164
194
|
key: string;
|
|
165
195
|
type: "string";
|
|
166
196
|
label: string;
|
|
167
197
|
options?: undefined;
|
|
198
|
+
description?: undefined;
|
|
199
|
+
placeholder?: undefined;
|
|
200
|
+
visibleWhen?: undefined;
|
|
168
201
|
emptyValue?: undefined;
|
|
169
202
|
editorPlacement?: undefined;
|
|
170
203
|
heading?: undefined;
|
|
171
|
-
visibleWhen?: undefined;
|
|
172
204
|
} | {
|
|
173
205
|
key: string;
|
|
174
206
|
type: "icon";
|
|
175
207
|
label: string;
|
|
176
208
|
editorPlacement: "toolbar";
|
|
177
209
|
options?: undefined;
|
|
210
|
+
description?: undefined;
|
|
211
|
+
placeholder?: undefined;
|
|
212
|
+
visibleWhen?: undefined;
|
|
178
213
|
emptyValue?: undefined;
|
|
179
214
|
heading?: undefined;
|
|
180
|
-
visibleWhen?: undefined;
|
|
181
215
|
} | {
|
|
182
216
|
key: string;
|
|
183
217
|
type: "link-target";
|
|
@@ -188,6 +222,8 @@ export declare const PHI_BUTTON_WIDGET_DEFINITION: {
|
|
|
188
222
|
equals: null;
|
|
189
223
|
};
|
|
190
224
|
options?: undefined;
|
|
225
|
+
description?: undefined;
|
|
226
|
+
placeholder?: undefined;
|
|
191
227
|
emptyValue?: undefined;
|
|
192
228
|
editorPlacement?: undefined;
|
|
193
229
|
})[];
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widget-types";
|
|
2
|
+
import { readPhiThemeGradientKey } from "../../../../../theme/phi-theme-gradients";
|
|
3
|
+
import { PHI_THEME_GRADIENT_FIELD_OPTIONS } from "../../../../../components/widgets/config/theme-gradient";
|
|
2
4
|
import { PHI_BUTTON_VARIANT_FIELD_OPTIONS, readPhiButtonVariant, } from "../../../../../components/widgets/config/button-variant";
|
|
3
5
|
import { PHI_SIGNAL_VALUE_SCHEMAS } from "../../../../../types/signals";
|
|
4
6
|
import { createPhiCommonActionField, readPhiControlLabel, } from "../../../../../components/widgets/config/common-action-field";
|
|
@@ -21,6 +23,7 @@ function parsePhiButtonWidgetConfig(config) {
|
|
|
21
23
|
icon: readString(config.icon),
|
|
22
24
|
value: readString(config.value),
|
|
23
25
|
variant: readPhiButtonVariant(config.variant),
|
|
26
|
+
gradient: readPhiThemeGradientKey(config.gradient),
|
|
24
27
|
linkTarget: readPhiLinkTarget(config.linkTarget) ?? undefined,
|
|
25
28
|
danger: readBoolean(config.danger),
|
|
26
29
|
};
|
|
@@ -71,6 +74,15 @@ export const PHI_BUTTON_WIDGET_DEFINITION = {
|
|
|
71
74
|
label: "Variant",
|
|
72
75
|
options: [...PHI_BUTTON_VARIANT_FIELD_OPTIONS],
|
|
73
76
|
},
|
|
77
|
+
{
|
|
78
|
+
key: "gradient",
|
|
79
|
+
type: "choice",
|
|
80
|
+
label: "Gradient",
|
|
81
|
+
description: "Which of the Theme's gradients fills the Button. The Theme decides how each one looks, per mode.",
|
|
82
|
+
options: [...PHI_THEME_GRADIENT_FIELD_OPTIONS],
|
|
83
|
+
placeholder: "Gradient 1",
|
|
84
|
+
visibleWhen: { field: "variant", equals: "gradient" },
|
|
85
|
+
},
|
|
74
86
|
{ key: "label", type: "string", label: "Label", emptyValue: "" },
|
|
75
87
|
{ key: "tooltip", type: "string", label: "Tooltip" },
|
|
76
88
|
{ key: "icon", type: "icon", label: "Icon", editorPlacement: "toolbar" },
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { type PhiThemeGradientKey } from "../../../../../theme/phi-theme-gradients";
|
|
2
|
+
import { type PhiButtonVariant } from "../../../../../components/widgets/config/button-variant";
|
|
1
3
|
import type { PhiCmsConfigField } from "../../../../../types/cms-plugins";
|
|
2
4
|
import type { PhiImageAssetVariantKeyValue } from "../../../../../types/media";
|
|
3
5
|
import { type PhiLinkTarget } from "../../../../../types/references";
|
|
6
|
+
import { type PhiBackgroundOverlay } from "../../../../../components/widgets/config/background";
|
|
4
7
|
import { type PhiBulletListEntry, type PhiBulletListStyle } from "../../../../../components/widgets/shared/bullet-list-vocabulary";
|
|
5
8
|
import { type PhiCardBillingPeriod, type PhiCardHeadingLevel, type PhiCardHoverEffect, type PhiCardIconPlacement, type PhiCardTextAlign, type PhiCardBadgeStyle, type PhiCardVariant, type PhiCardWidgetBody } from "../../../../../components/widgets/shared/card-vocabulary";
|
|
6
9
|
import { type PhiSignalRouteSet } from "../../../../../types/signals";
|
|
@@ -29,6 +32,8 @@ export type PhiCmsCardWidgetConfig = PhiCmsWidgetConfigBase & PhiCardImageSource
|
|
|
29
32
|
badgeColor?: string;
|
|
30
33
|
/** How the badge is drawn (`PHI_CARD_BADGE_STYLES`); absent, `none`. */
|
|
31
34
|
badgeStyle?: PhiCardBadgeStyle;
|
|
35
|
+
/** A Theme gradient slot the badge is filled with, over `badgeColor`; absent, the colour. */
|
|
36
|
+
badgeGradient?: PhiThemeGradientKey;
|
|
32
37
|
/** A `plan` body's prices, never translated, and what each is paid per (`/ month`), which is. */
|
|
33
38
|
price?: string;
|
|
34
39
|
pricePeriod?: string;
|
|
@@ -53,6 +58,12 @@ export type PhiCmsCardWidgetConfig = PhiCmsWidgetConfigBase & PhiCardImageSource
|
|
|
53
58
|
alt?: string;
|
|
54
59
|
/** How much of the picture shows, in percent; the card's ground shows through the rest. */
|
|
55
60
|
imageOpacity?: number;
|
|
61
|
+
/**
|
|
62
|
+
* A layer laid over the picture, under the card's marks and words: a colour, a gradient that fades the
|
|
63
|
+
* picture into the card, a pattern. The Background Overlay's shape (`PhiBackgroundOverlay`); stated by
|
|
64
|
+
* a Preset or an agent, not offered in the Inspector yet.
|
|
65
|
+
*/
|
|
66
|
+
imageOverlay?: PhiBackgroundOverlay;
|
|
56
67
|
/** Where the whole card leads. */
|
|
57
68
|
linkTarget?: PhiLinkTarget;
|
|
58
69
|
/** Whether the card draws its action button. */
|
|
@@ -65,6 +76,10 @@ export type PhiCmsCardWidgetConfig = PhiCmsWidgetConfigBase & PhiCardImageSource
|
|
|
65
76
|
actionIcon?: string;
|
|
66
77
|
/** Where the action button leads; absent, nowhere -- it then only emits `activate`. */
|
|
67
78
|
actionLinkTarget?: PhiLinkTarget;
|
|
79
|
+
/** How the action button stands out; absent, primary on a highlighted card and normal otherwise. */
|
|
80
|
+
actionVariant?: PhiButtonVariant;
|
|
81
|
+
/** The Theme gradient slot a `gradient` action button is filled with; absent, the first. */
|
|
82
|
+
actionGradient?: PhiThemeGradientKey;
|
|
68
83
|
/** How the card is set; the look is the card's Surface. */
|
|
69
84
|
variant?: PhiCardVariant;
|
|
70
85
|
highlight?: boolean;
|
|
@@ -446,7 +461,86 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
|
|
|
446
461
|
visibleWhen: {
|
|
447
462
|
field: string;
|
|
448
463
|
notEquals: null;
|
|
464
|
+
equals?: undefined;
|
|
465
|
+
};
|
|
466
|
+
description?: undefined;
|
|
467
|
+
emptyOption?: undefined;
|
|
468
|
+
placeholder?: undefined;
|
|
469
|
+
} | {
|
|
470
|
+
key: string;
|
|
471
|
+
type: "choice";
|
|
472
|
+
label: string;
|
|
473
|
+
description: string;
|
|
474
|
+
options: ({
|
|
475
|
+
readonly value: "normal";
|
|
476
|
+
readonly label: "Normal";
|
|
477
|
+
} | {
|
|
478
|
+
readonly value: "primary";
|
|
479
|
+
readonly label: "Primary";
|
|
480
|
+
} | {
|
|
481
|
+
readonly value: "dashed";
|
|
482
|
+
readonly label: "Dashed";
|
|
483
|
+
} | {
|
|
484
|
+
readonly value: "subtle";
|
|
485
|
+
readonly label: "Subtle";
|
|
486
|
+
} | {
|
|
487
|
+
readonly value: "link";
|
|
488
|
+
readonly label: "Link";
|
|
489
|
+
} | {
|
|
490
|
+
readonly value: "gradient";
|
|
491
|
+
readonly label: "Gradient";
|
|
492
|
+
} | {
|
|
493
|
+
readonly value: "glass";
|
|
494
|
+
readonly label: "Glass";
|
|
495
|
+
})[];
|
|
496
|
+
emptyOption: {
|
|
497
|
+
value: string;
|
|
498
|
+
label: string;
|
|
499
|
+
};
|
|
500
|
+
visibleWhen: {
|
|
501
|
+
field: string;
|
|
502
|
+
equals: true;
|
|
503
|
+
notEquals?: undefined;
|
|
504
|
+
};
|
|
505
|
+
presentation?: undefined;
|
|
506
|
+
placeholder?: undefined;
|
|
507
|
+
} | {
|
|
508
|
+
key: string;
|
|
509
|
+
type: "choice";
|
|
510
|
+
label: string;
|
|
511
|
+
options: {
|
|
512
|
+
value: "gradient1" | "gradient2" | "gradient3";
|
|
513
|
+
label: string;
|
|
514
|
+
}[];
|
|
515
|
+
placeholder: string;
|
|
516
|
+
visibleWhen: {
|
|
517
|
+
field: string;
|
|
518
|
+
equals: string;
|
|
519
|
+
notEquals?: undefined;
|
|
520
|
+
};
|
|
521
|
+
presentation?: undefined;
|
|
522
|
+
description?: undefined;
|
|
523
|
+
emptyOption?: undefined;
|
|
524
|
+
} | {
|
|
525
|
+
key: string;
|
|
526
|
+
type: "choice";
|
|
527
|
+
label: string;
|
|
528
|
+
description: string;
|
|
529
|
+
options: {
|
|
530
|
+
value: "gradient1" | "gradient2" | "gradient3";
|
|
531
|
+
label: string;
|
|
532
|
+
}[];
|
|
533
|
+
emptyOption: {
|
|
534
|
+
value: string;
|
|
535
|
+
label: string;
|
|
536
|
+
};
|
|
537
|
+
visibleWhen: {
|
|
538
|
+
field: string;
|
|
539
|
+
notEquals: string;
|
|
540
|
+
equals?: undefined;
|
|
449
541
|
};
|
|
542
|
+
presentation?: undefined;
|
|
543
|
+
placeholder?: undefined;
|
|
450
544
|
})[];
|
|
451
545
|
parseConfig: typeof parsePhiCmsCardWidgetConfig;
|
|
452
546
|
};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { readPhiThemeGradientKey } from "../../../../../theme/phi-theme-gradients";
|
|
2
|
+
import { PHI_THEME_GRADIENT_FIELD_OPTIONS } from "../../../../../components/widgets/config/theme-gradient";
|
|
3
|
+
import { PHI_BUTTON_VARIANT_FIELD_OPTIONS, readPhiButtonVariant, } from "../../../../../components/widgets/config/button-variant";
|
|
1
4
|
import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widget-types";
|
|
2
5
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
3
6
|
import { readPhiLinkTarget } from "../../../../../types/references";
|
|
4
7
|
import { readPhiMediaImageSourceConfig } from "../../../../../components/widgets/config/image-source-parser";
|
|
5
8
|
import { PHI_SURFACE_CARD } from "../../../../../helpers/surface-presets";
|
|
9
|
+
import { normalizePhiBackgroundWidgetConfig } from "../../../../../components/widgets/config/background";
|
|
6
10
|
import { buildPhiBulletListFields, readPhiBulletListEntries, readPhiBulletListStyle, } from "../../../../../components/widgets/shared/bullet-list-vocabulary";
|
|
7
11
|
import { PHI_CARD_HEADING_LEVELS, PHI_CARD_HOVER_EFFECTS, PHI_CARD_ICON_PLACEMENTS, PHI_CARD_TEXT_ALIGNS, PHI_CARD_BADGE_STYLES, PHI_CARD_VARIANTS, readPhiCardBillingPeriod, } from "../../../../../components/widgets/shared/card-vocabulary";
|
|
8
12
|
import { readPhiControlLabel } from "../../../../../components/widgets/config/common-action-field";
|
|
@@ -13,6 +17,10 @@ import { readBoolean, readRenderableBlockConfig, readString, } from "../../../..
|
|
|
13
17
|
function readPhiCardImageOpacity(value) {
|
|
14
18
|
return typeof value === "number" && Number.isFinite(value) ? Math.min(100, Math.max(0, value)) : undefined;
|
|
15
19
|
}
|
|
20
|
+
/** The Overlay over the picture, read as a Background reads its own; one it cannot read is none. */
|
|
21
|
+
function readPhiCardImageOverlay(value) {
|
|
22
|
+
return value == null ? undefined : normalizePhiBackgroundWidgetConfig({ base: { kind: "none" }, overlay: value }).overlay ?? undefined;
|
|
23
|
+
}
|
|
16
24
|
function readChoice(value, choices) {
|
|
17
25
|
return choices.includes(value) ? value : undefined;
|
|
18
26
|
}
|
|
@@ -28,6 +36,7 @@ function parsePhiCmsCardWidgetConfig(config) {
|
|
|
28
36
|
badge: readString(config.badge),
|
|
29
37
|
badgeColor: readString(config.badgeColor),
|
|
30
38
|
badgeStyle: readChoice(readString(config.badgeStyle), PHI_CARD_BADGE_STYLES),
|
|
39
|
+
badgeGradient: readPhiThemeGradientKey(config.badgeGradient),
|
|
31
40
|
price: readString(config.price),
|
|
32
41
|
pricePeriod: readString(config.pricePeriod),
|
|
33
42
|
priceYearly: readString(config.priceYearly),
|
|
@@ -44,11 +53,14 @@ function parsePhiCmsCardWidgetConfig(config) {
|
|
|
44
53
|
iconBackground: readString(config.iconBackground),
|
|
45
54
|
alt: readString(config.alt),
|
|
46
55
|
imageOpacity: readPhiCardImageOpacity(config.imageOpacity),
|
|
56
|
+
imageOverlay: readPhiCardImageOverlay(config.imageOverlay),
|
|
47
57
|
linkTarget: readPhiLinkTarget(config.linkTarget) ?? undefined,
|
|
48
58
|
actionEnabled: readBoolean(config.actionEnabled),
|
|
49
59
|
actionLabel: readPhiControlLabel(config.actionLabel),
|
|
50
60
|
actionIcon: readString(config.actionIcon),
|
|
51
61
|
actionLinkTarget: readPhiLinkTarget(config.actionLinkTarget) ?? undefined,
|
|
62
|
+
actionVariant: readPhiButtonVariant(config.actionVariant),
|
|
63
|
+
actionGradient: readPhiThemeGradientKey(config.actionGradient),
|
|
52
64
|
variant: readChoice(readString(config.variant), PHI_CARD_VARIANTS),
|
|
53
65
|
highlight: readBoolean(config.highlight),
|
|
54
66
|
hoverEffect: readChoice(readString(config.hoverEffect), PHI_CARD_HOVER_EFFECTS),
|
|
@@ -249,6 +261,23 @@ export const PHI_CARD_WIDGET_DEFINITION = {
|
|
|
249
261
|
label: "",
|
|
250
262
|
visibleWhen: { field: "actionEnabled", equals: true },
|
|
251
263
|
},
|
|
264
|
+
{
|
|
265
|
+
key: "actionVariant",
|
|
266
|
+
type: "choice",
|
|
267
|
+
label: "Variant",
|
|
268
|
+
description: "How the button stands out. Empty follows the card: primary when it is highlighted, normal otherwise.",
|
|
269
|
+
options: [...PHI_BUTTON_VARIANT_FIELD_OPTIONS],
|
|
270
|
+
emptyOption: { value: "", label: "Card" },
|
|
271
|
+
visibleWhen: { field: "actionEnabled", equals: true },
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
key: "actionGradient",
|
|
275
|
+
type: "choice",
|
|
276
|
+
label: "Gradient",
|
|
277
|
+
options: [...PHI_THEME_GRADIENT_FIELD_OPTIONS],
|
|
278
|
+
placeholder: "Gradient 1",
|
|
279
|
+
visibleWhen: { field: "actionVariant", equals: "gradient" },
|
|
280
|
+
},
|
|
252
281
|
{
|
|
253
282
|
key: "variant",
|
|
254
283
|
type: "choice",
|
|
@@ -284,6 +313,15 @@ export const PHI_CARD_WIDGET_DEFINITION = {
|
|
|
284
313
|
mode: "single",
|
|
285
314
|
defaultToken: "colorPrimary",
|
|
286
315
|
},
|
|
316
|
+
{
|
|
317
|
+
key: "badgeGradient",
|
|
318
|
+
type: "choice",
|
|
319
|
+
label: "Gradient",
|
|
320
|
+
description: "Fills the badge with one of the Theme's gradients instead of the colour. A ribbon's fold keeps the colour.",
|
|
321
|
+
options: [...PHI_THEME_GRADIENT_FIELD_OPTIONS],
|
|
322
|
+
emptyOption: { value: "", label: "None" },
|
|
323
|
+
visibleWhen: { field: "badgeStyle", notEquals: "none" },
|
|
324
|
+
},
|
|
287
325
|
...buildPhiBulletListFields("featureList", "Features").map((field) => ({
|
|
288
326
|
...field,
|
|
289
327
|
visibleWhen: { field: "body", equals: "plan" },
|
|
@@ -152,6 +152,7 @@ export function PhiCardWidgetEditor({ config, onChange }) {
|
|
|
152
152
|
? {
|
|
153
153
|
presentation,
|
|
154
154
|
...(config.imageOpacity == null ? {} : { opacity: config.imageOpacity / 100 }),
|
|
155
|
+
...(config.imageOverlay ? { overlay: config.imageOverlay } : {}),
|
|
155
156
|
source: config.sourceKind === "asset" ? "asset" : "url",
|
|
156
157
|
alt: config.alt ?? asset?.altText ?? "",
|
|
157
158
|
blurDataUrl: asset?.blurDataUrl ?? null,
|
|
@@ -168,13 +169,19 @@ export function PhiCardWidgetEditor({ config, onChange }) {
|
|
|
168
169
|
* Builder. The button is drawn whenever it is on, wherever it would lead.
|
|
169
170
|
*/
|
|
170
171
|
action: config.actionEnabled === true
|
|
171
|
-
? {
|
|
172
|
+
? {
|
|
173
|
+
...(config.actionIcon ? { icon: config.actionIcon } : {}),
|
|
174
|
+
ariaLabel: PHI_CARD_WIDGET_DEFAULT_LABELS.actionLabel,
|
|
175
|
+
...(config.actionVariant ? { variant: config.actionVariant } : {}),
|
|
176
|
+
...(config.actionGradient ? { gradient: config.actionGradient } : {}),
|
|
177
|
+
}
|
|
172
178
|
: null,
|
|
173
179
|
variant: config.variant,
|
|
174
180
|
body: config.body,
|
|
175
181
|
highlight: config.highlight,
|
|
176
182
|
badgeColor: config.badgeColor,
|
|
177
183
|
badgeStyle: config.badgeStyle,
|
|
184
|
+
badgeGradient: config.badgeGradient,
|
|
178
185
|
billingPeriod: config.billingPeriod,
|
|
179
186
|
hoverEffect: config.linkTarget ? config.hoverEffect : undefined,
|
|
180
187
|
}, ...(config.body === "plan" ? {
|
|
@@ -78,6 +78,7 @@ export async function PhiCardWidget({ labels, config, runtime, links, translate,
|
|
|
78
78
|
? {
|
|
79
79
|
presentation,
|
|
80
80
|
...(config?.imageOpacity == null ? {} : { opacity: config.imageOpacity / 100 }),
|
|
81
|
+
...(config?.imageOverlay ? { overlay: config.imageOverlay } : {}),
|
|
81
82
|
source: config?.sourceKind === "asset" ? "asset" : "url",
|
|
82
83
|
alt: (config?.alt ?? resolvedAsset?.altText ?? "").trim(),
|
|
83
84
|
blurDataUrl: resolvedAsset?.blurDataUrl ?? null,
|
|
@@ -107,6 +108,8 @@ export async function PhiCardWidget({ labels, config, runtime, links, translate,
|
|
|
107
108
|
...(actionLink ? { href: actionLink.href, newTab: actionLink.newTab, external: actionLink.external } : {}),
|
|
108
109
|
...(config?.actionIcon ? { icon: config.actionIcon } : {}),
|
|
109
110
|
...(defaultLabels ? { ariaLabel: defaultLabels.actionLabel } : {}),
|
|
111
|
+
...(config?.actionVariant ? { variant: config.actionVariant } : {}),
|
|
112
|
+
...(config?.actionGradient ? { gradient: config.actionGradient } : {}),
|
|
110
113
|
}
|
|
111
114
|
: null,
|
|
112
115
|
variant: config?.variant,
|
|
@@ -114,6 +117,7 @@ export async function PhiCardWidget({ labels, config, runtime, links, translate,
|
|
|
114
117
|
highlight: config?.highlight,
|
|
115
118
|
badgeColor: config?.badgeColor,
|
|
116
119
|
badgeStyle: config?.badgeStyle,
|
|
120
|
+
badgeGradient: config?.badgeGradient,
|
|
117
121
|
billingPeriod: config?.billingPeriod,
|
|
118
122
|
// Only a card that leads somewhere answers the pointer; the preview has no link but shows it.
|
|
119
123
|
hoverEffect: config?.linkTarget ? config.hoverEffect : undefined,
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { PhiCmsInstanceId } from "../../../../../types/cms-instance-id";
|
|
2
2
|
import type { PhiCollectionViewBindingModel } from "../../../../../types/collection-provider";
|
|
3
3
|
import type { PhiCmsCollectionViewWidgetConfig } from "../../../../../types/collection-view-widget";
|
|
4
|
-
|
|
4
|
+
import type { PhiRenderableBlockRenderMode } from "../../../../../types/renderable-block";
|
|
5
|
+
export declare function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabels, widgetId, renderMode, }: {
|
|
5
6
|
config: PhiCmsCollectionViewWidgetConfig;
|
|
6
7
|
binding: PhiCollectionViewBindingModel;
|
|
7
8
|
labels?: unknown;
|
|
8
9
|
widgetId?: PhiCmsInstanceId | null;
|
|
10
|
+
/** Handed on by the Collection View, so a configuration this renderer cannot serve is said its way. */
|
|
11
|
+
renderMode: PhiRenderableBlockRenderMode;
|
|
9
12
|
}): import("react").JSX.Element;
|