@phis/ui 0.7.8 → 0.8.0

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 (311) hide show
  1. package/components/controls/phi-address-control.d.ts +23 -0
  2. package/components/controls/phi-address-control.js +43 -0
  3. package/components/controls/phi-color-control.d.ts +3 -1
  4. package/components/controls/phi-color-control.js +2 -2
  5. package/components/controls/phi-country-select-control.d.ts +22 -0
  6. package/components/controls/phi-country-select-control.js +16 -0
  7. package/components/controls/phi-dialog-control.d.ts +1 -1
  8. package/components/controls/phi-drawer-control-adapter.d.ts +1 -1
  9. package/components/controls/phi-drawer-control-adapter.js +5 -3
  10. package/components/controls/phi-drawer-control.d.ts +7 -5
  11. package/components/controls/phi-float-button-control.d.ts +8 -1
  12. package/components/controls/phi-float-button-control.js +19 -3
  13. package/components/controls/phi-form-control.js +52 -8
  14. package/components/controls/phi-modal-control-adapter.d.ts +1 -1
  15. package/components/controls/phi-modal-control-adapter.js +14 -37
  16. package/components/controls/phi-modal-control.d.ts +5 -5
  17. package/components/controls/phi-options-provider.d.ts +1 -0
  18. package/components/controls/phi-options-provider.js +1 -0
  19. package/components/controls/phi-overlay-control-contract.d.ts +52 -17
  20. package/components/controls/phi-overlay-control-contract.js +55 -30
  21. package/components/controls/phi-reveal-once-dialog-control.d.ts +21 -0
  22. package/components/controls/phi-reveal-once-dialog-control.js +52 -0
  23. package/components/controls/phi-reveal-once-dialog-labels.d.ts +10 -0
  24. package/components/controls/phi-reveal-once-dialog-labels.js +5 -0
  25. package/components/forms/flags-field.d.ts +22 -0
  26. package/components/forms/flags-field.js +58 -0
  27. package/components/forms/form-option-flags.d.ts +20 -0
  28. package/components/forms/form-option-flags.js +38 -0
  29. package/components/forms/form-provider-contract.d.ts +23 -0
  30. package/components/forms/form-provider-contract.js +36 -0
  31. package/components/forms/form-provider-registry.d.ts +5 -1
  32. package/components/forms/shared-form-provider-registry.js +13 -0
  33. package/components/forms/structured-field-labels.d.ts +24 -0
  34. package/components/forms/structured-field-labels.js +43 -0
  35. package/components/forms/structured-form-field-controls.d.ts +12 -0
  36. package/components/forms/structured-form-field-controls.js +65 -0
  37. package/components/overlays/phi-overlay-container-client.js +2 -2
  38. package/components/regions/phi-cms-region-shell.js +2 -2
  39. package/components/regions/presets/content-entry-editor-page-tree.js +12 -3
  40. package/components/regions/presets/phi-settings-page-shell-tree.d.ts +6 -2
  41. package/components/regions/presets/phi-settings-page-shell-tree.js +1 -1
  42. package/components/root/phi-root-theme-resolver.js +3 -0
  43. package/components/shell/phi-antd-icon.d.ts +1 -8
  44. package/components/shell/phi-antd-icon.js +1 -227
  45. package/components/shell/phi-icon-names.d.ts +19 -0
  46. package/components/shell/phi-icon-names.js +264 -0
  47. package/components/shell/phi-icon.d.ts +2 -11
  48. package/components/shell/phi-icon.js +4 -32
  49. package/components/widgets/client/shared/phi-command-buttons.d.ts +13 -2
  50. package/components/widgets/client/shared/phi-command-buttons.js +10 -4
  51. package/components/widgets/client/shared/phi-rendered-value.js +27 -3
  52. package/components/widgets/client/shared/phi-table-provider-refusal.d.ts +13 -0
  53. package/components/widgets/client/shared/phi-table-provider-refusal.js +13 -0
  54. package/components/widgets/config/background.d.ts +3 -2
  55. package/components/widgets/config/choice-shared.d.ts +10 -1
  56. package/components/widgets/config/choice-shared.js +8 -2
  57. package/components/widgets/label-sets/admin-locales.js +1 -1
  58. package/components/widgets/label-sets/admin-users.d.ts +2 -5
  59. package/components/widgets/label-sets/admin-users.js +4 -10
  60. package/components/widgets/label-sets/effects.js +2 -4
  61. package/components/widgets/label-sets/profile.d.ts +13 -0
  62. package/components/widgets/label-sets/profile.js +28 -0
  63. package/components/widgets/label-sets/search-results.js +2 -4
  64. package/components/widgets/label-sets/table.js +9 -0
  65. package/components/widgets/label-types/effects.d.ts +3 -2
  66. package/components/widgets/label-types/effects.js +1 -2
  67. package/components/widgets/label-types/search-results.d.ts +2 -2
  68. package/components/widgets/label-types/search-results.js +1 -2
  69. package/components/widgets/label-types/table.d.ts +3 -0
  70. package/components/widgets/label-types/table.js +2 -0
  71. package/components/widgets/server/builder-chrome.d.ts +4 -1
  72. package/components/widgets/server/builder-chrome.js +2 -2
  73. package/components/widgets/shared/markdown-body-client.d.ts +26 -0
  74. package/components/widgets/shared/markdown-body-client.js +31 -1
  75. package/components/widgets/shared/markdown-render.d.ts +10 -2
  76. package/components/widgets/shared/markdown-render.js +35 -13
  77. package/constants/countries.d.ts +9 -0
  78. package/constants/countries.js +28 -0
  79. package/constants/customer-file.d.ts +25 -0
  80. package/constants/customer-file.js +26 -0
  81. package/constants/record-field-kinds.d.ts +15 -0
  82. package/constants/record-field-kinds.js +13 -0
  83. package/constants/runtime-module-ownership.js +12 -0
  84. package/constants/runtime-render-client-types.d.ts +5 -0
  85. package/constants/runtime-render-client-types.js +5 -0
  86. package/{plugins/runtime-modules/threads/controller/address.js → constants/threads-controller-address.js} +1 -1
  87. package/constants.d.ts +1 -0
  88. package/constants.js +2 -0
  89. package/gateway/form-handler-request.d.ts +22 -0
  90. package/gateway/form-handler-request.js +40 -0
  91. package/gateway/label-set.d.ts +15 -2
  92. package/gateway/label-set.js +60 -22
  93. package/gateway/site-form-route.js +11 -2
  94. package/helpers/address-field.d.ts +43 -0
  95. package/helpers/address-field.js +68 -0
  96. package/helpers/cms-dialog.d.ts +5 -20
  97. package/helpers/cms-dialog.js +8 -13
  98. package/helpers/cms-page-catalog.d.ts +10 -0
  99. package/helpers/cms-page-catalog.js +19 -0
  100. package/helpers/cms-preset-nodes.d.ts +4 -4
  101. package/helpers/cms-preset-nodes.js +1 -1
  102. package/helpers/cms-region-keys.d.ts +1 -1
  103. package/helpers/country-names.d.ts +12 -0
  104. package/helpers/country-names.js +14 -0
  105. package/helpers/phi-metadata.d.ts +33 -1
  106. package/helpers/phi-metadata.js +62 -1
  107. package/helpers/preset-table-check.d.ts +34 -0
  108. package/helpers/preset-table-check.js +124 -0
  109. package/helpers/preset-text-source-check.d.ts +4 -1
  110. package/helpers/preset-text-source-check.js +6 -1
  111. package/helpers/preset-tree-contract-check.d.ts +3 -2
  112. package/helpers/preset-tree-contract-check.js +30 -5
  113. package/helpers/public-route-claims.d.ts +9 -1
  114. package/helpers/public-route-claims.js +23 -3
  115. package/helpers/record-fields.d.ts +1 -5
  116. package/helpers/record-fields.js +15 -6
  117. package/helpers/route-address-check.d.ts +22 -2
  118. package/helpers/route-address-check.js +29 -8
  119. package/helpers/site-address-row.d.ts +23 -0
  120. package/helpers/site-address-row.js +36 -0
  121. package/helpers/surface-style.d.ts +8 -1
  122. package/helpers/surface-style.js +12 -2
  123. package/helpers/thread-inbox-row.d.ts +20 -0
  124. package/helpers/thread-inbox-row.js +26 -0
  125. package/helpers/translation-format.d.ts +26 -0
  126. package/helpers/translation-format.js +31 -0
  127. package/module-labels.d.ts +1 -1
  128. package/module-labels.js +1 -1
  129. package/module-page-check.d.ts +1 -0
  130. package/module-page-check.js +1 -0
  131. package/module-records.d.ts +2 -2
  132. package/module-records.js +1 -0
  133. package/next/area-route.js +34 -1
  134. package/next/root-route.js +4 -5
  135. package/package.json +2 -2
  136. package/plugins/runtime-modules/accounting/customer-file-access.d.ts +11 -0
  137. package/plugins/runtime-modules/accounting/customer-file-access.js +12 -0
  138. package/plugins/runtime-modules/accounting/data-providers.js +1 -1
  139. package/plugins/runtime-modules/accounting/ids.d.ts +11 -0
  140. package/plugins/runtime-modules/accounting/ids.js +23 -0
  141. package/plugins/runtime-modules/accounting/presets.js +32 -5
  142. package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +66 -0
  143. package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +122 -0
  144. package/plugins/runtime-modules/accounting/trees/accounting-products-label-set.js +2 -2
  145. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +26 -0
  146. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +381 -0
  147. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.js +4 -0
  148. package/plugins/runtime-modules/app/client-data-providers.d.ts +7 -0
  149. package/plugins/runtime-modules/app/client-data-providers.js +9 -0
  150. package/plugins/runtime-modules/app/data-providers.d.ts +98 -0
  151. package/plugins/runtime-modules/app/data-providers.js +80 -0
  152. package/plugins/runtime-modules/app/definition.d.ts +131 -0
  153. package/plugins/runtime-modules/app/definition.js +2 -0
  154. package/plugins/runtime-modules/app/forms.d.ts +46 -1
  155. package/plugins/runtime-modules/app/forms.js +195 -1
  156. package/plugins/runtime-modules/app/ids.d.ts +7 -0
  157. package/plugins/runtime-modules/app/ids.js +8 -0
  158. package/plugins/runtime-modules/app/module.d.ts +131 -0
  159. package/plugins/runtime-modules/app/services/addresses-table.d.ts +135 -0
  160. package/plugins/runtime-modules/app/services/addresses-table.js +101 -0
  161. package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +17 -0
  162. package/plugins/runtime-modules/app/trees/account-addresses-panel.js +179 -0
  163. package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +62 -0
  164. package/plugins/runtime-modules/app/trees/addresses-label-set.js +108 -0
  165. package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +27 -2
  166. package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +1 -0
  167. package/plugins/runtime-modules/app/trees/profile-label-set.js +3 -0
  168. package/plugins/runtime-modules/asset/presets.d.ts +4 -0
  169. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +4 -2
  170. package/plugins/runtime-modules/auth/trees/phi-auth-area-overlay-tree.server.js +4 -2
  171. package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +2 -2
  172. package/plugins/runtime-modules/auth/widgets/logout/client.d.ts +1 -1
  173. package/plugins/runtime-modules/auth/widgets/logout/client.js +2 -2
  174. package/plugins/runtime-modules/auth/widgets/security/client.d.ts +5 -1
  175. package/plugins/runtime-modules/auth/widgets/security/client.js +12 -10
  176. package/plugins/runtime-modules/avatar/overlay-tree.server.js +1 -1
  177. package/plugins/runtime-modules/blog/presets.d.ts +4 -0
  178. package/plugins/runtime-modules/builder/clients/inspector-image-field.d.ts +2 -1
  179. package/plugins/runtime-modules/builder/clients/inspector-image-field.js +3 -2
  180. package/plugins/runtime-modules/builder/clients/metadata-table-provider-stand-ins.d.ts +23 -0
  181. package/plugins/runtime-modules/builder/clients/metadata-table-provider-stand-ins.js +38 -0
  182. package/plugins/runtime-modules/builder/clients/mode-switch.d.ts +4 -1
  183. package/plugins/runtime-modules/builder/clients/mode-switch.js +2 -15
  184. package/plugins/runtime-modules/builder/clients/pages-workspace.js +2 -0
  185. package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +2 -1
  186. package/plugins/runtime-modules/builder/controller/draft-status-controller.js +28 -1
  187. package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +5 -0
  188. package/plugins/runtime-modules/builder/page-presets.server.d.ts +7 -0
  189. package/plugins/runtime-modules/builder/page-presets.server.js +10 -1
  190. package/plugins/runtime-modules/builder/persistence.js +4 -0
  191. package/plugins/runtime-modules/builder/public-route-collisions.js +8 -3
  192. package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +3 -1
  193. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +33 -6
  194. package/plugins/runtime-modules/builder/widgets/chrome/config.d.ts +6 -4
  195. package/plugins/runtime-modules/builder/widgets/chrome/config.js +11 -1
  196. package/plugins/runtime-modules/builder/widgets/inspector-header/authoring.d.ts +2 -2
  197. package/plugins/runtime-modules/builder/widgets/inspector-header/plugin.d.ts +2 -2
  198. package/plugins/runtime-modules/builder/widgets/mode-switch/plugin.js +1 -1
  199. package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +2 -2
  200. package/plugins/runtime-modules/client-manifests/app.js +3 -0
  201. package/plugins/runtime-modules/client-manifests/builder.js +10 -0
  202. package/plugins/runtime-modules/content-entry-routes.d.ts +4 -0
  203. package/plugins/runtime-modules/contracts.js +31 -1
  204. package/plugins/runtime-modules/core/definition.d.ts +23 -0
  205. package/plugins/runtime-modules/core/form-providers.d.ts +23 -0
  206. package/plugins/runtime-modules/core/messaging/thread-inbox-table.d.ts +0 -17
  207. package/plugins/runtime-modules/core/messaging/thread-inbox-table.js +2 -23
  208. package/plugins/runtime-modules/core/widgets/card/config.d.ts +0 -1
  209. package/plugins/runtime-modules/core/widgets/card/config.js +0 -1
  210. package/plugins/runtime-modules/core/widgets/card/editor.js +1 -1
  211. package/plugins/runtime-modules/core/widgets/command-toolbar/client.js +3 -0
  212. package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +316 -1
  213. package/plugins/runtime-modules/core/widgets/command-toolbar/config.js +4 -4
  214. package/plugins/runtime-modules/core/widgets/dimension/config.d.ts +1 -1
  215. package/plugins/runtime-modules/core/widgets/float-button/client.js +4 -1
  216. package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +326 -3
  217. package/plugins/runtime-modules/core/widgets/float-button/config.js +5 -2
  218. package/plugins/runtime-modules/core/widgets/header-navigation/client.js +1 -1
  219. package/plugins/runtime-modules/core/widgets/length/config.d.ts +1 -1
  220. package/plugins/runtime-modules/core/widgets/markdown/plugin.js +20 -7
  221. package/plugins/runtime-modules/core/widgets/markdown/server.d.ts +6 -2
  222. package/plugins/runtime-modules/core/widgets/markdown/server.js +2 -2
  223. package/plugins/runtime-modules/core/widgets/markdown/table-embeds.server.d.ts +12 -0
  224. package/plugins/runtime-modules/core/widgets/markdown/table-embeds.server.js +68 -0
  225. package/plugins/runtime-modules/core/widgets/number-input/config.d.ts +1 -1
  226. package/plugins/runtime-modules/core/widgets/simple-text/config.js +1 -1
  227. package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +2 -1
  228. package/plugins/runtime-modules/core/widgets/table/client.js +20 -5
  229. package/plugins/runtime-modules/core/widgets/table/config.js +6 -0
  230. package/plugins/runtime-modules/core/widgets/table/reader-query.d.ts +17 -0
  231. package/plugins/runtime-modules/core/widgets/table/reader-query.js +33 -0
  232. package/plugins/runtime-modules/dashboard/trees/dashboard-cards-page-tree.js +3 -1
  233. package/plugins/runtime-modules/descriptor-compiler.d.ts +19 -3
  234. package/plugins/runtime-modules/descriptor-compiler.js +44 -16
  235. package/plugins/runtime-modules/editor/presets.d.ts +4 -0
  236. package/plugins/runtime-modules/editor/trees/phi-default-editor-releases-page-tree.js +3 -1
  237. package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +5 -1
  238. package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +5 -1
  239. package/plugins/runtime-modules/localization/presets.d.ts +4 -0
  240. package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +3 -1
  241. package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +4 -2
  242. package/plugins/runtime-modules/news/presets.d.ts +4 -0
  243. package/plugins/runtime-modules/observability/trees/phi-default-admin-logs-page-tree.js +6 -2
  244. package/plugins/runtime-modules/resolver.js +17 -0
  245. package/plugins/runtime-modules/revisions/controller/client.js +13 -11
  246. package/plugins/runtime-modules/revisions/controller/draft-context-target.d.ts +25 -0
  247. package/plugins/runtime-modules/revisions/controller/draft-context-target.js +33 -0
  248. package/plugins/runtime-modules/revisions/presets.d.ts +4 -0
  249. package/plugins/runtime-modules/revisions/services/table.js +13 -4
  250. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +3 -1
  251. package/plugins/runtime-modules/search/widgets/search-results/client.js +4 -2
  252. package/plugins/runtime-modules/theme/presets.d.ts +4 -0
  253. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +76 -4
  254. package/plugins/runtime-modules/theme/widgets/brand-controls/config.d.ts +3 -2
  255. package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +2 -2
  256. package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +19 -7
  257. package/plugins/runtime-modules/threads/client-data-providers.js +5 -0
  258. package/plugins/runtime-modules/threads/controller/definition.js +1 -1
  259. package/plugins/runtime-modules/threads/data-providers.d.ts +115 -2
  260. package/plugins/runtime-modules/threads/data-providers.js +85 -0
  261. package/plugins/runtime-modules/threads/definition.d.ts +115 -2
  262. package/plugins/runtime-modules/threads/definition.js +1 -1
  263. package/plugins/runtime-modules/threads/ids.d.ts +2 -0
  264. package/plugins/runtime-modules/threads/ids.js +3 -0
  265. package/plugins/runtime-modules/threads/services/customer-file-table.d.ts +192 -0
  266. package/plugins/runtime-modules/threads/services/customer-file-table.js +164 -0
  267. package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +5 -3
  268. package/plugins/runtime-modules/user-management/client-data-providers.js +5 -0
  269. package/plugins/runtime-modules/user-management/data-providers.d.ts +159 -0
  270. package/plugins/runtime-modules/user-management/data-providers.js +101 -3
  271. package/plugins/runtime-modules/user-management/definition.d.ts +159 -0
  272. package/plugins/runtime-modules/user-management/ids.d.ts +9 -0
  273. package/plugins/runtime-modules/user-management/ids.js +9 -0
  274. package/plugins/runtime-modules/user-management/presets.js +17 -1
  275. package/plugins/runtime-modules/user-management/services/users-access-table.d.ts +378 -0
  276. package/plugins/runtime-modules/user-management/services/users-access-table.js +132 -0
  277. package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.d.ts +86 -0
  278. package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +118 -0
  279. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.d.ts +20 -0
  280. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js +166 -0
  281. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +19 -18
  282. package/server-helpers/cms-page-record.d.ts +9 -1
  283. package/server-helpers/cms-page-record.js +11 -1
  284. package/server-helpers/cms-request.js +8 -5
  285. package/server-helpers/link-preview-image.d.ts +30 -0
  286. package/server-helpers/link-preview-image.js +57 -0
  287. package/server-helpers/search-text.js +3 -0
  288. package/server-helpers.d.ts +1 -1
  289. package/server-helpers.js +1 -1
  290. package/styles/shell.css +30 -6
  291. package/theme/phi-theme-composition.js +9 -0
  292. package/theme/phi-theme-inverse-ground.d.ts +39 -0
  293. package/theme/phi-theme-inverse-ground.js +103 -0
  294. package/theme/phi-theme-tokens.d.ts +2 -1
  295. package/theme/phi-theme-tokens.js +2 -0
  296. package/types/cms-module-descriptors.d.ts +14 -0
  297. package/types/cms-overlay.d.ts +13 -6
  298. package/types/cms-overlay.js +6 -22
  299. package/types/cms-plugins.d.ts +14 -2
  300. package/types/cms.d.ts +10 -0
  301. package/types/core-widget-placements.d.ts +3 -3
  302. package/types/link-preview.d.ts +19 -0
  303. package/types/link-preview.js +19 -0
  304. package/types/record-provider.d.ts +22 -1
  305. package/types/site-theme.d.ts +27 -0
  306. package/types/table-embed.d.ts +48 -0
  307. package/types/table-embed.js +1 -0
  308. package/types/table-widget.d.ts +14 -0
  309. package/types/widget-runtime.d.ts +3 -0
  310. package/types.d.ts +1 -0
  311. /package/{plugins/runtime-modules/threads/controller/address.d.ts → constants/threads-controller-address.d.ts} +0 -0
@@ -1,7 +1,8 @@
1
1
  import type { CSSProperties, ReactNode } from "react";
2
+ import type { PhiControlSize } from "../../types/control";
2
3
  import type { PhiCmsMountPolicy } from "../../types/cms-mount-policy";
3
- import type { PhiCmsOverlaySize, PhiOverlayCloseSource, PhiOverlayMaskBehaviour } from "../../types/cms-overlay";
4
- import { type PhiResolvedResponsiveValue, type PhiResponsiveValue } from "../../types/responsive";
4
+ import type { PhiCmsOverlayConfig, PhiOverlayCloseSource, PhiOverlayMaskBehaviour } from "../../types/cms-overlay";
5
+ import type { PhiRenderableBlockSize } from "../../types/renderable-block";
5
6
  export type PhiOverlayControlDismissEvent = {
6
7
  target: EventTarget | null;
7
8
  key?: string;
@@ -55,26 +56,60 @@ export declare function resolvePhiOverlayMaskPresentation(mask: PhiOverlayMaskBe
55
56
  background?: string | undefined;
56
57
  };
57
58
  };
58
- export type PhiModalWidth = PhiCmsOverlaySize | PhiResponsiveValue<PhiCmsOverlaySize>;
59
- export type PhiModalResponsiveMode = keyof PhiResolvedResponsiveValue<unknown>;
60
59
  /**
61
- * Where a Modal's width switches from `compact` to `medium` and from `medium` to `wide`.
60
+ * An Overlay's geometry as a Control takes it: the block's own three pairs (`PhiCmsOverlayConfig`), one
61
+ * value per axis.
62
+ */
63
+ export type PhiOverlayControlGeometryProps = {
64
+ size?: PhiRenderableBlockSize | null;
65
+ minSize?: PhiRenderableBlockSize | null;
66
+ maxSize?: PhiRenderableBlockSize | null;
67
+ };
68
+ /** The width each `controlSize` step gives a Modal whose `size` names none. */
69
+ export declare const PHI_MODAL_WIDTH_BY_CONTROL_SIZE: Record<PhiControlSize, number>;
70
+ /** What a Modal draws of its geometry, as CSS: the dialog's width and box, and its container's height. */
71
+ export type PhiModalGeometry = {
72
+ /** Handed to the Modal as its width; undefined leaves it Ant Design's default. */
73
+ width: string | undefined;
74
+ minWidth: string | undefined;
75
+ maxWidth: string;
76
+ blockSize: string | undefined;
77
+ minBlockSize: string | undefined;
78
+ maxBlockSize: string;
79
+ };
80
+ /**
81
+ * A Modal's geometry, read once through the block's resolver.
62
82
  *
63
- * The container scale, the same pair the Form switches at, and not Ant Design's device breakpoints
64
- * (768/992): a Modal's box is the viewport it floats in, and a width stated per mode means "this much
65
- * room is there", which is the question the container scale answers.
83
+ * The width is the one a Signal told (`toldSize`, the `size` input), else the stated `size`, else the
84
+ * `controlSize` step; the height the told one, else the stated one, else none -- the Modal is as tall as
85
+ * its content up to the viewport. A minimum and a maximum are the stated ones, each held inside the
86
+ * viewport room, and with no maximum stated the viewport room is the maximum.
66
87
  */
67
- export declare const PHI_MODAL_RESPONSIVE_MIN_WIDTH: {
68
- readonly medium: 144 | 233 | 377 | 610 | 987;
69
- readonly wide: 144 | 233 | 377 | 610 | 987;
88
+ export declare function resolvePhiModalGeometry({ size, minSize, maxSize, toldSize, controlSize, }: PhiOverlayControlGeometryProps & {
89
+ toldSize?: PhiRenderableBlockSize | null;
90
+ controlSize?: PhiControlSize;
91
+ }): PhiModalGeometry;
92
+ /** What a Drawer draws of its geometry: the length along the axis it opens on, and its bounds. */
93
+ export type PhiDrawerGeometry = {
94
+ /**
95
+ * Handed to the Drawer as its `size`, a pixel length as a number (the Drawer warns on a string that is
96
+ * one); undefined leaves it Ant Design's default.
97
+ */
98
+ size: number | string | undefined;
99
+ /** How far a resizable Drawer may be dragged, where the stated maximum is in pixels. */
100
+ resizeMaxSize: number | undefined;
101
+ /** The bounds on the panel (`min-width`/`max-width`, or the height pair at `top` and `bottom`). */
102
+ style: CSSProperties;
70
103
  };
71
- export declare function resolvePhiModalResponsiveMode(availableWidth: number): PhiModalResponsiveMode;
72
104
  /**
73
- * The one width a Modal takes at one mode.
105
+ * A Drawer's geometry, read once through the block's resolver.
74
106
  *
75
- * A responsive width cascades like every responsive value (`resolvePhiResponsiveValue`): an unset mode
76
- * takes the nearest smaller one that is set, and a mode below every stated one takes `fallback` -- the
77
- * width `controlSize` gives, or none, which leaves the Modal its own default.
107
+ * A Drawer opens along one axis: `width` at `left` and `right`, `height` at `top` and `bottom`. The other
108
+ * axis is the viewport's, and what a config states for it is not drawn. The maximum reaches the panel as
109
+ * CSS whatever its unit, and Ant Design's resize as a limit only where it is in pixels, the one unit a
110
+ * drag counts in.
78
111
  */
79
- export declare function resolvePhiModalWidth(width: PhiModalWidth | undefined, fallback: PhiCmsOverlaySize | undefined, mode: PhiModalResponsiveMode): PhiCmsOverlaySize | undefined;
112
+ export declare function resolvePhiDrawerGeometry({ size, minSize, maxSize, placement, }: PhiOverlayControlGeometryProps & {
113
+ placement: PhiCmsOverlayConfig["placement"];
114
+ }): PhiDrawerGeometry;
80
115
  export declare function resolvePhiOverlayDismissSource(event: PhiOverlayControlDismissEvent): PhiOverlayCloseSource;
@@ -1,5 +1,5 @@
1
- import { PHI_CONTAINER_BREAKPOINT_COL3, PHI_CONTAINER_BREAKPOINT_CONTENT, } from "../../theme/phi-container-breakpoints";
2
- import { resolvePhiResponsiveValue, } from "../../types/responsive";
1
+ import { PHI_SPACE } from "../../theme/antd-css-var-contract";
2
+ import { resolvePhiRenderableBlockGeometry, } from "../../types/renderable-block-geometry";
3
3
  export const PHI_OVERLAY_DEFAULT_MASK = {
4
4
  appearance: "normal",
5
5
  allowOutsideInteraction: false,
@@ -36,41 +36,66 @@ export function resolvePhiOverlayMaskPresentation(mask) {
36
36
  },
37
37
  };
38
38
  }
39
+ /** The width each `controlSize` step gives a Modal whose `size` names none. */
40
+ export const PHI_MODAL_WIDTH_BY_CONTROL_SIZE = {
41
+ small: 520,
42
+ medium: 720,
43
+ large: 960,
44
+ };
39
45
  /**
40
- * Where a Modal's width switches from `compact` to `medium` and from `medium` to `wide`.
46
+ * The room a Modal never leaves: one `base` step clear of the viewport on both inline sides, one `lg`
47
+ * step on both block sides. Every stated length is held inside it, a minimum included, so a floor that
48
+ * keeps a Form in two columns on a desk does not push the dialog off a phone.
49
+ */
50
+ const PHI_MODAL_VIEWPORT_INLINE = `calc(100vw - ${PHI_SPACE.base} - ${PHI_SPACE.base})`;
51
+ const PHI_MODAL_VIEWPORT_BLOCK = `calc(100dvh - ${PHI_SPACE.lg} - ${PHI_SPACE.lg})`;
52
+ function withinViewport(length, viewport) {
53
+ return length == null ? undefined : `min(${length.css}, ${viewport})`;
54
+ }
55
+ /**
56
+ * A Modal's geometry, read once through the block's resolver.
41
57
  *
42
- * The container scale, the same pair the Form switches at, and not Ant Design's device breakpoints
43
- * (768/992): a Modal's box is the viewport it floats in, and a width stated per mode means "this much
44
- * room is there", which is the question the container scale answers.
58
+ * The width is the one a Signal told (`toldSize`, the `size` input), else the stated `size`, else the
59
+ * `controlSize` step; the height the told one, else the stated one, else none -- the Modal is as tall as
60
+ * its content up to the viewport. A minimum and a maximum are the stated ones, each held inside the
61
+ * viewport room, and with no maximum stated the viewport room is the maximum.
45
62
  */
46
- export const PHI_MODAL_RESPONSIVE_MIN_WIDTH = {
47
- medium: PHI_CONTAINER_BREAKPOINT_COL3,
48
- wide: PHI_CONTAINER_BREAKPOINT_CONTENT,
49
- };
50
- export function resolvePhiModalResponsiveMode(availableWidth) {
51
- if (availableWidth >= PHI_MODAL_RESPONSIVE_MIN_WIDTH.wide)
52
- return "wide";
53
- if (availableWidth >= PHI_MODAL_RESPONSIVE_MIN_WIDTH.medium)
54
- return "medium";
55
- return "compact";
63
+ export function resolvePhiModalGeometry({ size, minSize, maxSize, toldSize, controlSize, }) {
64
+ const stated = resolvePhiRenderableBlockGeometry({ size, minSize, maxSize });
65
+ const told = resolvePhiRenderableBlockGeometry({ size: toldSize });
66
+ const width = told.inline.size?.css
67
+ ?? stated.inline.size?.css
68
+ ?? (controlSize == null ? undefined : `${PHI_MODAL_WIDTH_BY_CONTROL_SIZE[controlSize]}px`);
69
+ return {
70
+ width,
71
+ minWidth: withinViewport(stated.inline.min, PHI_MODAL_VIEWPORT_INLINE),
72
+ maxWidth: withinViewport(stated.inline.max, PHI_MODAL_VIEWPORT_INLINE) ?? PHI_MODAL_VIEWPORT_INLINE,
73
+ blockSize: told.block.size?.css ?? stated.block.size?.css,
74
+ minBlockSize: withinViewport(stated.block.min, PHI_MODAL_VIEWPORT_BLOCK),
75
+ maxBlockSize: withinViewport(stated.block.max, PHI_MODAL_VIEWPORT_BLOCK) ?? PHI_MODAL_VIEWPORT_BLOCK,
76
+ };
56
77
  }
57
78
  /**
58
- * The one width a Modal takes at one mode.
79
+ * A Drawer's geometry, read once through the block's resolver.
59
80
  *
60
- * A responsive width cascades like every responsive value (`resolvePhiResponsiveValue`): an unset mode
61
- * takes the nearest smaller one that is set, and a mode below every stated one takes `fallback` -- the
62
- * width `controlSize` gives, or none, which leaves the Modal its own default.
81
+ * A Drawer opens along one axis: `width` at `left` and `right`, `height` at `top` and `bottom`. The other
82
+ * axis is the viewport's, and what a config states for it is not drawn. The maximum reaches the panel as
83
+ * CSS whatever its unit, and Ant Design's resize as a limit only where it is in pixels, the one unit a
84
+ * drag counts in.
63
85
  */
64
- export function resolvePhiModalWidth(width, fallback, mode) {
65
- if (width == null)
66
- return fallback;
67
- if (typeof width !== "object")
68
- return width;
69
- return resolvePhiResponsiveValue(width, {
70
- compact: fallback,
71
- medium: fallback,
72
- wide: fallback,
73
- })[mode];
86
+ export function resolvePhiDrawerGeometry({ size, minSize, maxSize, placement, }) {
87
+ const geometry = resolvePhiRenderableBlockGeometry({ size, minSize, maxSize });
88
+ const horizontal = placement === "left" || placement === "right";
89
+ const axis = horizontal ? geometry.inline : geometry.block;
90
+ const min = axis.min?.css;
91
+ const max = axis.max?.css;
92
+ return {
93
+ size: axis.size?.part?.unit === "px" ? axis.size.part.value : axis.size?.css,
94
+ resizeMaxSize: axis.max?.part?.unit === "px" ? axis.max.part.value : undefined,
95
+ style: horizontal
96
+ ? { ...(min == null ? null : { minWidth: min }), ...(max == null ? null : { maxWidth: max }) }
97
+ : { ...(min == null ? null : { minHeight: min }), ...(max == null ? null : { maxHeight: max }) },
98
+ };
74
99
  }
75
100
  export function resolvePhiOverlayDismissSource(event) {
76
101
  if ("key" in event && event.key === "Escape")
@@ -0,0 +1,21 @@
1
+ import { type PhiRevealOnceDialogLabels } from "./phi-reveal-once-dialog-labels";
2
+ /** Writes the value to the clipboard: true where it was written, false where the browser refused. */
3
+ export declare function copyPhiRevealedValue(value: string, clipboard?: Pick<Clipboard, "writeText"> | undefined): Promise<boolean>;
4
+ export type PhiRevealOnceDialogControlProps = {
5
+ /** The value shown once -- a new key's activation code. Null closes the Dialog. */
6
+ value: string | null;
7
+ title: string;
8
+ /** What the reader is told about it: that it is shown only now. */
9
+ description?: string;
10
+ labels?: Partial<PhiRevealOnceDialogLabels>;
11
+ /** Called when the Dialog closes, copied or not; the caller forgets the value then. */
12
+ onClose: () => void;
13
+ };
14
+ /**
15
+ * A value shown once, in a Dialog that copies it and closes: the answer of an act whose result is not kept
16
+ * anywhere it could be read again -- an activation code stored as its hash. The value stands in a code
17
+ * box the reader can select; "Copy and close" writes it to the clipboard and closes, and where the browser
18
+ * refuses, the Dialog stays open and says so. Nothing here keeps the value: the caller holds it until
19
+ * `onClose` and drops it then.
20
+ */
21
+ export declare function PhiRevealOnceDialogControl({ value, title, description, labels, onClose, }: PhiRevealOnceDialogControlProps): import("react").JSX.Element;
@@ -0,0 +1,52 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { PhiDialogControl } from "./phi-dialog-control";
5
+ import { PhiTypographyControl } from "./phi-typography-control";
6
+ import { PhiIcon } from "../shell/phi-icon";
7
+ import { PHI_REVEAL_ONCE_DIALOG_DEFAULT_LABELS } from "./phi-reveal-once-dialog-labels";
8
+ /** Writes the value to the clipboard: true where it was written, false where the browser refused. */
9
+ export async function copyPhiRevealedValue(value, clipboard = typeof navigator === "undefined" ? undefined : navigator.clipboard) {
10
+ if (!clipboard)
11
+ return false;
12
+ try {
13
+ await clipboard.writeText(value);
14
+ return true;
15
+ }
16
+ catch {
17
+ return false;
18
+ }
19
+ }
20
+ /**
21
+ * A value shown once, in a Dialog that copies it and closes: the answer of an act whose result is not kept
22
+ * anywhere it could be read again -- an activation code stored as its hash. The value stands in a code
23
+ * box the reader can select; "Copy and close" writes it to the clipboard and closes, and where the browser
24
+ * refuses, the Dialog stays open and says so. Nothing here keeps the value: the caller holds it until
25
+ * `onClose` and drops it then.
26
+ */
27
+ export function PhiRevealOnceDialogControl({ value, title, description, labels, onClose, }) {
28
+ const words = { ...PHI_REVEAL_ONCE_DIALOG_DEFAULT_LABELS, ...labels };
29
+ const [failed, setFailed] = useState(false);
30
+ const close = () => {
31
+ setFailed(false);
32
+ onClose();
33
+ };
34
+ const copyAndClose = async () => {
35
+ if (value == null)
36
+ return;
37
+ if (await copyPhiRevealedValue(value))
38
+ close();
39
+ else
40
+ setFailed(true);
41
+ };
42
+ return (_jsxs(PhiDialogControl, { open: value != null, title: title, alert: failed ? { level: "warning", showIcon: true, title: words.copyFailed } : null, actions: [
43
+ { key: "close", label: words.close, onClick: close },
44
+ {
45
+ key: "copy",
46
+ label: words.copyAndClose,
47
+ type: "primary",
48
+ icon: _jsx(PhiIcon, { name: "copy", size: "inherit" }),
49
+ onClick: () => void copyAndClose(),
50
+ },
51
+ ], onDismiss: close, children: [description ? _jsx(PhiTypographyControl, { type: "secondary", children: description }) : null, _jsx(PhiTypographyControl, { code: true, style: { fontSize: "1.25em", userSelect: "all", wordBreak: "break-all" }, children: value ?? "" })] }));
52
+ }
@@ -0,0 +1,10 @@
1
+ /** The words of `PhiRevealOnceDialogControl`, apart from it so a server Label Set can name them. */
2
+ export type PhiRevealOnceDialogLabels = {
3
+ /** The primary button: copies the value and closes. */
4
+ copyAndClose: string;
5
+ /** Closes without copying. */
6
+ close: string;
7
+ /** Said where the browser refused the copy; the value stays on screen to be selected by hand. */
8
+ copyFailed: string;
9
+ };
10
+ export declare const PHI_REVEAL_ONCE_DIALOG_DEFAULT_LABELS: PhiRevealOnceDialogLabels;
@@ -0,0 +1,5 @@
1
+ export const PHI_REVEAL_ONCE_DIALOG_DEFAULT_LABELS = {
2
+ copyAndClose: "Copy and close",
3
+ close: "Close",
4
+ copyFailed: "The value could not be copied. Select it and copy it by hand before closing.",
5
+ };
@@ -0,0 +1,22 @@
1
+ import type { PhiControlOption } from "../controls/phi-control-options";
2
+ /**
3
+ * The `flags` field: several yes-or-no answers held as one bit-flag number, the shape every yes-or-no
4
+ * state of a Core contract has. Each option's `value` is its bit, written as the decimal number
5
+ * (`"1"`, `"2"`, `"4"`, ...); the value is the sum of the bits checked, `0` for none. `config.requires`
6
+ * names, by option value, the option an option needs: it is offered only while that one is checked and
7
+ * is cleared when it is unchecked -- a default only for a purpose the address has.
8
+ */
9
+ export type PhiFlagsFieldConfig = {
10
+ bits: ReadonlyMap<string, number>;
11
+ requires: ReadonlyMap<number, number>;
12
+ };
13
+ /** The field's bits and dependencies, or an Error naming what is wrong: a field nobody can read the value of is refused. */
14
+ export declare function readPhiFlagsFieldConfig(config: Readonly<Record<string, unknown>> | undefined, options: readonly Pick<PhiControlOption, "value">[]): PhiFlagsFieldConfig;
15
+ /** The value as a number of the field's bits: anything else is none, and bits it does not offer are kept. */
16
+ export declare function readPhiFlagsFieldValue(value: unknown): number;
17
+ /**
18
+ * The value after a change of the checked options: the bits of those checked set, the field's other bits
19
+ * cleared, an option whose required one is not set cleared with it, and bits the field does not offer
20
+ * kept as they were.
21
+ */
22
+ export declare function writePhiFlagsFieldValue(config: PhiFlagsFieldConfig, previous: number, checked: readonly string[]): number;
@@ -0,0 +1,58 @@
1
+ import { isPhiRecord } from "../../helpers/is-record";
2
+ function readBit(value, where) {
3
+ const bit = /^[1-9][0-9]*$/u.test(value) ? Number(value) : Number.NaN;
4
+ if (!Number.isSafeInteger(bit) || (bit & (bit - 1)) !== 0) {
5
+ throw new Error(`The flags field ${where} "${value}" is no bit: an option's value is a power of two as a decimal number.`);
6
+ }
7
+ return bit;
8
+ }
9
+ /** The field's bits and dependencies, or an Error naming what is wrong: a field nobody can read the value of is refused. */
10
+ export function readPhiFlagsFieldConfig(config, options) {
11
+ const bits = new Map();
12
+ let all = 0;
13
+ for (const option of options) {
14
+ const bit = readBit(option.value, "option");
15
+ if ((all & bit) !== 0)
16
+ throw new Error(`The flags field names the bit ${bit} twice.`);
17
+ all |= bit;
18
+ bits.set(option.value, bit);
19
+ }
20
+ const requires = new Map();
21
+ const stated = config?.requires;
22
+ if (stated !== undefined) {
23
+ if (!isPhiRecord(stated)) {
24
+ throw new Error("The flags field's requires is no map of option values.");
25
+ }
26
+ for (const [dependent, needed] of Object.entries(stated)) {
27
+ const dependentBit = bits.get(dependent);
28
+ const neededBit = typeof needed === "string" ? bits.get(needed) : undefined;
29
+ if (dependentBit === undefined || neededBit === undefined || dependentBit === neededBit) {
30
+ throw new Error(`The flags field's requires names "${dependent}" -> "${String(needed)}", which are not two of its options.`);
31
+ }
32
+ requires.set(dependentBit, neededBit);
33
+ }
34
+ }
35
+ return { bits, requires };
36
+ }
37
+ /** The value as a number of the field's bits: anything else is none, and bits it does not offer are kept. */
38
+ export function readPhiFlagsFieldValue(value) {
39
+ return Number.isSafeInteger(value) && value >= 0 ? value : 0;
40
+ }
41
+ /**
42
+ * The value after a change of the checked options: the bits of those checked set, the field's other bits
43
+ * cleared, an option whose required one is not set cleared with it, and bits the field does not offer
44
+ * kept as they were.
45
+ */
46
+ export function writePhiFlagsFieldValue(config, previous, checked) {
47
+ let offered = 0;
48
+ for (const bit of config.bits.values())
49
+ offered |= bit;
50
+ let next = previous & ~offered;
51
+ for (const value of checked)
52
+ next |= config.bits.get(value) ?? 0;
53
+ for (const [dependent, needed] of config.requires) {
54
+ if ((next & needed) === 0)
55
+ next &= ~dependent;
56
+ }
57
+ return next;
58
+ }
@@ -0,0 +1,20 @@
1
+ import type { PhiFormFieldDescriptor } from "../../types/form-descriptor";
2
+ /**
3
+ * The fields whose chosen option an `optionFlag` condition of the Form reads, by key.
4
+ *
5
+ * Only these report their option's flags upward: every other field's options stay its own business, so
6
+ * a Form without such a condition renders exactly as before.
7
+ */
8
+ export declare function collectFormOptionFlagFieldKeys(fields: readonly PhiFormFieldDescriptor[]): ReadonlySet<string>;
9
+ /**
10
+ * The flags of what a field holds, among the options it offers: every chosen option's `flags` together,
11
+ * 0 for a field that holds nothing.
12
+ *
13
+ * `undefined` where a held value is among none of the options -- the list still loading, or a value the
14
+ * answer left out -- because then nobody knows what was chosen, and an `optionFlag` condition on it is
15
+ * unavailable rather than false.
16
+ */
17
+ export declare function resolveFormChosenOptionFlags(options: readonly {
18
+ value: string | number;
19
+ flags?: number;
20
+ }[] | null | undefined, held: unknown): number | undefined;
@@ -0,0 +1,38 @@
1
+ import { collectPhiRuntimeValueConditions } from "../../types/runtime-condition";
2
+ /**
3
+ * The fields whose chosen option an `optionFlag` condition of the Form reads, by key.
4
+ *
5
+ * Only these report their option's flags upward: every other field's options stay its own business, so
6
+ * a Form without such a condition renders exactly as before.
7
+ */
8
+ export function collectFormOptionFlagFieldKeys(fields) {
9
+ const keys = new Set();
10
+ for (const field of fields) {
11
+ for (const expression of [field.visibleWhen, field.disabledWhen]) {
12
+ for (const condition of collectPhiRuntimeValueConditions(expression)) {
13
+ if (condition.operator === "optionFlag")
14
+ keys.add(condition.valuePath);
15
+ }
16
+ }
17
+ }
18
+ return keys;
19
+ }
20
+ /**
21
+ * The flags of what a field holds, among the options it offers: every chosen option's `flags` together,
22
+ * 0 for a field that holds nothing.
23
+ *
24
+ * `undefined` where a held value is among none of the options -- the list still loading, or a value the
25
+ * answer left out -- because then nobody knows what was chosen, and an `optionFlag` condition on it is
26
+ * unavailable rather than false.
27
+ */
28
+ export function resolveFormChosenOptionFlags(options, held) {
29
+ const values = (Array.isArray(held) ? held : [held]).filter((entry) => (typeof entry === "string" && entry !== "") || (typeof entry === "number" && Number.isFinite(entry)));
30
+ let flags = 0;
31
+ for (const value of values) {
32
+ const option = options?.find((entry) => entry.value === value);
33
+ if (!option)
34
+ return undefined;
35
+ flags |= option.flags ?? 0;
36
+ }
37
+ return flags;
38
+ }
@@ -25,6 +25,9 @@ export declare const PHI_FORM_FIELD_PROVIDER_KEYS: {
25
25
  readonly upload: `${string}/${string}`;
26
26
  readonly linkTarget: `${string}/${string}`;
27
27
  readonly money: `${string}/${string}`;
28
+ readonly country: `${string}/${string}`;
29
+ readonly address: `${string}/${string}`;
30
+ readonly flags: `${string}/${string}`;
28
31
  };
29
32
  export declare const PHI_AUTH_FORM_FIELD_PROVIDER_KEYS: {
30
33
  readonly termsConsent: `${string}/${string}`;
@@ -442,6 +445,26 @@ export declare const PHI_SHARED_FORM_FIELD_TYPE_PROVIDER_DESCRIPTORS: readonly [
442
445
  readonly min: 0;
443
446
  readonly precision: 0;
444
447
  }];
448
+ }, {
449
+ readonly key: `${string}/${string}`;
450
+ readonly title: "Country";
451
+ readonly valueType: "string";
452
+ readonly presentation: "control";
453
+ readonly settingsFields: readonly [{
454
+ readonly key: "allowClear";
455
+ readonly type: "boolean";
456
+ readonly label: "Allow clear";
457
+ }];
458
+ }, {
459
+ readonly key: `${string}/${string}`;
460
+ readonly title: "Address";
461
+ readonly valueType: "json";
462
+ readonly presentation: "control";
463
+ }, {
464
+ readonly key: `${string}/${string}`;
465
+ readonly title: "Flags";
466
+ readonly valueType: "number";
467
+ readonly presentation: "control";
445
468
  }];
446
469
  export declare const PHI_SHARED_FORM_VALIDATION_PROVIDER_DESCRIPTORS: readonly [{
447
470
  readonly key: `${string}/${string}`;
@@ -36,6 +36,9 @@ export const PHI_FORM_FIELD_PROVIDER_KEYS = {
36
36
  upload: PHI_FORM_UPLOAD_FIELD_PROVIDER_KEY,
37
37
  linkTarget: createPhiSharedFormProviderKey("field", "link-target"),
38
38
  money: createPhiSharedFormProviderKey("field", "money"),
39
+ country: createPhiSharedFormProviderKey("field", "country"),
40
+ address: createPhiSharedFormProviderKey("field", "address"),
41
+ flags: createPhiSharedFormProviderKey("field", "flags"),
39
42
  };
40
43
  export const PHI_AUTH_FORM_FIELD_PROVIDER_KEYS = {
41
44
  termsConsent: createPhiSharedFormProviderKey("field", "auth-terms-consent"),
@@ -311,6 +314,39 @@ export const PHI_SHARED_FORM_FIELD_TYPE_PROVIDER_DESCRIPTORS = [
311
314
  { key: "max", type: "number", label: "Maximum", description: "In minor units.", min: 0, precision: 0 },
312
315
  ],
313
316
  },
317
+ /*
318
+ * A country of ISO 3166-1: the value is its alpha-2 code, uppercase, as Core stores an address's
319
+ * country; the options are named in the reader's language (`helpers/country-names.ts`) and searchable.
320
+ */
321
+ {
322
+ key: PHI_FORM_FIELD_PROVIDER_KEYS.country,
323
+ title: "Country",
324
+ valueType: "string",
325
+ presentation: "control",
326
+ settingsFields: [{ key: "allowClear", type: "boolean", label: "Allow clear" }],
327
+ },
328
+ /*
329
+ * One postal address as Core writes it (`PhisSiteAddressInput` of `@phis/contracts/users`): `json`, the
330
+ * parts in one object, an empty optional part `null`. The field holds each part to what Core takes
331
+ * (`helpers/address-field.ts`) and reads its words from the Form's Label Set
332
+ * (`PHI_FORM_ADDRESS_LABEL_KEYS`).
333
+ */
334
+ {
335
+ key: PHI_FORM_FIELD_PROVIDER_KEYS.address,
336
+ title: "Address",
337
+ valueType: "json",
338
+ presentation: "control",
339
+ },
340
+ /*
341
+ * Several yes-or-no answers as one bit-flag number: each option's value is its bit as a decimal number,
342
+ * `config.requires` an option another needs (`flags-field.ts`).
343
+ */
344
+ {
345
+ key: PHI_FORM_FIELD_PROVIDER_KEYS.flags,
346
+ title: "Flags",
347
+ valueType: "number",
348
+ presentation: "control",
349
+ },
314
350
  ];
315
351
  export const PHI_SHARED_FORM_VALIDATION_PROVIDER_DESCRIPTORS = [
316
352
  { key: PHI_FORM_VALIDATION_PROVIDER_KEYS.required, title: "Required" },
@@ -33,8 +33,12 @@ export type PhiFormFieldProviderProps = {
33
33
  * shows if somebody submits anyway; `null` releases it. For a value that only arrives later -- an
34
34
  * upload whose Asset id comes once the body is there. A submit while a hold stands does not reach
35
35
  * the handler: it fails the way a rule fails, on this field and through `onValidationFailed`.
36
+ *
37
+ * A field whose parts each say what is wrong with them (the address) passes `onRefused`: a refused
38
+ * submit then calls it instead of writing the sentence under the whole field, so no part's sentence
39
+ * stands a second time below the last part.
36
40
  */
37
- holdSubmit(fieldKey: string, reason: string | null): void;
41
+ holdSubmit(fieldKey: string, reason: string | null, onRefused?: () => void): void;
38
42
  };
39
43
  /**
40
44
  * The live values of the fields this Form watches -- those a `visibleWhen`, `disabledWhen` or options
@@ -14,6 +14,10 @@ const PhiLazySegmentedFormControl = lazyPhiFormFieldControl(() => import("./choi
14
14
  const PhiLazyNumberFormControl = lazyPhiFormFieldControl(() => import("./extended-form-field-controls").then((module) => module.PhiNumberFormControl));
15
15
  const PhiLazyStorageSizeFormControl = lazyPhiFormFieldControl(() => import("./extended-form-field-controls").then((module) => module.PhiStorageSizeFormControl));
16
16
  const PhiLazyMoneyFormControl = lazyPhiFormFieldControl(() => import("./extended-form-field-controls").then((module) => module.PhiMoneyFormControl));
17
+ const PhiLazyCountryFormControl = lazyPhiFormFieldControl(() => import("./structured-form-field-controls").then((module) => module.PhiCountryFormControl));
18
+ // Eight parts in six rows.
19
+ const PhiLazyAddressFormControl = lazyPhiFormFieldControl(() => import("./structured-form-field-controls").then((module) => module.PhiAddressFormControl), 6);
20
+ const PhiLazyFlagsFormControl = lazyPhiFormFieldControl(() => import("./structured-form-field-controls").then((module) => module.PhiFlagsFormControl), 2);
17
21
  const PhiLazySliderFormControl = lazyPhiFormFieldControl(() => import("./extended-form-field-controls").then((module) => module.PhiSliderFormControl));
18
22
  const PhiLazyCascaderFormControl = lazyPhiFormFieldControl(() => import("./extended-form-field-controls").then((module) => module.PhiCascaderFormControl));
19
23
  const PhiLazyDateTimeFormControl = lazyPhiFormFieldControl(() => import("./datetime-form-control").then((module) => module.PhiDateTimeFormControl));
@@ -128,6 +132,15 @@ export const PHI_SHARED_FORM_PROVIDER_REGISTRY = createPhiFormProviderRegistry({
128
132
  phiSharedFieldType(PHI_FORM_FIELD_PROVIDER_KEYS.money, {
129
133
  Control: PhiLazyMoneyFormControl,
130
134
  }),
135
+ phiSharedFieldType(PHI_FORM_FIELD_PROVIDER_KEYS.country, {
136
+ Control: PhiLazyCountryFormControl,
137
+ }),
138
+ phiSharedFieldType(PHI_FORM_FIELD_PROVIDER_KEYS.address, {
139
+ Control: PhiLazyAddressFormControl,
140
+ }),
141
+ phiSharedFieldType(PHI_FORM_FIELD_PROVIDER_KEYS.flags, {
142
+ Control: PhiLazyFlagsFormControl,
143
+ }),
131
144
  ],
132
145
  validationRules: [
133
146
  phiSharedValidationRule(PHI_FORM_VALIDATION_PROVIDER_KEYS.required, {
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The `address` field's own wording, read from the Form's Label Set under these keys and falling back to
3
+ * English, as the Media fields' are: one label per part, the sentence for each required part left empty,
4
+ * one for a part longer than Core stores (`%1` the part's label, `%2` the most characters) and one for a
5
+ * country that is no code of the list. A Form that places an address field states them in its Label Set.
6
+ */
7
+ export declare const PHI_FORM_ADDRESS_LABEL_KEYS: {
8
+ readonly name: "addressName";
9
+ readonly companyName: "addressCompanyName";
10
+ readonly line1: "addressLine1";
11
+ readonly line2: "addressLine2";
12
+ readonly postalCode: "addressPostalCode";
13
+ readonly city: "addressCity";
14
+ readonly region: "addressRegion";
15
+ readonly country: "addressCountry";
16
+ readonly nameRequired: "addressNameRequired";
17
+ readonly line1Required: "addressLine1Required";
18
+ readonly cityRequired: "addressCityRequired";
19
+ readonly countryRequired: "addressCountryRequired";
20
+ readonly tooLong: "addressTooLong";
21
+ };
22
+ export type PhiFormAddressLabels = Record<keyof typeof PHI_FORM_ADDRESS_LABEL_KEYS, string>;
23
+ /** The address field's words from the Form's Label Set, each empty one in English. */
24
+ export declare function readPhiFormAddressLabels(labels: Readonly<Record<string, string>> | undefined): PhiFormAddressLabels;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The `address` field's own wording, read from the Form's Label Set under these keys and falling back to
3
+ * English, as the Media fields' are: one label per part, the sentence for each required part left empty,
4
+ * one for a part longer than Core stores (`%1` the part's label, `%2` the most characters) and one for a
5
+ * country that is no code of the list. A Form that places an address field states them in its Label Set.
6
+ */
7
+ export const PHI_FORM_ADDRESS_LABEL_KEYS = {
8
+ name: "addressName",
9
+ companyName: "addressCompanyName",
10
+ line1: "addressLine1",
11
+ line2: "addressLine2",
12
+ postalCode: "addressPostalCode",
13
+ city: "addressCity",
14
+ region: "addressRegion",
15
+ country: "addressCountry",
16
+ nameRequired: "addressNameRequired",
17
+ line1Required: "addressLine1Required",
18
+ cityRequired: "addressCityRequired",
19
+ countryRequired: "addressCountryRequired",
20
+ tooLong: "addressTooLong",
21
+ };
22
+ const PHI_FORM_ADDRESS_DEFAULT_LABELS = {
23
+ name: "Name",
24
+ companyName: "Company",
25
+ line1: "Street and number",
26
+ line2: "Address line 2",
27
+ postalCode: "Postal code",
28
+ city: "City",
29
+ region: "Region",
30
+ country: "Country",
31
+ nameRequired: "Enter the name the address is made out to.",
32
+ line1Required: "Enter the street and number.",
33
+ cityRequired: "Enter the city.",
34
+ countryRequired: "Choose the country.",
35
+ tooLong: "%1 takes at most %2 characters.",
36
+ };
37
+ /** The address field's words from the Form's Label Set, each empty one in English. */
38
+ export function readPhiFormAddressLabels(labels) {
39
+ return Object.fromEntries(Object.keys(PHI_FORM_ADDRESS_LABEL_KEYS).map((key) => [
40
+ key,
41
+ labels?.[PHI_FORM_ADDRESS_LABEL_KEYS[key]]?.trim() || PHI_FORM_ADDRESS_DEFAULT_LABELS[key],
42
+ ]));
43
+ }