@phis/ui 0.4.5 → 0.4.7
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-root-layout.js +1 -1
- package/components/controls/phi-button-control.d.ts +3 -1
- package/components/controls/phi-button-control.js +2 -2
- package/components/controls/phi-collapse-control.d.ts +6 -2
- package/components/controls/phi-collapse-control.js +2 -2
- package/components/controls/phi-dialog-control.d.ts +11 -5
- package/components/controls/phi-dialog-control.js +19 -13
- package/components/controls/phi-menu-control-vocabulary.d.ts +7 -0
- package/components/controls/phi-menu-control-vocabulary.js +10 -0
- package/components/controls/phi-menu-control.d.ts +4 -1
- package/components/controls/phi-menu-control.js +6 -1
- package/components/controls/phi-text-control.d.ts +6 -1
- package/components/controls/phi-text-control.js +2 -1
- package/components/layouts/clients/phi-split-card-layout-client.js +13 -5
- package/components/layouts/clients/phi-three-column-layout-client.js +9 -3
- package/components/layouts/split-card-geometry.js +6 -2
- package/components/media/aspect-ratios.d.ts +2 -2
- package/components/menus/phi-account-menu.js +3 -1
- package/components/navigation/phi-link.js +7 -2
- package/components/navigation/use-phi-protected-mail.d.ts +11 -0
- package/components/navigation/use-phi-protected-mail.js +29 -0
- package/components/regions/clients/cms-region-container-client.js +5 -1
- package/components/regions/phi-cms-region-shell.d.ts +1 -0
- package/components/regions/phi-cms-region-shell.js +11 -0
- package/components/regions/presets/phi-area-shell-preset-nodes.d.ts +5 -0
- package/components/regions/presets/phi-area-shell-preset-nodes.js +19 -3
- package/components/root/phi-config-provider.js +16 -0
- package/components/shell/phi-cms-shell.d.ts +3 -1
- package/components/shell/phi-cms-shell.js +7 -3
- package/components/shell/phi-nav-link.js +7 -2
- package/components/shell/phi-shell-sider-drawer.d.ts +17 -0
- package/components/shell/phi-shell-sider-drawer.js +88 -0
- package/components/widgets/helpers/internal-reference-resolver.server.d.ts +1 -0
- package/components/widgets/helpers/internal-reference-resolver.server.js +4 -1
- package/components/widgets/label-sets/inspector.js +2 -0
- package/components/widgets/label-sets/search-results.d.ts +4 -0
- package/components/widgets/label-sets/search-results.js +35 -0
- package/components/widgets/label-types/inspector.d.ts +2 -0
- package/components/widgets/label-types/inspector.js +1 -0
- package/components/widgets/label-types/search-results.d.ts +15 -0
- package/components/widgets/label-types/search-results.js +10 -0
- package/components/widgets/server/navigation-request.js +13 -1
- package/components/widgets/shared/card-body-client.d.ts +2 -0
- package/components/widgets/shared/card-body-client.js +8 -7
- package/components/widgets/shared/card-vocabulary.d.ts +36 -0
- package/components/widgets/shared/card-vocabulary.js +52 -0
- package/components/widgets/shared/markdown-body-client.d.ts +29 -0
- package/components/widgets/shared/markdown-body-client.js +60 -5
- package/components/widgets/shared/markdown-image-vocabulary.d.ts +31 -0
- package/components/widgets/shared/markdown-image-vocabulary.js +68 -0
- package/components/widgets/shared/markdown-render.d.ts +5 -0
- package/components/widgets/shared/markdown-render.js +123 -8
- package/components/widgets/shared/markdown-sections.d.ts +40 -0
- package/components/widgets/shared/markdown-sections.js +111 -0
- package/constants/cms-widget-types.d.ts +2 -0
- package/constants/cms-widget-types.js +4 -0
- package/gateway/site-area.d.ts +10 -7
- package/gateway/site-area.js +13 -11
- package/gateway/site-config.js +7 -1
- package/gateway/site-read-marker-listeners.d.ts +24 -0
- package/gateway/site-read-marker-listeners.js +22 -0
- package/gateway/site-search.d.ts +37 -0
- package/gateway/site-search.js +116 -0
- package/helpers/external-href.js +1 -1
- package/helpers/protected-mail.d.ts +16 -0
- package/helpers/protected-mail.js +81 -0
- package/next/areas/app.js +5 -1
- package/next/areas/public.js +5 -1
- package/next/seo-routes.js +2 -2
- package/package.json +2 -2
- package/plugins/runtime-modules/app/presets.js +23 -0
- package/plugins/runtime-modules/app/trees/phi-default-app-area-preset-tree.d.ts +2 -1
- package/plugins/runtime-modules/app/trees/phi-default-app-area-preset-tree.js +3 -2
- package/plugins/runtime-modules/builder/clients/region-inspector.js +20 -1
- package/plugins/runtime-modules/client-manifests/common.js +8 -0
- package/plugins/runtime-modules/core/authoring-widgets.js +4 -0
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +8 -1
- package/plugins/runtime-modules/core/widgets/card/config.js +22 -1
- package/plugins/runtime-modules/core/widgets/card/editor.js +9 -1
- package/plugins/runtime-modules/core/widgets/card/plugin.js +18 -0
- package/plugins/runtime-modules/core/widgets/card/server.js +9 -1
- package/plugins/runtime-modules/core/widgets/description/plugin.js +10 -0
- package/plugins/runtime-modules/core/widgets/entry-list/view.server.js +2 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +3 -3
- package/plugins/runtime-modules/core/widgets/header-navigation/client.d.ts +6 -1
- package/plugins/runtime-modules/core/widgets/header-navigation/client.js +40 -13
- package/plugins/runtime-modules/core/widgets/header-navigation/config.d.ts +26 -1
- package/plugins/runtime-modules/core/widgets/header-navigation/config.js +27 -0
- package/plugins/runtime-modules/core/widgets/header-navigation/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/header-navigation/server.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/header-navigation/server.js +3 -1
- package/plugins/runtime-modules/core/widgets/html/plugin.js +16 -1
- package/plugins/runtime-modules/core/widgets/html/server.d.ts +6 -0
- package/plugins/runtime-modules/core/widgets/html/server.js +12 -4
- package/plugins/runtime-modules/core/widgets/image/client.js +11 -7
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +16 -0
- package/plugins/runtime-modules/core/widgets/markdown/config.js +46 -1
- package/plugins/runtime-modules/core/widgets/markdown/plugin.js +16 -0
- package/plugins/runtime-modules/core/widgets/markdown/server.js +22 -8
- package/plugins/runtime-modules/core/widgets/search-box/authoring.d.ts +6 -0
- package/plugins/runtime-modules/core/widgets/search-box/authoring.js +10 -0
- package/plugins/runtime-modules/core/widgets/search-box/client.d.ts +21 -0
- package/plugins/runtime-modules/core/widgets/search-box/client.js +17 -0
- package/plugins/runtime-modules/core/widgets/search-box/config.d.ts +63 -0
- package/plugins/runtime-modules/core/widgets/search-box/config.js +48 -0
- package/plugins/runtime-modules/core/widgets/search-box/plugin.d.ts +3 -0
- package/plugins/runtime-modules/core/widgets/search-box/plugin.js +11 -0
- package/plugins/runtime-modules/core/widgets/search-box/server.d.ts +21 -0
- package/plugins/runtime-modules/core/widgets/search-box/server.js +48 -0
- package/plugins/runtime-modules/core/widgets/search-results/authoring.d.ts +6 -0
- package/plugins/runtime-modules/core/widgets/search-results/authoring.js +10 -0
- package/plugins/runtime-modules/core/widgets/search-results/client.d.ts +34 -0
- package/plugins/runtime-modules/core/widgets/search-results/client.js +32 -0
- package/plugins/runtime-modules/core/widgets/search-results/config.d.ts +41 -0
- package/plugins/runtime-modules/core/widgets/search-results/config.js +39 -0
- package/plugins/runtime-modules/core/widgets/search-results/plugin.d.ts +3 -0
- package/plugins/runtime-modules/core/widgets/search-results/plugin.js +10 -0
- package/plugins/runtime-modules/core/widgets/search-results/server.d.ts +20 -0
- package/plugins/runtime-modules/core/widgets/search-results/server.js +73 -0
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +11 -0
- package/plugins/runtime-modules/core/widgets/simple-text/server.js +11 -1
- package/plugins/runtime-modules/core/widgets.js +17 -0
- package/plugins/runtime-modules/public/presets.d.ts +16 -0
- package/plugins/runtime-modules/public/presets.js +22 -0
- package/plugins/runtime-modules/public-base-page-references.d.ts +1 -0
- package/plugins/runtime-modules/public-base-page-references.js +1 -0
- package/plugins/runtime-modules/search-page-references.d.ts +20 -0
- package/plugins/runtime-modules/search-page-references.js +35 -0
- package/plugins/runtime-modules/search-page-tree.d.ts +14 -0
- package/plugins/runtime-modules/search-page-tree.js +63 -0
- package/server-helpers/search-index.d.ts +28 -0
- package/server-helpers/search-index.js +299 -0
- package/server-helpers/search-text.d.ts +40 -0
- package/server-helpers/search-text.js +152 -0
- package/server-helpers.d.ts +1 -0
- package/server-helpers.js +1 -0
- package/styles/controls.css +108 -10
- package/styles/layout.css +35 -0
- package/styles/shell.css +142 -0
- package/theme/phi-tokens.d.ts +6 -0
- package/theme/phi-tokens.js +6 -0
- package/theme.d.ts +1 -0
- package/theme.js +6 -0
- package/types/cms-plugins.d.ts +20 -2
- package/types/core-widget-placements.d.ts +5 -0
|
@@ -288,7 +288,7 @@ export async function PhiCmsAreaShell({ root, cmsBridge, children, chrome = "she
|
|
|
288
288
|
return (_jsx(PhiCmsShell, { content: children, headerPaneStickyTop: headerPaneStickyTop, headerBandRoom: headerBandRoom, headerTopRoom: headerTopBehaviour == null ? undefined : {
|
|
289
289
|
[PHI_SHELL_HEADER_TOP_EXTENT_PROPERTY]: `${headerTopRoom.extent}px`,
|
|
290
290
|
[PHI_SHELL_HEADER_TOP_STACK_PROPERTY]: `${headerTopRoom.stack}px`,
|
|
291
|
-
}, headerTop: hasRenderableHeaderTop ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region header_top", regionTypes: [PhiCmsRegionType.HeaderTop], registry: runtimeRegistry })) : undefined, headerMain: hasRenderableHeaderMain ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region header_main", regionTypes: [PhiCmsRegionType.HeaderMain], registry: runtimeRegistry })) : undefined, headerBottom: headerBottom, hero: hero, siderLeft: hasRenderableSiderLeft ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "sider_left", regionTypes: [PhiCmsRegionType.SiderLeft], stackGap: 0, registry: runtimeRegistry })) : undefined, siderRight: siderRight, siderLeftFullHeight: hasPhiConfigFlag(siderLeftRegion?.config, PhiCmsFlags.FullHeight) && hasRenderableSiderLeft, footerTop: footerTop, drawer: drawer, footerMain: hasRenderableFooterMain ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region footer_main", regionTypes: [PhiCmsRegionType.Footer], registry: runtimeRegistry })) : undefined, footerBottom: hasRenderableFooterBottom ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region footer_bottom", regionTypes: [PhiCmsRegionType.FooterBottom], registry: runtimeRegistry })) : undefined }));
|
|
291
|
+
}, headerTop: hasRenderableHeaderTop ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region header_top", regionTypes: [PhiCmsRegionType.HeaderTop], registry: runtimeRegistry })) : undefined, headerMain: hasRenderableHeaderMain ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region header_main", regionTypes: [PhiCmsRegionType.HeaderMain], registry: runtimeRegistry })) : undefined, headerBottom: headerBottom, hero: hero, siderLeft: hasRenderableSiderLeft ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "sider_left", regionTypes: [PhiCmsRegionType.SiderLeft], stackGap: 0, registry: runtimeRegistry })) : undefined, siderRight: siderRight, siderLeftFullHeight: hasPhiConfigFlag(siderLeftRegion?.config, PhiCmsFlags.FullHeight) && hasRenderableSiderLeft, siderLeftMobileDrawer: hasRenderableSiderLeft && hasPhiConfigFlag(siderLeftRegion?.config, PhiCmsFlags.MobileDrawer), footerTop: footerTop, drawer: drawer, footerMain: hasRenderableFooterMain ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region footer_main", regionTypes: [PhiCmsRegionType.Footer], registry: runtimeRegistry })) : undefined, footerBottom: hasRenderableFooterBottom ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region footer_bottom", regionTypes: [PhiCmsRegionType.FooterBottom], registry: runtimeRegistry })) : undefined }));
|
|
292
292
|
}
|
|
293
293
|
/**
|
|
294
294
|
* Boundary and Shell in one component, for a caller that is not a pair of Layouts.
|
|
@@ -15,6 +15,8 @@ export type PhiButtonControlProps = {
|
|
|
15
15
|
ariaLabel?: string;
|
|
16
16
|
/** For a button that is a toggle -- pause and play -- whether it is on. */
|
|
17
17
|
ariaPressed?: boolean;
|
|
18
|
+
/** Whether what the Button opens is open: a menu button's `aria-expanded`. */
|
|
19
|
+
ariaExpanded?: boolean;
|
|
18
20
|
/**
|
|
19
21
|
* Renders the button as a link rather than a command.
|
|
20
22
|
*
|
|
@@ -92,4 +94,4 @@ export type PhiButtonControlProps = {
|
|
|
92
94
|
ref?: Ref<HTMLButtonElement | HTMLAnchorElement>;
|
|
93
95
|
onClick?: () => void;
|
|
94
96
|
};
|
|
95
|
-
export declare function PhiButtonControl({ label, ariaLabel, ariaPressed, href, newTab, external, tooltip, icon, type, shape, danger, ghost, gradient, glass, disabled, readOnly, loading, htmlType, block, size, style, badge, className, ref, onClick, }: PhiButtonControlProps): import("react").JSX.Element;
|
|
97
|
+
export declare function PhiButtonControl({ label, ariaLabel, ariaPressed, ariaExpanded, href, newTab, external, tooltip, icon, type, shape, danger, ghost, gradient, glass, disabled, readOnly, loading, htmlType, block, size, style, badge, className, ref, onClick, }: PhiButtonControlProps): import("react").JSX.Element;
|
|
@@ -12,7 +12,7 @@ import { PhiHoverText } from "./phi-hover-text";
|
|
|
12
12
|
*/
|
|
13
13
|
const PhiLazyBadge = lazy(() => import("antd/es/badge"));
|
|
14
14
|
const PHI_GLASS_BUTTON_FILTER = "blur(12px) saturate(140%)";
|
|
15
|
-
export function PhiButtonControl({ label, ariaLabel, ariaPressed, href, newTab, external, tooltip, icon, type = "default", shape, danger, ghost, gradient, glass, disabled, readOnly, loading, htmlType, block, size, style, badge, className, ref, onClick, }) {
|
|
15
|
+
export function PhiButtonControl({ label, ariaLabel, ariaPressed, ariaExpanded, href, newTab, external, tooltip, icon, type = "default", shape, danger, ghost, gradient, glass, disabled, readOnly, loading, htmlType, block, size, style, badge, className, ref, onClick, }) {
|
|
16
16
|
const visibleTooltip = typeof label === "string" && typeof tooltip === "string" && label === tooltip
|
|
17
17
|
? null
|
|
18
18
|
: tooltip;
|
|
@@ -33,7 +33,7 @@ export function PhiButtonControl({ label, ariaLabel, ariaPressed, href, newTab,
|
|
|
33
33
|
gradientVars ? "phi-btn-gradient" : null,
|
|
34
34
|
glass && !gradientVars ? "phi-btn-glass" : null,
|
|
35
35
|
].filter(Boolean).join(" ") || undefined;
|
|
36
|
-
const button = (_jsx(Button, { ref: ref, className: paintedClassName, "aria-label": ariaLabel, "aria-pressed": ariaPressed, type: gradientVars ? "primary" : glass ? "default" : type, shape: shape, danger: danger, ghost: ghost, disabled: inert, loading: loading, htmlType: htmlType, block: block, size: size,
|
|
36
|
+
const button = (_jsx(Button, { ref: ref, className: paintedClassName, "aria-label": ariaLabel, "aria-pressed": ariaPressed, "aria-expanded": ariaExpanded, type: gradientVars ? "primary" : glass ? "default" : type, shape: shape, danger: danger, ghost: ghost, disabled: inert, loading: loading, htmlType: htmlType, block: block, size: size,
|
|
37
37
|
/* Not a pointer target at all, so the Button's own hover and press states never start. */
|
|
38
38
|
style: readOnly ? { ...paintedStyle, pointerEvents: "none" } : paintedStyle, "aria-disabled": readOnly || undefined, icon: icon, onClick: readOnly ? undefined : onClick, children: label }));
|
|
39
39
|
/*
|
|
@@ -24,8 +24,12 @@ export type PhiCollapseControlProps = {
|
|
|
24
24
|
openKeys: readonly string[];
|
|
25
25
|
onOpenKeysChange?: (keys: string[]) => void;
|
|
26
26
|
accordion?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
|
|
27
|
+
/**
|
|
28
|
+
* What folds a section: the whole header row (`row`), the header's title and its icon (`header`), only
|
|
29
|
+
* the icon, or nothing. Ant Design's `header` answers on the words alone, so a click beside a short
|
|
30
|
+
* title does nothing; `row` is its default, which takes the whole bar.
|
|
31
|
+
*/
|
|
32
|
+
collapsible?: "row" | "header" | "icon" | "disabled";
|
|
29
33
|
/** No ground of its own for headers and bodies. */
|
|
30
34
|
ghost?: boolean;
|
|
31
35
|
expandIconPlacement?: "start" | "end";
|
|
@@ -24,10 +24,10 @@ function resolveSectionStyles(titleStrong, headerPadding, bodyPadding) {
|
|
|
24
24
|
export function PhiCollapseControl({ sections, openKeys, onOpenKeysChange, accordion = false, collapsible = "header", ghost = false, expandIconPlacement = "start", size, headerClassName, headerPadding, bodyPadding, titleStrong = false, style, }) {
|
|
25
25
|
return (_jsx(Collapse, { accordion: accordion, activeKey: accordion ? openKeys[0] ?? undefined : [...openKeys],
|
|
26
26
|
// The caller's box draws the outline; what stays here is `ghost`, which decides the inside.
|
|
27
|
-
bordered: false, ghost: ghost, collapsible: collapsible, destroyOnHidden: false, expandIconPlacement: expandIconPlacement, size: size, classNames: headerClassName ? { header: headerClassName } : undefined, items: sections.map((section) => ({
|
|
27
|
+
bordered: false, ghost: ghost, collapsible: collapsible === "row" ? undefined : collapsible, destroyOnHidden: false, expandIconPlacement: expandIconPlacement, size: size, classNames: headerClassName ? { header: headerClassName } : undefined, items: sections.map((section) => ({
|
|
28
28
|
key: section.key,
|
|
29
29
|
label: section.label,
|
|
30
|
-
collapsible,
|
|
30
|
+
collapsible: collapsible === "row" ? undefined : collapsible,
|
|
31
31
|
forceRender: section.forceRender,
|
|
32
32
|
...(section.hidden ? { style: { display: "none" } } : {}),
|
|
33
33
|
children: section.children,
|
|
@@ -4,6 +4,7 @@ import type { PhiOverlayCloseSource, PhiOverlayMaskBehaviour } from "../../types
|
|
|
4
4
|
import type { PhiControlSize } from "../../types/control";
|
|
5
5
|
import { type PhiAlertControlProps } from "./phi-alert-control";
|
|
6
6
|
import type { PhiButtonType } from "./phi-button-types";
|
|
7
|
+
import { type PhiDrawerControlProps } from "./phi-drawer-control";
|
|
7
8
|
/**
|
|
8
9
|
* A Dialog built in code: a title, one subject, an optional notice above it, and the actions below.
|
|
9
10
|
*
|
|
@@ -27,10 +28,9 @@ import type { PhiButtonType } from "./phi-button-types";
|
|
|
27
28
|
* the same tokens rather than from each other -- the Layout presets are creation defaults a Builder may
|
|
28
29
|
* edit afterwards, which is not a constant to depend on.
|
|
29
30
|
*
|
|
30
|
-
* Modal
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* it becomes, and its placement and size come with it.
|
|
31
|
+
* A Modal unless `presentation` says `drawer`: the Header Navigation's entries on a phone were the first
|
|
32
|
+
* Dialog built in code and drawn from the side. `PhiDrawerControl` zeroes its zones as the Modal does, so
|
|
33
|
+
* the inside is the same; `placement` and `size` are the Drawer's own and nobody else reads them.
|
|
34
34
|
*/
|
|
35
35
|
export type PhiDialogControlAction = {
|
|
36
36
|
key: string;
|
|
@@ -70,7 +70,13 @@ export type PhiDialogControlProps = {
|
|
|
70
70
|
mountPolicy?: PhiCmsMountPolicy;
|
|
71
71
|
/** A styling hook for a surface that mounts the Dialog inside its own popup container. */
|
|
72
72
|
rootClassName?: string;
|
|
73
|
+
/** A Modal (the default) or a Drawer from the side. */
|
|
74
|
+
presentation?: "modal" | "drawer";
|
|
75
|
+
/** The edge a Drawer comes from. */
|
|
76
|
+
placement?: PhiDrawerControlProps["placement"];
|
|
77
|
+
/** A Drawer's width (or height, from the top or bottom). */
|
|
78
|
+
size?: PhiDrawerControlProps["size"];
|
|
73
79
|
onDismiss?: (source: PhiOverlayCloseSource) => void;
|
|
74
80
|
afterOpenChange?: (open: boolean) => void;
|
|
75
81
|
};
|
|
76
|
-
export declare function PhiDialogControl({ open, title, children, alert, actions, controlSize, centered, closable, keyboard, mask, mountPolicy, rootClassName, onDismiss, afterOpenChange, }: PhiDialogControlProps): import("react").JSX.Element;
|
|
82
|
+
export declare function PhiDialogControl({ open, title, children, alert, actions, controlSize, centered, closable, keyboard, mask, mountPolicy, rootClassName, presentation, placement, size, onDismiss, afterOpenChange, }: PhiDialogControlProps): import("react").JSX.Element;
|
|
@@ -6,17 +6,23 @@ import { PhiButtonControl } from "./phi-button-control";
|
|
|
6
6
|
import { PhiCompactGroupControl } from "./phi-compact-group-control";
|
|
7
7
|
import { PhiFlexControl } from "./phi-flex-control";
|
|
8
8
|
import { PhiModalControl } from "./phi-modal-control";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
import { PhiDrawerControl } from "./phi-drawer-control";
|
|
10
|
+
export function PhiDialogControl({ open, title, children, alert, actions, controlSize = "medium", centered, closable, keyboard, mask, mountPolicy, rootClassName, presentation = "modal", placement, size, onDismiss, afterOpenChange, }) {
|
|
11
|
+
const body = (_jsxs(PhiFlexControl, { vertical: true, gap: PHI_SPACE.base, style: { padding: PHI_SPACE.base, width: "100%", minWidth: 0 }, children: [alert == null ? null : _jsx(PhiAlertControl, { ...alert }), children] }));
|
|
12
|
+
const footer = (
|
|
13
|
+
/*
|
|
14
|
+
* The actions are one compact group, as a tree Overlay's footer is (OVERLAYS.md): Cancel and Apply
|
|
15
|
+
* are the two ends of one decision, and a gap between them read as two unrelated offers. A compact
|
|
16
|
+
* group does not wrap.
|
|
17
|
+
*/
|
|
18
|
+
actions == null || actions.length === 0 ? null : (_jsx(PhiFlexControl, { align: "center", justify: "end", style: {
|
|
19
|
+
paddingBlock: PHI_SPACE.xs,
|
|
20
|
+
paddingInline: PHI_SPACE.base,
|
|
21
|
+
width: "100%",
|
|
22
|
+
minWidth: 0,
|
|
23
|
+
}, children: _jsx(PhiCompactGroupControl, { children: actions.map((action) => (_jsx(PhiButtonControl, { label: action.label, icon: action.icon, type: action.type, danger: action.danger, disabled: action.disabled, loading: action.loading, onClick: action.onClick }, action.key))) }) })));
|
|
24
|
+
if (presentation === "drawer") {
|
|
25
|
+
return (_jsx(PhiDrawerControl, { open: open, title: title, closable: closable, keyboard: keyboard, mask: mask, mountPolicy: mountPolicy, placement: placement, size: size, onDismiss: onDismiss, afterOpenChange: afterOpenChange, body: body, footer: footer }));
|
|
26
|
+
}
|
|
27
|
+
return (_jsx(PhiModalControl, { open: open, title: title, closable: closable, keyboard: keyboard, mask: mask, mountPolicy: mountPolicy, centered: centered, controlSize: controlSize, rootClassName: rootClassName, onDismiss: onDismiss, afterOpenChange: afterOpenChange, body: body, footer: footer }));
|
|
22
28
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a horizontal menu marks the entry the reader is on: `underline` is a bar under it, `pill` a rounded
|
|
3
|
+
* ground in the control height, `auto` the bar in light mode and the pill in dark mode. Ant Design itself
|
|
4
|
+
* draws a bar in light mode and fills the whole height of the bar with the primary colour in dark mode.
|
|
5
|
+
*/
|
|
6
|
+
export declare const PHI_MENU_SELECTION_STYLES: readonly ["auto", "underline", "pill"];
|
|
7
|
+
export type PhiMenuSelectionStyle = (typeof PHI_MENU_SELECTION_STYLES)[number];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The Menu Control's words, apart from the Control: a Widget's definition reads them on the server, and a
|
|
3
|
+
* value imported from the Control would make Ant Design's Menu a dependency of every route.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* How a horizontal menu marks the entry the reader is on: `underline` is a bar under it, `pill` a rounded
|
|
7
|
+
* ground in the control height, `auto` the bar in light mode and the pill in dark mode. Ant Design itself
|
|
8
|
+
* draws a bar in light mode and fills the whole height of the bar with the primary colour in dark mode.
|
|
9
|
+
*/
|
|
10
|
+
export const PHI_MENU_SELECTION_STYLES = ["auto", "underline", "pill"];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from "react";
|
|
2
2
|
import type { ItemType } from "antd/es/menu/interface";
|
|
3
|
+
import type { PhiMenuSelectionStyle } from "./phi-menu-control-vocabulary";
|
|
3
4
|
export type PhiMenuControlDivider = {
|
|
4
5
|
type: "divider";
|
|
5
6
|
key?: string;
|
|
@@ -31,6 +32,8 @@ export type PhiMenuControlItem = PhiMenuControlDivider | PhiMenuControlGroup | P
|
|
|
31
32
|
export type PhiMenuControlProps = {
|
|
32
33
|
items: readonly PhiMenuControlItem[];
|
|
33
34
|
mode: "inline" | "horizontal";
|
|
35
|
+
/** A horizontal menu's mark for the current entry (`styles/controls.css`); absent, Ant Design's own. */
|
|
36
|
+
selectionStyle?: PhiMenuSelectionStyle;
|
|
34
37
|
/** Defaults to the active Phi theme mode. */
|
|
35
38
|
menuTheme?: "light" | "dark";
|
|
36
39
|
selectedKeys?: readonly string[];
|
|
@@ -50,4 +53,4 @@ export declare function toPhiAntdMenuItems(items: readonly PhiMenuControlItem[])
|
|
|
50
53
|
* backgrounds every stacked Phi menu uses, its collapsed width, and the type a Widget configures — so
|
|
51
54
|
* menu surfaces cannot drift apart in their component tokens.
|
|
52
55
|
*/
|
|
53
|
-
export declare function PhiMenuControl({ items, mode, menuTheme, selectedKeys, collapsed, collapsedWidth, inlineIndent, fontFamily, fontSize, style, }: PhiMenuControlProps): import("react").JSX.Element | null;
|
|
56
|
+
export declare function PhiMenuControl({ items, mode, menuTheme, selectedKeys, collapsed, collapsedWidth, inlineIndent, fontFamily, fontSize, selectionStyle, style, }: PhiMenuControlProps): import("react").JSX.Element | null;
|
|
@@ -24,7 +24,7 @@ export function toPhiAntdMenuItems(items) {
|
|
|
24
24
|
* backgrounds every stacked Phi menu uses, its collapsed width, and the type a Widget configures — so
|
|
25
25
|
* menu surfaces cannot drift apart in their component tokens.
|
|
26
26
|
*/
|
|
27
|
-
export function PhiMenuControl({ items, mode, menuTheme, selectedKeys, collapsed = false, collapsedWidth, inlineIndent, fontFamily, fontSize, style, }) {
|
|
27
|
+
export function PhiMenuControl({ items, mode, menuTheme, selectedKeys, collapsed = false, collapsedWidth, inlineIndent, fontFamily, fontSize, selectionStyle, style, }) {
|
|
28
28
|
const { mode: themeMode } = usePhiConfig();
|
|
29
29
|
const resolvedMenuTheme = menuTheme ?? themeMode;
|
|
30
30
|
/*
|
|
@@ -53,6 +53,11 @@ export function PhiMenuControl({ items, mode, menuTheme, selectedKeys, collapsed
|
|
|
53
53
|
* defaults, whose item spacing is what separates the entries in a header bar.
|
|
54
54
|
*/
|
|
55
55
|
mode === "inline" ? "phi-menu-control--inline" : null,
|
|
56
|
+
/*
|
|
57
|
+
* Decided by the Menu's own theme class in CSS, not here: `auto` is one class whatever the mode, so the
|
|
58
|
+
* page a server rendered for both modes marks the entry right in the one the reader sees.
|
|
59
|
+
*/
|
|
60
|
+
mode === "horizontal" && selectionStyle ? `phi-menu-control--selection-${selectionStyle}` : null,
|
|
56
61
|
fontFamily ? "phi-menu-control--font-family" : null,
|
|
57
62
|
fontSize ? "phi-menu-control--font-size" : null,
|
|
58
63
|
mode === "inline" && collapsedWidth !== undefined ? "phi-menu-control--collapsed-width" : null,
|
|
@@ -5,6 +5,11 @@ export type PhiTextControlPresentation = "input" | "password" | "textarea" | "hi
|
|
|
5
5
|
export type PhiTextControlProps = {
|
|
6
6
|
/** The DOM id of the input, so a `<label for>` outside the control can name it. */
|
|
7
7
|
id?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The field's name in a form that submits the browser's way -- a `GET` form the page answers by its
|
|
10
|
+
* query. Only such a form has a use for it; a controlled field in a Form host reads its value.
|
|
11
|
+
*/
|
|
12
|
+
name?: string;
|
|
8
13
|
value?: string | null;
|
|
9
14
|
label?: ReactNode;
|
|
10
15
|
description?: ReactNode;
|
|
@@ -49,4 +54,4 @@ export type PhiTextControlProps = {
|
|
|
49
54
|
*/
|
|
50
55
|
inputStyle?: CSSProperties;
|
|
51
56
|
};
|
|
52
|
-
export declare function PhiTextControl({ id, value, label, description, inputType, presentation, disabled, readOnly, allowClear, clearLabel, placeholder, ariaLabel, prefix, autoFocus, autoComplete, minLength, maxLength, rows, cols, autoSize, tabIndex, size, variant, inputRef, textareaRef, onChange, onPressEnter, onKeyDown, onFocus, onBlur, onClear, style, inputStyle, }: PhiTextControlProps): import("react").JSX.Element;
|
|
57
|
+
export declare function PhiTextControl({ id, name, value, label, description, inputType, presentation, disabled, readOnly, allowClear, clearLabel, placeholder, ariaLabel, prefix, autoFocus, autoComplete, minLength, maxLength, rows, cols, autoSize, tabIndex, size, variant, inputRef, textareaRef, onChange, onPressEnter, onKeyDown, onFocus, onBlur, onClear, style, inputStyle, }: PhiTextControlProps): import("react").JSX.Element;
|
|
@@ -72,7 +72,7 @@ function resolveTextAreaClearStyle(style, inputStyle) {
|
|
|
72
72
|
alignItems: "center",
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
-
export function PhiTextControl({ id, value, label, description, inputType = "text", presentation = "input", disabled = false, readOnly = false, allowClear = true, clearLabel, placeholder, ariaLabel, prefix, autoFocus, autoComplete, minLength, maxLength, rows, cols, autoSize, tabIndex, size, variant, inputRef, textareaRef, onChange, onPressEnter, onKeyDown, onFocus, onBlur, onClear, style, inputStyle, }) {
|
|
75
|
+
export function PhiTextControl({ id, name, value, label, description, inputType = "text", presentation = "input", disabled = false, readOnly = false, allowClear = true, clearLabel, placeholder, ariaLabel, prefix, autoFocus, autoComplete, minLength, maxLength, rows, cols, autoSize, tabIndex, size, variant, inputRef, textareaRef, onChange, onPressEnter, onKeyDown, onFocus, onBlur, onClear, style, inputStyle, }) {
|
|
76
76
|
const { labelId, labelledBy } = usePhiControlLabel(label, ariaLabel);
|
|
77
77
|
const resolvedKind = resolveTextInputKind(inputType);
|
|
78
78
|
const { token } = theme.useToken();
|
|
@@ -83,6 +83,7 @@ export function PhiTextControl({ id, value, label, description, inputType = "tex
|
|
|
83
83
|
const commonProps = {
|
|
84
84
|
ref: inputRef,
|
|
85
85
|
id,
|
|
86
|
+
name,
|
|
86
87
|
"aria-label": ariaLabel,
|
|
87
88
|
"aria-labelledby": labelledBy,
|
|
88
89
|
autoFocus,
|
|
@@ -57,17 +57,25 @@ export function PhiSplitCardLayout({ blockId, slots, gap, swapRatio = false, edi
|
|
|
57
57
|
swapped: swapRatio,
|
|
58
58
|
inset: resolvePhiPaddingStyle({ padding, paddingTop, paddingRight, paddingBottom, paddingLeft }),
|
|
59
59
|
};
|
|
60
|
+
/*
|
|
61
|
+
* The box is the query container -- for the shared Background's `cqw` and for the stacking rule in
|
|
62
|
+
* `styles/layout.css` -- and the grid is the element inside it: a container cannot ask about its own
|
|
63
|
+
* width. Below the rule's width the two cards stand one above the other, the first on top.
|
|
64
|
+
*/
|
|
60
65
|
const resolvedStyle = {
|
|
61
66
|
position: "relative",
|
|
62
67
|
containerType: "inline-size",
|
|
68
|
+
containerName: "phi-split-card",
|
|
63
69
|
...resolvedLayoutStyle,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
gap: resolvedGap,
|
|
67
|
-
alignItems: "stretch",
|
|
70
|
+
// Not the grid `[data-layout-kind="split"]` makes every split box: the grid is the element inside.
|
|
71
|
+
display: "block",
|
|
68
72
|
minWidth: 0,
|
|
69
73
|
minHeight: 0,
|
|
70
74
|
...style,
|
|
71
75
|
};
|
|
72
|
-
|
|
76
|
+
const gridStyle = {
|
|
77
|
+
"--phi-split-card-columns": resolvePhiSplitCardColumns(swapRatio),
|
|
78
|
+
gap: resolvedGap,
|
|
79
|
+
};
|
|
80
|
+
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)] }) }));
|
|
73
81
|
}
|
|
@@ -84,7 +84,13 @@ export function PhiThreeColumnLayout({ blockId, slots, balancedSides = true, gap
|
|
|
84
84
|
const resolvedLeftWidth = normalizePhiCssSize(leftWidth);
|
|
85
85
|
const resolvedMiddleWidth = normalizePhiCssSize(middleWidth);
|
|
86
86
|
const resolvedRightWidth = normalizePhiCssSize(rightWidth);
|
|
87
|
-
|
|
87
|
+
/*
|
|
88
|
+
* Balanced sides are a wide screen's: on a phone (`styles/layout.css`) the variables below make every
|
|
89
|
+
* side as wide as its content and nothing when empty, and the middle takes the rest. A centred middle
|
|
90
|
+
* was worth two equal sides of a 390px row; a link of 83px in a side of 81 was not.
|
|
91
|
+
*/
|
|
92
|
+
const balancedSideFlex = "var(--phi-three-column-side-flex, 1 1 0)";
|
|
93
|
+
const leftFlex = resolvedLeftWidth ? `0 0 ${resolvedLeftWidth}` : balancedSides ? balancedSideFlex : "0 1 auto";
|
|
88
94
|
/*
|
|
89
95
|
* The middle is the main thing and takes the larger share: with balanced sides it grows twice as fast as
|
|
90
96
|
* each side, so the sides stay equal to each other and the middle stays centred; without, it takes what
|
|
@@ -92,8 +98,8 @@ export function PhiThreeColumnLayout({ blockId, slots, balancedSides = true, gap
|
|
|
92
98
|
*/
|
|
93
99
|
const middleFlex = resolvedMiddleWidth
|
|
94
100
|
? `0 0 ${resolvedMiddleWidth}`
|
|
95
|
-
:
|
|
96
|
-
const rightFlex = resolvedRightWidth ? `0 0 ${resolvedRightWidth}` : balancedSides ?
|
|
101
|
+
: `var(--phi-three-column-middle-flex, ${PHI_THREE_COLUMN_MIDDLE_GROW} 1 0)`;
|
|
102
|
+
const rightFlex = resolvedRightWidth ? `0 0 ${resolvedRightWidth}` : balancedSides ? balancedSideFlex : "0 1 auto";
|
|
97
103
|
const showInsertButton = resolvedRenderMode === "editor";
|
|
98
104
|
const { style: resolvedLayoutStyle, ground, hasExplicitLayoutBackground, } = resolvePhiBaseLayoutChrome({
|
|
99
105
|
labelEnd,
|
|
@@ -19,9 +19,13 @@ const PHI_SPLIT_CARD_SHARES = "2.61803398875";
|
|
|
19
19
|
export function resolvePhiSplitCardGroundFrame(side, gap, swapped = false) {
|
|
20
20
|
const leftShare = swapped ? ` * ${PHI_SPLIT_CARD_RATIO}` : "";
|
|
21
21
|
const leftWidth = `((100cqw - ${gap})${leftShare} / ${PHI_SPLIT_CARD_SHARES})`;
|
|
22
|
+
/*
|
|
23
|
+
* Stacked (`styles/layout.css`), each card shows the whole Background on its own: the cards no longer
|
|
24
|
+
* share a row, and the height the lower card's piece would start at is not something CSS knows.
|
|
25
|
+
*/
|
|
22
26
|
return {
|
|
23
|
-
left: side === "left" ? "0px" : `calc(-1 * (${leftWidth} + ${gap}))`,
|
|
24
|
-
width: "100cqw",
|
|
27
|
+
left: `var(--phi-split-card-ground-left, ${side === "left" ? "0px" : `calc(-1 * (${leftWidth} + ${gap}))`})`,
|
|
28
|
+
width: "var(--phi-split-card-ground-width, 100cqw)",
|
|
25
29
|
};
|
|
26
30
|
}
|
|
27
31
|
/** The two columns: the smaller card left and the larger right, or the other way round when swapped. */
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
export declare const PHI_MEDIA_ASPECT_RATIOS: readonly ["16:9", "3:2", "4:3", "1:1", "3:4", "2:3", "9:16", "21:9"];
|
|
8
8
|
export type PhiMediaAspectRatio = (typeof PHI_MEDIA_ASPECT_RATIOS)[number];
|
|
9
9
|
export declare const PHI_MEDIA_ASPECT_RATIO_OPTIONS: {
|
|
10
|
-
value: "
|
|
11
|
-
label: "
|
|
10
|
+
value: "3:2" | "4:3" | "16:9" | "1:1" | "3:4" | "2:3" | "9:16" | "21:9";
|
|
11
|
+
label: "3:2" | "4:3" | "16:9" | "1:1" | "3:4" | "2:3" | "9:16" | "21:9";
|
|
12
12
|
}[];
|
|
13
13
|
/** The ratio as CSS `aspect-ratio` writes it. */
|
|
14
14
|
export declare function resolvePhiMediaAspectRatioCss(ratio: PhiMediaAspectRatio): string;
|
|
@@ -145,5 +145,7 @@ export function PhiAccountMenu({ labels, state, contributedItems, areaEntries, o
|
|
|
145
145
|
// A signed-in person has a name; a guest has none, and falls through to the generic icon.
|
|
146
146
|
initialsFrom: state.kind === "authenticated" ? state.displayName ?? null : null, icon: icon, label: state.kind === "authenticated"
|
|
147
147
|
? (state.displayName ?? labels.trigger.account)
|
|
148
|
-
: labels.trigger.account, menuItems: menuItems, triggerRef: triggerRef, open: open, onOpenChange: onOpenChange, showLabel: resolvedShowLabel, showChevron: resolvedShowChevron, labelPill: resolvedShowLabel
|
|
148
|
+
: labels.trigger.account, menuItems: menuItems, triggerRef: triggerRef, open: open, onOpenChange: onOpenChange, showLabel: resolvedShowLabel, showChevron: resolvedShowChevron, labelPill: resolvedShowLabel,
|
|
149
|
+
// On a phone the label pill is read, not shown: the avatar alone opens the menu (`styles/shell.css`).
|
|
150
|
+
className: "phi-account-menu" }));
|
|
149
151
|
}
|
|
@@ -3,12 +3,17 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useMemo, useState } from "react";
|
|
4
4
|
import Link from "next/link";
|
|
5
5
|
import { isPhiExternalHref } from "../../helpers/external-href";
|
|
6
|
+
import { isPhiProtectedMail } from "../../helpers/protected-mail";
|
|
6
7
|
import { usePhiConfig } from "../root/phi-config-provider";
|
|
8
|
+
import { usePhiRevealedHref } from "./use-phi-protected-mail";
|
|
7
9
|
export function PhiLink({ href, children, external, newTab, prefetch, className, style, onClick, }) {
|
|
8
10
|
const { token } = usePhiConfig();
|
|
9
11
|
const [hovered, setHovered] = useState(false);
|
|
10
12
|
const [active, setActive] = useState(false);
|
|
11
|
-
|
|
13
|
+
// A protected address is never a route, whatever the caller says it is.
|
|
14
|
+
const useAnchor = isPhiProtectedMail(href) || (external ?? isPhiExternalHref(href));
|
|
15
|
+
// A protected address (`helpers/protected-mail.ts`) is written into the anchor once mounted.
|
|
16
|
+
const anchorHref = usePhiRevealedHref(href);
|
|
12
17
|
const linkStyle = useMemo(() => ({
|
|
13
18
|
textDecoration: "none",
|
|
14
19
|
cursor: "pointer",
|
|
@@ -31,7 +36,7 @@ export function PhiLink({ href, children, external, newTab, prefetch, className,
|
|
|
31
36
|
onBlur: () => setActive(false),
|
|
32
37
|
};
|
|
33
38
|
if (useAnchor) {
|
|
34
|
-
return (_jsx("a", { href:
|
|
39
|
+
return (_jsx("a", { href: anchorHref, target: newTab ? "_blank" : undefined, rel: newTab ? "noreferrer noopener" : undefined, className: className, style: linkStyle, onClick: onClick, ...interactionProps, children: children }));
|
|
35
40
|
}
|
|
36
41
|
return (_jsx(Link, { href: href, ...(prefetch === undefined ? {} : { prefetch }), className: className, style: linkStyle, onClick: onClick, ...interactionProps, children: children }));
|
|
37
42
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The href a link may show: a protected address only once the page is hydrated, everything else at once.
|
|
3
|
+
*
|
|
4
|
+
* Before -- on the server, in the HTML, during hydration -- a protected href is absent, so the anchor in
|
|
5
|
+
* the source carries no address (`helpers/protected-mail.ts`).
|
|
6
|
+
*/
|
|
7
|
+
export declare function usePhiRevealedHref(href: string): string | undefined;
|
|
8
|
+
/** An address in running text, written in once the page is hydrated; nothing before. */
|
|
9
|
+
export declare function PhiProtectedMailText({ token }: {
|
|
10
|
+
token: string;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useSyncExternalStore } from "react";
|
|
4
|
+
import { decodePhiProtectedMail, isPhiProtectedMail } from "../../helpers/protected-mail";
|
|
5
|
+
const subscribeNever = () => () => { };
|
|
6
|
+
/**
|
|
7
|
+
* Whether this render runs in a hydrated browser. False on the server and during hydration -- the HTML a
|
|
8
|
+
* crawler reads -- and true in the render that follows.
|
|
9
|
+
*/
|
|
10
|
+
function usePhiHydrated() {
|
|
11
|
+
return useSyncExternalStore(subscribeNever, () => true, () => false);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The href a link may show: a protected address only once the page is hydrated, everything else at once.
|
|
15
|
+
*
|
|
16
|
+
* Before -- on the server, in the HTML, during hydration -- a protected href is absent, so the anchor in
|
|
17
|
+
* the source carries no address (`helpers/protected-mail.ts`).
|
|
18
|
+
*/
|
|
19
|
+
export function usePhiRevealedHref(href) {
|
|
20
|
+
const hydrated = usePhiHydrated();
|
|
21
|
+
if (!isPhiProtectedMail(href))
|
|
22
|
+
return href;
|
|
23
|
+
return hydrated ? decodePhiProtectedMail(href) ?? undefined : undefined;
|
|
24
|
+
}
|
|
25
|
+
/** An address in running text, written in once the page is hydrated; nothing before. */
|
|
26
|
+
export function PhiProtectedMailText({ token }) {
|
|
27
|
+
const hydrated = usePhiHydrated();
|
|
28
|
+
return _jsx("span", { "data-phi-mail": "", children: hydrated ? decodePhiProtectedMail(token) ?? "" : "" });
|
|
29
|
+
}
|
|
@@ -199,7 +199,11 @@ export function PhiCmsRegionContainerClient({ children, className, regionKey, co
|
|
|
199
199
|
height: "100%",
|
|
200
200
|
minWidth: 0,
|
|
201
201
|
minHeight: 0,
|
|
202
|
-
}, children: [collapsible ? (_jsx(PhiFlexControl
|
|
202
|
+
}, children: [collapsible ? (_jsx(PhiFlexControl
|
|
203
|
+
// Hidden where the Sider is a phone's drawer (`styles/shell.css`): a drawer does not fold.
|
|
204
|
+
, {
|
|
205
|
+
// Hidden where the Sider is a phone's drawer (`styles/shell.css`): a drawer does not fold.
|
|
206
|
+
className: "phi-sider-collapse-bar", align: "center", justify: collapsed ? "center" : isRightSider ? "flex-end" : "flex-start", style: {
|
|
203
207
|
minHeight: collapsedWidth,
|
|
204
208
|
paddingTop: 0,
|
|
205
209
|
paddingInline: collapsed ? 0 : token.paddingXS,
|
|
@@ -44,6 +44,7 @@ export type PhiCmsRegionShellAttributes = PhiRenderableBlockEffectsAttributes &
|
|
|
44
44
|
"data-phi-viewport-flags": number | undefined;
|
|
45
45
|
"data-phi-block-enabled": "true" | "false";
|
|
46
46
|
"data-phi-region-reveal": Exclude<PhiCmsRegionReveal, "always"> | undefined;
|
|
47
|
+
"data-phi-sider-mobile": "drawer" | undefined;
|
|
47
48
|
className: string;
|
|
48
49
|
};
|
|
49
50
|
export type PhiCmsRegionShellInput = {
|
|
@@ -74,6 +74,15 @@ export function phiCmsRegionSiderSticks(regionKey, config) {
|
|
|
74
74
|
export function phiCmsRegionFooterSticks(regionKey, config) {
|
|
75
75
|
return regionKey === "footer_bottom" && hasPhiFlag(config?.flags, PhiCmsFlags.Sticky);
|
|
76
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Whether a Region is the Sider that opens as a drawer on a phone (SHELL.md "The Sider on a phone").
|
|
79
|
+
*
|
|
80
|
+
* `sider_left` alone: it is the Area's, where an Area's navigation stands, and the Shell's menu button sits
|
|
81
|
+
* at the inline start of the Header beside it. `sider_right` belongs to the Page and keeps its column.
|
|
82
|
+
*/
|
|
83
|
+
function phiCmsRegionSiderOpensAsDrawer(regionKey, config) {
|
|
84
|
+
return regionKey === "sider_left" && hasPhiFlag(config?.flags, PhiCmsFlags.MobileDrawer);
|
|
85
|
+
}
|
|
77
86
|
/** The line a stuck Sider stands at: under the Header as measured, plus its own offset. */
|
|
78
87
|
function resolvePhiCmsRegionSiderStuckTop(topCss) {
|
|
79
88
|
return `calc(var(${PHI_SHELL_STICKY_TOP_PROPERTY}, 0px) + ${topCss})`;
|
|
@@ -438,6 +447,8 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
|
|
|
438
447
|
"data-phi-viewport-flags": viewportFlags,
|
|
439
448
|
"data-phi-block-enabled": enabled ? "true" : "false",
|
|
440
449
|
"data-phi-region-reveal": reveal === "always" ? undefined : reveal,
|
|
450
|
+
// `styles/shell.css` takes this Sider out of its column on a phone; `PhiShellSiderDrawer` opens it.
|
|
451
|
+
"data-phi-sider-mobile": phiCmsRegionSiderOpensAsDrawer(regionKey, config) ? "drawer" : undefined,
|
|
441
452
|
...effectsAttributes,
|
|
442
453
|
className: ["phi-cms-region-shell", resolvePhiSurfaceToneClassName(surface?.tone), className]
|
|
443
454
|
.filter(Boolean)
|
|
@@ -43,6 +43,11 @@ export declare function buildPhiAreaShellSiderLeftNodes({ nodes, runtime, labelP
|
|
|
43
43
|
regionSiderLeft: number;
|
|
44
44
|
layoutSiderLeft: PhiCmsInstanceId;
|
|
45
45
|
widgetSiderLeftNav: PhiCmsInstanceId;
|
|
46
|
+
/**
|
|
47
|
+
* A search box above the navigation (SEARCH.md), for an Area whose Pages are indexed. Absent draws
|
|
48
|
+
* none: the operator's Areas have nothing a reader searches.
|
|
49
|
+
*/
|
|
50
|
+
widgetSiderLeftSearch?: PhiCmsInstanceId;
|
|
46
51
|
};
|
|
47
52
|
}): PhiAreaShellPresetNodes;
|
|
48
53
|
/** Several node groups as one tree body, in the order given. */
|
|
@@ -107,7 +107,8 @@ export function buildPhiAreaShellSiderLeftNodes({ nodes, runtime, labelPrefix, n
|
|
|
107
107
|
sortOrder: 25,
|
|
108
108
|
// Structure only: the frame's look is the Theme's (SHELL.md, Shell Chrome Overlay).
|
|
109
109
|
config: {
|
|
110
|
-
|
|
110
|
+
// On a phone the navigation opens from the Header's menu button (SHELL.md "The Sider on a phone").
|
|
111
|
+
flags: PhiCmsFlags.Sticky | PhiCmsFlags.FullHeight | PhiCmsFlags.Collapsible | PhiCmsFlags.MobileDrawer,
|
|
111
112
|
size: { width: `${resolvedShellLeftWidth}px` },
|
|
112
113
|
...(typeof shellSiderLeftOffsetTop === "number" ? { offsetTop: shellSiderLeftOffsetTop } : { offsetTop: 0 }),
|
|
113
114
|
},
|
|
@@ -134,12 +135,27 @@ export function buildPhiAreaShellSiderLeftNodes({ nodes, runtime, labelPrefix, n
|
|
|
134
135
|
}),
|
|
135
136
|
],
|
|
136
137
|
contentWidgets: [
|
|
138
|
+
...(ids.widgetSiderLeftSearch
|
|
139
|
+
? [
|
|
140
|
+
nodes.widget({
|
|
141
|
+
typeKey: "search-box",
|
|
142
|
+
id: ids.widgetSiderLeftSearch,
|
|
143
|
+
parentLayoutNodeId: ids.layoutSiderLeft,
|
|
144
|
+
slotIndex: PHI_CMS_DEFAULT_SLOT_INDEX,
|
|
145
|
+
sortOrder: 0,
|
|
146
|
+
label: `${labelPrefix} sider left search`,
|
|
147
|
+
// The Area's own results Page; the box reads which from where it stands.
|
|
148
|
+
config: { padding: PHI_SPACE.xs },
|
|
149
|
+
}),
|
|
150
|
+
]
|
|
151
|
+
: []),
|
|
137
152
|
nodes.widget({
|
|
138
153
|
typeKey: "sidebar-navigation",
|
|
139
154
|
id: ids.widgetSiderLeftNav,
|
|
140
155
|
parentLayoutNodeId: ids.layoutSiderLeft,
|
|
141
|
-
|
|
142
|
-
|
|
156
|
+
// The stack flows by slot, one child each: the navigation takes the slot after the search box.
|
|
157
|
+
slotIndex: ids.widgetSiderLeftSearch ? 1 : PHI_CMS_DEFAULT_SLOT_INDEX,
|
|
158
|
+
sortOrder: 1,
|
|
143
159
|
label: `${labelPrefix} sider left navigation`,
|
|
144
160
|
config: {
|
|
145
161
|
side: "left",
|
|
@@ -37,6 +37,22 @@ function PhiConfigValueProvider({ children, customColors, fonts, fontFamilies, h
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
}, [controlShapeVars]);
|
|
40
|
+
/*
|
|
41
|
+
* The typefaces, for the same reason. The font catalogue's classes are what define
|
|
42
|
+
* `--phi-font-source-*`, which the Theme's `--ant-font-family` points at; a Drawer or a Modal on
|
|
43
|
+
* `document.body` found the variable undefined and fell back to the browser's sans-serif.
|
|
44
|
+
*/
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const classes = rootClassName.split(/\s+/u).filter(Boolean);
|
|
47
|
+
if (classes.length === 0)
|
|
48
|
+
return;
|
|
49
|
+
const root = document.documentElement;
|
|
50
|
+
const added = classes.filter((name) => !root.classList.contains(name));
|
|
51
|
+
root.classList.add(...added);
|
|
52
|
+
return () => {
|
|
53
|
+
root.classList.remove(...added);
|
|
54
|
+
};
|
|
55
|
+
}, [rootClassName]);
|
|
40
56
|
const value = useMemo(() => ({
|
|
41
57
|
customColors,
|
|
42
58
|
fonts,
|
|
@@ -9,6 +9,8 @@ export type PhiCmsShellProps = {
|
|
|
9
9
|
siderLeft?: ReactNode;
|
|
10
10
|
siderRight?: ReactNode;
|
|
11
11
|
siderLeftFullHeight?: boolean;
|
|
12
|
+
/** `sider_left` opens as a drawer on a phone (SHELL.md "The Sider on a phone"). */
|
|
13
|
+
siderLeftMobileDrawer?: boolean;
|
|
12
14
|
footerTop?: ReactNode;
|
|
13
15
|
footerMain?: ReactNode;
|
|
14
16
|
footerBottom?: ReactNode;
|
|
@@ -32,4 +34,4 @@ export type PhiCmsShellProps = {
|
|
|
32
34
|
*/
|
|
33
35
|
headerBandRoom?: Record<`--phi-shell-band-${string}`, string>;
|
|
34
36
|
};
|
|
35
|
-
export declare function PhiCmsShell({ content, headerTop, headerMain, headerBottom, hero, siderLeft, siderRight, siderLeftFullHeight, footerTop, footerMain, footerBottom, drawer, headerPaneStickyTop, headerTopRoom, headerBandRoom, }: PhiCmsShellProps): import("react").JSX.Element;
|
|
37
|
+
export declare function PhiCmsShell({ content, headerTop, headerMain, headerBottom, hero, siderLeft, siderRight, siderLeftFullHeight, siderLeftMobileDrawer, footerTop, footerMain, footerBottom, drawer, headerPaneStickyTop, headerTopRoom, headerBandRoom, }: PhiCmsShellProps): import("react").JSX.Element;
|