@phis/ui 0.6.3 → 0.6.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/components/cms/phi-cms-layout-renderer.js +11 -2
- package/components/controls/phi-multi-select-control.js +4 -2
- package/components/controls/phi-options-provider.d.ts +1 -0
- package/components/controls/phi-options-provider.js +1 -0
- package/components/controls/phi-segmented-control.js +15 -1
- package/components/controls/phi-select-control.d.ts +21 -0
- package/components/controls/phi-select-control.js +2 -2
- package/components/controls/phi-status-dot-control.d.ts +15 -0
- package/components/controls/phi-status-dot-control.js +25 -0
- package/components/controls/phi-table-control.js +8 -1
- package/components/controls/phi-tree-control.js +5 -4
- package/components/controls/phi-tree-select-control.js +1 -0
- package/components/layouts/clients/phi-split-card-half.d.ts +4 -1
- package/components/layouts/clients/phi-split-card-half.js +2 -2
- package/components/layouts/clients/phi-split-card-layout-client.d.ts +6 -3
- package/components/layouts/clients/phi-split-card-layout-client.js +5 -3
- package/components/layouts/clients/phi-three-column-layout-client.d.ts +20 -1
- package/components/layouts/clients/phi-three-column-layout-client.js +31 -15
- package/components/layouts/layout-definitions.d.ts +96 -0
- package/components/layouts/layout-definitions.js +40 -2
- package/components/layouts/plugins/split-card-layout-plugin.js +1 -1
- package/components/layouts/plugins/three-column-layout-plugin.js +1 -1
- package/components/layouts/split-card-geometry.d.ts +9 -4
- package/components/layouts/split-card-geometry.js +29 -13
- package/components/media/media-folder-options.d.ts +10 -0
- package/components/media/media-folder-options.js +14 -0
- package/components/shell/phi-antd-icon.d.ts +1 -0
- package/components/shell/phi-antd-icon.js +3 -0
- package/components/widgets/inspector-field-row.js +4 -1
- package/components/widgets/label-sets/admin-users.d.ts +3 -0
- package/components/widgets/label-sets/admin-users.js +8 -2
- package/components/widgets/label-sets/gallery.js +2 -2
- package/components/widgets/label-sets/inspector.js +4 -0
- package/components/widgets/label-sets/observability-logs.js +2 -2
- package/components/widgets/label-sets/profile.js +2 -1
- package/components/widgets/label-types/gallery.d.ts +2 -3
- package/components/widgets/label-types/gallery.js +1 -4
- package/components/widgets/label-types/inspector.d.ts +4 -0
- package/components/widgets/label-types/inspector.js +2 -0
- package/components/widgets/shared/markdown-image-vocabulary.js +1 -1
- package/constants/cms-layout-proportions.d.ts +6 -0
- package/constants/cms-layout-proportions.js +17 -0
- package/constants/runtime-module-ownership.js +1 -0
- package/helpers/page-reference-tree.js +8 -0
- package/helpers/table-action-links.d.ts +11 -0
- package/helpers/table-action-links.js +14 -0
- package/helpers/table-action-row-link.d.ts +8 -0
- package/helpers/table-action-row-link.js +14 -0
- package/package.json +2 -2
- package/plugins/factories/widget-renderers.d.ts +7 -1
- package/plugins/factories/widget-renderers.js +12 -2
- package/plugins/runtime-modules/asset/authoring-widgets.js +2 -2
- package/plugins/runtime-modules/asset/data-providers.js +1 -1
- package/plugins/runtime-modules/asset/services/options.js +7 -11
- package/plugins/runtime-modules/asset/widgets/area-upload/plugin.js +0 -2
- package/plugins/runtime-modules/asset/widgets/asset-focal-rect/plugin.js +0 -2
- package/plugins/runtime-modules/asset/widgets/image-inspector/plugin.js +0 -2
- package/plugins/runtime-modules/asset/widgets/media-picker/plugin.js +0 -2
- package/plugins/runtime-modules/asset/widgets.js +4 -4
- package/plugins/runtime-modules/auth/authoring-widgets.js +4 -8
- package/plugins/runtime-modules/auth/services/installations-table.js +3 -1
- package/plugins/runtime-modules/auth/widgets/auth-workflow/plugin.js +0 -6
- package/plugins/runtime-modules/auth/widgets/logout/plugin.js +0 -2
- package/plugins/runtime-modules/auth/widgets/security/plugin.js +0 -2
- package/plugins/runtime-modules/auth/widgets.js +5 -3
- package/plugins/runtime-modules/avatar/authoring-widgets.js +2 -2
- package/plugins/runtime-modules/avatar/widgets/account-avatar/plugin.js +0 -2
- package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/plugin.js +0 -2
- package/plugins/runtime-modules/avatar/widgets.js +2 -2
- package/plugins/runtime-modules/builder/authoring-widgets.js +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-choice-cascader.d.ts +28 -0
- package/plugins/runtime-modules/builder/clients/inspector-choice-cascader.js +98 -0
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +27 -3
- package/plugins/runtime-modules/builder/clients/inspector-record-field-options.d.ts +17 -0
- package/plugins/runtime-modules/builder/clients/inspector-record-field-options.js +21 -0
- package/plugins/runtime-modules/builder/clients/inspector-translate-switch.d.ts +24 -0
- package/plugins/runtime-modules/builder/clients/inspector-translate-switch.js +29 -0
- package/plugins/runtime-modules/builder/clients/layout-inspector.d.ts +1 -1
- package/plugins/runtime-modules/builder/clients/layout-inspector.js +4 -2
- package/plugins/runtime-modules/builder/clients/widget-inspector.d.ts +1 -1
- package/plugins/runtime-modules/builder/clients/widget-inspector.js +6 -6
- package/plugins/runtime-modules/builder/plugin-meta-labels.js +17 -0
- package/plugins/runtime-modules/builder/render-root-node-scaffold.js +12 -2
- package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +0 -2
- package/plugins/runtime-modules/builder/widgets.js +3 -3
- package/plugins/runtime-modules/contracts.js +8 -4
- package/plugins/runtime-modules/core/authoring-widgets.js +2 -2
- package/plugins/runtime-modules/core/data-providers.d.ts +7 -3
- package/plugins/runtime-modules/core/data-providers.js +11 -1
- package/plugins/runtime-modules/core/definition.d.ts +7 -3
- package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/draft-status/client.d.ts +2 -1
- package/plugins/runtime-modules/core/widgets/draft-status/client.js +4 -3
- package/plugins/runtime-modules/core/widgets/gallery/authoring.js +6 -8
- package/plugins/runtime-modules/core/widgets/gallery/client.js +4 -0
- package/plugins/runtime-modules/core/widgets/gallery/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +5 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.js +8 -4
- package/plugins/runtime-modules/core/widgets/image/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +11 -0
- package/plugins/runtime-modules/core/widgets/markdown/config.js +24 -22
- package/plugins/runtime-modules/core/widgets/simple-text/client.d.ts +9 -5
- package/plugins/runtime-modules/core/widgets/simple-text/client.js +5 -7
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +63 -4
- package/plugins/runtime-modules/core/widgets/simple-text/config.js +45 -11
- package/plugins/runtime-modules/core/widgets/simple-text/editor.js +2 -2
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.d.ts +13 -0
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +23 -4
- package/plugins/runtime-modules/core/widgets/simple-text/server.d.ts +4 -2
- package/plugins/runtime-modules/core/widgets/simple-text/server.js +7 -6
- package/plugins/runtime-modules/core/widgets/table/client.js +4 -4
- package/plugins/runtime-modules/core/widgets/table/config.js +11 -3
- package/plugins/runtime-modules/core/widgets/table/plugin.js +21 -1
- package/plugins/runtime-modules/core/widgets/thread-conversation/plugin.js +0 -2
- package/plugins/runtime-modules/core/widgets/tree/config.js +2 -1
- package/plugins/runtime-modules/core/widgets/tree/plugin.js +16 -1
- package/plugins/runtime-modules/core/widgets.js +1 -1
- package/plugins/runtime-modules/editor/services/releases-table.js +4 -1
- package/plugins/runtime-modules/observability/data-providers.js +1 -1
- package/plugins/runtime-modules/observability/services/table.js +3 -1
- package/plugins/runtime-modules/theme/authoring-widgets.js +5 -5
- package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +0 -5
- package/plugins/runtime-modules/theme/widgets.js +4 -4
- package/plugins/runtime-modules/user-management/addon-roles.d.ts +28 -7
- package/plugins/runtime-modules/user-management/addon-roles.js +42 -17
- package/plugins/runtime-modules/user-management/client-data-providers.js +6 -0
- package/plugins/runtime-modules/user-management/data-providers.js +11 -2
- package/plugins/runtime-modules/user-management/forms.js +40 -1
- package/plugins/runtime-modules/user-management/ids.d.ts +1 -0
- package/plugins/runtime-modules/user-management/ids.js +1 -0
- package/plugins/runtime-modules/user-management/services/options.d.ts +14 -3
- package/plugins/runtime-modules/user-management/services/options.js +52 -16
- package/plugins/runtime-modules/user-management/services/table.js +11 -25
- package/plugins/runtime-modules/user-management/services/users-query.d.ts +9 -0
- package/plugins/runtime-modules/user-management/services/users-query.js +29 -0
- package/plugins/runtime-modules/video/widgets/embed/plugin.js +0 -2
- package/plugins/runtime-modules/video/widgets.js +1 -1
- package/styles/layout.css +4 -4
- package/types/cms-config.d.ts +12 -4
- package/types/cms-config.js +3 -0
- package/types/cms-plugins.d.ts +26 -4
- package/types/core-widget-placements.d.ts +4 -4
- package/types/table-widget.d.ts +17 -1
- package/types/tree.d.ts +2 -0
- package/plugins/runtime-modules/asset/widgets/asset-focal-rect/authoring.d.ts +0 -2
- package/plugins/runtime-modules/asset/widgets/asset-focal-rect/authoring.js +0 -6
- package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.d.ts +0 -2
- package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.js +0 -6
- package/plugins/runtime-modules/auth/widgets/auth-methods/authoring.d.ts +0 -7
- package/plugins/runtime-modules/auth/widgets/auth-methods/authoring.js +0 -12
- package/plugins/runtime-modules/auth/widgets/auth-workflow/authoring.d.ts +0 -7
- package/plugins/runtime-modules/auth/widgets/auth-workflow/authoring.js +0 -12
- package/plugins/runtime-modules/auth/widgets/logout/authoring.d.ts +0 -3
- package/plugins/runtime-modules/auth/widgets/logout/authoring.js +0 -8
- package/plugins/runtime-modules/auth/widgets/security/authoring.d.ts +0 -3
- package/plugins/runtime-modules/auth/widgets/security/authoring.js +0 -8
- package/plugins/runtime-modules/avatar/widgets/account-avatar/authoring.d.ts +0 -2
- package/plugins/runtime-modules/avatar/widgets/account-avatar/authoring.js +0 -6
- package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/authoring.d.ts +0 -2
- package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/authoring.js +0 -6
- package/plugins/runtime-modules/builder/widgets/structure-region/internal-builder.d.ts +0 -22
- package/plugins/runtime-modules/builder/widgets/structure-region/internal-builder.js +0 -8
- package/plugins/runtime-modules/core/widgets/form-preview/authoring.d.ts +0 -10
- package/plugins/runtime-modules/core/widgets/form-preview/authoring.js +0 -15
- package/plugins/runtime-modules/core/widgets/thread-conversation/authoring.d.ts +0 -3
- package/plugins/runtime-modules/core/widgets/thread-conversation/authoring.js +0 -9
- package/plugins/runtime-modules/theme/widgets/brand-controls/authoring.d.ts +0 -76
- package/plugins/runtime-modules/theme/widgets/brand-controls/authoring.js +0 -30
|
@@ -71,11 +71,20 @@ async function resolvePhiCmsTreeLinkTargets(...args) {
|
|
|
71
71
|
const { resolvePhiCmsTreeLinkTargets: resolve } = await import("../../server-helpers/cms-link-targets");
|
|
72
72
|
return resolve(...args);
|
|
73
73
|
}
|
|
74
|
-
function resolvePhiRuntimeWidgetRenderer(runtimePlugin, previewPlugin, implementationMode) {
|
|
74
|
+
function resolvePhiRuntimeWidgetRenderer(runtimePlugin, previewPlugin, implementationMode, previewPolicy) {
|
|
75
75
|
if (implementationMode === "runtime") {
|
|
76
76
|
return runtimePlugin?.render ?? null;
|
|
77
77
|
}
|
|
78
78
|
if (implementationMode === "preview") {
|
|
79
|
+
// Declared, not inferred: only `visualPlaceholder` draws the house placeholder, and a `custom`
|
|
80
|
+
// policy without `renderPreview` stays a missing renderer. Imported where it is drawn, because this
|
|
81
|
+
// renderer is on every route and the placeholder only ever stands in a Preview.
|
|
82
|
+
if (previewPolicy === "visualPlaceholder") {
|
|
83
|
+
return previewPlugin
|
|
84
|
+
? async ({ widget }) => (await import("../../plugins/factories/widget-renderers"))
|
|
85
|
+
.renderPhiWidgetPreviewPlaceholder(widget, previewPlugin.title)
|
|
86
|
+
: null;
|
|
87
|
+
}
|
|
79
88
|
return previewPlugin?.renderPreview ?? null;
|
|
80
89
|
}
|
|
81
90
|
return null;
|
|
@@ -414,7 +423,7 @@ function renderContentWidget(widget, context) {
|
|
|
414
423
|
}
|
|
415
424
|
if (widgetPlugin) {
|
|
416
425
|
try {
|
|
417
|
-
const renderWidget = resolvePhiRuntimeWidgetRenderer(runtimePlugin, previewPlugin, implementationMode);
|
|
426
|
+
const renderWidget = resolvePhiRuntimeWidgetRenderer(runtimePlugin, previewPlugin, implementationMode, policies?.preview ?? null);
|
|
418
427
|
const moduleId = context.runtimeRegistry.ownerModuleIdByWidgetType.get(widget.widgetType) ?? null;
|
|
419
428
|
if (!renderWidget) {
|
|
420
429
|
return renderCmsDiagnostic({
|
|
@@ -4,16 +4,18 @@ import { useMemo } from "react";
|
|
|
4
4
|
import { Select } from "antd";
|
|
5
5
|
import { PhiControlOptionContent } from "./phi-control-option-content";
|
|
6
6
|
import { PhiLabeledControl, usePhiControlLabel } from "./phi-labeled-control";
|
|
7
|
+
import { groupPhiSelectOptions } from "./phi-select-control";
|
|
7
8
|
export function PhiMultiSelectControl({ id, value, label, description, placeholder, disabled, readOnly, allowCustom, allowClear, options, maxTagCount, size, variant, popupMatchSelectWidth = false, style, onFocus, onBlur, onChange, }) {
|
|
8
9
|
const { labelId, labelledBy } = usePhiControlLabel(label);
|
|
9
|
-
|
|
10
|
+
// Options that name a group are listed under its heading, as the Select lists them.
|
|
11
|
+
const selectOptions = useMemo(() => groupPhiSelectOptions(options.map((option) => ({
|
|
10
12
|
value: option.value,
|
|
11
13
|
// Keep labels non-primitive so rc-select cannot add native HTML titles.
|
|
12
14
|
label: _jsx(_Fragment, { children: option.label }),
|
|
13
15
|
searchLabel: option.label,
|
|
14
16
|
option,
|
|
15
17
|
disabled: option.disabled,
|
|
16
|
-
})), [options]);
|
|
18
|
+
}))), [options]);
|
|
17
19
|
const control = (_jsx(Select, { id: id, "aria-labelledby": labelledBy, mode: allowCustom ? "tags" : "multiple", allowClear: allowClear, value: [...(value ?? [])], placeholder: placeholder, disabled: disabled || readOnly || !onChange, options: selectOptions, optionFilterProp: ["searchLabel", "value"], optionRender: (option) => {
|
|
18
20
|
/*
|
|
19
21
|
* With `allowCustom` the Select offers what is being typed as an option of its own, and that one
|
|
@@ -116,6 +116,7 @@ export declare function usePhiControlOptionsProvider<TValue extends string | num
|
|
|
116
116
|
disabled?: boolean;
|
|
117
117
|
description?: string;
|
|
118
118
|
icon?: string;
|
|
119
|
+
parentValue?: TValue;
|
|
119
120
|
}[] | null;
|
|
120
121
|
optionsProvider?: PhiControlOptionsProviderConfig | null;
|
|
121
122
|
sourceConfig?: Record<string, unknown> | null;
|
|
@@ -3,12 +3,26 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { Segmented } from "antd";
|
|
4
4
|
import { PHI_THEME_GRADIENT_CSS_VARS } from "../../theme/phi-theme-gradients";
|
|
5
5
|
import { PhiLabeledControl, usePhiControlLabel } from "./phi-labeled-control";
|
|
6
|
+
import { PhiTruncatedHoverText } from "./phi-truncated-hover-text";
|
|
7
|
+
/* The segment's own box cuts its words: the hover text measures this element and nothing around it. */
|
|
8
|
+
const PHI_SEGMENT_LABEL_STYLE = {
|
|
9
|
+
display: "block",
|
|
10
|
+
overflow: "hidden",
|
|
11
|
+
textOverflow: "ellipsis",
|
|
12
|
+
whiteSpace: "nowrap",
|
|
13
|
+
};
|
|
6
14
|
export function PhiSegmentedControl({ value, label, options, disabled, readOnly, block, size, gradient, onFocus, onBlur, onChange, }) {
|
|
7
15
|
const { labelId, labelledBy } = usePhiControlLabel(label);
|
|
8
16
|
const gradientVars = gradient ? PHI_THEME_GRADIENT_CSS_VARS[gradient] : null;
|
|
9
17
|
const control = (_jsx(Segmented, { "aria-labelledby": labelledBy, block: block, value: value, disabled: disabled || readOnly || !onChange, options: options.map((option) => ({
|
|
10
18
|
value: option.value,
|
|
11
|
-
|
|
19
|
+
/*
|
|
20
|
+
* A segment too narrow for its words shows them whole in the house tooltip, and only then. A
|
|
21
|
+
* segment with a description says that instead, which is more than its label.
|
|
22
|
+
*/
|
|
23
|
+
label: option.description
|
|
24
|
+
? option.label
|
|
25
|
+
: (_jsx(PhiTruncatedHoverText, { title: option.label, children: _jsx("span", { style: PHI_SEGMENT_LABEL_STYLE, children: option.label }) })),
|
|
12
26
|
disabled: option.disabled,
|
|
13
27
|
/*
|
|
14
28
|
* No browser tooltip: left out, the Segmented writes the label into `title` and every segment
|
|
@@ -37,4 +37,25 @@ export type PhiSelectControlProps<TValue extends string | number = string> = {
|
|
|
37
37
|
filterOptionsLocally?: boolean;
|
|
38
38
|
onChange: (value: TValue) => void;
|
|
39
39
|
};
|
|
40
|
+
type PhiResolvedSelectOption<TValue extends string | number> = {
|
|
41
|
+
value: TValue;
|
|
42
|
+
label: ReactNode;
|
|
43
|
+
searchLabel: string;
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
option: PhiControlOption<TValue>;
|
|
46
|
+
};
|
|
47
|
+
type PhiSelectSeparatorEntry = {
|
|
48
|
+
value: string;
|
|
49
|
+
label: ReactNode;
|
|
50
|
+
searchLabel: "";
|
|
51
|
+
disabled: true;
|
|
52
|
+
style: CSSProperties;
|
|
53
|
+
separator: true;
|
|
54
|
+
};
|
|
55
|
+
export declare function groupPhiSelectOptions<TValue extends string | number>(resolved: Array<PhiResolvedSelectOption<TValue> | PhiSelectSeparatorEntry>): (PhiSelectSeparatorEntry | PhiResolvedSelectOption<TValue> | {
|
|
56
|
+
label: ReactNode;
|
|
57
|
+
title: string;
|
|
58
|
+
options: PhiResolvedSelectOption<TValue>[];
|
|
59
|
+
})[];
|
|
40
60
|
export declare function PhiSelectControl<TValue extends string | number = string>({ id, value, label, description, ariaLabel, placeholder, disabled, readOnly, presentation, allowCustom, allowClear, options, size, variant, popupMatchSelectWidth, getPopupContainer, popupRootClassName, popupZIndex, style, onFocus, onBlur, onOpenChange, onSearch, filterOptionsLocally, onChange, }: PhiSelectControlProps<TValue>): import("react").JSX.Element;
|
|
61
|
+
export {};
|
|
@@ -32,9 +32,9 @@ function separatePhiSelectOptions(resolved) {
|
|
|
32
32
|
}
|
|
33
33
|
/*
|
|
34
34
|
* Consecutive options that name the same group, under one heading. Options without a group stay at the
|
|
35
|
-
* top level, and a list that names no group at all comes back unchanged.
|
|
35
|
+
* top level, and a list that names no group at all comes back unchanged. The Multi Select groups with it.
|
|
36
36
|
*/
|
|
37
|
-
function groupPhiSelectOptions(resolved) {
|
|
37
|
+
export function groupPhiSelectOptions(resolved) {
|
|
38
38
|
if (!resolved.some((entry) => !isPhiSelectSeparatorEntry(entry) && entry.option.group)) {
|
|
39
39
|
return resolved;
|
|
40
40
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A state shown as a small coloured dot, its word in the house tooltip.
|
|
4
|
+
*
|
|
5
|
+
* For a state somebody glances at rather than reads -- saved, a draft, published -- where a tag would
|
|
6
|
+
* take a line's worth of room for one word. The word is still there: pointed at, the tooltip says it,
|
|
7
|
+
* and assistive technology reads it as the dot's label. `children` widens what the pointer may rest on,
|
|
8
|
+
* so a row (a path and its state) can carry one tooltip for both.
|
|
9
|
+
*/
|
|
10
|
+
export declare function PhiStatusDotControl({ color, label, children, }: {
|
|
11
|
+
/** A Theme token colour, or nothing for a neutral state. */
|
|
12
|
+
color?: string;
|
|
13
|
+
label: string;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { PhiHoverText } from "./phi-hover-text";
|
|
4
|
+
/** How large the dot is drawn: small enough to stand beside a line of text without taking its place. */
|
|
5
|
+
const PHI_STATUS_DOT_SIZE = 8;
|
|
6
|
+
/**
|
|
7
|
+
* A state shown as a small coloured dot, its word in the house tooltip.
|
|
8
|
+
*
|
|
9
|
+
* For a state somebody glances at rather than reads -- saved, a draft, published -- where a tag would
|
|
10
|
+
* take a line's worth of room for one word. The word is still there: pointed at, the tooltip says it,
|
|
11
|
+
* and assistive technology reads it as the dot's label. `children` widens what the pointer may rest on,
|
|
12
|
+
* so a row (a path and its state) can carry one tooltip for both.
|
|
13
|
+
*/
|
|
14
|
+
export function PhiStatusDotControl({ color, label, children, }) {
|
|
15
|
+
const dot = (_jsx("span", { role: "img", "aria-label": label, style: {
|
|
16
|
+
display: "inline-block",
|
|
17
|
+
flex: "0 0 auto",
|
|
18
|
+
width: PHI_STATUS_DOT_SIZE,
|
|
19
|
+
height: PHI_STATUS_DOT_SIZE,
|
|
20
|
+
borderRadius: "50%",
|
|
21
|
+
background: color ?? "currentColor",
|
|
22
|
+
opacity: color ? 1 : 0.45,
|
|
23
|
+
} }));
|
|
24
|
+
return (_jsx(PhiHoverText, { title: label, children: _jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 8, minWidth: 0 }, children: [children, dot] }) }));
|
|
25
|
+
}
|
|
@@ -9,6 +9,7 @@ import { flushSync } from "react-dom";
|
|
|
9
9
|
import { Children, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
|
|
10
10
|
import { PHI_GREGORY_CALENDAR_ADAPTER_KEY } from "../../types/calendar-keys";
|
|
11
11
|
import { PHI_VISUAL_ANCHOR_PART_ATTRIBUTE } from "../../types/visual-anchors";
|
|
12
|
+
import { PhiTruncatedHoverText } from "./phi-truncated-hover-text";
|
|
12
13
|
import { PhiColorControl } from "./phi-color-control";
|
|
13
14
|
import { PhiCheckboxControl } from "./phi-checkbox-control";
|
|
14
15
|
import { PhiCheckboxGroupControl } from "./phi-checkbox-group-control";
|
|
@@ -370,6 +371,12 @@ function buildRowMove(rows, rowIdentityPath, parentRowIdentityPath, movedRowIden
|
|
|
370
371
|
afterRowIdentity: placement === "after" ? targetRowIdentity : null,
|
|
371
372
|
};
|
|
372
373
|
}
|
|
374
|
+
/* The box that cuts a column's name short is the one the hover text measures. */
|
|
375
|
+
const PHI_TABLE_COLUMN_TITLE_STYLE = { display: "block", minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" };
|
|
376
|
+
/** A column's name, cut with an ellipsis where the column is narrower, and then said whole in the house tooltip. */
|
|
377
|
+
function renderPhiTableColumnTitle(title) {
|
|
378
|
+
return (_jsx(PhiTruncatedHoverText, { title: title, children: _jsx("span", { style: PHI_TABLE_COLUMN_TITLE_STYLE, children: title }) }));
|
|
379
|
+
}
|
|
373
380
|
export function PhiTableControl({ rows, rowIdentityPath, columns, columnOrder, sortingMode, sorts, onSortsChange, columnReordering = false, onColumnOrderChange, rowSelection, pagination = false, tree, rowReordering, editing, loading = false, bordered, striped = false, stickyHeader = false, showHeader, footer, summary, size, emptyText, layout, rowStyle, onRowActivate, onExternalRowDragOver, onExternalRowDrop, onExternalDragOver, onExternalDrop, }) {
|
|
374
381
|
const { token } = usePhiConfig();
|
|
375
382
|
const [editingRowIdentityState, setEditingRowIdentity] = useState(null);
|
|
@@ -582,7 +589,7 @@ export function PhiTableControl({ rows, rowIdentityPath, columns, columnOrder, s
|
|
|
582
589
|
const reorderIndex = columnOrder.indexOf(column.key);
|
|
583
590
|
const canReorder = columnReordering && column.fixed === undefined && reorderIndex >= 0;
|
|
584
591
|
const columnStyle = buildColumnStyle(column.sizing);
|
|
585
|
-
const title = canReorder ? (_jsxs(Flex, { align: "center", gap: 4,
|
|
592
|
+
const title = canReorder ? (_jsxs(Flex, { align: "center", gap: 4, style: { minWidth: 0 }, children: [renderPhiTableColumnTitle(column.title), _jsx("span", { onClick: (event) => event.stopPropagation(), children: _jsx(PhiButtonControl, { type: "text", size: "small", icon: _jsx(PhiIcon, { name: "left", size: "inherit" }), disabled: reorderIndex === 0, ariaLabel: "Move column left", tooltip: "Move column left", onClick: () => onColumnOrderChange?.(moveColumn(columnOrder, column.key, -1)) }) }), _jsx("span", { onClick: (event) => event.stopPropagation(), children: _jsx(PhiButtonControl, { type: "text", size: "small", icon: _jsx(PhiIcon, { name: "right", size: "inherit" }), disabled: reorderIndex === columnOrder.length - 1, ariaLabel: "Move column right", tooltip: "Move column right", onClick: () => onColumnOrderChange?.(moveColumn(columnOrder, column.key, 1)) }) })] })) : renderPhiTableColumnTitle(column.title);
|
|
586
593
|
return {
|
|
587
594
|
key: column.key,
|
|
588
595
|
columnKey: sortField,
|
|
@@ -9,6 +9,7 @@ import { PhiTextControl } from "./phi-text-control";
|
|
|
9
9
|
import { PhiConfirmControl } from "./phi-confirm-control";
|
|
10
10
|
import { PhiExpandIndicator } from "./phi-expand-indicator";
|
|
11
11
|
import { PhiLink } from "../navigation/phi-link";
|
|
12
|
+
import { resolvePhiTableRowActionLink } from "../../helpers/table-action-row-link";
|
|
12
13
|
import { PhiSkeletonControl } from "./phi-skeleton-control";
|
|
13
14
|
function readPath(value, path) {
|
|
14
15
|
if (!path)
|
|
@@ -102,16 +103,16 @@ function PhiTreeNodeTitle({ node, presentation, editing, actions, controlSize, o
|
|
|
102
103
|
beforeNodeIdentity: dropMode === "before" ? node.identity : null,
|
|
103
104
|
afterNodeIdentity: dropMode === "after" ? node.identity : null,
|
|
104
105
|
});
|
|
105
|
-
}, children: [iconEditable ? (_jsx(PhiIconPickerControl, { value: typeof icon === "string" ? icon : null, buttonSize: controlSize, buttonType: "text", onChange: (value) => void onCommitField?.(node.identity, iconFieldKey, value) })) : presentation.showIcon !== false && typeof icon === "string" ? _jsx(PhiIcon, { name: icon }) : null, _jsxs("div", { style: { display: "grid", flex: 1, minWidth: 0 }, children: [titleEditable ? (_jsx(PhiTextControl, { value: draftTitle, size: controlSize, variant: presentation.node.titleEditor?.variant ?? "underlined", onChange: (value) => setDraftTitle(value ?? ""), onPressEnter: commitTitle, onBlur: commitTitle })) : _jsx("span", { children: title }), description != null && description !== "" ? (_jsx(Typography.Text, { type: "secondary", ellipsis: true, style: { fontSize: "inherit" }, children: String(description) })) : null] }), actions.length ? (_jsx(Flex, { align: "center", gap: 2, onClick: (event) => event.stopPropagation(), children: actions.map((action) => (_jsx(PhiTreeActionButton, { action: action.execution === "link"
|
|
106
|
-
?
|
|
106
|
+
}, children: [iconEditable ? (_jsx(PhiIconPickerControl, { value: typeof icon === "string" ? icon : null, buttonSize: controlSize, buttonType: "text", onChange: (value) => void onCommitField?.(node.identity, iconFieldKey, value) })) : presentation.showIcon !== false && typeof icon === "string" ? _jsx(PhiIcon, { name: icon }) : null, _jsxs("div", { style: { display: "grid", flex: 1, minWidth: 0 }, children: [titleEditable ? (_jsx(PhiTextControl, { value: draftTitle, size: controlSize, variant: presentation.node.titleEditor?.variant ?? "underlined", onChange: (value) => setDraftTitle(value ?? ""), onPressEnter: commitTitle, onBlur: commitTitle })) : _jsx("span", { children: title }), description != null && description !== "" ? (_jsx(Typography.Text, { type: "secondary", ellipsis: true, style: { fontSize: "inherit" }, children: String(description) })) : null] }), actions.length ? (_jsx(Flex, { align: "center", gap: 2, onClick: (event) => event.stopPropagation(), children: actions.map((action) => (_jsx(PhiTreeActionButton, { action: action.execution === "link"
|
|
107
|
+
? resolvePhiTableRowActionLink(action, action.hrefPath ? readPath(node.record, action.hrefPath) : undefined)
|
|
107
108
|
: action, size: controlSize, onActivate: () => onAction?.(action, node.identity) }, action.key))) })) : null] }));
|
|
108
109
|
}
|
|
109
110
|
export function PhiTreeActionButton({ action, size = "small", disabled = false, onActivate, }) {
|
|
110
111
|
const display = action.display ?? "label";
|
|
111
112
|
const button = (_jsx(Button, { size: size, type: action.mode === "primary" ? "primary" : "default", danger: action.mode === "danger", disabled: disabled, icon: display !== "label" && action.icon ? _jsx(PhiIcon, { name: action.icon }) : undefined, "aria-label": action.label, onClick: () => { if (!action.confirm)
|
|
112
113
|
onActivate(); }, children: display !== "icon" ? action.label : null }));
|
|
113
|
-
const actionable = action.execution === "link" && action.
|
|
114
|
-
? _jsx(PhiLink, { href: action.href, external: action.
|
|
114
|
+
const actionable = action.execution === "link" && action.link
|
|
115
|
+
? _jsx(PhiLink, { href: action.link.href, external: action.link.external, newTab: action.link.newTab, children: button })
|
|
115
116
|
: button;
|
|
116
117
|
return action.confirm && action.execution !== "link" ? (_jsx(PhiConfirmControl, { title: action.confirm.title, description: action.confirm.description, confirmLabel: action.confirm.okText, cancelLabel: action.confirm.cancelText, danger: action.mode === "danger", disabled: disabled, onConfirm: onActivate, children: actionable })) : actionable;
|
|
117
118
|
}
|
|
@@ -11,6 +11,7 @@ function buildPhiTreeSelectNodes(options) {
|
|
|
11
11
|
value: option.value,
|
|
12
12
|
label: option.label,
|
|
13
13
|
...(option.description ? { description: option.description } : {}),
|
|
14
|
+
...(option.icon ? { icon: option.icon } : {}),
|
|
14
15
|
}, presentation: "tree" })),
|
|
15
16
|
label: _jsx(PhiControlOptionContent, { option: { value: option.value, label: option.label }, presentation: "selection" }),
|
|
16
17
|
searchLabel: `${option.label} ${option.description ?? ""}`.trim(),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CSSProperties, HTMLAttributes, ReactNode } from "react";
|
|
2
2
|
import type { PhiCmsInstanceId } from "../../../types/cms-instance-id";
|
|
3
3
|
import { type PhiSurface } from "../../../types/surface";
|
|
4
|
+
import type { PhiCmsSplitCardRatio } from "../../../constants/cms-layout-proportions";
|
|
4
5
|
export type PhiSplitCardHalfProps = Omit<HTMLAttributes<HTMLDivElement>, "style" | "children"> & {
|
|
5
6
|
[attribute: `data-${string}`]: string | undefined;
|
|
6
7
|
blockId: PhiCmsInstanceId | string | number | null | undefined;
|
|
@@ -11,6 +12,8 @@ export type PhiSplitCardHalfProps = Omit<HTMLAttributes<HTMLDivElement>, "style"
|
|
|
11
12
|
gap: string;
|
|
12
13
|
/** Whether the left card is the larger one; the right card's part of the Background follows it. */
|
|
13
14
|
swapped?: boolean;
|
|
15
|
+
/** The ratio the cards stand in; the right card's part of the Background follows it. */
|
|
16
|
+
ratio?: PhiCmsSplitCardRatio;
|
|
14
17
|
style?: CSSProperties;
|
|
15
18
|
children?: ReactNode;
|
|
16
19
|
};
|
|
@@ -25,4 +28,4 @@ export type PhiSplitCardHalfProps = Omit<HTMLAttributes<HTMLDivElement>, "style"
|
|
|
25
28
|
* for the Split Card (`usePhiLayoutSignalSurface`). A moving Background does not move here: each card
|
|
26
29
|
* would move its own copy, and two copies of one picture moving are not one picture.
|
|
27
30
|
*/
|
|
28
|
-
export declare function PhiSplitCardHalf({ blockId, surface, side, gap, swapped, style, className, children, ...attributes }: PhiSplitCardHalfProps): import("react").JSX.Element;
|
|
31
|
+
export declare function PhiSplitCardHalf({ blockId, surface, side, gap, swapped, ratio, style, className, children, ...attributes }: PhiSplitCardHalfProps): import("react").JSX.Element;
|
|
@@ -19,7 +19,7 @@ import { joinPhiClassNames } from "../../../helpers/class-names";
|
|
|
19
19
|
* for the Split Card (`usePhiLayoutSignalSurface`). A moving Background does not move here: each card
|
|
20
20
|
* would move its own copy, and two copies of one picture moving are not one picture.
|
|
21
21
|
*/
|
|
22
|
-
export function PhiSplitCardHalf({ blockId, surface, side, gap, swapped, style, className, children, ...attributes }) {
|
|
22
|
+
export function PhiSplitCardHalf({ blockId, surface, side, gap, swapped, ratio, style, className, children, ...attributes }) {
|
|
23
23
|
const signalled = usePhiLayoutSignalSurface(blockId, surface);
|
|
24
24
|
const still = signalled?.background?.motion
|
|
25
25
|
? { ...signalled, background: { ...signalled.background, motion: null } }
|
|
@@ -30,5 +30,5 @@ export function PhiSplitCardHalf({ blockId, surface, side, gap, swapped, style,
|
|
|
30
30
|
forceGroundLayer: true,
|
|
31
31
|
});
|
|
32
32
|
const toneClassName = resolvePhiSurfaceToneClassName(still?.tone);
|
|
33
|
-
return (_jsxs("div", { ...attributes, className: joinPhiClassNames(className, toneClassName), style: { ...card.style, ...style }, children: [_jsx(PhiSurfaceGroundLayer, { ground: card.ground, frame: resolvePhiSplitCardGroundFrame(side, gap, swapped) }), toneClassName ? _jsx(PhiSurfaceTone, { tone: still?.tone, children: children }) : children] }));
|
|
33
|
+
return (_jsxs("div", { ...attributes, className: joinPhiClassNames(className, toneClassName), style: { ...card.style, ...style }, children: [_jsx(PhiSurfaceGroundLayer, { ground: card.ground, frame: resolvePhiSplitCardGroundFrame(side, gap, swapped, ratio) }), toneClassName ? _jsx(PhiSurfaceTone, { tone: still?.tone, children: children }) : children] }));
|
|
34
34
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from "react";
|
|
2
2
|
import { type PhiBaseLayoutProps } from "../phi-layout-view-model";
|
|
3
3
|
import type { PhiAnchorWidgetPlacement } from "../../controls/phi-anchor-control-contract";
|
|
4
|
+
import { type PhiCmsSplitCardRatio } from "../../../constants/cms-layout-proportions";
|
|
4
5
|
/**
|
|
5
|
-
* Two cards on the golden ratio.
|
|
6
|
+
* Two cards side by side, on the golden ratio unless `ratio` says otherwise.
|
|
6
7
|
*
|
|
7
8
|
* The Layout's Surface is worn by both: each card draws its edge, corner,
|
|
8
9
|
* depth, pane and mode (`PhiSplitCardHalf`), and the Background runs once across the two and shows only
|
|
@@ -13,8 +14,10 @@ import type { PhiAnchorWidgetPlacement } from "../../controls/phi-anchor-control
|
|
|
13
14
|
export type PhiSplitCardLayoutProps = Omit<PhiBaseLayoutProps, "slots"> & {
|
|
14
15
|
slots: ReactNode[];
|
|
15
16
|
gap?: CSSProperties["gap"];
|
|
16
|
-
/** The larger card on the left instead of the right
|
|
17
|
+
/** The larger card on the left instead of the right; nothing to swap at `50-50`. */
|
|
17
18
|
swapRatio?: boolean;
|
|
19
|
+
/** The ratio the cards stand in: φ (`golden`, the default), `50-50` or `20-80`. */
|
|
20
|
+
ratio?: PhiCmsSplitCardRatio;
|
|
18
21
|
editSlotAnchor?: PhiAnchorWidgetPlacement | null;
|
|
19
22
|
};
|
|
20
|
-
export declare function PhiSplitCardLayout({ blockId, slots, gap, swapRatio, editSlotAction, editRenderInsertControl, editSlotAnchor, renderMode, layoutKind, labelEnd, padding, paddingTop, paddingRight, paddingBottom, paddingLeft, surface, style, }: PhiSplitCardLayoutProps): import("react").JSX.Element;
|
|
23
|
+
export declare function PhiSplitCardLayout({ blockId, slots, gap, swapRatio, ratio, editSlotAction, editRenderInsertControl, editSlotAnchor, renderMode, layoutKind, labelEnd, padding, paddingTop, paddingRight, paddingBottom, paddingLeft, surface, style, }: PhiSplitCardLayoutProps): import("react").JSX.Element;
|
|
@@ -7,11 +7,12 @@ import { isPhiLayoutAuthoringRender, phiLayoutDebugLayerMarker, phiLayoutSlotCla
|
|
|
7
7
|
import { PhiLayoutSurfaceBox } from "../phi-layout-surface-box";
|
|
8
8
|
import { PhiSplitCardHalf } from "./phi-split-card-half";
|
|
9
9
|
import { resolvePhiSplitCardColumns } from "../split-card-geometry";
|
|
10
|
+
import { PHI_CMS_SPLIT_CARD_DEFAULT_RATIO, } from "../../../constants/cms-layout-proportions";
|
|
10
11
|
const PHI_SPLIT_CARD_LAYOUT_DEFAULTS = resolvePhiLayoutDefaults("split");
|
|
11
12
|
function renderSplitCardSlot(isAuthoringRender, key, child, slotRole, slotIndex, editSlotAnchor, editSlotAction, editRenderInsertControl, label, card) {
|
|
12
13
|
const hasContent = child !== null && child !== undefined && child !== false;
|
|
13
14
|
const showInsertButton = typeof editSlotAction === "function" && editRenderInsertControl != null;
|
|
14
|
-
return (_jsxs(PhiSplitCardHalf, { blockId: card.blockId, surface: card.surface, side: slotRole, gap: card.gap, swapped: card.swapped, "data-layout-kind": "split", className: phiLayoutSlotClassName(isAuthoringRender), "data-phi-layout-has-content": phiLayoutSlotContentMarker(isAuthoringRender, hasContent), style: {
|
|
15
|
+
return (_jsxs(PhiSplitCardHalf, { blockId: card.blockId, surface: card.surface, side: slotRole, gap: card.gap, swapped: card.swapped, ratio: card.ratio, "data-layout-kind": "split", className: phiLayoutSlotClassName(isAuthoringRender), "data-phi-layout-has-content": phiLayoutSlotContentMarker(isAuthoringRender, hasContent), style: {
|
|
15
16
|
position: "relative",
|
|
16
17
|
/*
|
|
17
18
|
* No `height: 100%` and no `minHeight: 0`: the grid stretches both cards to the row already, and
|
|
@@ -39,7 +40,7 @@ function renderSplitCardSlot(isAuthoringRender, key, child, slotRole, slotIndex,
|
|
|
39
40
|
})
|
|
40
41
|
: null] }, key));
|
|
41
42
|
}
|
|
42
|
-
export function PhiSplitCardLayout({ blockId, slots, gap, swapRatio = false, editSlotAction, editRenderInsertControl, editSlotAnchor = "center", renderMode = "live", layoutKind = "split", labelEnd, padding, paddingTop, paddingRight, paddingBottom, paddingLeft, surface, style, }) {
|
|
43
|
+
export function PhiSplitCardLayout({ blockId, slots, gap, swapRatio = false, ratio = PHI_CMS_SPLIT_CARD_DEFAULT_RATIO, editSlotAction, editRenderInsertControl, editSlotAnchor = "center", renderMode = "live", layoutKind = "split", labelEnd, padding, paddingTop, paddingRight, paddingBottom, paddingLeft, surface, style, }) {
|
|
43
44
|
const isAuthoringRender = isPhiLayoutAuthoringRender({ editSlotAction, renderMode });
|
|
44
45
|
const resolvedRenderMode = renderMode ?? "live";
|
|
45
46
|
const resolvedGap = normalizePhiCssSize(gap) ?? PHI_SPLIT_CARD_LAYOUT_DEFAULTS.gap;
|
|
@@ -59,6 +60,7 @@ export function PhiSplitCardLayout({ blockId, slots, gap, swapRatio = false, edi
|
|
|
59
60
|
surface,
|
|
60
61
|
gap: gapLength,
|
|
61
62
|
swapped: swapRatio,
|
|
63
|
+
ratio,
|
|
62
64
|
inset: resolvePhiPaddingStyle({ padding, paddingTop, paddingRight, paddingBottom, paddingLeft }),
|
|
63
65
|
};
|
|
64
66
|
/*
|
|
@@ -78,7 +80,7 @@ export function PhiSplitCardLayout({ blockId, slots, gap, swapRatio = false, edi
|
|
|
78
80
|
...style,
|
|
79
81
|
};
|
|
80
82
|
const gridStyle = {
|
|
81
|
-
"--phi-split-card-columns": resolvePhiSplitCardColumns(swapRatio),
|
|
83
|
+
"--phi-split-card-columns": resolvePhiSplitCardColumns(swapRatio, ratio),
|
|
82
84
|
gap: resolvedGap,
|
|
83
85
|
};
|
|
84
86
|
return (_jsx(PhiLayoutSurfaceBox, { blockId: blockId, surface: undefined, ground: null, "data-layout-kind": layoutKind, "data-phi-block-render-mode": resolvedRenderMode, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", className: "phi-layout", style: resolvedStyle, children: _jsxs("div", { className: "phi-split-card__grid", style: gridStyle, children: [renderSplitCardSlot(isAuthoringRender, "slot-1", slots[0] ?? null, "left", 0, editSlotAnchor, editSlotAction, editRenderInsertControl, "Slot 1", card), renderSplitCardSlot(isAuthoringRender, "slot-2", slots[1] ?? null, "right", 1, editSlotAnchor, editSlotAction, editRenderInsertControl, "Slot 2", card)] }) }));
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from "react";
|
|
2
2
|
import { type PhiBaseLayoutProps } from "../phi-layout-view-model";
|
|
3
|
+
import { type PhiCmsThreeColumnSideShare } from "../../../constants/cms-layout-proportions";
|
|
3
4
|
import type { PhiAnchorWidgetPlacement } from "../../controls/phi-anchor-control-contract";
|
|
4
5
|
import type { PhiRenderableBlockResponsiveSize, PhiRenderableBlockSize } from "../../../types";
|
|
5
6
|
export type PhiThreeColumnLayoutProps = Pick<PhiBaseLayoutProps, "blockId" | "gap" | "surface" | "renderMode" | "zIndex" | "layoutKind" | "labelEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "editSlotAction" | "editRenderInsertControl" | "style"> & {
|
|
6
7
|
slots: ReactNode[];
|
|
7
8
|
balancedSides?: boolean;
|
|
9
|
+
/** What each balanced side takes of the row, in percent; the middle takes the rest. Default 25. */
|
|
10
|
+
sideShare?: PhiCmsThreeColumnSideShare;
|
|
8
11
|
wrap?: boolean | CSSProperties["flexWrap"];
|
|
9
12
|
align?: CSSProperties["alignItems"];
|
|
10
13
|
justify?: CSSProperties["justifyContent"];
|
|
@@ -17,4 +20,20 @@ export type PhiThreeColumnLayoutProps = Pick<PhiBaseLayoutProps, "blockId" | "ga
|
|
|
17
20
|
collapsedSizeHint?: PhiRenderableBlockSize | null;
|
|
18
21
|
editSlotAnchor?: PhiAnchorWidgetPlacement | null;
|
|
19
22
|
};
|
|
20
|
-
|
|
23
|
+
/**
|
|
24
|
+
* The `flex` of each column.
|
|
25
|
+
*
|
|
26
|
+
* A balanced side grows by its share and the middle by what two sides leave of a hundred, so 25 is
|
|
27
|
+
* 25 : 50 : 25 -- the 1 : 2 : 1 the Layout always had -- and 33 is 33 : 34 : 33. Growth, not a percent
|
|
28
|
+
* width: the gaps come out of the row first and the rest is shared, where three percent widths and two
|
|
29
|
+
* gaps would be wider than the row.
|
|
30
|
+
*
|
|
31
|
+
* On a phone (`styles/layout.css`) the variables give way to sides as wide as their content and a middle
|
|
32
|
+
* taking the rest, whatever the share. A fixed width wins over both, on every screen.
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolvePhiThreeColumnFlex({ balancedSides, sideShare, leftWidth, middleWidth, rightWidth, }: Pick<PhiThreeColumnLayoutProps, "balancedSides" | "sideShare" | "leftWidth" | "middleWidth" | "rightWidth">): {
|
|
35
|
+
left: string;
|
|
36
|
+
middle: string;
|
|
37
|
+
right: string;
|
|
38
|
+
};
|
|
39
|
+
export declare function PhiThreeColumnLayout({ blockId, slots, balancedSides, sideShare, gap, wrap, align, justify, leftWidth, middleWidth, rightWidth, editSlotAnchor, editSlotAction, editRenderInsertControl, renderMode, ...layoutProps }: PhiThreeColumnLayoutProps): import("react").JSX.Element;
|
|
@@ -3,6 +3,7 @@ import { normalizePhiCssSize, resolvePhiLayoutBox, phiFlexPlacementWord, resolve
|
|
|
3
3
|
import { resolvePhiBaseLayoutChrome } from "../phi-layout-view-model";
|
|
4
4
|
import { resolvePhiLayoutDefaults } from "../../../helpers/cms-layout-defaults";
|
|
5
5
|
import { PHI_CMS_THREE_COLUMN_LAYOUT_SLOTS } from "../../../constants/cms-layout-types";
|
|
6
|
+
import { PHI_CMS_THREE_COLUMN_DEFAULT_SIDE_SHARE, } from "../../../constants/cms-layout-proportions";
|
|
6
7
|
import { isPhiLayoutAuthoringRender, phiLayoutDebugLayerMarker, phiLayoutSlotClassName, phiLayoutSlotContentMarker, } from "../../../helpers/layout-authoring-markers";
|
|
7
8
|
import { PhiLayoutSurfaceBox } from "../phi-layout-surface-box";
|
|
8
9
|
import { resolvePhiLayoutSlotChildSizing } from "./phi-layout-anchored-overlay";
|
|
@@ -77,12 +78,20 @@ function renderColumn(isAuthoringRender, key, child, width, flex, anchor, slotRo
|
|
|
77
78
|
width: "100%",
|
|
78
79
|
} })) : null] }, key));
|
|
79
80
|
}
|
|
80
|
-
/** How much faster the middle slot grows than
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
/** How much faster the middle slot grows than a side that does not grow at all: it takes the rest. */
|
|
82
|
+
const PHI_THREE_COLUMN_UNBALANCED_MIDDLE_GROW = 2;
|
|
83
|
+
/**
|
|
84
|
+
* The `flex` of each column.
|
|
85
|
+
*
|
|
86
|
+
* A balanced side grows by its share and the middle by what two sides leave of a hundred, so 25 is
|
|
87
|
+
* 25 : 50 : 25 -- the 1 : 2 : 1 the Layout always had -- and 33 is 33 : 34 : 33. Growth, not a percent
|
|
88
|
+
* width: the gaps come out of the row first and the rest is shared, where three percent widths and two
|
|
89
|
+
* gaps would be wider than the row.
|
|
90
|
+
*
|
|
91
|
+
* On a phone (`styles/layout.css`) the variables give way to sides as wide as their content and a middle
|
|
92
|
+
* taking the rest, whatever the share. A fixed width wins over both, on every screen.
|
|
93
|
+
*/
|
|
94
|
+
export function resolvePhiThreeColumnFlex({ balancedSides = true, sideShare = PHI_CMS_THREE_COLUMN_DEFAULT_SIDE_SHARE, leftWidth, middleWidth, rightWidth, }) {
|
|
86
95
|
const resolvedLeftWidth = normalizePhiCssSize(leftWidth);
|
|
87
96
|
const resolvedMiddleWidth = normalizePhiCssSize(middleWidth);
|
|
88
97
|
const resolvedRightWidth = normalizePhiCssSize(rightWidth);
|
|
@@ -91,17 +100,24 @@ export function PhiThreeColumnLayout({ blockId, slots, balancedSides = true, gap
|
|
|
91
100
|
* side as wide as its content and nothing when empty, and the middle takes the rest. A centred middle
|
|
92
101
|
* was worth two equal sides of a 390px row; a link of 83px in a side of 81 was not.
|
|
93
102
|
*/
|
|
94
|
-
const
|
|
95
|
-
const leftFlex = resolvedLeftWidth ? `0 0 ${resolvedLeftWidth}` : balancedSides ? balancedSideFlex : "0 1 auto";
|
|
103
|
+
const sideFlex = balancedSides ? `var(--phi-three-column-side-flex, ${sideShare} 1 0)` : "0 1 auto";
|
|
96
104
|
/*
|
|
97
|
-
* The middle is the main thing
|
|
98
|
-
*
|
|
99
|
-
*
|
|
105
|
+
* The middle is the main thing: with balanced sides it grows by the rest of the hundred, so the sides
|
|
106
|
+
* stay equal to each other and the middle stays centred; without, it takes what the sides' content
|
|
107
|
+
* leaves.
|
|
100
108
|
*/
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
: `
|
|
104
|
-
|
|
109
|
+
const middleGrow = balancedSides ? 100 - 2 * sideShare : PHI_THREE_COLUMN_UNBALANCED_MIDDLE_GROW;
|
|
110
|
+
return {
|
|
111
|
+
left: resolvedLeftWidth ? `0 0 ${resolvedLeftWidth}` : sideFlex,
|
|
112
|
+
middle: resolvedMiddleWidth ? `0 0 ${resolvedMiddleWidth}` : `var(--phi-three-column-middle-flex, ${middleGrow} 1 0)`,
|
|
113
|
+
right: resolvedRightWidth ? `0 0 ${resolvedRightWidth}` : sideFlex,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
export function PhiThreeColumnLayout({ blockId, slots, balancedSides = true, sideShare = PHI_CMS_THREE_COLUMN_DEFAULT_SIDE_SHARE, gap = PHI_THREE_COLUMN_LAYOUT_DEFAULTS.gap, wrap = PHI_THREE_COLUMN_LAYOUT_DEFAULTS.wrap, align, justify, leftWidth, middleWidth, rightWidth, editSlotAnchor = "center", editSlotAction, editRenderInsertControl, renderMode = "live", ...layoutProps }) {
|
|
117
|
+
const isAuthoringRender = isPhiLayoutAuthoringRender({ editSlotAction, renderMode });
|
|
118
|
+
const { style, layoutKind = "threecol", padding, paddingTop, paddingRight, paddingBottom, paddingLeft, surface, labelEnd, size, minSize, maxSize, collapsedSizeHint, } = layoutProps;
|
|
119
|
+
const resolvedRenderMode = renderMode ?? "live";
|
|
120
|
+
const { left: leftFlex, middle: middleFlex, right: rightFlex, } = resolvePhiThreeColumnFlex({ balancedSides, sideShare, leftWidth, middleWidth, rightWidth });
|
|
105
121
|
const showInsertButton = resolvedRenderMode === "editor";
|
|
106
122
|
const layoutBox = resolvePhiLayoutBox({ size, minSize, maxSize, collapsedSizeHint });
|
|
107
123
|
const { style: resolvedLayoutStyle, ground, hasExplicitLayoutBackground, } = resolvePhiBaseLayoutChrome({
|
|
@@ -574,10 +574,31 @@ export declare const PHI_SPLIT_CARD_LAYOUT_DEFINITION: {
|
|
|
574
574
|
key: string;
|
|
575
575
|
type: "padding";
|
|
576
576
|
label: string;
|
|
577
|
+
} | {
|
|
578
|
+
key: string;
|
|
579
|
+
type: "choice";
|
|
580
|
+
label: string;
|
|
581
|
+
presentation: "segmented";
|
|
582
|
+
emptyOption: {
|
|
583
|
+
value: string;
|
|
584
|
+
label: string;
|
|
585
|
+
};
|
|
586
|
+
options: {
|
|
587
|
+
value: string;
|
|
588
|
+
label: string;
|
|
589
|
+
}[];
|
|
590
|
+
visibleWhen?: undefined;
|
|
577
591
|
} | {
|
|
578
592
|
key: string;
|
|
579
593
|
type: "boolean";
|
|
580
594
|
label: string;
|
|
595
|
+
visibleWhen: {
|
|
596
|
+
field: string;
|
|
597
|
+
notEquals: string;
|
|
598
|
+
};
|
|
599
|
+
presentation?: undefined;
|
|
600
|
+
emptyOption?: undefined;
|
|
601
|
+
options?: undefined;
|
|
581
602
|
})[];
|
|
582
603
|
slots: ({
|
|
583
604
|
readonly key: "slot_0";
|
|
@@ -613,12 +634,39 @@ export declare const PHI_THREE_COLUMN_LAYOUT_DEFINITION: {
|
|
|
613
634
|
key: string;
|
|
614
635
|
type: "boolean";
|
|
615
636
|
label: string;
|
|
637
|
+
valueType?: undefined;
|
|
638
|
+
visibleWhen?: undefined;
|
|
639
|
+
emptyOption?: undefined;
|
|
640
|
+
options?: undefined;
|
|
641
|
+
min?: undefined;
|
|
642
|
+
} | {
|
|
643
|
+
key: string;
|
|
644
|
+
type: "choice";
|
|
645
|
+
valueType: "number";
|
|
646
|
+
label: string;
|
|
647
|
+
visibleWhen: {
|
|
648
|
+
field: string;
|
|
649
|
+
equals: true;
|
|
650
|
+
};
|
|
651
|
+
emptyOption: {
|
|
652
|
+
value: string;
|
|
653
|
+
label: string;
|
|
654
|
+
separator: "after";
|
|
655
|
+
};
|
|
656
|
+
options: {
|
|
657
|
+
value: number;
|
|
658
|
+
label: string;
|
|
659
|
+
}[];
|
|
616
660
|
min?: undefined;
|
|
617
661
|
} | {
|
|
618
662
|
key: string;
|
|
619
663
|
type: "length";
|
|
620
664
|
label: string;
|
|
621
665
|
min: number;
|
|
666
|
+
valueType?: undefined;
|
|
667
|
+
visibleWhen?: undefined;
|
|
668
|
+
emptyOption?: undefined;
|
|
669
|
+
options?: undefined;
|
|
622
670
|
})[];
|
|
623
671
|
slots: ({
|
|
624
672
|
readonly key: "slot_0";
|
|
@@ -1265,10 +1313,31 @@ export declare const PHI_CORE_LAYOUT_DEFINITIONS: readonly [{
|
|
|
1265
1313
|
key: string;
|
|
1266
1314
|
type: "padding";
|
|
1267
1315
|
label: string;
|
|
1316
|
+
} | {
|
|
1317
|
+
key: string;
|
|
1318
|
+
type: "choice";
|
|
1319
|
+
label: string;
|
|
1320
|
+
presentation: "segmented";
|
|
1321
|
+
emptyOption: {
|
|
1322
|
+
value: string;
|
|
1323
|
+
label: string;
|
|
1324
|
+
};
|
|
1325
|
+
options: {
|
|
1326
|
+
value: string;
|
|
1327
|
+
label: string;
|
|
1328
|
+
}[];
|
|
1329
|
+
visibleWhen?: undefined;
|
|
1268
1330
|
} | {
|
|
1269
1331
|
key: string;
|
|
1270
1332
|
type: "boolean";
|
|
1271
1333
|
label: string;
|
|
1334
|
+
visibleWhen: {
|
|
1335
|
+
field: string;
|
|
1336
|
+
notEquals: string;
|
|
1337
|
+
};
|
|
1338
|
+
presentation?: undefined;
|
|
1339
|
+
emptyOption?: undefined;
|
|
1340
|
+
options?: undefined;
|
|
1272
1341
|
})[];
|
|
1273
1342
|
slots: ({
|
|
1274
1343
|
readonly key: "slot_0";
|
|
@@ -1303,12 +1372,39 @@ export declare const PHI_CORE_LAYOUT_DEFINITIONS: readonly [{
|
|
|
1303
1372
|
key: string;
|
|
1304
1373
|
type: "boolean";
|
|
1305
1374
|
label: string;
|
|
1375
|
+
valueType?: undefined;
|
|
1376
|
+
visibleWhen?: undefined;
|
|
1377
|
+
emptyOption?: undefined;
|
|
1378
|
+
options?: undefined;
|
|
1379
|
+
min?: undefined;
|
|
1380
|
+
} | {
|
|
1381
|
+
key: string;
|
|
1382
|
+
type: "choice";
|
|
1383
|
+
valueType: "number";
|
|
1384
|
+
label: string;
|
|
1385
|
+
visibleWhen: {
|
|
1386
|
+
field: string;
|
|
1387
|
+
equals: true;
|
|
1388
|
+
};
|
|
1389
|
+
emptyOption: {
|
|
1390
|
+
value: string;
|
|
1391
|
+
label: string;
|
|
1392
|
+
separator: "after";
|
|
1393
|
+
};
|
|
1394
|
+
options: {
|
|
1395
|
+
value: number;
|
|
1396
|
+
label: string;
|
|
1397
|
+
}[];
|
|
1306
1398
|
min?: undefined;
|
|
1307
1399
|
} | {
|
|
1308
1400
|
key: string;
|
|
1309
1401
|
type: "length";
|
|
1310
1402
|
label: string;
|
|
1311
1403
|
min: number;
|
|
1404
|
+
valueType?: undefined;
|
|
1405
|
+
visibleWhen?: undefined;
|
|
1406
|
+
emptyOption?: undefined;
|
|
1407
|
+
options?: undefined;
|
|
1312
1408
|
})[];
|
|
1313
1409
|
slots: ({
|
|
1314
1410
|
readonly key: "slot_0";
|