@phis/ui 0.5.0 → 0.5.1

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.
Files changed (27) hide show
  1. package/components/controls/phi-button-control.d.ts +7 -1
  2. package/components/media/phi-asset-folder-control.js +1 -1
  3. package/components/regions/presets/content-entry-editor-page-tree.js +1 -1
  4. package/components/regions/presets/phi-settings-page-shell-tree.js +1 -1
  5. package/components/shell/phi-antd-icon.d.ts +4 -0
  6. package/components/shell/phi-antd-icon.js +8 -0
  7. package/components/shell/phi-icon.d.ts +18 -0
  8. package/components/shell/phi-icon.js +50 -3
  9. package/components/widgets/client/shared/phi-button-icons.d.ts +7 -0
  10. package/components/widgets/client/shared/phi-button-icons.js +15 -67
  11. package/components/widgets/label-types/common-controls.js +12 -12
  12. package/package.json +1 -1
  13. package/plugins/runtime-modules/accounting/presets.d.ts +10 -1
  14. package/plugins/runtime-modules/accounting/presets.js +25 -8
  15. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-area-preset-tree.d.ts +6 -0
  16. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-area-preset-tree.js +53 -0
  17. package/plugins/runtime-modules/area-definitions.d.ts +48 -6
  18. package/plugins/runtime-modules/area-definitions.js +8 -0
  19. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +1 -1
  20. package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +2 -2
  21. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +2 -2
  22. package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +1 -1
  23. package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +1 -1
  24. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +1 -1
  25. package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +2 -2
  26. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +1 -1
  27. package/styles/controls.css +11 -0
@@ -44,7 +44,13 @@ export type PhiButtonControlProps = {
44
44
  */
45
45
  external?: boolean;
46
46
  tooltip?: ReactNode;
47
- icon?: ReactNode;
47
+ /**
48
+ * The icon, as an element. A name is resolved before it gets here -- `resolvePhiButtonIcon` for a
49
+ * Widget's configured name, `PhiIcon` otherwise -- because a control draws and resolves nothing: resolving
50
+ * here put the icon resolver and the whole name list into every page with a Button, the error pages among
51
+ * them. A string is refused by the type, so a name can never be drawn as text.
52
+ */
53
+ icon?: Exclude<ReactNode, string>;
48
54
  type?: PhiButtonType;
49
55
  /** A round button is what an icon on its own wants, over a picture or in a toolbar. */
50
56
  shape?: ButtonProps["shape"];
@@ -5,7 +5,7 @@ import { PhiCascaderControl } from "../controls/phi-cascader-control";
5
5
  import { PhiToolbarControl } from "../controls/phi-toolbar-control";
6
6
  import { resolvePhiButtonIcon } from "../widgets/client/shared/phi-button-icons";
7
7
  export function PhiAssetFolderControl({ value, options, placeholder, createLabel, showCreate = false, createDisabled = false, lock = null, allowClear = true, size, style, onChange, onCreate, }) {
8
- const create = showCreate && onCreate ? (_jsx(PhiButtonControl, { ariaLabel: createLabel, tooltip: createLabel, icon: resolvePhiButtonIcon("add"), type: "primary", size: size, disabled: createDisabled, onClick: onCreate })) : null;
8
+ const create = showCreate && onCreate ? (_jsx(PhiButtonControl, { ariaLabel: createLabel, tooltip: createLabel, icon: resolvePhiButtonIcon("plus"), type: "primary", size: size, disabled: createDisabled, onClick: onCreate })) : null;
9
9
  /*
10
10
  * Drawn as the state it is in: a closed lock on a locked Folder, an open one on an unlocked one, and
11
11
  * the tooltip names what pressing it does.
@@ -187,7 +187,7 @@ function buildEntryDialogNodes(nodes, input) {
187
187
  * follows from that and is not stated -- a compact group does not wrap.
188
188
  */
189
189
  buttons: [
190
- { key: "cancel", emits: [{ capabilityId: "close", value: null }], label: input.cancelLabel, icon: "cancel" },
190
+ { key: "cancel", emits: [{ capabilityId: "close", value: null }], label: input.cancelLabel, icon: "close" },
191
191
  { key: "save", emits: [{ capabilityId: "submit", value: null }], label: input.saveLabel, variant: "primary", icon: "save" },
192
192
  ],
193
193
  signalRoutes: {
@@ -308,7 +308,7 @@ export function buildPhiSettingsPageShellTree({ page, ownerModuleId, presetKey,
308
308
  key: "cancel",
309
309
  emits: [{ capabilityId: "close", value: null }],
310
310
  ...(overlay.cancelLabel ? { label: overlay.cancelLabel } : { action: "cancel" }),
311
- icon: "cancel",
311
+ icon: "close",
312
312
  },
313
313
  {
314
314
  key: "submit",
@@ -9,6 +9,7 @@ declare const PHI_ANTD_ICON_LOADERS: {
9
9
  readonly AppstoreOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/AppstoreOutlined")>;
10
10
  readonly ArrowDownOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/ArrowDownOutlined")>;
11
11
  readonly ArrowUpOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/ArrowUpOutlined")>;
12
+ readonly AuditOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/AuditOutlined")>;
12
13
  readonly AudioTwoTone: () => Promise<typeof import("@ant-design/icons/es/icons/AudioTwoTone")>;
13
14
  readonly BgColorsOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/BgColorsOutlined")>;
14
15
  readonly BlockOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/BlockOutlined")>;
@@ -60,6 +61,7 @@ declare const PHI_ANTD_ICON_LOADERS: {
60
61
  readonly LayoutOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/LayoutOutlined")>;
61
62
  readonly LeftOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/LeftOutlined")>;
62
63
  readonly LinkOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/LinkOutlined")>;
64
+ readonly LoginOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/LoginOutlined")>;
63
65
  readonly LockOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/LockOutlined")>;
64
66
  readonly LogoutOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/LogoutOutlined")>;
65
67
  readonly MailOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/MailOutlined")>;
@@ -76,6 +78,8 @@ declare const PHI_ANTD_ICON_LOADERS: {
76
78
  readonly PauseCircleOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/PauseCircleOutlined")>;
77
79
  readonly PlayCircleFilled: () => Promise<typeof import("@ant-design/icons-svg/es/asn/PlayCircleFilled")>;
78
80
  readonly PlayCircleOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/PlayCircleOutlined")>;
81
+ readonly PlusCircleOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/PlusCircleOutlined")>;
82
+ readonly OrderedListOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/OrderedListOutlined")>;
79
83
  readonly PlusOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/PlusOutlined")>;
80
84
  readonly ProfileOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/ProfileOutlined")>;
81
85
  readonly QuestionCircleOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/QuestionCircleOutlined")>;
@@ -30,6 +30,7 @@ const PHI_ANTD_ICON_LOADERS = {
30
30
  AppstoreOutlined: () => import("@ant-design/icons-svg/es/asn/AppstoreOutlined"),
31
31
  ArrowDownOutlined: () => import("@ant-design/icons-svg/es/asn/ArrowDownOutlined"),
32
32
  ArrowUpOutlined: () => import("@ant-design/icons-svg/es/asn/ArrowUpOutlined"),
33
+ AuditOutlined: () => import("@ant-design/icons-svg/es/asn/AuditOutlined"),
33
34
  AudioTwoTone: () => import("@ant-design/icons/es/icons/AudioTwoTone"),
34
35
  BgColorsOutlined: () => import("@ant-design/icons-svg/es/asn/BgColorsOutlined"),
35
36
  BlockOutlined: () => import("@ant-design/icons-svg/es/asn/BlockOutlined"),
@@ -81,6 +82,7 @@ const PHI_ANTD_ICON_LOADERS = {
81
82
  LayoutOutlined: () => import("@ant-design/icons-svg/es/asn/LayoutOutlined"),
82
83
  LeftOutlined: () => import("@ant-design/icons-svg/es/asn/LeftOutlined"),
83
84
  LinkOutlined: () => import("@ant-design/icons-svg/es/asn/LinkOutlined"),
85
+ LoginOutlined: () => import("@ant-design/icons-svg/es/asn/LoginOutlined"),
84
86
  LockOutlined: () => import("@ant-design/icons-svg/es/asn/LockOutlined"),
85
87
  LogoutOutlined: () => import("@ant-design/icons-svg/es/asn/LogoutOutlined"),
86
88
  MailOutlined: () => import("@ant-design/icons-svg/es/asn/MailOutlined"),
@@ -97,6 +99,8 @@ const PHI_ANTD_ICON_LOADERS = {
97
99
  PauseCircleOutlined: () => import("@ant-design/icons-svg/es/asn/PauseCircleOutlined"),
98
100
  PlayCircleFilled: () => import("@ant-design/icons-svg/es/asn/PlayCircleFilled"),
99
101
  PlayCircleOutlined: () => import("@ant-design/icons-svg/es/asn/PlayCircleOutlined"),
102
+ PlusCircleOutlined: () => import("@ant-design/icons-svg/es/asn/PlusCircleOutlined"),
103
+ OrderedListOutlined: () => import("@ant-design/icons-svg/es/asn/OrderedListOutlined"),
100
104
  PlusOutlined: () => import("@ant-design/icons-svg/es/asn/PlusOutlined"),
101
105
  ProfileOutlined: () => import("@ant-design/icons-svg/es/asn/ProfileOutlined"),
102
106
  QuestionCircleOutlined: () => import("@ant-design/icons-svg/es/asn/QuestionCircleOutlined"),
@@ -275,6 +279,7 @@ export const PHI_ANTD_ICON_NAMES = {
275
279
  "arrow-down-outlined": "ArrowDownOutlined",
276
280
  "arrow-up": "ArrowUpOutlined",
277
281
  "arrow-up-outlined": "ArrowUpOutlined",
282
+ "audit": "AuditOutlined",
278
283
  "audio-two-tone": "AudioTwoTone",
279
284
  "bg-colors": "BgColorsOutlined",
280
285
  "bg-colors-outlined": "BgColorsOutlined",
@@ -326,6 +331,9 @@ export const PHI_ANTD_ICON_NAMES = {
326
331
  "share-alt-outlined": "ShareAltOutlined",
327
332
  sun: "SunOutlined",
328
333
  "sun-outlined": "SunOutlined",
334
+ "ordered-list-outlined": "OrderedListOutlined",
335
+ "login": "LoginOutlined",
336
+ "plus-circle-outlined": "PlusCircleOutlined",
329
337
  "unordered-list": "UnorderedListOutlined",
330
338
  "unordered-list-outlined": "UnorderedListOutlined",
331
339
  up: "UpOutlined",
@@ -8,5 +8,23 @@ type PhiIconProps = {
8
8
  name?: string;
9
9
  size?: number | string;
10
10
  } & PhiAntdIconPresentation;
11
+ /**
12
+ * Whether `PhiIcon` draws something for `name`: the one rule every icon name in this house follows.
13
+ *
14
+ * A name without a prefix is an Ant Design icon from `PHI_ANTD_ICON_NAMES` and means the same as
15
+ * `antd:<name>`. One name per icon, and the same name in a Button, a Table action, a Command Toolbar and a
16
+ * preset: there are no aliases (`add`, `cancel`, `trash`) beside it, and case counts. `module:`,
17
+ * `iconify:`, `asset:` and the Builder's motif namespaces are drawn by their own owners, which say for
18
+ * themselves whether the name exists, so here they count as known.
19
+ */
20
+ export declare function isPhiIconNameKnown(name: string): boolean;
21
+ /**
22
+ * Says once per name that it names no icon, where somebody reads it.
23
+ *
24
+ * An unknown name draws nothing -- no word, no placeholder -- so without this a typo is a blank nobody
25
+ * notices. Rendered on the server the warning lands in the Site service's journal, in the browser in its
26
+ * console. `validate-preset-icon-vocabulary` catches the same mistake in a preset before it ships.
27
+ */
28
+ export declare function reportPhiUnknownIconName(name: string): void;
11
29
  export declare function PhiIcon({ name, size, ...presentation }: PhiIconProps): import("react").JSX.Element | null;
12
30
  export {};
@@ -28,14 +28,57 @@ function renderIconFallback(size) {
28
28
  height: size,
29
29
  } }));
30
30
  }
31
+ function isPhiBuilderIconNamespace(namespace) {
32
+ return namespace.endsWith("/layouts") || namespace.endsWith("/widgets");
33
+ }
34
+ /**
35
+ * Whether `PhiIcon` draws something for `name`: the one rule every icon name in this house follows.
36
+ *
37
+ * A name without a prefix is an Ant Design icon from `PHI_ANTD_ICON_NAMES` and means the same as
38
+ * `antd:<name>`. One name per icon, and the same name in a Button, a Table action, a Command Toolbar and a
39
+ * preset: there are no aliases (`add`, `cancel`, `trash`) beside it, and case counts. `module:`,
40
+ * `iconify:`, `asset:` and the Builder's motif namespaces are drawn by their own owners, which say for
41
+ * themselves whether the name exists, so here they count as known.
42
+ */
43
+ export function isPhiIconNameKnown(name) {
44
+ const [namespace, ...rest] = name.split(":");
45
+ const value = rest.join(":");
46
+ if (!value)
47
+ return Object.hasOwn(PHI_ANTD_ICON_NAMES, name);
48
+ if (isPhiBuilderIconNamespace(namespace))
49
+ return true;
50
+ switch (namespace) {
51
+ case PHI_MODULE_ICON_NAMESPACE:
52
+ case "iconify":
53
+ case "asset":
54
+ return true;
55
+ case "antd":
56
+ return Object.hasOwn(PHI_ANTD_ICON_NAMES, value);
57
+ default:
58
+ return false;
59
+ }
60
+ }
61
+ const reportedUnknownIconNames = new Set();
62
+ /**
63
+ * Says once per name that it names no icon, where somebody reads it.
64
+ *
65
+ * An unknown name draws nothing -- no word, no placeholder -- so without this a typo is a blank nobody
66
+ * notices. Rendered on the server the warning lands in the Site service's journal, in the browser in its
67
+ * console. `validate-preset-icon-vocabulary` catches the same mistake in a preset before it ships.
68
+ */
69
+ export function reportPhiUnknownIconName(name) {
70
+ if (reportedUnknownIconNames.has(name))
71
+ return;
72
+ reportedUnknownIconNames.add(name);
73
+ console.warn(`[phi-icon] "${name}" names no icon and draws nothing. Use a name from PHI_ANTD_ICON_NAMES `
74
+ + "(components/shell/phi-antd-icon.tsx), with or without `antd:`, or a `module:`, `iconify:` or `asset:` name.");
75
+ }
31
76
  function renderAntdIcon(key, size, presentation) {
32
77
  const icon = PHI_ANTD_ICON_NAMES[key];
33
78
  return icon ? _jsx(PhiAntdIcon, { icon: icon, size: size, ...presentation }) : null;
34
79
  }
35
80
  function renderBuilderIcon(namespace, motif, size) {
36
- const isLayoutNamespace = namespace.endsWith("/layouts");
37
- const isWidgetNamespace = namespace.endsWith("/widgets");
38
- if (!isLayoutNamespace && !isWidgetNamespace) {
81
+ if (!isPhiBuilderIconNamespace(namespace)) {
39
82
  return null;
40
83
  }
41
84
  return (_jsx(Suspense, { fallback: renderIconFallback(size), children: _jsx(LazyPhiBuilderMotifIcon, { namespace: namespace, motif: motif, size: size }) }));
@@ -74,6 +117,10 @@ export function PhiIcon({ name, size = 16, ...presentation }) {
74
117
  if (!name) {
75
118
  return null;
76
119
  }
120
+ if (!isPhiIconNameKnown(name)) {
121
+ reportPhiUnknownIconName(name);
122
+ return null;
123
+ }
77
124
  const resolvedSize = size === "inherit" ? "1em" : size;
78
125
  const [namespace, ...rest] = name.split(":");
79
126
  const value = rest.join(":");
@@ -1,2 +1,9 @@
1
1
  import type { ReactNode } from "react";
2
+ /**
3
+ * The icon a Button, a Table action or a Command Toolbar names, or null where the name draws nothing.
4
+ *
5
+ * The same rule as `PhiIcon` (`isPhiIconNameKnown`): a short name is the Ant Design icon of that name,
6
+ * one name per icon. Null rather than an empty element, because a Table falls back to the action's label
7
+ * where its icon does not resolve and asks this to find out.
8
+ */
2
9
  export declare function resolvePhiButtonIcon(icon: string | null | undefined): ReactNode;
@@ -1,72 +1,20 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { PhiAntdIcon } from "../../../shell/phi-antd-icon";
4
- import { PhiIcon } from "../../../shell/phi-icon";
3
+ import { isPhiIconNameKnown, PhiIcon, reportPhiUnknownIconName } from "../../../shell/phi-icon";
4
+ /**
5
+ * The icon a Button, a Table action or a Command Toolbar names, or null where the name draws nothing.
6
+ *
7
+ * The same rule as `PhiIcon` (`isPhiIconNameKnown`): a short name is the Ant Design icon of that name,
8
+ * one name per icon. Null rather than an empty element, because a Table falls back to the action's label
9
+ * where its icon does not resolve and asks this to find out.
10
+ */
5
11
  export function resolvePhiButtonIcon(icon) {
6
- const normalizedIcon = icon?.trim();
7
- const alias = normalizedIcon?.toLowerCase().startsWith("antd:")
8
- ? normalizedIcon.slice("antd:".length).toLowerCase()
9
- : normalizedIcon?.toLowerCase();
10
- switch (alias) {
11
- case "apply":
12
- case "check":
13
- return _jsx(PhiAntdIcon, { icon: "CheckOutlined" });
14
- case "cancel":
15
- case "clear":
16
- case "close":
17
- return _jsx(PhiAntdIcon, { icon: "CloseOutlined" });
18
- case "upload":
19
- case "cloud-upload":
20
- case "publish":
21
- return _jsx(PhiAntdIcon, { icon: "CloudUploadOutlined" });
22
- case "delete":
23
- case "trash":
24
- return _jsx(PhiAntdIcon, { icon: "DeleteOutlined" });
25
- case "edit":
26
- case "meta":
27
- case "settings":
28
- return _jsx(PhiAntdIcon, { icon: "EditOutlined" });
29
- case "eye":
30
- case "preview":
31
- case "view":
32
- return _jsx(PhiAntdIcon, { icon: "EyeOutlined" });
33
- case "eye-invisible":
34
- case "eye-invisible-outlined":
35
- return _jsx(PhiAntdIcon, { icon: "EyeInvisibleOutlined" });
36
- case "folder-add":
37
- case "folder-add-outlined":
38
- return _jsx(PhiAntdIcon, { icon: "FolderAddOutlined" });
39
- case "history":
40
- return _jsx(PhiAntdIcon, { icon: "HistoryOutlined" });
41
- case "link":
42
- case "link-outlined":
43
- return _jsx(PhiAntdIcon, { icon: "LinkOutlined" });
44
- case "minus":
45
- case "minus-outlined":
46
- return _jsx(PhiAntdIcon, { icon: "MinusOutlined" });
47
- case "add":
48
- case "new":
49
- case "plus":
50
- return _jsx(PhiAntdIcon, { icon: "PlusOutlined" });
51
- case "redo":
52
- return _jsx(PhiAntdIcon, { icon: "RedoOutlined" });
53
- case "reload":
54
- case "refresh":
55
- case "reset":
56
- case "restore":
57
- return _jsx(PhiAntdIcon, { icon: "ReloadOutlined" });
58
- case "save":
59
- return _jsx(PhiAntdIcon, { icon: "SaveOutlined" });
60
- case "search":
61
- return _jsx(PhiAntdIcon, { icon: "SearchOutlined" });
62
- case "stop":
63
- case "retire":
64
- return _jsx(PhiAntdIcon, { icon: "StopOutlined" });
65
- case "undo":
66
- return _jsx(PhiAntdIcon, { icon: "UndoOutlined" });
67
- default:
68
- return normalizedIcon?.includes(":")
69
- ? _jsx(PhiIcon, { name: normalizedIcon, size: "1em" })
70
- : null;
12
+ const name = icon?.trim();
13
+ if (!name)
14
+ return null;
15
+ if (!isPhiIconNameKnown(name)) {
16
+ reportPhiUnknownIconName(name);
17
+ return null;
71
18
  }
19
+ return _jsx(PhiIcon, { name: name, size: "1em" });
72
20
  }
@@ -1,21 +1,21 @@
1
1
  export const PHI_COMMON_CONTROL_DEFAULT_LABELS = {
2
2
  actions: {
3
- add: { label: "Add", tooltip: "Add", icon: "add" },
4
- apply: { label: "Apply", tooltip: "Apply", icon: "apply", variant: "primary" },
5
- cancel: { label: "Cancel", tooltip: "Cancel", icon: "cancel" },
6
- clear: { label: "Clear", tooltip: "Clear", icon: "clear" },
3
+ add: { label: "Add", tooltip: "Add", icon: "plus" },
4
+ apply: { label: "Apply", tooltip: "Apply", icon: "check", variant: "primary" },
5
+ cancel: { label: "Cancel", tooltip: "Cancel", icon: "close" },
6
+ clear: { label: "Clear", tooltip: "Clear", icon: "close" },
7
7
  delete: { label: "Delete", tooltip: "Delete", icon: "delete", danger: true },
8
8
  deleteSelected: { label: "Delete selected", tooltip: "Delete selected", icon: "delete", danger: true },
9
9
  edit: { label: "Edit", tooltip: "Edit", icon: "edit" },
10
- livePreview: { label: "Live preview", tooltip: "Live preview", icon: "preview" },
11
- meta: { label: "Meta", tooltip: "Meta", icon: "meta" },
12
- new: { label: "New", tooltip: "New", icon: "new" },
13
- pageMeta: { label: "Meta", tooltip: "Page meta", icon: "meta" },
14
- publish: { label: "Publish", tooltip: "Publish", icon: "publish" },
10
+ livePreview: { label: "Live preview", tooltip: "Live preview", icon: "eye" },
11
+ meta: { label: "Meta", tooltip: "Meta", icon: "edit" },
12
+ new: { label: "New", tooltip: "New", icon: "plus" },
13
+ pageMeta: { label: "Meta", tooltip: "Page meta", icon: "edit" },
14
+ publish: { label: "Publish", tooltip: "Publish", icon: "cloud-upload" },
15
15
  reload: { label: "Reload", tooltip: "Reload", icon: "reload" },
16
- reset: { label: "Reset", tooltip: "Reset", icon: "reset", danger: true },
17
- restore: { label: "Restore", tooltip: "Restore", icon: "restore" },
18
- review: { label: "Review", tooltip: "Review", icon: "preview" },
16
+ reset: { label: "Reset", tooltip: "Reset", icon: "reload", danger: true },
17
+ restore: { label: "Restore", tooltip: "Restore", icon: "reload" },
18
+ review: { label: "Review", tooltip: "Review", icon: "eye" },
19
19
  save: { label: "Save", tooltip: "Save", icon: "save" },
20
20
  search: { label: "Search", tooltip: "Search", icon: "search" },
21
21
  undo: { label: "Undo", tooltip: "Undo", icon: "undo" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phis/ui",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -4,6 +4,15 @@ export declare const PHI_ACCOUNTING_RUNTIME_MODULE_AREA_SHELLS: {
4
4
  presetKey: string;
5
5
  shellPresetVersion: number;
6
6
  area: "accounting";
7
- loadTree: ({ page, runtime }: PhiCmsDescriptorBuildContext) => Promise<import("../../../types").PhiResolvedCmsPageTree>;
7
+ loadTree: ({ page, runtime }: PhiCmsDescriptorBuildContext) => Promise<{
8
+ pageMeta: import("../../../types").PhiCmsResolvedPageMeta | null | undefined;
9
+ runtimeModuleIds: `${string}/${string}`[] | null | undefined;
10
+ regions: import("../../../types").PhiCmsRegionNode[];
11
+ overlays: import("../../../types").PhiCmsOverlayNode[];
12
+ layoutNodes: import("../../../types").PhiCmsLayoutNode[];
13
+ contentWidgets: import("../../../types").PhiCmsContentWidgetNode[];
14
+ controllerSettings: import("../../../types/cms").PhiCmsTreeControllerSettings;
15
+ page: import("../../../types").PhiCmsPageNode;
16
+ }>;
8
17
  }[];
9
18
  export declare const PHI_ACCOUNTING_RUNTIME_MODULE_ROUTES: PhiCmsRoutePresetDescriptor[];
@@ -1,5 +1,7 @@
1
1
  import { PHI_BASE_PAGE_LAYOUT_VERSION } from "../../../components/regions/presets/phi-base-page-layout";
2
2
  import { buildPhiAreaRootRoutePresetDescriptor } from "../area-root-route";
3
+ import { PhiCmsRegionType } from "../../../constants/phi-cms";
4
+ import { PHI_DEFAULT_PUB_AREA_COMPOSITION_NODE_KEYS } from "../preset-contracts/pub-area";
3
5
  import { PHI_ACCOUNTING_RUNTIME_MODULE_ID } from "./ids";
4
6
  /* What the Accounting base Module brings: the Site shell for its Area, the Area root and the overview. */
5
7
  export const PHI_ACCOUNTING_RUNTIME_MODULE_AREA_SHELLS = [
@@ -8,14 +10,29 @@ export const PHI_ACCOUNTING_RUNTIME_MODULE_AREA_SHELLS = [
8
10
  presetKey: "accounting-area-preset",
9
11
  shellPresetVersion: 1,
10
12
  area: "accounting",
11
- loadTree: ({ page, runtime }) => import("../phi-default-site-area-preset-tree")
12
- .then((module) => module.buildPhiDefaultSiteAreaPresetTree({
13
- page,
14
- runtime,
15
- presetKey: "accounting-area-preset",
16
- ownerModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID,
17
- runtimeModuleArea: "accounting",
18
- })),
13
+ /*
14
+ * A staff Area's shell, composed as the Admin's is: the Site's shell without its header and footer,
15
+ * and the header bar and sidebar over it. It used to be the Site's shell alone, which left
16
+ * `accounting:sidebar` drawn nowhere.
17
+ */
18
+ loadTree: async ({ page, runtime }) => {
19
+ const [{ buildPhiDefaultSiteAreaPresetTree }, { buildPhiDefaultAccountingAreaPresetTree }, { mergePhiCmsShellTrees, omitPhiCmsShellCompositionNodes },] = await Promise.all([
20
+ import("../phi-default-site-area-preset-tree"),
21
+ import("./trees/phi-default-accounting-area-preset-tree"),
22
+ import("../shell-tree-composition"),
23
+ ]);
24
+ const [base, overlay] = await Promise.all([
25
+ buildPhiDefaultSiteAreaPresetTree({
26
+ page,
27
+ runtime,
28
+ presetKey: "accounting-area-preset",
29
+ ownerModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID,
30
+ runtimeModuleArea: "accounting",
31
+ }),
32
+ buildPhiDefaultAccountingAreaPresetTree({ page, runtime }),
33
+ ]);
34
+ return mergePhiCmsShellTrees(omitPhiCmsShellCompositionNodes(base, { ownerModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID, presetKey: "accounting-area-preset" }, [PhiCmsRegionType.HeaderTop, PhiCmsRegionType.HeaderMain, PhiCmsRegionType.Footer], PHI_DEFAULT_PUB_AREA_COMPOSITION_NODE_KEYS), overlay);
35
+ },
19
36
  },
20
37
  ];
21
38
  export const PHI_ACCOUNTING_RUNTIME_MODULE_ROUTES = [
@@ -0,0 +1,6 @@
1
+ import type { PhiResolvedCmsPageTree, PhiCmsPageNode } from "../../../../types/cms";
2
+ import type { PhiBlockRuntime } from "../../../../types";
3
+ export declare function buildPhiDefaultAccountingAreaPresetTree({ page, runtime, }: {
4
+ page: PhiCmsPageNode;
5
+ runtime: PhiBlockRuntime;
6
+ }): Promise<PhiResolvedCmsPageTree>;
@@ -0,0 +1,53 @@
1
+ import { createPhiPresetCmsInstanceIdMap } from "../../../../types/cms-instance-id";
2
+ import { PHI_ACCOUNTING_RUNTIME_MODULE_ID } from "../ids";
3
+ import { createPhiCmsPresetNodes } from "../../../../helpers/cms-preset-nodes";
4
+ import { buildPhiAreaShellHeaderNodes, buildPhiAreaShellSiderLeftNodes, concatPhiAreaShellPresetNodes, } from "../../../../components/regions/presets/phi-area-shell-preset-nodes";
5
+ import { createPhiDefaultAreaRuntimeModuleIds } from "../../area-module-defaults";
6
+ /*
7
+ * The staff shell, as Admin's: the header bar with the Page title as a caption, the Tour button and the
8
+ * Account, and the sidebar on `accounting:sidebar`, composed over the Site's shell in `../presets.ts`.
9
+ * Ids of its own, so an Accounting shell never shares a node with another Area's.
10
+ */
11
+ const SYNTHETIC_ACCOUNTING_REGION_IDS = {
12
+ regionHeaderTop: -170,
13
+ regionSiderLeft: -180,
14
+ };
15
+ const SYNTHETIC_ACCOUNTING_LAYOUT_IDS = createPhiPresetCmsInstanceIdMap({
16
+ domain: "area",
17
+ ownerModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID,
18
+ presetKey: "accounting-area-preset",
19
+ }, [
20
+ "layoutHeaderTop",
21
+ "layoutHeaderTopActions",
22
+ "layoutSiderLeft",
23
+ ]);
24
+ const SYNTHETIC_ACCOUNTING_WIDGET_IDS = createPhiPresetCmsInstanceIdMap({
25
+ domain: "area",
26
+ ownerModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID,
27
+ presetKey: "accounting-area-preset",
28
+ }, [
29
+ "widgetSiderLeftNav",
30
+ "widgetHeaderTopAccount",
31
+ "widgetHeaderTopPageTitle",
32
+ "widgetHeaderTopTourButton",
33
+ ]);
34
+ export async function buildPhiDefaultAccountingAreaPresetTree({ page, runtime, }) {
35
+ const nodes = createPhiCmsPresetNodes(page);
36
+ return {
37
+ page: nodes.page(),
38
+ runtimeModuleIds: createPhiDefaultAreaRuntimeModuleIds("accounting"),
39
+ overlays: [],
40
+ ...concatPhiAreaShellPresetNodes(buildPhiAreaShellHeaderNodes({
41
+ nodes,
42
+ runtime,
43
+ labelPrefix: "accounting",
44
+ ids: { ...SYNTHETIC_ACCOUNTING_REGION_IDS, ...SYNTHETIC_ACCOUNTING_LAYOUT_IDS, ...SYNTHETIC_ACCOUNTING_WIDGET_IDS },
45
+ }), buildPhiAreaShellSiderLeftNodes({
46
+ nodes,
47
+ runtime,
48
+ labelPrefix: "accounting",
49
+ navKey: "accounting:sidebar",
50
+ ids: { ...SYNTHETIC_ACCOUNTING_REGION_IDS, ...SYNTHETIC_ACCOUNTING_LAYOUT_IDS, ...SYNTHETIC_ACCOUNTING_WIDGET_IDS },
51
+ })),
52
+ };
53
+ }
@@ -107,14 +107,28 @@ export declare const PHI_ACCOUNTING_RUNTIME_AREA_DEFINITIONS: {
107
107
  label: {
108
108
  defaultMessage: string;
109
109
  };
110
- items: {
110
+ items: ({
111
111
  itemKey: string;
112
112
  label: {
113
113
  defaultMessage: string;
114
114
  };
115
115
  icon: string;
116
116
  routePresetKey: string;
117
- }[];
117
+ standing?: undefined;
118
+ target?: undefined;
119
+ } | {
120
+ itemKey: string;
121
+ label: {
122
+ defaultMessage: string;
123
+ };
124
+ icon: string;
125
+ standing: "last";
126
+ target: {
127
+ kind: "area";
128
+ area: "admin";
129
+ };
130
+ routePresetKey?: undefined;
131
+ })[];
118
132
  exportedItemKeys: string[];
119
133
  anchors: Partial<Record<PhiCmsNavigationAnchor, PhiCmsNavigationAnchorPlacement>>;
120
134
  })[];
@@ -295,14 +309,28 @@ export declare const PHI_ALL_RUNTIME_AREA_DEFINITIONS: ({
295
309
  label: {
296
310
  defaultMessage: string;
297
311
  };
298
- items: {
312
+ items: ({
299
313
  itemKey: string;
300
314
  label: {
301
315
  defaultMessage: string;
302
316
  };
303
317
  icon: string;
304
318
  routePresetKey: string;
305
- }[];
319
+ standing?: undefined;
320
+ target?: undefined;
321
+ } | {
322
+ itemKey: string;
323
+ label: {
324
+ defaultMessage: string;
325
+ };
326
+ icon: string;
327
+ standing: "last";
328
+ target: {
329
+ kind: "area";
330
+ area: "admin";
331
+ };
332
+ routePresetKey?: undefined;
333
+ })[];
306
334
  exportedItemKeys: string[];
307
335
  anchors: Partial<Record<PhiCmsNavigationAnchor, PhiCmsNavigationAnchorPlacement>>;
308
336
  })[];
@@ -540,14 +568,28 @@ export declare function resolvePhiRuntimeAreaDefinition(area: PhiCmsAreaDefiniti
540
568
  label: {
541
569
  defaultMessage: string;
542
570
  };
543
- items: {
571
+ items: ({
544
572
  itemKey: string;
545
573
  label: {
546
574
  defaultMessage: string;
547
575
  };
548
576
  icon: string;
549
577
  routePresetKey: string;
550
- }[];
578
+ standing?: undefined;
579
+ target?: undefined;
580
+ } | {
581
+ itemKey: string;
582
+ label: {
583
+ defaultMessage: string;
584
+ };
585
+ icon: string;
586
+ standing: "last";
587
+ target: {
588
+ kind: "area";
589
+ area: "admin";
590
+ };
591
+ routePresetKey?: undefined;
592
+ })[];
551
593
  exportedItemKeys: string[];
552
594
  anchors: Partial<Record<PhiCmsNavigationAnchor, PhiCmsNavigationAnchorPlacement>>;
553
595
  })[];
@@ -238,6 +238,14 @@ export const PHI_ACCOUNTING_RUNTIME_AREA_DEFINITIONS = [
238
238
  label: label("Overview"),
239
239
  icon: "antd:audit",
240
240
  routePresetKey: "accounting-overview-page",
241
+ },
242
+ // The way into the Admin, as the Builder has one; shown to whoever the Admin lets in.
243
+ {
244
+ itemKey: "@phis/ui/modules/accounting/nav/admin",
245
+ label: label("Admin"),
246
+ icon: "antd:cluster",
247
+ standing: "last",
248
+ target: { kind: "area", area: "admin" },
241
249
  }],
242
250
  exportedItemKeys: ["@phis/ui/modules/accounting/nav/home"],
243
251
  anchors: sidebarAnchors(),
@@ -428,7 +428,7 @@ export async function buildPhiDefaultBuilderMediaPageTree({ page, runtime, }) {
428
428
  key: "createFolder",
429
429
  label: mediaLabels?.tool.createFolderLabel ?? "Create folder",
430
430
  description: mediaLabels?.tool.createFolderLabel ?? "Create folder",
431
- icon: "add",
431
+ icon: "plus",
432
432
  display: "icon",
433
433
  mode: "primary",
434
434
  }],
@@ -475,7 +475,7 @@ export async function buildPhiBuilderInspectorAreaOverlayTree({ page, runtime, }
475
475
  * follows from that and is not stated -- a compact group does not wrap.
476
476
  */
477
477
  buttons: [
478
- { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: effectsLabels.cancel, variant: "normal", icon: "cancel" },
478
+ { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: effectsLabels.cancel, variant: "normal", icon: "close" },
479
479
  { key: "save", emits: [{ capabilityId: "command", value: "save" }], label: effectsLabels.save, variant: "primary", icon: "save" },
480
480
  ],
481
481
  signalRoutes: {
@@ -604,7 +604,7 @@ export async function buildPhiBuilderInspectorAreaOverlayTree({ page, runtime, }
604
604
  * follows from that and is not stated -- a compact group does not wrap.
605
605
  */
606
606
  buttons: [
607
- { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: signalsLabels.routes.cancel, variant: "normal", icon: "cancel" },
607
+ { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: signalsLabels.routes.cancel, variant: "normal", icon: "close" },
608
608
  /*
609
609
  * The primary action reads "Apply", not "Save": it commits one route into the draft, and the
610
610
  * Page is saved separately. It sets `icon: "save"` itself so the button keeps that mark, and the
@@ -1714,7 +1714,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
1714
1714
  key: "module-usage-commands",
1715
1715
  ...PHI_DIALOG_COMMANDS_CONFIG,
1716
1716
  buttons: [
1717
- { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: modulesLabels?.usage.cancel ?? "Keep it on", icon: "cancel" },
1717
+ { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: modulesLabels?.usage.cancel ?? "Keep it on", icon: "close" },
1718
1718
  { key: "confirm", emits: [{ capabilityId: "command", value: "confirm" }], variant: "primary", label: modulesLabels?.usage.confirm ?? "Switch off anyway", icon: "save" },
1719
1719
  ],
1720
1720
  signalRoutes: {
@@ -1810,7 +1810,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
1810
1810
  key: "public-routes-commands",
1811
1811
  ...PHI_DIALOG_COMMANDS_CONFIG,
1812
1812
  buttons: [
1813
- { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: modulesLabels?.publicRoutes.cancel ?? "Cancel", icon: "cancel" },
1813
+ { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: modulesLabels?.publicRoutes.cancel ?? "Cancel", icon: "close" },
1814
1814
  { key: "assign", emits: [{ capabilityId: "command", value: "assign" }], variant: "primary", label: modulesLabels?.publicRoutes.assign ?? "Enable", icon: "save" },
1815
1815
  ],
1816
1816
  signalRoutes: {
@@ -84,7 +84,7 @@ export async function buildPhiDefaultAdminGroupsPageTree({ page, runtime, }) {
84
84
  config: {
85
85
  key: `admin-groups-${workflow}-commands`,
86
86
  buttons: [
87
- { key: "cancel", emits: [{ capabilityId: "close", value: null }], label: labels.actions.cancel, icon: "cancel" },
87
+ { key: "cancel", emits: [{ capabilityId: "close", value: null }], label: labels.actions.cancel, icon: "close" },
88
88
  { key: "save", emits: [{ capabilityId: "submit", value: null }], label: text.submit, variant: "primary", icon: "save" },
89
89
  ],
90
90
  signalRoutes: {
@@ -303,7 +303,7 @@ export async function buildPhiDefaultEditorTranslationsPageTree({ page, runtime,
303
303
  key: "editor-translation-commands",
304
304
  ...PHI_DIALOG_COMMANDS_CONFIG,
305
305
  buttons: [
306
- { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: widgetLabels.actions.cancel, icon: "cancel" },
306
+ { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: widgetLabels.actions.cancel, icon: "close" },
307
307
  { key: "save", emits: [{ capabilityId: "command", value: "save" }], label: widgetLabels.actions.save, variant: "primary", icon: "save" },
308
308
  ],
309
309
  signalRoutes: {
@@ -356,7 +356,7 @@ export async function buildPhiDefaultBuilderRevisionsPageTree({ page, runtime, }
356
356
  key: "cancel",
357
357
  emits: [{ capabilityId: "close", value: null }],
358
358
  label: revisionsLabels.deleteArea.cancel,
359
- icon: "cancel",
359
+ icon: "close",
360
360
  },
361
361
  {
362
362
  key: "confirm",
@@ -104,7 +104,7 @@ export async function buildPhiDefaultThreadsPageTree({ page, runtime, area, }) {
104
104
  config: {
105
105
  key: "app-threads-reply-commands",
106
106
  buttons: [
107
- { key: "cancel", emits: [{ capabilityId: "close", value: null }], action: "cancel", icon: "cancel" },
107
+ { key: "cancel", emits: [{ capabilityId: "close", value: null }], action: "cancel", icon: "close" },
108
108
  {
109
109
  key: "submit",
110
110
  emits: [{ capabilityId: "submit", value: null }],
@@ -643,7 +643,7 @@ export async function buildPhiDefaultThreadsPageTree({ page, runtime, area, }) {
643
643
  key: "app-threads-new-commands",
644
644
  ...PHI_DIALOG_COMMANDS_CONFIG,
645
645
  buttons: [
646
- { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: labels.cancelLabel, icon: "cancel" },
646
+ { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: labels.cancelLabel, icon: "close" },
647
647
  { key: "save", emits: [{ capabilityId: "command", value: "save" }], label: labels.openConversationLabel, variant: "primary", icon: "save" },
648
648
  ],
649
649
  signalRoutes: {
@@ -545,7 +545,7 @@ export async function buildPhiDefaultAdminUsersPageTree({ page, runtime, }) {
545
545
  key: `admin-users-${mode}-commands`,
546
546
  ...PHI_DIALOG_COMMANDS_CONFIG,
547
547
  buttons: [
548
- { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: widgetLabels.confirm.cancel, icon: "cancel" },
548
+ { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: widgetLabels.confirm.cancel, icon: "close" },
549
549
  { key: "save", emits: [{ capabilityId: "command", value: "save" }], label: saveLabel, variant: "primary", icon: "save" },
550
550
  ],
551
551
  signalRoutes: {
@@ -369,6 +369,8 @@ h5.phi-typography, .phi-typography h5 {
369
369
  --phi-card-control-radius: var(--phi-surface-radius);
370
370
  --phi-card-control-line: var(--ant-line-width) var(--ant-line-type) var(--ant-color-border-secondary);
371
371
  position: relative;
372
+ display: flex;
373
+ flex-direction: column;
372
374
  box-sizing: border-box;
373
375
  min-width: 0;
374
376
  border: var(--phi-card-control-line);
@@ -428,7 +430,16 @@ h5.phi-typography, .phi-typography h5 {
428
430
  border-radius: var(--phi-card-control-radius) var(--phi-card-control-radius) 0 0;
429
431
  }
430
432
 
433
+ /*
434
+ * The body takes whatever height the box is given beyond its head and cover. A Card stretched to its row
435
+ * in a grid of Cards is taller than its own content, and the body is where that height belongs: a caller
436
+ * whose content is a column of its own (`height: 100%`) can then push its last part -- a price and a
437
+ * button -- to the bottom edge, so a row of Cards lines up there. A box that is only as tall as its
438
+ * content gains nothing and loses nothing. The basis is 0 rather than `auto` so the height is definite
439
+ * where the box's is, which is what lets that `100%` resolve at all.
440
+ */
431
441
  .phi-card-control__body {
442
+ flex: 1 0 0;
432
443
  border-radius: 0 0 var(--phi-card-control-radius) var(--phi-card-control-radius);
433
444
  }
434
445