@phis/ui 0.6.4 → 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.
Files changed (164) hide show
  1. package/components/cms/phi-cms-layout-renderer.js +11 -2
  2. package/components/controls/phi-multi-select-control.js +4 -2
  3. package/components/controls/phi-options-provider.d.ts +1 -0
  4. package/components/controls/phi-options-provider.js +1 -0
  5. package/components/controls/phi-select-control.d.ts +21 -0
  6. package/components/controls/phi-select-control.js +2 -2
  7. package/components/controls/phi-status-dot-control.d.ts +15 -0
  8. package/components/controls/phi-status-dot-control.js +25 -0
  9. package/components/controls/phi-table-control.js +8 -1
  10. package/components/controls/phi-tree-control.js +5 -4
  11. package/components/controls/phi-tree-select-control.js +1 -0
  12. package/components/layouts/clients/phi-split-card-half.d.ts +4 -1
  13. package/components/layouts/clients/phi-split-card-half.js +2 -2
  14. package/components/layouts/clients/phi-split-card-layout-client.d.ts +6 -3
  15. package/components/layouts/clients/phi-split-card-layout-client.js +5 -3
  16. package/components/layouts/clients/phi-three-column-layout-client.d.ts +20 -1
  17. package/components/layouts/clients/phi-three-column-layout-client.js +31 -15
  18. package/components/layouts/layout-definitions.d.ts +96 -0
  19. package/components/layouts/layout-definitions.js +40 -2
  20. package/components/layouts/plugins/split-card-layout-plugin.js +1 -1
  21. package/components/layouts/plugins/three-column-layout-plugin.js +1 -1
  22. package/components/layouts/split-card-geometry.d.ts +9 -4
  23. package/components/layouts/split-card-geometry.js +29 -13
  24. package/components/media/media-folder-options.d.ts +10 -0
  25. package/components/media/media-folder-options.js +14 -0
  26. package/components/shell/phi-antd-icon.d.ts +1 -0
  27. package/components/shell/phi-antd-icon.js +3 -0
  28. package/components/widgets/inspector-field-row.js +4 -1
  29. package/components/widgets/label-sets/admin-users.d.ts +3 -0
  30. package/components/widgets/label-sets/admin-users.js +8 -2
  31. package/components/widgets/label-sets/gallery.js +2 -2
  32. package/components/widgets/label-sets/inspector.js +4 -0
  33. package/components/widgets/label-sets/observability-logs.js +2 -2
  34. package/components/widgets/label-sets/profile.js +2 -1
  35. package/components/widgets/label-types/gallery.d.ts +2 -3
  36. package/components/widgets/label-types/gallery.js +1 -4
  37. package/components/widgets/label-types/inspector.d.ts +4 -0
  38. package/components/widgets/label-types/inspector.js +2 -0
  39. package/components/widgets/shared/markdown-image-vocabulary.js +1 -1
  40. package/constants/cms-layout-proportions.d.ts +6 -0
  41. package/constants/cms-layout-proportions.js +17 -0
  42. package/constants/runtime-module-ownership.js +1 -0
  43. package/helpers/page-reference-tree.js +8 -0
  44. package/helpers/table-action-links.d.ts +11 -0
  45. package/helpers/table-action-links.js +14 -0
  46. package/helpers/table-action-row-link.d.ts +8 -0
  47. package/helpers/table-action-row-link.js +14 -0
  48. package/package.json +2 -2
  49. package/plugins/factories/widget-renderers.d.ts +7 -1
  50. package/plugins/factories/widget-renderers.js +12 -2
  51. package/plugins/runtime-modules/asset/authoring-widgets.js +2 -2
  52. package/plugins/runtime-modules/asset/data-providers.js +1 -1
  53. package/plugins/runtime-modules/asset/services/options.js +7 -11
  54. package/plugins/runtime-modules/asset/widgets/area-upload/plugin.js +0 -2
  55. package/plugins/runtime-modules/asset/widgets/asset-focal-rect/plugin.js +0 -2
  56. package/plugins/runtime-modules/asset/widgets/image-inspector/plugin.js +0 -2
  57. package/plugins/runtime-modules/asset/widgets/media-picker/plugin.js +0 -2
  58. package/plugins/runtime-modules/asset/widgets.js +4 -4
  59. package/plugins/runtime-modules/auth/authoring-widgets.js +4 -8
  60. package/plugins/runtime-modules/auth/widgets/auth-workflow/plugin.js +0 -6
  61. package/plugins/runtime-modules/auth/widgets/logout/plugin.js +0 -2
  62. package/plugins/runtime-modules/auth/widgets/security/plugin.js +0 -2
  63. package/plugins/runtime-modules/auth/widgets.js +5 -3
  64. package/plugins/runtime-modules/avatar/authoring-widgets.js +2 -2
  65. package/plugins/runtime-modules/avatar/widgets/account-avatar/plugin.js +0 -2
  66. package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/plugin.js +0 -2
  67. package/plugins/runtime-modules/avatar/widgets.js +2 -2
  68. package/plugins/runtime-modules/builder/authoring-widgets.js +1 -1
  69. package/plugins/runtime-modules/builder/clients/inspector-choice-cascader.d.ts +28 -0
  70. package/plugins/runtime-modules/builder/clients/inspector-choice-cascader.js +98 -0
  71. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +27 -3
  72. package/plugins/runtime-modules/builder/clients/inspector-record-field-options.d.ts +17 -0
  73. package/plugins/runtime-modules/builder/clients/inspector-record-field-options.js +21 -0
  74. package/plugins/runtime-modules/builder/clients/inspector-translate-switch.d.ts +24 -0
  75. package/plugins/runtime-modules/builder/clients/inspector-translate-switch.js +29 -0
  76. package/plugins/runtime-modules/builder/clients/layout-inspector.d.ts +1 -1
  77. package/plugins/runtime-modules/builder/clients/layout-inspector.js +4 -2
  78. package/plugins/runtime-modules/builder/clients/widget-inspector.d.ts +1 -1
  79. package/plugins/runtime-modules/builder/clients/widget-inspector.js +6 -6
  80. package/plugins/runtime-modules/builder/plugin-meta-labels.js +17 -0
  81. package/plugins/runtime-modules/builder/render-root-node-scaffold.js +12 -2
  82. package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +0 -2
  83. package/plugins/runtime-modules/builder/widgets.js +3 -3
  84. package/plugins/runtime-modules/contracts.js +8 -4
  85. package/plugins/runtime-modules/core/authoring-widgets.js +2 -2
  86. package/plugins/runtime-modules/core/data-providers.d.ts +7 -3
  87. package/plugins/runtime-modules/core/data-providers.js +11 -1
  88. package/plugins/runtime-modules/core/definition.d.ts +7 -3
  89. package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +1 -1
  90. package/plugins/runtime-modules/core/widgets/draft-status/client.d.ts +2 -1
  91. package/plugins/runtime-modules/core/widgets/draft-status/client.js +4 -3
  92. package/plugins/runtime-modules/core/widgets/gallery/authoring.js +6 -8
  93. package/plugins/runtime-modules/core/widgets/gallery/client.js +4 -0
  94. package/plugins/runtime-modules/core/widgets/gallery/config.js +1 -1
  95. package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +5 -1
  96. package/plugins/runtime-modules/core/widgets/gallery/server.js +8 -4
  97. package/plugins/runtime-modules/core/widgets/image/config.js +1 -1
  98. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +11 -0
  99. package/plugins/runtime-modules/core/widgets/markdown/config.js +24 -22
  100. package/plugins/runtime-modules/core/widgets/simple-text/client.d.ts +9 -5
  101. package/plugins/runtime-modules/core/widgets/simple-text/client.js +5 -7
  102. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +63 -4
  103. package/plugins/runtime-modules/core/widgets/simple-text/config.js +45 -11
  104. package/plugins/runtime-modules/core/widgets/simple-text/editor.js +2 -2
  105. package/plugins/runtime-modules/core/widgets/simple-text/plugin.d.ts +13 -0
  106. package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +23 -4
  107. package/plugins/runtime-modules/core/widgets/simple-text/server.d.ts +4 -2
  108. package/plugins/runtime-modules/core/widgets/simple-text/server.js +7 -6
  109. package/plugins/runtime-modules/core/widgets/table/client.js +4 -4
  110. package/plugins/runtime-modules/core/widgets/table/config.js +11 -3
  111. package/plugins/runtime-modules/core/widgets/table/plugin.js +21 -1
  112. package/plugins/runtime-modules/core/widgets/thread-conversation/plugin.js +0 -2
  113. package/plugins/runtime-modules/core/widgets/tree/config.js +2 -1
  114. package/plugins/runtime-modules/core/widgets/tree/plugin.js +16 -1
  115. package/plugins/runtime-modules/core/widgets.js +1 -1
  116. package/plugins/runtime-modules/observability/data-providers.js +1 -1
  117. package/plugins/runtime-modules/theme/authoring-widgets.js +5 -5
  118. package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +0 -5
  119. package/plugins/runtime-modules/theme/widgets.js +4 -4
  120. package/plugins/runtime-modules/user-management/addon-roles.d.ts +28 -7
  121. package/plugins/runtime-modules/user-management/addon-roles.js +42 -17
  122. package/plugins/runtime-modules/user-management/client-data-providers.js +6 -0
  123. package/plugins/runtime-modules/user-management/data-providers.js +11 -2
  124. package/plugins/runtime-modules/user-management/forms.js +40 -1
  125. package/plugins/runtime-modules/user-management/ids.d.ts +1 -0
  126. package/plugins/runtime-modules/user-management/ids.js +1 -0
  127. package/plugins/runtime-modules/user-management/services/options.d.ts +14 -3
  128. package/plugins/runtime-modules/user-management/services/options.js +52 -16
  129. package/plugins/runtime-modules/user-management/services/table.js +8 -24
  130. package/plugins/runtime-modules/user-management/services/users-query.d.ts +9 -0
  131. package/plugins/runtime-modules/user-management/services/users-query.js +29 -0
  132. package/plugins/runtime-modules/video/widgets/embed/plugin.js +0 -2
  133. package/plugins/runtime-modules/video/widgets.js +1 -1
  134. package/styles/layout.css +4 -4
  135. package/types/cms-config.d.ts +12 -4
  136. package/types/cms-config.js +3 -0
  137. package/types/cms-plugins.d.ts +26 -4
  138. package/types/core-widget-placements.d.ts +4 -4
  139. package/types/table-widget.d.ts +17 -1
  140. package/types/tree.d.ts +2 -0
  141. package/plugins/runtime-modules/asset/widgets/asset-focal-rect/authoring.d.ts +0 -2
  142. package/plugins/runtime-modules/asset/widgets/asset-focal-rect/authoring.js +0 -6
  143. package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.d.ts +0 -2
  144. package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.js +0 -6
  145. package/plugins/runtime-modules/auth/widgets/auth-methods/authoring.d.ts +0 -7
  146. package/plugins/runtime-modules/auth/widgets/auth-methods/authoring.js +0 -12
  147. package/plugins/runtime-modules/auth/widgets/auth-workflow/authoring.d.ts +0 -7
  148. package/plugins/runtime-modules/auth/widgets/auth-workflow/authoring.js +0 -12
  149. package/plugins/runtime-modules/auth/widgets/logout/authoring.d.ts +0 -3
  150. package/plugins/runtime-modules/auth/widgets/logout/authoring.js +0 -8
  151. package/plugins/runtime-modules/auth/widgets/security/authoring.d.ts +0 -3
  152. package/plugins/runtime-modules/auth/widgets/security/authoring.js +0 -8
  153. package/plugins/runtime-modules/avatar/widgets/account-avatar/authoring.d.ts +0 -2
  154. package/plugins/runtime-modules/avatar/widgets/account-avatar/authoring.js +0 -6
  155. package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/authoring.d.ts +0 -2
  156. package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/authoring.js +0 -6
  157. package/plugins/runtime-modules/builder/widgets/structure-region/internal-builder.d.ts +0 -22
  158. package/plugins/runtime-modules/builder/widgets/structure-region/internal-builder.js +0 -8
  159. package/plugins/runtime-modules/core/widgets/form-preview/authoring.d.ts +0 -10
  160. package/plugins/runtime-modules/core/widgets/form-preview/authoring.js +0 -15
  161. package/plugins/runtime-modules/core/widgets/thread-conversation/authoring.d.ts +0 -3
  162. package/plugins/runtime-modules/core/widgets/thread-conversation/authoring.js +0 -9
  163. package/plugins/runtime-modules/theme/widgets/brand-controls/authoring.d.ts +0 -76
  164. package/plugins/runtime-modules/theme/widgets/brand-controls/authoring.js +0 -30
@@ -108,7 +108,7 @@ export const PHI_MARKDOWN_WIDGET_DEFINITION = {
108
108
  },
109
109
  },
110
110
  fields: [
111
- { key: "eyebrow", type: "string", label: "Eyebrow" },
111
+ { key: "eyebrow", type: "string", heading: "Text", label: "Eyebrow" },
112
112
  {
113
113
  key: "sourceMode",
114
114
  type: "choice",
@@ -122,7 +122,7 @@ export const PHI_MARKDOWN_WIDGET_DEFINITION = {
122
122
  {
123
123
  key: "recordField",
124
124
  type: "record-field",
125
- label: "Record field",
125
+ label: "Record",
126
126
  description: "Shows a field of the record this page is about instead of the text. The text stands in where the page has no record.",
127
127
  kinds: ["markdown", "text"],
128
128
  },
@@ -164,10 +164,28 @@ export const PHI_MARKDOWN_WIDGET_DEFINITION = {
164
164
  label: "FAQ for search engines",
165
165
  visibleWhen: { field: "foldSections", notEquals: "none" },
166
166
  },
167
+ {
168
+ key: "headingOffset",
169
+ type: "number",
170
+ label: "Heading Offset",
171
+ description: "Moves every heading of the text down by this many levels: at 1, a # heading is drawn as H2, ## as H3, and so on. For a text that stands under a page title of its own, so its first heading does not compete with it.",
172
+ min: 0,
173
+ max: PHI_MARKDOWN_HEADING_OFFSET_MAX,
174
+ precision: 0,
175
+ },
176
+ {
177
+ key: "tocKey",
178
+ type: "string",
179
+ label: "TOC Key",
180
+ // Empty is no key, and a TOC on "Auto" connects to the text all the same.
181
+ placeholder: "Auto",
182
+ description: "A name for this text's table of contents. A Markdown TOC widget set to Binding Mode \"Target\" with the same TOC Key lists this text's headings and no other's. Leave it empty while the page has one Markdown text: a TOC on \"Auto\" finds it by itself.",
183
+ },
167
184
  {
168
185
  key: "imageFloat",
169
186
  type: "choice",
170
- label: "Image Float",
187
+ heading: "Image",
188
+ label: "Float",
171
189
  // No float is the default and stores nothing; the line says so instead of an empty picker.
172
190
  emptyOption: { value: "none", label: "None" },
173
191
  options: PHI_MARKDOWN_IMAGE_FLOAT_OPTIONS,
@@ -180,7 +198,7 @@ export const PHI_MARKDOWN_WIDGET_DEFINITION = {
180
198
  {
181
199
  key: "imageFloatWidth",
182
200
  type: "choice",
183
- label: "Image Width",
201
+ label: "Width",
184
202
  emptyOption: { value: "large", label: "Large (golden)" },
185
203
  options: [
186
204
  { value: "small", label: "Small" },
@@ -195,7 +213,7 @@ export const PHI_MARKDOWN_WIDGET_DEFINITION = {
195
213
  {
196
214
  key: "imageAspectRatio",
197
215
  type: "choice",
198
- label: "Image Proportion",
216
+ label: "Proportion",
199
217
  options: [
200
218
  { value: "auto", label: "Automatic" },
201
219
  { value: "phi", label: "φ (golden)" },
@@ -209,6 +227,7 @@ export const PHI_MARKDOWN_WIDGET_DEFINITION = {
209
227
  {
210
228
  key: "textBlockSpacingBefore",
211
229
  type: "choice",
230
+ heading: "Spacing",
212
231
  label: "Before Paragraph",
213
232
  options: PHI_MARKDOWN_SPACING_OPTIONS,
214
233
  },
@@ -230,23 +249,6 @@ export const PHI_MARKDOWN_WIDGET_DEFINITION = {
230
249
  label: "After Header",
231
250
  options: PHI_MARKDOWN_SPACING_OPTIONS,
232
251
  },
233
- {
234
- key: "headingOffset",
235
- type: "number",
236
- label: "Heading Offset",
237
- description: "Moves every heading of the text down by this many levels: at 1, a # heading is drawn as H2, ## as H3, and so on. For a text that stands under a page title of its own, so its first heading does not compete with it.",
238
- min: 0,
239
- max: PHI_MARKDOWN_HEADING_OFFSET_MAX,
240
- precision: 0,
241
- },
242
- {
243
- key: "tocKey",
244
- type: "string",
245
- label: "TOC Key",
246
- // Empty is no key, and a TOC on "Auto" connects to the text all the same.
247
- placeholder: "Auto",
248
- description: "A name for this text's table of contents. A Markdown TOC widget set to Binding Mode \"Target\" with the same TOC Key lists this text's headings and no other's. Leave it empty while the page has one Markdown text: a TOC on \"Auto\" finds it by itself.",
249
- },
250
252
  // The markers are an unordered list's: a `1.` list counts, whatever its level's marker says.
251
253
  ...buildPhiBulletListFields("list", "Unordered Lists"),
252
254
  ],
@@ -6,22 +6,26 @@ import type { PhiWidgetFontFamilyKey, PhiWidgetFontSizeKey } from "../../../../.
6
6
  export type PhiSimpleTextWidgetClientLabels = {
7
7
  text: string;
8
8
  };
9
+ /** Where a linked text leads, resolved on the server: a Page reference means nothing in a browser. */
10
+ export type PhiSimpleTextWidgetLink = {
11
+ href: string;
12
+ newTab: boolean;
13
+ external: boolean;
14
+ };
9
15
  export type PhiSimpleTextWidgetClientConfig = {
10
16
  renderMode?: PhiRenderableBlockRenderMode;
11
- href?: string;
12
17
  icon?: string;
13
18
  color?: string;
14
19
  fontFamily?: PhiWidgetFontFamilyKey;
15
20
  fontSize?: PhiWidgetFontSizeKey;
16
- external?: boolean;
17
- newTab?: boolean;
18
21
  tone?: PhiTextTone;
19
22
  marks?: PhiSimpleTextMark[];
20
23
  textTransform?: PhiTextTransform;
21
24
  letterSpacing?: PhiLetterSpacingStep;
22
- disabled?: boolean;
23
25
  };
24
26
  export type PhiSimpleTextWidgetClientProps = PhiClientBlockBaseProps<PhiSimpleTextWidgetClientLabels, PhiSimpleTextWidgetClientConfig> & {
25
27
  blockId: PhiCmsInstanceId;
28
+ /** Absent, or `null` for a target that resolved to nothing: the text draws as text. */
29
+ link?: PhiSimpleTextWidgetLink | null;
26
30
  };
27
- export declare function PhiSimpleTextWidgetClient({ blockId, labels, config, }: PhiSimpleTextWidgetClientProps): import("react").JSX.Element;
31
+ export declare function PhiSimpleTextWidgetClient({ blockId, labels, config, link, }: PhiSimpleTextWidgetClientProps): import("react").JSX.Element;
@@ -13,7 +13,7 @@ import { hasPhiSimpleTextMark } from "./marks";
13
13
  import { PhiFlexControl } from "../../../../../components/controls/phi-flex-control";
14
14
  import { PhiTypographyControl } from "../../../../../components/controls/phi-typography-control";
15
15
  const PHI_LINE_HEIGHT_LG = 1.6;
16
- export function PhiSimpleTextWidgetClient({ blockId, labels, config, }) {
16
+ export function PhiSimpleTextWidgetClient({ blockId, labels, config, link = null, }) {
17
17
  const { fonts, token } = usePhiConfig();
18
18
  const [textOverride, setTextOverride] = useState(null);
19
19
  const [iconOverride, setIconOverride] = useState({
@@ -33,7 +33,6 @@ export function PhiSimpleTextWidgetClient({ blockId, labels, config, }) {
33
33
  value: undefined,
34
34
  });
35
35
  const [styleOverride, setStyleOverride] = useState({});
36
- const hasHref = typeof config?.href === "string" && config.href.trim().length > 0;
37
36
  const isLiveMode = config?.renderMode == null || config.renderMode === "live";
38
37
  const textValue = textOverride ?? labels.text;
39
38
  const iconValue = iconOverride.active ? iconOverride.value : config?.icon;
@@ -45,7 +44,6 @@ export function PhiSimpleTextWidgetClient({ blockId, labels, config, }) {
45
44
  italic: styleOverride.italic ?? hasPhiSimpleTextMark(config, "italic"),
46
45
  underline: styleOverride.underline ?? hasPhiSimpleTextMark(config, "underline"),
47
46
  delete: styleOverride.delete ?? hasPhiSimpleTextMark(config, "strike"),
48
- disabled: config?.disabled,
49
47
  code: styleOverride.code ?? hasPhiSimpleTextMark(config, "code"),
50
48
  };
51
49
  const resolvedFontFamily = styleValue.code
@@ -110,7 +108,7 @@ export function PhiSimpleTextWidgetClient({ blockId, labels, config, }) {
110
108
  * A linked text's colour is the link's (`PhiLink`), which answers the pointer; the words inside inherit
111
109
  * it. Stated on them as well, the colour stood over the link's and the hover never showed.
112
110
  */
113
- const contentColor = hasHref ? undefined : textColor;
111
+ const contentColor = link ? undefined : textColor;
114
112
  const contentNode = (_jsxs(PhiFlexControl, { align: "center", gap: 8, style: {
115
113
  width: "fit-content",
116
114
  maxWidth: "100%",
@@ -119,7 +117,7 @@ export function PhiSimpleTextWidgetClient({ blockId, labels, config, }) {
119
117
  lineHeight: resolvedFontSize ? PHI_LINE_HEIGHT_LG : "inherit",
120
118
  color: contentColor ?? undefined,
121
119
  fontFamily: resolvedFontFamily,
122
- }, children: [iconValue ? _jsx(PhiIcon, { name: iconValue, size: "1.25em" }) : null, _jsx(PhiTypographyControl, { type: config?.tone, strong: styleValue.strong, italic: styleValue.italic, underline: styleValue.underline, delete: styleValue.delete, disabled: styleValue.disabled, code: styleValue.code, style: {
120
+ }, children: [iconValue ? _jsx(PhiIcon, { name: iconValue, size: "1.25em" }) : null, _jsx(PhiTypographyControl, { type: config?.tone, strong: styleValue.strong, italic: styleValue.italic, underline: styleValue.underline, delete: styleValue.delete, code: styleValue.code, style: {
123
121
  color: contentColor ?? "inherit",
124
122
  fontSize: resolvedFontSize ?? "inherit",
125
123
  lineHeight: resolvedFontSize ? PHI_LINE_HEIGHT_LG : "inherit",
@@ -127,10 +125,10 @@ export function PhiSimpleTextWidgetClient({ blockId, labels, config, }) {
127
125
  ...(config?.textTransform === "uppercase" ? { textTransform: "uppercase" } : {}),
128
126
  ...(config?.letterSpacing ? { letterSpacing: PHI_LETTER_SPACING_STEPS[config.letterSpacing] } : {}),
129
127
  }, children: textValue })] }));
130
- if (!hasHref) {
128
+ if (!link) {
131
129
  return contentNode;
132
130
  }
133
- return (_jsx(PhiLink, { href: config.href, external: config.external, newTab: config.newTab, onClick: isLiveMode
131
+ return (_jsx(PhiLink, { href: link.href, external: link.external, newTab: link.newTab, onClick: isLiveMode
134
132
  ? undefined
135
133
  : (event) => {
136
134
  event.preventDefault();
@@ -1,5 +1,6 @@
1
1
  import { type PhiTextSource } from "../../../../../helpers/text-source";
2
2
  import { type PhiSimpleTextMark } from "../../../../../types/core-widget-placements";
3
+ import { type PhiLinkTarget } from "../../../../../types/references";
3
4
  import type { PhiCmsResolvedContent } from "../../../../../types";
4
5
  import type { PhiWidgetFontFamilyKey, PhiWidgetFontSizeKey } from "../../../../../types/site-theme";
5
6
  import { type PhiCmsWidgetConfigBase } from "../../../../../components/widgets/config/parser-primitives";
@@ -7,20 +8,24 @@ import { type PhiLetterSpacingStep, type PhiTextTransform } from "../../../../..
7
8
  import { type PhiTextTone } from "../../../../../components/widgets/config/text-tone";
8
9
  export type PhiCmsSimpleTextWidgetConfig = PhiCmsWidgetConfigBase & {
9
10
  text?: string;
10
- href?: string;
11
+ /**
12
+ * Where the text leads, as every Control that leads somewhere keeps it: a Page by identity, an address
13
+ * elsewhere as a URL with its own new-tab choice (`REFERENCES.md`). A text box for a path was what this
14
+ * Widget had before, and the paths typed into it went stale the moment their Page moved.
15
+ */
16
+ linkTarget?: PhiLinkTarget;
17
+ /** A link field of the page record that is where the text leads instead of `linkTarget`. */
18
+ linkRecordField?: string;
11
19
  icon?: string;
12
20
  color?: string;
13
21
  fontFamily?: PhiWidgetFontFamilyKey;
14
22
  fontSize?: PhiWidgetFontSizeKey;
15
- external?: boolean;
16
- newTab?: boolean;
17
23
  tone?: PhiTextTone;
18
24
  marks?: PhiSimpleTextMark[];
19
25
  /** Capitals for a label (`text-case-vocabulary.ts`); absent, as written. */
20
26
  textTransform?: PhiTextTransform;
21
27
  /** A spacing step for a label in capitals; absent, normal. */
22
28
  letterSpacing?: PhiLetterSpacingStep;
23
- disabled?: boolean;
24
29
  /** `"preset"` while the words are a Preset's and translated globally (`helpers/text-source.ts`). */
25
30
  textSource?: PhiTextSource;
26
31
  /** A text, number or date field of the page record to show instead of the Widget's own text. */
@@ -371,6 +376,44 @@ export declare const PHI_SIMPLE_TEXT_WIDGET_DEFINITION: {
371
376
  key: string;
372
377
  type: "choice";
373
378
  label: string;
379
+ visibleWhen: {
380
+ field: string;
381
+ equals: null;
382
+ notEquals?: undefined;
383
+ };
384
+ emptyOption: {
385
+ value: string;
386
+ label: string;
387
+ };
388
+ emptyValue: undefined;
389
+ options: ({
390
+ readonly value: "secondary";
391
+ readonly label: "Secondary";
392
+ } | {
393
+ readonly value: "success";
394
+ readonly label: "Success";
395
+ } | {
396
+ readonly value: "warning";
397
+ readonly label: "Warning";
398
+ } | {
399
+ readonly value: "danger";
400
+ readonly label: "Danger";
401
+ })[];
402
+ patchOnChange?: undefined;
403
+ } | {
404
+ key: string;
405
+ type: "choice";
406
+ label: string;
407
+ visibleWhen: {
408
+ field: string;
409
+ notEquals: null;
410
+ equals?: undefined;
411
+ };
412
+ emptyOption: {
413
+ value: string;
414
+ label: string;
415
+ };
416
+ emptyValue: undefined;
374
417
  options: ({
375
418
  readonly value: "secondary";
376
419
  readonly label: "Secondary";
@@ -384,6 +427,9 @@ export declare const PHI_SIMPLE_TEXT_WIDGET_DEFINITION: {
384
427
  readonly value: "danger";
385
428
  readonly label: "Danger";
386
429
  })[];
430
+ patchOnChange: {
431
+ color: undefined;
432
+ };
387
433
  } | {
388
434
  key: string;
389
435
  type: "choice";
@@ -395,6 +441,10 @@ export declare const PHI_SIMPLE_TEXT_WIDGET_DEFINITION: {
395
441
  readonly value: "uppercase";
396
442
  readonly label: "Capitals";
397
443
  })[];
444
+ visibleWhen?: undefined;
445
+ emptyOption?: undefined;
446
+ emptyValue?: undefined;
447
+ patchOnChange?: undefined;
398
448
  } | {
399
449
  key: string;
400
450
  type: "choice";
@@ -409,6 +459,10 @@ export declare const PHI_SIMPLE_TEXT_WIDGET_DEFINITION: {
409
459
  readonly value: "wider";
410
460
  readonly label: "Wider";
411
461
  })[];
462
+ visibleWhen?: undefined;
463
+ emptyOption?: undefined;
464
+ emptyValue?: undefined;
465
+ patchOnChange?: undefined;
412
466
  })[];
413
467
  defaultConfig: {
414
468
  maxSize: {
@@ -422,4 +476,9 @@ export declare function resolvePhiSimpleTextWidgetText(config: PhiSimpleTextWidg
422
476
  preferConfigText?: boolean;
423
477
  }, fallbackText?: string): string;
424
478
  export declare const PHI_SIMPLE_TEXT_WIDGET_PLUGIN_TYPE: string;
479
+ /**
480
+ * The patch the toolbar's colour writes: a colour of the author's own replaces the tone, because the two
481
+ * exclude each other and the colour is what would draw. Taking the colour away leaves the default tone.
482
+ */
483
+ export declare function applyPhiSimpleTextColor(color: string | null | undefined): Pick<PhiCmsSimpleTextWidgetConfig, "color" | "tone">;
425
484
  export {};
@@ -4,7 +4,8 @@ import { readPhiTextSource } from "../../../../../helpers/text-source";
4
4
  import { PHI_SIMPLE_TEXT_MARKS } from "../../../../../types/core-widget-placements";
5
5
  import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
6
6
  import { PHI_RENDERABLE_BLOCK_GEOMETRY_FIELDS } from "../../../../../helpers/renderable-block-plugin-fields";
7
- import { readBoolean, readRenderableBlockConfig, readString, } from "../../../../../components/widgets/config/parser-primitives";
7
+ import { readPhiLinkTarget } from "../../../../../types/references";
8
+ import { readRenderableBlockConfig, readString, } from "../../../../../components/widgets/config/parser-primitives";
8
9
  import { PHI_WIDGET_FONT_FAMILY_OPTIONS, readPhiWidgetFontFamily, } from "../../../../../components/widgets/helpers/font-family";
9
10
  import { PHI_WIDGET_FONT_SIZE_OPTIONS, readPhiWidgetFontSize, } from "../../../../../components/widgets/helpers/font-size";
10
11
  import { PHI_LETTER_SPACING_FIELD_OPTIONS, PHI_TEXT_TRANSFORM_FIELD_OPTIONS, readPhiLetterSpacingStep, readPhiTextTransform, } from "../../../../../components/widgets/config/text-case-vocabulary";
@@ -20,18 +21,16 @@ function parsePhiCmsSimpleTextWidgetConfig(config) {
20
21
  return {
21
22
  ...renderableBlockConfig,
22
23
  text: readString(config.text),
23
- href: readString(config.href),
24
+ linkTarget: readPhiLinkTarget(config.linkTarget) ?? undefined,
25
+ linkRecordField: readString(config.linkRecordField),
24
26
  icon: readString(config.icon),
25
27
  color: readString(config.color),
26
28
  fontFamily: readPhiWidgetFontFamily(config.fontFamily),
27
29
  fontSize: readPhiWidgetFontSize(config.fontSize),
28
- external: readBoolean(config.external),
29
- newTab: readBoolean(config.newTab),
30
30
  tone: readPhiTextTone(config.tone),
31
31
  marks: readSimpleTextMarks(config.marks),
32
32
  textTransform: readPhiTextTransform(config.textTransform),
33
33
  letterSpacing: readPhiLetterSpacingStep(config.letterSpacing),
34
- disabled: readBoolean(config.disabled),
35
34
  textSource: readPhiTextSource(config.textSource),
36
35
  recordField: readString(config.recordField),
37
36
  };
@@ -53,15 +52,18 @@ export const PHI_SIMPLE_TEXT_WIDGET_DEFINITION = {
53
52
  },
54
53
  fields: [
55
54
  ...PHI_RENDERABLE_BLOCK_GEOMETRY_FIELDS,
56
- { key: "text", type: "string", label: "Text", required: true },
55
+ /*
56
+ * No `text` field: the words are written on the canvas, as a Card's and a Markdown's are. The Widget
57
+ * translates them itself (`translatesOwnText`), so nothing reads the field list to find them.
58
+ */
57
59
  {
58
60
  key: "recordField",
59
61
  type: "record-field",
60
- label: "Record field",
62
+ heading: "Text",
63
+ label: "Record",
61
64
  description: "Shows a field of the record this page is about instead of the text. The text stands in where the page has no record.",
62
65
  kinds: PHI_RECORD_TEXT_FIELD_KINDS,
63
66
  },
64
- { key: "href", type: "url", label: "Href" },
65
67
  { key: "icon", type: "icon", label: "Icon", editorPlacement: "toolbar" },
66
68
  { key: "color", type: "color", label: "Color", mode: "single", editorPlacement: "toolbar" },
67
69
  {
@@ -78,11 +80,31 @@ export const PHI_SIMPLE_TEXT_WIDGET_DEFINITION = {
78
80
  editorPlacement: "toolbar",
79
81
  options: [...PHI_WIDGET_FONT_SIZE_OPTIONS],
80
82
  },
83
+ /*
84
+ * A tone and a colour of the author's own exclude each other: the colour is what draws while both
85
+ * are set, so choosing a tone takes the colour away, and the toolbar's colour takes the tone away
86
+ * (`editor.tsx`). The field is declared twice, each shown in one of the two states, because that is
87
+ * what the choice vocabulary can say without a property of its own: while a colour is set the select
88
+ * reads "Custom" -- its empty line, never stored -- and picking a tone from there clears the colour.
89
+ */
90
+ {
91
+ key: "tone",
92
+ type: "choice",
93
+ label: "Tone",
94
+ visibleWhen: { field: "color", equals: null },
95
+ emptyOption: { value: "default", label: "Default" },
96
+ emptyValue: undefined,
97
+ options: [...PHI_TEXT_TONE_FIELD_OPTIONS],
98
+ },
81
99
  {
82
100
  key: "tone",
83
101
  type: "choice",
84
102
  label: "Tone",
103
+ visibleWhen: { field: "color", notEquals: null },
104
+ emptyOption: { value: "custom", label: "Custom" },
105
+ emptyValue: undefined,
85
106
  options: [...PHI_TEXT_TONE_FIELD_OPTIONS],
107
+ patchOnChange: { color: undefined },
86
108
  },
87
109
  {
88
110
  key: "textTransform",
@@ -96,10 +118,15 @@ export const PHI_SIMPLE_TEXT_WIDGET_DEFINITION = {
96
118
  label: "Letter Spacing",
97
119
  options: [...PHI_LETTER_SPACING_FIELD_OPTIONS],
98
120
  },
99
- { key: "external", type: "boolean", label: "External" },
100
- { key: "newTab", type: "boolean", label: "Open In New Tab" },
101
121
  { key: "marks", type: "string", label: "Marks", editorPlacement: "toolbar" },
102
- { key: "disabled", type: "boolean", label: "Disabled" },
122
+ { key: "linkTarget", type: "link-target", heading: "Link target", label: "Link target" },
123
+ {
124
+ key: "linkRecordField",
125
+ type: "record-field",
126
+ label: "Link from record",
127
+ description: "Leads where a field of the record this page is about leads, instead of the target above.",
128
+ kinds: ["link"],
129
+ },
103
130
  ],
104
131
  defaultConfig: {
105
132
  /*
@@ -125,3 +152,10 @@ export function resolvePhiSimpleTextWidgetText(config, options, fallbackText = "
125
152
  return config?.text ?? config?.label ?? fallbackText;
126
153
  }
127
154
  export const PHI_SIMPLE_TEXT_WIDGET_PLUGIN_TYPE = PhiCmsWidgetType.SimpleText;
155
+ /**
156
+ * The patch the toolbar's colour writes: a colour of the author's own replaces the tone, because the two
157
+ * exclude each other and the colour is what would draw. Taking the colour away leaves the default tone.
158
+ */
159
+ export function applyPhiSimpleTextColor(color) {
160
+ return color ? { color, tone: undefined } : { color: undefined };
161
+ }
@@ -11,7 +11,7 @@ import { PhiWidgetColorToolButton, PhiWidgetIconToolButton, PhiWidgetTypographyT
11
11
  import { usePhiWidgetScaffoldPopup } from "../../../../../components/widgets/client/shared/phi-widget-scaffold-popup";
12
12
  import { usePhiAuthoringToolsLabels } from "../../../../../components/widgets/client/shared/phi-authoring-tools-labels";
13
13
  import { PHI_SIMPLE_TEXT_MARKS } from "../../../../../types/core-widget-placements";
14
- import { resolvePhiSimpleTextWidgetText, } from "./config";
14
+ import { applyPhiSimpleTextColor, resolvePhiSimpleTextWidgetText, } from "./config";
15
15
  import { hasPhiSimpleTextMark } from "./marks";
16
16
  import { resolvePhiWidgetFontFamily } from "../../../../../components/widgets/helpers/font-family";
17
17
  import { resolvePhiWidgetFontSize } from "../../../../../components/widgets/helpers/font-size";
@@ -138,5 +138,5 @@ export function PhiSimpleTextWidgetEditorPluginBody({ label, config, onChange, }
138
138
  }
139
139
  export function PhiSimpleTextWidgetEditorPluginTools({ config, onChange, }) {
140
140
  const labels = usePhiAuthoringToolsLabels();
141
- return (_jsxs(_Fragment, { children: [_jsx(PhiWidgetIconToolButton, { value: config.icon ?? null, ariaLabel: labels.text.icon, onChange: (icon) => onChange({ icon: icon ?? undefined }) }), _jsx(PhiSimpleTextWidgetColorButton, { config: config, onChange: (color) => onChange({ color: color ?? undefined }) }), _jsx(PhiSimpleTextWidgetTypographyButton, { config: config, onChange: onChange }), _jsx(PhiSimpleTextWidgetStyleButton, { config: config, onChange: onChange })] }));
141
+ return (_jsxs(_Fragment, { children: [_jsx(PhiWidgetIconToolButton, { value: config.icon ?? null, ariaLabel: labels.text.icon, onChange: (icon) => onChange({ icon: icon ?? undefined }) }), _jsx(PhiSimpleTextWidgetColorButton, { config: config, onChange: (color) => onChange(applyPhiSimpleTextColor(color)) }), _jsx(PhiSimpleTextWidgetTypographyButton, { config: config, onChange: onChange }), _jsx(PhiSimpleTextWidgetStyleButton, { config: config, onChange: onChange })] }));
142
142
  }
@@ -1,4 +1,17 @@
1
1
  import type { PhiCmsServerWidgetPlugin } from "../../../../../types";
2
+ import { resolvePhiWidgetRecordField } from "../../../../../server-helpers/record-fields";
3
+ import type { PhiBlockRuntime } from "../../../../../types";
4
+ import type { PhiResolvedLinkTargets } from "../../../../../types/references";
5
+ import type { PhiSimpleTextWidgetLink } from "./client";
2
6
  import { PHI_SIMPLE_TEXT_WIDGET_PLUGIN_TYPE, type PhiCmsSimpleTextWidgetConfig } from "./config";
7
+ /**
8
+ * Where the text leads, resolved here so the address travels and not the reference.
9
+ *
10
+ * A link field of the page record wins over the stored target, as on the Button. Where the record lacks
11
+ * that field the text stays and leads nowhere: unlike a Button, a text without its link still has its
12
+ * words to show. A Page target that did not resolve -- deleted, unpublished, its Module off -- is no
13
+ * link either (`REFERENCES.md`).
14
+ */
15
+ export declare function resolvePhiSimpleTextLink(config: Pick<PhiCmsSimpleTextWidgetConfig, "linkTarget" | "linkRecordField">, runtime: PhiBlockRuntime, registry: Parameters<typeof resolvePhiWidgetRecordField>[0]["registry"], links: PhiResolvedLinkTargets | null | undefined): Promise<PhiSimpleTextWidgetLink | null>;
3
16
  export declare const PHI_SIMPLE_TEXT_WIDGET_PLUGIN: PhiCmsServerWidgetPlugin<PhiCmsSimpleTextWidgetConfig>;
4
17
  export { PHI_SIMPLE_TEXT_WIDGET_PLUGIN_TYPE };
@@ -4,8 +4,26 @@ import { hasPhiFlag } from "../../../../../helpers/flags";
4
4
  import { translatePhiSearchWidgetTexts } from "../../../../../server-helpers/search-text";
5
5
  import { formatPhiRecordFieldText, PHI_RECORD_TEXT_FIELD_KINDS } from "../../../../../helpers/record-fields";
6
6
  import { resolvePhiWidgetRecordField } from "../../../../../server-helpers/record-fields";
7
+ import { isPhiExternalHref } from "../../../../../helpers/external-href";
8
+ import { resolvePhiLinkHref } from "../../../../../helpers/link-target";
7
9
  import { PhiSimpleTextWidget } from "./server";
8
10
  import { PHI_SIMPLE_TEXT_WIDGET_DEFINITION, PHI_SIMPLE_TEXT_WIDGET_PLUGIN_TYPE, resolvePhiSimpleTextWidgetText, } from "./config";
11
+ /**
12
+ * Where the text leads, resolved here so the address travels and not the reference.
13
+ *
14
+ * A link field of the page record wins over the stored target, as on the Button. Where the record lacks
15
+ * that field the text stays and leads nowhere: unlike a Button, a text without its link still has its
16
+ * words to show. A Page target that did not resolve -- deleted, unpublished, its Module off -- is no
17
+ * link either (`REFERENCES.md`).
18
+ */
19
+ export async function resolvePhiSimpleTextLink(config, runtime, registry, links) {
20
+ const linkField = await resolvePhiWidgetRecordField({ registry, runtime, key: config.linkRecordField, kinds: ["link"] });
21
+ if (linkField.bound) {
22
+ const href = linkField.field?.value.href;
23
+ return href ? { href, newTab: false, external: isPhiExternalHref(href) } : null;
24
+ }
25
+ return resolvePhiLinkHref(config.linkTarget, links);
26
+ }
9
27
  export const PHI_SIMPLE_TEXT_WIDGET_PLUGIN = {
10
28
  ...PHI_SIMPLE_TEXT_WIDGET_DEFINITION,
11
29
  // The text as the render shows it: a record's already in the page's language, the Widget's own translated here.
@@ -18,7 +36,8 @@ export const PHI_SIMPLE_TEXT_WIDGET_PLUGIN = {
18
36
  textSource: config.textSource,
19
37
  });
20
38
  },
21
- render: async ({ widget, config, runtime, registry }) => {
39
+ render: async ({ widget, config, runtime, registry, links }) => {
40
+ const link = await resolvePhiSimpleTextLink(config, runtime, registry, links);
22
41
  const noTranslate = hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate);
23
42
  // A record's text is already translated; only the Widget's own still has to be.
24
43
  const hasResolvedText = Boolean(widget.resolvedContent?.textFields.text);
@@ -30,10 +49,10 @@ export const PHI_SIMPLE_TEXT_WIDGET_PLUGIN = {
30
49
  if (recordField.bound) {
31
50
  const text = recordField.field ? formatPhiRecordFieldText(recordField.field, runtime.locale.current, runtime.site.timeZone) : "";
32
51
  return text
33
- ? _jsx(PhiSimpleTextWidget, { blockId: widget.id, translate: false, labels: { text }, config: config, runtime: runtime }, `widget-${widget.id}`)
52
+ ? _jsx(PhiSimpleTextWidget, { blockId: widget.id, translate: false, labels: { text }, config: config, link: link, runtime: runtime }, `widget-${widget.id}`)
34
53
  : null;
35
54
  }
36
- return (_jsx(PhiSimpleTextWidget, { blockId: widget.id, translate: !noTranslate && !hasResolvedText, textSource: config.textSource, labels: {
55
+ return (_jsx(PhiSimpleTextWidget, { blockId: widget.id, translate: !noTranslate && !hasResolvedText, textSource: config.textSource, link: link, labels: {
37
56
  text: resolvePhiSimpleTextWidgetText({
38
57
  ...config,
39
58
  label: widget.label ?? undefined,
@@ -44,7 +63,7 @@ export const PHI_SIMPLE_TEXT_WIDGET_PLUGIN = {
44
63
  }, "Text"),
45
64
  }, config: config, runtime: runtime }, `widget-${widget.id}`));
46
65
  },
47
- renderPreview: ({ widget, config, runtime }) => (_jsx(PhiSimpleTextWidget, { blockId: widget.id, labels: {
66
+ renderPreview: async ({ widget, config, runtime, registry, links }) => (_jsx(PhiSimpleTextWidget, { blockId: widget.id, link: await resolvePhiSimpleTextLink(config, runtime, registry, links), labels: {
48
67
  text: resolvePhiSimpleTextWidgetText({
49
68
  ...config,
50
69
  label: widget.label ?? undefined,
@@ -1,6 +1,6 @@
1
1
  import type { PhiTextSource } from "../../../../../helpers/text-source";
2
2
  import type { PhiCmsInstanceId, PhiRenderableBlockBase, PhiServerBlockBaseProps } from "../../../../../types";
3
- import type { PhiSimpleTextWidgetClientConfig } from "./client";
3
+ import type { PhiSimpleTextWidgetClientConfig, PhiSimpleTextWidgetLink } from "./client";
4
4
  export type PhiSimpleTextWidgetLabels = {
5
5
  text: string;
6
6
  };
@@ -18,5 +18,7 @@ export type PhiSimpleTextWidgetProps = PhiServerBlockBaseProps<PhiSimpleTextWidg
18
18
  * written in while the Description and Card Widgets beside it were translating theirs.
19
19
  */
20
20
  translate?: boolean;
21
+ /** Where the text leads, resolved by the caller from the target or the record; absent, it leads nowhere. */
22
+ link?: PhiSimpleTextWidgetLink | null;
21
23
  };
22
- export declare function PhiSimpleTextWidget({ blockId, labels, config, translate, textSource, runtime, }: PhiSimpleTextWidgetProps): Promise<import("react").JSX.Element>;
24
+ export declare function PhiSimpleTextWidget({ blockId, labels, config, translate, textSource, link, runtime, }: PhiSimpleTextWidgetProps): Promise<import("react").JSX.Element>;
@@ -4,7 +4,7 @@ import { maskPhiTextPlaceholders, resolvePhiTextPlaceholders } from "../../../..
4
4
  import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
5
5
  import { protectPhiMailHref } from "../../../../../helpers/protected-mail";
6
6
  import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
7
- export async function PhiSimpleTextWidget({ blockId, labels, config, translate, textSource, runtime, }) {
7
+ export async function PhiSimpleTextWidget({ blockId, labels, config, translate, textSource, link = null, runtime, }) {
8
8
  const locale = runtime?.locale.current;
9
9
  /*
10
10
  * Masked before the translation and filled after it.
@@ -21,15 +21,16 @@ export async function PhiSimpleTextWidget({ blockId, labels, config, translate,
21
21
  return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.SimpleText, componentProps: {
22
22
  blockId,
23
23
  labels: { text },
24
- config: protectPhiSimpleTextMailHref(config),
24
+ config: config,
25
+ link: protectPhiSimpleTextMailLink(link, config),
25
26
  } }));
26
27
  }
27
28
  /*
28
29
  * Live, a `mailto:` target leaves protected (`helpers/protected-mail.ts`). In the Builder the config is
29
30
  * the operator's to edit and goes as it is.
30
31
  */
31
- function protectPhiSimpleTextMailHref(config) {
32
- if (!config?.href || (config.renderMode != null && config.renderMode !== "live"))
33
- return config;
34
- return { ...config, href: protectPhiMailHref(config.href) };
32
+ function protectPhiSimpleTextMailLink(link, config) {
33
+ if (!link || (config?.renderMode != null && config.renderMode !== "live"))
34
+ return link;
35
+ return { ...link, href: protectPhiMailHref(link.href) };
35
36
  }
@@ -23,6 +23,7 @@ import { PhiSwitchControl } from "../../../../../components/controls/phi-switch-
23
23
  import { readPhiTableControlValue, } from "../../../../../components/controls/phi-table-control";
24
24
  import { PhiTextControl } from "../../../../../components/controls/phi-text-control";
25
25
  import { PhiLink } from "../../../../../components/navigation/phi-link";
26
+ import { resolvePhiTableRowActionLink } from "../../../../../helpers/table-action-row-link";
26
27
  import { PhiIcon } from "../../../../../components/shell/phi-icon";
27
28
  import { usePhiConfig } from "../../../../../components/root/phi-config-provider";
28
29
  import { usePhiSignalListener } from "../../../../../components/runtime/runtime-signal-bus";
@@ -655,8 +656,7 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
655
656
  if (!matchesAllConditions(row, action.visibleWhen, conditionSources))
656
657
  return null;
657
658
  const disabled = findMatchingCondition(row, action.disabledWhen, conditionSources);
658
- const rowHref = action.hrefPath ? readPhiTableControlValue(row, action.hrefPath) : action.href;
659
- return (_jsx(TableAction, { action: typeof rowHref === "string" ? { ...action, href: rowHref } : action, disabled: Boolean(disabled), disabledReason: disabled && "reason" in disabled ? disabled.reason : undefined, templateValue: resource ? readRowIdentity(row, resource.rowIdentityPath) : null, size: resolvedControlSize, onActivate: () => activateAction(action, row) }, action.key));
659
+ return (_jsx(TableAction, { action: resolvePhiTableRowActionLink(action, action.hrefPath ? readPhiTableControlValue(row, action.hrefPath) : undefined), disabled: Boolean(disabled), disabledReason: disabled && "reason" in disabled ? disabled.reason : undefined, templateValue: resource ? readRowIdentity(row, resource.rowIdentityPath) : null, size: resolvedControlSize, onActivate: () => activateAction(action, row) }, action.key));
660
660
  });
661
661
  return features.actions?.rowLayout === "spaced"
662
662
  ? _jsx(PhiFlexControl, { align: "center", gap: "small", style: { display: "inline-flex" }, children: renderedActions })
@@ -950,8 +950,8 @@ function TableAction({ action, disabled = false, disabledReason, templateValue,
950
950
  if (!action.confirm)
951
951
  onActivate();
952
952
  } }) }));
953
- if (action.execution === "link" && action.href) {
954
- return disabled ? content : _jsx(PhiLink, { href: action.href, external: action.newTab, newTab: action.newTab, children: content });
953
+ if (action.execution === "link" && action.link) {
954
+ return disabled ? content : _jsx(PhiLink, { href: action.link.href, external: action.link.external, newTab: action.link.newTab, children: content });
955
955
  }
956
956
  return action.confirm && !disabled ? (_jsx(PhiConfirmControl, { title: formatTableActionTemplate(action.confirm.title, templateValue), description: action.confirm.alert ? (_jsxs(PhiFlexControl, { vertical: true, gap: "small", children: [action.confirm.description ? (_jsx("span", { children: formatTableActionTemplate(action.confirm.description, templateValue) })) : null, _jsx(PhiAlertControl, { level: action.confirm.alert.level, title: formatTableActionTemplate(action.confirm.alert.title, templateValue), description: formatTableActionTemplate(action.confirm.alert.description, templateValue) })] })) : formatTableActionTemplate(action.confirm.description, templateValue), confirmLabel: action.confirm.okText, cancelLabel: action.confirm.cancelText, danger: danger, placement: "left", onConfirm: onActivate, children: content })) : content;
957
957
  }
@@ -2,6 +2,7 @@ import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widge
2
2
  import { readPhiProviderResourceSource } from "../../../../../types/runtime-data-provider";
3
3
  import { PHI_TABLE_TAG_COLORS, PHI_TABLE_TAG_VARIANTS, readPhiTableQuery, } from "../../../../../types/table-widget";
4
4
  import { PHI_SIGNAL_VALUE_SCHEMAS, readPhiSignalRouteSet } from "../../../../../types/signals";
5
+ import { readPhiLinkTarget } from "../../../../../types/references";
5
6
  import { createPhiConfigReader } from "../../../../../components/widgets/config/strict-config-reader";
6
7
  import { readPhiControlSize } from "../../../../../types/control";
7
8
  import { PHI_CONTROL_SIZE_FIELD } from "../../../../../components/widgets/config/control-signal-config";
@@ -103,8 +104,15 @@ const PHI_TABLE_ACTION_CONFIG_FIELDS = [
103
104
  { value: "primary", label: "Primary" },
104
105
  { value: "danger", label: "Danger" },
105
106
  ] },
106
- { key: "href", type: "url", label: "Href", visibleWhen: { field: "execution", equals: "link" } },
107
- { key: "hrefPath", type: "string", label: "Row Href Path", visibleWhen: { field: "execution", equals: "link" } },
107
+ { key: "linkTarget", type: "link-target", label: "Link target", visibleWhen: { field: "execution", equals: "link" } },
108
+ {
109
+ key: "hrefPath",
110
+ type: "string",
111
+ label: "Row Href Path",
112
+ description: "Leads to the address a row holds at this path, instead of the target above.",
113
+ visibleWhen: { field: "execution", equals: "link" },
114
+ },
115
+ /* For a row's own address only: an address chosen as the target says whether it opens a new tab itself. */
108
116
  { key: "newTab", type: "boolean", label: "Open In New Tab", visibleWhen: { field: "execution", equals: "link" } },
109
117
  ...buildPhiTableConditionExpressionConfigFields("visibleWhen", "Visible Conditions", "all", "Always visible"),
110
118
  ...buildPhiTableConditionExpressionConfigFields("disabledWhen", "Disabled Conditions", "any", "No disabled conditions"),
@@ -347,7 +355,7 @@ function readAction(reader) {
347
355
  icon: reader.string("icon"),
348
356
  display: reader.oneOf("display", ["icon", "label", "icon-label"]),
349
357
  mode: reader.oneOf("mode", ["normal", "primary", "danger"]) ?? "normal",
350
- href: reader.string("href"),
358
+ linkTarget: reader.value("linkTarget", "a link target", (value) => readPhiLinkTarget(value) ?? undefined),
351
359
  hrefPath: reader.string("hrefPath"),
352
360
  newTab: reader.boolean("newTab"),
353
361
  visibleWhen: readCondition(reader, "visibleWhen"),