@phis/ui 0.5.2 → 0.5.4

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 (284) hide show
  1. package/README.md +1 -1
  2. package/components/controls/phi-border-control.js +1 -1
  3. package/components/controls/phi-bound-radius-control.js +9 -9
  4. package/components/controls/phi-brand-control.js +1 -1
  5. package/components/controls/phi-cascader-control.d.ts +9 -1
  6. package/components/controls/phi-cascader-control.js +25 -3
  7. package/components/controls/phi-drawer-control-adapter.js +4 -4
  8. package/components/controls/phi-dropdown-control.js +2 -2
  9. package/components/controls/phi-form-control.js +1 -1
  10. package/components/controls/phi-image-control.js +1 -1
  11. package/components/controls/phi-mask-picker-control.js +6 -6
  12. package/components/controls/phi-money-control.d.ts +39 -0
  13. package/components/controls/phi-money-control.js +34 -0
  14. package/components/controls/phi-number-control.d.ts +6 -1
  15. package/components/controls/phi-number-control.js +3 -3
  16. package/components/controls/phi-options-provider.d.ts +7 -0
  17. package/components/controls/phi-options-provider.js +11 -0
  18. package/components/controls/phi-select-control.js +1 -1
  19. package/components/controls/phi-theme-scope-control.js +1 -1
  20. package/components/controls/use-phi-color-control-presets.js +2 -2
  21. package/components/forms/compound-form-controls.js +2 -2
  22. package/components/forms/extended-form-field-controls.d.ts +1 -0
  23. package/components/forms/extended-form-field-controls.js +24 -2
  24. package/components/forms/form-descriptor-runtime-client.js +13 -0
  25. package/components/forms/form-provider-contract.d.ts +43 -0
  26. package/components/forms/form-provider-contract.js +40 -0
  27. package/components/forms/money-field.d.ts +27 -0
  28. package/components/forms/money-field.js +78 -0
  29. package/components/forms/shared-form-provider-registry.js +6 -2
  30. package/components/layouts/clients/phi-flex-layout-client.js +4 -4
  31. package/components/layouts/clients/phi-grid-layout-client.js +3 -3
  32. package/components/layouts/clients/phi-sequence-slot-editor.js +1 -1
  33. package/components/layouts/layout-definitions.d.ts +4 -4
  34. package/components/layouts/phi-page-region-layout.js +1 -1
  35. package/components/layouts/phi-structure-region-layout.js +3 -3
  36. package/components/media/phi-asset-focal-rect-widget.js +4 -4
  37. package/components/media/phi-asset-inspector-section.js +1 -1
  38. package/components/media/phi-media-kind-icon.js +2 -2
  39. package/components/media/phi-media-picker-binding.js +6 -1
  40. package/components/media/phi-media-restricted-icon.js +1 -1
  41. package/components/media/phi-site-font-assets.js +6 -1
  42. package/components/motion/phi-sequence-run.d.ts +14 -1
  43. package/components/motion/phi-sequence-run.js +22 -3
  44. package/components/motion/phi-sequence-viewport.js +3 -1
  45. package/components/overlays/phi-overlay-container-client.js +1 -1
  46. package/components/regions/presets/content-entry-editor-page-tree.js +3 -1
  47. package/components/regions/presets/phi-base-page-column.js +6 -2
  48. package/components/root/phi-config-provider.js +1 -1
  49. package/components/root/phi-root-background.js +1 -1
  50. package/components/root/phi-root-theme-resolver.js +1 -1
  51. package/components/shell/phi-module-icons.js +1 -1
  52. package/components/tables/client/phi-table-binding.js +16 -3
  53. package/components/trees/client/phi-tree-binding.js +6 -2
  54. package/components/widgets/built-in/builder-workspace-preview.js +8 -8
  55. package/components/widgets/client/bullet-list-entries-editor.js +2 -2
  56. package/components/widgets/client/external-document-editor.js +1 -1
  57. package/components/widgets/client/html-editor.js +3 -3
  58. package/components/widgets/client/shared/phi-collection-view-binding.js +10 -2
  59. package/components/widgets/client/shared/phi-rendered-value.d.ts +9 -1
  60. package/components/widgets/client/shared/phi-rendered-value.js +20 -1
  61. package/components/widgets/config/background.d.ts +1 -1
  62. package/components/widgets/config/background.js +1 -1
  63. package/components/widgets/config/choice-shared.d.ts +2 -2
  64. package/components/widgets/inspector-field-row.js +1 -1
  65. package/components/widgets/label-sets/gallery.js +6 -0
  66. package/components/widgets/label-sets/inspector.js +2 -0
  67. package/components/widgets/label-sets/interval.d.ts +4 -0
  68. package/components/widgets/label-sets/interval.js +31 -0
  69. package/components/widgets/label-sets/record.js +6 -1
  70. package/components/widgets/label-sets/slot-upload.d.ts +4 -0
  71. package/components/widgets/label-sets/slot-upload.js +36 -0
  72. package/components/widgets/label-sets/table.js +6 -1
  73. package/components/widgets/label-types/gallery.d.ts +7 -0
  74. package/components/widgets/label-types/gallery.js +6 -0
  75. package/components/widgets/label-types/inspector.d.ts +1 -0
  76. package/components/widgets/label-types/inspector.js +1 -0
  77. package/components/widgets/label-types/interval.d.ts +16 -0
  78. package/components/widgets/label-types/interval.js +21 -0
  79. package/components/widgets/label-types/record.d.ts +3 -0
  80. package/components/widgets/label-types/record.js +2 -0
  81. package/components/widgets/label-types/slot-upload.d.ts +24 -0
  82. package/components/widgets/label-types/slot-upload.js +16 -0
  83. package/components/widgets/label-types/table.d.ts +3 -0
  84. package/components/widgets/label-types/table.js +2 -0
  85. package/components/widgets/shared/card-body-client.js +1 -1
  86. package/components/widgets/shared/result-body-client.js +1 -1
  87. package/constants/media-library-provider-keys.d.ts +8 -1
  88. package/constants/media-library-provider-keys.js +8 -1
  89. package/constants/record-field-kinds.d.ts +6 -0
  90. package/constants/record-field-kinds.js +7 -0
  91. package/constants/runtime-module-ownership.js +2 -1
  92. package/controls.d.ts +7 -0
  93. package/controls.js +4 -0
  94. package/helpers/border-widget-style.d.ts +2 -2
  95. package/helpers/border-widget-style.js +2 -2
  96. package/helpers/cms-dialog.d.ts +43 -7
  97. package/helpers/cms-dialog.js +46 -4
  98. package/helpers/cms-layout-defaults.d.ts +2 -2
  99. package/helpers/cms-page-catalog.d.ts +13 -0
  100. package/helpers/cms-page-catalog.js +18 -2
  101. package/helpers/cms-preset-nodes.d.ts +13 -3
  102. package/helpers/cms-preset-nodes.js +3 -2
  103. package/helpers/cms-preset-page-tree.d.ts +4 -0
  104. package/helpers/cms-preset-page-tree.js +2 -0
  105. package/helpers/layout-style.d.ts +2 -2
  106. package/helpers/money-amount.d.ts +48 -0
  107. package/helpers/money-amount.js +131 -0
  108. package/helpers/page-layout-check.d.ts +4 -1
  109. package/helpers/page-layout-check.js +41 -2
  110. package/helpers/record-fields.d.ts +22 -0
  111. package/helpers/record-fields.js +109 -0
  112. package/helpers/surface-presets.d.ts +6 -6
  113. package/helpers/surface-style.d.ts +1 -1
  114. package/helpers.d.ts +0 -1
  115. package/helpers.js +0 -2
  116. package/module-page-check.d.ts +12 -0
  117. package/module-page-check.js +12 -0
  118. package/module-records.d.ts +7 -2
  119. package/module-records.js +5 -1
  120. package/next/antd-form-context-loader.mjs +31 -0
  121. package/next/config.d.mts +2 -0
  122. package/next/config.mjs +36 -3
  123. package/package.json +11 -2
  124. package/plugins/runtime-modules/accounting/module.d.ts +1 -1
  125. package/plugins/runtime-modules/app/module.d.ts +1 -1
  126. package/plugins/runtime-modules/asset/data-providers.d.ts +0 -65
  127. package/plugins/runtime-modules/asset/data-providers.js +0 -40
  128. package/plugins/runtime-modules/asset/definition.d.ts +0 -60
  129. package/plugins/runtime-modules/asset/ids.d.ts +0 -1
  130. package/plugins/runtime-modules/asset/ids.js +1 -2
  131. package/plugins/runtime-modules/asset/presets.d.ts +1 -0
  132. package/plugins/runtime-modules/asset/server.js +0 -5
  133. package/plugins/runtime-modules/asset/services/collection.js +1 -0
  134. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +2 -2
  135. package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +3 -0
  136. package/plugins/runtime-modules/blog/presets.d.ts +1 -0
  137. package/plugins/runtime-modules/builder/clients/inspector-config-field.d.ts +4 -1
  138. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +13 -4
  139. package/plugins/runtime-modules/builder/clients/inspector-link-target-field.js +1 -1
  140. package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +14 -1
  141. package/plugins/runtime-modules/builder/clients/inspector-signal-section.js +2 -2
  142. package/plugins/runtime-modules/builder/clients/layout-inspector.js +1 -1
  143. package/plugins/runtime-modules/builder/clients/layout-scaffold-buttons.js +4 -4
  144. package/plugins/runtime-modules/builder/clients/layout-scaffold-overlays.js +1 -1
  145. package/plugins/runtime-modules/builder/clients/region-inspector.js +1 -1
  146. package/plugins/runtime-modules/builder/clients/region-visibility-fields.js +1 -1
  147. package/plugins/runtime-modules/builder/clients/shells-workspace.js +1 -1
  148. package/plugins/runtime-modules/builder/clients/structure-canvas.js +2 -2
  149. package/plugins/runtime-modules/builder/clients/widget-effects-editor.js +1 -1
  150. package/plugins/runtime-modules/builder/clients/widget-inspector.d.ts +4 -1
  151. package/plugins/runtime-modules/builder/clients/widget-inspector.js +3 -2
  152. package/plugins/runtime-modules/builder/offered-page-catalog.js +3 -3
  153. package/plugins/runtime-modules/builder/options-providers.js +7 -0
  154. package/plugins/runtime-modules/builder/page-presets.server.d.ts +6 -0
  155. package/plugins/runtime-modules/builder/page-presets.server.js +8 -0
  156. package/plugins/runtime-modules/builder/pages-workspace.js +12 -1
  157. package/plugins/runtime-modules/builder/render-root-node-scaffold.js +5 -5
  158. package/plugins/runtime-modules/builder/structure-dnd.js +2 -2
  159. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +6 -3
  160. package/plugins/runtime-modules/builder/widgets/test-block/client.js +1 -1
  161. package/plugins/runtime-modules/content-entry-routes.d.ts +1 -0
  162. package/plugins/runtime-modules/contracts.js +41 -1
  163. package/plugins/runtime-modules/core/data-providers.d.ts +60 -0
  164. package/plugins/runtime-modules/core/data-providers.js +41 -0
  165. package/plugins/runtime-modules/core/definition.d.ts +98 -0
  166. package/plugins/runtime-modules/core/form-providers.d.ts +43 -0
  167. package/plugins/runtime-modules/core/server.js +5 -0
  168. package/plugins/runtime-modules/core/widgets/breadcrumb/client.d.ts +6 -3
  169. package/plugins/runtime-modules/core/widgets/breadcrumb/client.js +6 -5
  170. package/plugins/runtime-modules/core/widgets/breadcrumb/plugin.js +1 -1
  171. package/plugins/runtime-modules/core/widgets/breadcrumb/server.d.ts +9 -1
  172. package/plugins/runtime-modules/core/widgets/breadcrumb/server.js +29 -3
  173. package/plugins/runtime-modules/core/widgets/button/config.d.ts +34 -0
  174. package/plugins/runtime-modules/core/widgets/button/config.js +16 -0
  175. package/plugins/runtime-modules/core/widgets/button/plugin.js +37 -6
  176. package/plugins/runtime-modules/core/widgets/card/config.d.ts +13 -2
  177. package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +3 -3
  178. package/plugins/runtime-modules/core/widgets/cascader/client.js +1 -1
  179. package/plugins/runtime-modules/core/widgets/cascader/config.d.ts +8 -2
  180. package/plugins/runtime-modules/core/widgets/cascader/config.js +22 -0
  181. package/plugins/runtime-modules/core/widgets/checkbox-group/config.d.ts +1 -1
  182. package/plugins/runtime-modules/core/widgets/description/config.d.ts +13 -2
  183. package/plugins/runtime-modules/core/widgets/description/editor.js +13 -13
  184. package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +11 -0
  185. package/plugins/runtime-modules/core/widgets/gallery/authoring.js +12 -3
  186. package/plugins/runtime-modules/core/widgets/gallery/client.d.ts +4 -1
  187. package/plugins/runtime-modules/core/widgets/gallery/client.js +38 -21
  188. package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +18 -0
  189. package/plugins/runtime-modules/core/widgets/gallery/config.js +24 -0
  190. package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +1 -1
  191. package/plugins/runtime-modules/core/widgets/gallery/server.js +11 -0
  192. package/plugins/runtime-modules/core/widgets/image/config.d.ts +35 -0
  193. package/plugins/runtime-modules/core/widgets/image/config.js +8 -0
  194. package/plugins/runtime-modules/core/widgets/image/plugin.js +19 -1
  195. package/plugins/runtime-modules/core/widgets/image/server.d.ts +3 -1
  196. package/plugins/runtime-modules/core/widgets/image/server.js +2 -2
  197. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +13 -0
  198. package/plugins/runtime-modules/core/widgets/markdown/config.js +8 -0
  199. package/plugins/runtime-modules/core/widgets/markdown/editor.js +7 -7
  200. package/plugins/runtime-modules/core/widgets/markdown/plugin.js +20 -7
  201. package/plugins/runtime-modules/core/widgets/multi-select/config.d.ts +1 -1
  202. package/plugins/runtime-modules/core/widgets/record/authoring.js +1 -1
  203. package/plugins/runtime-modules/core/widgets/record/client.js +8 -2
  204. package/plugins/runtime-modules/core/widgets/record/config.js +4 -0
  205. package/plugins/runtime-modules/core/widgets/result/config.d.ts +11 -0
  206. package/plugins/runtime-modules/core/widgets/segmented/config.d.ts +1 -1
  207. package/plugins/runtime-modules/core/widgets/select-box/config.d.ts +1 -1
  208. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +13 -0
  209. package/plugins/runtime-modules/core/widgets/simple-text/config.js +9 -0
  210. package/plugins/runtime-modules/core/widgets/simple-text/editor.js +1 -1
  211. package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +14 -1
  212. package/plugins/runtime-modules/core/widgets/slot-upload/authoring.js +2 -1
  213. package/plugins/runtime-modules/core/widgets/slot-upload/client.d.ts +3 -1
  214. package/plugins/runtime-modules/core/widgets/slot-upload/client.js +45 -24
  215. package/plugins/runtime-modules/core/widgets/slot-upload/config.d.ts +12 -4
  216. package/plugins/runtime-modules/core/widgets/slot-upload/config.js +18 -1
  217. package/plugins/runtime-modules/core/widgets/slot-upload/plugin.js +4 -2
  218. package/plugins/runtime-modules/core/widgets/slot-upload/server.d.ts +9 -3
  219. package/plugins/runtime-modules/core/widgets/slot-upload/server.js +17 -3
  220. package/plugins/runtime-modules/core/widgets/spacer/client.js +1 -1
  221. package/plugins/runtime-modules/core/widgets/steps/config.d.ts +1 -1
  222. package/plugins/runtime-modules/core/widgets/table/client.js +4 -4
  223. package/plugins/runtime-modules/core/widgets/table/config.d.ts +37 -0
  224. package/plugins/runtime-modules/core/widgets/table/config.js +3 -0
  225. package/plugins/runtime-modules/descriptor-compiler.d.ts +11 -1
  226. package/plugins/runtime-modules/descriptor-compiler.js +57 -8
  227. package/plugins/runtime-modules/editor/presets.d.ts +1 -0
  228. package/plugins/runtime-modules/groups/definition.d.ts +1 -1
  229. package/plugins/runtime-modules/groups/forms.d.ts +18 -0
  230. package/plugins/runtime-modules/groups/forms.js +2 -2
  231. package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +6 -4
  232. package/plugins/runtime-modules/localization/presets.d.ts +1 -0
  233. package/plugins/runtime-modules/news/presets.d.ts +1 -0
  234. package/plugins/runtime-modules/public/module.d.ts +1 -1
  235. package/plugins/runtime-modules/resolver.js +7 -0
  236. package/plugins/runtime-modules/revisions/presets.d.ts +1 -0
  237. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +2 -2
  238. package/plugins/runtime-modules/theme/presets.d.ts +1 -0
  239. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +25 -2
  240. package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +4 -2
  241. package/plugins/runtime-modules/user-management/controller/client.js +6 -1
  242. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +3 -3
  243. package/runtime-render-client.d.ts +1 -1
  244. package/runtime-render-client.js +2 -1
  245. package/server-helpers/cms-page-record.d.ts +26 -0
  246. package/server-helpers/cms-page-record.js +52 -0
  247. package/server-helpers/cms-request.js +48 -4
  248. package/server-helpers/record-fields.d.ts +62 -0
  249. package/server-helpers/record-fields.js +86 -0
  250. package/server-helpers/record-samples.d.ts +21 -0
  251. package/server-helpers/record-samples.js +49 -0
  252. package/styles/builder-scaffold.css +19 -19
  253. package/styles/controls.css +109 -109
  254. package/styles/gradients.css +23 -23
  255. package/styles/layout-affordances.css +15 -15
  256. package/styles/layout-authoring-scaffold.css +20 -20
  257. package/styles/layout.css +9 -9
  258. package/styles/root.css +4 -4
  259. package/styles/shell.css +48 -17
  260. package/theme/antd-css-var-contract.d.ts +86 -80
  261. package/theme/antd-css-var-contract.js +92 -81
  262. package/theme/phi-control-shape.d.ts +1 -1
  263. package/theme/phi-theme-gradients.d.ts +2 -2
  264. package/theme/phi-theme-gradients.js +14 -14
  265. package/theme/phi-theme-palette.d.ts +1 -1
  266. package/theme/phi-theme-palette.js +2 -2
  267. package/theme/phi-theme-tokens.d.ts +8 -5
  268. package/theme/phi-theme-tokens.js +59 -28
  269. package/theme/phi-theme.d.ts +14 -2
  270. package/theme/phi-theme.js +14 -1
  271. package/theme/phi-tokens.d.ts +5 -0
  272. package/theme/phi-tokens.js +9 -0
  273. package/types/cms-module-descriptors.d.ts +9 -0
  274. package/types/cms-plugins.d.ts +27 -1
  275. package/types/collection-provider.d.ts +7 -0
  276. package/types/core-widget-placements.d.ts +42 -0
  277. package/types/record-provider.d.ts +109 -1
  278. package/types/table-widget.d.ts +33 -1
  279. package/types/table-widget.js +1 -0
  280. package/types/tree-widget.d.ts +7 -0
  281. package/types/widget-runtime.d.ts +5 -0
  282. package/types.d.ts +1 -0
  283. /package/plugins/runtime-modules/{asset/services/folder-images.server.d.ts → core/services/media-folder-images.server.d.ts} +0 -0
  284. /package/plugins/runtime-modules/{asset/services/folder-images.server.js → core/services/media-folder-images.server.js} +0 -0
@@ -24,6 +24,7 @@ export declare const PHI_FORM_FIELD_PROVIDER_KEYS: {
24
24
  readonly tree: `${string}/${string}`;
25
25
  readonly upload: `${string}/${string}`;
26
26
  readonly linkTarget: `${string}/${string}`;
27
+ readonly money: `${string}/${string}`;
27
28
  };
28
29
  export declare const PHI_AUTH_FORM_FIELD_PROVIDER_KEYS: {
29
30
  readonly termsConsent: `${string}/${string}`;
@@ -403,6 +404,48 @@ export declare const PHI_SHARED_FORM_FIELD_TYPE_PROVIDER_DESCRIPTORS: readonly [
403
404
  readonly label: "Area";
404
405
  readonly description: "Whose Pages are offered; Public when empty.";
405
406
  }];
407
+ }, {
408
+ readonly key: `${string}/${string}`;
409
+ readonly title: "Money";
410
+ readonly valueType: "json";
411
+ readonly presentation: "control";
412
+ readonly settingsFields: readonly [{
413
+ readonly key: "currency";
414
+ readonly type: "choice";
415
+ readonly mode: "single";
416
+ readonly valueType: "string";
417
+ readonly label: "Currency";
418
+ readonly description: "The currency of one amount.";
419
+ readonly options: {
420
+ value: string;
421
+ label: string;
422
+ }[];
423
+ }, {
424
+ readonly key: "currencies";
425
+ readonly type: "choice";
426
+ readonly mode: "multiple";
427
+ readonly valueType: "string[]";
428
+ readonly label: "Currencies";
429
+ readonly description: "One amount per currency, instead of a single currency.";
430
+ readonly options: {
431
+ value: string;
432
+ label: string;
433
+ }[];
434
+ }, {
435
+ readonly key: "min";
436
+ readonly type: "number";
437
+ readonly label: "Minimum";
438
+ readonly description: "In minor units: 100 is 1.00 CHF.";
439
+ readonly min: 0;
440
+ readonly precision: 0;
441
+ }, {
442
+ readonly key: "max";
443
+ readonly type: "number";
444
+ readonly label: "Maximum";
445
+ readonly description: "In minor units.";
446
+ readonly min: 0;
447
+ readonly precision: 0;
448
+ }];
406
449
  }];
407
450
  export declare const PHI_SHARED_FORM_VALIDATION_PROVIDER_DESCRIPTORS: readonly [{
408
451
  readonly key: `${string}/${string}`;
@@ -1,5 +1,6 @@
1
1
  import { createPhiModuleScopedKey } from "../../constants/runtime-module-ownership";
2
2
  import { PhiMediaKind } from "../../constants/media";
3
+ import { PHIS_PAYMENT_CURRENCY_EXPONENTS } from "@phis/contracts/payments";
3
4
  export function createPhiSharedFormProviderKey(kind, key) {
4
5
  const normalizedKey = key.trim();
5
6
  if (!normalizedKey || normalizedKey.includes("/") || normalizedKey.includes(":")) {
@@ -31,6 +32,7 @@ export const PHI_FORM_FIELD_PROVIDER_KEYS = {
31
32
  tree: createPhiSharedFormProviderKey("field", "tree"),
32
33
  upload: createPhiSharedFormProviderKey("field", "upload"),
33
34
  linkTarget: createPhiSharedFormProviderKey("field", "link-target"),
35
+ money: createPhiSharedFormProviderKey("field", "money"),
34
36
  };
35
37
  export const PHI_AUTH_FORM_FIELD_PROVIDER_KEYS = {
36
38
  termsConsent: createPhiSharedFormProviderKey("field", "auth-terms-consent"),
@@ -106,6 +108,10 @@ export const PHI_FORM_UPLOAD_LABEL_KEYS = {
106
108
  errorStorageUnreachable: "uploadErrorStorageUnreachable",
107
109
  errorFolderLocked: "uploadErrorFolderLocked",
108
110
  };
111
+ /** Every currency a payment accepts, by its ISO 4217 code, for the money field's settings. */
112
+ const PHI_MONEY_CURRENCY_OPTIONS = Object.keys(PHIS_PAYMENT_CURRENCY_EXPONENTS)
113
+ .sort()
114
+ .map((code) => ({ value: code, label: code }));
109
115
  export const PHI_SHARED_FORM_FIELD_TYPE_PROVIDER_DESCRIPTORS = [
110
116
  { key: PHI_FORM_FIELD_PROVIDER_KEYS.text, title: "Text", valueType: "string", presentation: "control", settingsFields: [{ key: "minLength", type: "number", label: "Minimum characters", min: 0 }, { key: "maxLength", type: "number", label: "Maximum characters", min: 0 }] },
111
117
  { key: PHI_FORM_FIELD_PROVIDER_KEYS.email, title: "Email", valueType: "string", presentation: "control", settingsFields: [{ key: "minLength", type: "number", label: "Minimum characters", min: 0 }, { key: "maxLength", type: "number", label: "Maximum characters", min: 0 }] },
@@ -270,6 +276,40 @@ export const PHI_SHARED_FORM_FIELD_TYPE_PROVIDER_DESCRIPTORS = [
270
276
  { key: "area", type: "string", label: "Area", description: "Whose Pages are offered; Public when empty." },
271
277
  ],
272
278
  },
279
+ /*
280
+ * An amount of money: minor units in the value, major units on screen beside the currency's code.
281
+ * `json`, because the value is the contract's money (`{ currency, minor }`) for one `currency`, or a
282
+ * price list (`{ CHF: "1990" }`) for several `currencies` -- see `money-field.ts`. `min` and `max`
283
+ * are minor units.
284
+ */
285
+ {
286
+ key: PHI_FORM_FIELD_PROVIDER_KEYS.money,
287
+ title: "Money",
288
+ valueType: "json",
289
+ presentation: "control",
290
+ settingsFields: [
291
+ {
292
+ key: "currency",
293
+ type: "choice",
294
+ mode: "single",
295
+ valueType: "string",
296
+ label: "Currency",
297
+ description: "The currency of one amount.",
298
+ options: PHI_MONEY_CURRENCY_OPTIONS,
299
+ },
300
+ {
301
+ key: "currencies",
302
+ type: "choice",
303
+ mode: "multiple",
304
+ valueType: "string[]",
305
+ label: "Currencies",
306
+ description: "One amount per currency, instead of a single currency.",
307
+ options: PHI_MONEY_CURRENCY_OPTIONS,
308
+ },
309
+ { key: "min", type: "number", label: "Minimum", description: "In minor units: 100 is 1.00 CHF.", min: 0, precision: 0 },
310
+ { key: "max", type: "number", label: "Maximum", description: "In minor units.", min: 0, precision: 0 },
311
+ ],
312
+ },
273
313
  ];
274
314
  export const PHI_SHARED_FORM_VALIDATION_PROVIDER_DESCRIPTORS = [
275
315
  { key: PHI_FORM_VALIDATION_PROVIDER_KEYS.required, title: "Required" },
@@ -0,0 +1,27 @@
1
+ import type { PhisPaymentMoney } from "@phis/contracts/payments";
2
+ export type PhiMoneyFieldConfig = {
3
+ /** The one currency of a single amount, or absent for a list. */
4
+ currency?: string;
5
+ /** The currencies of a list, in the order they are shown, or absent for a single amount. */
6
+ currencies?: readonly string[];
7
+ /** The least and the most an amount may be, in minor units; every entry of a list is held to them. */
8
+ min?: string;
9
+ max?: string;
10
+ };
11
+ /** A price list as the field holds it: minor units per currency code. */
12
+ export type PhiMoneyFieldAmounts = Readonly<Record<string, string>>;
13
+ /**
14
+ * The field's config, read strictly (`strict-config-reader.ts`): a value present and wrong is a
15
+ * `PhiConfigError` naming the field, never a default put in its place.
16
+ */
17
+ export declare function readPhiMoneyFieldConfig(config: Readonly<Record<string, unknown>> | undefined): PhiMoneyFieldConfig;
18
+ /**
19
+ * The value a single-amount field was given, or `null` for none. Anything else -- another currency, an
20
+ * amount that is not a canonical minor string -- is a record that does not fit the Form, and saying so
21
+ * is the only answer that does not overwrite it with nothing on the next save.
22
+ */
23
+ export declare function readPhiMoneyFieldAmount(value: unknown, currency: string): PhisPaymentMoney | null;
24
+ /** The value a price-list field was given, or `null` for none; the same refusal for a value that does not fit. */
25
+ export declare function readPhiMoneyFieldAmounts(value: unknown, currencies: readonly string[]): PhiMoneyFieldAmounts | null;
26
+ /** A list with one entry changed: an empty one is removed, and a list left with none is `null`. */
27
+ export declare function updatePhiMoneyFieldAmounts(amounts: PhiMoneyFieldAmounts | null, currencies: readonly string[], currency: string, minor: string | null): PhiMoneyFieldAmounts | null;
@@ -0,0 +1,78 @@
1
+ import { isPhiRecord } from "../../helpers/is-record";
2
+ import { comparePhiMinorAmounts, isPhiMinorAmount, PHI_MINOR_AMOUNT_MAX, readPhiCurrencyExponent, } from "../../helpers/money-amount";
3
+ import { createPhiConfigReader } from "../widgets/config/strict-config-reader";
4
+ function readCurrency(reader, key, value) {
5
+ return typeof value === "string" && readPhiCurrencyExponent(value) !== undefined
6
+ ? value
7
+ : reader.fail(key, "an ISO 4217 currency code a payment accepts", value);
8
+ }
9
+ function readMinorBound(reader, key) {
10
+ const value = reader.integer(key);
11
+ if (value === undefined)
12
+ return undefined;
13
+ const minor = String(value);
14
+ return value >= 0 && isPhiMinorAmount(minor) ? minor : reader.fail(key, `a whole number of minor units from 0 to ${PHI_MINOR_AMOUNT_MAX}`);
15
+ }
16
+ /**
17
+ * The field's config, read strictly (`strict-config-reader.ts`): a value present and wrong is a
18
+ * `PhiConfigError` naming the field, never a default put in its place.
19
+ */
20
+ export function readPhiMoneyFieldConfig(config) {
21
+ const reader = createPhiConfigReader(config ?? {}, "config");
22
+ const hasCurrency = reader.has("currency");
23
+ const hasCurrencies = reader.has("currencies");
24
+ if (hasCurrency === hasCurrencies) {
25
+ return reader.fail("currency", "either `currency` (one amount) or `currencies` (one amount per currency)", config?.currency);
26
+ }
27
+ const min = readMinorBound(reader, "min");
28
+ const max = readMinorBound(reader, "max");
29
+ if (min !== undefined && max !== undefined && comparePhiMinorAmounts(min, max) > 0) {
30
+ reader.fail("max", `at least the minimum ${min}`);
31
+ }
32
+ const bounds = { ...(min === undefined ? {} : { min }), ...(max === undefined ? {} : { max }) };
33
+ if (hasCurrency) {
34
+ return { currency: readCurrency(reader, "currency", reader.string("currency")), ...bounds };
35
+ }
36
+ const currencies = reader.stringList("currencies") ?? [];
37
+ if (currencies.length === 0)
38
+ reader.fail("currencies", "at least one currency");
39
+ currencies.forEach((currency, index) => readCurrency(reader, `currencies[${index}]`, currency));
40
+ if (new Set(currencies).size !== currencies.length)
41
+ reader.fail("currencies", "each currency once");
42
+ return { currencies, ...bounds };
43
+ }
44
+ function describe(value) {
45
+ return JSON.stringify(value) ?? String(value);
46
+ }
47
+ /**
48
+ * The value a single-amount field was given, or `null` for none. Anything else -- another currency, an
49
+ * amount that is not a canonical minor string -- is a record that does not fit the Form, and saying so
50
+ * is the only answer that does not overwrite it with nothing on the next save.
51
+ */
52
+ export function readPhiMoneyFieldAmount(value, currency) {
53
+ if (value === undefined || value === null)
54
+ return null;
55
+ if (isPhiRecord(value) && value.currency === currency && isPhiMinorAmount(value.minor)) {
56
+ return { currency, minor: value.minor };
57
+ }
58
+ throw new Error(`A money field in ${currency} was given ${describe(value)}; it holds { currency: "${currency}", minor: "<digits>" } or null.`);
59
+ }
60
+ /** The value a price-list field was given, or `null` for none; the same refusal for a value that does not fit. */
61
+ export function readPhiMoneyFieldAmounts(value, currencies) {
62
+ if (value === undefined || value === null)
63
+ return null;
64
+ if (isPhiRecord(value) && Object.entries(value).every(([currency, minor]) => currencies.includes(currency) && isPhiMinorAmount(minor))) {
65
+ return Object.keys(value).length === 0 ? null : value;
66
+ }
67
+ throw new Error(`A money field in ${currencies.join(", ")} was given ${describe(value)}; it holds minor units per currency or null.`);
68
+ }
69
+ /** A list with one entry changed: an empty one is removed, and a list left with none is `null`. */
70
+ export function updatePhiMoneyFieldAmounts(amounts, currencies, currency, minor) {
71
+ const next = {};
72
+ for (const entry of currencies) {
73
+ const amount = entry === currency ? minor : amounts?.[entry];
74
+ if (amount != null)
75
+ next[entry] = amount;
76
+ }
77
+ return Object.keys(next).length === 0 ? null : next;
78
+ }
@@ -25,7 +25,7 @@ placeholderRows = 1) {
25
25
  * server render. On a server-rendered page React keeps the server HTML until the chunk is there.
26
26
  */
27
27
  const placeholder = (_jsx("div", { "aria-busy": "true", style: {
28
- blockSize: `calc(var(--ant-control-height) * ${placeholderRows} + var(--ant-padding-sm) * ${placeholderRows - 1})`,
28
+ blockSize: `calc(var(--phi-control-height) * ${placeholderRows} + var(--phi-padding-sm) * ${placeholderRows - 1})`,
29
29
  /*
30
30
  * The Control shape, because this stands where a Control is about to stand. `grown-md` is half a
31
31
  * Control line, which on the one-row placeholder is exactly the capsule and on a taller one is the
@@ -33,7 +33,7 @@ placeholderRows = 1) {
33
33
  * change under the reader at the moment the chunk lands.
34
34
  */
35
35
  borderRadius: "var(--phi-control-radius-grown-md)",
36
- background: "var(--ant-color-fill-quaternary)",
36
+ background: "var(--phi-color-fill-quaternary)",
37
37
  } }));
38
38
  return function PhiLazyFormFieldControl(props) {
39
39
  return (_jsx(Suspense, { fallback: placeholder, children: _jsx(LazyControl, { ...props }) }));
@@ -45,6 +45,7 @@ const PhiLazyMultiSelectFormControl = lazyPhiFormFieldControl(() => import("./ch
45
45
  const PhiLazySegmentedFormControl = lazyPhiFormFieldControl(() => import("./choice-form-field-controls").then((module) => module.PhiSegmentedFormControl));
46
46
  const PhiLazyNumberFormControl = lazyPhiFormFieldControl(() => import("./extended-form-field-controls").then((module) => module.PhiNumberFormControl));
47
47
  const PhiLazyStorageSizeFormControl = lazyPhiFormFieldControl(() => import("./extended-form-field-controls").then((module) => module.PhiStorageSizeFormControl));
48
+ const PhiLazyMoneyFormControl = lazyPhiFormFieldControl(() => import("./extended-form-field-controls").then((module) => module.PhiMoneyFormControl));
48
49
  const PhiLazySliderFormControl = lazyPhiFormFieldControl(() => import("./extended-form-field-controls").then((module) => module.PhiSliderFormControl));
49
50
  const PhiLazyCascaderFormControl = lazyPhiFormFieldControl(() => import("./extended-form-field-controls").then((module) => module.PhiCascaderFormControl));
50
51
  const PhiLazyDateTimeFormControl = lazyPhiFormFieldControl(() => import("./datetime-form-control").then((module) => module.PhiDateTimeFormControl));
@@ -156,6 +157,9 @@ export const PHI_SHARED_FORM_PROVIDER_REGISTRY = createPhiFormProviderRegistry({
156
157
  phiSharedFieldType(PHI_FORM_FIELD_PROVIDER_KEYS.linkTarget, {
157
158
  Control: PhiLazyLinkTargetFormControl,
158
159
  }),
160
+ phiSharedFieldType(PHI_FORM_FIELD_PROVIDER_KEYS.money, {
161
+ Control: PhiLazyMoneyFormControl,
162
+ }),
159
163
  ],
160
164
  validationRules: [
161
165
  phiSharedValidationRule(PHI_FORM_VALIDATION_PROVIDER_KEYS.required, {
@@ -53,8 +53,8 @@ export function PhiFlexLayout({ slots, ...layoutProps }) {
53
53
  minHeight: 1,
54
54
  maxHeight: 1,
55
55
  alignSelf: "center",
56
- backgroundColor: "var(--ant-color-border-secondary)",
57
- boxShadow: "inset 0 0 0 1px var(--ant-color-border-secondary)",
56
+ backgroundColor: "var(--phi-color-border-secondary)",
57
+ boxShadow: "inset 0 0 0 1px var(--phi-color-border-secondary)",
58
58
  pointerEvents: "none",
59
59
  }
60
60
  : {
@@ -66,8 +66,8 @@ export function PhiFlexLayout({ slots, ...layoutProps }) {
66
66
  maxHeight: resolvedSeparatorCrossSize,
67
67
  alignSelf: "center",
68
68
  marginInline: 0,
69
- backgroundColor: "var(--ant-color-border-secondary)",
70
- boxShadow: "inset 0 0 0 1px var(--ant-color-border-secondary)",
69
+ backgroundColor: "var(--phi-color-border-secondary)",
70
+ boxShadow: "inset 0 0 0 1px var(--phi-color-border-secondary)",
71
71
  pointerEvents: "none",
72
72
  };
73
73
  const renderSeparator = (key) => (_jsx("div", { style: {
@@ -49,7 +49,7 @@ function renderGridGuides(profile, columns) {
49
49
  marginInlineStart: `calc(var(--phi-grid-column-gap, 0px) * ${shares.lead} / 24)`,
50
50
  marginInlineEnd: `calc(var(--phi-grid-column-gap, 0px) * ${shares.trail} / 24)`,
51
51
  border: "1px dashed var(--phi-debug-layer-slot-border)",
52
- borderRadius: "var(--ant-border-radius)",
52
+ borderRadius: "var(--phi-border-radius)",
53
53
  background: "var(--phi-debug-layer-slot-background-soft)",
54
54
  } }, `grid-guide-${profile}-${index}`));
55
55
  });
@@ -127,11 +127,11 @@ export function PhiGridLayout({ slots, ...layoutProps }) {
127
127
  minWidth: 0,
128
128
  width: "100%",
129
129
  height: "100%",
130
- minHeight: "var(--ant-control-height-lg)",
130
+ minHeight: "var(--phi-control-height-lg)",
131
131
  display: "flex",
132
132
  alignItems: "center",
133
133
  justifyContent: "center",
134
- borderRadius: "var(--ant-border-radius-lg)",
134
+ borderRadius: "var(--phi-border-radius-lg)",
135
135
  }, children: editRenderInsertControl({
136
136
  presentation: "inline",
137
137
  slotIndex: nextInsertSlotIndex,
@@ -39,7 +39,7 @@ export function PhiSequenceSlotEditor({ slots, slotKeys, slotLabels, slotCount,
39
39
  flex: "0 0 auto",
40
40
  width: "100%",
41
41
  justifyContent: "center",
42
- paddingBottom: "var(--ant-padding-xs)",
42
+ paddingBottom: "var(--phi-padding-xs)",
43
43
  }, children: [_jsx("span", { onClick: (event) => event.stopPropagation(), children: _jsx(PhiButtonControl, { ariaLabel: `Previous ${slotNoun}`, icon: _jsx(PhiIcon, { name: "left", size: "inherit" }), size: "small", type: "text", disabled: !hasPreviousSlot, onClick: () => onActiveIndexChange(currentIndex - 1) }) }), _jsxs(PhiTypographyControl, { type: "secondary", style: { minWidth: 64, textAlign: "center" }, children: [currentIndex + 1, " / ", editableSlotCount] }), _jsx("span", { onClick: (event) => event.stopPropagation(), children: _jsx(PhiButtonControl, { ariaLabel: `Next ${slotNoun}`, icon: _jsx(PhiIcon, { name: "right", size: "inherit" }), size: "small", type: "text", disabled: !hasNextSlot, onClick: () => onActiveIndexChange(currentIndex + 1) }) })] }), _jsxs("div", { className: phiLayoutSlotClassName(isAuthoringRender), "data-phi-layout-has-content": phiLayoutSlotContentMarker(isAuthoringRender, hasCurrentSlot), "data-phi-sequence-active-slot": currentSlotKey, style: {
44
44
  position: "relative",
45
45
  display: "flex",
@@ -556,7 +556,7 @@ export declare const PHI_SPLIT_CARD_LAYOUT_DEFINITION: {
556
556
  readonly background: {
557
557
  readonly base: {
558
558
  readonly kind: "color";
559
- readonly color: "var(--ant-color-bg-container)";
559
+ readonly color: "var(--phi-color-bg-container)";
560
560
  };
561
561
  readonly overlay: null;
562
562
  readonly filter: null;
@@ -565,7 +565,7 @@ export declare const PHI_SPLIT_CARD_LAYOUT_DEFINITION: {
565
565
  readonly border: {
566
566
  readonly borderWidth: 1;
567
567
  readonly borderStyle: "solid";
568
- readonly borderColor: "var(--ant-color-border-secondary)";
568
+ readonly borderColor: "var(--phi-color-border-secondary)";
569
569
  };
570
570
  readonly shadow: "soft";
571
571
  };
@@ -1247,7 +1247,7 @@ export declare const PHI_CORE_LAYOUT_DEFINITIONS: readonly [{
1247
1247
  readonly background: {
1248
1248
  readonly base: {
1249
1249
  readonly kind: "color";
1250
- readonly color: "var(--ant-color-bg-container)";
1250
+ readonly color: "var(--phi-color-bg-container)";
1251
1251
  };
1252
1252
  readonly overlay: null;
1253
1253
  readonly filter: null;
@@ -1256,7 +1256,7 @@ export declare const PHI_CORE_LAYOUT_DEFINITIONS: readonly [{
1256
1256
  readonly border: {
1257
1257
  readonly borderWidth: 1;
1258
1258
  readonly borderStyle: "solid";
1259
- readonly borderColor: "var(--ant-color-border-secondary)";
1259
+ readonly borderColor: "var(--phi-color-border-secondary)";
1260
1260
  };
1261
1261
  readonly shadow: "soft";
1262
1262
  };
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { PHI_LAYOUT } from "../../theme/phi-tokens";
4
4
  import { usePhiAuthoringRegionOverrides } from "../runtime/authoring-region-overrides";
5
- const PHI_PADDING = "var(--ant-padding)";
5
+ const PHI_PADDING = "var(--phi-padding)";
6
6
  export function PhiPageRegionLayout({ blockId, headerBottom, hero, content, siderRight, footerTop, style, }) {
7
7
  const overrides = usePhiAuthoringRegionOverrides();
8
8
  const isPreviewMode = overrides.preview;
@@ -4,9 +4,9 @@ import { usePhiConfig } from "../root/phi-config-provider";
4
4
  import { PHI_LAYOUT } from "../../theme/phi-tokens";
5
5
  import { usePhiAuthoringRegionOverrides } from "../runtime/authoring-region-overrides";
6
6
  import { PhiTypographyControl } from "../controls/phi-typography-control";
7
- const PHI_PADDING = "var(--ant-padding)";
8
- const PHI_PADDING_XS = "var(--ant-padding-xs)";
9
- const PHI_COLOR_BORDER_SECONDARY = "var(--ant-color-border-secondary)";
7
+ const PHI_PADDING = "var(--phi-padding)";
8
+ const PHI_PADDING_XS = "var(--phi-padding-xs)";
9
+ const PHI_COLOR_BORDER_SECONDARY = "var(--phi-color-border-secondary)";
10
10
  export function PhiStructureRegionLayout({ blockId, headerTop, headerMain, siderLeft, footerMain, footerBottom, style, labels, }) {
11
11
  const { token } = usePhiConfig();
12
12
  const overrides = usePhiAuthoringRegionOverrides();
@@ -255,7 +255,7 @@ function PhiAssetFocalRectEditor({ asset, config, }) {
255
255
  maxHeight: "calc(100dvh - 240px)",
256
256
  minHeight: 240,
257
257
  overflow: "hidden",
258
- background: "var(--ant-color-fill-tertiary)",
258
+ background: "var(--phi-color-fill-tertiary)",
259
259
  }, children: _jsx("div", { ref: canvasRef, onPointerDown: pointerDown, onPointerMove: pointerMove, onPointerUp: pointerUp, onPointerCancel: pointerUp, style: { position: "absolute", inset: 0, cursor, touchAction: "none", userSelect: "none" }, children: _jsxs("div", { ref: imageRef, style: {
260
260
  position: "absolute",
261
261
  left: imageBox?.left ?? 0,
@@ -270,9 +270,9 @@ function PhiAssetFocalRectEditor({ asset, config, }) {
270
270
  top: `${draft.y * 100}%`,
271
271
  width: `${draft.width * 100}%`,
272
272
  height: `${draft.height * 100}%`,
273
- border: "2px solid var(--ant-color-primary)",
274
- boxShadow: "0 0 0 1px var(--ant-color-bg-container) inset",
275
- background: "color-mix(in srgb, var(--ant-color-primary) 12%, transparent)",
273
+ border: "2px solid var(--phi-color-primary)",
274
+ boxShadow: "0 0 0 1px var(--phi-color-bg-container) inset",
275
+ background: "color-mix(in srgb, var(--phi-color-primary) 12%, transparent)",
276
276
  cursor,
277
277
  }, children: [_jsxs("div", { style: { position: "absolute", insetInlineStart: 8, top: 8, display: "flex", gap: 6, flexWrap: "wrap" }, children: [_jsx(PhiTagControl, { color: "blue", children: `x ${focalRectToPercent(draft.x)}` }), _jsx(PhiTagControl, { color: "blue", children: `y ${focalRectToPercent(draft.y)}` })] }), _jsxs("div", { style: { position: "absolute", insetInlineEnd: 8, bottom: 8, display: "flex", gap: 6, flexWrap: "wrap" }, children: [_jsx(PhiTagControl, { color: "blue", children: `w ${focalRectToPercent(draft.width)}` }), _jsx(PhiTagControl, { color: "blue", children: `h ${focalRectToPercent(draft.height)}` })] })] })) : null] }) }) }));
278
278
  }
@@ -112,7 +112,7 @@ export function PhiAssetInspectorSection({ section, asset, selectedVariantKey, s
112
112
  width: "100%",
113
113
  minWidth: 0,
114
114
  "--phi-labeled-control-label-width": "33.333333%",
115
- }, children: [_jsxs("div", { style: { position: "relative", width: "100%", aspectRatio: "4 / 3", overflow: "hidden", borderRadius: "var(--ant-border-radius-lg)", background: "var(--ant-color-fill-tertiary)" }, children: [asset.kind === PhiMediaKind.Image ? (isOriginalSelection ? (originalCoverImageStyle ? (_jsx(NextImage, { alt: asset.altText ?? asset.title ?? asset.originalName, src: asset.deliveryUrl, width: asset.width ?? 1, height: asset.height ?? 1, unoptimized: unoptimizedPreview, sizes: "340px", placeholder: asset.blurDataUrl ? "blur" : "empty", blurDataURL: asset.blurDataUrl ?? undefined, style: originalCoverImageStyle })) : (_jsx(NextImage, { alt: asset.altText ?? asset.title ?? asset.originalName, src: asset.deliveryUrl, fill: true, unoptimized: unoptimizedPreview, sizes: "340px", placeholder: asset.blurDataUrl ? "blur" : "empty", blurDataURL: asset.blurDataUrl ?? undefined, style: { objectFit: "cover" } }))) : (_jsx("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center" }, children: previewFrame?.fixedCropBox ? (_jsx("div", { style: { position: "relative", width: previewFrame.fixedCropBox, height: previewFrame.fixedCropBox, flex: "0 0 auto", overflow: "hidden" }, children: _jsx(NextImage, { alt: asset.altText ?? asset.title ?? asset.originalName, src: variantPresentation?.url ?? asset.deliveryUrl, width: previewFrame.fixedCropBox, height: previewFrame.fixedCropBox, unoptimized: unoptimizedPreview, placeholder: asset.blurDataUrl ? "blur" : "empty", blurDataURL: asset.blurDataUrl ?? undefined, style: selectedVariantCoverImageStyle ?? undefined }) })) : (_jsx("div", { style: {
115
+ }, children: [_jsxs("div", { style: { position: "relative", width: "100%", aspectRatio: "4 / 3", overflow: "hidden", borderRadius: "var(--phi-border-radius-lg)", background: "var(--phi-color-fill-tertiary)" }, children: [asset.kind === PhiMediaKind.Image ? (isOriginalSelection ? (originalCoverImageStyle ? (_jsx(NextImage, { alt: asset.altText ?? asset.title ?? asset.originalName, src: asset.deliveryUrl, width: asset.width ?? 1, height: asset.height ?? 1, unoptimized: unoptimizedPreview, sizes: "340px", placeholder: asset.blurDataUrl ? "blur" : "empty", blurDataURL: asset.blurDataUrl ?? undefined, style: originalCoverImageStyle })) : (_jsx(NextImage, { alt: asset.altText ?? asset.title ?? asset.originalName, src: asset.deliveryUrl, fill: true, unoptimized: unoptimizedPreview, sizes: "340px", placeholder: asset.blurDataUrl ? "blur" : "empty", blurDataURL: asset.blurDataUrl ?? undefined, style: { objectFit: "cover" } }))) : (_jsx("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center" }, children: previewFrame?.fixedCropBox ? (_jsx("div", { style: { position: "relative", width: previewFrame.fixedCropBox, height: previewFrame.fixedCropBox, flex: "0 0 auto", overflow: "hidden" }, children: _jsx(NextImage, { alt: asset.altText ?? asset.title ?? asset.originalName, src: variantPresentation?.url ?? asset.deliveryUrl, width: previewFrame.fixedCropBox, height: previewFrame.fixedCropBox, unoptimized: unoptimizedPreview, placeholder: asset.blurDataUrl ? "blur" : "empty", blurDataURL: asset.blurDataUrl ?? undefined, style: selectedVariantCoverImageStyle ?? undefined }) })) : (_jsx("div", { style: {
116
116
  position: "relative",
117
117
  width: previewFrame?.fitAxis === "width" ? "100%" : "auto",
118
118
  height: previewFrame?.fitAxis === "height" ? "100%" : "auto",
@@ -2,8 +2,8 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { PhiMediaKind } from "../../constants/media";
4
4
  import { PhiIcon } from "../shell/phi-icon";
5
- const PHI_COLOR_TEXT_SECONDARY = "var(--ant-color-text-secondary)";
6
- const PHI_COLOR_PRIMARY = "var(--ant-color-primary)";
5
+ const PHI_COLOR_TEXT_SECONDARY = "var(--phi-color-text-secondary)";
6
+ const PHI_COLOR_PRIMARY = "var(--phi-color-primary)";
7
7
  export function PhiMediaKindIcon({ kind, size = 32, style, className }) {
8
8
  const iconStyle = {
9
9
  fontSize: `${size / 16}rem`,
@@ -4,6 +4,7 @@ import { useEffect, useMemo, useRef, useState } from "react";
4
4
  import { PhiImageAssetVariantKey, PhiMediaKind } from "../../constants/media";
5
5
  import { usePhiControlSignalController } from "../widgets/client/shared/phi-control-signals";
6
6
  import { usePhiCollectionProvider } from "../widgets/client/shared/phi-collection-provider";
7
+ import { usePhiIntlLocale, usePhiIntlTimeZone } from "../root/phi-intl-locale";
7
8
  import { PhiMediaPickerControl } from "../controls/phi-media-picker-control";
8
9
  import { normalizePhiMediaPickerMinColumnWidth } from "../controls/phi-media-picker-control-contract";
9
10
  import { PHI_ASSET_COLLECTION_DATA_SOURCE } from "./asset-collection-runtime";
@@ -48,6 +49,8 @@ export function usePhiMediaPickerBinding({ config, labels, searchLabels, value:
48
49
  : null;
49
50
  const source = config?.dataSource ?? PHI_ASSET_COLLECTION_DATA_SOURCE;
50
51
  const { provider, bindingError } = usePhiCollectionProvider(source);
52
+ const locale = usePhiIntlLocale();
53
+ const timeZone = usePhiIntlTimeZone();
51
54
  const folderOptions = useMemo(() => buildPhiMediaFolderCascaderOptions(folders), [folders]);
52
55
  const spaceOptions = useMemo(() => buildPhiMediaSpaceOptions(spaces, labels.space), [labels.space, spaces]);
53
56
  const folderValue = useMemo(() => buildPhiMediaFolderValueById(folders, folderId), [folderId, folders]);
@@ -88,6 +91,8 @@ export function usePhiMediaPickerBinding({ config, labels, searchLabels, value:
88
91
  resourceKey: source.resourceKey,
89
92
  query,
90
93
  params: "params" in source ? source.params : undefined,
94
+ locale,
95
+ timeZone,
91
96
  signal: abortController.signal,
92
97
  });
93
98
  if (abortController.signal.aborted)
@@ -122,7 +127,7 @@ export function usePhiMediaPickerBinding({ config, labels, searchLabels, value:
122
127
  };
123
128
  void load();
124
129
  return () => abortController.abort();
125
- }, [isOpen, provider, query, refreshToken, source]);
130
+ }, [isOpen, locale, provider, query, refreshToken, source, timeZone]);
126
131
  const resolvedAssets = provider && source ? assets : [];
127
132
  const updateOpen = (next) => {
128
133
  if (controlledOpen == null)
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { PhiIcon } from "../shell/phi-icon";
4
- const PHI_COLOR_ERROR = "var(--ant-color-error)";
4
+ const PHI_COLOR_ERROR = "var(--phi-color-error)";
5
5
  export function PhiMediaRestrictedIcon({ size = 32, style, className, title = "not allowed", }) {
6
6
  const iconStyle = {
7
7
  fontSize: `${size / 16}rem`,
@@ -3,6 +3,7 @@ import { useEffect, useMemo, useState } from "react";
3
3
  import { PhiMediaKind } from "../../constants/media";
4
4
  import { createPhiAssetUri } from "../../types/references";
5
5
  import { usePhiCollectionProvider } from "../widgets/client/shared/phi-collection-provider";
6
+ import { usePhiIntlLocale, usePhiIntlTimeZone } from "../root/phi-intl-locale";
6
7
  import { PHI_ASSET_COLLECTION_DATA_SOURCE } from "./asset-collection-runtime";
7
8
  import { readPhiMediaAssetTiles } from "./phi-image-preview-data";
8
9
  /**
@@ -35,6 +36,8 @@ function readFontAssetLabel(asset) {
35
36
  */
36
37
  export function usePhiSiteFontAssets(enabled = true) {
37
38
  const { provider } = usePhiCollectionProvider(PHI_ASSET_COLLECTION_DATA_SOURCE);
39
+ const locale = usePhiIntlLocale();
40
+ const timeZone = usePhiIntlTimeZone();
38
41
  const [assets, setAssets] = useState([]);
39
42
  const [loading, setLoading] = useState(false);
40
43
  const [error, setError] = useState(null);
@@ -55,6 +58,8 @@ export function usePhiSiteFontAssets(enabled = true) {
55
58
  sortOrder: "descending",
56
59
  filters: { kind: PhiMediaKind.Font },
57
60
  },
61
+ locale,
62
+ timeZone,
58
63
  signal: abortController.signal,
59
64
  }).then((data) => {
60
65
  if (abortController.signal.aborted)
@@ -75,7 +80,7 @@ export function usePhiSiteFontAssets(enabled = true) {
75
80
  setLoading(false);
76
81
  });
77
82
  return () => abortController.abort();
78
- }, [enabled, provider]);
83
+ }, [enabled, locale, provider, timeZone]);
79
84
  const options = useMemo(() => assets
80
85
  .filter((asset) => asset.kind === PhiMediaKind.Font)
81
86
  .map((asset) => ({
@@ -3,6 +3,12 @@ import { type PhiSequenceSettings } from "../widgets/config/sequence-settings";
3
3
  import type { PhiSequenceControlLabels } from "../widgets/label-types/sequence";
4
4
  /** How many items stand in the window: never more than there are, never fewer than one. */
5
5
  export declare function resolvePhiSequenceRunSpan(visibleCount: number | undefined, itemCount: number): number;
6
+ /** One small stand-in for an item: its content, and its name for a screen reader (empty falls back to the page label). */
7
+ export type PhiSequenceThumbnail = {
8
+ key: string;
9
+ label: string;
10
+ content: ReactNode;
11
+ };
6
12
  /**
7
13
  * A run of items shown a few at a time, and the two things the browser will not do for us.
8
14
  *
@@ -18,10 +24,17 @@ export declare function resolvePhiSequenceRunSpan(visibleCount: number | undefin
18
24
  *
19
25
  * What the items are is the caller's: the Gallery's pictures, the Entries list's cards.
20
26
  */
21
- export declare function PhiSequenceRun({ items, settings, labels, itemStyle, }: {
27
+ export declare function PhiSequenceRun({ items, settings, labels, itemStyle, thumbnails, thumbnailWidth, }: {
22
28
  /** Keyed by the caller; the run neither wraps nor rekeys them. */
23
29
  items: readonly ReactNode[];
24
30
  settings: PhiSequenceSettings | undefined;
25
31
  labels: PhiSequenceControlLabels;
26
32
  itemStyle?: CSSProperties;
33
+ /**
34
+ * A row of buttons under the window, one per item, in place of the dots. Acts only while one item is
35
+ * shown at a time; the active item's is marked and a press makes its item the active one.
36
+ */
37
+ thumbnails?: readonly PhiSequenceThumbnail[];
38
+ /** A thumbnail's width in pixels. */
39
+ thumbnailWidth?: number;
27
40
  }): import("react").JSX.Element | null;
@@ -18,6 +18,10 @@ function formatPageLabel(template, from, to) {
18
18
  export function resolvePhiSequenceRunSpan(visibleCount, itemCount) {
19
19
  return Math.min(visibleCount ?? PHI_SEQUENCE_SETTINGS_DEFAULTS.visibleCount, Math.max(itemCount, 1));
20
20
  }
21
+ /** Whether the thumbnail row is drawn: only over one item at a time, and only where there is something to choose. */
22
+ function resolvePhiSequenceShowsThumbnails(thumbnails, span, itemCount) {
23
+ return thumbnails !== undefined && span === 1 && itemCount > 1;
24
+ }
21
25
  /**
22
26
  * A run of items shown a few at a time, and the two things the browser will not do for us.
23
27
  *
@@ -33,7 +37,7 @@ export function resolvePhiSequenceRunSpan(visibleCount, itemCount) {
33
37
  *
34
38
  * What the items are is the caller's: the Gallery's pictures, the Entries list's cards.
35
39
  */
36
- export function PhiSequenceRun({ items, settings, labels, itemStyle, }) {
40
+ export function PhiSequenceRun({ items, settings, labels, itemStyle, thumbnails, thumbnailWidth, }) {
37
41
  const { token } = usePhiConfig();
38
42
  const defaults = PHI_SEQUENCE_SETTINGS_DEFAULTS;
39
43
  const loop = settings?.loop ?? defaults.loop;
@@ -70,8 +74,23 @@ export function PhiSequenceRun({ items, settings, labels, itemStyle, }) {
70
74
  const atEnd = windowStart >= lastStart;
71
75
  // Two disabled arrows over a single item say nothing; the dots already know to stay away.
72
76
  const showArrows = (controls === "arrows" || controls === "both") && itemCount > span;
73
- const showDots = (controls === "dots" || controls === "both") && pageCount > 1;
74
- return (_jsxs("div", { role: "region", "aria-roledescription": "carousel", "aria-label": labels.region, style: { display: "flex", flexDirection: "column", gap: token.marginXS, width: "100%", minWidth: 0, ...gestures.style }, ...autoplay.holdHandlers, ...gestures.handlers, children: [_jsxs("div", { style: { position: "relative", minWidth: 0 }, "aria-live": autoplay.running ? "off" : "polite", children: [_jsx(PhiSequenceViewport, { items: [...items], activeIndex: activeIndex, visibleCount: span, anchor: "start", transition: settings?.transition ?? defaults.transition, ...(settings?.durationMs === undefined ? {} : { durationMs: settings.durationMs }), ...(settings?.easing === undefined ? {} : { easing: settings.easing }), lookahead: settings?.lookahead ?? defaults.lookahead, mountPolicy: settings?.mountPolicy ?? defaults.mountPolicy, gap: resolvePhiSpacingScaleValue(settings?.gap ?? defaults.gap), itemStyle: itemStyle }), showArrows ? (_jsxs(_Fragment, { children: [_jsx("div", { style: { position: "absolute", insetBlockStart: "50%", insetInlineStart: token.marginXS, transform: "translateY(-50%)" }, children: _jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "left", size: "inherit" }), ariaLabel: labels.previous, shape: "circle", disabled: atStart && !loop, onClick: () => stepByHand(-1) }) }), _jsx("div", { style: { position: "absolute", insetBlockStart: "50%", insetInlineEnd: token.marginXS, transform: "translateY(-50%)" }, children: _jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "right", size: "inherit" }), ariaLabel: labels.next, shape: "circle", disabled: atEnd && !loop, onClick: () => stepByHand(1) }) })] })) : null, autoplay.offered ? (_jsx("div", { style: { position: "absolute", insetBlockEnd: token.marginXS, insetInlineEnd: token.marginXS }, children: _jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: autoplay.stopped ? "play-circle" : "pause-circle", size: "inherit" }), ariaLabel: autoplay.stopped ? labels.play : labels.pause, ariaPressed: autoplay.stopped, shape: "circle", onClick: autoplay.toggleStopped }) })) : null] }), showDots ? (_jsx("div", { role: "group", "aria-label": labels.pages, style: { display: "flex", justifyContent: "center", gap: token.marginXXS }, children: Array.from({ length: pageCount }, (_, page) => (_jsx("button", { type: "button", "aria-label": formatPageLabel(labels.page, (pageStarts[page] ?? 0) + 1, Math.min((pageStarts[page] ?? 0) + span, itemCount)), "aria-current": page === currentPage || undefined, onClick: () => {
77
+ const showThumbnails = resolvePhiSequenceShowsThumbnails(thumbnails, span, itemCount);
78
+ const showDots = !showThumbnails && (controls === "dots" || controls === "both") && pageCount > 1;
79
+ return (_jsxs("div", { role: "region", "aria-roledescription": "carousel", "aria-label": labels.region, style: { display: "flex", flexDirection: "column", gap: token.marginXS, width: "100%", minWidth: 0, ...gestures.style }, ...autoplay.holdHandlers, ...gestures.handlers, children: [_jsxs("div", { style: { position: "relative", minWidth: 0 }, "aria-live": autoplay.running ? "off" : "polite", children: [_jsx(PhiSequenceViewport, { items: [...items], activeIndex: activeIndex, visibleCount: span, anchor: "start", transition: settings?.transition ?? defaults.transition, ...(settings?.durationMs === undefined ? {} : { durationMs: settings.durationMs }), ...(settings?.easing === undefined ? {} : { easing: settings.easing }), lookahead: settings?.lookahead ?? defaults.lookahead, mountPolicy: settings?.mountPolicy ?? defaults.mountPolicy, gap: resolvePhiSpacingScaleValue(settings?.gap ?? defaults.gap), itemStyle: itemStyle }), showArrows ? (_jsxs(_Fragment, { children: [_jsx("div", { style: { position: "absolute", insetBlockStart: "50%", insetInlineStart: token.marginXS, transform: "translateY(-50%)" }, children: _jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "left", size: "inherit" }), ariaLabel: labels.previous, shape: "circle", disabled: atStart && !loop, onClick: () => stepByHand(-1) }) }), _jsx("div", { style: { position: "absolute", insetBlockStart: "50%", insetInlineEnd: token.marginXS, transform: "translateY(-50%)" }, children: _jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "right", size: "inherit" }), ariaLabel: labels.next, shape: "circle", disabled: atEnd && !loop, onClick: () => stepByHand(1) }) })] })) : null, autoplay.offered ? (_jsx("div", { style: { position: "absolute", insetBlockEnd: token.marginXS, insetInlineEnd: token.marginXS }, children: _jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: autoplay.stopped ? "play-circle" : "pause-circle", size: "inherit" }), ariaLabel: autoplay.stopped ? labels.play : labels.pause, ariaPressed: autoplay.stopped, shape: "circle", onClick: autoplay.toggleStopped }) })) : null] }), showThumbnails ? (_jsx("div", { role: "group", "aria-label": labels.pages, style: { display: "flex", flexWrap: "wrap", justifyContent: "center", gap: resolvePhiSpacingScaleValue("xs"), minWidth: 0 }, children: thumbnails?.map((thumbnail, index) => (_jsx("button", { type: "button", "aria-label": thumbnail.label || formatPageLabel(labels.page, index + 1, index + 1), "aria-current": index === activeIndex || undefined, "aria-pressed": index === activeIndex, onClick: () => {
80
+ setActiveIndex(index);
81
+ autoplay.restart();
82
+ }, style: {
83
+ flex: "none",
84
+ width: thumbnailWidth,
85
+ padding: 0,
86
+ cursor: "pointer",
87
+ overflow: "hidden",
88
+ background: "none",
89
+ borderRadius: token.borderRadius,
90
+ border: `${token.lineWidthBold}px solid ${index === activeIndex ? token.colorPrimary : "transparent"}`,
91
+ opacity: index === activeIndex ? 1 : 0.7,
92
+ transition: `border-color ${token.motionDurationMid}, opacity ${token.motionDurationMid}`,
93
+ }, children: thumbnail.content }, thumbnail.key))) })) : null, showDots ? (_jsx("div", { role: "group", "aria-label": labels.pages, style: { display: "flex", justifyContent: "center", gap: token.marginXXS }, children: Array.from({ length: pageCount }, (_, page) => (_jsx("button", { type: "button", "aria-label": formatPageLabel(labels.page, (pageStarts[page] ?? 0) + 1, Math.min((pageStarts[page] ?? 0) + span, itemCount)), "aria-current": page === currentPage || undefined, onClick: () => {
75
94
  setActiveIndex(pageStarts[page] ?? 0);
76
95
  autoplay.restart();
77
96
  }, style: {
@@ -80,7 +80,9 @@ export function PhiSequenceViewport({ items, activeIndex, visibleCount = 1, anch
80
80
  const slice = span === 1
81
81
  ? "100%"
82
82
  : `calc((100% - ${span - 1} * ${gapLength}) / ${span})`;
83
- const step = span === 1 ? "100%" : `calc(${slice} + ${gapLength})`;
83
+ // One place's width plus the gap after it, for one visible item as for several: the track's items stand
84
+ // that far apart, so a step of the width alone drifts a gap further off the window with every item.
85
+ const step = `calc(${slice} + ${gapLength})`;
84
86
  const mountedIndices = new Set();
85
87
  for (let index = 0; index < itemCount; index += 1) {
86
88
  const insideWindow = index >= start - lookahead && index < start + span + lookahead;