@10x-media/form-builder 0.1.0-beta.2 → 0.1.0-beta.21

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 (619) hide show
  1. package/CHANGELOG.md +360 -0
  2. package/README.md +7 -5
  3. package/dist/actions/assertNoBlockCollision.js +18 -0
  4. package/dist/actions/assertNoBlockCollision.js.map +1 -0
  5. package/dist/actions/body/converters.d.ts +20 -0
  6. package/dist/actions/body/converters.js +57 -0
  7. package/dist/actions/body/converters.js.map +1 -0
  8. package/dist/actions/body/escapeHtml.d.ts +6 -0
  9. package/dist/actions/body/escapeHtml.js +14 -0
  10. package/dist/actions/body/escapeHtml.js.map +1 -0
  11. package/dist/actions/body/serializeBody.d.ts +55 -0
  12. package/dist/actions/body/serializeBody.js +78 -0
  13. package/dist/actions/body/serializeBody.js.map +1 -0
  14. package/dist/actions/body/serializeSlate.js +31 -0
  15. package/dist/actions/body/serializeSlate.js.map +1 -0
  16. package/dist/actions/body/textOfBody.d.ts +13 -0
  17. package/dist/actions/body/textOfBody.js +35 -0
  18. package/dist/actions/body/textOfBody.js.map +1 -0
  19. package/dist/actions/body/wildcards.d.ts +10 -0
  20. package/dist/actions/body/wildcards.js +33 -0
  21. package/dist/actions/body/wildcards.js.map +1 -0
  22. package/dist/actions/buildActionBlocks.js +12 -9
  23. package/dist/actions/buildActionBlocks.js.map +1 -1
  24. package/dist/actions/builtin/confirmation.js +47 -43
  25. package/dist/actions/builtin/confirmation.js.map +1 -1
  26. package/dist/actions/builtin/emailAction.d.ts +20 -0
  27. package/dist/actions/builtin/emailAction.js +120 -0
  28. package/dist/actions/builtin/emailAction.js.map +1 -0
  29. package/dist/actions/builtin/emailTeam.js +20 -38
  30. package/dist/actions/builtin/emailTeam.js.map +1 -1
  31. package/dist/actions/builtin/index.d.ts +16 -1
  32. package/dist/actions/builtin/index.js +21 -7
  33. package/dist/actions/builtin/index.js.map +1 -1
  34. package/dist/actions/builtin/signedWebhook.js +6 -2
  35. package/dist/actions/builtin/signedWebhook.js.map +1 -1
  36. package/dist/actions/defineAction.d.ts +17 -5
  37. package/dist/actions/defineAction.js.map +1 -1
  38. package/dist/actions/dispatch.js +51 -6
  39. package/dist/actions/dispatch.js.map +1 -1
  40. package/dist/actions/dispatchContext.js +13 -0
  41. package/dist/actions/dispatchContext.js.map +1 -0
  42. package/dist/actions/emailRecipients.d.ts +12 -0
  43. package/dist/actions/emailRecipients.js +146 -0
  44. package/dist/actions/emailRecipients.js.map +1 -0
  45. package/dist/actions/fromAddresses.d.ts +37 -0
  46. package/dist/actions/fromAddresses.js +131 -0
  47. package/dist/actions/fromAddresses.js.map +1 -0
  48. package/dist/actions/recipientSources.d.ts +34 -0
  49. package/dist/actions/recipientSources.js +11 -0
  50. package/dist/actions/recipientSources.js.map +1 -0
  51. package/dist/actions/registry.d.ts +2 -1
  52. package/dist/actions/registry.js +5 -7
  53. package/dist/actions/registry.js.map +1 -1
  54. package/dist/actions/runActions.js +10 -1
  55. package/dist/actions/runActions.js.map +1 -1
  56. package/dist/actions/task.js +47 -16
  57. package/dist/actions/task.js.map +1 -1
  58. package/dist/aggregation/aggregateResponses.d.ts +9 -0
  59. package/dist/aggregation/aggregateResponses.js +8 -14
  60. package/dist/aggregation/aggregateResponses.js.map +1 -1
  61. package/dist/aggregation/resolveResultsRequest.d.ts +41 -6
  62. package/dist/aggregation/resolveResultsRequest.js +97 -11
  63. package/dist/aggregation/resolveResultsRequest.js.map +1 -1
  64. package/dist/calc/computeCalcFields.d.ts +5 -3
  65. package/dist/calc/computeCalcFields.js +6 -4
  66. package/dist/calc/computeCalcFields.js.map +1 -1
  67. package/dist/calc/evaluate.d.ts +26 -3
  68. package/dist/calc/evaluate.js +34 -13
  69. package/dist/calc/evaluate.js.map +1 -1
  70. package/dist/calc/formatCalc.d.ts +11 -0
  71. package/dist/calc/formatCalc.js +35 -0
  72. package/dist/calc/formatCalc.js.map +1 -0
  73. package/dist/calc/formatCalcValue.d.ts +17 -0
  74. package/dist/calc/formatCalcValue.js +17 -0
  75. package/dist/calc/formatCalcValue.js.map +1 -0
  76. package/dist/calc/normalizeCalc.d.ts +17 -3
  77. package/dist/calc/normalizeCalc.js +42 -33
  78. package/dist/calc/normalizeCalc.js.map +1 -1
  79. package/dist/calc/registry.d.ts +43 -0
  80. package/dist/calc/registry.js +27 -0
  81. package/dist/calc/registry.js.map +1 -0
  82. package/dist/calc/resolveCalcContext.d.ts +36 -0
  83. package/dist/calc/resolveCalcContext.js +87 -0
  84. package/dist/calc/resolveCalcContext.js.map +1 -0
  85. package/dist/calc/types.d.ts +25 -4
  86. package/dist/calc/types.js +23 -0
  87. package/dist/calc/types.js.map +1 -0
  88. package/dist/client/ByteSizeField.d.ts +29 -0
  89. package/dist/client/ByteSizeField.js +58 -0
  90. package/dist/client/ByteSizeField.js.map +1 -0
  91. package/dist/client/CalcExpressionBuilder.d.ts +20 -0
  92. package/dist/client/CalcExpressionBuilder.js +890 -0
  93. package/dist/client/CalcExpressionBuilder.js.map +1 -0
  94. package/dist/client/ClosePollButton.d.ts +15 -0
  95. package/dist/client/ClosePollButton.js +80 -0
  96. package/dist/client/ClosePollButton.js.map +1 -0
  97. package/dist/client/CondensedArray.d.ts +15 -0
  98. package/dist/client/CondensedArray.js +97 -0
  99. package/dist/client/CondensedArray.js.map +1 -0
  100. package/dist/client/ConditionBuilder.js +2 -1
  101. package/dist/client/ConditionBuilder.js.map +1 -1
  102. package/dist/client/ConsentBlockLabel.d.ts +15 -0
  103. package/dist/client/ConsentBlockLabel.js +71 -0
  104. package/dist/client/ConsentBlockLabel.js.map +1 -0
  105. package/dist/client/ConsentSourceRowLabel.d.ts +9 -0
  106. package/dist/client/ConsentSourceRowLabel.js +21 -0
  107. package/dist/client/ConsentSourceRowLabel.js.map +1 -0
  108. package/dist/client/EndpointOptionsSelect.d.ts +55 -0
  109. package/dist/client/EndpointOptionsSelect.js +112 -0
  110. package/dist/client/EndpointOptionsSelect.js.map +1 -0
  111. package/dist/client/FieldBlockLabel.d.ts +18 -0
  112. package/dist/client/FieldBlockLabel.js +34 -0
  113. package/dist/client/FieldBlockLabel.js.map +1 -0
  114. package/dist/client/FieldNameSelect.d.ts +37 -0
  115. package/dist/client/FieldNameSelect.js +72 -0
  116. package/dist/client/FieldNameSelect.js.map +1 -0
  117. package/dist/client/FlowBuilder.d.ts +2 -2
  118. package/dist/client/FlowBuilder.js +137 -88
  119. package/dist/client/FlowBuilder.js.map +1 -1
  120. package/dist/client/FormConditionField.js +1 -4
  121. package/dist/client/FormConditionField.js.map +1 -1
  122. package/dist/client/RecipientsSelect.d.ts +37 -0
  123. package/dist/client/RecipientsSelect.js +197 -0
  124. package/dist/client/RecipientsSelect.js.map +1 -0
  125. package/dist/client/RuleDescription.d.ts +21 -0
  126. package/dist/client/RuleDescription.js +19 -0
  127. package/dist/client/RuleDescription.js.map +1 -0
  128. package/dist/client/admin.css +557 -0
  129. package/dist/client/endpointOptions.d.ts +11 -0
  130. package/dist/client/endpointOptions.js +38 -0
  131. package/dist/client/endpointOptions.js.map +1 -0
  132. package/dist/client/flowAuthoring.js +142 -0
  133. package/dist/client/flowAuthoring.js.map +1 -0
  134. package/dist/client/synthesizeClientField.js +21 -10
  135. package/dist/client/synthesizeClientField.js.map +1 -1
  136. package/dist/client/toStaticLabel.js +13 -0
  137. package/dist/client/toStaticLabel.js.map +1 -0
  138. package/dist/collections/buttonFields.d.ts +34 -0
  139. package/dist/collections/buttonFields.js +35 -0
  140. package/dist/collections/buttonFields.js.map +1 -0
  141. package/dist/collections/cells/FieldCountCell.d.ts +15 -0
  142. package/dist/collections/cells/FieldCountCell.js +18 -0
  143. package/dist/collections/cells/FieldCountCell.js.map +1 -0
  144. package/dist/collections/cells/FlowStepsCell.d.ts +14 -0
  145. package/dist/collections/cells/FlowStepsCell.js +17 -0
  146. package/dist/collections/cells/FlowStepsCell.js.map +1 -0
  147. package/dist/collections/formSubmissions.js +114 -28
  148. package/dist/collections/formSubmissions.js.map +1 -1
  149. package/dist/collections/forms.js +449 -112
  150. package/dist/collections/forms.js.map +1 -1
  151. package/dist/collections/formsEndpoints.js +106 -0
  152. package/dist/collections/formsEndpoints.js.map +1 -0
  153. package/dist/collections/redirectFields.d.ts +29 -0
  154. package/dist/collections/settingsFields.d.ts +31 -0
  155. package/dist/collections/settingsFields.js +45 -0
  156. package/dist/collections/settingsFields.js.map +1 -0
  157. package/dist/conditions/conditionType.js +9 -2
  158. package/dist/conditions/conditionType.js.map +1 -1
  159. package/dist/conditions/evaluate.js +1 -1
  160. package/dist/conditions/evaluate.js.map +1 -1
  161. package/dist/conditions/fieldTypes.d.ts +3 -1
  162. package/dist/conditions/fieldTypes.js +4 -1
  163. package/dist/conditions/fieldTypes.js.map +1 -1
  164. package/dist/conditions/normalizeConditions.js +20 -6
  165. package/dist/conditions/normalizeConditions.js.map +1 -1
  166. package/dist/consent/applyConsentStatements.d.ts +14 -0
  167. package/dist/consent/applyConsentStatements.js +17 -0
  168. package/dist/consent/applyConsentStatements.js.map +1 -0
  169. package/dist/consent/captureConsent.d.ts +39 -11
  170. package/dist/consent/captureConsent.js +63 -13
  171. package/dist/consent/captureConsent.js.map +1 -1
  172. package/dist/consent/consentSourcesField.d.ts +66 -0
  173. package/dist/consent/consentSourcesField.js +98 -0
  174. package/dist/consent/consentSourcesField.js.map +1 -0
  175. package/dist/consent/effectiveStatement.js +16 -0
  176. package/dist/consent/effectiveStatement.js.map +1 -0
  177. package/dist/consent/resolveConsentEntries.d.ts +24 -0
  178. package/dist/consent/resolveConsentEntries.js +40 -0
  179. package/dist/consent/resolveConsentEntries.js.map +1 -0
  180. package/dist/consent/resolveConsentSourcesRequest.d.ts +37 -0
  181. package/dist/consent/resolveConsentSourcesRequest.js +54 -0
  182. package/dist/consent/resolveConsentSourcesRequest.js.map +1 -0
  183. package/dist/consent/resolveConsentStatements.d.ts +45 -0
  184. package/dist/consent/resolveConsentStatements.js +46 -0
  185. package/dist/consent/resolveConsentStatements.js.map +1 -0
  186. package/dist/consent/resolvePublishedVersionRef.d.ts +17 -11
  187. package/dist/consent/resolvePublishedVersionRef.js +13 -10
  188. package/dist/consent/resolvePublishedVersionRef.js.map +1 -1
  189. package/dist/consent/types.d.ts +69 -0
  190. package/dist/context/formContext.d.ts +30 -0
  191. package/dist/context/formContext.js +54 -0
  192. package/dist/context/formContext.js.map +1 -0
  193. package/dist/email/departments.d.ts +59 -0
  194. package/dist/email/departments.js +87 -0
  195. package/dist/email/departments.js.map +1 -0
  196. package/dist/email/departmentsField.d.ts +53 -0
  197. package/dist/email/departmentsField.js +73 -0
  198. package/dist/email/departmentsField.js.map +1 -0
  199. package/dist/exports/client.d.ts +14 -1
  200. package/dist/exports/client.js +14 -1
  201. package/dist/exports/i18n.d.ts +5 -2
  202. package/dist/exports/i18n.js +5 -2
  203. package/dist/exports/react.d.ts +34 -10
  204. package/dist/exports/react.js +24 -4
  205. package/dist/exports/rsc.d.ts +10 -1
  206. package/dist/exports/rsc.js +10 -1
  207. package/dist/exports/types.d.ts +20 -12
  208. package/dist/fields/buildFieldBlocks.js +46 -25
  209. package/dist/fields/buildFieldBlocks.js.map +1 -1
  210. package/dist/fields/builtin/calculation.d.ts +17 -0
  211. package/dist/fields/builtin/calculation.js +193 -18
  212. package/dist/fields/builtin/calculation.js.map +1 -1
  213. package/dist/fields/builtin/checkbox.js +23 -0
  214. package/dist/fields/builtin/checkbox.js.map +1 -1
  215. package/dist/fields/builtin/consent.js +49 -14
  216. package/dist/fields/builtin/consent.js.map +1 -1
  217. package/dist/fields/builtin/country.d.ts +13 -0
  218. package/dist/fields/builtin/country.js +30 -0
  219. package/dist/fields/builtin/country.js.map +1 -0
  220. package/dist/fields/builtin/date.js +31 -0
  221. package/dist/fields/builtin/date.js.map +1 -0
  222. package/dist/fields/builtin/email.js +8 -1
  223. package/dist/fields/builtin/email.js.map +1 -1
  224. package/dist/fields/builtin/file.d.ts +15 -0
  225. package/dist/fields/builtin/file.js +95 -8
  226. package/dist/fields/builtin/file.js.map +1 -1
  227. package/dist/fields/builtin/index.d.ts +30 -0
  228. package/dist/fields/builtin/index.js +37 -10
  229. package/dist/fields/builtin/index.js.map +1 -1
  230. package/dist/fields/builtin/message.js +30 -0
  231. package/dist/fields/builtin/message.js.map +1 -0
  232. package/dist/fields/builtin/repeater.js +8 -3
  233. package/dist/fields/builtin/repeater.js.map +1 -1
  234. package/dist/fields/builtin/select.js +28 -4
  235. package/dist/fields/builtin/select.js.map +1 -1
  236. package/dist/fields/builtin/state.d.ts +13 -0
  237. package/dist/fields/builtin/state.js +30 -0
  238. package/dist/fields/builtin/state.js.map +1 -0
  239. package/dist/fields/builtin/text.js +7 -0
  240. package/dist/fields/builtin/text.js.map +1 -1
  241. package/dist/fields/data/regions.d.ts +21 -0
  242. package/dist/fields/data/regions.js +1238 -0
  243. package/dist/fields/data/regions.js.map +1 -0
  244. package/dist/fields/fieldKey.d.ts +15 -0
  245. package/dist/fields/fieldKey.js +16 -0
  246. package/dist/fields/fieldKey.js.map +1 -0
  247. package/dist/fields/fieldNamesOfType.js +30 -0
  248. package/dist/fields/fieldNamesOfType.js.map +1 -0
  249. package/dist/fields/instanceOptions.js +20 -0
  250. package/dist/fields/instanceOptions.js.map +1 -0
  251. package/dist/fields/localizedIf.d.ts +13 -0
  252. package/dist/fields/localizedIf.js +12 -0
  253. package/dist/fields/localizedIf.js.map +1 -0
  254. package/dist/fields/registry.d.ts +3 -1
  255. package/dist/fields/registry.js +23 -8
  256. package/dist/fields/registry.js.map +1 -1
  257. package/dist/fields/sharedConfig.js +125 -59
  258. package/dist/fields/sharedConfig.js.map +1 -1
  259. package/dist/fields/types.d.ts +78 -9
  260. package/dist/flow/engine.d.ts +6 -4
  261. package/dist/flow/engine.js +11 -6
  262. package/dist/flow/engine.js.map +1 -1
  263. package/dist/flow/normalizeFlow.js +28 -9
  264. package/dist/flow/normalizeFlow.js.map +1 -1
  265. package/dist/flow/stepLabel.js +15 -0
  266. package/dist/flow/stepLabel.js.map +1 -0
  267. package/dist/flow/types.d.ts +12 -3
  268. package/dist/flow/types.js +11 -0
  269. package/dist/flow/types.js.map +1 -0
  270. package/dist/form/pollState.d.ts +23 -0
  271. package/dist/form/pollState.js +17 -0
  272. package/dist/form/pollState.js.map +1 -0
  273. package/dist/form/toFormDocument.d.ts +110 -0
  274. package/dist/form/toFormDocument.js +89 -0
  275. package/dist/form/toFormDocument.js.map +1 -0
  276. package/dist/form/types.d.ts +73 -0
  277. package/dist/index.d.ts +67 -61
  278. package/dist/index.js +120 -25
  279. package/dist/index.js.map +1 -1
  280. package/dist/options.d.ts +281 -0
  281. package/dist/plugin/applyRegistryConfig.d.ts +11 -0
  282. package/dist/plugin/applyRegistryConfig.js +20 -0
  283. package/dist/plugin/applyRegistryConfig.js.map +1 -0
  284. package/dist/plugin/customState.js +26 -0
  285. package/dist/plugin/customState.js.map +1 -0
  286. package/dist/plugin/registerCollections.js +43 -40
  287. package/dist/plugin/registerCollections.js.map +1 -1
  288. package/dist/plugin/uploadsCollection.d.ts +16 -0
  289. package/dist/plugin/uploadsCollection.js +53 -0
  290. package/dist/plugin/uploadsCollection.js.map +1 -0
  291. package/dist/poll/applyPollOptions.js +18 -0
  292. package/dist/poll/applyPollOptions.js.map +1 -0
  293. package/dist/poll/buildPollOptionSourceFields.js +50 -0
  294. package/dist/poll/buildPollOptionSourceFields.js.map +1 -0
  295. package/dist/poll/closeJob.d.ts +53 -0
  296. package/dist/poll/closeJob.js +121 -0
  297. package/dist/poll/closeJob.js.map +1 -0
  298. package/dist/poll/definePollOptionSource.d.ts +44 -0
  299. package/dist/poll/definePollOptionSource.js +6 -0
  300. package/dist/poll/definePollOptionSource.js.map +1 -0
  301. package/dist/poll/definePollType.d.ts +34 -0
  302. package/dist/poll/definePollType.js +6 -0
  303. package/dist/poll/definePollType.js.map +1 -0
  304. package/dist/poll/effectivePollOptions.d.ts +38 -0
  305. package/dist/poll/effectivePollOptions.js +64 -0
  306. package/dist/poll/effectivePollOptions.js.map +1 -0
  307. package/dist/poll/mostVoted.d.ts +21 -0
  308. package/dist/poll/mostVoted.js +32 -0
  309. package/dist/poll/mostVoted.js.map +1 -0
  310. package/dist/poll/outcomeBeforeChange.js +91 -0
  311. package/dist/poll/outcomeBeforeChange.js.map +1 -0
  312. package/dist/poll/outcomeFields.d.ts +38 -0
  313. package/dist/poll/outcomeFields.js +52 -0
  314. package/dist/poll/outcomeFields.js.map +1 -0
  315. package/dist/poll/pollTypeRegistry.d.ts +34 -0
  316. package/dist/poll/pollTypeRegistry.js +69 -0
  317. package/dist/poll/pollTypeRegistry.js.map +1 -0
  318. package/dist/poll/registry.d.ts +17 -0
  319. package/dist/poll/registry.js +12 -0
  320. package/dist/poll/registry.js.map +1 -0
  321. package/dist/poll/resolvePollCloseRequest.js +106 -0
  322. package/dist/poll/resolvePollCloseRequest.js.map +1 -0
  323. package/dist/poll/resolvePollOptions.d.ts +29 -0
  324. package/dist/poll/resolvePollOptions.js +52 -0
  325. package/dist/poll/resolvePollOptions.js.map +1 -0
  326. package/dist/poll/resolvePollOptionsRequest.js +50 -0
  327. package/dist/poll/resolvePollOptionsRequest.js.map +1 -0
  328. package/dist/poll/resolvePollOutcome.d.ts +40 -0
  329. package/dist/poll/resolvePollOutcome.js +90 -0
  330. package/dist/poll/resolvePollOutcome.js.map +1 -0
  331. package/dist/poll/resultsField.js +21 -0
  332. package/dist/poll/resultsField.js.map +1 -0
  333. package/dist/poll/votes/aggregateFromVotes.d.ts +27 -0
  334. package/dist/poll/votes/aggregateFromVotes.js +54 -0
  335. package/dist/poll/votes/aggregateFromVotes.js.map +1 -0
  336. package/dist/poll/votes/answerValues.js +16 -0
  337. package/dist/poll/votes/answerValues.js.map +1 -0
  338. package/dist/poll/votes/bumpPollVote.js +88 -0
  339. package/dist/poll/votes/bumpPollVote.js.map +1 -0
  340. package/dist/poll/votes/recountPollVotes.d.ts +20 -0
  341. package/dist/poll/votes/recountPollVotes.js +63 -0
  342. package/dist/poll/votes/recountPollVotes.js.map +1 -0
  343. package/dist/poll/votes/voteTallyHook.js +76 -0
  344. package/dist/poll/votes/voteTallyHook.js.map +1 -0
  345. package/dist/poll/votes/votesCollection.d.ts +19 -0
  346. package/dist/poll/votes/votesCollection.js +89 -0
  347. package/dist/poll/votes/votesCollection.js.map +1 -0
  348. package/dist/prefill/valuesFromSearchParams.js +5 -9
  349. package/dist/prefill/valuesFromSearchParams.js.map +1 -1
  350. package/dist/presentations/types.d.ts +3 -2
  351. package/dist/react/Form.d.ts +77 -35
  352. package/dist/react/Form.js +368 -222
  353. package/dist/react/Form.js.map +1 -1
  354. package/dist/react/FormContext.d.ts +51 -1
  355. package/dist/react/FormContext.js.map +1 -1
  356. package/dist/react/FormControls.d.ts +55 -0
  357. package/dist/react/FormControls.js +56 -0
  358. package/dist/react/FormControls.js.map +1 -0
  359. package/dist/react/FormFields.d.ts +18 -0
  360. package/dist/react/FormFields.js +114 -0
  361. package/dist/react/FormFields.js.map +1 -0
  362. package/dist/react/FormLayout.d.ts +4 -2
  363. package/dist/react/FormLayout.js +3 -2
  364. package/dist/react/FormLayout.js.map +1 -1
  365. package/dist/react/FormResults.d.ts +8 -3
  366. package/dist/react/FormResults.js +50 -29
  367. package/dist/react/FormResults.js.map +1 -1
  368. package/dist/react/FormSteps.d.ts +17 -0
  369. package/dist/react/FormSteps.js +35 -0
  370. package/dist/react/FormSteps.js.map +1 -0
  371. package/dist/react/Poll.d.ts +40 -6
  372. package/dist/react/Poll.js +137 -33
  373. package/dist/react/Poll.js.map +1 -1
  374. package/dist/react/adapters.d.ts +35 -0
  375. package/dist/react/adapters.js +11 -0
  376. package/dist/react/adapters.js.map +1 -0
  377. package/dist/react/captcha/HcaptchaCaptcha.d.ts +31 -0
  378. package/dist/react/captcha/HcaptchaCaptcha.js +53 -0
  379. package/dist/react/captcha/HcaptchaCaptcha.js.map +1 -0
  380. package/dist/react/captcha/RecaptchaCaptcha.d.ts +44 -0
  381. package/dist/react/captcha/RecaptchaCaptcha.js +93 -0
  382. package/dist/react/captcha/RecaptchaCaptcha.js.map +1 -0
  383. package/dist/react/captcha/TurnstileCaptcha.d.ts +31 -0
  384. package/dist/react/captcha/TurnstileCaptcha.js +53 -0
  385. package/dist/react/captcha/TurnstileCaptcha.js.map +1 -0
  386. package/dist/react/captcha/types.d.ts +8 -0
  387. package/dist/react/captcha/useCaptchaScript.js +63 -0
  388. package/dist/react/captcha/useCaptchaScript.js.map +1 -0
  389. package/dist/react/captcha/vendors.js +8 -0
  390. package/dist/react/captcha/vendors.js.map +1 -0
  391. package/dist/react/contract.d.ts +2 -3
  392. package/dist/react/contract.js.map +1 -1
  393. package/dist/react/fetchResults.d.ts +1 -1
  394. package/dist/react/fetchResults.js +1 -1
  395. package/dist/react/fetchResults.js.map +1 -1
  396. package/dist/react/presentation/DialogSurface.js +1 -4
  397. package/dist/react/presentation/DialogSurface.js.map +1 -1
  398. package/dist/react/primitives/Checkbox.d.ts +6 -2
  399. package/dist/react/primitives/Checkbox.js +4 -2
  400. package/dist/react/primitives/Checkbox.js.map +1 -1
  401. package/dist/react/primitives/ChoiceGroup.d.ts +40 -0
  402. package/dist/react/primitives/ChoiceGroup.js +33 -0
  403. package/dist/react/primitives/ChoiceGroup.js.map +1 -0
  404. package/dist/react/primitives/FieldShell.d.ts +13 -5
  405. package/dist/react/primitives/FieldShell.js +35 -32
  406. package/dist/react/primitives/FieldShell.js.map +1 -1
  407. package/dist/react/primitives/Input.d.ts +4 -2
  408. package/dist/react/primitives/Input.js +2 -1
  409. package/dist/react/primitives/Input.js.map +1 -1
  410. package/dist/react/renderers/calculation.js +7 -5
  411. package/dist/react/renderers/calculation.js.map +1 -1
  412. package/dist/react/renderers/checkbox.js +3 -5
  413. package/dist/react/renderers/checkbox.js.map +1 -1
  414. package/dist/react/renderers/consent.js +84 -36
  415. package/dist/react/renderers/consent.js.map +1 -1
  416. package/dist/react/renderers/date.js +33 -0
  417. package/dist/react/renderers/date.js.map +1 -0
  418. package/dist/react/renderers/email.js +4 -5
  419. package/dist/react/renderers/email.js.map +1 -1
  420. package/dist/react/renderers/file.js +29 -14
  421. package/dist/react/renderers/file.js.map +1 -1
  422. package/dist/react/renderers/index.js +7 -0
  423. package/dist/react/renderers/index.js.map +1 -1
  424. package/dist/react/renderers/message.js +41 -0
  425. package/dist/react/renderers/message.js.map +1 -0
  426. package/dist/react/renderers/number.js +1 -4
  427. package/dist/react/renderers/number.js.map +1 -1
  428. package/dist/react/renderers/region.js +43 -0
  429. package/dist/react/renderers/region.js.map +1 -0
  430. package/dist/react/renderers/repeater.js +32 -14
  431. package/dist/react/renderers/repeater.js.map +1 -1
  432. package/dist/react/renderers/select.js +21 -6
  433. package/dist/react/renderers/select.js.map +1 -1
  434. package/dist/react/renderers/text.js +4 -5
  435. package/dist/react/renderers/text.js.map +1 -1
  436. package/dist/react/renderers/textarea.js +1 -4
  437. package/dist/react/renderers/textarea.js.map +1 -1
  438. package/dist/react/state.d.ts +46 -3
  439. package/dist/react/state.js +73 -10
  440. package/dist/react/state.js.map +1 -1
  441. package/dist/react/submitForm.js +1 -1
  442. package/dist/react/submitForm.js.map +1 -1
  443. package/dist/react/uploadFile.d.ts +2 -2
  444. package/dist/react/uploadFile.js +1 -1
  445. package/dist/react/uploadFile.js.map +1 -1
  446. package/dist/react/useCalcValues.d.ts +10 -0
  447. package/dist/react/useCalcValues.js +13 -0
  448. package/dist/react/useCalcValues.js.map +1 -0
  449. package/dist/react/useField.d.ts +0 -1
  450. package/dist/react/useField.js +7 -6
  451. package/dist/react/useField.js.map +1 -1
  452. package/dist/react/useFormState.d.ts +1 -1
  453. package/dist/react/useFormState.js +1 -1
  454. package/dist/react/useFormState.js.map +1 -1
  455. package/dist/react/validateField.js +3 -6
  456. package/dist/react/validateField.js.map +1 -1
  457. package/dist/recall/interpolate.d.ts +4 -3
  458. package/dist/recall/interpolate.js +5 -4
  459. package/dist/recall/interpolate.js.map +1 -1
  460. package/dist/recall/resolver.d.ts +1 -1
  461. package/dist/recall/resolver.js +15 -3
  462. package/dist/recall/resolver.js.map +1 -1
  463. package/dist/spam/captcha.d.ts +4 -3
  464. package/dist/spam/captcha.js +4 -3
  465. package/dist/spam/captcha.js.map +1 -1
  466. package/dist/spam/clientIp.js +9 -0
  467. package/dist/spam/clientIp.js.map +1 -0
  468. package/dist/spam/constants.js +13 -1
  469. package/dist/spam/constants.js.map +1 -1
  470. package/dist/spam/identify.js +3 -6
  471. package/dist/spam/identify.js.map +1 -1
  472. package/dist/spam/providers/hcaptcha.d.ts +17 -0
  473. package/dist/spam/providers/hcaptcha.js +18 -0
  474. package/dist/spam/providers/hcaptcha.js.map +1 -0
  475. package/dist/spam/providers/recaptcha.d.ts +23 -0
  476. package/dist/spam/providers/recaptcha.js +23 -0
  477. package/dist/spam/providers/recaptcha.js.map +1 -0
  478. package/dist/spam/providers/siteverify.js +34 -0
  479. package/dist/spam/providers/siteverify.js.map +1 -0
  480. package/dist/spam/providers/turnstile.d.ts +17 -0
  481. package/dist/spam/providers/turnstile.js +18 -0
  482. package/dist/spam/providers/turnstile.js.map +1 -0
  483. package/dist/spam/resolveSpam.js +2 -1
  484. package/dist/spam/resolveSpam.js.map +1 -1
  485. package/dist/spam/spamGuard.js +25 -11
  486. package/dist/spam/spamGuard.js.map +1 -1
  487. package/dist/spam/types.d.ts +19 -4
  488. package/dist/submissions/SubmissionAnswers.js +6 -2
  489. package/dist/submissions/SubmissionAnswers.js.map +1 -1
  490. package/dist/submissions/SubmissionAnswersClient.js +100 -64
  491. package/dist/submissions/SubmissionAnswersClient.js.map +1 -1
  492. package/dist/submissions/coerceBoolean.js +14 -0
  493. package/dist/submissions/coerceBoolean.js.map +1 -0
  494. package/dist/submissions/createSubmission.d.ts +36 -0
  495. package/dist/submissions/createSubmission.js +26 -0
  496. package/dist/submissions/createSubmission.js.map +1 -0
  497. package/dist/submissions/formIdOf.js +13 -0
  498. package/dist/submissions/formIdOf.js.map +1 -0
  499. package/dist/submissions/resolveVotedSubmission.d.ts +27 -0
  500. package/dist/submissions/resolveVotedSubmission.js +51 -0
  501. package/dist/submissions/resolveVotedSubmission.js.map +1 -0
  502. package/dist/submissions/runSubmission.d.ts +10 -0
  503. package/dist/submissions/runSubmission.js +104 -54
  504. package/dist/submissions/runSubmission.js.map +1 -1
  505. package/dist/submissions/types.d.ts +11 -4
  506. package/dist/submissions/validateSubmission.js +99 -13
  507. package/dist/submissions/validateSubmission.js.map +1 -1
  508. package/dist/submissions/verifyContext.js +35 -0
  509. package/dist/submissions/verifyContext.js.map +1 -0
  510. package/dist/submissions/voteChangeEndpoint.js +105 -0
  511. package/dist/submissions/voteChangeEndpoint.js.map +1 -0
  512. package/dist/submissions/votedCookie.d.ts +15 -0
  513. package/dist/submissions/votedCookie.js +74 -0
  514. package/dist/submissions/votedCookie.js.map +1 -0
  515. package/dist/translations/clientRuntimeKeys.d.ts +17 -0
  516. package/dist/translations/clientRuntimeKeys.js +48 -0
  517. package/dist/translations/clientRuntimeKeys.js.map +1 -0
  518. package/dist/translations/de.d.ts +12 -0
  519. package/dist/translations/de.js +380 -0
  520. package/dist/translations/de.js.map +1 -0
  521. package/dist/translations/en.js +250 -28
  522. package/dist/translations/en.js.map +1 -1
  523. package/dist/translations/index.d.ts +14 -5
  524. package/dist/translations/index.js +14 -3
  525. package/dist/translations/index.js.map +1 -1
  526. package/dist/translations/keys.d.ts +245 -23
  527. package/dist/translations/keys.js +246 -24
  528. package/dist/translations/keys.js.map +1 -1
  529. package/dist/translations/makeTranslate.d.ts +7 -3
  530. package/dist/translations/makeTranslate.js +12 -3
  531. package/dist/translations/makeTranslate.js.map +1 -1
  532. package/dist/translations/server.js +8 -1
  533. package/dist/translations/server.js.map +1 -1
  534. package/dist/uploads/captureFileRef.d.ts +10 -3
  535. package/dist/uploads/captureFileRef.js +18 -9
  536. package/dist/uploads/captureFileRef.js.map +1 -1
  537. package/dist/uploads/formatBytes.d.ts +9 -0
  538. package/dist/uploads/formatBytes.js +25 -0
  539. package/dist/uploads/formatBytes.js.map +1 -0
  540. package/dist/uploads/resolveFileRef.js +3 -2
  541. package/dist/uploads/resolveFileRef.js.map +1 -1
  542. package/dist/uploads/types.d.ts +1 -2
  543. package/dist/validation/buildRuleBlocks.js +18 -17
  544. package/dist/validation/buildRuleBlocks.js.map +1 -1
  545. package/dist/validation/builtin/email.js +2 -1
  546. package/dist/validation/builtin/email.js.map +1 -1
  547. package/dist/validation/builtin/index.d.ts +14 -0
  548. package/dist/validation/builtin/index.js +14 -1
  549. package/dist/validation/builtin/index.js.map +1 -1
  550. package/dist/validation/builtin/integer.js +15 -0
  551. package/dist/validation/builtin/integer.js.map +1 -0
  552. package/dist/validation/builtin/matchesField.js +3 -7
  553. package/dist/validation/builtin/matchesField.js.map +1 -1
  554. package/dist/validation/builtin/max.js +1 -0
  555. package/dist/validation/builtin/max.js.map +1 -1
  556. package/dist/validation/builtin/maxDate.js +24 -0
  557. package/dist/validation/builtin/maxDate.js.map +1 -0
  558. package/dist/validation/builtin/maxLength.js +1 -0
  559. package/dist/validation/builtin/maxLength.js.map +1 -1
  560. package/dist/validation/builtin/min.js +1 -0
  561. package/dist/validation/builtin/min.js.map +1 -1
  562. package/dist/validation/builtin/minDate.js +24 -0
  563. package/dist/validation/builtin/minDate.js.map +1 -0
  564. package/dist/validation/builtin/minLength.js +1 -0
  565. package/dist/validation/builtin/minLength.js.map +1 -1
  566. package/dist/validation/builtin/notAlreadySubmitted.js +5 -1
  567. package/dist/validation/builtin/notAlreadySubmitted.js.map +1 -1
  568. package/dist/validation/builtin/oneOf.js +1 -0
  569. package/dist/validation/builtin/oneOf.js.map +1 -1
  570. package/dist/validation/builtin/pattern.js +11 -2
  571. package/dist/validation/builtin/pattern.js.map +1 -1
  572. package/dist/validation/builtin/url.js +1 -0
  573. package/dist/validation/builtin/url.js.map +1 -1
  574. package/dist/validation/builtin/validateDateBound.js +18 -0
  575. package/dist/validation/builtin/validateDateBound.js.map +1 -0
  576. package/dist/validation/builtin/validateRegexParams.js +44 -0
  577. package/dist/validation/builtin/validateRegexParams.js.map +1 -0
  578. package/dist/validation/emailPattern.js +10 -0
  579. package/dist/validation/emailPattern.js.map +1 -0
  580. package/dist/validation/fieldTargetParam.d.ts +22 -0
  581. package/dist/validation/fieldTargetParam.js +38 -0
  582. package/dist/validation/fieldTargetParam.js.map +1 -0
  583. package/dist/validation/registry.d.ts +2 -1
  584. package/dist/validation/registry.js +2 -9
  585. package/dist/validation/registry.js.map +1 -1
  586. package/dist/validation/runValidation.js +8 -29
  587. package/dist/validation/runValidation.js.map +1 -1
  588. package/dist/validation/types.d.ts +5 -11
  589. package/dist/validation/validateUrl.js +22 -0
  590. package/dist/validation/validateUrl.js.map +1 -0
  591. package/package.json +14 -6
  592. package/styles/form-builder.css +94 -190
  593. package/dist/collections/uploads.d.ts +0 -30
  594. package/dist/collections/uploads.js +0 -55
  595. package/dist/collections/uploads.js.map +0 -1
  596. package/dist/consent/buildConsentSourceConfig.js +0 -49
  597. package/dist/consent/buildConsentSourceConfig.js.map +0 -1
  598. package/dist/consent/builtin/index.d.ts +0 -7
  599. package/dist/consent/builtin/index.js +0 -11
  600. package/dist/consent/builtin/index.js.map +0 -1
  601. package/dist/consent/builtin/pageReference.js +0 -75
  602. package/dist/consent/builtin/pageReference.js.map +0 -1
  603. package/dist/consent/builtin/static.js +0 -44
  604. package/dist/consent/builtin/static.js.map +0 -1
  605. package/dist/consent/defineConsentSource.d.ts +0 -35
  606. package/dist/consent/defineConsentSource.js +0 -6
  607. package/dist/consent/defineConsentSource.js.map +0 -1
  608. package/dist/consent/registry.d.ts +0 -16
  609. package/dist/consent/registry.js +0 -16
  610. package/dist/consent/registry.js.map +0 -1
  611. package/dist/consent/resolveConsentLinks.d.ts +0 -19
  612. package/dist/consent/resolveConsentLinks.js +0 -26
  613. package/dist/consent/resolveConsentLinks.js.map +0 -1
  614. package/dist/presentations/registry.d.ts +0 -15
  615. package/dist/presentations/registry.js +0 -15
  616. package/dist/presentations/registry.js.map +0 -1
  617. package/dist/react/toFormDocument.d.ts +0 -24
  618. package/dist/react/toFormDocument.js +0 -22
  619. package/dist/react/toFormDocument.js.map +0 -1
@@ -0,0 +1,142 @@
1
+ import { END_OF_FORM } from "../flow/types.js";
2
+ import "../flow/stepLabel.js";
3
+ //#region src/client/flowAuthoring.ts
4
+ /** Project a step's stored `next` onto its select option value ('' = sequential fall-through). */
5
+ const nextToSelectValue = (next) => next === null ? END_OF_FORM : next ?? "";
6
+ /** Parse a select option value back into a stored `next` (undefined = sequential fall-through). */
7
+ const nextFromSelectValue = (value) => value === "__end__" ? null : value.length > 0 ? value : void 0;
8
+ /**
9
+ * One option per step, labeled like its step card. A step whose id is empty is dropped: the id is
10
+ * the option's value, so such a step cannot be routed to and an empty value would collide with the
11
+ * next select's sequential option.
12
+ */
13
+ const stepSelectOptions = (steps, labels) => steps.map((step, index) => ({
14
+ label: labels[index] ?? "",
15
+ value: step.id
16
+ })).filter((option) => option.value.length > 0);
17
+ /** Every step but `stepId`, so a step's own next/transition selects cannot route it to itself. */
18
+ const otherStepSelectOptions = (options, stepId) => options.filter((option) => option.value !== stepId);
19
+ /**
20
+ * The `next` select's options: sequential fall-through first (the default, and what an absent
21
+ * `next` maps to), then explicit end of form, then every other step. Values round-trip through
22
+ * `nextFromSelectValue`.
23
+ */
24
+ const nextSelectOptions = (args) => [
25
+ {
26
+ label: args.sequentialLabel,
27
+ value: ""
28
+ },
29
+ {
30
+ label: args.terminalLabel,
31
+ value: END_OF_FORM
32
+ },
33
+ ...args.otherSteps
34
+ ];
35
+ const isRecord = (value) => value != null && typeof value === "object" && !Array.isArray(value);
36
+ /** Chars kept before truncating a `messageSnippet` result, plus a trailing ellipsis. */
37
+ const MESSAGE_SNIPPET_LENGTH = 40;
38
+ /**
39
+ * Short plain-text preview of a bare message block's richText content, for the flow step list.
40
+ * Reads only the shallow lexical shape (`root.children[].children[].text`), which is all a short
41
+ * authored message needs; a legacy Slate body or other non-lexical shape yields `undefined`, same
42
+ * as empty content, so the caller falls back to the block type's display label.
43
+ */
44
+ const messageSnippet = (content) => {
45
+ const root = isRecord(content) ? content.root : void 0;
46
+ const text = (isRecord(root) && Array.isArray(root.children) ? root.children : []).map((block) => {
47
+ return (isRecord(block) && Array.isArray(block.children) ? block.children : []).map((leaf) => isRecord(leaf) && typeof leaf.text === "string" ? leaf.text : "").join("");
48
+ }).join(" ").replace(/\s+/g, " ").trim();
49
+ if (text.length === 0) return;
50
+ return text.length > MESSAGE_SNIPPET_LENGTH ? `${text.slice(0, MESSAGE_SNIPPET_LENGTH).trimEnd()}…` : text;
51
+ };
52
+ /**
53
+ * Project the form's field rows into flow entries. Named rows are keyed by their trimmed name and
54
+ * labeled with their configured `label`, falling back to the name when unset. Nameless rows of a
55
+ * bare type are keyed by their block row id and labeled with a snippet of their content when they
56
+ * have any (see `messageSnippet`), else the type's display label (numbered in form order when the
57
+ * type occurs more than once). Rows with neither a usable name nor a bare-type row id are not
58
+ * addressable and are skipped.
59
+ */
60
+ const flowFieldEntries = (rows, bareTypeLabels) => {
61
+ const isBareRow = (row) => bareTypeLabels[row.blockType] !== void 0 && row.id != null;
62
+ const nameOf = (row) => typeof row.name === "string" ? row.name.trim() : "";
63
+ const bareTotals = /* @__PURE__ */ new Map();
64
+ for (const row of rows) if (nameOf(row).length === 0 && isBareRow(row)) bareTotals.set(row.blockType, (bareTotals.get(row.blockType) ?? 0) + 1);
65
+ const bareSeen = /* @__PURE__ */ new Map();
66
+ const entries = [];
67
+ for (const row of rows) {
68
+ const name = nameOf(row);
69
+ if (name.length > 0) {
70
+ const label = typeof row.label === "string" && row.label.trim().length > 0 ? row.label : name;
71
+ entries.push({
72
+ key: name,
73
+ label
74
+ });
75
+ continue;
76
+ }
77
+ if (!isBareRow(row)) continue;
78
+ const typeLabel = bareTypeLabels[row.blockType] ?? row.blockType;
79
+ const n = (bareSeen.get(row.blockType) ?? 0) + 1;
80
+ bareSeen.set(row.blockType, n);
81
+ const fallback = (bareTotals.get(row.blockType) ?? 0) > 1 ? `${typeLabel} ${n}` : typeLabel;
82
+ entries.push({
83
+ key: String(row.id),
84
+ label: messageSnippet(row.content) ?? fallback
85
+ });
86
+ }
87
+ return entries;
88
+ };
89
+ /** Field key to index of the step holding it (first occurrence wins). */
90
+ const fieldHolders = (steps) => {
91
+ const holders = /* @__PURE__ */ new Map();
92
+ steps.forEach((step, index) => {
93
+ for (const field of step.fields) if (!holders.has(field)) holders.set(field, index);
94
+ });
95
+ return holders;
96
+ };
97
+ /** Entries not assigned to any step, in form order. */
98
+ const unassignedEntries = (entries, steps) => {
99
+ const assigned = new Set(steps.flatMap((step) => step.fields));
100
+ return entries.filter((entry) => !assigned.has(entry.key));
101
+ };
102
+ /** Assign a field key to the step at `targetIndex`, stripping it from every other step. */
103
+ const assignFieldToStep = (steps, targetIndex, field) => steps.map((step, index) => {
104
+ if (index === targetIndex) return step.fields.includes(field) ? step : {
105
+ ...step,
106
+ fields: [...step.fields, field]
107
+ };
108
+ return step.fields.includes(field) ? {
109
+ ...step,
110
+ fields: step.fields.filter((f) => f !== field)
111
+ } : step;
112
+ });
113
+ /** Remove a field key from the step at `targetIndex`, leaving other steps untouched. */
114
+ const removeFieldFromStep = (steps, targetIndex, field) => steps.map((step, index) => index === targetIndex && step.fields.includes(field) ? {
115
+ ...step,
116
+ fields: step.fields.filter((f) => f !== field)
117
+ } : step);
118
+ /**
119
+ * Remove the step at `index` and every reference to it: another step's `next` pointing at it
120
+ * returns to absent (sequential fall-through), and transitions targeting it are dropped. Without
121
+ * the cascade a dangling `next` would silently route into whatever step follows it in the array.
122
+ */
123
+ const removeStepCascade = (steps, index) => {
124
+ const removed = steps[index];
125
+ const rest = steps.filter((_, i) => i !== index);
126
+ if (!removed) return rest;
127
+ return rest.map((step) => {
128
+ const keptTransitions = (step.transitions ?? []).filter((t) => t.to !== removed.id);
129
+ const dropsNext = step.next === removed.id;
130
+ const dropsTransitions = keptTransitions.length !== (step.transitions?.length ?? 0);
131
+ if (!dropsNext && !dropsTransitions) return step;
132
+ const { next, transitions, ...base } = step;
133
+ const cleaned = { ...base };
134
+ if (!dropsNext && next !== void 0) cleaned.next = next;
135
+ if (keptTransitions.length > 0) cleaned.transitions = keptTransitions;
136
+ return cleaned;
137
+ });
138
+ };
139
+ //#endregion
140
+ export { assignFieldToStep, fieldHolders, flowFieldEntries, nextFromSelectValue, nextSelectOptions, nextToSelectValue, otherStepSelectOptions, removeFieldFromStep, removeStepCascade, stepSelectOptions, unassignedEntries };
141
+
142
+ //# sourceMappingURL=flowAuthoring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowAuthoring.js","names":[],"sources":["../../src/client/flowAuthoring.ts"],"sourcesContent":["import { END_OF_FORM, type FlowStep } from '../flow/types'\nimport type { FieldRow } from './synthesizeClientField'\n\nexport { stepLabel } from '../flow/stepLabel'\nexport { END_OF_FORM }\n\n/** Project a step's stored `next` onto its select option value ('' = sequential fall-through). */\nexport const nextToSelectValue = (next: FlowStep['next']): string =>\n\tnext === null ? END_OF_FORM : (next ?? '')\n\n/** Parse a select option value back into a stored `next` (undefined = sequential fall-through). */\nexport const nextFromSelectValue = (value: string): FlowStep['next'] =>\n\tvalue === END_OF_FORM ? null : value.length > 0 ? value : undefined\n\n/** A form field as the flow builder addresses it: its stable key plus a display label. */\nexport type FlowFieldEntry = { key: string; label: string }\n\n/** A flow builder select option. Structurally a `ReactSelectOption`, without the client-only import. */\nexport type FlowSelectOption = { label: string; value: string }\n\n/**\n * One option per step, labeled like its step card. A step whose id is empty is dropped: the id is\n * the option's value, so such a step cannot be routed to and an empty value would collide with the\n * next select's sequential option.\n */\nexport const stepSelectOptions = (\n\tsteps: Pick<FlowStep, 'id'>[],\n\tlabels: string[]\n): FlowSelectOption[] =>\n\tsteps\n\t\t.map((step, index) => ({ label: labels[index] ?? '', value: step.id }))\n\t\t.filter((option) => option.value.length > 0)\n\n/** Every step but `stepId`, so a step's own next/transition selects cannot route it to itself. */\nexport const otherStepSelectOptions = (\n\toptions: FlowSelectOption[],\n\tstepId: string\n): FlowSelectOption[] => options.filter((option) => option.value !== stepId)\n\n/**\n * The `next` select's options: sequential fall-through first (the default, and what an absent\n * `next` maps to), then explicit end of form, then every other step. Values round-trip through\n * `nextFromSelectValue`.\n */\nexport const nextSelectOptions = (args: {\n\tsequentialLabel: string\n\tterminalLabel: string\n\totherSteps: FlowSelectOption[]\n}): FlowSelectOption[] => [\n\t{ label: args.sequentialLabel, value: '' },\n\t{ label: args.terminalLabel, value: END_OF_FORM },\n\t...args.otherSteps,\n]\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n\tvalue != null && typeof value === 'object' && !Array.isArray(value)\n\n/** Chars kept before truncating a `messageSnippet` result, plus a trailing ellipsis. */\nconst MESSAGE_SNIPPET_LENGTH = 40\n\n/**\n * Short plain-text preview of a bare message block's richText content, for the flow step list.\n * Reads only the shallow lexical shape (`root.children[].children[].text`), which is all a short\n * authored message needs; a legacy Slate body or other non-lexical shape yields `undefined`, same\n * as empty content, so the caller falls back to the block type's display label.\n */\nexport const messageSnippet = (content: unknown): string | undefined => {\n\tconst root = isRecord(content) ? content.root : undefined\n\tconst blockNodes = isRecord(root) && Array.isArray(root.children) ? root.children : []\n\tconst text = blockNodes\n\t\t.map((block) => {\n\t\t\tconst leaves = isRecord(block) && Array.isArray(block.children) ? block.children : []\n\t\t\treturn leaves\n\t\t\t\t.map((leaf) => (isRecord(leaf) && typeof leaf.text === 'string' ? leaf.text : ''))\n\t\t\t\t.join('')\n\t\t})\n\t\t.join(' ')\n\t\t.replace(/\\s+/g, ' ')\n\t\t.trim()\n\tif (text.length === 0) {\n\t\treturn undefined\n\t}\n\treturn text.length > MESSAGE_SNIPPET_LENGTH\n\t\t? `${text.slice(0, MESSAGE_SNIPPET_LENGTH).trimEnd()}…`\n\t\t: text\n}\n\n/**\n * Project the form's field rows into flow entries. Named rows are keyed by their trimmed name and\n * labeled with their configured `label`, falling back to the name when unset. Nameless rows of a\n * bare type are keyed by their block row id and labeled with a snippet of their content when they\n * have any (see `messageSnippet`), else the type's display label (numbered in form order when the\n * type occurs more than once). Rows with neither a usable name nor a bare-type row id are not\n * addressable and are skipped.\n */\nexport const flowFieldEntries = (\n\trows: FieldRow[],\n\tbareTypeLabels: Record<string, string>\n): FlowFieldEntry[] => {\n\tconst isBareRow = (row: FieldRow): boolean =>\n\t\tbareTypeLabels[row.blockType] !== undefined && row.id != null\n\tconst nameOf = (row: FieldRow): string => (typeof row.name === 'string' ? row.name.trim() : '')\n\n\tconst bareTotals = new Map<string, number>()\n\tfor (const row of rows) {\n\t\tif (nameOf(row).length === 0 && isBareRow(row)) {\n\t\t\tbareTotals.set(row.blockType, (bareTotals.get(row.blockType) ?? 0) + 1)\n\t\t}\n\t}\n\n\tconst bareSeen = new Map<string, number>()\n\tconst entries: FlowFieldEntry[] = []\n\tfor (const row of rows) {\n\t\tconst name = nameOf(row)\n\t\tif (name.length > 0) {\n\t\t\tconst label = typeof row.label === 'string' && row.label.trim().length > 0 ? row.label : name\n\t\t\tentries.push({ key: name, label })\n\t\t\tcontinue\n\t\t}\n\t\tif (!isBareRow(row)) {\n\t\t\tcontinue\n\t\t}\n\t\tconst typeLabel = bareTypeLabels[row.blockType] ?? row.blockType\n\t\tconst n = (bareSeen.get(row.blockType) ?? 0) + 1\n\t\tbareSeen.set(row.blockType, n)\n\t\tconst fallback = (bareTotals.get(row.blockType) ?? 0) > 1 ? `${typeLabel} ${n}` : typeLabel\n\t\tentries.push({ key: String(row.id), label: messageSnippet(row.content) ?? fallback })\n\t}\n\treturn entries\n}\n\n/** Field key to index of the step holding it (first occurrence wins). */\nexport const fieldHolders = (steps: Pick<FlowStep, 'fields'>[]): Map<string, number> => {\n\tconst holders = new Map<string, number>()\n\tsteps.forEach((step, index) => {\n\t\tfor (const field of step.fields) {\n\t\t\tif (!holders.has(field)) holders.set(field, index)\n\t\t}\n\t})\n\treturn holders\n}\n\n/** Entries not assigned to any step, in form order. */\nexport const unassignedEntries = (\n\tentries: FlowFieldEntry[],\n\tsteps: Pick<FlowStep, 'fields'>[]\n): FlowFieldEntry[] => {\n\tconst assigned = new Set(steps.flatMap((step) => step.fields))\n\treturn entries.filter((entry) => !assigned.has(entry.key))\n}\n\n/** Assign a field key to the step at `targetIndex`, stripping it from every other step. */\nexport const assignFieldToStep = (\n\tsteps: FlowStep[],\n\ttargetIndex: number,\n\tfield: string\n): FlowStep[] =>\n\tsteps.map((step, index) => {\n\t\tif (index === targetIndex) {\n\t\t\treturn step.fields.includes(field) ? step : { ...step, fields: [...step.fields, field] }\n\t\t}\n\t\treturn step.fields.includes(field)\n\t\t\t? { ...step, fields: step.fields.filter((f) => f !== field) }\n\t\t\t: step\n\t})\n\n/** Remove a field key from the step at `targetIndex`, leaving other steps untouched. */\nexport const removeFieldFromStep = (\n\tsteps: FlowStep[],\n\ttargetIndex: number,\n\tfield: string\n): FlowStep[] =>\n\tsteps.map((step, index) =>\n\t\tindex === targetIndex && step.fields.includes(field)\n\t\t\t? { ...step, fields: step.fields.filter((f) => f !== field) }\n\t\t\t: step\n\t)\n\n/**\n * Remove the step at `index` and every reference to it: another step's `next` pointing at it\n * returns to absent (sequential fall-through), and transitions targeting it are dropped. Without\n * the cascade a dangling `next` would silently route into whatever step follows it in the array.\n */\nexport const removeStepCascade = (steps: FlowStep[], index: number): FlowStep[] => {\n\tconst removed = steps[index]\n\tconst rest = steps.filter((_, i) => i !== index)\n\tif (!removed) {\n\t\treturn rest\n\t}\n\treturn rest.map((step) => {\n\t\tconst keptTransitions = (step.transitions ?? []).filter((t) => t.to !== removed.id)\n\t\tconst dropsNext = step.next === removed.id\n\t\tconst dropsTransitions = keptTransitions.length !== (step.transitions?.length ?? 0)\n\t\tif (!dropsNext && !dropsTransitions) {\n\t\t\treturn step\n\t\t}\n\t\tconst { next, transitions, ...base } = step\n\t\tconst cleaned: FlowStep = { ...base }\n\t\tif (!dropsNext && next !== undefined) cleaned.next = next\n\t\tif (keptTransitions.length > 0) cleaned.transitions = keptTransitions\n\t\treturn cleaned\n\t})\n}\n"],"mappings":"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"}
@@ -1,44 +1,55 @@
1
+ import { fixedFieldOptions } from "../fields/data/regions.js";
1
2
  //#region src/client/synthesizeClientField.ts
2
- /** Project a stored field row into a condition operand, or `null` when the row has no usable name. */
3
+ /**
4
+ * Project a stored field row into a condition operand, or `null` when the row has no usable name or
5
+ * its type is absent from the condition-type map (not conditionable, e.g. a display-only message).
6
+ */
3
7
  const operandFromRow = (row, conditionTypes) => {
4
8
  const name = typeof row.name === "string" ? row.name.trim() : "";
5
9
  if (name.length === 0) return null;
6
- const conditionType = conditionTypes[row.blockType] ?? "text";
10
+ const conditionType = conditionTypes[row.blockType];
11
+ if (!conditionType) return null;
7
12
  return {
8
13
  name,
9
14
  label: typeof row.label === "string" && row.label.length > 0 ? row.label : name,
10
15
  conditionType,
11
- options: Array.isArray(row.options) ? row.options : void 0
16
+ options: Array.isArray(row.options) ? row.options : fixedFieldOptions(row.blockType)
12
17
  };
13
18
  };
14
19
  /**
15
20
  * Build the minimal `*FieldClient` a Payload leaf condition input requires for a given operand. Casts
16
21
  * are localized to these four synths and nowhere else: `FieldBaseClient` requires only `name`, and each
17
22
  * leaf is `FieldBaseClient & Pick<…, 'type' | …>` where every picked member but `type` (and `select`'s
18
- * required `options`) is optional, so the literals are structurally complete. `dateClientField` omits
19
- * `admin.date`, so `DateCondition` falls back to its default date format. Each synth returns a single
20
- * concrete client type so leaf `field` props need no narrowing.
23
+ * required `options`) is optional, so the literals are structurally complete. Every synth carries an
24
+ * `admin: {}` because Payload's `Select` and `Date` leaf inputs read `field.admin.placeholder`
25
+ * unguarded and throw on a missing `admin`; the empty object also leaves `admin.date` unset, so
26
+ * `DateCondition` still falls back to its default date format. Each synth returns a single concrete
27
+ * client type so leaf `field` props need no narrowing.
21
28
  */
22
29
  const textClientField = (operand) => ({
23
30
  name: operand.name,
24
31
  label: operand.label,
25
- type: "text"
32
+ type: "text",
33
+ admin: {}
26
34
  });
27
35
  const numberClientField = (operand) => ({
28
36
  name: operand.name,
29
37
  label: operand.label,
30
- type: "number"
38
+ type: "number",
39
+ admin: {}
31
40
  });
32
41
  const dateClientField = (operand) => ({
33
42
  name: operand.name,
34
43
  label: operand.label,
35
- type: "date"
44
+ type: "date",
45
+ admin: {}
36
46
  });
37
47
  const selectClientField = (operand) => ({
38
48
  name: operand.name,
39
49
  label: operand.label,
40
50
  type: "select",
41
- options: operand.options ?? []
51
+ options: operand.options ?? [],
52
+ admin: {}
42
53
  });
43
54
  //#endregion
44
55
  export { dateClientField, numberClientField, operandFromRow, selectClientField, textClientField };
@@ -1 +1 @@
1
- {"version":3,"file":"synthesizeClientField.js","names":[],"sources":["../../src/client/synthesizeClientField.ts"],"sourcesContent":["import type {\n\tDateFieldClient,\n\tNumberFieldClient,\n\tOption,\n\tSelectFieldClient,\n\tTextFieldClient,\n} from 'payload'\nimport type { ConditionFieldType } from '../conditions/fieldTypes'\n\n/** A field row as stored in the form's `fields` blocks array (only the keys the builder reads). */\nexport type FieldRow = {\n\tblockType: string\n\tname?: string\n\tlabel?: string\n\toptions?: Option[]\n\t[key: string]: unknown\n}\n\n/** A condition operand: a selectable form field the builder can compare against. */\nexport type ConditionOperand = {\n\tname: string\n\tlabel: string\n\tconditionType: ConditionFieldType\n\toptions?: Option[]\n}\n\n/** Project a stored field row into a condition operand, or `null` when the row has no usable name. */\nexport const operandFromRow = (\n\trow: FieldRow,\n\tconditionTypes: Record<string, ConditionFieldType>\n): ConditionOperand | null => {\n\tconst name = typeof row.name === 'string' ? row.name.trim() : ''\n\tif (name.length === 0) {\n\t\treturn null\n\t}\n\tconst conditionType = conditionTypes[row.blockType] ?? 'text'\n\treturn {\n\t\tname,\n\t\tlabel: typeof row.label === 'string' && row.label.length > 0 ? row.label : name,\n\t\tconditionType,\n\t\toptions: Array.isArray(row.options) ? row.options : undefined,\n\t}\n}\n\n/**\n * Build the minimal `*FieldClient` a Payload leaf condition input requires for a given operand. Casts\n * are localized to these four synths and nowhere else: `FieldBaseClient` requires only `name`, and each\n * leaf is `FieldBaseClient & Pick<…, 'type' | …>` where every picked member but `type` (and `select`'s\n * required `options`) is optional, so the literals are structurally complete. `dateClientField` omits\n * `admin.date`, so `DateCondition` falls back to its default date format. Each synth returns a single\n * concrete client type so leaf `field` props need no narrowing.\n */\nexport const textClientField = (operand: ConditionOperand): TextFieldClient =>\n\t({ name: operand.name, label: operand.label, type: 'text' }) as TextFieldClient\n\nexport const numberClientField = (operand: ConditionOperand): NumberFieldClient =>\n\t({ name: operand.name, label: operand.label, type: 'number' }) as NumberFieldClient\n\nexport const dateClientField = (operand: ConditionOperand): DateFieldClient =>\n\t({ name: operand.name, label: operand.label, type: 'date' }) as DateFieldClient\n\nexport const selectClientField = (operand: ConditionOperand): SelectFieldClient =>\n\t({\n\t\tname: operand.name,\n\t\tlabel: operand.label,\n\t\ttype: 'select',\n\t\toptions: operand.options ?? [],\n\t}) as SelectFieldClient\n"],"mappings":";;AA2BA,MAAa,kBACZ,KACA,mBAC6B;CAC7B,MAAM,OAAO,OAAO,IAAI,SAAS,WAAW,IAAI,KAAK,KAAK,IAAI;CAC9D,IAAI,KAAK,WAAW,GACnB,OAAO;CAER,MAAM,gBAAgB,eAAe,IAAI,cAAc;CACvD,OAAO;EACN;EACA,OAAO,OAAO,IAAI,UAAU,YAAY,IAAI,MAAM,SAAS,IAAI,IAAI,QAAQ;EAC3E;EACA,SAAS,MAAM,QAAQ,IAAI,OAAO,IAAI,IAAI,UAAU,KAAA;CACrD;AACD;;;;;;;;;AAUA,MAAa,mBAAmB,aAC9B;CAAE,MAAM,QAAQ;CAAM,OAAO,QAAQ;CAAO,MAAM;AAAO;AAE3D,MAAa,qBAAqB,aAChC;CAAE,MAAM,QAAQ;CAAM,OAAO,QAAQ;CAAO,MAAM;AAAS;AAE7D,MAAa,mBAAmB,aAC9B;CAAE,MAAM,QAAQ;CAAM,OAAO,QAAQ;CAAO,MAAM;AAAO;AAE3D,MAAa,qBAAqB,aAChC;CACA,MAAM,QAAQ;CACd,OAAO,QAAQ;CACf,MAAM;CACN,SAAS,QAAQ,WAAW,CAAC;AAC9B"}
1
+ {"version":3,"file":"synthesizeClientField.js","names":[],"sources":["../../src/client/synthesizeClientField.ts"],"sourcesContent":["import type {\n\tDateFieldClient,\n\tNumberFieldClient,\n\tOption,\n\tSelectFieldClient,\n\tTextFieldClient,\n} from 'payload'\nimport type { ConditionFieldType } from '../conditions/fieldTypes'\nimport { fixedFieldOptions } from '../fields/data/regions'\n\n/** A field row as stored in the form's `fields` blocks array (only the keys the builder reads). */\nexport type FieldRow = {\n\tblockType: string\n\tname?: string\n\tlabel?: string\n\toptions?: Option[]\n\t/** A bare message block's richText body; see `messageSnippet`. */\n\tcontent?: unknown\n\t[key: string]: unknown\n}\n\n/** A condition operand: a selectable form field the builder can compare against. */\nexport type ConditionOperand = {\n\tname: string\n\tlabel: string\n\tconditionType: ConditionFieldType\n\toptions?: Option[]\n}\n\n/**\n * Project a stored field row into a condition operand, or `null` when the row has no usable name or\n * its type is absent from the condition-type map (not conditionable, e.g. a display-only message).\n */\nexport const operandFromRow = (\n\trow: FieldRow,\n\tconditionTypes: Record<string, ConditionFieldType>\n): ConditionOperand | null => {\n\tconst name = typeof row.name === 'string' ? row.name.trim() : ''\n\tif (name.length === 0) {\n\t\treturn null\n\t}\n\tconst conditionType = conditionTypes[row.blockType]\n\tif (!conditionType) {\n\t\treturn null\n\t}\n\treturn {\n\t\tname,\n\t\tlabel: typeof row.label === 'string' && row.label.length > 0 ? row.label : name,\n\t\tconditionType,\n\t\t// Country/state author no options but are `select`-typed conditions, so offer their fixed set.\n\t\toptions: Array.isArray(row.options) ? row.options : fixedFieldOptions(row.blockType),\n\t}\n}\n\n/**\n * Build the minimal `*FieldClient` a Payload leaf condition input requires for a given operand. Casts\n * are localized to these four synths and nowhere else: `FieldBaseClient` requires only `name`, and each\n * leaf is `FieldBaseClient & Pick<…, 'type' | …>` where every picked member but `type` (and `select`'s\n * required `options`) is optional, so the literals are structurally complete. Every synth carries an\n * `admin: {}` because Payload's `Select` and `Date` leaf inputs read `field.admin.placeholder`\n * unguarded and throw on a missing `admin`; the empty object also leaves `admin.date` unset, so\n * `DateCondition` still falls back to its default date format. Each synth returns a single concrete\n * client type so leaf `field` props need no narrowing.\n */\nexport const textClientField = (operand: ConditionOperand): TextFieldClient =>\n\t({ name: operand.name, label: operand.label, type: 'text', admin: {} }) as TextFieldClient\n\nexport const numberClientField = (operand: ConditionOperand): NumberFieldClient =>\n\t({ name: operand.name, label: operand.label, type: 'number', admin: {} }) as NumberFieldClient\n\nexport const dateClientField = (operand: ConditionOperand): DateFieldClient =>\n\t({ name: operand.name, label: operand.label, type: 'date', admin: {} }) as DateFieldClient\n\nexport const selectClientField = (operand: ConditionOperand): SelectFieldClient =>\n\t({\n\t\tname: operand.name,\n\t\tlabel: operand.label,\n\t\ttype: 'select',\n\t\toptions: operand.options ?? [],\n\t\tadmin: {},\n\t}) as SelectFieldClient\n"],"mappings":";;;;;;AAiCA,MAAa,kBACZ,KACA,mBAC6B;CAC7B,MAAM,OAAO,OAAO,IAAI,SAAS,WAAW,IAAI,KAAK,KAAK,IAAI;CAC9D,IAAI,KAAK,WAAW,GACnB,OAAO;CAER,MAAM,gBAAgB,eAAe,IAAI;CACzC,IAAI,CAAC,eACJ,OAAO;CAER,OAAO;EACN;EACA,OAAO,OAAO,IAAI,UAAU,YAAY,IAAI,MAAM,SAAS,IAAI,IAAI,QAAQ;EAC3E;EAEA,SAAS,MAAM,QAAQ,IAAI,OAAO,IAAI,IAAI,UAAU,kBAAkB,IAAI,SAAS;CACpF;AACD;;;;;;;;;;;AAYA,MAAa,mBAAmB,aAC9B;CAAE,MAAM,QAAQ;CAAM,OAAO,QAAQ;CAAO,MAAM;CAAQ,OAAO,CAAC;AAAE;AAEtE,MAAa,qBAAqB,aAChC;CAAE,MAAM,QAAQ;CAAM,OAAO,QAAQ;CAAO,MAAM;CAAU,OAAO,CAAC;AAAE;AAExE,MAAa,mBAAmB,aAC9B;CAAE,MAAM,QAAQ;CAAM,OAAO,QAAQ;CAAO,MAAM;CAAQ,OAAO,CAAC;AAAE;AAEtE,MAAa,qBAAqB,aAChC;CACA,MAAM,QAAQ;CACd,OAAO,QAAQ;CACf,MAAM;CACN,SAAS,QAAQ,WAAW,CAAC;CAC7B,OAAO,CAAC;AACT"}
@@ -0,0 +1,13 @@
1
+ //#region src/client/toStaticLabel.ts
2
+ /**
3
+ * Narrows the untyped `label` a custom Field component receives (via `field.label` or the
4
+ * top-level prop) to a renderable static label, dropping functions and other non-static shapes.
5
+ */
6
+ const toStaticLabel = (label) => {
7
+ if (typeof label === "string") return label;
8
+ if (label && typeof label === "object") return label;
9
+ };
10
+ //#endregion
11
+ export { toStaticLabel };
12
+
13
+ //# sourceMappingURL=toStaticLabel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toStaticLabel.js","names":[],"sources":["../../src/client/toStaticLabel.ts"],"sourcesContent":["import type { StaticLabel } from 'payload'\n\n/**\n * Narrows the untyped `label` a custom Field component receives (via `field.label` or the\n * top-level prop) to a renderable static label, dropping functions and other non-static shapes.\n */\nexport const toStaticLabel = (label: unknown): StaticLabel | undefined => {\n\tif (typeof label === 'string') {\n\t\treturn label\n\t}\n\tif (label && typeof label === 'object') {\n\t\treturn label as Record<string, string>\n\t}\n\treturn undefined\n}\n"],"mappings":";;;;;AAMA,MAAa,iBAAiB,UAA4C;CACzE,IAAI,OAAO,UAAU,UACpB,OAAO;CAER,IAAI,SAAS,OAAO,UAAU,UAC7B,OAAO;AAGT"}
@@ -0,0 +1,34 @@
1
+ import { Field } from "payload";
2
+
3
+ //#region src/collections/buttonFields.d.ts
4
+ /** The default button-label fields, keyed by button. What the `buttons.fields` seam receives. */
5
+ type DefaultButtonFields = {
6
+ submit: Field;
7
+ prev: Field;
8
+ next: Field;
9
+ };
10
+ /**
11
+ * Composes the three form-level button fields. Receives the defaults with the content localization
12
+ * flag already applied and returns the field for each slot; the collection places `submit` at the
13
+ * bottom of the Fields tab and `prev`/`next` in a row on the Flow tab. Any slot may return the
14
+ * default, a replacement, or the default wrapped in a `row` alongside a host field (e.g. an icon
15
+ * select), so adjacent fields ride along in the same slot.
16
+ */
17
+ type ButtonFieldsOverride = (args: {
18
+ defaultFields: DefaultButtonFields;
19
+ }) => DefaultButtonFields;
20
+ /** The plugin `buttons` option: form-level button labels and the group's composition seam. */
21
+ type ButtonsOption = {
22
+ fields?: ButtonFieldsOverride;
23
+ };
24
+ /** The default submit button label field (`buttons.submitLabel`), localized when `localize` is true. */
25
+ declare const buildSubmitLabelField: (localize: boolean) => Field;
26
+ /** The default "Next" button label field (`buttons.nextLabel`); applies to multi-step forms. */
27
+ declare const buildNextLabelField: (localize: boolean) => Field;
28
+ /** The default "Previous" button label field (`buttons.prevLabel`); applies to multi-step forms. */
29
+ declare const buildPrevLabelField: (localize: boolean) => Field;
30
+ /** All three defaults with the localization flag applied: exactly what the seam is handed. */
31
+ declare const buildDefaultButtonFields: (localize: boolean) => DefaultButtonFields;
32
+ //#endregion
33
+ export { ButtonFieldsOverride, ButtonsOption, DefaultButtonFields, buildDefaultButtonFields, buildNextLabelField, buildPrevLabelField, buildSubmitLabelField };
34
+ //# sourceMappingURL=buttonFields.d.ts.map
@@ -0,0 +1,35 @@
1
+ import { keys } from "../translations/keys.js";
2
+ import { labelForKey } from "../translations/server.js";
3
+ import { localizedIf } from "../fields/localizedIf.js";
4
+ //#region src/collections/buttonFields.ts
5
+ /** The default submit button label field (`buttons.submitLabel`), localized when `localize` is true. */
6
+ const buildSubmitLabelField = (localize) => ({
7
+ name: "submitLabel",
8
+ type: "text",
9
+ label: labelForKey(keys.buttonsSubmitLabel),
10
+ ...localizedIf(localize)
11
+ });
12
+ /** The default "Next" button label field (`buttons.nextLabel`); applies to multi-step forms. */
13
+ const buildNextLabelField = (localize) => ({
14
+ name: "nextLabel",
15
+ type: "text",
16
+ label: labelForKey(keys.buttonsNextLabel),
17
+ ...localizedIf(localize)
18
+ });
19
+ /** The default "Previous" button label field (`buttons.prevLabel`); applies to multi-step forms. */
20
+ const buildPrevLabelField = (localize) => ({
21
+ name: "prevLabel",
22
+ type: "text",
23
+ label: labelForKey(keys.buttonsPrevLabel),
24
+ ...localizedIf(localize)
25
+ });
26
+ /** All three defaults with the localization flag applied: exactly what the seam is handed. */
27
+ const buildDefaultButtonFields = (localize) => ({
28
+ submit: buildSubmitLabelField(localize),
29
+ prev: buildPrevLabelField(localize),
30
+ next: buildNextLabelField(localize)
31
+ });
32
+ //#endregion
33
+ export { buildDefaultButtonFields, buildNextLabelField, buildPrevLabelField, buildSubmitLabelField };
34
+
35
+ //# sourceMappingURL=buttonFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buttonFields.js","names":[],"sources":["../../src/collections/buttonFields.ts"],"sourcesContent":["import type { Field } from 'payload'\nimport { localizedIf } from '../fields/localizedIf'\nimport { keys } from '../translations/keys'\nimport { labelForKey } from '../translations/server'\n\n/** The default button-label fields, keyed by button. What the `buttons.fields` seam receives. */\nexport type DefaultButtonFields = {\n\tsubmit: Field\n\tprev: Field\n\tnext: Field\n}\n\n/**\n * Composes the three form-level button fields. Receives the defaults with the content localization\n * flag already applied and returns the field for each slot; the collection places `submit` at the\n * bottom of the Fields tab and `prev`/`next` in a row on the Flow tab. Any slot may return the\n * default, a replacement, or the default wrapped in a `row` alongside a host field (e.g. an icon\n * select), so adjacent fields ride along in the same slot.\n */\nexport type ButtonFieldsOverride = (args: {\n\tdefaultFields: DefaultButtonFields\n}) => DefaultButtonFields\n\n/** The plugin `buttons` option: form-level button labels and the group's composition seam. */\nexport type ButtonsOption = {\n\tfields?: ButtonFieldsOverride\n}\n\n/** The default submit button label field (`buttons.submitLabel`), localized when `localize` is true. */\nexport const buildSubmitLabelField = (localize: boolean): Field => ({\n\tname: 'submitLabel',\n\ttype: 'text',\n\tlabel: labelForKey(keys.buttonsSubmitLabel),\n\t...localizedIf(localize),\n})\n\n/** The default \"Next\" button label field (`buttons.nextLabel`); applies to multi-step forms. */\nexport const buildNextLabelField = (localize: boolean): Field => ({\n\tname: 'nextLabel',\n\ttype: 'text',\n\tlabel: labelForKey(keys.buttonsNextLabel),\n\t...localizedIf(localize),\n})\n\n/** The default \"Previous\" button label field (`buttons.prevLabel`); applies to multi-step forms. */\nexport const buildPrevLabelField = (localize: boolean): Field => ({\n\tname: 'prevLabel',\n\ttype: 'text',\n\tlabel: labelForKey(keys.buttonsPrevLabel),\n\t...localizedIf(localize),\n})\n\n/** All three defaults with the localization flag applied: exactly what the seam is handed. */\nexport const buildDefaultButtonFields = (localize: boolean): DefaultButtonFields => ({\n\tsubmit: buildSubmitLabelField(localize),\n\tprev: buildPrevLabelField(localize),\n\tnext: buildNextLabelField(localize),\n})\n"],"mappings":";;;;;AA6BA,MAAa,yBAAyB,cAA8B;CACnE,MAAM;CACN,MAAM;CACN,OAAO,YAAY,KAAK,kBAAkB;CAC1C,GAAG,YAAY,QAAQ;AACxB;;AAGA,MAAa,uBAAuB,cAA8B;CACjE,MAAM;CACN,MAAM;CACN,OAAO,YAAY,KAAK,gBAAgB;CACxC,GAAG,YAAY,QAAQ;AACxB;;AAGA,MAAa,uBAAuB,cAA8B;CACjE,MAAM;CACN,MAAM;CACN,OAAO,YAAY,KAAK,gBAAgB;CACxC,GAAG,YAAY,QAAQ;AACxB;;AAGA,MAAa,4BAA4B,cAA4C;CACpF,QAAQ,sBAAsB,QAAQ;CACtC,MAAM,oBAAoB,QAAQ;CAClC,MAAM,oBAAoB,QAAQ;AACnC"}
@@ -0,0 +1,15 @@
1
+ //#region src/collections/cells/FieldCountCell.d.ts
2
+ /** The subset of Payload's `DefaultCellComponentProps` this cell reads: the raw `fields` blocks array. */
3
+ type FieldCountCellProps = {
4
+ cellData?: unknown[] | null;
5
+ };
6
+ /**
7
+ * List-view cell for the `fields` blocks field: a localized field count instead of Payload's
8
+ * default "N Fields - Text, Email, ..." block-type summary.
9
+ */
10
+ declare const FieldCountCell: ({
11
+ cellData
12
+ }: FieldCountCellProps) => import("react/jsx-runtime").JSX.Element;
13
+ //#endregion
14
+ export { FieldCountCell };
15
+ //# sourceMappingURL=FieldCountCell.d.ts.map
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import { keys } from "../../translations/keys.js";
3
+ import { useTranslation } from "../../translations/useTranslation.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region src/collections/cells/FieldCountCell.tsx
6
+ /**
7
+ * List-view cell for the `fields` blocks field: a localized field count instead of Payload's
8
+ * default "N Fields - Text, Email, ..." block-type summary.
9
+ */
10
+ const FieldCountCell = ({ cellData }) => {
11
+ const { t } = useTranslation();
12
+ const count = Array.isArray(cellData) ? cellData.length : 0;
13
+ return /* @__PURE__ */ jsx("span", { children: t(count === 1 ? keys.cellFieldCountOne : keys.cellFieldCountOther, { count }) });
14
+ };
15
+ //#endregion
16
+ export { FieldCountCell };
17
+
18
+ //# sourceMappingURL=FieldCountCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldCountCell.js","names":[],"sources":["../../../src/collections/cells/FieldCountCell.tsx"],"sourcesContent":["'use client'\n\nimport { keys } from '../../translations/keys'\nimport { useTranslation } from '../../translations/useTranslation'\n\n/** The subset of Payload's `DefaultCellComponentProps` this cell reads: the raw `fields` blocks array. */\ntype FieldCountCellProps = {\n\tcellData?: unknown[] | null\n}\n\n/**\n * List-view cell for the `fields` blocks field: a localized field count instead of Payload's\n * default \"N Fields - Text, Email, ...\" block-type summary.\n */\nexport const FieldCountCell = ({ cellData }: FieldCountCellProps) => {\n\tconst { t } = useTranslation()\n\tconst count = Array.isArray(cellData) ? cellData.length : 0\n\treturn (\n\t\t<span>{t(count === 1 ? keys.cellFieldCountOne : keys.cellFieldCountOther, { count })}</span>\n\t)\n}\n"],"mappings":";;;;;;;;;AAcA,MAAa,kBAAkB,EAAE,eAAoC;CACpE,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,QAAQ,MAAM,QAAQ,QAAQ,IAAI,SAAS,SAAS;CAC1D,OACC,oBAAC,QAAD,EAAA,UAAO,EAAE,UAAU,IAAI,KAAK,oBAAoB,KAAK,qBAAqB,EAAE,MAAM,CAAC,EAAQ,CAAA;AAE7F"}
@@ -0,0 +1,14 @@
1
+ //#region src/collections/cells/FlowStepsCell.d.ts
2
+ /** The subset of Payload's `DefaultCellComponentProps` this cell reads: the raw `flow` json value. */
3
+ type FlowStepsCellProps = {
4
+ cellData?: {
5
+ steps?: unknown[];
6
+ } | null;
7
+ };
8
+ /** List-view cell for the `flow` json field: a localized step count instead of raw JSON. */
9
+ declare const FlowStepsCell: ({
10
+ cellData
11
+ }: FlowStepsCellProps) => import("react/jsx-runtime").JSX.Element;
12
+ //#endregion
13
+ export { FlowStepsCell };
14
+ //# sourceMappingURL=FlowStepsCell.d.ts.map
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { keys } from "../../translations/keys.js";
3
+ import { useTranslation } from "../../translations/useTranslation.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region src/collections/cells/FlowStepsCell.tsx
6
+ const stepCountOf = (cellData) => Array.isArray(cellData?.steps) ? cellData.steps.length : 0;
7
+ /** List-view cell for the `flow` json field: a localized step count instead of raw JSON. */
8
+ const FlowStepsCell = ({ cellData }) => {
9
+ const { t } = useTranslation();
10
+ const count = stepCountOf(cellData);
11
+ if (count === 0) return /* @__PURE__ */ jsx("span", { children: "—" });
12
+ return /* @__PURE__ */ jsx("span", { children: t(count === 1 ? keys.cellStepCountOne : keys.cellStepCountOther, { count }) });
13
+ };
14
+ //#endregion
15
+ export { FlowStepsCell };
16
+
17
+ //# sourceMappingURL=FlowStepsCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlowStepsCell.js","names":[],"sources":["../../../src/collections/cells/FlowStepsCell.tsx"],"sourcesContent":["'use client'\n\nimport { keys } from '../../translations/keys'\nimport { useTranslation } from '../../translations/useTranslation'\n\n/** The subset of Payload's `DefaultCellComponentProps` this cell reads: the raw `flow` json value. */\ntype FlowStepsCellProps = {\n\tcellData?: { steps?: unknown[] } | null\n}\n\nconst stepCountOf = (cellData: FlowStepsCellProps['cellData']): number =>\n\tArray.isArray(cellData?.steps) ? cellData.steps.length : 0\n\n/** List-view cell for the `flow` json field: a localized step count instead of raw JSON. */\nexport const FlowStepsCell = ({ cellData }: FlowStepsCellProps) => {\n\tconst { t } = useTranslation()\n\tconst count = stepCountOf(cellData)\n\tif (count === 0) {\n\t\treturn <span>—</span>\n\t}\n\treturn <span>{t(count === 1 ? keys.cellStepCountOne : keys.cellStepCountOther, { count })}</span>\n}\n"],"mappings":";;;;;AAUA,MAAM,eAAe,aACpB,MAAM,QAAQ,UAAU,KAAK,IAAI,SAAS,MAAM,SAAS;;AAG1D,MAAa,iBAAiB,EAAE,eAAmC;CAClE,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,QAAQ,YAAY,QAAQ;CAClC,IAAI,UAAU,GACb,OAAO,oBAAC,QAAD,EAAA,UAAM,IAAO,CAAA;CAErB,OAAO,oBAAC,QAAD,EAAA,UAAO,EAAE,UAAU,IAAI,KAAK,mBAAmB,KAAK,oBAAoB,EAAE,MAAM,CAAC,EAAQ,CAAA;AACjG"}