@phis/ui 0.4.3 → 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-anchor-nav-control.js +4 -1
- package/components/controls/phi-background-control.d.ts +6 -1
- package/components/controls/phi-background-control.js +30 -7
- package/components/controls/phi-bullet-list-control.d.ts +7 -2
- package/components/controls/phi-bullet-list-control.js +4 -3
- package/components/controls/phi-button-control.d.ts +13 -1
- package/components/controls/phi-button-control.js +21 -3
- package/components/controls/phi-color-control.js +4 -2
- package/components/controls/phi-drawer-control-adapter.js +3 -2
- package/components/controls/phi-dropdown-control.js +2 -2
- package/components/controls/phi-inline-text-editor.js +7 -1
- package/components/controls/phi-length-control.js +1 -1
- 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 +16 -4
- package/components/controls/phi-ribbon-control.js +14 -8
- package/components/controls/phi-ribbon-wrap-control.d.ts +32 -0
- package/components/controls/phi-ribbon-wrap-control.js +31 -0
- package/components/controls/phi-segmented-control.d.ts +4 -1
- package/components/controls/phi-segmented-control.js +13 -2
- package/components/controls/phi-select-control.js +5 -2
- package/components/controls/phi-series-chart-control.d.ts +48 -0
- package/components/controls/phi-series-chart-control.js +82 -0
- 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/controls/phi-text-control.js +57 -3
- package/components/controls/phi-tree-control.js +1 -1
- package/components/controls/phi-truncated-hover-text.d.ts +15 -0
- package/components/controls/phi-truncated-hover-text.js +25 -0
- package/components/forms/link-target-form-control.d.ts +1 -1
- package/components/forms/link-target-form-control.js +2 -45
- package/components/forms/phi-form-widget-frame.js +4 -2
- package/components/layouts/clients/phi-three-column-layout-client.js +10 -1
- package/components/layouts/phi-layout-view-model.js +10 -1
- package/components/navigation/phi-link.js +6 -1
- package/components/regions/clients/cms-region-container-client.js +16 -1
- package/components/regions/phi-cms-region-container.js +7 -0
- package/components/regions/phi-cms-region-shell.d.ts +22 -1
- package/components/regions/phi-cms-region-shell.js +131 -23
- package/components/root/phi-config-provider.d.ts +13 -0
- package/components/root/phi-config-provider.js +12 -1
- package/components/root/phi-root-background.d.ts +7 -0
- package/components/root/phi-root-background.js +20 -1
- 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 +15 -1
- package/components/root/phi-shell-chrome-overlay.d.ts +18 -1
- package/components/root/phi-shell-chrome-overlay.js +26 -4
- package/components/runtime/runtime-module-context.d.ts +12 -1
- package/components/runtime/runtime-module-context.js +6 -1
- package/components/shell/phi-antd-icon.d.ts +1 -0
- package/components/shell/phi-antd-icon.js +3 -0
- 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/shell/use-phi-shell-sticky-top.js +61 -16
- package/components/surface/phi-surface-tone.d.ts +13 -0
- package/components/surface/phi-surface-tone.js +21 -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/bullet-list-entries-editor.js +7 -1
- package/components/widgets/client/html-editor.js +1 -1
- 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/client/shared/use-page-reference-options.d.ts +17 -0
- package/components/widgets/client/shared/use-page-reference-options.js +57 -0
- package/components/widgets/config/background.d.ts +52 -1
- package/components/widgets/config/background.js +85 -4
- 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 +4 -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 +2 -0
- package/components/widgets/label-types/background.js +2 -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/bullet-list-vocabulary.d.ts +10 -0
- package/components/widgets/shared/bullet-list-vocabulary.js +5 -2
- package/components/widgets/shared/card-body-client.d.ts +16 -3
- package/components/widgets/shared/card-body-client.js +79 -8
- package/components/widgets/shared/card-vocabulary.d.ts +12 -2
- package/components/widgets/shared/card-vocabulary.js +7 -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.js +39 -10
- 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-container-chrome.js +6 -1
- 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/locale.d.ts +8 -0
- package/helpers/locale.js +18 -0
- package/helpers/mode-paint.d.ts +4 -0
- package/helpers/mode-paint.js +47 -0
- package/helpers/shell-region-style.js +2 -1
- package/helpers/surface-style.d.ts +12 -1
- package/helpers/surface-style.js +60 -12
- package/module-dashboard-cards.d.ts +2 -1
- package/module-dashboard-cards.js +2 -1
- package/module-records.d.ts +7 -0
- package/module-records.js +6 -0
- package/package.json +1 -1
- package/plugins/runtime-modules/area-definitions.d.ts +0 -42
- package/plugins/runtime-modules/area-definitions.js +3 -8
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +21 -2
- package/plugins/runtime-modules/builder/clients/inspector-surface-labels.js +1 -0
- package/plugins/runtime-modules/builder/clients/layout-scaffold-overlays.js +10 -5
- 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/edit-scaffold-drawer.js +3 -2
- package/plugins/runtime-modules/builder/persistence.d.ts +3 -0
- package/plugins/runtime-modules/builder/persistence.js +9 -1
- package/plugins/runtime-modules/builder/render-root-node-scaffold.js +25 -15
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +4 -0
- package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +15 -4
- package/plugins/runtime-modules/client-authoring-module.d.ts +8 -1
- package/plugins/runtime-modules/client-authoring-module.js +13 -3
- 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/brand/client.d.ts +12 -3
- package/plugins/runtime-modules/core/widgets/brand/client.js +3 -11
- package/plugins/runtime-modules/core/widgets/brand/home.d.ts +15 -0
- package/plugins/runtime-modules/core/widgets/brand/home.js +18 -0
- package/plugins/runtime-modules/core/widgets/brand/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/brand/server.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/brand/server.js +2 -2
- 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 +100 -1
- package/plugins/runtime-modules/core/widgets/card/config.js +57 -3
- package/plugins/runtime-modules/core/widgets/card/editor.js +21 -4
- package/plugins/runtime-modules/core/widgets/card/server.js +5 -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/description/client.js +3 -3
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -0
- package/plugins/runtime-modules/core/widgets/description/editor.js +3 -2
- package/plugins/runtime-modules/core/widgets/description/server.js +3 -2
- 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/config.d.ts +1 -0
- 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/config.d.ts +1 -0
- 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.js +2 -2
- package/plugins/runtime-modules/core/widgets/html/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +320 -2
- package/plugins/runtime-modules/core/widgets/markdown/config.js +18 -4
- package/plugins/runtime-modules/core/widgets/markdown/editor.js +9 -1
- package/plugins/runtime-modules/core/widgets/markdown-toc/client.js +6 -1
- package/plugins/runtime-modules/core/widgets/markdown-toc/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/markdown-toc/config.js +14 -2
- package/plugins/runtime-modules/core/widgets/quick-links/authoring.js +7 -2
- package/plugins/runtime-modules/core/widgets/quick-links/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/quick-links/items.d.ts +0 -2
- package/plugins/runtime-modules/core/widgets/quick-links/items.js +0 -15
- 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/result/config.d.ts +1 -0
- 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/sidebar-navigation/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/sidebar-navigation/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/client.js +8 -3
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -0
- package/plugins/runtime-modules/core/widgets/simple-text/editor.js +2 -2
- 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/config.d.ts +3 -0
- 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/dashboard/card-rows.d.ts +3 -1
- package/plugins/runtime-modules/dashboard/card-rows.js +30 -2
- package/plugins/runtime-modules/dashboard/clients/dashboard-card-view.js +29 -7
- package/plugins/runtime-modules/dashboard/trees/phi-default-builder-dashboard-page-tree.js +5 -40
- 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 +157 -22
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +5 -9
- package/runtime-data-provider-client.d.ts +2 -0
- package/runtime-data-provider-client.js +7 -0
- package/server-helpers/cms-link-targets.js +6 -0
- package/styles/controls.css +74 -7
- package/styles/gradients.css +101 -0
- package/styles/layout.css +45 -2
- package/styles/root.css +18 -0
- package/styles/shell.css +137 -0
- package/theme/phi-antd-token-resolver.js +20 -1
- 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 +6 -2
- package/theme/phi-theme-tokens.js +15 -0
- package/theme/phi-theme.d.ts +5 -0
- package/theme/phi-theme.js +21 -0
- package/theme/phi-tokens.d.ts +16 -15
- package/theme/phi-tokens.js +16 -15
- package/types/cms-plugins.d.ts +2 -0
- package/types/cms-presets.d.ts +7 -0
- package/types/core-widget-placements.d.ts +3 -0
- package/types/dashboard-cards.d.ts +39 -4
- package/types/dashboard-cards.js +6 -0
- package/types/layout-style.d.ts +9 -8
- package/types/layout-style.js +9 -8
- package/types/site-theme.d.ts +10 -2
- package/types/surface.d.ts +4 -0
- package/types/surface.js +4 -0
- package/types.d.ts +1 -1
- package/types.js +1 -1
|
@@ -3,25 +3,42 @@ import { readString } from "./parser-primitives";
|
|
|
3
3
|
* How a button in a Widget's config stands out, in words that belong to this package.
|
|
4
4
|
*
|
|
5
5
|
* `normal` is the plain button, `primary` the one a surface leads with, `dashed` an outlined one for an
|
|
6
|
-
* optional step, `subtle` a button without a frame, `link` one that reads as a link.
|
|
7
|
-
*
|
|
6
|
+
* optional step, `subtle` a button without a frame, `link` one that reads as a link. `gradient` is filled
|
|
7
|
+
* with one of the Theme's gradient slots, `glass` a frosted pane for a button over a picture or a run.
|
|
8
|
+
* The Button Control maps them onto its primitive; a config never names the primitive's own vocabulary.
|
|
8
9
|
*/
|
|
9
|
-
export const PHI_BUTTON_VARIANTS = ["normal", "primary", "dashed", "subtle", "link"];
|
|
10
|
+
export const PHI_BUTTON_VARIANTS = ["normal", "primary", "dashed", "subtle", "link", "gradient", "glass"];
|
|
10
11
|
export function readPhiButtonVariant(value) {
|
|
11
12
|
const variant = readString(value);
|
|
12
13
|
return PHI_BUTTON_VARIANTS.includes(variant ?? "")
|
|
13
14
|
? variant
|
|
14
15
|
: undefined;
|
|
15
16
|
}
|
|
17
|
+
/*
|
|
18
|
+
* A gradient Button is a primary one underneath -- its colour is the edge and the fallback where the
|
|
19
|
+
* run is not drawn -- and a glass one is the plain one with a pane over it.
|
|
20
|
+
*/
|
|
16
21
|
const PHI_BUTTON_TYPE_BY_VARIANT = {
|
|
17
22
|
normal: "default",
|
|
18
23
|
primary: "primary",
|
|
19
24
|
dashed: "dashed",
|
|
20
25
|
subtle: "text",
|
|
21
26
|
link: "link",
|
|
27
|
+
gradient: "primary",
|
|
28
|
+
glass: "default",
|
|
22
29
|
};
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
/**
|
|
31
|
+
* A variant as the Button Control's props. The `gradient` variant takes the slot it names, the Theme's
|
|
32
|
+
* first where it names none, so choosing the variant alone already draws a run.
|
|
33
|
+
*/
|
|
34
|
+
export function resolvePhiButtonVariantPresentation(variant, gradient) {
|
|
35
|
+
if (!variant)
|
|
36
|
+
return {};
|
|
37
|
+
return {
|
|
38
|
+
type: PHI_BUTTON_TYPE_BY_VARIANT[variant],
|
|
39
|
+
...(variant === "gradient" ? { gradient: gradient ?? "gradient1" } : {}),
|
|
40
|
+
...(variant === "glass" ? { glass: true } : {}),
|
|
41
|
+
};
|
|
25
42
|
}
|
|
26
43
|
export const PHI_BUTTON_VARIANT_FIELD_OPTIONS = [
|
|
27
44
|
{ value: "normal", label: "Normal" },
|
|
@@ -29,4 +46,6 @@ export const PHI_BUTTON_VARIANT_FIELD_OPTIONS = [
|
|
|
29
46
|
{ value: "dashed", label: "Dashed" },
|
|
30
47
|
{ value: "subtle", label: "Subtle" },
|
|
31
48
|
{ value: "link", label: "Link" },
|
|
49
|
+
{ value: "gradient", label: "Gradient" },
|
|
50
|
+
{ value: "glass", label: "Glass" },
|
|
32
51
|
];
|
|
@@ -41,7 +41,7 @@ export declare function createPhiCommonActionField({ signalValuePath, heading, }
|
|
|
41
41
|
[signalValuePath]: PhiCommonControlActionKey;
|
|
42
42
|
label: string;
|
|
43
43
|
icon: string;
|
|
44
|
-
variant: "normal" | "subtle" | "link" | "dashed" | "primary";
|
|
44
|
+
variant: "normal" | "glass" | "subtle" | "gradient" | "link" | "dashed" | "primary";
|
|
45
45
|
danger: boolean;
|
|
46
46
|
};
|
|
47
47
|
};
|
|
@@ -43,7 +43,7 @@ export function readCssSize(value) {
|
|
|
43
43
|
*/
|
|
44
44
|
function assertPhiSurfaceConfig(surface) {
|
|
45
45
|
const cssSize = (value) => (typeof value === "number" && Number.isFinite(value)) || typeof value === "string" ? value : undefined;
|
|
46
|
-
|
|
46
|
+
const readBackground = (background) => {
|
|
47
47
|
background.value("base", "a background base: a CSS value or an object with a kind", (value) => typeof value === "string" ||
|
|
48
48
|
(isPhiRecord(value) && ["color", "gradient", "image", "none"].includes(String(value.kind)))
|
|
49
49
|
? value
|
|
@@ -51,7 +51,9 @@ function assertPhiSurfaceConfig(surface) {
|
|
|
51
51
|
background.value("overlay", "a background overlay", (value) => (isPhiRecord(value) ? value : undefined));
|
|
52
52
|
background.oneOf("filter", PHI_BACKGROUND_FILTERS);
|
|
53
53
|
background.value("motion", "a background motion", (value) => (isPhiRecord(value) ? value : undefined));
|
|
54
|
-
}
|
|
54
|
+
};
|
|
55
|
+
surface.object("background", readBackground);
|
|
56
|
+
surface.object("backgroundDark", readBackground);
|
|
55
57
|
surface.oneOf("borderSource", PHI_CMS_BORDER_SOURCES);
|
|
56
58
|
surface.object("border", (border) => {
|
|
57
59
|
border.number("borderWidth");
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Theme's gradient slots as a choice a Widget field offers (theme/phi-theme-gradients.ts).
|
|
3
|
+
*
|
|
4
|
+
* Named by slot and not by look, because the look is the Theme's: "Gradient 1" is burgundy on one Site
|
|
5
|
+
* and teal on the next, and gold in the dark mode of the first. A field that stores the slot keeps
|
|
6
|
+
* following whatever the Theme draws there.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PHI_THEME_GRADIENT_FIELD_OPTIONS: {
|
|
9
|
+
value: "gradient1" | "gradient2" | "gradient3";
|
|
10
|
+
label: string;
|
|
11
|
+
}[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PHI_THEME_GRADIENT_KEYS } from "../../../theme/phi-theme-gradients";
|
|
2
|
+
/**
|
|
3
|
+
* The Theme's gradient slots as a choice a Widget field offers (theme/phi-theme-gradients.ts).
|
|
4
|
+
*
|
|
5
|
+
* Named by slot and not by look, because the look is the Theme's: "Gradient 1" is burgundy on one Site
|
|
6
|
+
* and teal on the next, and gold in the dark mode of the first. A field that stores the slot keeps
|
|
7
|
+
* following whatever the Theme draws there.
|
|
8
|
+
*/
|
|
9
|
+
export const PHI_THEME_GRADIENT_FIELD_OPTIONS = PHI_THEME_GRADIENT_KEYS.map((key, index) => ({
|
|
10
|
+
value: key,
|
|
11
|
+
label: `Gradient ${index + 1}`,
|
|
12
|
+
}));
|
|
@@ -18,6 +18,7 @@ const PHI_BACKGROUND_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
18
18
|
base_color: PHI_BACKGROUND_WIDGET_DEFAULT_LABELS.base.color,
|
|
19
19
|
base_gradient: PHI_BACKGROUND_WIDGET_DEFAULT_LABELS.base.gradient,
|
|
20
20
|
base_image: PHI_BACKGROUND_WIDGET_DEFAULT_LABELS.base.image,
|
|
21
|
+
base_theme: PHI_BACKGROUND_WIDGET_DEFAULT_LABELS.base.theme,
|
|
21
22
|
image_url: PHI_BACKGROUND_WIDGET_DEFAULT_LABELS.image.url,
|
|
22
23
|
image_alt: PHI_BACKGROUND_WIDGET_DEFAULT_LABELS.image.alt,
|
|
23
24
|
image_position: PHI_BACKGROUND_WIDGET_DEFAULT_LABELS.image.position,
|
|
@@ -57,6 +58,7 @@ const PHI_BACKGROUND_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
57
58
|
filter_none: PHI_BACKGROUND_WIDGET_DEFAULT_LABELS.filter.none,
|
|
58
59
|
filter_glass: PHI_BACKGROUND_WIDGET_DEFAULT_LABELS.filter.glass,
|
|
59
60
|
filter_haze: PHI_BACKGROUND_WIDGET_DEFAULT_LABELS.filter.haze,
|
|
61
|
+
filter_clear: PHI_BACKGROUND_WIDGET_DEFAULT_LABELS.filter.clear,
|
|
60
62
|
filter_blur: PHI_BACKGROUND_WIDGET_DEFAULT_LABELS.filter.blur,
|
|
61
63
|
direction_up: PHI_BACKGROUND_WIDGET_DEFAULT_LABELS.direction.up,
|
|
62
64
|
direction_right: PHI_BACKGROUND_WIDGET_DEFAULT_LABELS.direction.right,
|
|
@@ -104,6 +106,7 @@ export async function getPhiBackgroundWidgetLabels(options) {
|
|
|
104
106
|
color: labels.base_color,
|
|
105
107
|
gradient: labels.base_gradient,
|
|
106
108
|
image: labels.base_image,
|
|
109
|
+
theme: labels.base_theme,
|
|
107
110
|
},
|
|
108
111
|
image: {
|
|
109
112
|
url: labels.image_url,
|
|
@@ -157,6 +160,7 @@ export async function getPhiBackgroundWidgetLabels(options) {
|
|
|
157
160
|
none: labels.filter_none,
|
|
158
161
|
glass: labels.filter_glass,
|
|
159
162
|
haze: labels.filter_haze,
|
|
163
|
+
clear: labels.filter_clear,
|
|
160
164
|
blur: labels.filter_blur,
|
|
161
165
|
},
|
|
162
166
|
direction: {
|
|
@@ -14,6 +14,7 @@ const PHI_GEOMETRY_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
14
14
|
section_stacking: PHI_GEOMETRY_WIDGET_DEFAULT_LABELS.sections.stacking,
|
|
15
15
|
field_sticky: PHI_GEOMETRY_WIDGET_DEFAULT_LABELS.fields.sticky,
|
|
16
16
|
field_offset_top: PHI_GEOMETRY_WIDGET_DEFAULT_LABELS.fields.offsetTop,
|
|
17
|
+
field_offset_bottom: PHI_GEOMETRY_WIDGET_DEFAULT_LABELS.fields.offsetBottom,
|
|
17
18
|
field_size: PHI_GEOMETRY_WIDGET_DEFAULT_LABELS.fields.size,
|
|
18
19
|
field_min_size: PHI_GEOMETRY_WIDGET_DEFAULT_LABELS.fields.minSize,
|
|
19
20
|
field_max_size: PHI_GEOMETRY_WIDGET_DEFAULT_LABELS.fields.maxSize,
|
|
@@ -39,6 +40,7 @@ export async function getPhiGeometryWidgetLabels(options) {
|
|
|
39
40
|
fields: {
|
|
40
41
|
sticky: labels.field_sticky,
|
|
41
42
|
offsetTop: labels.field_offset_top,
|
|
43
|
+
offsetBottom: labels.field_offset_bottom,
|
|
42
44
|
size: labels.field_size,
|
|
43
45
|
minSize: labels.field_min_size,
|
|
44
46
|
maxSize: labels.field_max_size,
|
|
@@ -31,6 +31,7 @@ const PHI_INSPECTOR_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
31
31
|
region_visibility_reveal: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.regionVisibility.reveal,
|
|
32
32
|
region_visibility_always: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.regionVisibility.always,
|
|
33
33
|
region_visibility_hover: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.regionVisibility.hover,
|
|
34
|
+
region_hero_overlap: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.regionVisibility.heroOverlap,
|
|
34
35
|
region_visibility_scroll_up: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.regionVisibility.scrollUp,
|
|
35
36
|
region_visibility_page_owned: definePhiMessageLabel(PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.regionVisibility.pageOwned),
|
|
36
37
|
surface_style_title: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.surfaceStyle.title,
|
|
@@ -43,6 +44,7 @@ const PHI_INSPECTOR_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
43
44
|
tone_light: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.tone.light,
|
|
44
45
|
tone_dark: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.tone.dark,
|
|
45
46
|
tone_inverse: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.tone.inverse,
|
|
47
|
+
tone_background_per_mode: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.tone.backgroundPerMode,
|
|
46
48
|
grid_columns: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.grid.columns,
|
|
47
49
|
grid_masonry_columns: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.grid.masonryColumns,
|
|
48
50
|
grid_distribution: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.grid.distribution,
|
|
@@ -109,6 +111,7 @@ export async function getPhiInspectorWidgetLabels(options) {
|
|
|
109
111
|
hover: labels.region_visibility_hover,
|
|
110
112
|
scrollUp: labels.region_visibility_scroll_up,
|
|
111
113
|
pageOwned: labels.region_visibility_page_owned,
|
|
114
|
+
heroOverlap: labels.region_hero_overlap,
|
|
112
115
|
},
|
|
113
116
|
surfaceStyle: {
|
|
114
117
|
title: labels.surface_style_title,
|
|
@@ -123,6 +126,7 @@ export async function getPhiInspectorWidgetLabels(options) {
|
|
|
123
126
|
light: labels.tone_light,
|
|
124
127
|
dark: labels.tone_dark,
|
|
125
128
|
inverse: labels.tone_inverse,
|
|
129
|
+
backgroundPerMode: labels.tone_background_per_mode,
|
|
126
130
|
},
|
|
127
131
|
grid: {
|
|
128
132
|
columns: labels.grid_columns,
|
|
@@ -14,6 +14,7 @@ export type PhiBackgroundWidgetLabels = {
|
|
|
14
14
|
color: string;
|
|
15
15
|
gradient: string;
|
|
16
16
|
image: string;
|
|
17
|
+
theme: string;
|
|
17
18
|
};
|
|
18
19
|
image: {
|
|
19
20
|
url: string;
|
|
@@ -67,6 +68,7 @@ export type PhiBackgroundWidgetLabels = {
|
|
|
67
68
|
none: string;
|
|
68
69
|
glass: string;
|
|
69
70
|
haze: string;
|
|
71
|
+
clear: string;
|
|
70
72
|
blur: string;
|
|
71
73
|
};
|
|
72
74
|
direction: {
|
|
@@ -14,6 +14,7 @@ export const PHI_BACKGROUND_WIDGET_DEFAULT_LABELS = {
|
|
|
14
14
|
color: "Color",
|
|
15
15
|
gradient: "Gradient",
|
|
16
16
|
image: "Image",
|
|
17
|
+
theme: "Theme",
|
|
17
18
|
},
|
|
18
19
|
image: {
|
|
19
20
|
url: "Image URL",
|
|
@@ -67,6 +68,7 @@ export const PHI_BACKGROUND_WIDGET_DEFAULT_LABELS = {
|
|
|
67
68
|
none: "None",
|
|
68
69
|
glass: "Glass",
|
|
69
70
|
haze: "Haze",
|
|
71
|
+
clear: "Clear",
|
|
70
72
|
blur: "Blur",
|
|
71
73
|
},
|
|
72
74
|
direction: {
|
|
@@ -11,12 +11,12 @@ export const PHI_COMMON_CONTROL_DEFAULT_LABELS = {
|
|
|
11
11
|
meta: { label: "Meta", tooltip: "Meta", icon: "meta" },
|
|
12
12
|
new: { label: "New", tooltip: "New", icon: "new" },
|
|
13
13
|
pageMeta: { label: "Meta", tooltip: "Page meta", icon: "meta" },
|
|
14
|
-
publish: { label: "Publish", tooltip: "Publish", icon: "publish"
|
|
14
|
+
publish: { label: "Publish", tooltip: "Publish", icon: "publish" },
|
|
15
15
|
reload: { label: "Reload", tooltip: "Reload", icon: "reload" },
|
|
16
16
|
reset: { label: "Reset", tooltip: "Reset", icon: "reset", danger: true },
|
|
17
17
|
restore: { label: "Restore", tooltip: "Restore", icon: "restore" },
|
|
18
18
|
review: { label: "Review", tooltip: "Review", icon: "preview" },
|
|
19
|
-
save: { label: "Save", tooltip: "Save", icon: "save"
|
|
19
|
+
save: { label: "Save", tooltip: "Save", icon: "save" },
|
|
20
20
|
search: { label: "Search", tooltip: "Search", icon: "search" },
|
|
21
21
|
undo: { label: "Undo", tooltip: "Undo", icon: "undo" },
|
|
22
22
|
redo: { label: "Redo", tooltip: "Redo", icon: "redo" },
|
|
@@ -33,6 +33,8 @@ export type PhiInspectorWidgetLabels = {
|
|
|
33
33
|
light: string;
|
|
34
34
|
dark: string;
|
|
35
35
|
inverse: string;
|
|
36
|
+
/** The switch that gives a Surface a ground of its own in dark mode (`PhiSurface.backgroundDark`). */
|
|
37
|
+
backgroundPerMode: string;
|
|
36
38
|
};
|
|
37
39
|
/**
|
|
38
40
|
* A Grid's columns -- how many slots a row holds at each width, and where one slot stands -- and a
|
|
@@ -70,6 +72,8 @@ export type PhiInspectorRegionVisibilityLabels = {
|
|
|
70
72
|
hover: string;
|
|
71
73
|
scrollUp: string;
|
|
72
74
|
pageOwned: string;
|
|
75
|
+
/** How far the Page's `content` reaches up into its Hero (`PhiCmsRegionConfig.heroOverlap`). */
|
|
76
|
+
heroOverlap: string;
|
|
73
77
|
};
|
|
74
78
|
export type PhiInspectorLinkTargetLabels = {
|
|
75
79
|
none: string;
|
|
@@ -30,6 +30,7 @@ export const PHI_INSPECTOR_WIDGET_DEFAULT_LABELS = {
|
|
|
30
30
|
hover: "At the top edge",
|
|
31
31
|
scrollUp: "When scrolling up",
|
|
32
32
|
pageOwned: "This Region belongs to its Page and stands on that Page alone.",
|
|
33
|
+
heroOverlap: "Reaches into the Hero",
|
|
33
34
|
},
|
|
34
35
|
surfaceStyle: {
|
|
35
36
|
title: "Style",
|
|
@@ -44,6 +45,7 @@ export const PHI_INSPECTOR_WIDGET_DEFAULT_LABELS = {
|
|
|
44
45
|
light: "Light",
|
|
45
46
|
dark: "Dark",
|
|
46
47
|
inverse: "Inverse",
|
|
48
|
+
backgroundPerMode: "Own background in dark mode",
|
|
47
49
|
},
|
|
48
50
|
grid: {
|
|
49
51
|
columns: "Slots per row",
|
|
@@ -41,6 +41,16 @@ export type PhiResolvedBulletListStyle = {
|
|
|
41
41
|
gap: PhiSpacingScaleKey;
|
|
42
42
|
flags: number;
|
|
43
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* The markers a browser cycles through, and a tight gap. Exported so a Widget can state them as its
|
|
46
|
+
* defaults, which is what an Inspector shows for a list nobody has set yet.
|
|
47
|
+
*/
|
|
48
|
+
export declare const PHI_BULLET_LIST_DEFAULT_STYLE: {
|
|
49
|
+
readonly level1: "dot";
|
|
50
|
+
readonly level2: "circle";
|
|
51
|
+
readonly level3: "dash";
|
|
52
|
+
readonly gap: "xs";
|
|
53
|
+
};
|
|
44
54
|
/** A stored list style, part by part; whatever is not one of its values is left out. */
|
|
45
55
|
export declare function readPhiBulletListStyle(value: unknown): PhiBulletListStyle | undefined;
|
|
46
56
|
export declare function resolvePhiBulletListStyle(style: PhiBulletListStyle | null | undefined): PhiResolvedBulletListStyle;
|
|
@@ -20,8 +20,11 @@ export const PhiBulletListFlag = {
|
|
|
20
20
|
/** A line between entries, for entries without a ground of their own. */
|
|
21
21
|
Dividers: 1 << 0,
|
|
22
22
|
};
|
|
23
|
-
/**
|
|
24
|
-
|
|
23
|
+
/**
|
|
24
|
+
* The markers a browser cycles through, and a tight gap. Exported so a Widget can state them as its
|
|
25
|
+
* defaults, which is what an Inspector shows for a list nobody has set yet.
|
|
26
|
+
*/
|
|
27
|
+
export const PHI_BULLET_LIST_DEFAULT_STYLE = {
|
|
25
28
|
level1: "dot",
|
|
26
29
|
level2: "circle",
|
|
27
30
|
level3: "dash",
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
+
import { type PhiBackgroundOverlay } from "../config/background";
|
|
3
|
+
import { type PhiButtonVariant } from "../config/button-variant";
|
|
4
|
+
import type { PhiThemeGradientKey } from "../../../theme/phi-theme-gradients";
|
|
2
5
|
import { type PhiImageControlSource } from "../../controls/phi-image-control";
|
|
3
6
|
import type { PhiImagePresentation } from "../../media/image-presentation";
|
|
4
7
|
import type { PhiClientBlockBaseProps } from "../../../types";
|
|
5
8
|
import type { PhiSurface } from "../../../types/surface";
|
|
6
9
|
import type { PhiSignalRouteSet } from "../../../types/signals";
|
|
7
|
-
import type { PhiCardBillingPeriod, PhiCardHeadingLevel, PhiCardHoverEffect, PhiCardIconPlacement, PhiCardTextAlign, PhiCardTextSlot, PhiCardVariant, PhiCardWidgetBody } from "./card-vocabulary";
|
|
8
|
-
export type { PhiCardBillingPeriod, PhiCardHeadingLevel, PhiCardHoverEffect, PhiCardIconPlacement, PhiCardTextAlign, PhiCardTextSlot, PhiCardVariant, PhiCardWidgetBody, } from "./card-vocabulary";
|
|
10
|
+
import type { PhiCardBadgeStyle, PhiCardBillingPeriod, PhiCardHeadingLevel, PhiCardHoverEffect, PhiCardIconPlacement, PhiCardTextAlign, PhiCardTextSlot, PhiCardVariant, PhiCardWidgetBody } from "./card-vocabulary";
|
|
11
|
+
export type { PhiCardBadgeStyle, PhiCardBillingPeriod, PhiCardHeadingLevel, PhiCardHoverEffect, PhiCardIconPlacement, PhiCardTextAlign, PhiCardTextSlot, PhiCardVariant, PhiCardWidgetBody, } from "./card-vocabulary";
|
|
9
12
|
export type PhiCardWidgetClientLabels = {
|
|
10
13
|
eyebrow?: string;
|
|
11
14
|
/**
|
|
@@ -42,6 +45,8 @@ export type PhiCardWidgetImage = {
|
|
|
42
45
|
presentation: PhiImagePresentation;
|
|
43
46
|
/** 0 to 1; absent is the whole picture. */
|
|
44
47
|
opacity?: number;
|
|
48
|
+
/** A layer over the picture, under the card's marks (`PhiCmsCardWidgetConfig.imageOverlay`). */
|
|
49
|
+
overlay?: PhiBackgroundOverlay | null;
|
|
45
50
|
source: PhiImageControlSource;
|
|
46
51
|
alt: string;
|
|
47
52
|
blurDataUrl?: string | null;
|
|
@@ -72,6 +77,10 @@ export type PhiCardWidgetClientConfig = {
|
|
|
72
77
|
highlight?: boolean;
|
|
73
78
|
/** The badge's ground; absent, the Theme's primary. */
|
|
74
79
|
badgeColor?: string;
|
|
80
|
+
/** How the badge is drawn; absent, `none`. */
|
|
81
|
+
badgeStyle?: PhiCardBadgeStyle;
|
|
82
|
+
/** A Theme gradient slot the badge is filled with, over `badgeColor`. */
|
|
83
|
+
badgeGradient?: PhiThemeGradientKey;
|
|
75
84
|
/** Which price a `plan` shows until a `billingPeriod` signal says otherwise. Absent is `monthly`. */
|
|
76
85
|
billingPeriod?: PhiCardBillingPeriod;
|
|
77
86
|
hoverEffect?: PhiCardHoverEffect;
|
|
@@ -85,11 +94,15 @@ export type PhiCardWidgetAction = {
|
|
|
85
94
|
icon?: string;
|
|
86
95
|
/** The button's name where it shows only its icon. */
|
|
87
96
|
ariaLabel?: string;
|
|
97
|
+
/** How it stands out; absent, primary on a highlighted card and normal otherwise. */
|
|
98
|
+
variant?: PhiButtonVariant;
|
|
99
|
+
/** The Theme gradient slot a `gradient` button is filled with. */
|
|
100
|
+
gradient?: PhiThemeGradientKey;
|
|
88
101
|
};
|
|
89
102
|
export type PhiCardWidgetClientProps = PhiClientBlockBaseProps<PhiCardWidgetClientLabels, PhiCardWidgetClientConfig> & {
|
|
90
103
|
binding?: PhiCardWidgetClientBinding;
|
|
91
104
|
/**
|
|
92
|
-
* What a `list` body draws, and a `plan` body's features, already drawn.
|
|
105
|
+
* What a `list` body draws, a `series` body's chart, and a `plan` body's features, already drawn.
|
|
93
106
|
*
|
|
94
107
|
* Handed in rather than drawn here: the Card is on Public pages, and a list Control imported by it
|
|
95
108
|
* would load on every page with a Card. A Dashboard draws its entries and passes them; a plan card's
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { PhiButtonControl } from "../../controls/phi-button-control";
|
|
5
|
+
import { PHI_BACKGROUND_OVERLAY_DEFAULT_OPACITY, resolvePhiBackgroundWidgetStyle, } from "../config/background";
|
|
6
|
+
import { resolvePhiButtonVariantPresentation } from "../config/button-variant";
|
|
5
7
|
import { PhiFlexControl } from "../../controls/phi-flex-control";
|
|
6
8
|
import { PhiImageControl } from "../../controls/phi-image-control";
|
|
7
9
|
import { PhiRibbonControl } from "../../controls/phi-ribbon-control";
|
|
10
|
+
import { PhiRibbonWrapControl } from "../../controls/phi-ribbon-wrap-control";
|
|
8
11
|
import { PhiSkeletonControl } from "../../controls/phi-skeleton-control";
|
|
9
12
|
import { PhiStatisticControl } from "../../controls/phi-statistic-control";
|
|
10
13
|
import { PhiTypographyControl } from "../../controls/phi-typography-control";
|
|
@@ -16,7 +19,27 @@ import { PhiSurfaceTone } from "../../surface/phi-surface-tone";
|
|
|
16
19
|
import { resolvePhiSurfaceStyle } from "../../../helpers/surface-style";
|
|
17
20
|
import { usePhiControlSignalController } from "../client/shared/phi-control-signals";
|
|
18
21
|
import { PHI_COLOR, PHI_SPACE } from "../../../theme/antd-css-var-contract";
|
|
22
|
+
import { PHI_THEME_HEADING_FONT_VARIABLE } from "../../../theme/phi-theme-typography";
|
|
19
23
|
import { PHI_CARD_TEXT_SLOTS, readPhiCardBillingPeriod } from "./card-vocabulary";
|
|
24
|
+
/**
|
|
25
|
+
* The layer over a card's picture. A colour or a gradient is drawn as CSS, each colour mixed down to the
|
|
26
|
+
* Overlay's opacity, so a Theme variable (`var(--ant-color-bg-container)`) resolves and the picture fades
|
|
27
|
+
* into the card's own ground in either mode; a Background draws the same Overlay into an SVG picture,
|
|
28
|
+
* where no variable reaches. A pattern or noise is drawn as a Background draws it.
|
|
29
|
+
*/
|
|
30
|
+
function resolvePhiCardImageOverlayStyle(overlay) {
|
|
31
|
+
if (overlay.kind !== "color") {
|
|
32
|
+
return resolvePhiBackgroundWidgetStyle({ base: { kind: "none" }, overlay });
|
|
33
|
+
}
|
|
34
|
+
const opacity = Math.round(Math.max(0, Math.min(1, overlay.opacity ?? PHI_BACKGROUND_OVERLAY_DEFAULT_OPACITY)) * 1000) / 10;
|
|
35
|
+
const mix = (color) => (color === "transparent" || opacity >= 100
|
|
36
|
+
? color
|
|
37
|
+
: `color-mix(in srgb, ${color} ${opacity}%, transparent)`);
|
|
38
|
+
const ink = overlay.ink ?? { kind: "color", color: "#000000" };
|
|
39
|
+
return ink.kind === "color"
|
|
40
|
+
? { backgroundColor: mix(ink.color) }
|
|
41
|
+
: { backgroundImage: `linear-gradient(${ink.direction}, ${ink.stops.map((stop) => `${mix(stop.color)} ${stop.percent}%`).join(", ")})` };
|
|
42
|
+
}
|
|
20
43
|
const PHI_CARD_SIGNAL_TEXT_SLOTS = new Set(PHI_CARD_TEXT_SLOTS);
|
|
21
44
|
/*
|
|
22
45
|
* What each variant sets, in one row per variant. A further variant -- a featured card -- is a row here
|
|
@@ -192,6 +215,8 @@ export function PhiCardWidgetClient({ labels: placedLabels, config, binding, lis
|
|
|
192
215
|
* Segmented's items follow their track. The Theme's plain corner did not: a pill Site drew square marks.
|
|
193
216
|
*/
|
|
194
217
|
const iconCorner = (side) => `calc(var(--phi-control-radius-lg, ${token.borderRadiusLG}px) * ${side / token.controlHeightLG})`;
|
|
218
|
+
/* The framed box an icon before the title stands in. */
|
|
219
|
+
const inlineIconFrame = iconSize + 16;
|
|
195
220
|
const iconMark = (size, framed) => iconName ? (_jsx("span", { "aria-hidden": "true", className: "phi-card__icon", style: {
|
|
196
221
|
display: "inline-flex",
|
|
197
222
|
flex: "none",
|
|
@@ -207,10 +232,34 @@ export function PhiCardWidgetClient({ labels: placedLabels, config, binding, lis
|
|
|
207
232
|
* unreadable. A card whose figure is the only thing it has makes the figure the link.
|
|
208
233
|
*/
|
|
209
234
|
const valueText = renderText ? renderText("value", labels.value) : null;
|
|
210
|
-
|
|
235
|
+
/*
|
|
236
|
+
* Beside an icon before the title, the figure starts where the title's words do, under them rather
|
|
237
|
+
* than under the icon: the number belongs to the heading, the icon only marks it. On a line set to its
|
|
238
|
+
* start only -- centred or at the end, the figure already stands with the words.
|
|
239
|
+
*/
|
|
240
|
+
const figureIndent = iconPlacement === "inline" && iconName && (textAlign === "start" || textAlign === "justify")
|
|
241
|
+
? { paddingInlineStart: inlineIconFrame + gap }
|
|
242
|
+
: {};
|
|
243
|
+
/*
|
|
244
|
+
* The figure is set like the title it belongs to: in the font the Theme gives headings, and with digits
|
|
245
|
+
* of one width, so a figure that changes does not shift as it counts. No fallback in the `var()`, as for
|
|
246
|
+
* the headings themselves (`styles/layout.css`): a Theme that keeps headings on the body font sets no
|
|
247
|
+
* variable, and the figure inherits the body font.
|
|
248
|
+
*/
|
|
249
|
+
const figureType = {
|
|
250
|
+
fontFamily: `var(${PHI_THEME_HEADING_FONT_VARIABLE})`,
|
|
251
|
+
fontVariantNumeric: "tabular-nums",
|
|
252
|
+
};
|
|
253
|
+
const figure = valueText != null ? (_jsx("div", { style: {
|
|
254
|
+
...figureType,
|
|
255
|
+
fontSize: token.fontSizeHeading3,
|
|
256
|
+
color: highlight ? PHI_COLOR.primary : PHI_COLOR.textHeading,
|
|
257
|
+
...slotWidth,
|
|
258
|
+
...figureIndent,
|
|
259
|
+
}, children: valueText })) : (_jsx(PhiStatisticControl, { value: binding?.error ?? labels.value ?? "", loading: binding?.loading === true || overrides.loading === true, style: figureIndent, styles: {
|
|
211
260
|
content: binding?.error
|
|
212
261
|
? { color: PHI_COLOR.error, fontSize: token.fontSize }
|
|
213
|
-
: { color: highlight ? PHI_COLOR.primary : PHI_COLOR.textHeading },
|
|
262
|
+
: { ...figureType, color: highlight ? PHI_COLOR.primary : PHI_COLOR.textHeading },
|
|
214
263
|
} }));
|
|
215
264
|
/* A failure stands where the lines would, as it does for a figure; a list still coming is three lines. */
|
|
216
265
|
const list = binding?.error ? (_jsx(PhiTypographyControl, { style: { color: PHI_COLOR.error, ...slotWidth }, children: binding.error })) : binding?.loading === true || overrides.loading === true ? (_jsx(PhiSkeletonControl, { lines: 3 })) : listContent ?? null;
|
|
@@ -230,7 +279,7 @@ export function PhiCardWidgetClient({ labels: placedLabels, config, binding, lis
|
|
|
230
279
|
color: highlight ? PHI_COLOR.primary : PHI_COLOR.textHeading,
|
|
231
280
|
...slotWidth,
|
|
232
281
|
}, children: priceText })) : null, periodText != null ? (_jsx("span", { style: { color: PHI_COLOR.textSecondary, ...slotWidth }, children: periodText })) : null] })) : null, list != null ? _jsx("div", { style: { justifySelf: "stretch", minWidth: 0, textAlign: "start" }, children: list }) : null] })) : null;
|
|
233
|
-
const headingRow = iconPlacement === "inline" && iconName ? (_jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: justify, gap, ...slotWidth }, children: [iconMark(iconSize,
|
|
282
|
+
const headingRow = iconPlacement === "inline" && iconName ? (_jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: justify, gap, ...slotWidth }, children: [iconMark(iconSize, inlineIconFrame), heading] })) : heading;
|
|
234
283
|
const media = image ? (_jsxs("div", { className: "phi-card__media", style: {
|
|
235
284
|
position: "relative",
|
|
236
285
|
aspectRatio: metrics.mediaAspectRatio ?? resolveMediaAspectRatio(image.presentation),
|
|
@@ -239,7 +288,12 @@ export function PhiCardWidgetClient({ labels: placedLabels, config, binding, lis
|
|
|
239
288
|
width: "100%",
|
|
240
289
|
height: "100%",
|
|
241
290
|
...(image.opacity == null || image.opacity >= 1 ? {} : { opacity: image.opacity }),
|
|
242
|
-
} }),
|
|
291
|
+
} }), image.overlay ? (_jsx("span", { "aria-hidden": "true", className: "phi-card__media-overlay", style: {
|
|
292
|
+
...resolvePhiCardImageOverlayStyle(image.overlay),
|
|
293
|
+
position: "absolute",
|
|
294
|
+
inset: 0,
|
|
295
|
+
pointerEvents: "none",
|
|
296
|
+
} })) : null, iconAtTop && iconName ? (_jsx("span", { "aria-hidden": "true", className: "phi-card__icon", style: {
|
|
243
297
|
position: "absolute",
|
|
244
298
|
insetInlineStart: markSide === "start" ? inset : markSide === "end" ? undefined : "50%",
|
|
245
299
|
insetInlineEnd: markSide === "end" ? inset : undefined,
|
|
@@ -289,24 +343,41 @@ export function PhiCardWidgetClient({ labels: placedLabels, config, binding, lis
|
|
|
289
343
|
const footAction = body === "plan" && action != null;
|
|
290
344
|
const actionButton = action ? (_jsx("div", { className: "phi-card__action",
|
|
291
345
|
/* At the foot, it stands where the words' alignment puts it, as it does among them. */
|
|
292
|
-
style: footAction ? { marginTop: "auto", alignSelf: textAlign === "center" ? "center" : textAlign === "end" ? "flex-end" : "flex-start" } : undefined, children: _jsx(PhiButtonControl, {
|
|
346
|
+
style: footAction ? { marginTop: "auto", alignSelf: textAlign === "center" ? "center" : textAlign === "end" ? "flex-end" : "flex-start" } : undefined, children: _jsx(PhiButtonControl, { ...(action.variant
|
|
347
|
+
? resolvePhiButtonVariantPresentation(action.variant, action.gradient)
|
|
348
|
+
: { type: highlight ? "primary" : "default" }), size: buttonSize, ...(action.href ? { href: action.href, newTab: action.newTab, external: action.external } : {}), label: labels.actionLabel || undefined, ...(labels.actionLabel ? {} : { ariaLabel: action.ariaLabel }), ...(action.icon ? { icon: _jsx(PhiIcon, { name: action.icon, size: "1em" }) } : {}), ...(activates ? { onClick: () => controlSignals.emitCapability("activate", null) } : {}) }) })) : null;
|
|
293
349
|
/*
|
|
294
350
|
* The band in the card's top end corner, floating (`PhiRibbonControl`): the words below it start where
|
|
295
351
|
* they start in a card without one, so plans side by side keep their headings on one line.
|
|
296
352
|
*/
|
|
297
|
-
const
|
|
298
|
-
const
|
|
353
|
+
const badgeStyle = config?.badgeStyle ?? "none";
|
|
354
|
+
const ribbon = badge != null && (badgeStyle === "corner" || badgeStyle === "tag") ? (_jsx(PhiRibbonControl, { color: config?.badgeColor, ...(config?.badgeGradient ? { gradient: config.badgeGradient } : {}), placement: badgeStyle === "tag" ? "edge" : "corner", ...(!renderText && labels.badge
|
|
355
|
+
? {
|
|
356
|
+
fullText: labels.badge,
|
|
357
|
+
...(href
|
|
358
|
+
? {
|
|
359
|
+
onClick: (event) => event.currentTarget.closest(".phi-card")?.querySelector(".phi-card__link")?.click(),
|
|
360
|
+
}
|
|
361
|
+
: {}),
|
|
362
|
+
}
|
|
363
|
+
: {}), ...(renderText ? { style: { pointerEvents: "auto", minWidth: "6em" } } : {}), children: badge })) : null;
|
|
364
|
+
const words = (_jsxs("div", { style: { display: "grid", gap, padding: footAction ? 0 : inset, justifyItems }, children: [iconAtTop && iconName && !image ? (_jsx("div", { style: { justifySelf: markSide === "center" ? "center" : markSide === "end" ? "end" : "start" }, children: iconMark(topIconSize, topIconSize + 24) })) : null, eyebrow != null && !eyebrowOnMedia && !labels.eyebrowEnd ? (_jsx(PhiTypographyControl, { type: "secondary", style: { ...eyebrowType, color: highlight ? PHI_COLOR.primary : PHI_COLOR.textTertiary, ...slotWidth }, children: eyebrow })) : null, labels.eyebrowEnd && !eyebrowOnMedia ? (_jsxs(PhiFlexControl, { justify: "space-between", align: "baseline", wrap: true, gap: PHI_SPACE.xs, style: { justifySelf: "stretch", minWidth: 0 }, children: [_jsx(PhiTypographyControl, { type: "secondary", style: { ...eyebrowType, color: highlight ? PHI_COLOR.primary : PHI_COLOR.textTertiary }, children: eyebrow ?? "" }), _jsx(PhiTypographyControl, { type: "secondary", style: { ...eyebrowType, color: PHI_COLOR.textTertiary }, children: labels.eyebrowEnd })] })) : null, headingRow, body === "stat" ? figure : null, body === "series" ? (_jsxs(_Fragment, { children: [labels.value || binding?.error || binding?.loading === true || overrides.loading === true ? figure : null, list != null && !binding?.error && binding?.loading !== true && overrides.loading !== true ? (_jsx("div", { style: { justifySelf: "stretch", minWidth: 0 }, children: list })) : null] })) : null, body === "list" && list != null ? (_jsx("div", { style: { justifySelf: "stretch", minWidth: 0 }, children: list })) : null, description != null ? (_jsx(PhiTypographyControl, { presentation: "paragraph", style: {
|
|
299
365
|
marginBottom: 0,
|
|
300
366
|
color: PHI_COLOR.textSecondary,
|
|
301
367
|
fontSize: descriptionSize,
|
|
302
368
|
...slotWidth,
|
|
303
369
|
}, children: description })) : null, plan, meta != null ? (_jsx(PhiTypographyControl, { type: "secondary", style: { fontSize: token.fontSizeSM, color: PHI_COLOR.textTertiary, ...slotWidth }, children: meta })) : null, footAction ? null : actionButton] }));
|
|
304
370
|
const content = (_jsxs(_Fragment, { children: [media, footAction ? (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap, padding: inset, flex: "1 1 auto", minWidth: 0 }, children: [words, actionButton] })) : words, cardLink] }));
|
|
305
|
-
|
|
371
|
+
const card = (_jsxs("article", { className: [
|
|
306
372
|
"phi-card",
|
|
307
373
|
href ? "phi-card--link" : null,
|
|
308
374
|
highlight ? "phi-card--highlight" : null,
|
|
309
375
|
hoverEffect !== "none" ? `phi-card--hover-${hoverEffect}` : null,
|
|
310
376
|
surface.className,
|
|
311
377
|
].filter(Boolean).join(" "), "data-phi-card-variant": variant, style: boxStyle, children: [_jsx(PhiSurfaceGroundLayer, { ground: surface.ground, className: "phi-card__ground" }), ribbon, surface.className ? _jsx(PhiSurfaceTone, { tone: config?.surface?.tone, children: content }) : content] }));
|
|
378
|
+
/*
|
|
379
|
+
* A ribbon hangs over the card's edge, which the card -- clipping for its picture and its zoom -- cannot
|
|
380
|
+
* give a child of its own; it wraps the card instead (`PhiRibbonWrapControl`). An editor writes in it.
|
|
381
|
+
*/
|
|
382
|
+
return badge != null && badgeStyle === "ribbon" ? (_jsx(PhiRibbonWrapControl, { text: badge, ...(config?.badgeColor ? { color: config.badgeColor } : {}), ...(config?.badgeGradient ? { gradient: config.badgeGradient } : {}), interactive: renderText != null, className: hoverEffect === "lift" ? "phi-card-ribbon phi-card-ribbon--lift" : "phi-card-ribbon", children: card })) : card;
|
|
312
383
|
}
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* `text` is a heading. `stat` is a labelled figure: the label is the heading, so a card that counts
|
|
5
5
|
* something says what it counted in the same place and type a text card says what it is about, and the
|
|
6
6
|
* figure is drawn by the house's one statistic Control. `list` is a heading over a few lines the caller
|
|
7
|
-
* draws and hands in (`listContent`), which only a Dashboard does today. `
|
|
7
|
+
* draws and hands in (`listContent`), which only a Dashboard does today. `series` is a figure over time:
|
|
8
|
+
* the headline as a `stat` draws it, over a chart the caller draws and hands in the same way -- a Dashboard
|
|
9
|
+
* again, so the chart Control never loads with a Card on a Public page. `plan` is an offer: a price
|
|
8
10
|
* and what it is paid per, a monthly and a yearly one of each, over a list of what the plan includes and
|
|
9
11
|
* what it does not (`PhiBulletListEntry.state`). Several plan cards side by side are a Layout's row, and
|
|
10
12
|
* the recommended one is the card that is `highlight`ed.
|
|
@@ -12,7 +14,7 @@
|
|
|
12
14
|
* The body is chosen, never inferred from whether a value happens to have arrived. A card that decided
|
|
13
15
|
* by presence would draw as text and reflow into a statistic the moment its figure landed.
|
|
14
16
|
*/
|
|
15
|
-
export type PhiCardWidgetBody = "text" | "stat" | "list" | "plan";
|
|
17
|
+
export type PhiCardWidgetBody = "text" | "stat" | "list" | "series" | "plan";
|
|
16
18
|
/**
|
|
17
19
|
* Which of a plan card's two prices it shows. A plan states one, the other, or both; one that states
|
|
18
20
|
* only the monthly price shows it under `yearly` as well, so a period switch on the page never leaves a
|
|
@@ -36,6 +38,14 @@ export type PhiCardHeadingLevel = (typeof PHI_CARD_HEADING_LEVELS)[number];
|
|
|
36
38
|
/** Logical, so `start` is the left in a left-to-right page and the right in a right-to-left one. */
|
|
37
39
|
export declare const PHI_CARD_TEXT_ALIGNS: readonly ["start", "center", "end", "justify"];
|
|
38
40
|
export type PhiCardTextAlign = (typeof PHI_CARD_TEXT_ALIGNS)[number];
|
|
41
|
+
/**
|
|
42
|
+
* How a card's badge is drawn. `corner` is a band flush in the top end corner, `tag` a rounded mark a
|
|
43
|
+
* little down the end edge -- both inside the card. `ribbon` hangs over the end edge with a fold behind
|
|
44
|
+
* it, and needs room beside the card. `none` draws nothing and keeps the words, to hide a badge for a
|
|
45
|
+
* while. Absent is `none`: a card has a badge once a style is chosen for it.
|
|
46
|
+
*/
|
|
47
|
+
export declare const PHI_CARD_BADGE_STYLES: readonly ["none", "corner", "tag", "ribbon"];
|
|
48
|
+
export type PhiCardBadgeStyle = (typeof PHI_CARD_BADGE_STYLES)[number];
|
|
39
49
|
/**
|
|
40
50
|
* Where the icon stands: before the heading, small, or at the top, large -- at the start, the middle or
|
|
41
51
|
* the end of the line, over the picture when the card has one, on a ground of its own so it reads on any
|
|
@@ -24,6 +24,13 @@ export function readPhiCardBillingPeriod(value) {
|
|
|
24
24
|
export const PHI_CARD_HEADING_LEVELS = ["h2", "h3", "h4"];
|
|
25
25
|
/** Logical, so `start` is the left in a left-to-right page and the right in a right-to-left one. */
|
|
26
26
|
export const PHI_CARD_TEXT_ALIGNS = ["start", "center", "end", "justify"];
|
|
27
|
+
/**
|
|
28
|
+
* How a card's badge is drawn. `corner` is a band flush in the top end corner, `tag` a rounded mark a
|
|
29
|
+
* little down the end edge -- both inside the card. `ribbon` hangs over the end edge with a fold behind
|
|
30
|
+
* it, and needs room beside the card. `none` draws nothing and keeps the words, to hide a badge for a
|
|
31
|
+
* while. Absent is `none`: a card has a badge once a style is chosen for it.
|
|
32
|
+
*/
|
|
33
|
+
export const PHI_CARD_BADGE_STYLES = ["none", "corner", "tag", "ribbon"];
|
|
27
34
|
/**
|
|
28
35
|
* Where the icon stands: before the heading, small, or at the top, large -- at the start, the middle or
|
|
29
36
|
* the end of the line, over the picture when the card has one, on a ground of its own so it reads on any
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PhiRuntimeModuleDataProviderDescriptor } from "../../../types/cms-plugins";
|
|
2
|
+
import type { PhiProviderResourceSource, PhiRuntimeDataProviderKey } from "../../../types/runtime-data-provider";
|
|
3
|
+
export declare const PhiCollectionSourceFailureText: {
|
|
4
|
+
readonly notConfigured: () => string;
|
|
5
|
+
readonly providerUnavailable: (providerKey: string) => string;
|
|
6
|
+
readonly resourceUnavailable: (resourceKey: string, providerKey: string) => string;
|
|
7
|
+
readonly rendererUnavailable: (rendererKey: string) => string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Why a Collection View cannot draw, as far as that is known without asking the source anything.
|
|
11
|
+
*
|
|
12
|
+
* This is what the Builder can say: it never reads the data, so a read that would fail is not its to
|
|
13
|
+
* find out, but a binding to a provider no active Module declares, a resource that provider does not
|
|
14
|
+
* have, or an item renderer nobody offers is plain from the declarations alone.
|
|
15
|
+
*
|
|
16
|
+
* `itemRendererKeys` is the set of renderers the Area's Modules declare, or null where the caller does
|
|
17
|
+
* not have it -- and then a renderer the configuration names is not judged at all rather than judged
|
|
18
|
+
* against nothing. The renderer a resource ships with is never judged: it belongs to the provider just
|
|
19
|
+
* found active.
|
|
20
|
+
*/
|
|
21
|
+
export declare function readPhiCollectionViewDeclaredFailure({ source, itemRendererKey, dataProviderDescriptorsByKey, itemRendererKeys, }: {
|
|
22
|
+
source: PhiProviderResourceSource | null | undefined;
|
|
23
|
+
itemRendererKey: string | null | undefined;
|
|
24
|
+
dataProviderDescriptorsByKey: ReadonlyMap<PhiRuntimeDataProviderKey, PhiRuntimeModuleDataProviderDescriptor>;
|
|
25
|
+
itemRendererKeys: ReadonlySet<string> | null;
|
|
26
|
+
}): string | null;
|