@10x-media/form-builder 0.1.0-beta.3 → 0.1.0-beta.5

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 (406) hide show
  1. package/CHANGELOG.md +125 -0
  2. package/README.md +4 -4
  3. package/dist/actions/body/serializeBody.d.ts +22 -4
  4. package/dist/actions/body/serializeBody.js +3 -1
  5. package/dist/actions/body/serializeBody.js.map +1 -1
  6. package/dist/actions/body/textOfBody.d.ts +13 -0
  7. package/dist/actions/body/textOfBody.js +35 -0
  8. package/dist/actions/body/textOfBody.js.map +1 -0
  9. package/dist/actions/builtin/confirmation.js +51 -12
  10. package/dist/actions/builtin/confirmation.js.map +1 -1
  11. package/dist/actions/builtin/emailTeam.js +82 -34
  12. package/dist/actions/builtin/emailTeam.js.map +1 -1
  13. package/dist/actions/builtin/index.d.ts +18 -1
  14. package/dist/actions/builtin/index.js +21 -7
  15. package/dist/actions/builtin/index.js.map +1 -1
  16. package/dist/actions/builtin/signedWebhook.js +2 -16
  17. package/dist/actions/builtin/signedWebhook.js.map +1 -1
  18. package/dist/actions/defineAction.d.ts +1 -1
  19. package/dist/actions/fromAddresses.d.ts +21 -0
  20. package/dist/actions/fromAddresses.js +74 -0
  21. package/dist/actions/fromAddresses.js.map +1 -0
  22. package/dist/actions/runActions.js +2 -0
  23. package/dist/actions/runActions.js.map +1 -1
  24. package/dist/actions/task.js +9 -8
  25. package/dist/actions/task.js.map +1 -1
  26. package/dist/aggregation/aggregateResponses.d.ts +9 -0
  27. package/dist/aggregation/aggregateResponses.js +8 -14
  28. package/dist/aggregation/aggregateResponses.js.map +1 -1
  29. package/dist/aggregation/resolveResultsRequest.d.ts +35 -6
  30. package/dist/aggregation/resolveResultsRequest.js +68 -11
  31. package/dist/aggregation/resolveResultsRequest.js.map +1 -1
  32. package/dist/calc/computeCalcFields.js +2 -1
  33. package/dist/calc/computeCalcFields.js.map +1 -1
  34. package/dist/client/ByteSizeField.d.ts +8 -0
  35. package/dist/client/ByteSizeField.js +3 -1
  36. package/dist/client/ByteSizeField.js.map +1 -1
  37. package/dist/client/ClosePollButton.d.ts +15 -0
  38. package/dist/client/ClosePollButton.js +80 -0
  39. package/dist/client/ClosePollButton.js.map +1 -0
  40. package/dist/client/CondensedArray.d.ts +15 -0
  41. package/dist/client/CondensedArray.js +97 -0
  42. package/dist/client/CondensedArray.js.map +1 -0
  43. package/dist/client/EndpointOptionsSelect.d.ts +45 -0
  44. package/dist/client/EndpointOptionsSelect.js +103 -0
  45. package/dist/client/EndpointOptionsSelect.js.map +1 -0
  46. package/dist/client/FieldBlockLabel.d.ts +18 -0
  47. package/dist/client/FieldBlockLabel.js +34 -0
  48. package/dist/client/FieldBlockLabel.js.map +1 -0
  49. package/dist/client/FieldNameSelect.d.ts +20 -4
  50. package/dist/client/FieldNameSelect.js +25 -14
  51. package/dist/client/FieldNameSelect.js.map +1 -1
  52. package/dist/client/FlowBuilder.d.ts +2 -1
  53. package/dist/client/FlowBuilder.js +134 -83
  54. package/dist/client/FlowBuilder.js.map +1 -1
  55. package/dist/client/RuleDescription.d.ts +21 -0
  56. package/dist/client/RuleDescription.js +19 -0
  57. package/dist/client/RuleDescription.js.map +1 -0
  58. package/dist/client/admin.css +83 -5
  59. package/dist/client/endpointOptions.js +29 -0
  60. package/dist/client/endpointOptions.js.map +1 -0
  61. package/dist/client/flowAuthoring.js +142 -0
  62. package/dist/client/flowAuthoring.js.map +1 -0
  63. package/dist/client/synthesizeClientField.js +21 -10
  64. package/dist/client/synthesizeClientField.js.map +1 -1
  65. package/dist/collections/buttonFields.d.ts +34 -0
  66. package/dist/collections/buttonFields.js +35 -0
  67. package/dist/collections/buttonFields.js.map +1 -0
  68. package/dist/collections/cells/FieldCountCell.d.ts +15 -0
  69. package/dist/collections/cells/FieldCountCell.js +18 -0
  70. package/dist/collections/cells/FieldCountCell.js.map +1 -0
  71. package/dist/collections/cells/FlowStepsCell.d.ts +14 -0
  72. package/dist/collections/cells/FlowStepsCell.js +17 -0
  73. package/dist/collections/cells/FlowStepsCell.js.map +1 -0
  74. package/dist/collections/formSubmissions.js +55 -12
  75. package/dist/collections/formSubmissions.js.map +1 -1
  76. package/dist/collections/forms.js +376 -57
  77. package/dist/collections/forms.js.map +1 -1
  78. package/dist/collections/redirectFields.d.ts +29 -0
  79. package/dist/conditions/conditionType.js +9 -2
  80. package/dist/conditions/conditionType.js.map +1 -1
  81. package/dist/conditions/normalizeConditions.js +2 -1
  82. package/dist/conditions/normalizeConditions.js.map +1 -1
  83. package/dist/consent/applyConsentStatements.d.ts +14 -0
  84. package/dist/consent/applyConsentStatements.js +17 -0
  85. package/dist/consent/applyConsentStatements.js.map +1 -0
  86. package/dist/consent/captureConsent.d.ts +19 -8
  87. package/dist/consent/captureConsent.js +34 -11
  88. package/dist/consent/captureConsent.js.map +1 -1
  89. package/dist/consent/consentSourcesField.d.ts +58 -0
  90. package/dist/consent/consentSourcesField.js +79 -0
  91. package/dist/consent/consentSourcesField.js.map +1 -0
  92. package/dist/consent/resolveConsentEntries.d.ts +24 -0
  93. package/dist/consent/resolveConsentEntries.js +43 -0
  94. package/dist/consent/resolveConsentEntries.js.map +1 -0
  95. package/dist/consent/resolveConsentSourcesRequest.d.ts +37 -0
  96. package/dist/consent/resolveConsentSourcesRequest.js +55 -0
  97. package/dist/consent/resolveConsentSourcesRequest.js.map +1 -0
  98. package/dist/consent/resolveConsentStatements.d.ts +45 -0
  99. package/dist/consent/resolveConsentStatements.js +44 -0
  100. package/dist/consent/resolveConsentStatements.js.map +1 -0
  101. package/dist/consent/resolvePublishedVersionRef.d.ts +17 -11
  102. package/dist/consent/resolvePublishedVersionRef.js +13 -10
  103. package/dist/consent/resolvePublishedVersionRef.js.map +1 -1
  104. package/dist/consent/types.d.ts +49 -0
  105. package/dist/email/departments.d.ts +55 -0
  106. package/dist/email/departments.js +130 -0
  107. package/dist/email/departments.js.map +1 -0
  108. package/dist/email/departmentsField.d.ts +49 -0
  109. package/dist/email/departmentsField.js +69 -0
  110. package/dist/email/departmentsField.js.map +1 -0
  111. package/dist/exports/client.d.ts +8 -1
  112. package/dist/exports/client.js +8 -1
  113. package/dist/exports/react.d.ts +15 -6
  114. package/dist/exports/react.js +11 -3
  115. package/dist/exports/rsc.d.ts +8 -1
  116. package/dist/exports/rsc.js +8 -1
  117. package/dist/exports/types.d.ts +18 -10
  118. package/dist/fields/buildFieldBlocks.js +43 -19
  119. package/dist/fields/buildFieldBlocks.js.map +1 -1
  120. package/dist/fields/builtin/calculation.js +7 -0
  121. package/dist/fields/builtin/calculation.js.map +1 -1
  122. package/dist/fields/builtin/checkbox.js +8 -0
  123. package/dist/fields/builtin/checkbox.js.map +1 -1
  124. package/dist/fields/builtin/consent.js +25 -15
  125. package/dist/fields/builtin/consent.js.map +1 -1
  126. package/dist/fields/builtin/country.d.ts +13 -0
  127. package/dist/fields/builtin/country.js +30 -0
  128. package/dist/fields/builtin/country.js.map +1 -0
  129. package/dist/fields/builtin/date.js +2 -0
  130. package/dist/fields/builtin/date.js.map +1 -1
  131. package/dist/fields/builtin/file.js +13 -8
  132. package/dist/fields/builtin/file.js.map +1 -1
  133. package/dist/fields/builtin/index.d.ts +13 -1
  134. package/dist/fields/builtin/index.js +20 -7
  135. package/dist/fields/builtin/index.js.map +1 -1
  136. package/dist/fields/builtin/message.js +30 -0
  137. package/dist/fields/builtin/message.js.map +1 -0
  138. package/dist/fields/builtin/repeater.js +8 -3
  139. package/dist/fields/builtin/repeater.js.map +1 -1
  140. package/dist/fields/builtin/select.js +8 -3
  141. package/dist/fields/builtin/select.js.map +1 -1
  142. package/dist/fields/builtin/state.d.ts +13 -0
  143. package/dist/fields/builtin/state.js +30 -0
  144. package/dist/fields/builtin/state.js.map +1 -0
  145. package/dist/fields/data/regions.d.ts +21 -0
  146. package/dist/fields/data/regions.js +1238 -0
  147. package/dist/fields/data/regions.js.map +1 -0
  148. package/dist/fields/fieldKey.d.ts +15 -0
  149. package/dist/fields/fieldKey.js +16 -0
  150. package/dist/fields/fieldKey.js.map +1 -0
  151. package/dist/fields/fieldNamesOfType.js +13 -8
  152. package/dist/fields/fieldNamesOfType.js.map +1 -1
  153. package/dist/fields/instanceOptions.js +20 -0
  154. package/dist/fields/instanceOptions.js.map +1 -0
  155. package/dist/fields/localizedIf.d.ts +13 -0
  156. package/dist/fields/localizedIf.js +12 -0
  157. package/dist/fields/localizedIf.js.map +1 -0
  158. package/dist/fields/registry.d.ts +1 -0
  159. package/dist/fields/registry.js +21 -2
  160. package/dist/fields/registry.js.map +1 -1
  161. package/dist/fields/sharedConfig.js +101 -51
  162. package/dist/fields/sharedConfig.js.map +1 -1
  163. package/dist/fields/types.d.ts +61 -5
  164. package/dist/flow/engine.d.ts +6 -4
  165. package/dist/flow/engine.js +11 -6
  166. package/dist/flow/engine.js.map +1 -1
  167. package/dist/flow/normalizeFlow.js +22 -7
  168. package/dist/flow/normalizeFlow.js.map +1 -1
  169. package/dist/flow/stepLabel.js +15 -0
  170. package/dist/flow/stepLabel.js.map +1 -0
  171. package/dist/flow/types.d.ts +12 -3
  172. package/dist/flow/types.js +11 -0
  173. package/dist/flow/types.js.map +1 -0
  174. package/dist/form/pollState.d.ts +22 -0
  175. package/dist/form/pollState.js +17 -0
  176. package/dist/form/pollState.js.map +1 -0
  177. package/dist/form/toFormDocument.d.ts +85 -0
  178. package/dist/form/toFormDocument.js +75 -0
  179. package/dist/form/toFormDocument.js.map +1 -0
  180. package/dist/form/types.d.ts +65 -0
  181. package/dist/index.d.ts +193 -27
  182. package/dist/index.js +59 -19
  183. package/dist/index.js.map +1 -1
  184. package/dist/plugin/customState.js +26 -0
  185. package/dist/plugin/customState.js.map +1 -0
  186. package/dist/plugin/registerCollections.js +33 -44
  187. package/dist/plugin/registerCollections.js.map +1 -1
  188. package/dist/plugin/uploadsCollection.d.ts +13 -0
  189. package/dist/plugin/uploadsCollection.js +44 -0
  190. package/dist/plugin/uploadsCollection.js.map +1 -0
  191. package/dist/poll/applyPollOptions.js +18 -0
  192. package/dist/poll/applyPollOptions.js.map +1 -0
  193. package/dist/poll/buildPollOptionSourceFields.js +50 -0
  194. package/dist/poll/buildPollOptionSourceFields.js.map +1 -0
  195. package/dist/poll/closeJob.d.ts +52 -0
  196. package/dist/poll/closeJob.js +119 -0
  197. package/dist/poll/closeJob.js.map +1 -0
  198. package/dist/poll/definePollOptionSource.d.ts +44 -0
  199. package/dist/poll/definePollOptionSource.js +6 -0
  200. package/dist/poll/definePollOptionSource.js.map +1 -0
  201. package/dist/poll/definePollType.d.ts +34 -0
  202. package/dist/poll/definePollType.js +6 -0
  203. package/dist/poll/definePollType.js.map +1 -0
  204. package/dist/poll/effectivePollOptions.d.ts +38 -0
  205. package/dist/poll/effectivePollOptions.js +64 -0
  206. package/dist/poll/effectivePollOptions.js.map +1 -0
  207. package/dist/poll/mostVoted.d.ts +21 -0
  208. package/dist/poll/mostVoted.js +32 -0
  209. package/dist/poll/mostVoted.js.map +1 -0
  210. package/dist/poll/outcomeBeforeChange.js +91 -0
  211. package/dist/poll/outcomeBeforeChange.js.map +1 -0
  212. package/dist/poll/outcomeFields.d.ts +38 -0
  213. package/dist/poll/outcomeFields.js +52 -0
  214. package/dist/poll/outcomeFields.js.map +1 -0
  215. package/dist/poll/pollTypeRegistry.d.ts +34 -0
  216. package/dist/poll/pollTypeRegistry.js +71 -0
  217. package/dist/poll/pollTypeRegistry.js.map +1 -0
  218. package/dist/poll/registry.d.ts +16 -0
  219. package/dist/poll/registry.js +16 -0
  220. package/dist/poll/registry.js.map +1 -0
  221. package/dist/poll/resolvePollCloseRequest.js +105 -0
  222. package/dist/poll/resolvePollCloseRequest.js.map +1 -0
  223. package/dist/poll/resolvePollOptions.d.ts +29 -0
  224. package/dist/poll/resolvePollOptions.js +52 -0
  225. package/dist/poll/resolvePollOptions.js.map +1 -0
  226. package/dist/poll/resolvePollOptionsRequest.js +51 -0
  227. package/dist/poll/resolvePollOptionsRequest.js.map +1 -0
  228. package/dist/poll/resolvePollOutcome.d.ts +34 -0
  229. package/dist/poll/resolvePollOutcome.js +76 -0
  230. package/dist/poll/resolvePollOutcome.js.map +1 -0
  231. package/dist/poll/resultsField.js +21 -0
  232. package/dist/poll/resultsField.js.map +1 -0
  233. package/dist/prefill/valuesFromSearchParams.js +3 -2
  234. package/dist/prefill/valuesFromSearchParams.js.map +1 -1
  235. package/dist/presentations/types.d.ts +3 -2
  236. package/dist/react/Form.d.ts +15 -33
  237. package/dist/react/Form.js +144 -119
  238. package/dist/react/Form.js.map +1 -1
  239. package/dist/react/FormContext.d.ts +37 -1
  240. package/dist/react/FormContext.js.map +1 -1
  241. package/dist/react/FormControls.d.ts +55 -0
  242. package/dist/react/FormControls.js +56 -0
  243. package/dist/react/FormControls.js.map +1 -0
  244. package/dist/react/FormResults.d.ts +6 -3
  245. package/dist/react/FormResults.js +37 -29
  246. package/dist/react/FormResults.js.map +1 -1
  247. package/dist/react/FormSteps.d.ts +17 -0
  248. package/dist/react/FormSteps.js +35 -0
  249. package/dist/react/FormSteps.js.map +1 -0
  250. package/dist/react/Poll.d.ts +17 -6
  251. package/dist/react/Poll.js +66 -18
  252. package/dist/react/Poll.js.map +1 -1
  253. package/dist/react/contract.d.ts +2 -3
  254. package/dist/react/contract.js.map +1 -1
  255. package/dist/react/fetchResults.d.ts +1 -1
  256. package/dist/react/fetchResults.js +1 -1
  257. package/dist/react/fetchResults.js.map +1 -1
  258. package/dist/react/primitives/Checkbox.d.ts +4 -2
  259. package/dist/react/primitives/Checkbox.js +2 -1
  260. package/dist/react/primitives/Checkbox.js.map +1 -1
  261. package/dist/react/primitives/FieldShell.d.ts +2 -4
  262. package/dist/react/primitives/FieldShell.js +12 -19
  263. package/dist/react/primitives/FieldShell.js.map +1 -1
  264. package/dist/react/renderers/calculation.js +1 -2
  265. package/dist/react/renderers/calculation.js.map +1 -1
  266. package/dist/react/renderers/checkbox.js +1 -2
  267. package/dist/react/renderers/checkbox.js.map +1 -1
  268. package/dist/react/renderers/consent.js +78 -34
  269. package/dist/react/renderers/consent.js.map +1 -1
  270. package/dist/react/renderers/date.js +1 -3
  271. package/dist/react/renderers/date.js.map +1 -1
  272. package/dist/react/renderers/email.js +1 -2
  273. package/dist/react/renderers/email.js.map +1 -1
  274. package/dist/react/renderers/file.js +6 -3
  275. package/dist/react/renderers/file.js.map +1 -1
  276. package/dist/react/renderers/index.js +5 -0
  277. package/dist/react/renderers/index.js.map +1 -1
  278. package/dist/react/renderers/message.js +35 -0
  279. package/dist/react/renderers/message.js.map +1 -0
  280. package/dist/react/renderers/number.js +1 -2
  281. package/dist/react/renderers/number.js.map +1 -1
  282. package/dist/react/renderers/region.js +45 -0
  283. package/dist/react/renderers/region.js.map +1 -0
  284. package/dist/react/renderers/repeater.js +7 -10
  285. package/dist/react/renderers/repeater.js.map +1 -1
  286. package/dist/react/renderers/select.js +1 -2
  287. package/dist/react/renderers/select.js.map +1 -1
  288. package/dist/react/renderers/text.js +1 -2
  289. package/dist/react/renderers/text.js.map +1 -1
  290. package/dist/react/renderers/textarea.js +1 -2
  291. package/dist/react/renderers/textarea.js.map +1 -1
  292. package/dist/react/state.d.ts +23 -2
  293. package/dist/react/state.js +16 -7
  294. package/dist/react/state.js.map +1 -1
  295. package/dist/react/uploadFile.d.ts +2 -2
  296. package/dist/react/uploadFile.js +1 -1
  297. package/dist/react/uploadFile.js.map +1 -1
  298. package/dist/react/useField.d.ts +0 -1
  299. package/dist/react/useField.js +0 -1
  300. package/dist/react/useField.js.map +1 -1
  301. package/dist/react/useFormState.d.ts +1 -1
  302. package/dist/react/useFormState.js +1 -1
  303. package/dist/react/useFormState.js.map +1 -1
  304. package/dist/react/validateField.js +3 -6
  305. package/dist/react/validateField.js.map +1 -1
  306. package/dist/recall/interpolate.d.ts +4 -3
  307. package/dist/recall/interpolate.js +5 -4
  308. package/dist/recall/interpolate.js.map +1 -1
  309. package/dist/recall/resolver.d.ts +1 -1
  310. package/dist/recall/resolver.js +14 -2
  311. package/dist/recall/resolver.js.map +1 -1
  312. package/dist/spam/captcha.d.ts +1 -1
  313. package/dist/spam/captcha.js +1 -1
  314. package/dist/spam/captcha.js.map +1 -1
  315. package/dist/submissions/SubmissionAnswers.js +6 -2
  316. package/dist/submissions/SubmissionAnswers.js.map +1 -1
  317. package/dist/submissions/SubmissionAnswersClient.js +91 -62
  318. package/dist/submissions/SubmissionAnswersClient.js.map +1 -1
  319. package/dist/submissions/createSubmission.d.ts +36 -0
  320. package/dist/submissions/createSubmission.js +26 -0
  321. package/dist/submissions/createSubmission.js.map +1 -0
  322. package/dist/submissions/runSubmission.d.ts +10 -0
  323. package/dist/submissions/runSubmission.js +92 -44
  324. package/dist/submissions/runSubmission.js.map +1 -1
  325. package/dist/submissions/types.d.ts +11 -4
  326. package/dist/submissions/validateSubmission.js +59 -10
  327. package/dist/submissions/validateSubmission.js.map +1 -1
  328. package/dist/submissions/votedCookie.d.ts +13 -0
  329. package/dist/submissions/votedCookie.js +27 -0
  330. package/dist/submissions/votedCookie.js.map +1 -0
  331. package/dist/translations/de.js +295 -0
  332. package/dist/translations/de.js.map +1 -0
  333. package/dist/translations/en.js +138 -23
  334. package/dist/translations/en.js.map +1 -1
  335. package/dist/translations/index.d.ts +2 -1
  336. package/dist/translations/index.js +6 -2
  337. package/dist/translations/index.js.map +1 -1
  338. package/dist/translations/keys.d.ts +134 -19
  339. package/dist/translations/keys.js +135 -20
  340. package/dist/translations/keys.js.map +1 -1
  341. package/dist/uploads/types.d.ts +1 -2
  342. package/dist/validation/buildRuleBlocks.js +18 -17
  343. package/dist/validation/buildRuleBlocks.js.map +1 -1
  344. package/dist/validation/builtin/email.js +1 -0
  345. package/dist/validation/builtin/email.js.map +1 -1
  346. package/dist/validation/builtin/matchesField.js +3 -7
  347. package/dist/validation/builtin/matchesField.js.map +1 -1
  348. package/dist/validation/builtin/max.js +1 -0
  349. package/dist/validation/builtin/max.js.map +1 -1
  350. package/dist/validation/builtin/maxDate.js +1 -0
  351. package/dist/validation/builtin/maxDate.js.map +1 -1
  352. package/dist/validation/builtin/maxLength.js +1 -0
  353. package/dist/validation/builtin/maxLength.js.map +1 -1
  354. package/dist/validation/builtin/min.js +1 -0
  355. package/dist/validation/builtin/min.js.map +1 -1
  356. package/dist/validation/builtin/minDate.js +1 -0
  357. package/dist/validation/builtin/minDate.js.map +1 -1
  358. package/dist/validation/builtin/minLength.js +1 -0
  359. package/dist/validation/builtin/minLength.js.map +1 -1
  360. package/dist/validation/builtin/notAlreadySubmitted.js +1 -0
  361. package/dist/validation/builtin/notAlreadySubmitted.js.map +1 -1
  362. package/dist/validation/builtin/oneOf.js +1 -0
  363. package/dist/validation/builtin/oneOf.js.map +1 -1
  364. package/dist/validation/builtin/pattern.js +11 -2
  365. package/dist/validation/builtin/pattern.js.map +1 -1
  366. package/dist/validation/builtin/url.js +1 -0
  367. package/dist/validation/builtin/url.js.map +1 -1
  368. package/dist/validation/builtin/validateRegexParams.js +44 -0
  369. package/dist/validation/builtin/validateRegexParams.js.map +1 -0
  370. package/dist/validation/fieldTargetParam.d.ts +22 -0
  371. package/dist/validation/fieldTargetParam.js +38 -0
  372. package/dist/validation/fieldTargetParam.js.map +1 -0
  373. package/dist/validation/runValidation.js +8 -29
  374. package/dist/validation/runValidation.js.map +1 -1
  375. package/dist/validation/types.d.ts +5 -11
  376. package/dist/validation/validateUrl.js +22 -0
  377. package/dist/validation/validateUrl.js.map +1 -0
  378. package/package.json +7 -6
  379. package/styles/form-builder.css +10 -0
  380. package/dist/collections/uploads.d.ts +0 -30
  381. package/dist/collections/uploads.js +0 -55
  382. package/dist/collections/uploads.js.map +0 -1
  383. package/dist/consent/buildConsentSourceConfig.js +0 -49
  384. package/dist/consent/buildConsentSourceConfig.js.map +0 -1
  385. package/dist/consent/builtin/index.d.ts +0 -7
  386. package/dist/consent/builtin/index.js +0 -11
  387. package/dist/consent/builtin/index.js.map +0 -1
  388. package/dist/consent/builtin/pageReference.js +0 -75
  389. package/dist/consent/builtin/pageReference.js.map +0 -1
  390. package/dist/consent/builtin/static.js +0 -44
  391. package/dist/consent/builtin/static.js.map +0 -1
  392. package/dist/consent/defineConsentSource.d.ts +0 -35
  393. package/dist/consent/defineConsentSource.js +0 -6
  394. package/dist/consent/defineConsentSource.js.map +0 -1
  395. package/dist/consent/registry.d.ts +0 -16
  396. package/dist/consent/registry.js +0 -16
  397. package/dist/consent/registry.js.map +0 -1
  398. package/dist/consent/resolveConsentLinks.d.ts +0 -19
  399. package/dist/consent/resolveConsentLinks.js +0 -26
  400. package/dist/consent/resolveConsentLinks.js.map +0 -1
  401. package/dist/presentations/registry.d.ts +0 -15
  402. package/dist/presentations/registry.js +0 -15
  403. package/dist/presentations/registry.js.map +0 -1
  404. package/dist/react/toFormDocument.d.ts +0 -24
  405. package/dist/react/toFormDocument.js +0 -22
  406. package/dist/react/toFormDocument.js.map +0 -1
@@ -1,29 +1,39 @@
1
1
  import { keys } from "../../translations/keys.js";
2
- import { labelFor } from "../../translations/server.js";
2
+ import { labelForKey } from "../../translations/server.js";
3
3
  import { defineFormField } from "../defineFormField.js";
4
- //#region src/fields/builtin/consent.ts
5
4
  /**
6
- * Base consent field definition. `source` select and `sourceConfig` group are injected
7
- * by `buildFieldBlocks` from the live `consentRegistry`, so only the selected source's
8
- * fields are visible in the admin UI via `admin.condition`.
5
+ * Consent is a reference, so the field is a reference: the author picks a source and nothing else.
6
+ * The statement, the policy page, and its version all live with the source (see
7
+ * `consentSourcesField`), so there is no wording to copy per form, no URL to paste, and no version
8
+ * to type; correcting a statement corrects every form pointing at it. `label` and `placeholder` are
9
+ * dropped for the same reason: the statement is the visible text and the checkbox's accessible name.
10
+ *
11
+ * Registered only when the plugin's `consent.sources` resolver is set, since a consent field with
12
+ * no source to reference has nothing to say and nothing to prove.
13
+ *
14
+ * The intrinsic validator owns `required`: the engine's shared required guard only fires on an
15
+ * empty value, and `false` (the coerced state of both an unchecked box and an absent answer) is a
16
+ * present one, so without this a required consent would accept an explicit refusal.
9
17
  */
10
18
  const consentField = defineFormField({
11
19
  type: "consent",
12
20
  label: keys.fieldTypeConsent,
13
21
  value: "boolean",
22
+ omitShared: ["label", "placeholder"],
14
23
  config: [{
15
- name: "statement",
24
+ name: "source",
16
25
  type: "text",
17
- label: labelFor(keys.consentConfigStatement)
18
- }, {
19
- name: "optional",
20
- type: "checkbox",
21
- label: labelFor(keys.consentConfigOptional)
26
+ label: labelForKey(keys.consentConfigSource),
27
+ admin: { components: { Field: {
28
+ path: "@10x-media/form-builder/client#EndpointOptionsSelect",
29
+ clientProps: {
30
+ endpoint: "consent-sources",
31
+ descriptionKey: keys.consentConfigSourceDescription,
32
+ isClearable: false
33
+ }
34
+ } } }
22
35
  }],
23
- validate: ({ value, config, t }) => {
24
- if (!(config.optional === true) && value !== true) return t(keys.validationRequired);
25
- return true;
26
- },
36
+ validate: ({ value, config, t }) => config.required === true && value !== true ? t(keys.validationRequired) : true,
27
37
  format: ({ value, t }) => t(value === true ? keys.formatYes : keys.formatNo)
28
38
  });
29
39
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"consent.js","names":[],"sources":["../../../src/fields/builtin/consent.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { labelFor } from '../../translations/server'\nimport { defineFormField } from '../defineFormField'\n\ntype ConsentConfig = {\n\tstatement?: string\n\tsource?: string\n\tsourceConfig?: Record<string, unknown>\n\toptional?: boolean\n}\n\n/**\n * Base consent field definition. `source` select and `sourceConfig` group are injected\n * by `buildFieldBlocks` from the live `consentRegistry`, so only the selected source's\n * fields are visible in the admin UI via `admin.condition`.\n */\nexport const consentField = defineFormField<'boolean', ConsentConfig>({\n\ttype: 'consent',\n\tlabel: keys.fieldTypeConsent,\n\tvalue: 'boolean',\n\tconfig: [\n\t\t{ name: 'statement', type: 'text', label: labelFor(keys.consentConfigStatement) },\n\t\t// source select and sourceConfig group are injected by buildFieldBlocks at plugin boot\n\t\t// so the options reflect the live consentRegistry rather than this static list.\n\t\t{ name: 'optional', type: 'checkbox', label: labelFor(keys.consentConfigOptional) },\n\t],\n\tvalidate: ({ value, config, t }) => {\n\t\tconst optional = (config as ConsentConfig).optional === true\n\t\tif (!optional && value !== true) {\n\t\t\treturn t(keys.validationRequired)\n\t\t}\n\t\treturn true\n\t},\n\tformat: ({ value, t }) => t(value === true ? keys.formatYes : keys.formatNo),\n})\n"],"mappings":";;;;;;;;;AAgBA,MAAa,eAAe,gBAA0C;CACrE,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,QAAQ,CACP;EAAE,MAAM;EAAa,MAAM;EAAQ,OAAO,SAAS,KAAK,sBAAsB;CAAE,GAGhF;EAAE,MAAM;EAAY,MAAM;EAAY,OAAO,SAAS,KAAK,qBAAqB;CAAE,CACnF;CACA,WAAW,EAAE,OAAO,QAAQ,QAAQ;EAEnC,IAAI,EADc,OAAyB,aAAa,SACvC,UAAU,MAC1B,OAAO,EAAE,KAAK,kBAAkB;EAEjC,OAAO;CACR;CACA,SAAS,EAAE,OAAO,QAAQ,EAAE,UAAU,OAAO,KAAK,YAAY,KAAK,QAAQ;AAC5E,CAAC"}
1
+ {"version":3,"file":"consent.js","names":[],"sources":["../../../src/fields/builtin/consent.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { labelForKey } from '../../translations/server'\nimport { defineFormField } from '../defineFormField'\n\ntype ConsentConfig = { source?: string; required?: boolean }\n\nconst SOURCE_FIELD_REF = '@10x-media/form-builder/client#EndpointOptionsSelect'\n\n/**\n * Consent is a reference, so the field is a reference: the author picks a source and nothing else.\n * The statement, the policy page, and its version all live with the source (see\n * `consentSourcesField`), so there is no wording to copy per form, no URL to paste, and no version\n * to type; correcting a statement corrects every form pointing at it. `label` and `placeholder` are\n * dropped for the same reason: the statement is the visible text and the checkbox's accessible name.\n *\n * Registered only when the plugin's `consent.sources` resolver is set, since a consent field with\n * no source to reference has nothing to say and nothing to prove.\n *\n * The intrinsic validator owns `required`: the engine's shared required guard only fires on an\n * empty value, and `false` (the coerced state of both an unchecked box and an absent answer) is a\n * present one, so without this a required consent would accept an explicit refusal.\n */\nexport const consentField = defineFormField<'boolean', ConsentConfig>({\n\ttype: 'consent',\n\tlabel: keys.fieldTypeConsent,\n\tvalue: 'boolean',\n\tomitShared: ['label', 'placeholder'],\n\tconfig: [\n\t\t{\n\t\t\tname: 'source',\n\t\t\ttype: 'text',\n\t\t\tlabel: labelForKey(keys.consentConfigSource),\n\t\t\tadmin: {\n\t\t\t\tcomponents: {\n\t\t\t\t\tField: {\n\t\t\t\t\t\tpath: SOURCE_FIELD_REF,\n\t\t\t\t\t\tclientProps: {\n\t\t\t\t\t\t\tendpoint: 'consent-sources',\n\t\t\t\t\t\t\tdescriptionKey: keys.consentConfigSourceDescription,\n\t\t\t\t\t\t\tisClearable: false,\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],\n\tvalidate: ({ value, config, t }) =>\n\t\tconfig.required === true && value !== true ? t(keys.validationRequired) : true,\n\tformat: ({ value, t }) => t(value === true ? keys.formatYes : keys.formatNo),\n})\n"],"mappings":";;;;;;;;;;;;;;;;;AAsBA,MAAa,eAAe,gBAA0C;CACrE,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,YAAY,CAAC,SAAS,aAAa;CACnC,QAAQ,CACP;EACC,MAAM;EACN,MAAM;EACN,OAAO,YAAY,KAAK,mBAAmB;EAC3C,OAAO,EACN,YAAY,EACX,OAAO;GACN,MAAM;GACN,aAAa;IACZ,UAAU;IACV,gBAAgB,KAAK;IACrB,aAAa;GACd;EACD,EACD,EACD;CACD,CACD;CACA,WAAW,EAAE,OAAO,QAAQ,QAC3B,OAAO,aAAa,QAAQ,UAAU,OAAO,EAAE,KAAK,kBAAkB,IAAI;CAC3E,SAAS,EAAE,OAAO,QAAQ,EAAE,UAAU,OAAO,KAAK,YAAY,KAAK,QAAQ;AAC5E,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { FormFieldConfigValues, FormFieldDefinition } from "../types.js";
2
+
3
+ //#region src/fields/builtin/country.d.ts
4
+ /**
5
+ * A country picker fronted by the fixed ISO 3166-1 alpha-2 set (see {@link COUNTRIES}). Unlike
6
+ * `select` the author does not author options, so there is no `config`; the stored value is the
7
+ * two-letter code and `format` resolves it to the English name. `resolveOptions` exposes the same
8
+ * set as poll choices so a country field can back a poll despite carrying no authored options.
9
+ */
10
+ declare const countryField: FormFieldDefinition<"text", FormFieldConfigValues>;
11
+ //#endregion
12
+ export { countryField };
13
+ //# sourceMappingURL=country.d.ts.map
@@ -0,0 +1,30 @@
1
+ import { keys } from "../../translations/keys.js";
2
+ import { defineFormField } from "../defineFormField.js";
3
+ import { COUNTRIES, countryLabel, isCountryCode } from "../data/regions.js";
4
+ //#region src/fields/builtin/country.ts
5
+ /**
6
+ * A country picker fronted by the fixed ISO 3166-1 alpha-2 set (see {@link COUNTRIES}). Unlike
7
+ * `select` the author does not author options, so there is no `config`; the stored value is the
8
+ * two-letter code and `format` resolves it to the English name. `resolveOptions` exposes the same
9
+ * set as poll choices so a country field can back a poll despite carrying no authored options.
10
+ */
11
+ const countryField = defineFormField({
12
+ type: "country",
13
+ label: keys.fieldTypeCountry,
14
+ value: "text",
15
+ conditionType: "select",
16
+ pollEligible: true,
17
+ resolveOptions: () => COUNTRIES,
18
+ validate: ({ value, t }) => {
19
+ if (value == null || value === "") return true;
20
+ return isCountryCode(value) ? true : t(keys.validationCountry);
21
+ },
22
+ format: ({ value }) => {
23
+ if (value == null || value === "") return "";
24
+ return countryLabel(value) ?? String(value);
25
+ }
26
+ });
27
+ //#endregion
28
+ export { countryField };
29
+
30
+ //# sourceMappingURL=country.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"country.js","names":[],"sources":["../../../src/fields/builtin/country.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { COUNTRIES, countryLabel, isCountryCode } from '../data/regions'\nimport { defineFormField } from '../defineFormField'\n\n/**\n * A country picker fronted by the fixed ISO 3166-1 alpha-2 set (see {@link COUNTRIES}). Unlike\n * `select` the author does not author options, so there is no `config`; the stored value is the\n * two-letter code and `format` resolves it to the English name. `resolveOptions` exposes the same\n * set as poll choices so a country field can back a poll despite carrying no authored options.\n */\nexport const countryField = defineFormField<'text'>({\n\ttype: 'country',\n\tlabel: keys.fieldTypeCountry,\n\tvalue: 'text',\n\tconditionType: 'select',\n\tpollEligible: true,\n\tresolveOptions: () => COUNTRIES,\n\tvalidate: ({ value, t }) => {\n\t\tif (value == null || value === '') {\n\t\t\treturn true\n\t\t}\n\t\treturn isCountryCode(value) ? true : t(keys.validationCountry)\n\t},\n\tformat: ({ value }) => {\n\t\tif (value == null || value === '') {\n\t\t\treturn ''\n\t\t}\n\t\treturn countryLabel(value) ?? String(value)\n\t},\n})\n"],"mappings":";;;;;;;;;;AAUA,MAAa,eAAe,gBAAwB;CACnD,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,iBAAiB;CAC9D;CACA,SAAS,EAAE,YAAY;EACtB,IAAI,SAAS,QAAQ,UAAU,IAC9B,OAAO;EAER,OAAO,aAAa,KAAK,KAAK,OAAO,KAAK;CAC3C;AACD,CAAC"}
@@ -13,10 +13,12 @@ const isValidCalendarDate = (value) => {
13
13
  const date = new Date(Date.UTC(year, month - 1, day));
14
14
  return date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day;
15
15
  };
16
+ /** `placeholder` is omitted: browsers ignore it on `<input type="date">`, which renders its own picker. */
16
17
  const dateField = defineFormField({
17
18
  type: "date",
18
19
  label: keys.fieldTypeDate,
19
20
  value: "date",
21
+ omitShared: ["placeholder"],
20
22
  validate: ({ value, t }) => {
21
23
  if (value == null || value === "") return true;
22
24
  return isValidCalendarDate(value) ? true : t(keys.validationDate);
@@ -1 +1 @@
1
- {"version":3,"file":"date.js","names":[],"sources":["../../../src/fields/builtin/date.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { defineFormField } from '../defineFormField'\n\nconst DATE_PATTERN = /^(\\d{4})-(\\d{2})-(\\d{2})$/\n\n/** True calendar-date check for `YYYY-MM-DD` strings (rejects e.g. `2024-02-30`). */\nexport const isValidCalendarDate = (value: string): boolean => {\n\tconst match = DATE_PATTERN.exec(value)\n\tif (!match) {\n\t\treturn false\n\t}\n\tconst [, yearStr, monthStr, dayStr] = match\n\tconst year = Number(yearStr)\n\tconst month = Number(monthStr)\n\tconst day = Number(dayStr)\n\tconst date = new Date(Date.UTC(year, month - 1, day))\n\treturn (\n\t\tdate.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day\n\t)\n}\n\nexport const dateField = defineFormField<'date'>({\n\ttype: 'date',\n\tlabel: keys.fieldTypeDate,\n\tvalue: 'date',\n\tvalidate: ({ value, t }) => {\n\t\tif (value == null || value === '') {\n\t\t\treturn true\n\t\t}\n\t\treturn isValidCalendarDate(value) ? true : t(keys.validationDate)\n\t},\n\tformat: ({ value }) => (value == null ? '' : String(value)),\n})\n"],"mappings":";;;AAGA,MAAM,eAAe;;AAGrB,MAAa,uBAAuB,UAA2B;CAC9D,MAAM,QAAQ,aAAa,KAAK,KAAK;CACrC,IAAI,CAAC,OACJ,OAAO;CAER,MAAM,GAAG,SAAS,UAAU,UAAU;CACtC,MAAM,OAAO,OAAO,OAAO;CAC3B,MAAM,QAAQ,OAAO,QAAQ;CAC7B,MAAM,MAAM,OAAO,MAAM;CACzB,MAAM,OAAO,IAAI,KAAK,KAAK,IAAI,MAAM,QAAQ,GAAG,GAAG,CAAC;CACpD,OACC,KAAK,eAAe,MAAM,QAAQ,KAAK,YAAY,MAAM,QAAQ,KAAK,KAAK,WAAW,MAAM;AAE9F;AAEA,MAAa,YAAY,gBAAwB;CAChD,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,WAAW,EAAE,OAAO,QAAQ;EAC3B,IAAI,SAAS,QAAQ,UAAU,IAC9B,OAAO;EAER,OAAO,oBAAoB,KAAK,IAAI,OAAO,EAAE,KAAK,cAAc;CACjE;CACA,SAAS,EAAE,YAAa,SAAS,OAAO,KAAK,OAAO,KAAK;AAC1D,CAAC"}
1
+ {"version":3,"file":"date.js","names":[],"sources":["../../../src/fields/builtin/date.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { defineFormField } from '../defineFormField'\n\nconst DATE_PATTERN = /^(\\d{4})-(\\d{2})-(\\d{2})$/\n\n/** True calendar-date check for `YYYY-MM-DD` strings (rejects e.g. `2024-02-30`). */\nexport const isValidCalendarDate = (value: string): boolean => {\n\tconst match = DATE_PATTERN.exec(value)\n\tif (!match) {\n\t\treturn false\n\t}\n\tconst [, yearStr, monthStr, dayStr] = match\n\tconst year = Number(yearStr)\n\tconst month = Number(monthStr)\n\tconst day = Number(dayStr)\n\tconst date = new Date(Date.UTC(year, month - 1, day))\n\treturn (\n\t\tdate.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day\n\t)\n}\n\n/** `placeholder` is omitted: browsers ignore it on `<input type=\"date\">`, which renders its own picker. */\nexport const dateField = defineFormField<'date'>({\n\ttype: 'date',\n\tlabel: keys.fieldTypeDate,\n\tvalue: 'date',\n\tomitShared: ['placeholder'],\n\tvalidate: ({ value, t }) => {\n\t\tif (value == null || value === '') {\n\t\t\treturn true\n\t\t}\n\t\treturn isValidCalendarDate(value) ? true : t(keys.validationDate)\n\t},\n\tformat: ({ value }) => (value == null ? '' : String(value)),\n})\n"],"mappings":";;;AAGA,MAAM,eAAe;;AAGrB,MAAa,uBAAuB,UAA2B;CAC9D,MAAM,QAAQ,aAAa,KAAK,KAAK;CACrC,IAAI,CAAC,OACJ,OAAO;CAER,MAAM,GAAG,SAAS,UAAU,UAAU;CACtC,MAAM,OAAO,OAAO,OAAO;CAC3B,MAAM,QAAQ,OAAO,QAAQ;CAC7B,MAAM,MAAM,OAAO,MAAM;CACzB,MAAM,OAAO,IAAI,KAAK,KAAK,IAAI,MAAM,QAAQ,GAAG,GAAG,CAAC;CACpD,OACC,KAAK,eAAe,MAAM,QAAQ,KAAK,YAAY,MAAM,QAAQ,KAAK,KAAK,WAAW,MAAM;AAE9F;;AAGA,MAAa,YAAY,gBAAwB;CAChD,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,YAAY,CAAC,aAAa;CAC1B,WAAW,EAAE,OAAO,QAAQ;EAC3B,IAAI,SAAS,QAAQ,UAAU,IAC9B,OAAO;EAER,OAAO,oBAAoB,KAAK,IAAI,OAAO,EAAE,KAAK,cAAc;CACjE;CACA,SAAS,EAAE,YAAa,SAAS,OAAO,KAAK,OAAO,KAAK;AAC1D,CAAC"}
@@ -77,18 +77,23 @@ const fileMimeTypeOptions = [
77
77
  * The `file` field type. Its stored value is a server-captured {@link FileRef}; the client only ever submits
78
78
  * the upload id, and `runSubmission` re-reads filename/mimeType/filesize from the upload doc at the trust
79
79
  * boundary (see `captureFileRef`). The intrinsic validator is intentionally a no-op: MIME/size/existence are
80
- * enforced authoritatively server-side against the stored doc, never against client metadata. `relationTo`,
81
- * `mimeTypes`, and `maxSize` persist on the block so the capture can enforce them.
80
+ * enforced authoritatively server-side against the stored doc, never against client metadata. `mimeTypes`
81
+ * and `maxSize` persist on the block so the capture can enforce them. `uploadsCollection` is not
82
+ * author-editable: a forms hook stamps the plugin-configured uploads collection slug onto it on every save
83
+ * so the client renderer knows where to POST; the server never trusts it at submit time (plugin config
84
+ * stays the source of truth). Named `uploadsCollection` because `collection` is a mongoose-reserved
85
+ * schema pathname.
82
86
  */
83
87
  const fileField = defineFormField({
84
88
  type: "file",
85
89
  label: keys.fieldTypeFile,
86
90
  value: "file",
91
+ omitShared: ["placeholder"],
87
92
  config: [
88
93
  {
89
- name: "relationTo",
94
+ name: "uploadsCollection",
90
95
  type: "text",
91
- label: labelFor(keys.fileConfigRelationTo)
96
+ admin: { hidden: true }
92
97
  },
93
98
  {
94
99
  name: "mimeTypes",
@@ -102,10 +107,10 @@ const fileField = defineFormField({
102
107
  type: "number",
103
108
  min: 0,
104
109
  label: labelFor(keys.fileConfigMaxSize),
105
- admin: {
106
- description: labelFor(keys.fileConfigMaxSizeDescription),
107
- components: { Field: MAX_SIZE_REF }
108
- }
110
+ admin: { components: { Field: {
111
+ path: MAX_SIZE_REF,
112
+ clientProps: { descriptionKey: keys.fileConfigMaxSizeDescription }
113
+ } } }
109
114
  }
110
115
  ],
111
116
  format: ({ value }) => isFileRef(value) ? value.filename : ""
@@ -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\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. `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{\n\t\t\tname: 'mimeTypes',\n\t\t\ttype: 'select',\n\t\t\thasMany: true,\n\t\t\toptions: fileMimeTypeOptions,\n\t\t\tlabel: labelFor(keys.fileConfigMimeTypes),\n\t\t},\n\t\t{\n\t\t\tname: 'maxSize',\n\t\t\ttype: 'number',\n\t\t\tmin: 0,\n\t\t\tlabel: labelFor(keys.fileConfigMaxSize),\n\t\t\tadmin: {\n\t\t\t\tdescription: labelFor(keys.fileConfigMaxSizeDescription),\n\t\t\t\tcomponents: { Field: MAX_SIZE_REF },\n\t\t\t},\n\t\t},\n\t],\n\tformat: ({ value }) => (isFileRef(value) ? value.filename : ''),\n})\n"],"mappings":";;;;AAWA,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;;;;;;;;AASA,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;GACC,MAAM;GACN,MAAM;GACN,SAAS;GACT,SAAS;GACT,OAAO,SAAS,KAAK,mBAAmB;EACzC;EACA;GACC,MAAM;GACN,MAAM;GACN,KAAK;GACL,OAAO,SAAS,KAAK,iBAAiB;GACtC,OAAO;IACN,aAAa,SAAS,KAAK,4BAA4B;IACvD,YAAY,EAAE,OAAO,aAAa;GACnC;EACD;CACD;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 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 */\nexport const fileField = defineFormField<'file', FileConfig>({\n\ttype: 'file',\n\tlabel: keys.fieldTypeFile,\n\tvalue: 'file',\n\tomitShared: ['placeholder'],\n\tconfig: [\n\t\t{ name: 'uploadsCollection', type: 'text', admin: { hidden: true } },\n\t\t{\n\t\t\tname: 'mimeTypes',\n\t\t\ttype: 'select',\n\t\t\thasMany: true,\n\t\t\toptions: fileMimeTypeOptions,\n\t\t\tlabel: labelFor(keys.fileConfigMimeTypes),\n\t\t},\n\t\t{\n\t\t\tname: 'maxSize',\n\t\t\ttype: 'number',\n\t\t\tmin: 0,\n\t\t\tlabel: labelFor(keys.fileConfigMaxSize),\n\t\t\tadmin: {\n\t\t\t\tcomponents: {\n\t\t\t\t\tField: {\n\t\t\t\t\t\tpath: MAX_SIZE_REF,\n\t\t\t\t\t\tclientProps: { descriptionKey: keys.fileConfigMaxSizeDescription },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t],\n\tformat: ({ value }) => (isFileRef(value) ? value.filename : ''),\n})\n"],"mappings":";;;;AAWA,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;;;;;;;;;;;;AAaA,MAAa,YAAY,gBAAoC;CAC5D,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;GACT,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"}
@@ -1,14 +1,26 @@
1
1
  import { AnyFormFieldDefinition } from "../types.js";
2
+ import { RichTextField } from "payload";
2
3
 
3
4
  //#region src/fields/builtin/index.d.ts
5
+ /**
6
+ * Built-in field definitions with content-bearing config fields (select option labels, repeater add
7
+ * label) carrying `localized: true` when `localize` is true. `editor`, when given, overrides the
8
+ * richText editor on the message content field (from the plugin's `richText.editor` option). Field
9
+ * types without content config are shared static definitions. Definitions are authored with precise
10
+ * value/config generics; the registry stores them erased (config is re-narrowed per matched type at
11
+ * execution), hence one cast per built-in, no `any`.
12
+ */
13
+ declare const buildDefaultFieldDefinitions: (localize: boolean, editor?: RichTextField["editor"]) => AnyFormFieldDefinition[];
4
14
  declare const defaultFieldDefinitions: AnyFormFieldDefinition[];
5
15
  /**
6
16
  * `defaultFieldDefinitions` indexed by `type`, so a single built-in can be spread and tweaked
7
17
  * without hand-rolling a `.find()`, e.g.
8
18
  * `fields: { text: { ...defaultFieldDefinitionsByType.text, validate: myValidate } }`. The
9
19
  * `fields` plugin option replaces a built-in of the same `type`; `false` removes it, `true` keeps it.
20
+ * Prebuilt with content localization on; with `localizeContent: false`, derive overrides from
21
+ * `buildDefaultFieldDefinitions(false)` instead so the spread does not reintroduce `localized`.
10
22
  */
11
23
  declare const defaultFieldDefinitionsByType: Record<string, AnyFormFieldDefinition>;
12
24
  //#endregion
13
- export { defaultFieldDefinitions, defaultFieldDefinitionsByType };
25
+ export { buildDefaultFieldDefinitions, defaultFieldDefinitions, defaultFieldDefinitionsByType };
14
26
  //# sourceMappingURL=index.d.ts.map
@@ -4,33 +4,46 @@ import { consentField } from "./consent.js";
4
4
  import { dateField } from "./date.js";
5
5
  import { emailField } from "./email.js";
6
6
  import { fileField } from "./file.js";
7
+ import { buildMessageField } from "./message.js";
7
8
  import { numberField } from "./number.js";
8
- import { repeaterField } from "./repeater.js";
9
- import { selectField } from "./select.js";
9
+ import { buildRepeaterField } from "./repeater.js";
10
+ import { buildSelectField } from "./select.js";
10
11
  import { textField } from "./text.js";
11
12
  import { textareaField } from "./textarea.js";
12
13
  //#region src/fields/builtin/index.ts
13
- 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`.
21
+ */
22
+ const buildDefaultFieldDefinitions = (localize, editor) => [
14
23
  textField,
15
24
  textareaField,
16
25
  emailField,
17
26
  numberField,
18
- selectField,
27
+ buildSelectField(localize),
19
28
  checkboxField,
20
29
  calculationField,
21
30
  consentField,
22
31
  fileField,
23
- repeaterField,
24
- dateField
32
+ buildRepeaterField(localize),
33
+ dateField,
34
+ buildMessageField(localize, editor)
25
35
  ];
36
+ const defaultFieldDefinitions = buildDefaultFieldDefinitions(true);
26
37
  /**
27
38
  * `defaultFieldDefinitions` indexed by `type`, so a single built-in can be spread and tweaked
28
39
  * without hand-rolling a `.find()`, e.g.
29
40
  * `fields: { text: { ...defaultFieldDefinitionsByType.text, validate: myValidate } }`. The
30
41
  * `fields` plugin option replaces a built-in of the same `type`; `false` removes it, `true` keeps it.
42
+ * Prebuilt with content localization on; with `localizeContent: false`, derive overrides from
43
+ * `buildDefaultFieldDefinitions(false)` instead so the spread does not reintroduce `localized`.
31
44
  */
32
45
  const defaultFieldDefinitionsByType = Object.fromEntries(defaultFieldDefinitions.map((definition) => [definition.type, definition]));
33
46
  //#endregion
34
- export { defaultFieldDefinitions, defaultFieldDefinitionsByType };
47
+ export { buildDefaultFieldDefinitions, defaultFieldDefinitions, defaultFieldDefinitionsByType };
35
48
 
36
49
  //# 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 { dateField } from './date'\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\tdateField as AnyFormFieldDefinition,\n]\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 */\nexport const defaultFieldDefinitionsByType: Record<string, AnyFormFieldDefinition> =\n\tObject.fromEntries(defaultFieldDefinitions.map((definition) => [definition.type, definition]))\n"],"mappings":";;;;;;;;;;;;AAeA,MAAa,0BAAoD;CAChE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;;;;;;AAQA,MAAa,gCACZ,OAAO,YAAY,wBAAwB,KAAK,eAAe,CAAC,WAAW,MAAM,UAAU,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/fields/builtin/index.ts"],"sourcesContent":["import type { RichTextField } from 'payload'\nimport type { AnyFormFieldDefinition } from '../types'\nimport { calculationField } from './calculation'\nimport { checkboxField } from './checkbox'\nimport { consentField } from './consent'\nimport { dateField } from './date'\nimport { emailField } from './email'\nimport { fileField } 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`.\n */\nexport const buildDefaultFieldDefinitions = (\n\tlocalize: boolean,\n\teditor?: RichTextField['editor']\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\tcalculationField as AnyFormFieldDefinition,\n\tconsentField as AnyFormFieldDefinition,\n\tfileField 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":";;;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,gCACZ,UACA,WAC8B;CAC9B;CACA;CACA;CACA;CACA,iBAAiB,QAAQ;CACzB;CACA;CACA;CACA;CACA,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 { localizedIf } from "../localizedIf.js";
2
+ import { keys } from "../../translations/keys.js";
3
+ import { labelFor } from "../../translations/server.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
+ import { localizedIf } from "../localizedIf.js";
1
2
  import { keys } from "../../translations/keys.js";
2
3
  import { labelFor } from "../../translations/server.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
+ import { localizedIf } from "../localizedIf.js";
1
2
  import { keys } from "../../translations/keys.js";
2
3
  import { labelFor } from "../../translations/server.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",
@@ -19,7 +22,8 @@ const selectField = defineFormField({
19
22
  name: "label",
20
23
  type: "text",
21
24
  required: true,
22
- label: labelFor(keys.configOptionLabel)
25
+ label: labelFor(keys.configOptionLabel),
26
+ ...localizedIf(localize)
23
27
  }, {
24
28
  name: "value",
25
29
  type: "text",
@@ -38,7 +42,8 @@ const selectField = defineFormField({
38
42
  return optionLabels?.[value] ?? String(value);
39
43
  }
40
44
  });
45
+ buildSelectField(true);
41
46
  //#endregion
42
- export { selectField };
47
+ export { buildSelectField };
43
48
 
44
49
  //# 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[] }\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\trequired: true,\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],\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,UAAU;GACV,OAAO,SAAS,KAAK,iBAAiB;GACtC,GAAG,YAAY,QAAQ;EACxB,GACA;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;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"}
@@ -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