@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
@@ -1,40 +1,127 @@
1
1
  import { keys } from "../../translations/keys.js";
2
2
  import { labelFor } from "../../translations/server.js";
3
3
  import { defineFormField } from "../defineFormField.js";
4
+ import { mimeAllowed } from "../../uploads/resolveFileRef.js";
4
5
  //#region src/fields/builtin/file.ts
5
6
  const isFileRef = (value) => typeof value === "object" && value !== null && "filename" in value;
7
+ const MAX_SIZE_REF = "@10x-media/form-builder/client#ByteSizeField";
8
+ /**
9
+ * Curated MIME type choices for the file field's `mimeTypes` select. Values are raw MIME strings or
10
+ * trailing-`*` prefix wildcards, exactly the patterns `resolveFileRef` matches server-side; `type/*`
11
+ * values double as the file input's `accept` attribute (browsers ignore other prefix patterns, which
12
+ * is fine since the server stays authoritative). Every value must be 63 bytes or less: Payload's
13
+ * db-postgres adapter stores select options as a pg enum, and pg enum labels cap at 63 bytes.
14
+ */
15
+ const fileMimeTypeOptions = [
16
+ {
17
+ label: "Any image",
18
+ value: "image/*"
19
+ },
20
+ {
21
+ label: "PNG image",
22
+ value: "image/png"
23
+ },
24
+ {
25
+ label: "JPEG image",
26
+ value: "image/jpeg"
27
+ },
28
+ {
29
+ label: "WebP image",
30
+ value: "image/webp"
31
+ },
32
+ {
33
+ label: "GIF image",
34
+ value: "image/gif"
35
+ },
36
+ {
37
+ label: "SVG image",
38
+ value: "image/svg+xml"
39
+ },
40
+ {
41
+ label: "PDF",
42
+ value: "application/pdf"
43
+ },
44
+ {
45
+ label: "Plain text",
46
+ value: "text/plain"
47
+ },
48
+ {
49
+ label: "CSV",
50
+ value: "text/csv"
51
+ },
52
+ {
53
+ label: "ZIP archive",
54
+ value: "application/zip"
55
+ },
56
+ {
57
+ label: "Word document (.doc)",
58
+ value: "application/msword"
59
+ },
60
+ {
61
+ label: "Excel spreadsheet (.xls)",
62
+ value: "application/vnd.ms-excel"
63
+ },
64
+ {
65
+ label: "Office documents (docx, xlsx, pptx)",
66
+ value: "application/vnd.openxmlformats-officedocument.*"
67
+ },
68
+ {
69
+ label: "Any audio",
70
+ value: "audio/*"
71
+ },
72
+ {
73
+ label: "Any video",
74
+ value: "video/*"
75
+ }
76
+ ];
6
77
  /**
7
78
  * The `file` field type. Its stored value is a server-captured {@link FileRef}; the client only ever submits
8
79
  * the upload id, and `runSubmission` re-reads filename/mimeType/filesize from the upload doc at the trust
9
80
  * boundary (see `captureFileRef`). The intrinsic validator is intentionally a no-op: MIME/size/existence are
10
- * enforced authoritatively server-side against the stored doc, never against client metadata. `relationTo`,
11
- * `mimeTypes`, and `maxSize` persist on the block so the capture can enforce them.
81
+ * enforced authoritatively server-side against the stored doc, never against client metadata. `mimeTypes`
82
+ * and `maxSize` persist on the block so the capture can enforce them. `uploadsCollection` is not
83
+ * author-editable: a forms hook stamps the plugin-configured uploads collection slug onto it on every save
84
+ * so the client renderer knows where to POST; the server never trusts it at submit time (plugin config
85
+ * stays the source of truth). Named `uploadsCollection` because `collection` is a mongoose-reserved
86
+ * schema pathname.
87
+ *
88
+ * `allowedMimeTypes` (the host upload collection's `upload.mimeTypes`, threaded from the plugin
89
+ * factory) constrains the picker's MIME options to what the collection actually accepts; omitted
90
+ * keeps the full list. Admin-time only: the collection and `captureFileRef` remain authoritative.
12
91
  */
13
- const fileField = defineFormField({
92
+ const buildFileField = (allowedMimeTypes) => defineFormField({
14
93
  type: "file",
15
94
  label: keys.fieldTypeFile,
16
95
  value: "file",
96
+ omitShared: ["placeholder"],
17
97
  config: [
18
98
  {
19
- name: "relationTo",
99
+ name: "uploadsCollection",
20
100
  type: "text",
21
- label: labelFor(keys.fileConfigRelationTo)
101
+ admin: { hidden: true }
22
102
  },
23
103
  {
24
104
  name: "mimeTypes",
25
- type: "text",
105
+ type: "select",
26
106
  hasMany: true,
107
+ options: fileMimeTypeOptions.filter((option) => mimeAllowed(option.value, allowedMimeTypes)),
27
108
  label: labelFor(keys.fileConfigMimeTypes)
28
109
  },
29
110
  {
30
111
  name: "maxSize",
31
112
  type: "number",
32
- label: labelFor(keys.fileConfigMaxSize)
113
+ min: 0,
114
+ label: labelFor(keys.fileConfigMaxSize),
115
+ admin: { components: { Field: {
116
+ path: MAX_SIZE_REF,
117
+ clientProps: { descriptionKey: keys.fileConfigMaxSizeDescription }
118
+ } } }
33
119
  }
34
120
  ],
35
121
  format: ({ value }) => isFileRef(value) ? value.filename : ""
36
122
  });
123
+ buildFileField();
37
124
  //#endregion
38
- export { fileField };
125
+ export { buildFileField, fileMimeTypeOptions };
39
126
 
40
127
  //# sourceMappingURL=file.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"file.js","names":[],"sources":["../../../src/fields/builtin/file.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { labelFor } from '../../translations/server'\nimport type { FileRef } from '../../uploads/types'\nimport { defineFormField } from '../defineFormField'\n\ntype FileConfig = {\n\trelationTo?: string\n\tmimeTypes?: string[]\n\tmaxSize?: number\n}\n\nconst isFileRef = (value: unknown): value is FileRef =>\n\ttypeof value === 'object' && value !== null && 'filename' in value\n\n/**\n * The `file` field type. Its stored value is a server-captured {@link FileRef}; the client only ever submits\n * the upload id, and `runSubmission` re-reads filename/mimeType/filesize from the upload doc at the trust\n * boundary (see `captureFileRef`). The intrinsic validator is intentionally a no-op: MIME/size/existence are\n * enforced authoritatively server-side against the stored doc, never against client metadata. `relationTo`,\n * `mimeTypes`, and `maxSize` persist on the block so the capture can enforce them.\n */\nexport const fileField = defineFormField<'file', FileConfig>({\n\ttype: 'file',\n\tlabel: keys.fieldTypeFile,\n\tvalue: 'file',\n\tconfig: [\n\t\t{ name: 'relationTo', type: 'text', label: labelFor(keys.fileConfigRelationTo) },\n\t\t{ name: 'mimeTypes', type: 'text', hasMany: true, label: labelFor(keys.fileConfigMimeTypes) },\n\t\t{ name: 'maxSize', type: 'number', label: labelFor(keys.fileConfigMaxSize) },\n\t],\n\tformat: ({ value }) => (isFileRef(value) ? value.filename : ''),\n})\n"],"mappings":";;;;AAWA,MAAM,aAAa,UAClB,OAAO,UAAU,YAAY,UAAU,QAAQ,cAAc;;;;;;;;AAS9D,MAAa,YAAY,gBAAoC;CAC5D,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,QAAQ;EACP;GAAE,MAAM;GAAc,MAAM;GAAQ,OAAO,SAAS,KAAK,oBAAoB;EAAE;EAC/E;GAAE,MAAM;GAAa,MAAM;GAAQ,SAAS;GAAM,OAAO,SAAS,KAAK,mBAAmB;EAAE;EAC5F;GAAE,MAAM;GAAW,MAAM;GAAU,OAAO,SAAS,KAAK,iBAAiB;EAAE;CAC5E;CACA,SAAS,EAAE,YAAa,UAAU,KAAK,IAAI,MAAM,WAAW;AAC7D,CAAC"}
1
+ {"version":3,"file":"file.js","names":[],"sources":["../../../src/fields/builtin/file.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { labelFor } from '../../translations/server'\nimport { mimeAllowed } from '../../uploads/resolveFileRef'\nimport type { FileRef } from '../../uploads/types'\nimport { defineFormField } from '../defineFormField'\n\ntype FileConfig = {\n\tuploadsCollection?: string\n\tmimeTypes?: string[]\n\tmaxSize?: number\n}\n\nconst isFileRef = (value: unknown): value is FileRef =>\n\ttypeof value === 'object' && value !== null && 'filename' in value\n\nconst MAX_SIZE_REF = '@10x-media/form-builder/client#ByteSizeField'\n\n/**\n * Curated MIME type choices for the file field's `mimeTypes` select. Values are raw MIME strings or\n * trailing-`*` prefix wildcards, exactly the patterns `resolveFileRef` matches server-side; `type/*`\n * values double as the file input's `accept` attribute (browsers ignore other prefix patterns, which\n * is fine since the server stays authoritative). Every value must be 63 bytes or less: Payload's\n * db-postgres adapter stores select options as a pg enum, and pg enum labels cap at 63 bytes.\n */\nexport const fileMimeTypeOptions = [\n\t{ label: 'Any image', value: 'image/*' },\n\t{ label: 'PNG image', value: 'image/png' },\n\t{ label: 'JPEG image', value: 'image/jpeg' },\n\t{ label: 'WebP image', value: 'image/webp' },\n\t{ label: 'GIF image', value: 'image/gif' },\n\t{ label: 'SVG image', value: 'image/svg+xml' },\n\t{ label: 'PDF', value: 'application/pdf' },\n\t{ label: 'Plain text', value: 'text/plain' },\n\t{ label: 'CSV', value: 'text/csv' },\n\t{ label: 'ZIP archive', value: 'application/zip' },\n\t{ label: 'Word document (.doc)', value: 'application/msword' },\n\t{ label: 'Excel spreadsheet (.xls)', value: 'application/vnd.ms-excel' },\n\t{\n\t\tlabel: 'Office documents (docx, xlsx, pptx)',\n\t\tvalue: 'application/vnd.openxmlformats-officedocument.*',\n\t},\n\t{ label: 'Any audio', value: 'audio/*' },\n\t{ label: 'Any video', value: 'video/*' },\n]\n\n/**\n * The `file` field type. Its stored value is a server-captured {@link FileRef}; the client only ever submits\n * the upload id, and `runSubmission` re-reads filename/mimeType/filesize from the upload doc at the trust\n * boundary (see `captureFileRef`). The intrinsic validator is intentionally a no-op: MIME/size/existence are\n * enforced authoritatively server-side against the stored doc, never against client metadata. `mimeTypes`\n * and `maxSize` persist on the block so the capture can enforce them. `uploadsCollection` is not\n * author-editable: a forms hook stamps the plugin-configured uploads collection slug onto it on every save\n * so the client renderer knows where to POST; the server never trusts it at submit time (plugin config\n * stays the source of truth). Named `uploadsCollection` because `collection` is a mongoose-reserved\n * schema pathname.\n *\n * `allowedMimeTypes` (the host upload collection's `upload.mimeTypes`, threaded from the plugin\n * factory) constrains the picker's MIME options to what the collection actually accepts; omitted\n * keeps the full list. Admin-time only: the collection and `captureFileRef` remain authoritative.\n */\nexport const buildFileField = (allowedMimeTypes?: string[]) =>\n\tdefineFormField<'file', FileConfig>({\n\t\ttype: 'file',\n\t\tlabel: keys.fieldTypeFile,\n\t\tvalue: 'file',\n\t\tomitShared: ['placeholder'],\n\t\tconfig: [\n\t\t\t{ name: 'uploadsCollection', type: 'text', admin: { hidden: true } },\n\t\t\t{\n\t\t\t\tname: 'mimeTypes',\n\t\t\t\ttype: 'select',\n\t\t\t\thasMany: true,\n\t\t\t\toptions: fileMimeTypeOptions.filter((option) =>\n\t\t\t\t\tmimeAllowed(option.value, allowedMimeTypes)\n\t\t\t\t),\n\t\t\t\tlabel: labelFor(keys.fileConfigMimeTypes),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'maxSize',\n\t\t\t\ttype: 'number',\n\t\t\t\tmin: 0,\n\t\t\t\tlabel: labelFor(keys.fileConfigMaxSize),\n\t\t\t\tadmin: {\n\t\t\t\t\tcomponents: {\n\t\t\t\t\t\tField: {\n\t\t\t\t\t\t\tpath: MAX_SIZE_REF,\n\t\t\t\t\t\t\tclientProps: { descriptionKey: keys.fileConfigMaxSizeDescription },\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tformat: ({ value }) => (isFileRef(value) ? value.filename : ''),\n\t})\n\n/** The file field with the full MIME option list, for consumers spreading a default definition. */\nexport const fileField = buildFileField()\n"],"mappings":";;;;;AAYA,MAAM,aAAa,UAClB,OAAO,UAAU,YAAY,UAAU,QAAQ,cAAc;AAE9D,MAAM,eAAe;;;;;;;;AASrB,MAAa,sBAAsB;CAClC;EAAE,OAAO;EAAa,OAAO;CAAU;CACvC;EAAE,OAAO;EAAa,OAAO;CAAY;CACzC;EAAE,OAAO;EAAc,OAAO;CAAa;CAC3C;EAAE,OAAO;EAAc,OAAO;CAAa;CAC3C;EAAE,OAAO;EAAa,OAAO;CAAY;CACzC;EAAE,OAAO;EAAa,OAAO;CAAgB;CAC7C;EAAE,OAAO;EAAO,OAAO;CAAkB;CACzC;EAAE,OAAO;EAAc,OAAO;CAAa;CAC3C;EAAE,OAAO;EAAO,OAAO;CAAW;CAClC;EAAE,OAAO;EAAe,OAAO;CAAkB;CACjD;EAAE,OAAO;EAAwB,OAAO;CAAqB;CAC7D;EAAE,OAAO;EAA4B,OAAO;CAA2B;CACvE;EACC,OAAO;EACP,OAAO;CACR;CACA;EAAE,OAAO;EAAa,OAAO;CAAU;CACvC;EAAE,OAAO;EAAa,OAAO;CAAU;AACxC;;;;;;;;;;;;;;;;AAiBA,MAAa,kBAAkB,qBAC9B,gBAAoC;CACnC,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,YAAY,CAAC,aAAa;CAC1B,QAAQ;EACP;GAAE,MAAM;GAAqB,MAAM;GAAQ,OAAO,EAAE,QAAQ,KAAK;EAAE;EACnE;GACC,MAAM;GACN,MAAM;GACN,SAAS;GACT,SAAS,oBAAoB,QAAQ,WACpC,YAAY,OAAO,OAAO,gBAAgB,CAC3C;GACA,OAAO,SAAS,KAAK,mBAAmB;EACzC;EACA;GACC,MAAM;GACN,MAAM;GACN,KAAK;GACL,OAAO,SAAS,KAAK,iBAAiB;GACtC,OAAO,EACN,YAAY,EACX,OAAO;IACN,MAAM;IACN,aAAa,EAAE,gBAAgB,KAAK,6BAA6B;GAClE,EACD,EACD;EACD;CACD;CACA,SAAS,EAAE,YAAa,UAAU,KAAK,IAAI,MAAM,WAAW;AAC7D,CAAC;AAGuB,eAAe"}
@@ -0,0 +1,30 @@
1
+ import { AnyFormFieldDefinition } from "../types.js";
2
+ import { CalcAllowed } from "../../calc/normalizeCalc.js";
3
+ import { CalcSourceClientMeta } from "./calculation.js";
4
+ import { RichTextField } from "payload";
5
+
6
+ //#region src/fields/builtin/index.d.ts
7
+ /**
8
+ * Built-in field definitions with content-bearing config fields (select option labels, repeater add
9
+ * label) carrying `localized: true` when `localize` is true. `editor`, when given, overrides the
10
+ * richText editor on the message content field (from the plugin's `richText.editor` option). Field
11
+ * types without content config are shared static definitions. Definitions are authored with precise
12
+ * value/config generics; the registry stores them erased (config is re-narrowed per matched type at
13
+ * execution), hence one cast per built-in, no `any`. `calcAllowed` threads the registered calc
14
+ * extension names into the calculation field's expression validate and editor schema;
15
+ * `calcSources` carries the serializable source metadata the builder UI renders from.
16
+ */
17
+ declare const buildDefaultFieldDefinitions: (localize: boolean, editor?: RichTextField["editor"], uploadMimeTypes?: string[], calcAllowed?: CalcAllowed, calcSources?: CalcSourceClientMeta[]) => AnyFormFieldDefinition[];
18
+ declare const defaultFieldDefinitions: AnyFormFieldDefinition[];
19
+ /**
20
+ * `defaultFieldDefinitions` indexed by `type`, so a single built-in can be spread and tweaked
21
+ * without hand-rolling a `.find()`, e.g.
22
+ * `fields: { text: { ...defaultFieldDefinitionsByType.text, validate: myValidate } }`. The
23
+ * `fields` plugin option replaces a built-in of the same `type`; `false` removes it, `true` keeps it.
24
+ * Prebuilt with content localization on; with `localizeContent: false`, derive overrides from
25
+ * `buildDefaultFieldDefinitions(false)` instead so the spread does not reintroduce `localized`.
26
+ */
27
+ declare const defaultFieldDefinitionsByType: Record<string, AnyFormFieldDefinition>;
28
+ //#endregion
29
+ export { buildDefaultFieldDefinitions, defaultFieldDefinitions, defaultFieldDefinitionsByType };
30
+ //# sourceMappingURL=index.d.ts.map
@@ -1,27 +1,54 @@
1
- import { calculationField } from "./calculation.js";
1
+ import { buildCalculationField } from "./calculation.js";
2
2
  import { checkboxField } from "./checkbox.js";
3
3
  import { consentField } from "./consent.js";
4
+ import { dateField } from "./date.js";
4
5
  import { emailField } from "./email.js";
5
- import { fileField } from "./file.js";
6
+ import { buildFileField } from "./file.js";
7
+ import { buildMessageField } from "./message.js";
6
8
  import { numberField } from "./number.js";
7
- import { repeaterField } from "./repeater.js";
8
- import { selectField } from "./select.js";
9
+ import { buildRepeaterField } from "./repeater.js";
10
+ import { buildSelectField } from "./select.js";
9
11
  import { textField } from "./text.js";
10
12
  import { textareaField } from "./textarea.js";
11
13
  //#region src/fields/builtin/index.ts
12
- const defaultFieldDefinitions = [
14
+ /**
15
+ * Built-in field definitions with content-bearing config fields (select option labels, repeater add
16
+ * label) carrying `localized: true` when `localize` is true. `editor`, when given, overrides the
17
+ * richText editor on the message content field (from the plugin's `richText.editor` option). Field
18
+ * types without content config are shared static definitions. Definitions are authored with precise
19
+ * value/config generics; the registry stores them erased (config is re-narrowed per matched type at
20
+ * execution), hence one cast per built-in, no `any`. `calcAllowed` threads the registered calc
21
+ * extension names into the calculation field's expression validate and editor schema;
22
+ * `calcSources` carries the serializable source metadata the builder UI renders from.
23
+ */
24
+ const buildDefaultFieldDefinitions = (localize, editor, uploadMimeTypes, calcAllowed, calcSources) => [
13
25
  textField,
14
26
  textareaField,
15
27
  emailField,
16
28
  numberField,
17
- selectField,
29
+ buildSelectField(localize),
18
30
  checkboxField,
19
- calculationField,
31
+ buildCalculationField(calcAllowed, {
32
+ localize,
33
+ sources: calcSources
34
+ }),
20
35
  consentField,
21
- fileField,
22
- repeaterField
36
+ buildFileField(uploadMimeTypes),
37
+ buildRepeaterField(localize),
38
+ dateField,
39
+ buildMessageField(localize, editor)
23
40
  ];
41
+ const defaultFieldDefinitions = buildDefaultFieldDefinitions(true);
42
+ /**
43
+ * `defaultFieldDefinitions` indexed by `type`, so a single built-in can be spread and tweaked
44
+ * without hand-rolling a `.find()`, e.g.
45
+ * `fields: { text: { ...defaultFieldDefinitionsByType.text, validate: myValidate } }`. The
46
+ * `fields` plugin option replaces a built-in of the same `type`; `false` removes it, `true` keeps it.
47
+ * Prebuilt with content localization on; with `localizeContent: false`, derive overrides from
48
+ * `buildDefaultFieldDefinitions(false)` instead so the spread does not reintroduce `localized`.
49
+ */
50
+ const defaultFieldDefinitionsByType = Object.fromEntries(defaultFieldDefinitions.map((definition) => [definition.type, definition]));
24
51
  //#endregion
25
- export { defaultFieldDefinitions };
52
+ export { buildDefaultFieldDefinitions, defaultFieldDefinitions, defaultFieldDefinitionsByType };
26
53
 
27
54
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/fields/builtin/index.ts"],"sourcesContent":["import type { AnyFormFieldDefinition } from '../types'\nimport { calculationField } from './calculation'\nimport { checkboxField } from './checkbox'\nimport { consentField } from './consent'\nimport { emailField } from './email'\nimport { fileField } from './file'\nimport { numberField } from './number'\nimport { repeaterField } from './repeater'\nimport { selectField } from './select'\nimport { textField } from './text'\nimport { textareaField } from './textarea'\n\n// Field types are authored with precise value/config generics; the registry stores them erased\n// (config is re-narrowed per matched type at execution). One cast per built-in, no `any`.\nexport const defaultFieldDefinitions: AnyFormFieldDefinition[] = [\n\ttextField as AnyFormFieldDefinition,\n\ttextareaField as AnyFormFieldDefinition,\n\temailField as AnyFormFieldDefinition,\n\tnumberField as AnyFormFieldDefinition,\n\tselectField as AnyFormFieldDefinition,\n\tcheckboxField as AnyFormFieldDefinition,\n\tcalculationField as AnyFormFieldDefinition,\n\tconsentField as AnyFormFieldDefinition,\n\tfileField as AnyFormFieldDefinition,\n\trepeaterField as AnyFormFieldDefinition,\n]\n"],"mappings":";;;;;;;;;;;AAcA,MAAa,0BAAoD;CAChE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/fields/builtin/index.ts"],"sourcesContent":["import type { RichTextField } from 'payload'\nimport type { CalcAllowed } from '../../calc/normalizeCalc'\nimport type { AnyFormFieldDefinition } from '../types'\nimport { buildCalculationField, type CalcSourceClientMeta } from './calculation'\nimport { checkboxField } from './checkbox'\nimport { consentField } from './consent'\nimport { dateField } from './date'\nimport { emailField } from './email'\nimport { buildFileField } from './file'\nimport { buildMessageField } from './message'\nimport { numberField } from './number'\nimport { buildRepeaterField } from './repeater'\nimport { buildSelectField } from './select'\nimport { textField } from './text'\nimport { textareaField } from './textarea'\n\n/**\n * Built-in field definitions with content-bearing config fields (select option labels, repeater add\n * label) carrying `localized: true` when `localize` is true. `editor`, when given, overrides the\n * richText editor on the message content field (from the plugin's `richText.editor` option). Field\n * types without content config are shared static definitions. Definitions are authored with precise\n * value/config generics; the registry stores them erased (config is re-narrowed per matched type at\n * execution), hence one cast per built-in, no `any`. `calcAllowed` threads the registered calc\n * extension names into the calculation field's expression validate and editor schema;\n * `calcSources` carries the serializable source metadata the builder UI renders from.\n */\n// biome-ignore lint/complexity/useMaxParams: the documented positional surface (localize, editor, uploadMimeTypes) plus the calc allowed sets and source metadata; an options object would break existing callers\nexport const buildDefaultFieldDefinitions = (\n\tlocalize: boolean,\n\teditor?: RichTextField['editor'],\n\tuploadMimeTypes?: string[],\n\tcalcAllowed?: CalcAllowed,\n\tcalcSources?: CalcSourceClientMeta[]\n): AnyFormFieldDefinition[] => [\n\ttextField as AnyFormFieldDefinition,\n\ttextareaField as AnyFormFieldDefinition,\n\temailField as AnyFormFieldDefinition,\n\tnumberField as AnyFormFieldDefinition,\n\tbuildSelectField(localize) as AnyFormFieldDefinition,\n\tcheckboxField as AnyFormFieldDefinition,\n\tbuildCalculationField(calcAllowed, { localize, sources: calcSources }) as AnyFormFieldDefinition,\n\tconsentField as AnyFormFieldDefinition,\n\tbuildFileField(uploadMimeTypes) as AnyFormFieldDefinition,\n\tbuildRepeaterField(localize) as AnyFormFieldDefinition,\n\tdateField as AnyFormFieldDefinition,\n\tbuildMessageField(localize, editor) as AnyFormFieldDefinition,\n]\n\nexport const defaultFieldDefinitions: AnyFormFieldDefinition[] = buildDefaultFieldDefinitions(true)\n\n/**\n * `defaultFieldDefinitions` indexed by `type`, so a single built-in can be spread and tweaked\n * without hand-rolling a `.find()`, e.g.\n * `fields: { text: { ...defaultFieldDefinitionsByType.text, validate: myValidate } }`. The\n * `fields` plugin option replaces a built-in of the same `type`; `false` removes it, `true` keeps it.\n * Prebuilt with content localization on; with `localizeContent: false`, derive overrides from\n * `buildDefaultFieldDefinitions(false)` instead so the spread does not reintroduce `localized`.\n */\nexport const defaultFieldDefinitionsByType: Record<string, AnyFormFieldDefinition> =\n\tObject.fromEntries(defaultFieldDefinitions.map((definition) => [definition.type, definition]))\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAa,gCACZ,UACA,QACA,iBACA,aACA,gBAC8B;CAC9B;CACA;CACA;CACA;CACA,iBAAiB,QAAQ;CACzB;CACA,sBAAsB,aAAa;EAAE;EAAU,SAAS;CAAY,CAAC;CACrE;CACA,eAAe,eAAe;CAC9B,mBAAmB,QAAQ;CAC3B;CACA,kBAAkB,UAAU,MAAM;AACnC;AAEA,MAAa,0BAAoD,6BAA6B,IAAI;;;;;;;;;AAUlG,MAAa,gCACZ,OAAO,YAAY,wBAAwB,KAAK,eAAe,CAAC,WAAW,MAAM,UAAU,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { keys } from "../../translations/keys.js";
2
+ import { labelFor } from "../../translations/server.js";
3
+ import { localizedIf } from "../localizedIf.js";
4
+ import { defineFormField } from "../defineFormField.js";
5
+ //#region src/fields/builtin/message.ts
6
+ /**
7
+ * Display-only inline rich text rendered between fields. Bare: the block is just the `content`
8
+ * richText, no name/label/width/validation chrome, and instances are identified by their block
9
+ * row id (see `fieldKey`). Value kind `'none'`: the engine never validates it and never writes it
10
+ * to submissions. `content` is authored copy and follows `localize`; `editor`, when given,
11
+ * overrides the host config's default richText editor (from the plugin's `richText.editor`).
12
+ */
13
+ const buildMessageField = (localize, editor) => defineFormField({
14
+ type: "message",
15
+ label: keys.fieldTypeMessage,
16
+ value: "none",
17
+ bare: true,
18
+ config: [{
19
+ name: "content",
20
+ type: "richText",
21
+ label: labelFor(keys.configContent),
22
+ ...editor ? { editor } : {},
23
+ ...localizedIf(localize)
24
+ }]
25
+ });
26
+ buildMessageField(true);
27
+ //#endregion
28
+ export { buildMessageField };
29
+
30
+ //# sourceMappingURL=message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.js","names":[],"sources":["../../../src/fields/builtin/message.ts"],"sourcesContent":["import type { RichTextField } from 'payload'\nimport { keys } from '../../translations/keys'\nimport { labelFor } from '../../translations/server'\nimport { defineFormField } from '../defineFormField'\nimport { localizedIf } from '../localizedIf'\n\n/**\n * Display-only inline rich text rendered between fields. Bare: the block is just the `content`\n * richText, no name/label/width/validation chrome, and instances are identified by their block\n * row id (see `fieldKey`). Value kind `'none'`: the engine never validates it and never writes it\n * to submissions. `content` is authored copy and follows `localize`; `editor`, when given,\n * overrides the host config's default richText editor (from the plugin's `richText.editor`).\n */\nexport const buildMessageField = (localize: boolean, editor?: RichTextField['editor']) =>\n\tdefineFormField<'none'>({\n\t\ttype: 'message',\n\t\tlabel: keys.fieldTypeMessage,\n\t\tvalue: 'none',\n\t\tbare: true,\n\t\tconfig: [\n\t\t\t{\n\t\t\t\tname: 'content',\n\t\t\t\ttype: 'richText',\n\t\t\t\tlabel: labelFor(keys.configContent),\n\t\t\t\t...(editor ? { editor } : {}),\n\t\t\t\t...localizedIf(localize),\n\t\t\t},\n\t\t],\n\t})\n\nexport const messageField = buildMessageField(true)\n"],"mappings":";;;;;;;;;;;;AAaA,MAAa,qBAAqB,UAAmB,WACpD,gBAAwB;CACvB,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,MAAM;CACN,QAAQ,CACP;EACC,MAAM;EACN,MAAM;EACN,OAAO,SAAS,KAAK,aAAa;EAClC,GAAI,SAAS,EAAE,OAAO,IAAI,CAAC;EAC3B,GAAG,YAAY,QAAQ;CACxB,CACD;AACD,CAAC;AAE0B,kBAAkB,IAAI"}
@@ -1,11 +1,14 @@
1
1
  import { keys } from "../../translations/keys.js";
2
2
  import { labelFor } from "../../translations/server.js";
3
+ import { localizedIf } from "../localizedIf.js";
3
4
  import { defineFormField } from "../defineFormField.js";
4
5
  //#region src/fields/builtin/repeater.ts
5
- const repeaterField = defineFormField({
6
+ /** `addLabel` is the visitor-facing add-row button text and follows `localize`; row bounds never do. */
7
+ const buildRepeaterField = (localize) => defineFormField({
6
8
  type: "repeater",
7
9
  label: keys.fieldTypeRepeater,
8
10
  value: "repeater",
11
+ omitShared: ["placeholder"],
9
12
  config: [
10
13
  {
11
14
  name: "minRows",
@@ -22,7 +25,8 @@ const repeaterField = defineFormField({
22
25
  {
23
26
  name: "addLabel",
24
27
  type: "text",
25
- label: labelFor(keys.configAddLabel)
28
+ label: labelFor(keys.configAddLabel),
29
+ ...localizedIf(localize)
26
30
  }
27
31
  ],
28
32
  validate: ({ value, config, t }) => {
@@ -38,7 +42,8 @@ const repeaterField = defineFormField({
38
42
  return t(keys.repeaterRowCount).replace("{count}", String(count));
39
43
  }
40
44
  });
45
+ buildRepeaterField(true);
41
46
  //#endregion
42
- export { repeaterField };
47
+ export { buildRepeaterField };
43
48
 
44
49
  //# sourceMappingURL=repeater.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"repeater.js","names":[],"sources":["../../../src/fields/builtin/repeater.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { labelFor } from '../../translations/server'\nimport { defineFormField } from '../defineFormField'\n\ntype RepeaterConfig = {\n\tminRows?: number\n\tmaxRows?: number\n\taddLabel?: string\n}\n\nexport const repeaterField = defineFormField<'repeater', RepeaterConfig>({\n\ttype: 'repeater',\n\tlabel: keys.fieldTypeRepeater,\n\tvalue: 'repeater',\n\tconfig: [\n\t\t{\n\t\t\tname: 'minRows',\n\t\t\ttype: 'number',\n\t\t\tmin: 0,\n\t\t\tlabel: labelFor(keys.configMinRows),\n\t\t},\n\t\t{\n\t\t\tname: 'maxRows',\n\t\t\ttype: 'number',\n\t\t\tmin: 1,\n\t\t\tlabel: labelFor(keys.configMaxRows),\n\t\t},\n\t\t{\n\t\t\tname: 'addLabel',\n\t\t\ttype: 'text',\n\t\t\tlabel: labelFor(keys.configAddLabel),\n\t\t},\n\t\t// subFields blocks field is injected by buildFieldBlocks after the main loop,\n\t\t// so all non-repeater blocks are available and repeater-in-repeater is excluded.\n\t],\n\tvalidate: ({ value, config, t }) => {\n\t\tconst rows = Array.isArray(value) ? value : []\n\t\tconst min = typeof config.minRows === 'number' ? config.minRows : 0\n\t\tif (rows.length < min) {\n\t\t\treturn t(keys.validationRepeaterMin).replace('{min}', String(min))\n\t\t}\n\t\tconst max = typeof config.maxRows === 'number' ? config.maxRows : undefined\n\t\tif (max != null && rows.length > max) {\n\t\t\treturn t(keys.validationRepeaterMax).replace('{max}', String(max))\n\t\t}\n\t\treturn true\n\t},\n\tformat: ({ value, t }) => {\n\t\tconst count = Array.isArray(value) ? value.length : 0\n\t\treturn t(keys.repeaterRowCount).replace('{count}', String(count))\n\t},\n})\n"],"mappings":";;;;AAUA,MAAa,gBAAgB,gBAA4C;CACxE,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,QAAQ;EACP;GACC,MAAM;GACN,MAAM;GACN,KAAK;GACL,OAAO,SAAS,KAAK,aAAa;EACnC;EACA;GACC,MAAM;GACN,MAAM;GACN,KAAK;GACL,OAAO,SAAS,KAAK,aAAa;EACnC;EACA;GACC,MAAM;GACN,MAAM;GACN,OAAO,SAAS,KAAK,cAAc;EACpC;CAGD;CACA,WAAW,EAAE,OAAO,QAAQ,QAAQ;EACnC,MAAM,OAAO,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC;EAC7C,MAAM,MAAM,OAAO,OAAO,YAAY,WAAW,OAAO,UAAU;EAClE,IAAI,KAAK,SAAS,KACjB,OAAO,EAAE,KAAK,qBAAqB,EAAE,QAAQ,SAAS,OAAO,GAAG,CAAC;EAElE,MAAM,MAAM,OAAO,OAAO,YAAY,WAAW,OAAO,UAAU,KAAA;EAClE,IAAI,OAAO,QAAQ,KAAK,SAAS,KAChC,OAAO,EAAE,KAAK,qBAAqB,EAAE,QAAQ,SAAS,OAAO,GAAG,CAAC;EAElE,OAAO;CACR;CACA,SAAS,EAAE,OAAO,QAAQ;EACzB,MAAM,QAAQ,MAAM,QAAQ,KAAK,IAAI,MAAM,SAAS;EACpD,OAAO,EAAE,KAAK,gBAAgB,EAAE,QAAQ,WAAW,OAAO,KAAK,CAAC;CACjE;AACD,CAAC"}
1
+ {"version":3,"file":"repeater.js","names":[],"sources":["../../../src/fields/builtin/repeater.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { labelFor } from '../../translations/server'\nimport { defineFormField } from '../defineFormField'\nimport { localizedIf } from '../localizedIf'\n\ntype RepeaterConfig = {\n\tminRows?: number\n\tmaxRows?: number\n\taddLabel?: string\n}\n\n/** `addLabel` is the visitor-facing add-row button text and follows `localize`; row bounds never do. */\nexport const buildRepeaterField = (localize: boolean) =>\n\tdefineFormField<'repeater', RepeaterConfig>({\n\t\ttype: 'repeater',\n\t\tlabel: keys.fieldTypeRepeater,\n\t\tvalue: 'repeater',\n\t\tomitShared: ['placeholder'],\n\t\tconfig: [\n\t\t\t{\n\t\t\t\tname: 'minRows',\n\t\t\t\ttype: 'number',\n\t\t\t\tmin: 0,\n\t\t\t\tlabel: labelFor(keys.configMinRows),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'maxRows',\n\t\t\t\ttype: 'number',\n\t\t\t\tmin: 1,\n\t\t\t\tlabel: labelFor(keys.configMaxRows),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'addLabel',\n\t\t\t\ttype: 'text',\n\t\t\t\tlabel: labelFor(keys.configAddLabel),\n\t\t\t\t...localizedIf(localize),\n\t\t\t},\n\t\t\t// subFields blocks field is injected by buildFieldBlocks after the main loop,\n\t\t\t// so all non-repeater blocks are available and repeater-in-repeater is excluded.\n\t\t],\n\t\tvalidate: ({ value, config, t }) => {\n\t\t\tconst rows = Array.isArray(value) ? value : []\n\t\t\tconst min = typeof config.minRows === 'number' ? config.minRows : 0\n\t\t\tif (rows.length < min) {\n\t\t\t\treturn t(keys.validationRepeaterMin).replace('{min}', String(min))\n\t\t\t}\n\t\t\tconst max = typeof config.maxRows === 'number' ? config.maxRows : undefined\n\t\t\tif (max != null && rows.length > max) {\n\t\t\t\treturn t(keys.validationRepeaterMax).replace('{max}', String(max))\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\t\tformat: ({ value, t }) => {\n\t\t\tconst count = Array.isArray(value) ? value.length : 0\n\t\t\treturn t(keys.repeaterRowCount).replace('{count}', String(count))\n\t\t},\n\t})\n\nexport const repeaterField = buildRepeaterField(true)\n"],"mappings":";;;;;;AAYA,MAAa,sBAAsB,aAClC,gBAA4C;CAC3C,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,YAAY,CAAC,aAAa;CAC1B,QAAQ;EACP;GACC,MAAM;GACN,MAAM;GACN,KAAK;GACL,OAAO,SAAS,KAAK,aAAa;EACnC;EACA;GACC,MAAM;GACN,MAAM;GACN,KAAK;GACL,OAAO,SAAS,KAAK,aAAa;EACnC;EACA;GACC,MAAM;GACN,MAAM;GACN,OAAO,SAAS,KAAK,cAAc;GACnC,GAAG,YAAY,QAAQ;EACxB;CAGD;CACA,WAAW,EAAE,OAAO,QAAQ,QAAQ;EACnC,MAAM,OAAO,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC;EAC7C,MAAM,MAAM,OAAO,OAAO,YAAY,WAAW,OAAO,UAAU;EAClE,IAAI,KAAK,SAAS,KACjB,OAAO,EAAE,KAAK,qBAAqB,EAAE,QAAQ,SAAS,OAAO,GAAG,CAAC;EAElE,MAAM,MAAM,OAAO,OAAO,YAAY,WAAW,OAAO,UAAU,KAAA;EAClE,IAAI,OAAO,QAAQ,KAAK,SAAS,KAChC,OAAO,EAAE,KAAK,qBAAqB,EAAE,QAAQ,SAAS,OAAO,GAAG,CAAC;EAElE,OAAO;CACR;CACA,SAAS,EAAE,OAAO,QAAQ;EACzB,MAAM,QAAQ,MAAM,QAAQ,KAAK,IAAI,MAAM,SAAS;EACpD,OAAO,EAAE,KAAK,gBAAgB,EAAE,QAAQ,WAAW,OAAO,KAAK,CAAC;CACjE;AACD,CAAC;AAE2B,mBAAmB,IAAI"}
@@ -1,12 +1,15 @@
1
1
  import { keys } from "../../translations/keys.js";
2
2
  import { labelFor } from "../../translations/server.js";
3
+ import { localizedIf } from "../localizedIf.js";
3
4
  import { defineFormField } from "../defineFormField.js";
4
5
  //#region src/fields/builtin/select.ts
5
- const selectField = defineFormField({
6
+ /** Option `label` is author-facing content and follows `localize`; `value` is an identifier and never does. */
7
+ const buildSelectField = (localize) => defineFormField({
6
8
  type: "select",
7
9
  label: keys.fieldTypeSelect,
8
10
  value: "text",
9
11
  conditionType: "select",
12
+ pollEligible: true,
10
13
  config: [{
11
14
  name: "options",
12
15
  type: "array",
@@ -18,14 +21,34 @@ const selectField = defineFormField({
18
21
  fields: [{
19
22
  name: "label",
20
23
  type: "text",
21
- required: true,
22
- label: labelFor(keys.configOptionLabel)
24
+ label: labelFor(keys.configOptionLabel),
25
+ ...localizedIf(localize)
23
26
  }, {
24
27
  name: "value",
25
28
  type: "text",
26
29
  required: true,
27
30
  label: labelFor(keys.configOptionValue)
28
31
  }]
32
+ }, {
33
+ name: "display",
34
+ type: "select",
35
+ defaultValue: "dropdown",
36
+ label: labelFor(keys.configSelectDisplay),
37
+ admin: { isClearable: false },
38
+ options: [
39
+ {
40
+ label: labelFor(keys.selectDisplayDropdown),
41
+ value: "dropdown"
42
+ },
43
+ {
44
+ label: labelFor(keys.selectDisplayRadio),
45
+ value: "radio"
46
+ },
47
+ {
48
+ label: labelFor(keys.selectDisplayButtons),
49
+ value: "buttons"
50
+ }
51
+ ]
29
52
  }],
30
53
  validate: ({ value, config, t }) => {
31
54
  if (value == null || value === "") return true;
@@ -38,7 +61,8 @@ const selectField = defineFormField({
38
61
  return optionLabels?.[value] ?? String(value);
39
62
  }
40
63
  });
64
+ buildSelectField(true);
41
65
  //#endregion
42
- export { selectField };
66
+ export { buildSelectField };
43
67
 
44
68
  //# sourceMappingURL=select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","names":[],"sources":["../../../src/fields/builtin/select.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { labelFor } from '../../translations/server'\nimport { defineFormField } from '../defineFormField'\n\ntype SelectOption = { label: string; value: string }\ntype SelectConfig = { options?: SelectOption[] }\n\nexport const selectField = defineFormField<'text', SelectConfig>({\n\ttype: 'select',\n\tlabel: keys.fieldTypeSelect,\n\tvalue: 'text',\n\tconditionType: 'select',\n\tconfig: [\n\t\t{\n\t\t\tname: 'options',\n\t\t\ttype: 'array',\n\t\t\tlabel: labelFor(keys.configOptions),\n\t\t\tlabels: { singular: labelFor(keys.configOption), plural: labelFor(keys.configOptions) },\n\t\t\tfields: [\n\t\t\t\t{ name: 'label', type: 'text', required: true, label: labelFor(keys.configOptionLabel) },\n\t\t\t\t{ name: 'value', type: 'text', required: true, label: labelFor(keys.configOptionValue) },\n\t\t\t],\n\t\t},\n\t],\n\tvalidate: ({ value, config, t }) => {\n\t\tif (value == null || value === '') {\n\t\t\treturn true\n\t\t}\n\t\tconst options = config.options ?? []\n\t\tif (options.length === 0) {\n\t\t\treturn true\n\t\t}\n\t\treturn options.some((option) => option.value === value) ? true : t(keys.validationSelect)\n\t},\n\tformat: ({ value, optionLabels }) => {\n\t\tif (value == null || value === '') {\n\t\t\treturn ''\n\t\t}\n\t\treturn optionLabels?.[value] ?? String(value)\n\t},\n})\n"],"mappings":";;;;AAOA,MAAa,cAAc,gBAAsC;CAChE,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,eAAe;CACf,QAAQ,CACP;EACC,MAAM;EACN,MAAM;EACN,OAAO,SAAS,KAAK,aAAa;EAClC,QAAQ;GAAE,UAAU,SAAS,KAAK,YAAY;GAAG,QAAQ,SAAS,KAAK,aAAa;EAAE;EACtF,QAAQ,CACP;GAAE,MAAM;GAAS,MAAM;GAAQ,UAAU;GAAM,OAAO,SAAS,KAAK,iBAAiB;EAAE,GACvF;GAAE,MAAM;GAAS,MAAM;GAAQ,UAAU;GAAM,OAAO,SAAS,KAAK,iBAAiB;EAAE,CACxF;CACD,CACD;CACA,WAAW,EAAE,OAAO,QAAQ,QAAQ;EACnC,IAAI,SAAS,QAAQ,UAAU,IAC9B,OAAO;EAER,MAAM,UAAU,OAAO,WAAW,CAAC;EACnC,IAAI,QAAQ,WAAW,GACtB,OAAO;EAER,OAAO,QAAQ,MAAM,WAAW,OAAO,UAAU,KAAK,IAAI,OAAO,EAAE,KAAK,gBAAgB;CACzF;CACA,SAAS,EAAE,OAAO,mBAAmB;EACpC,IAAI,SAAS,QAAQ,UAAU,IAC9B,OAAO;EAER,OAAO,eAAe,UAAU,OAAO,KAAK;CAC7C;AACD,CAAC"}
1
+ {"version":3,"file":"select.js","names":[],"sources":["../../../src/fields/builtin/select.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { labelFor } from '../../translations/server'\nimport { defineFormField } from '../defineFormField'\nimport { localizedIf } from '../localizedIf'\n\ntype SelectOption = { label?: string; value: string }\ntype SelectConfig = { options?: SelectOption[]; display?: 'dropdown' | 'radio' | 'buttons' }\n\n/** Option `label` is author-facing content and follows `localize`; `value` is an identifier and never does. */\nexport const buildSelectField = (localize: boolean) =>\n\tdefineFormField<'text', SelectConfig>({\n\t\ttype: 'select',\n\t\tlabel: keys.fieldTypeSelect,\n\t\tvalue: 'text',\n\t\tconditionType: 'select',\n\t\tpollEligible: true,\n\t\tconfig: [\n\t\t\t{\n\t\t\t\tname: 'options',\n\t\t\t\ttype: 'array',\n\t\t\t\tlabel: labelFor(keys.configOptions),\n\t\t\t\tlabels: { singular: labelFor(keys.configOption), plural: labelFor(keys.configOptions) },\n\t\t\t\tfields: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'label',\n\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\tlabel: labelFor(keys.configOptionLabel),\n\t\t\t\t\t\t...localizedIf(localize),\n\t\t\t\t\t},\n\t\t\t\t\t{ name: 'value', type: 'text', required: true, label: labelFor(keys.configOptionValue) },\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'display',\n\t\t\t\ttype: 'select',\n\t\t\t\tdefaultValue: 'dropdown',\n\t\t\t\tlabel: labelFor(keys.configSelectDisplay),\n\t\t\t\tadmin: { isClearable: false },\n\t\t\t\toptions: [\n\t\t\t\t\t{ label: labelFor(keys.selectDisplayDropdown), value: 'dropdown' },\n\t\t\t\t\t{ label: labelFor(keys.selectDisplayRadio), value: 'radio' },\n\t\t\t\t\t{ label: labelFor(keys.selectDisplayButtons), value: 'buttons' },\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\tvalidate: ({ value, config, t }) => {\n\t\t\tif (value == null || value === '') {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tconst options = config.options ?? []\n\t\t\tif (options.length === 0) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn options.some((option) => option.value === value) ? true : t(keys.validationSelect)\n\t\t},\n\t\tformat: ({ value, optionLabels }) => {\n\t\t\tif (value == null || value === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn optionLabels?.[value] ?? String(value)\n\t\t},\n\t})\n\nexport const selectField = buildSelectField(true)\n"],"mappings":";;;;;;AASA,MAAa,oBAAoB,aAChC,gBAAsC;CACrC,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,eAAe;CACf,cAAc;CACd,QAAQ,CACP;EACC,MAAM;EACN,MAAM;EACN,OAAO,SAAS,KAAK,aAAa;EAClC,QAAQ;GAAE,UAAU,SAAS,KAAK,YAAY;GAAG,QAAQ,SAAS,KAAK,aAAa;EAAE;EACtF,QAAQ,CACP;GACC,MAAM;GACN,MAAM;GACN,OAAO,SAAS,KAAK,iBAAiB;GACtC,GAAG,YAAY,QAAQ;EACxB,GACA;GAAE,MAAM;GAAS,MAAM;GAAQ,UAAU;GAAM,OAAO,SAAS,KAAK,iBAAiB;EAAE,CACxF;CACD,GACA;EACC,MAAM;EACN,MAAM;EACN,cAAc;EACd,OAAO,SAAS,KAAK,mBAAmB;EACxC,OAAO,EAAE,aAAa,MAAM;EAC5B,SAAS;GACR;IAAE,OAAO,SAAS,KAAK,qBAAqB;IAAG,OAAO;GAAW;GACjE;IAAE,OAAO,SAAS,KAAK,kBAAkB;IAAG,OAAO;GAAQ;GAC3D;IAAE,OAAO,SAAS,KAAK,oBAAoB;IAAG,OAAO;GAAU;EAChE;CACD,CACD;CACA,WAAW,EAAE,OAAO,QAAQ,QAAQ;EACnC,IAAI,SAAS,QAAQ,UAAU,IAC9B,OAAO;EAER,MAAM,UAAU,OAAO,WAAW,CAAC;EACnC,IAAI,QAAQ,WAAW,GACtB,OAAO;EAER,OAAO,QAAQ,MAAM,WAAW,OAAO,UAAU,KAAK,IAAI,OAAO,EAAE,KAAK,gBAAgB;CACzF;CACA,SAAS,EAAE,OAAO,mBAAmB;EACpC,IAAI,SAAS,QAAQ,UAAU,IAC9B,OAAO;EAER,OAAO,eAAe,UAAU,OAAO,KAAK;CAC7C;AACD,CAAC;AAEyB,iBAAiB,IAAI"}
@@ -0,0 +1,13 @@
1
+ import { FormFieldConfigValues, FormFieldDefinition } from "../types.js";
2
+
3
+ //#region src/fields/builtin/state.d.ts
4
+ /**
5
+ * A US state/DC picker fronted by the fixed USPS-code set (see {@link US_STATES}), scoped US-only to
6
+ * match native's `state` block. Like `country` the author authors no options; the stored value is the
7
+ * state code and `format` resolves it to the state name. `resolveOptions` exposes the set as poll
8
+ * choices so a state field can back a poll despite carrying no authored options.
9
+ */
10
+ declare const stateField: FormFieldDefinition<"text", FormFieldConfigValues>;
11
+ //#endregion
12
+ export { stateField };
13
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1,30 @@
1
+ import { keys } from "../../translations/keys.js";
2
+ import { defineFormField } from "../defineFormField.js";
3
+ import { US_STATES, isUsStateCode, usStateLabel } from "../data/regions.js";
4
+ //#region src/fields/builtin/state.ts
5
+ /**
6
+ * A US state/DC picker fronted by the fixed USPS-code set (see {@link US_STATES}), scoped US-only to
7
+ * match native's `state` block. Like `country` the author authors no options; the stored value is the
8
+ * state code and `format` resolves it to the state name. `resolveOptions` exposes the set as poll
9
+ * choices so a state field can back a poll despite carrying no authored options.
10
+ */
11
+ const stateField = defineFormField({
12
+ type: "state",
13
+ label: keys.fieldTypeState,
14
+ value: "text",
15
+ conditionType: "select",
16
+ pollEligible: true,
17
+ resolveOptions: () => US_STATES,
18
+ validate: ({ value, t }) => {
19
+ if (value == null || value === "") return true;
20
+ return isUsStateCode(value) ? true : t(keys.validationState);
21
+ },
22
+ format: ({ value }) => {
23
+ if (value == null || value === "") return "";
24
+ return usStateLabel(value) ?? String(value);
25
+ }
26
+ });
27
+ //#endregion
28
+ export { stateField };
29
+
30
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","names":[],"sources":["../../../src/fields/builtin/state.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { isUsStateCode, US_STATES, usStateLabel } from '../data/regions'\nimport { defineFormField } from '../defineFormField'\n\n/**\n * A US state/DC picker fronted by the fixed USPS-code set (see {@link US_STATES}), scoped US-only to\n * match native's `state` block. Like `country` the author authors no options; the stored value is the\n * state code and `format` resolves it to the state name. `resolveOptions` exposes the set as poll\n * choices so a state field can back a poll despite carrying no authored options.\n */\nexport const stateField = defineFormField<'text'>({\n\ttype: 'state',\n\tlabel: keys.fieldTypeState,\n\tvalue: 'text',\n\tconditionType: 'select',\n\tpollEligible: true,\n\tresolveOptions: () => US_STATES,\n\tvalidate: ({ value, t }) => {\n\t\tif (value == null || value === '') {\n\t\t\treturn true\n\t\t}\n\t\treturn isUsStateCode(value) ? true : t(keys.validationState)\n\t},\n\tformat: ({ value }) => {\n\t\tif (value == null || value === '') {\n\t\t\treturn ''\n\t\t}\n\t\treturn usStateLabel(value) ?? String(value)\n\t},\n})\n"],"mappings":";;;;;;;;;;AAUA,MAAa,aAAa,gBAAwB;CACjD,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,eAAe;CACf,cAAc;CACd,sBAAsB;CACtB,WAAW,EAAE,OAAO,QAAQ;EAC3B,IAAI,SAAS,QAAQ,UAAU,IAC9B,OAAO;EAER,OAAO,cAAc,KAAK,IAAI,OAAO,EAAE,KAAK,eAAe;CAC5D;CACA,SAAS,EAAE,YAAY;EACtB,IAAI,SAAS,QAAQ,UAAU,IAC9B,OAAO;EAER,OAAO,aAAa,KAAK,KAAK,OAAO,KAAK;CAC3C;AACD,CAAC"}
@@ -1,10 +1,17 @@
1
1
  import { keys } from "../../translations/keys.js";
2
+ import { labelFor } from "../../translations/server.js";
2
3
  import { defineFormField } from "../defineFormField.js";
3
4
  //#region src/fields/builtin/text.ts
4
5
  const textField = defineFormField({
5
6
  type: "text",
6
7
  label: keys.fieldTypeText,
7
8
  value: "text",
9
+ advancedConfig: [{
10
+ name: "autocomplete",
11
+ type: "text",
12
+ label: labelFor(keys.configAutocomplete),
13
+ admin: { description: labelFor(keys.configAutocompleteDescription) }
14
+ }],
8
15
  format: ({ value }) => value == null ? "" : String(value)
9
16
  });
10
17
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"text.js","names":[],"sources":["../../../src/fields/builtin/text.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { defineFormField } from '../defineFormField'\n\nexport const textField = defineFormField<'text'>({\n\ttype: 'text',\n\tlabel: keys.fieldTypeText,\n\tvalue: 'text',\n\tformat: ({ value }) => (value == null ? '' : String(value)),\n})\n"],"mappings":";;;AAGA,MAAa,YAAY,gBAAwB;CAChD,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,SAAS,EAAE,YAAa,SAAS,OAAO,KAAK,OAAO,KAAK;AAC1D,CAAC"}
1
+ {"version":3,"file":"text.js","names":[],"sources":["../../../src/fields/builtin/text.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { labelFor } from '../../translations/server'\nimport { defineFormField } from '../defineFormField'\n\nexport const textField = defineFormField<'text'>({\n\ttype: 'text',\n\tlabel: keys.fieldTypeText,\n\tvalue: 'text',\n\tadvancedConfig: [\n\t\t{\n\t\t\tname: 'autocomplete',\n\t\t\ttype: 'text',\n\t\t\tlabel: labelFor(keys.configAutocomplete),\n\t\t\tadmin: { description: labelFor(keys.configAutocompleteDescription) },\n\t\t},\n\t],\n\tformat: ({ value }) => (value == null ? '' : String(value)),\n})\n"],"mappings":";;;;AAIA,MAAa,YAAY,gBAAwB;CAChD,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,gBAAgB,CACf;EACC,MAAM;EACN,MAAM;EACN,OAAO,SAAS,KAAK,kBAAkB;EACvC,OAAO,EAAE,aAAa,SAAS,KAAK,6BAA6B,EAAE;CACpE,CACD;CACA,SAAS,EAAE,YAAa,SAAS,OAAO,KAAK,OAAO,KAAK;AAC1D,CAAC"}
@@ -0,0 +1,21 @@
1
+ //#region src/fields/data/regions.d.ts
2
+ /**
3
+ * Fixed option sets for the built-in `country` and `state` field types: the author never authors
4
+ * these, so unlike `select` they live in code, not per-instance config. A plain data module with no
5
+ * dependencies, imported on both the server (validation, `format`, poll options) and the client (the
6
+ * frontend renderer, the condition builder), so it must stay isomorphic. `value` is the stored code
7
+ * and is the stable identity contract (never localize it); `label` is the English display name.
8
+ */
9
+ /** ISO 3166-1 alpha-2 codes with their English short names (every officially assigned code). */
10
+ declare const COUNTRIES: {
11
+ label: string;
12
+ value: string;
13
+ }[];
14
+ /** The 50 US states plus the District of Columbia, keyed by USPS code. Matches native's US-only `state` block. */
15
+ declare const US_STATES: {
16
+ label: string;
17
+ value: string;
18
+ }[];
19
+ //#endregion
20
+ export { COUNTRIES, US_STATES };
21
+ //# sourceMappingURL=regions.d.ts.map