@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
package/README.md CHANGED
@@ -73,7 +73,7 @@ The root export (`@phis/ui`) is not an integration surface; import from the grou
73
73
  | --- | --- |
74
74
  | Next.js Site | `next/config` (`withPhiNextConfig` for the Site's `next.config`), `next/area-route`, `next/areas/<area>`, `next/areas/<area>-client`, `next/root-route`, `next/root-error-page`, `next/global-error`, `next/site-bridge`, `next/site-proxy`, `next/proxy-runtime`, `next/route-handlers`, `next/seo-routes`, `next/overlay-zones`, `next/overlay-zones-client`, `next/cache-handler`, `next/runtime-module-client-boundary` |
75
75
  | CMS rendering | `cms`, `cms/root-layout`, `cms/root-page`, `cms/root-slot-page`, `cms/error-page`, `cms/request`, `cms/plugins`, `cms/plugins/<area>` |
76
- | Module packages | `module`, `module/client`, `module/authoring-client`, `module/labels`, `module/dashboard-cards`, `module/records`, `module/references`, `module/projection`, `module/projection/client`, `module/projection/authoring-client`, `module/site-modules`, `module/site-modules-client` |
76
+ | Module packages | `module`, `module/client`, `module/authoring-client`, `module/labels`, `module/dashboard-cards`, `module/records`, `module/page-check`, `module/references`, `module/projection`, `module/projection/client`, `module/projection/authoring-client`, `module/site-modules`, `module/site-modules-client` |
77
77
  | Runtime Clients | `runtime`, `runtime/controller-client`, `runtime/render-client`, `runtime/signal-client`, `runtime/data-provider-client`, `runtime/authoring-client`, `runtime/authoring-manifest-client`, `runtime/calendar-adapter-client`, `runtime/user-state-client`, `runtime/client-manifests/<area>` |
78
78
  | UI | `widgets`, `core-widgets`, `widget-config`, `controls`, `controls/config`, `controls/date-time`, `layouts`, `shells`, `root`, `navigation`, `forms`, `forms/client`, `media`, `references`, `state`, `theme` |
79
79
  | Builder | `builder-api-route` |
@@ -28,7 +28,7 @@ function resolveCurrentValue(value, primaryColor) {
28
28
  };
29
29
  }
30
30
  function resolveDisplayBorderColor(color, primaryColor) {
31
- if (color === "var(--ant-color-primary)") {
31
+ if (color === "var(--phi-color-primary)") {
32
32
  return primaryColor;
33
33
  }
34
34
  return color;
@@ -17,14 +17,14 @@ const RADIUS_OPTIONS = [
17
17
  ];
18
18
  const RADIUS_COMPARE_ALIASES = {
19
19
  none: ["0", "0px"],
20
- xxs: ["3", "3px", "var(--ant-border-radius-xs)"],
21
- xs: ["5", "5px", "var(--ant-border-radius-sm)"],
22
- sm: ["8", "8px", "var(--ant-border-radius)"],
23
- base: ["13", "13px", "var(--ant-border-radius-lg)"],
24
- md: ["21", "21px", "var(--ant-border-radius-lg)"],
25
- lg: ["34", "34px", "var(--ant-border-radius-lg)"],
26
- xl: ["55", "55px", "var(--ant-border-radius-outer)"],
27
- xxl: ["89", "89px", "var(--ant-border-radius-outer)"],
20
+ xxs: ["3", "3px", "var(--phi-border-radius-xs)"],
21
+ xs: ["5", "5px", "var(--phi-border-radius-sm)"],
22
+ sm: ["8", "8px", "var(--phi-border-radius)"],
23
+ base: ["13", "13px", "var(--phi-border-radius-lg)"],
24
+ md: ["21", "21px", "var(--phi-border-radius-lg)"],
25
+ lg: ["34", "34px", "var(--phi-border-radius-lg)"],
26
+ xl: ["55", "55px", "var(--phi-border-radius-outer)"],
27
+ xxl: ["89", "89px", "var(--phi-border-radius-outer)"],
28
28
  round: ["50%"],
29
29
  };
30
30
  const PHI_RADIUS_CORNER_SHORT_LABELS = {
@@ -124,5 +124,5 @@ export function PhiBoundRadiusControl({ value, disabled = false, labels = PHI_RA
124
124
  if (asGridRows) {
125
125
  return (_jsxs(_Fragment, { children: [_jsx(Typography.Text, { children: labels.sections.radius }), _jsx("div", { style: { justifySelf: "start" }, children: switchControl }), cornerGrid ? _jsx("div", { style: { gridColumn: "1 / -1", minWidth: 0 }, children: cornerGrid }) : null] }));
126
126
  }
127
- return (_jsxs("div", { style: { display: "grid", gap: token.paddingXS, width: "100%" }, children: [_jsxs(Flex, { align: "center", justify: "flex-start", gap: labelWidth == null ? 8 : 12, children: [showLabel ? (_jsx(Typography.Text, { style: labelWidth == null ? undefined : { flex: `0 0 ${labelWidth}px`, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", lineHeight: "var(--ant-control-height)" }, children: labels.sections.radius })) : null, switchControl] }), cornerGrid] }));
127
+ return (_jsxs("div", { style: { display: "grid", gap: token.paddingXS, width: "100%" }, children: [_jsxs(Flex, { align: "center", justify: "flex-start", gap: labelWidth == null ? 8 : 12, children: [showLabel ? (_jsx(Typography.Text, { style: labelWidth == null ? undefined : { flex: `0 0 ${labelWidth}px`, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", lineHeight: "var(--phi-control-height)" }, children: labels.sections.radius })) : null, switchControl] }), cornerGrid] }));
128
128
  }
@@ -158,5 +158,5 @@ export function PhiBrandControl({ brand, fallbackTitle, shows = "lockup", mode,
158
158
  objectFit: "contain",
159
159
  display: "block",
160
160
  transform: logoYOffset === 0 ? undefined : `translateY(${logoYOffset}px)`,
161
- } }) })) : null, _jsxs(Flex, { vertical: true, gap: 0, justify: "center", children: [eyebrow ? (_jsx("span", { style: { display: "block", fontSize: "var(--ant-font-size-sm)", opacity: 0.75 }, children: eyebrow })) : null, wordmarkNode] })] }));
161
+ } }) })) : null, _jsxs(Flex, { vertical: true, gap: 0, justify: "center", children: [eyebrow ? (_jsx("span", { style: { display: "block", fontSize: "var(--phi-font-size-sm)", opacity: 0.75 }, children: eyebrow })) : null, wordmarkNode] })] }));
162
162
  }
@@ -5,17 +5,25 @@ import type { PhiControlOption } from "./phi-control-options";
5
5
  import type { PhiTreeOption } from "../../types/tree";
6
6
  export type PhiCascaderNormalizeMode = "raw" | "path";
7
7
  export type PhiCascaderOption = PhiControlOption;
8
+ /** What a click may choose (`PhiCascaderControl`'s `select`). */
9
+ export type PhiCascaderSelect = "any" | "options";
8
10
  export declare function normalizePhiCascaderValue(value: string | null | undefined, options?: {
9
11
  separator?: string | null;
10
12
  rootValue?: string | null;
11
13
  normalize?: PhiCascaderNormalizeMode | null;
12
14
  }): string;
13
- export declare function PhiCascaderControl({ value, options, allowRoot, allowClear, expandTrigger, separator, rootValue, normalize, disabled, readOnly, label, placeholder, size, onChange, onFocus, onBlur, classNames, getPopupContainer, style, }: {
15
+ export declare function PhiCascaderControl({ value, options, allowRoot, allowClear, expandTrigger, select, separator, rootValue, normalize, disabled, readOnly, label, placeholder, size, onChange, onFocus, onBlur, classNames, getPopupContainer, style, }: {
14
16
  value?: string | null;
15
17
  options?: readonly PhiCascaderOption[];
16
18
  allowRoot?: boolean;
17
19
  allowClear?: boolean;
18
20
  expandTrigger?: CascaderProps["expandTrigger"];
21
+ /**
22
+ * What a click may choose. `any` (the default) takes every level, so a path picker can stop at a parent;
23
+ * `options` takes only a value the options name, and a level the Cascader made up from deeper paths is a
24
+ * group that opens and chooses nothing -- a page picker, whose folders are no Pages.
25
+ */
26
+ select?: PhiCascaderSelect;
19
27
  separator?: string;
20
28
  rootValue?: string;
21
29
  normalize?: PhiCascaderNormalizeMode;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useMemo, useState } from "react";
3
+ import { useMemo, useRef, useState } from "react";
4
4
  import { Cascader } from "antd";
5
5
  import { PhiLabeledControl, usePhiControlLabel } from "./phi-labeled-control";
6
6
  import { PhiDescriptionHint } from "./phi-description-tooltip-icon";
@@ -135,7 +135,7 @@ function buildCascaderOptions(configuredOptions, currentValue, allowRoot, separa
135
135
  insertCascaderOption(options, { value: currentValue, label: titleizeSegment(currentValue, rootValue) }, allowRoot, separator, rootValue, normalize);
136
136
  return options;
137
137
  }
138
- export function PhiCascaderControl({ value, options, allowRoot = true, allowClear = false, expandTrigger = "click", separator = "/", rootValue = "/", normalize = "raw", disabled = false, readOnly = false, label, placeholder, size, onChange, onFocus, onBlur, classNames, getPopupContainer, style, }) {
138
+ export function PhiCascaderControl({ value, options, allowRoot = true, allowClear = false, expandTrigger = "click", select = "any", separator = "/", rootValue = "/", normalize = "raw", disabled = false, readOnly = false, label, placeholder, size, onChange, onFocus, onBlur, classNames, getPopupContainer, style, }) {
139
139
  const { labelId, labelledBy } = usePhiControlLabel(label);
140
140
  const { token } = usePhiConfig();
141
141
  const resolvedSeparator = separator.trim() || "/";
@@ -146,8 +146,20 @@ export function PhiCascaderControl({ value, options, allowRoot = true, allowClea
146
146
  normalize,
147
147
  });
148
148
  const [searchValue, setSearchValue] = useState("");
149
+ /*
150
+ * A click on a level that chooses nothing (`select: "options"`) still closes Ant Design's popup, the way
151
+ * a choice does. It stays open instead, on the level that was opened, so the click reads as "show me
152
+ * what is in here" rather than as nothing.
153
+ */
154
+ const [open, setOpen] = useState(false);
155
+ const keepOpen = useRef(false);
149
156
  const cascaderOptions = useMemo(() => buildCascaderOptions(options ?? [], normalizedValue, allowRoot, resolvedSeparator, resolvedRootValue, normalize), [allowRoot, normalize, normalizedValue, options, resolvedRootValue, resolvedSeparator]);
150
157
  const cascaderValue = findOptionPath(cascaderOptions, normalizedValue, resolvedSeparator, resolvedRootValue) ?? [];
158
+ const choosableValues = useMemo(() => new Set((options ?? []).map((option) => normalizePhiCascaderValue(option.value, {
159
+ separator: resolvedSeparator,
160
+ rootValue: resolvedRootValue,
161
+ normalize,
162
+ }))), [normalize, options, resolvedRootValue, resolvedSeparator]);
151
163
  function commit(nextValue) {
152
164
  const normalizedNextValue = normalizePhiCascaderValue(nextValue, {
153
165
  separator: resolvedSeparator,
@@ -157,10 +169,20 @@ export function PhiCascaderControl({ value, options, allowRoot = true, allowClea
157
169
  if (!allowRoot && normalizedNextValue === resolvedRootValue) {
158
170
  return;
159
171
  }
172
+ if (select === "options" && !choosableValues.has(normalizedNextValue)) {
173
+ keepOpen.current = true;
174
+ return;
175
+ }
160
176
  setSearchValue("");
161
177
  onChange?.(normalizedNextValue);
162
178
  }
163
- const control = (_jsx(Cascader, { "aria-labelledby": labelledBy, allowClear: allowClear, changeOnSelect: true, expandTrigger: expandTrigger, rootClassName: "phi-cascader-control", disabled: disabled || readOnly || !onChange, displayRender: (_, selectedOptions) => {
179
+ const control = (_jsx(Cascader, { "aria-labelledby": labelledBy, allowClear: allowClear, changeOnSelect: true, expandTrigger: expandTrigger, open: open, onOpenChange: (next) => {
180
+ if (!next && keepOpen.current) {
181
+ keepOpen.current = false;
182
+ return;
183
+ }
184
+ setOpen(next);
185
+ }, rootClassName: "phi-cascader-control", disabled: disabled || readOnly || !onChange, displayRender: (_, selectedOptions) => {
164
186
  const selectedLabels = (selectedOptions ?? [])
165
187
  .map((option) => option.label)
166
188
  .filter((label) => label != null);
@@ -8,9 +8,9 @@ import { Drawer } from "antd";
8
8
  import { PHI_FONT_SIZE, PHI_SPACE } from "../../theme/antd-css-var-contract";
9
9
  import { PHI_OVERLAY_DEFAULT_MASK, resolvePhiOverlayDismissSource, resolvePhiOverlayMaskPresentation, } from "./phi-overlay-control-contract";
10
10
  import { usePhiHydrated } from "../state/use-phi-hydrated";
11
- const PHI_DRAWER_HEADER_MIN_BLOCK_SIZE = `calc(var(--ant-control-height) + ${PHI_SPACE.xs} + ${PHI_SPACE.xs})`;
11
+ const PHI_DRAWER_HEADER_MIN_BLOCK_SIZE = `calc(var(--phi-control-height) + ${PHI_SPACE.xs} + ${PHI_SPACE.xs})`;
12
12
  /** Where a title starts when the close button stands before it: past the button, not beneath it. */
13
- const PHI_DRAWER_TITLE_AFTER_CLOSE = `calc(${PHI_SPACE.sm} + var(--ant-control-height) + ${PHI_SPACE.xs})`;
13
+ const PHI_DRAWER_TITLE_AFTER_CLOSE = `calc(${PHI_SPACE.sm} + var(--phi-control-height) + ${PHI_SPACE.xs})`;
14
14
  export function PhiDrawerControlAdapter({ open, title, header, body, footer, closable = true, keyboard = true, mask = PHI_OVERLAY_DEFAULT_MASK, mountPolicy = "remount", placement = "right", size, maxSize, resizable = false, push = false, zIndex, containerStyle, onDismiss, afterOpenChange, panelRef, }) {
15
15
  const hydrated = usePhiHydrated();
16
16
  const resolvedMask = resolvePhiOverlayMaskPresentation(mask);
@@ -29,7 +29,7 @@ export function PhiDrawerControlAdapter({ open, title, header, body, footer, clo
29
29
  * drawer without a configured background was see-through, and the presets only looked right
30
30
  * because their glass effect brings a background of its own.
31
31
  */
32
- background: "var(--ant-color-bg-elevated)",
32
+ background: "var(--phi-color-bg-elevated)",
33
33
  ...containerStyle,
34
34
  padding: 0,
35
35
  },
@@ -51,7 +51,7 @@ export function PhiDrawerControlAdapter({ open, title, header, body, footer, clo
51
51
  background: "transparent",
52
52
  },
53
53
  // The title in the body's size, as a Modal's is (theme/phi-theme.ts); Ant Design sets a Drawer's at `lg`.
54
- title: { width: "100%", minWidth: 0, fontSize: PHI_FONT_SIZE.base, lineHeight: "var(--ant-line-height)" },
54
+ title: { width: "100%", minWidth: 0, fontSize: PHI_FONT_SIZE.base, lineHeight: "var(--phi-line-height)" },
55
55
  close: {
56
56
  position: "absolute",
57
57
  top: "50%",
@@ -72,7 +72,7 @@ export function PhiPillDropdownControl({ items, selectedKeys, open, onOpenChange
72
72
  return (_jsx(PhiDropdownControl, { items: items, selectedKeys: selectedKeys, open: open, onOpenChange: onOpenChange, children: _jsxs("button", { ref: triggerRef, type: "button", className: joinPhiClassNames("phi-dropdown-control", className), style: {
73
73
  display: "inline-flex",
74
74
  alignItems: "center",
75
- gap: "var(--ant-padding-xs)",
75
+ gap: "var(--phi-padding-xs)",
76
76
  fontSize: "inherit",
77
77
  color: "inherit",
78
78
  background: "transparent",
@@ -80,5 +80,5 @@ export function PhiPillDropdownControl({ items, selectedKeys, open, onOpenChange
80
80
  padding: 0,
81
81
  cursor: canOpen ? "pointer" : "default",
82
82
  ...style,
83
- }, "aria-haspopup": canOpen ? "menu" : undefined, onMouseEnter: onIntent, onFocus: onIntent, onClick: onIntent, children: [leading, hasLabel && pill ? (_jsx("span", { className: "phi-dropdown-control__pill", children: _jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: "var(--ant-padding-xxs)" }, children: [_jsx("span", { children: label }), chevron] }) })) : (_jsxs(_Fragment, { children: [hasLabel ? _jsx("span", { children: label }) : null, chevron] }))] }) }));
83
+ }, "aria-haspopup": canOpen ? "menu" : undefined, onMouseEnter: onIntent, onFocus: onIntent, onClick: onIntent, children: [leading, hasLabel && pill ? (_jsx("span", { className: "phi-dropdown-control__pill", children: _jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: "var(--phi-padding-xxs)" }, children: [_jsx("span", { children: label }), chevron] }) })) : (_jsxs(_Fragment, { children: [hasLabel ? _jsx("span", { children: label }) : null, chevron] }))] }) }));
84
84
  }
@@ -416,7 +416,7 @@ export const PhiFormControl = forwardRef(function PhiFormControl({ descriptor, r
416
416
  [`--phi-form-cell-gap-${mode}`, part === "label"
417
417
  ? (placed.stacked ? `calc(var(--phi-form-row-gap-${mode}) / 4)` : "0px")
418
418
  : field.key === lastInFlowFieldKey ? "0px" : `var(--phi-form-row-gap-${mode})`],
419
- [`--phi-form-label-height-${mode}`, placed.stacked
419
+ [`--phi-form-label-slot-height-${mode}`, placed.stacked
420
420
  ? "auto"
421
421
  : "var(--phi-form-label-min-height)"],
422
422
  [`--phi-form-label-pad-${mode}`, placed.stacked
@@ -41,7 +41,7 @@ export function PhiImageControl({ presentation, source, alt, title, width, heigh
41
41
  maxWidth: "100%",
42
42
  lineHeight: 0,
43
43
  overflow: presentation.simulatedCropStyle ? "hidden" : undefined,
44
- ...(loaded || blur ? {} : { backgroundColor: "var(--ant-color-fill-quaternary)" }),
44
+ ...(loaded || blur ? {} : { backgroundColor: "var(--phi-color-fill-quaternary)" }),
45
45
  ...(zoom ? { cursor: "zoom-in" } : {}),
46
46
  ...style,
47
47
  };
@@ -20,8 +20,8 @@ function renderMaskPreview(mask, label, selected = false) {
20
20
  width: 54,
21
21
  height: 54,
22
22
  borderRadius: 8,
23
- background: "linear-gradient(135deg, var(--ant-color-primary, #1677ff), var(--ant-color-info, #13c2c2))",
24
- boxShadow: selected ? "0 0 0 2px var(--ant-color-primary)" : "inset 0 0 0 1px var(--ant-color-border-secondary)",
23
+ background: "linear-gradient(135deg, var(--phi-color-primary, #1677ff), var(--phi-color-info, #13c2c2))",
24
+ boxShadow: selected ? "0 0 0 2px var(--phi-color-primary)" : "inset 0 0 0 1px var(--phi-color-border-secondary)",
25
25
  ...resolvePhiMaskStyle(mask),
26
26
  } }), _jsx(Typography.Text, { style: { fontSize: 11, textAlign: "center" }, children: label })] }));
27
27
  }
@@ -49,22 +49,22 @@ export function PhiMaskPickerControl({ value, open, buttonAriaLabel = "Select ma
49
49
  });
50
50
  };
51
51
  const popupContainer = (triggerNode) => contentRef.current ?? triggerNode.parentElement ?? document.body;
52
- const content = (_jsx("div", { ref: contentRef, style: { width: 360, maxWidth: "calc(100vw - (var(--ant-padding-lg) * 2))" }, onClick: (event) => event.stopPropagation(), onMouseDown: (event) => event.stopPropagation(), onPointerDown: (event) => event.stopPropagation(), onKeyDown: (event) => event.stopPropagation(), children: _jsxs(Flex, { vertical: true, gap: "var(--ant-padding-sm)", children: [_jsxs(Flex, { align: "center", justify: "space-between", gap: "var(--ant-padding-sm)", children: [_jsx(Typography.Text, { strong: true, children: "Mask" }), _jsx(PhiButtonControl, { size: "small", type: "text", danger: true, icon: _jsx(PhiIcon, { name: "delete", size: "inherit" }), ariaLabel: "Clear mask", onClick: () => picker.changeValue(undefined) })] }), _jsx(PhiSegmentedControl, { block: true, value: mode, options: [
52
+ const content = (_jsx("div", { ref: contentRef, style: { width: 360, maxWidth: "calc(100vw - (var(--phi-padding-lg) * 2))" }, onClick: (event) => event.stopPropagation(), onMouseDown: (event) => event.stopPropagation(), onPointerDown: (event) => event.stopPropagation(), onKeyDown: (event) => event.stopPropagation(), children: _jsxs(Flex, { vertical: true, gap: "var(--phi-padding-sm)", children: [_jsxs(Flex, { align: "center", justify: "space-between", gap: "var(--phi-padding-sm)", children: [_jsx(Typography.Text, { strong: true, children: "Mask" }), _jsx(PhiButtonControl, { size: "small", type: "text", danger: true, icon: _jsx(PhiIcon, { name: "delete", size: "inherit" }), ariaLabel: "Clear mask", onClick: () => picker.changeValue(undefined) })] }), _jsx(PhiSegmentedControl, { block: true, value: mode, options: [
53
53
  { value: "preset", label: "Presets" },
54
54
  { value: "asset", label: "Media" },
55
55
  ], onChange: setMode }), mode === "preset" ? (_jsx("div", { style: {
56
56
  display: "grid",
57
57
  gridTemplateColumns: "repeat(4, minmax(0, 1fr))",
58
- gap: "var(--ant-padding-sm)",
58
+ gap: "var(--phi-padding-sm)",
59
59
  }, children: PHI_MASK_PRESET_OPTIONS.map((preset) => {
60
60
  const selected = resolvedMask.source !== "asset" && resolvedMask.preset === preset.value;
61
- return (_jsx(PhiButtonControl, { type: selected ? "primary" : "default", style: { height: "auto", padding: "var(--ant-padding-xs)" }, onClick: () => selectPreset(preset.value), label: renderMaskPreview({
61
+ return (_jsx(PhiButtonControl, { type: selected ? "primary" : "default", style: { height: "auto", padding: "var(--phi-padding-xs)" }, onClick: () => selectPreset(preset.value), label: renderMaskPreview({
62
62
  ...resolvedMask,
63
63
  enabled: true,
64
64
  source: "preset",
65
65
  preset: preset.value,
66
66
  }, preset.label, selected) }, preset.value));
67
- }) })) : null, mode === "asset" ? (_jsxs(Flex, { vertical: true, gap: "var(--ant-padding-xs)", children: [_jsx(PhiMediaPickerControl, { ...mediaPickerProps, getPopupContainer: popupContainer, popupRootClassName: popupRootClassName, trigger: _jsx("span", { style: { display: "block" }, children: _jsx(PhiButtonControl, { block: true, label: "Select mask asset", onClick: () => undefined }) }) }), _jsx(PhiFileDropControl, { accept: ".svg,.png,image/svg+xml,image/png", onFile: (file) => onUploadFile?.(file), disabled: uploading, style: { width: "100%" }, children: _jsx("span", { style: { display: "block", width: "100%" }, children: _jsx(PhiButtonControl, { block: true, icon: _jsx(PhiIcon, { name: "upload", size: "inherit" }), loading: uploading, label: uploading ? `Uploading ${uploadProgress}%` : "Upload SVG or PNG mask", onClick: () => undefined }) }) }), _jsx(PhiIconPickerControl, { value: selectedIcon, onChange: onIconSelect, disabled: uploading, buttonAriaLabel: "Select Iconify mask", buttonIcon: selectedIcon ? _jsx(PhiIcon, { name: selectedIcon, size: 16 }) : _jsx(PhiIcon, { name: "star", size: "inherit" }), buttonLabel: uploading ? `Uploading ${uploadProgress}%` : "Select Iconify icon", buttonType: "default", buttonSize: "medium", buttonBlock: true, buttonStyle: { width: "100%" }, getPopupContainer: popupContainer, rootClassName: popupRootClassName })] })) : null, [
67
+ }) })) : null, mode === "asset" ? (_jsxs(Flex, { vertical: true, gap: "var(--phi-padding-xs)", children: [_jsx(PhiMediaPickerControl, { ...mediaPickerProps, getPopupContainer: popupContainer, popupRootClassName: popupRootClassName, trigger: _jsx("span", { style: { display: "block" }, children: _jsx(PhiButtonControl, { block: true, label: "Select mask asset", onClick: () => undefined }) }) }), _jsx(PhiFileDropControl, { accept: ".svg,.png,image/svg+xml,image/png", onFile: (file) => onUploadFile?.(file), disabled: uploading, style: { width: "100%" }, children: _jsx("span", { style: { display: "block", width: "100%" }, children: _jsx(PhiButtonControl, { block: true, icon: _jsx(PhiIcon, { name: "upload", size: "inherit" }), loading: uploading, label: uploading ? `Uploading ${uploadProgress}%` : "Upload SVG or PNG mask", onClick: () => undefined }) }) }), _jsx(PhiIconPickerControl, { value: selectedIcon, onChange: onIconSelect, disabled: uploading, buttonAriaLabel: "Select Iconify mask", buttonIcon: selectedIcon ? _jsx(PhiIcon, { name: selectedIcon, size: 16 }) : _jsx(PhiIcon, { name: "star", size: "inherit" }), buttonLabel: uploading ? `Uploading ${uploadProgress}%` : "Select Iconify icon", buttonType: "default", buttonSize: "medium", buttonBlock: true, buttonStyle: { width: "100%" }, getPopupContainer: popupContainer, rootClassName: popupRootClassName })] })) : null, [
68
68
  ["Scale", Math.round((resolvedMask.scale ?? 1) * 100), 25, 200, "%", (next) => patchMask({ scale: next / 100 })],
69
69
  ["Offset X", resolvedMask.offsetX ?? 0, -100, 100, "%", (next) => patchMask({ offsetX: next })],
70
70
  ["Offset Y", resolvedMask.offsetY ?? 0, -100, 100, "%", (next) => patchMask({ offsetY: next })],
@@ -0,0 +1,39 @@
1
+ import type { CSSProperties, FocusEventHandler } from "react";
2
+ import type { PhiControlSize, PhiControlVariant } from "../../types/control";
3
+ export type PhiMoneyControlProps = {
4
+ /** The DOM id of the input, so a `<label for>` outside the control can name it. */
5
+ id?: string;
6
+ /** The amount in minor units, a canonical integer string (`PhisPaymentMoney.minor`); `null` for none. */
7
+ value?: string | null;
8
+ /** The ISO 4217 code the amount is in; it decides how many places the number has. */
9
+ currency: string;
10
+ /** The page's locale, for how the number is written (`usePhiIntlLocale`). */
11
+ locale: string;
12
+ /** The least and the most the amount may be, in minor units. Nothing below zero is an amount. */
13
+ min?: string;
14
+ max?: string;
15
+ label?: string;
16
+ /** The field's accessible name where it shows no `label`. */
17
+ ariaLabel?: string;
18
+ placeholder?: string;
19
+ disabled?: boolean;
20
+ readOnly?: boolean;
21
+ size?: PhiControlSize;
22
+ variant?: PhiControlVariant;
23
+ style?: CSSProperties;
24
+ onChange?: (minor: string | null) => void;
25
+ onBlur?: FocusEventHandler<HTMLInputElement>;
26
+ };
27
+ /**
28
+ * An amount of money: minor units in and out, major units on screen, the currency beside the number.
29
+ *
30
+ * The number is held as a decimal string (`stringMode`), never as a float, and converted on its digits
31
+ * (`helpers/money-amount.ts`). It is written the way the page's locale writes numbers once the field is
32
+ * left, and while somebody types it shows exactly what they typed -- reformatting under the caret moves
33
+ * it. Leaving the field rounds to the currency's places and brings the amount into `min`..`max`.
34
+ *
35
+ * The currency is its ISO code, on the side the locale puts it ("CHF 12.50", "12,50 EUR"), and it is
36
+ * shown with an empty field too: unlike a unit, it says what is being asked for before there is an
37
+ * answer.
38
+ */
39
+ export declare function PhiMoneyControl({ id, value, currency, locale, min, max, label, ariaLabel, placeholder, disabled, readOnly, size, variant, style, onChange, onBlur, }: PhiMoneyControlProps): import("react").JSX.Element;
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { InputNumber } from "antd";
4
+ import { PHI_LAYOUT } from "../../theme/phi-tokens";
5
+ import { comparePhiMinorAmounts, formatPhiMajorAmount, parsePhiLocaleAmount, phiMajorToMinorAmount, PHI_MINOR_AMOUNT_MAX, readPhiCurrencyExponent, resolvePhiCurrencyAffix, } from "../../helpers/money-amount";
6
+ import { PhiLabeledControl, usePhiControlLabel } from "./phi-labeled-control";
7
+ import { phisMinorToMajorAmount } from "@phis/contracts/payments";
8
+ /**
9
+ * An amount of money: minor units in and out, major units on screen, the currency beside the number.
10
+ *
11
+ * The number is held as a decimal string (`stringMode`), never as a float, and converted on its digits
12
+ * (`helpers/money-amount.ts`). It is written the way the page's locale writes numbers once the field is
13
+ * left, and while somebody types it shows exactly what they typed -- reformatting under the caret moves
14
+ * it. Leaving the field rounds to the currency's places and brings the amount into `min`..`max`.
15
+ *
16
+ * The currency is its ISO code, on the side the locale puts it ("CHF 12.50", "12,50 EUR"), and it is
17
+ * shown with an empty field too: unlike a unit, it says what is being asked for before there is an
18
+ * answer.
19
+ */
20
+ export function PhiMoneyControl({ id, value, currency, locale, min, max, label, ariaLabel, placeholder, disabled, readOnly, size, variant, style, onChange, onBlur, }) {
21
+ const { labelId, labelledBy } = usePhiControlLabel(label);
22
+ const exponent = readPhiCurrencyExponent(currency);
23
+ if (exponent === undefined) {
24
+ throw new Error(`PhiMoneyControl: "${currency}" is not an ISO 4217 currency a payment accepts.`);
25
+ }
26
+ const ceiling = max !== undefined && comparePhiMinorAmounts(max, PHI_MINOR_AMOUNT_MAX) < 0 ? max : PHI_MINOR_AMOUNT_MAX;
27
+ const affix = resolvePhiCurrencyAffix(locale, currency);
28
+ const control = (_jsx(InputNumber, { id: id, "aria-label": labelledBy ? undefined : ariaLabel, "aria-labelledby": labelledBy, stringMode: true, value: value == null ? null : phisMinorToMajorAmount(value, exponent), min: phisMinorToMajorAmount(min ?? "0", exponent), max: phisMinorToMajorAmount(ceiling, exponent), step: "1", precision: exponent, formatter: (next, info) => {
29
+ if (info.userTyping)
30
+ return info.input;
31
+ return next == null || next === "" ? "" : formatPhiMajorAmount(next, locale, exponent);
32
+ }, parser: (text) => parsePhiLocaleAmount(text ?? "", locale), prefix: affix.placement === "prefix" ? affix.text : undefined, suffix: affix.placement === "suffix" ? affix.text : undefined, placeholder: placeholder, disabled: disabled || (!onChange && !readOnly), readOnly: readOnly, size: size, variant: variant, style: { maxWidth: PHI_LAYOUT.numberControlMax, ...style }, onChange: (next) => onChange?.(next == null || next === "" ? null : phiMajorToMinorAmount(next, exponent)), onBlur: onBlur }));
33
+ return _jsx(PhiLabeledControl, { label: label, labelId: labelId, fill: style?.width === "100%", children: control });
34
+ }
@@ -5,6 +5,11 @@ export type PhiNumberControlProps = {
5
5
  id?: string;
6
6
  value?: number | null;
7
7
  label?: string;
8
+ /**
9
+ * The field's accessible name. Stated beside a `label`, it wins over it, as on `PhiTextControl` and
10
+ * `PhiSelectControl` (`usePhiControlLabel`).
11
+ */
12
+ ariaLabel?: string;
8
13
  /**
9
14
  * What the number is in, shown inside the field.
10
15
  *
@@ -27,4 +32,4 @@ export type PhiNumberControlProps = {
27
32
  onBlur?: FocusEventHandler<HTMLInputElement>;
28
33
  onKeyDown?: KeyboardEventHandler<HTMLInputElement>;
29
34
  };
30
- export declare function PhiNumberControl({ id, value, label, prefix, placeholder, min, max, step, precision, disabled, readOnly, size, variant, style, onChange, onBlur, onKeyDown, }: PhiNumberControlProps): import("react").JSX.Element;
35
+ export declare function PhiNumberControl({ id, value, label, ariaLabel, prefix, placeholder, min, max, step, precision, disabled, readOnly, size, variant, style, onChange, onBlur, onKeyDown, }: PhiNumberControlProps): import("react").JSX.Element;
@@ -3,9 +3,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { InputNumber } from "antd";
4
4
  import { PHI_LAYOUT } from "../../theme/phi-tokens";
5
5
  import { PhiLabeledControl, usePhiControlLabel } from "./phi-labeled-control";
6
- export function PhiNumberControl({ id, value, label, prefix, placeholder, min, max, step, precision, disabled, readOnly, size, variant, style, onChange, onBlur, onKeyDown, }) {
7
- const { labelId, labelledBy } = usePhiControlLabel(label);
8
- const control = (_jsx(InputNumber, { id: id, "aria-labelledby": labelledBy, value: value, prefix: prefix, placeholder: placeholder, min: min, max: max, step: step, precision: precision, disabled: disabled || (!onChange && !readOnly), readOnly: readOnly, size: size, variant: variant,
6
+ export function PhiNumberControl({ id, value, label, ariaLabel, prefix, placeholder, min, max, step, precision, disabled, readOnly, size, variant, style, onChange, onBlur, onKeyDown, }) {
7
+ const { labelId, labelledBy } = usePhiControlLabel(label, ariaLabel);
8
+ const control = (_jsx(InputNumber, { id: id, "aria-label": ariaLabel, "aria-labelledby": labelledBy, value: value, prefix: prefix, placeholder: placeholder, min: min, max: max, step: step, precision: precision, disabled: disabled || (!onChange && !readOnly), readOnly: readOnly, size: size, variant: variant,
9
9
  /*
10
10
  * The ceiling first, so a caller's own `maxWidth` replaces it rather than fighting it. A field
11
11
  * that needs to be wider than a number ever is says so, and says it in one place.
@@ -44,6 +44,13 @@ export type PhiControlOptionsProviderContext<TValue extends string | number = st
44
44
  * knowing which field supplies it or where that field lives.
45
45
  */
46
46
  dependencies: Record<string, unknown>;
47
+ /**
48
+ * The reader's language and the Site's time zone (`usePhiIntlLocale`, `usePhiIntlTimeZone`), for a
49
+ * provider whose option labels are words, amounts or dates. The hook puts both into every load key,
50
+ * outside `resolveLoadKey` like the dependencies, so a live language switch asks again.
51
+ */
52
+ locale: string;
53
+ timeZone: string;
47
54
  snapshot: unknown;
48
55
  asyncData: unknown;
49
56
  };
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { readPhiDotPath } from "../../helpers/dot-path";
3
+ import { usePhiIntlLocale, usePhiIntlTimeZone } from "../root/phi-intl-locale";
3
4
  import { createContext, createElement, useContext, useEffect, useEffectEvent, useMemo, useState, useSyncExternalStore, } from "react";
4
5
  import { isPhiRuntimeDataProviderKey, } from "../../types/runtime-data-provider";
5
6
  const EMPTY_OPTIONS_PROVIDER_REGISTRY = new Map();
@@ -169,6 +170,8 @@ export function usePhiControlOptionsProvider({ options, optionsProvider, sourceC
169
170
  form: formValues,
170
171
  config: sourceConfig,
171
172
  }), [optionsProvider?.dependencies, formValues, sourceConfig]);
173
+ const locale = usePhiIntlLocale();
174
+ const timeZone = usePhiIntlTimeZone();
172
175
  const defaultProviderLoadKey = JSON.stringify({
173
176
  providerKey: optionsProvider?.providerKey ?? null,
174
177
  area: optionsProvider?.area ?? null,
@@ -184,11 +187,15 @@ export function usePhiControlOptionsProvider({ options, optionsProvider, sourceC
184
187
  // keystroke, so taking the search into account is the searching provider's own decision.
185
188
  search,
186
189
  dependencies: dependencyValues,
190
+ locale,
191
+ timeZone,
187
192
  snapshot: providerSnapshot,
188
193
  };
194
+ // The language and the zone are prefixed for the same reason the dependencies are.
189
195
  const providerLoadKey = registeredProvider?.load
190
196
  ? [
191
197
  registeredProvider.key,
198
+ JSON.stringify([locale, timeZone]),
192
199
  JSON.stringify(dependencyValues),
193
200
  registeredProvider.resolveLoadKey?.(loadContext) ?? defaultProviderLoadKey,
194
201
  ].join(":")
@@ -270,6 +277,8 @@ export function usePhiControlOptionsProvider({ options, optionsProvider, sourceC
270
277
  sourceConfig,
271
278
  search,
272
279
  dependencies: dependencyValues,
280
+ locale,
281
+ timeZone,
273
282
  snapshot: providerSnapshot,
274
283
  asyncData,
275
284
  }),
@@ -280,6 +289,8 @@ export function usePhiControlOptionsProvider({ options, optionsProvider, sourceC
280
289
  searchState,
281
290
  dependenciesSatisfied,
282
291
  dependencyValues,
292
+ locale,
293
+ timeZone,
283
294
  asyncData,
284
295
  asyncError,
285
296
  asyncPending,
@@ -8,7 +8,7 @@ function isPhiSelectSeparatorEntry(entry) {
8
8
  return typeof entry === "object" && entry != null && "separator" in entry;
9
9
  }
10
10
  function renderPhiSelectSeparator() {
11
- return _jsx("div", { role: "separator", style: { borderTop: "1px solid var(--ant-color-split)", marginBlock: 4 } });
11
+ return _jsx("div", { role: "separator", style: { borderTop: "1px solid var(--phi-color-split)", marginBlock: 4 } });
12
12
  }
13
13
  /* The options with a line where one asks for it -- once, where an option after and one before agree. */
14
14
  function separatePhiSelectOptions(resolved) {
@@ -19,7 +19,7 @@ export function PhiThemeScopeControl({ scope, mode, token, components, children,
19
19
  const theme = useMemo(() => ({
20
20
  inherit: false,
21
21
  cssVar: {
22
- prefix: "ant",
22
+ prefix: "phi",
23
23
  key: createPhiAntdThemeCssVarKey(scope, { mode, token, components }),
24
24
  },
25
25
  token,
@@ -28,9 +28,9 @@ const PHI_TEXT_COLOR_TOKEN_KEYS = [
28
28
  "colorTextPlaceholder",
29
29
  "colorTextDisabled",
30
30
  ];
31
- /** A Theme colour token's role, the custom property Ant Design writes for it: `colorPrimaryBg` → `var(--ant-color-primary-bg)`. */
31
+ /** A Theme colour token's role, the custom property Ant Design writes for it: `colorPrimaryBg` → `var(--phi-color-primary-bg)`. */
32
32
  function resolvePhiColorTokenReference(tokenKey) {
33
- return `var(--ant-${tokenKey.replace(/[A-Z]/gu, (letter) => `-${letter.toLowerCase()}`)})`;
33
+ return `var(--phi-${tokenKey.replace(/[A-Z]/gu, (letter) => `-${letter.toLowerCase()}`)})`;
34
34
  }
35
35
  /**
36
36
  * The colour picker's swatches: the Theme's custom colours, its primary and text ladders, then the fixed
@@ -187,7 +187,7 @@ export function PhiCompoundTableFormControl({ field, label, description, value,
187
187
  if (addResetFields)
188
188
  formContext?.setValues(addResetFields);
189
189
  };
190
- return (_jsxs("div", { "data-phi-form-keyboard-scope": true, style: { display: "grid", gap: "var(--ant-padding-sm)", minWidth: 0, width: "100%" }, children: [_jsx(PhiCollectionHeaderControl, { title: label, description: description, toolbar: addEnabled ? (_jsx(PhiToolbarControl, { items: [{
190
+ return (_jsxs("div", { "data-phi-form-keyboard-scope": true, style: { display: "grid", gap: "var(--phi-padding-sm)", minWidth: 0, width: "100%" }, children: [_jsx(PhiCollectionHeaderControl, { title: label, description: description, toolbar: addEnabled ? (_jsx(PhiToolbarControl, { items: [{
191
191
  key: "add",
192
192
  label: addLabel,
193
193
  ariaLabel: addLabel,
@@ -212,5 +212,5 @@ export function PhiCompoundTreeFormControl({ field, label, description, value, o
212
212
  blockNode: true,
213
213
  node: { titleFieldKey: typeof config.titleFieldKey === "string" ? config.titleFieldKey : "title" },
214
214
  });
215
- return (_jsxs("div", { "data-phi-form-keyboard-scope": true, style: { display: "grid", gap: "var(--ant-padding-sm)", minWidth: 0, width: "100%" }, children: [_jsx(PhiCollectionHeaderControl, { title: label, description: description }), _jsx(PhiTreeControl, { nodes: nodes, nodeIdentityPath: identityPath, parentNodeIdentityPath: parentPath, presentation: presentation, disabled: disabled || readOnly, selectedNodeIdentities: selected, checkedNodeIdentities: checked, expandedNodeIdentities: expanded, selectionMode: config.selectionMode === "multiple" ? "multiple" : config.selectionMode === "none" ? "none" : "single", checking: config.checking === true, editing: config.editing === true && !disabled && !readOnly, draggable: config.reorder === true && !disabled && !readOnly, onSelectionChange: setSelected, onCheckingChange: setChecked, onExpansionChange: setExpanded, onCommitField: (identity, fieldKey, proposed) => onChange?.(nodes.map((node) => String(readPath(node, identityPath)) === String(identity) ? setPath(node, fieldKey, proposed) : node)), onDrop: (move) => onChange?.(applyMove(nodes, identityPath, parentPath, move)) })] }));
215
+ return (_jsxs("div", { "data-phi-form-keyboard-scope": true, style: { display: "grid", gap: "var(--phi-padding-sm)", minWidth: 0, width: "100%" }, children: [_jsx(PhiCollectionHeaderControl, { title: label, description: description }), _jsx(PhiTreeControl, { nodes: nodes, nodeIdentityPath: identityPath, parentNodeIdentityPath: parentPath, presentation: presentation, disabled: disabled || readOnly, selectedNodeIdentities: selected, checkedNodeIdentities: checked, expandedNodeIdentities: expanded, selectionMode: config.selectionMode === "multiple" ? "multiple" : config.selectionMode === "none" ? "none" : "single", checking: config.checking === true, editing: config.editing === true && !disabled && !readOnly, draggable: config.reorder === true && !disabled && !readOnly, onSelectionChange: setSelected, onCheckingChange: setChecked, onExpansionChange: setExpanded, onCommitField: (identity, fieldKey, proposed) => onChange?.(nodes.map((node) => String(readPath(node, identityPath)) === String(identity) ? setPath(node, fieldKey, proposed) : node)), onDrop: (move) => onChange?.(applyMove(nodes, identityPath, parentPath, move)) })] }));
216
216
  }
@@ -4,3 +4,4 @@ export declare const PhiSliderFormControl: ComponentType<PhiFormFieldProviderPro
4
4
  export declare const PhiCascaderFormControl: ComponentType<PhiFormFieldProviderProps>;
5
5
  export declare const PhiNumberFormControl: ComponentType<PhiFormFieldProviderProps>;
6
6
  export declare const PhiStorageSizeFormControl: ComponentType<PhiFormFieldProviderProps>;
7
+ export declare const PhiMoneyFormControl: ComponentType<PhiFormFieldProviderProps>;
@@ -1,9 +1,13 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { PhiCascaderControl } from "../controls/phi-cascader-control";
4
+ import { PhiFlexControl } from "../controls/phi-flex-control";
5
+ import { PhiMoneyControl } from "../controls/phi-money-control";
4
6
  import { PhiNumberControl } from "../controls/phi-number-control";
5
7
  import { PhiSliderControl } from "../controls/phi-slider-control";
6
8
  import { resolvePhiFormText } from "./form-descriptor-contract";
9
+ import { readPhiMoneyFieldAmount, readPhiMoneyFieldAmounts, readPhiMoneyFieldConfig, updatePhiMoneyFieldAmounts, } from "./money-field";
10
+ import { usePhiIntlLocale } from "../root/phi-intl-locale";
7
11
  import { PHI_STORAGE_SIZE_UNIT_LABEL, phiBytesToStorageSize, phiStorageSizeToBytes, } from "./storage-size";
8
12
  /**
9
13
  * The unit beside a number, which is the value's and not the field's name ("days", not "Window (days)").
@@ -23,7 +27,7 @@ function readPhiNumberFieldPrefix(prefix, labels) {
23
27
  }
24
28
  /*
25
29
  * Field kinds most forms never have, loaded only where one is rendered: the slider, the cascader and
26
- * the number fields.
30
+ * the number and money fields.
27
31
  *
28
32
  * The shared registry is imported by every Form Widget, and a Contact form paid for the slider and the
29
33
  * cascader -- and through the compound controls for the Table and Tree Controls with every editor --
@@ -37,7 +41,7 @@ export const PhiSliderFormControl = ({ field, value, onChange, disabled, readOnl
37
41
  const slider = (_jsx(PhiSliderControl, { value: numericValue, min: min, max: max, step: step, dots: field.config?.dots === true, included: field.config?.included !== false, reverse: field.config?.reverse === true, tooltipMode: field.config?.tooltipMode === "always" || field.config?.tooltipMode === "hidden"
38
42
  ? field.config.tooltipMode
39
43
  : "auto", tooltipSuffix: typeof field.config?.tooltipSuffix === "string" ? field.config.tooltipSuffix : undefined, disabled: disabled, readOnly: readOnly, style: { width: "100%" }, onChange: (nextValue) => onChange?.(nextValue) }));
40
- return field.config?.showInput === true ? (_jsxs("div", { style: { display: "grid", gridTemplateColumns: "minmax(96px, 1fr) minmax(0, 2fr)", gap: "var(--ant-padding-sm)", alignItems: "center", minWidth: 0 }, children: [_jsx(PhiNumberControl, { value: numericValue ?? null, min: min, max: max, step: step, precision: typeof field.config?.precision === "number" ? field.config.precision : undefined, disabled: disabled, readOnly: readOnly, style: { width: "100%" }, onChange: (nextValue) => onChange?.(nextValue) }), slider] })) : slider;
44
+ return field.config?.showInput === true ? (_jsxs("div", { style: { display: "grid", gridTemplateColumns: "minmax(96px, 1fr) minmax(0, 2fr)", gap: "var(--phi-padding-sm)", alignItems: "center", minWidth: 0 }, children: [_jsx(PhiNumberControl, { value: numericValue ?? null, min: min, max: max, step: step, precision: typeof field.config?.precision === "number" ? field.config.precision : undefined, disabled: disabled, readOnly: readOnly, style: { width: "100%" }, onChange: (nextValue) => onChange?.(nextValue) }), slider] })) : slider;
41
45
  };
42
46
  export const PhiCascaderFormControl = ({ field, value, onChange, options, placeholder, disabled, readOnly }) => (_jsx(PhiCascaderControl, { value: typeof value === "string" ? value : undefined, placeholder: placeholder, disabled: disabled, readOnly: readOnly, options: options ?? [], allowRoot: field.config?.allowRoot !== false, allowClear: field.config?.allowClear === true, separator: typeof field.config?.separator === "string" ? field.config.separator : "/", rootValue: typeof field.config?.rootValue === "string" ? field.config.rootValue : "/", normalize: field.config?.normalize === "path" ? "path" : "raw", onChange: (nextValue) => onChange?.(nextValue) }));
43
47
  export const PhiNumberFormControl = ({ id, field, value, onChange, placeholder, disabled, readOnly, labels, }) => (_jsx(PhiNumberControl, { id: id, value: typeof value === "number" ? value : null, disabled: disabled, readOnly: readOnly, placeholder: placeholder, min: typeof field.config?.min === "number" ? field.config.min : undefined, max: typeof field.config?.max === "number" ? field.config.max : undefined, step: typeof field.config?.step === "number" ? field.config.step : undefined, precision: typeof field.config?.precision === "number" ? field.config.precision : undefined, prefix: readPhiNumberFieldPrefix(field.config?.prefix, labels), style: { width: "100%" }, onChange: (nextValue) => onChange?.(nextValue) }));
@@ -56,3 +60,21 @@ export const PhiStorageSizeFormControl = ({ id, value, onChange, placeholder, di
56
60
  */
57
61
  prefix: size == null ? undefined : PHI_STORAGE_SIZE_UNIT_LABEL, min: 0, step: 1, disabled: disabled, readOnly: readOnly, placeholder: placeholder, style: { width: "100%" }, onChange: (nextValue) => onChange?.(phiStorageSizeToBytes(nextValue)) }));
58
62
  };
63
+ /*
64
+ * The field holds minor units and shows major ones, as the storage size holds bytes and shows megabytes:
65
+ * the conversion is the Control's, on the digits (`helpers/money-amount.ts`), and a handler reads the
66
+ * contract's money and nothing else. The shapes and the config are `money-field.ts`.
67
+ */
68
+ export const PhiMoneyFormControl = ({ id, field, value, onChange, label, placeholder, disabled, readOnly, }) => {
69
+ const locale = usePhiIntlLocale();
70
+ const config = readPhiMoneyFieldConfig(field.config);
71
+ const { currency, currencies, min, max } = config;
72
+ if (currency !== undefined) {
73
+ return (_jsx(PhiMoneyControl, { id: id, value: readPhiMoneyFieldAmount(value, currency)?.minor ?? null, currency: currency, locale: locale, min: min, max: max, placeholder: placeholder, disabled: disabled, readOnly: readOnly, style: { width: "100%" }, onChange: (minor) => onChange?.(minor === null ? null : { currency, minor }) }));
74
+ }
75
+ const list = currencies ?? [];
76
+ const amounts = readPhiMoneyFieldAmounts(value, list);
77
+ return (_jsx(PhiFlexControl, { vertical: true, gap: "small", children: list.map((entry, index) => (_jsx(PhiMoneyControl, {
78
+ // The field's label names the first input; each one after it is named by the label and its currency.
79
+ id: index === 0 ? id : undefined, ariaLabel: index === 0 ? undefined : [label, entry].filter(Boolean).join(" "), value: amounts?.[entry] ?? null, currency: entry, locale: locale, min: min, max: max, placeholder: placeholder, disabled: disabled, readOnly: readOnly, style: { width: "100%" }, onChange: (minor) => onChange?.(updatePhiMoneyFieldAmounts(amounts, list, entry, minor)) }, entry))) }));
80
+ };
@@ -10,6 +10,7 @@ import { isPhiControllerSignalAddress } from "../../types/signals";
10
10
  import { readPhiRuntimeConditionStateSignalValue } from "../../types/runtime-condition";
11
11
  import { collectPhiRuntimeValueConditions } from "../../types/runtime-condition";
12
12
  import { usePhiTableProvider } from "../widgets/client/shared/phi-table-provider";
13
+ import { usePhiIntlLocale, usePhiIntlTimeZone } from "../root/phi-intl-locale";
13
14
  import { PhiFormControl } from "../controls/phi-form-control";
14
15
  import { readPhiRuntimeFormValuesSignalValue } from "./runtime-form-state";
15
16
  import { resolvePhiFormText } from "./form-descriptor-contract";
@@ -40,6 +41,17 @@ export function PhiFormDescriptorRuntimeClient({ descriptor, labels, loadedIniti
40
41
  const emitSignal = usePhiSignalEmitter(identity.sender);
41
42
  const source = widgetConfig?.source ?? null;
42
43
  const { provider, resource, bindingError } = usePhiTableProvider(source);
44
+ /*
45
+ * Sent with the record read, but held in a ref rather than made part of what starts one: a Form's
46
+ * values are what somebody is editing, and a language switch that read the record again would throw
47
+ * their edits away. The next read takes the language that is current then.
48
+ */
49
+ const locale = usePhiIntlLocale();
50
+ const timeZone = usePhiIntlTimeZone();
51
+ const intlRef = useRef({ locale, timeZone });
52
+ useEffect(() => {
53
+ intlRef.current = { locale, timeZone };
54
+ }, [locale, timeZone]);
43
55
  const initialValuesInput = widgetConfig?.formConfig.initialValues;
44
56
  const initialValuesFromQueryInput = widgetConfig?.formConfig.initialValuesFromQuery;
45
57
  const page = usePhiRuntimePageConditionState();
@@ -152,6 +164,7 @@ export function PhiFormDescriptorRuntimeClient({ descriptor, labels, loadedIniti
152
164
  resourceKey: source.resourceKey,
153
165
  rowIdentity,
154
166
  params: source.params,
167
+ ...intlRef.current,
155
168
  signal,
156
169
  });
157
170
  }, [bindingError, configuredInitialValues, provider, resource?.recordRead, source]);