@phis/ui 0.4.4 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +31 -2
- 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 +15 -1
- package/components/controls/phi-button-control.js +21 -3
- package/components/controls/phi-collapse-control.d.ts +6 -2
- package/components/controls/phi-collapse-control.js +2 -2
- package/components/controls/phi-dialog-control.d.ts +11 -5
- package/components/controls/phi-dialog-control.js +19 -13
- package/components/controls/phi-dropdown-control.js +2 -2
- package/components/controls/phi-media-asset-tile-control.js +10 -10
- package/components/controls/phi-menu-control-vocabulary.d.ts +7 -0
- package/components/controls/phi-menu-control-vocabulary.js +10 -0
- package/components/controls/phi-menu-control.d.ts +4 -1
- package/components/controls/phi-menu-control.js +6 -1
- 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/clients/phi-split-card-layout-client.js +13 -5
- package/components/layouts/clients/phi-three-column-layout-client.js +9 -3
- package/components/layouts/phi-layout-view-model.js +10 -1
- package/components/layouts/split-card-geometry.js +6 -2
- package/components/media/aspect-ratios.d.ts +2 -2
- package/components/menus/phi-account-menu.js +3 -1
- package/components/navigation/phi-link.js +7 -2
- package/components/navigation/use-phi-protected-mail.d.ts +11 -0
- package/components/navigation/use-phi-protected-mail.js +29 -0
- package/components/regions/clients/cms-region-container-client.js +16 -2
- package/components/regions/phi-cms-region-container.js +5 -1
- package/components/regions/phi-cms-region-shell.d.ts +11 -0
- package/components/regions/phi-cms-region-shell.js +64 -7
- package/components/regions/presets/phi-area-shell-preset-nodes.js +2 -1
- package/components/root/phi-config-provider.js +16 -0
- 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 +9 -1
- package/components/shell/phi-cms-shell.js +10 -4
- package/components/shell/phi-nav-link.js +7 -2
- package/components/shell/phi-shell-sider-drawer.d.ts +17 -0
- package/components/shell/phi-shell-sider-drawer.js +88 -0
- 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/helpers/internal-reference-resolver.server.d.ts +1 -0
- package/components/widgets/helpers/internal-reference-resolver.server.js +4 -1
- 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 +6 -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 +6 -0
- package/components/widgets/label-types/inspector.js +3 -0
- package/components/widgets/server/navigation-request.js +13 -1
- package/components/widgets/shared/card-body-client.d.ts +13 -0
- package/components/widgets/shared/card-body-client.js +40 -11
- package/components/widgets/shared/card-vocabulary.d.ts +36 -0
- package/components/widgets/shared/card-vocabulary.js +52 -0
- 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-body-client.d.ts +29 -0
- package/components/widgets/shared/markdown-body-client.js +60 -5
- package/components/widgets/shared/markdown-image-vocabulary.d.ts +31 -0
- package/components/widgets/shared/markdown-image-vocabulary.js +68 -0
- package/components/widgets/shared/markdown-render.d.ts +5 -0
- package/components/widgets/shared/markdown-render.js +139 -11
- package/components/widgets/shared/markdown-sections.d.ts +40 -0
- package/components/widgets/shared/markdown-sections.js +111 -0
- 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/external-href.js +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/protected-mail.d.ts +16 -0
- package/helpers/protected-mail.js +81 -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 +2 -2
- 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 +67 -3
- 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 +102 -1
- package/plugins/runtime-modules/core/widgets/card/config.js +60 -1
- package/plugins/runtime-modules/core/widgets/card/editor.js +17 -2
- package/plugins/runtime-modules/core/widgets/card/server.js +13 -1
- 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/entry-list/view.server.js +2 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +3 -3
- 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/header-navigation/client.d.ts +6 -1
- package/plugins/runtime-modules/core/widgets/header-navigation/client.js +40 -13
- package/plugins/runtime-modules/core/widgets/header-navigation/config.d.ts +26 -1
- package/plugins/runtime-modules/core/widgets/header-navigation/config.js +27 -0
- package/plugins/runtime-modules/core/widgets/header-navigation/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/header-navigation/server.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/header-navigation/server.js +3 -1
- package/plugins/runtime-modules/core/widgets/image/client.js +11 -7
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +16 -0
- package/plugins/runtime-modules/core/widgets/markdown/config.js +46 -1
- package/plugins/runtime-modules/core/widgets/markdown/server.js +22 -8
- 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/simple-text/server.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 +118 -15
- package/styles/gradients.css +101 -0
- package/styles/layout.css +35 -0
- package/styles/root.css +18 -0
- package/styles/shell.css +206 -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/theme/phi-tokens.d.ts +6 -0
- package/theme/phi-tokens.js +6 -0
- package/theme.d.ts +1 -0
- package/theme.js +6 -0
- package/types/cms-presets.d.ts +7 -0
- package/types/core-widget-placements.d.ts +8 -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,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,8 +1,11 @@
|
|
|
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
|
-
import { type PhiCardBillingPeriod, type PhiCardHeadingLevel, type PhiCardHoverEffect, type PhiCardIconPlacement, type PhiCardTextAlign, type PhiCardBadgeStyle, type PhiCardVariant, type PhiCardWidgetBody } from "../../../../../components/widgets/shared/card-vocabulary";
|
|
8
|
+
import { type PhiCardBillingPeriod, type PhiCardHeadingLevel, type PhiCardHoverEffect, type PhiCardIconPlacement, type PhiCardTextAlign, type PhiCardBadgeStyle, type PhiCardMediaAspectRatio, type PhiCardVariant, type PhiCardWidgetBody } from "../../../../../components/widgets/shared/card-vocabulary";
|
|
6
9
|
import { type PhiSignalRouteSet } from "../../../../../types/signals";
|
|
7
10
|
import { type PhiCmsWidgetConfigBase } from "../../../../../components/widgets/config/parser-primitives";
|
|
8
11
|
type PhiCardImageSource = {
|
|
@@ -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;
|
|
@@ -51,8 +56,19 @@ export type PhiCmsCardWidgetConfig = PhiCmsWidgetConfigBase & PhiCardImageSource
|
|
|
51
56
|
iconBackground?: string;
|
|
52
57
|
/** The picture's words for a reader who cannot see it; an Asset brings its own. */
|
|
53
58
|
alt?: string;
|
|
59
|
+
/**
|
|
60
|
+
* How tall the picture stands (`PHI_CARD_MEDIA_ASPECT_RATIOS`); absent is `auto`, the proportion of the
|
|
61
|
+
* file shown -- for a Media picture the Card variant's 3:2.
|
|
62
|
+
*/
|
|
63
|
+
mediaAspectRatio?: PhiCardMediaAspectRatio;
|
|
54
64
|
/** How much of the picture shows, in percent; the card's ground shows through the rest. */
|
|
55
65
|
imageOpacity?: number;
|
|
66
|
+
/**
|
|
67
|
+
* A layer laid over the picture, under the card's marks and words: a colour, a gradient that fades the
|
|
68
|
+
* picture into the card, a pattern. The Background Overlay's shape (`PhiBackgroundOverlay`); stated by
|
|
69
|
+
* a Preset or an agent, not offered in the Inspector yet.
|
|
70
|
+
*/
|
|
71
|
+
imageOverlay?: PhiBackgroundOverlay;
|
|
56
72
|
/** Where the whole card leads. */
|
|
57
73
|
linkTarget?: PhiLinkTarget;
|
|
58
74
|
/** Whether the card draws its action button. */
|
|
@@ -65,6 +81,10 @@ export type PhiCmsCardWidgetConfig = PhiCmsWidgetConfigBase & PhiCardImageSource
|
|
|
65
81
|
actionIcon?: string;
|
|
66
82
|
/** Where the action button leads; absent, nowhere -- it then only emits `activate`. */
|
|
67
83
|
actionLinkTarget?: PhiLinkTarget;
|
|
84
|
+
/** How the action button stands out; absent, primary on a highlighted card and normal otherwise. */
|
|
85
|
+
actionVariant?: PhiButtonVariant;
|
|
86
|
+
/** The Theme gradient slot a `gradient` action button is filled with; absent, the first. */
|
|
87
|
+
actionGradient?: PhiThemeGradientKey;
|
|
68
88
|
/** How the card is set; the look is the card's Surface. */
|
|
69
89
|
variant?: PhiCardVariant;
|
|
70
90
|
highlight?: boolean;
|
|
@@ -105,6 +125,7 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
|
|
|
105
125
|
};
|
|
106
126
|
defaultConfig: {
|
|
107
127
|
body: "text";
|
|
128
|
+
mediaAspectRatio: "auto";
|
|
108
129
|
imageOpacity: number;
|
|
109
130
|
headingLevel: "h3";
|
|
110
131
|
textAlign: "start";
|
|
@@ -130,6 +151,7 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
|
|
|
130
151
|
};
|
|
131
152
|
actionLabel: string;
|
|
132
153
|
body: "text";
|
|
154
|
+
mediaAspectRatio: "auto";
|
|
133
155
|
imageOpacity: number;
|
|
134
156
|
headingLevel: "h3";
|
|
135
157
|
textAlign: "start";
|
|
@@ -446,7 +468,86 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
|
|
|
446
468
|
visibleWhen: {
|
|
447
469
|
field: string;
|
|
448
470
|
notEquals: null;
|
|
471
|
+
equals?: undefined;
|
|
472
|
+
};
|
|
473
|
+
description?: undefined;
|
|
474
|
+
emptyOption?: undefined;
|
|
475
|
+
placeholder?: undefined;
|
|
476
|
+
} | {
|
|
477
|
+
key: string;
|
|
478
|
+
type: "choice";
|
|
479
|
+
label: string;
|
|
480
|
+
description: string;
|
|
481
|
+
options: ({
|
|
482
|
+
readonly value: "normal";
|
|
483
|
+
readonly label: "Normal";
|
|
484
|
+
} | {
|
|
485
|
+
readonly value: "primary";
|
|
486
|
+
readonly label: "Primary";
|
|
487
|
+
} | {
|
|
488
|
+
readonly value: "dashed";
|
|
489
|
+
readonly label: "Dashed";
|
|
490
|
+
} | {
|
|
491
|
+
readonly value: "subtle";
|
|
492
|
+
readonly label: "Subtle";
|
|
493
|
+
} | {
|
|
494
|
+
readonly value: "link";
|
|
495
|
+
readonly label: "Link";
|
|
496
|
+
} | {
|
|
497
|
+
readonly value: "gradient";
|
|
498
|
+
readonly label: "Gradient";
|
|
499
|
+
} | {
|
|
500
|
+
readonly value: "glass";
|
|
501
|
+
readonly label: "Glass";
|
|
502
|
+
})[];
|
|
503
|
+
emptyOption: {
|
|
504
|
+
value: string;
|
|
505
|
+
label: string;
|
|
506
|
+
};
|
|
507
|
+
visibleWhen: {
|
|
508
|
+
field: string;
|
|
509
|
+
equals: true;
|
|
510
|
+
notEquals?: undefined;
|
|
511
|
+
};
|
|
512
|
+
presentation?: undefined;
|
|
513
|
+
placeholder?: undefined;
|
|
514
|
+
} | {
|
|
515
|
+
key: string;
|
|
516
|
+
type: "choice";
|
|
517
|
+
label: string;
|
|
518
|
+
options: {
|
|
519
|
+
value: "gradient1" | "gradient2" | "gradient3";
|
|
520
|
+
label: string;
|
|
521
|
+
}[];
|
|
522
|
+
placeholder: string;
|
|
523
|
+
visibleWhen: {
|
|
524
|
+
field: string;
|
|
525
|
+
equals: string;
|
|
526
|
+
notEquals?: undefined;
|
|
527
|
+
};
|
|
528
|
+
presentation?: undefined;
|
|
529
|
+
description?: undefined;
|
|
530
|
+
emptyOption?: undefined;
|
|
531
|
+
} | {
|
|
532
|
+
key: string;
|
|
533
|
+
type: "choice";
|
|
534
|
+
label: string;
|
|
535
|
+
description: string;
|
|
536
|
+
options: {
|
|
537
|
+
value: "gradient1" | "gradient2" | "gradient3";
|
|
538
|
+
label: string;
|
|
539
|
+
}[];
|
|
540
|
+
emptyOption: {
|
|
541
|
+
value: string;
|
|
542
|
+
label: string;
|
|
543
|
+
};
|
|
544
|
+
visibleWhen: {
|
|
545
|
+
field: string;
|
|
546
|
+
notEquals: string;
|
|
547
|
+
equals?: undefined;
|
|
449
548
|
};
|
|
549
|
+
presentation?: undefined;
|
|
550
|
+
placeholder?: undefined;
|
|
450
551
|
})[];
|
|
451
552
|
parseConfig: typeof parsePhiCmsCardWidgetConfig;
|
|
452
553
|
};
|
|
@@ -1,10 +1,14 @@
|
|
|
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
|
-
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";
|
|
11
|
+
import { PHI_CARD_HEADING_LEVELS, PHI_CARD_HOVER_EFFECTS, PHI_CARD_ICON_PLACEMENTS, PHI_CARD_TEXT_ALIGNS, PHI_CARD_BADGE_STYLES, PHI_CARD_MEDIA_ASPECT_RATIOS, PHI_CARD_VARIANTS, readPhiCardBillingPeriod, } from "../../../../../components/widgets/shared/card-vocabulary";
|
|
8
12
|
import { readPhiControlLabel } from "../../../../../components/widgets/config/common-action-field";
|
|
9
13
|
import { PHI_CARD_SIGNALS } from "../../../../../components/widgets/signals/control-signal-capabilities";
|
|
10
14
|
import { readPhiSignalRouteSet } from "../../../../../types/signals";
|
|
@@ -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),
|
|
@@ -43,12 +52,16 @@ function parsePhiCmsCardWidgetConfig(config) {
|
|
|
43
52
|
iconColor: readString(config.iconColor),
|
|
44
53
|
iconBackground: readString(config.iconBackground),
|
|
45
54
|
alt: readString(config.alt),
|
|
55
|
+
mediaAspectRatio: readChoice(readString(config.mediaAspectRatio), PHI_CARD_MEDIA_ASPECT_RATIOS),
|
|
46
56
|
imageOpacity: readPhiCardImageOpacity(config.imageOpacity),
|
|
57
|
+
imageOverlay: readPhiCardImageOverlay(config.imageOverlay),
|
|
47
58
|
linkTarget: readPhiLinkTarget(config.linkTarget) ?? undefined,
|
|
48
59
|
actionEnabled: readBoolean(config.actionEnabled),
|
|
49
60
|
actionLabel: readPhiControlLabel(config.actionLabel),
|
|
50
61
|
actionIcon: readString(config.actionIcon),
|
|
51
62
|
actionLinkTarget: readPhiLinkTarget(config.actionLinkTarget) ?? undefined,
|
|
63
|
+
actionVariant: readPhiButtonVariant(config.actionVariant),
|
|
64
|
+
actionGradient: readPhiThemeGradientKey(config.actionGradient),
|
|
52
65
|
variant: readChoice(readString(config.variant), PHI_CARD_VARIANTS),
|
|
53
66
|
highlight: readBoolean(config.highlight),
|
|
54
67
|
hoverEffect: readChoice(readString(config.hoverEffect), PHI_CARD_HOVER_EFFECTS),
|
|
@@ -66,6 +79,7 @@ function parsePhiCmsCardWidgetConfig(config) {
|
|
|
66
79
|
}
|
|
67
80
|
const PHI_CARD_DEFAULT_CONFIG = {
|
|
68
81
|
body: "text",
|
|
82
|
+
mediaAspectRatio: "auto",
|
|
69
83
|
imageOpacity: 100,
|
|
70
84
|
headingLevel: "h3",
|
|
71
85
|
textAlign: "start",
|
|
@@ -165,6 +179,25 @@ export const PHI_CARD_WIDGET_DEFINITION = {
|
|
|
165
179
|
],
|
|
166
180
|
},
|
|
167
181
|
{ key: "image", type: "image", heading: "Image", label: "Image" },
|
|
182
|
+
/*
|
|
183
|
+
* Automatic is the Card variant's 3:2 for a Media picture, so a row of cards stands at one height; a
|
|
184
|
+
* step crops every card it is set on into the same box, Original shows the whole picture.
|
|
185
|
+
*/
|
|
186
|
+
{
|
|
187
|
+
key: "mediaAspectRatio",
|
|
188
|
+
type: "choice",
|
|
189
|
+
label: "Proportion",
|
|
190
|
+
options: [
|
|
191
|
+
{ value: "auto", label: "Automatic" },
|
|
192
|
+
{ value: "original", label: "Original" },
|
|
193
|
+
{ value: "phi", label: "φ (golden)" },
|
|
194
|
+
{ value: "3:2", label: "3:2" },
|
|
195
|
+
{ value: "4:3", label: "4:3" },
|
|
196
|
+
{ value: "16:9", label: "16:9" },
|
|
197
|
+
{ value: "2:1", label: "2:1" },
|
|
198
|
+
{ value: "1:1", label: "1:1" },
|
|
199
|
+
],
|
|
200
|
+
},
|
|
168
201
|
{
|
|
169
202
|
key: "imageOpacity",
|
|
170
203
|
type: "number",
|
|
@@ -249,6 +282,23 @@ export const PHI_CARD_WIDGET_DEFINITION = {
|
|
|
249
282
|
label: "",
|
|
250
283
|
visibleWhen: { field: "actionEnabled", equals: true },
|
|
251
284
|
},
|
|
285
|
+
{
|
|
286
|
+
key: "actionVariant",
|
|
287
|
+
type: "choice",
|
|
288
|
+
label: "Variant",
|
|
289
|
+
description: "How the button stands out. Empty follows the card: primary when it is highlighted, normal otherwise.",
|
|
290
|
+
options: [...PHI_BUTTON_VARIANT_FIELD_OPTIONS],
|
|
291
|
+
emptyOption: { value: "", label: "Card" },
|
|
292
|
+
visibleWhen: { field: "actionEnabled", equals: true },
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
key: "actionGradient",
|
|
296
|
+
type: "choice",
|
|
297
|
+
label: "Gradient",
|
|
298
|
+
options: [...PHI_THEME_GRADIENT_FIELD_OPTIONS],
|
|
299
|
+
placeholder: "Gradient 1",
|
|
300
|
+
visibleWhen: { field: "actionVariant", equals: "gradient" },
|
|
301
|
+
},
|
|
252
302
|
{
|
|
253
303
|
key: "variant",
|
|
254
304
|
type: "choice",
|
|
@@ -284,6 +334,15 @@ export const PHI_CARD_WIDGET_DEFINITION = {
|
|
|
284
334
|
mode: "single",
|
|
285
335
|
defaultToken: "colorPrimary",
|
|
286
336
|
},
|
|
337
|
+
{
|
|
338
|
+
key: "badgeGradient",
|
|
339
|
+
type: "choice",
|
|
340
|
+
label: "Gradient",
|
|
341
|
+
description: "Fills the badge with one of the Theme's gradients instead of the colour. A ribbon's fold keeps the colour.",
|
|
342
|
+
options: [...PHI_THEME_GRADIENT_FIELD_OPTIONS],
|
|
343
|
+
emptyOption: { value: "", label: "None" },
|
|
344
|
+
visibleWhen: { field: "badgeStyle", notEquals: "none" },
|
|
345
|
+
},
|
|
287
346
|
...buildPhiBulletListFields("featureList", "Features").map((field) => ({
|
|
288
347
|
...field,
|
|
289
348
|
visibleWhen: { field: "body", equals: "plan" },
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { buildPhiMediaAssetContentDeliveryUrl } from "../../../../../constants/media";
|
|
5
5
|
import { resolvePhiImagePresentation } from "../../../../../components/media/image-presentation";
|
|
6
|
+
import { resolvePhiCardImageVariantKey, resolvePhiCardMediaAspectRatioCss, resolvePhiCardMediaAspectRatioValue, } from "../../../../../components/widgets/shared/card-vocabulary";
|
|
6
7
|
import { usePhiAuthoringAssetDetails } from "../../../../../components/media/use-authoring-asset-details";
|
|
7
8
|
import { PhiInlineTextEditor } from "../../../../../components/controls/phi-inline-text-editor";
|
|
8
9
|
import { PhiTypographyControl } from "../../../../../components/controls/phi-typography-control";
|
|
@@ -112,7 +113,13 @@ export function PhiCardWidgetEditor({ config, onChange }) {
|
|
|
112
113
|
const presentation = resolvePhiImagePresentation({
|
|
113
114
|
sourceKind: config.sourceKind,
|
|
114
115
|
assetId,
|
|
115
|
-
|
|
116
|
+
/* The card's own variant, else the Card variant where its box is that variant's proportion. */
|
|
117
|
+
variantKey: resolvePhiCardImageVariantKey({
|
|
118
|
+
sourceKind: config.sourceKind,
|
|
119
|
+
variantKey: config.sourceKind === "asset" ? config.variantKey : null,
|
|
120
|
+
mediaAspectRatio: config.mediaAspectRatio,
|
|
121
|
+
}),
|
|
122
|
+
frameAspectRatio: resolvePhiCardMediaAspectRatioValue(config.mediaAspectRatio),
|
|
116
123
|
variantVersion: asset?.variantVersion ?? (config.sourceKind === "asset" ? config.variantVersion : null),
|
|
117
124
|
deliveryRevision: asset?.deliveryRevision,
|
|
118
125
|
originalUrl: assetId == null ? null : buildPhiMediaAssetContentDeliveryUrl(assetId),
|
|
@@ -148,10 +155,12 @@ export function PhiCardWidgetEditor({ config, onChange }) {
|
|
|
148
155
|
}, config: {
|
|
149
156
|
// A card that states no Surface has none, on the canvas as on the page: "None" is its contents.
|
|
150
157
|
surface: config.surface ?? null,
|
|
158
|
+
mediaAspectRatio: resolvePhiCardMediaAspectRatioCss(config.mediaAspectRatio),
|
|
151
159
|
image: presentation.url
|
|
152
160
|
? {
|
|
153
161
|
presentation,
|
|
154
162
|
...(config.imageOpacity == null ? {} : { opacity: config.imageOpacity / 100 }),
|
|
163
|
+
...(config.imageOverlay ? { overlay: config.imageOverlay } : {}),
|
|
155
164
|
source: config.sourceKind === "asset" ? "asset" : "url",
|
|
156
165
|
alt: config.alt ?? asset?.altText ?? "",
|
|
157
166
|
blurDataUrl: asset?.blurDataUrl ?? null,
|
|
@@ -168,13 +177,19 @@ export function PhiCardWidgetEditor({ config, onChange }) {
|
|
|
168
177
|
* Builder. The button is drawn whenever it is on, wherever it would lead.
|
|
169
178
|
*/
|
|
170
179
|
action: config.actionEnabled === true
|
|
171
|
-
? {
|
|
180
|
+
? {
|
|
181
|
+
...(config.actionIcon ? { icon: config.actionIcon } : {}),
|
|
182
|
+
ariaLabel: PHI_CARD_WIDGET_DEFAULT_LABELS.actionLabel,
|
|
183
|
+
...(config.actionVariant ? { variant: config.actionVariant } : {}),
|
|
184
|
+
...(config.actionGradient ? { gradient: config.actionGradient } : {}),
|
|
185
|
+
}
|
|
172
186
|
: null,
|
|
173
187
|
variant: config.variant,
|
|
174
188
|
body: config.body,
|
|
175
189
|
highlight: config.highlight,
|
|
176
190
|
badgeColor: config.badgeColor,
|
|
177
191
|
badgeStyle: config.badgeStyle,
|
|
192
|
+
badgeGradient: config.badgeGradient,
|
|
178
193
|
billingPeriod: config.billingPeriod,
|
|
179
194
|
hoverEffect: config.linkTarget ? config.hoverEffect : undefined,
|
|
180
195
|
}, ...(config.body === "plan" ? {
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { trBulk, trBulkForLocale } from "../../../../../server-helpers/translate";
|
|
3
3
|
import { isPhiMediaSvgContentType } from "../../../../../constants/media";
|
|
4
4
|
import { resolvePhiImagePresentation } from "../../../../../components/media/image-presentation";
|
|
5
|
+
import { resolvePhiCardImageVariantKey, resolvePhiCardMediaAspectRatioCss, resolvePhiCardMediaAspectRatioValue, } from "../../../../../components/widgets/shared/card-vocabulary";
|
|
5
6
|
import { resolvePhiPublicAssetReference } from "../../../../../components/widgets/helpers/internal-reference-resolver.server";
|
|
6
7
|
import { resolvePhiLinkHref } from "../../../../../helpers/link-target";
|
|
7
8
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
@@ -60,7 +61,13 @@ export async function PhiCardWidget({ labels, config, runtime, links, translate,
|
|
|
60
61
|
const presentation = resolvePhiImagePresentation({
|
|
61
62
|
sourceKind: config?.sourceKind,
|
|
62
63
|
assetId: resolvedAsset?.id,
|
|
63
|
-
|
|
64
|
+
/* The card's own variant, else the Card variant where its box is that variant's proportion. */
|
|
65
|
+
variantKey: resolvePhiCardImageVariantKey({
|
|
66
|
+
sourceKind: config?.sourceKind,
|
|
67
|
+
variantKey: config?.sourceKind === "asset" ? config?.variantKey : null,
|
|
68
|
+
mediaAspectRatio: config?.mediaAspectRatio,
|
|
69
|
+
}),
|
|
70
|
+
frameAspectRatio: resolvePhiCardMediaAspectRatioValue(config?.mediaAspectRatio),
|
|
64
71
|
variantVersion: resolvedAsset?.variantVersion,
|
|
65
72
|
deliveryRevision: resolvedAsset?.deliveryRevision,
|
|
66
73
|
originalUrl: resolvedAsset?.deliveryUrl,
|
|
@@ -74,10 +81,12 @@ export async function PhiCardWidget({ labels, config, runtime, links, translate,
|
|
|
74
81
|
const actionLink = preview || !actionEnabled ? null : resolvePhiLinkHref(config?.actionLinkTarget, links);
|
|
75
82
|
const clientConfig = {
|
|
76
83
|
surface: config?.surface ?? null,
|
|
84
|
+
mediaAspectRatio: resolvePhiCardMediaAspectRatioCss(config?.mediaAspectRatio),
|
|
77
85
|
image: presentation.url
|
|
78
86
|
? {
|
|
79
87
|
presentation,
|
|
80
88
|
...(config?.imageOpacity == null ? {} : { opacity: config.imageOpacity / 100 }),
|
|
89
|
+
...(config?.imageOverlay ? { overlay: config.imageOverlay } : {}),
|
|
81
90
|
source: config?.sourceKind === "asset" ? "asset" : "url",
|
|
82
91
|
alt: (config?.alt ?? resolvedAsset?.altText ?? "").trim(),
|
|
83
92
|
blurDataUrl: resolvedAsset?.blurDataUrl ?? null,
|
|
@@ -107,6 +116,8 @@ export async function PhiCardWidget({ labels, config, runtime, links, translate,
|
|
|
107
116
|
...(actionLink ? { href: actionLink.href, newTab: actionLink.newTab, external: actionLink.external } : {}),
|
|
108
117
|
...(config?.actionIcon ? { icon: config.actionIcon } : {}),
|
|
109
118
|
...(defaultLabels ? { ariaLabel: defaultLabels.actionLabel } : {}),
|
|
119
|
+
...(config?.actionVariant ? { variant: config.actionVariant } : {}),
|
|
120
|
+
...(config?.actionGradient ? { gradient: config.actionGradient } : {}),
|
|
110
121
|
}
|
|
111
122
|
: null,
|
|
112
123
|
variant: config?.variant,
|
|
@@ -114,6 +125,7 @@ export async function PhiCardWidget({ labels, config, runtime, links, translate,
|
|
|
114
125
|
highlight: config?.highlight,
|
|
115
126
|
badgeColor: config?.badgeColor,
|
|
116
127
|
badgeStyle: config?.badgeStyle,
|
|
128
|
+
badgeGradient: config?.badgeGradient,
|
|
117
129
|
billingPeriod: config?.billingPeriod,
|
|
118
130
|
// Only a card that leads somewhere answers the pointer; the preview has no link but shows it.
|
|
119
131
|
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;
|
|
@@ -21,6 +21,8 @@ import { usePhiControlSignalController } from "../../../../../components/widgets
|
|
|
21
21
|
import { usePhiSearchDraft } from "../../../../../components/widgets/client/shared/phi-search-draft";
|
|
22
22
|
import { buildPhiMediaSpaceOptions, usePhiMediaSpaceSelectionAllowed, } from "../../../../../components/media/media-space-selection";
|
|
23
23
|
import { buildPhiMediaFolderCascaderOptions, buildPhiMediaFolderValueById, combinePhiMediaFlagValues, resolvePhiMediaFolderIdFromValue, } from "../../../../../components/media/media-folder-options";
|
|
24
|
+
import { PhiWidgetFailure } from "../../../../../components/widgets/shared/widget-failure-client";
|
|
25
|
+
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
24
26
|
import { PHI_ASSET_CONTROLLER_STORE_KEY } from "../../../../../components/media/asset-controller-signals";
|
|
25
27
|
import { applyPhiAssetCollectionData } from "../../../../../components/media/asset-collection-runtime";
|
|
26
28
|
import { readPhiMediaAssetTiles, readPhiMediaFolders } from "../../../../../components/media/phi-image-preview-data";
|
|
@@ -59,7 +61,7 @@ function overlayPhiAssetLabels(base, override) {
|
|
|
59
61
|
}
|
|
60
62
|
return result;
|
|
61
63
|
}
|
|
62
|
-
export function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabels, widgetId, }) {
|
|
64
|
+
export function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabels, widgetId, renderMode, }) {
|
|
63
65
|
const labels = useMemo(() => overlayPhiAssetLabels(PHI_MEDIA_WIDGET_DEFAULT_LABELS, config.presentation.labels ?? rawLabels), [config.presentation.labels, rawLabels]);
|
|
64
66
|
const { token } = usePhiConfig();
|
|
65
67
|
const { showMessage } = usePhiApplicationFeedback();
|
|
@@ -145,7 +147,7 @@ export function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabe
|
|
|
145
147
|
typeKey: "collection-action",
|
|
146
148
|
});
|
|
147
149
|
if (unsupportedFilter || unsupportedAction) {
|
|
148
|
-
return (_jsx(
|
|
150
|
+
return (_jsx(PhiWidgetFailure, { renderMode: renderMode, widgetType: PhiCmsWidgetType.CollectionView, widgetId: widgetId, title: unsupportedFilter
|
|
149
151
|
? `Asset collection filter "${unsupportedFilter.key}" is not supported.`
|
|
150
152
|
: `Asset collection action "${unsupportedAction?.key ?? "unknown"}" is not supported.` }));
|
|
151
153
|
}
|
|
@@ -257,7 +259,12 @@ export function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabe
|
|
|
257
259
|
folderPath: null,
|
|
258
260
|
presentationFlags: state.presentationFlags,
|
|
259
261
|
query,
|
|
260
|
-
} })) : null,
|
|
262
|
+
} })) : null,
|
|
263
|
+
/*
|
|
264
|
+
* Only what an action left behind reaches this: a failed read of the source ends the Collection
|
|
265
|
+
* View before this renderer is drawn. A refusal is the acting person's to read, live or not.
|
|
266
|
+
*/
|
|
267
|
+
diagnostics: state.error ? _jsx(PhiAlertControl, { level: "error", showIcon: true, title: state.error }) : null, body: body, items: state.assets.map((asset) => (_jsx(PhiMediaAssetTileControl, { asset: asset, minColumnWidth: minColumnWidth, selected: state.selectedAssetId === asset.id, mode: mode, deleting: deletingAssetIds.includes(asset.id), onSelect: selectAsset, onDelete: (nextAsset) => { void deleteAsset(nextAsset); }, deleteLabel: labels.grid.deleteLabel, showTypeLabel: true, showDeleteAction: true, showDimensions: true, showIdLabel: true }, asset.id))), mode: mode, gap: gap, minColumnWidth: minColumnWidth, pagination: features.pagination?.enabled === false ? null : {
|
|
261
268
|
page: state.page,
|
|
262
269
|
pageSize: state.pageSize,
|
|
263
270
|
total: state.pagination?.total ?? 0,
|
|
@@ -4,5 +4,5 @@ import { PHI_COLLECTION_VIEW_WIDGET_DEFINITION } from "./config";
|
|
|
4
4
|
import { PhiCollectionViewWidget } from "./client";
|
|
5
5
|
export const PHI_COLLECTION_VIEW_WIDGET_BUILDER_PLUGIN = {
|
|
6
6
|
...PHI_COLLECTION_VIEW_WIDGET_DEFINITION,
|
|
7
|
-
renderEditor: ({ config }) => (_jsx(PhiCollectionViewWidget, { config: config, preview: true, skeletonActive: false })),
|
|
7
|
+
renderEditor: ({ widget, config }) => (_jsx(PhiCollectionViewWidget, { config: config, widgetId: widget.id, renderMode: "editor", preview: true, skeletonActive: false })),
|
|
8
8
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { PhiCmsInstanceId } from "../../../../../types/cms-instance-id";
|
|
2
2
|
import type { PhiCmsCollectionViewWidgetConfig } from "../../../../../types/collection-view-widget";
|
|
3
|
+
import type { PhiRenderableBlockRenderMode } from "../../../../../types/renderable-block";
|
|
3
4
|
export type PhiCollectionViewWidgetProps = {
|
|
4
5
|
config?: PhiCmsCollectionViewWidgetConfig | null;
|
|
5
6
|
widgetId?: PhiCmsInstanceId | null;
|
|
6
7
|
labels?: unknown;
|
|
8
|
+
/** Where this draws; the parsed config does not carry it, so the plugin reads it off the node. */
|
|
9
|
+
renderMode: PhiRenderableBlockRenderMode;
|
|
7
10
|
preview?: boolean;
|
|
8
11
|
skeletonActive?: boolean;
|
|
9
12
|
};
|