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

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 +68 -0
  2. package/README.md +45 -1402
  3. package/dist/actions/buildActionBlocks.js +19 -0
  4. package/dist/actions/buildActionBlocks.js.map +1 -0
  5. package/dist/actions/builtin/confirmation.js +49 -0
  6. package/dist/actions/builtin/confirmation.js.map +1 -0
  7. package/dist/actions/builtin/emailTeam.js +46 -0
  8. package/dist/actions/builtin/emailTeam.js.map +1 -0
  9. package/dist/actions/builtin/index.d.ts +7 -0
  10. package/dist/actions/builtin/index.js +13 -0
  11. package/dist/actions/builtin/index.js.map +1 -0
  12. package/dist/actions/builtin/signedWebhook.js +49 -0
  13. package/dist/actions/builtin/signedWebhook.js.map +1 -0
  14. package/dist/actions/defineAction.d.ts +36 -0
  15. package/dist/actions/defineAction.js +6 -0
  16. package/dist/actions/defineAction.js.map +1 -0
  17. package/dist/actions/dispatch.js +48 -0
  18. package/dist/actions/dispatch.js.map +1 -0
  19. package/dist/actions/registry.d.ts +16 -0
  20. package/dist/actions/registry.js +16 -0
  21. package/dist/actions/registry.js.map +1 -0
  22. package/dist/actions/runActions.d.ts +9 -0
  23. package/dist/actions/runActions.js +34 -0
  24. package/dist/actions/runActions.js.map +1 -0
  25. package/dist/actions/sign.d.ts +7 -0
  26. package/dist/actions/sign.js +9 -0
  27. package/dist/actions/sign.js.map +1 -0
  28. package/dist/actions/task.js +82 -0
  29. package/dist/actions/task.js.map +1 -0
  30. package/dist/aggregation/aggregateResponses.d.ts +31 -0
  31. package/dist/aggregation/aggregateResponses.js +86 -0
  32. package/dist/aggregation/aggregateResponses.js.map +1 -0
  33. package/dist/aggregation/aggregateRows.d.ts +10 -0
  34. package/dist/aggregation/aggregateRows.js +64 -0
  35. package/dist/aggregation/aggregateRows.js.map +1 -0
  36. package/dist/aggregation/resolveResultsRequest.d.ts +32 -0
  37. package/dist/aggregation/resolveResultsRequest.js +56 -0
  38. package/dist/aggregation/resolveResultsRequest.js.map +1 -0
  39. package/dist/aggregation/types.d.ts +39 -0
  40. package/dist/calc/computeCalcFields.d.ts +15 -0
  41. package/dist/calc/computeCalcFields.js +27 -0
  42. package/dist/calc/computeCalcFields.js.map +1 -0
  43. package/dist/calc/evaluate.d.ts +8 -0
  44. package/dist/calc/evaluate.js +59 -0
  45. package/dist/calc/evaluate.js.map +1 -0
  46. package/dist/calc/normalizeCalc.d.ts +8 -0
  47. package/dist/calc/normalizeCalc.js +100 -0
  48. package/dist/calc/normalizeCalc.js.map +1 -0
  49. package/dist/calc/types.d.ts +28 -0
  50. package/dist/client/ConditionBuilder.js +121 -0
  51. package/dist/client/ConditionBuilder.js.map +1 -0
  52. package/dist/client/ConditionRow.js +150 -0
  53. package/dist/client/ConditionRow.js.map +1 -0
  54. package/dist/client/FlowBuilder.d.ts +15 -0
  55. package/dist/client/FlowBuilder.js +408 -0
  56. package/dist/client/FlowBuilder.js.map +1 -0
  57. package/dist/client/FormConditionField.d.ts +21 -0
  58. package/dist/client/FormConditionField.js +33 -0
  59. package/dist/client/FormConditionField.js.map +1 -0
  60. package/dist/client/synthesizeClientField.js +46 -0
  61. package/dist/client/synthesizeClientField.js.map +1 -0
  62. package/dist/collections/formSubmissions.js +157 -0
  63. package/dist/collections/formSubmissions.js.map +1 -0
  64. package/dist/collections/forms.js +198 -0
  65. package/dist/collections/forms.js.map +1 -0
  66. package/dist/collections/uploads.d.ts +30 -0
  67. package/dist/collections/uploads.js +55 -0
  68. package/dist/collections/uploads.js.map +1 -0
  69. package/dist/conditions/conditionType.js +14 -0
  70. package/dist/conditions/conditionType.js.map +1 -0
  71. package/dist/conditions/evaluate.d.ts +17 -0
  72. package/dist/conditions/evaluate.js +94 -0
  73. package/dist/conditions/evaluate.js.map +1 -0
  74. package/dist/conditions/fieldTypes.d.ts +9 -0
  75. package/dist/{fieldTypes-CzhhJXjg.js → conditions/fieldTypes.js} +2 -2
  76. package/dist/conditions/fieldTypes.js.map +1 -0
  77. package/dist/conditions/normalizeConditions.js +47 -0
  78. package/dist/conditions/normalizeConditions.js.map +1 -0
  79. package/dist/conditions/types.d.ts +8 -0
  80. package/dist/consent/buildConsentSourceConfig.js +49 -0
  81. package/dist/consent/buildConsentSourceConfig.js.map +1 -0
  82. package/dist/consent/builtin/index.d.ts +7 -0
  83. package/dist/consent/builtin/index.js +11 -0
  84. package/dist/consent/builtin/index.js.map +1 -0
  85. package/dist/consent/builtin/pageReference.js +75 -0
  86. package/dist/consent/builtin/pageReference.js.map +1 -0
  87. package/dist/consent/builtin/static.js +44 -0
  88. package/dist/consent/builtin/static.js.map +1 -0
  89. package/dist/consent/captureConsent.d.ts +28 -0
  90. package/dist/consent/captureConsent.js +26 -0
  91. package/dist/consent/captureConsent.js.map +1 -0
  92. package/dist/consent/defineConsentSource.d.ts +35 -0
  93. package/dist/consent/defineConsentSource.js +6 -0
  94. package/dist/consent/defineConsentSource.js.map +1 -0
  95. package/dist/consent/registry.d.ts +16 -0
  96. package/dist/consent/registry.js +16 -0
  97. package/dist/consent/registry.js.map +1 -0
  98. package/dist/consent/resolveConsentLinks.d.ts +19 -0
  99. package/dist/consent/resolveConsentLinks.js +26 -0
  100. package/dist/consent/resolveConsentLinks.js.map +1 -0
  101. package/dist/consent/resolvePublishedVersionRef.d.ts +17 -0
  102. package/dist/consent/resolvePublishedVersionRef.js +27 -0
  103. package/dist/consent/resolvePublishedVersionRef.js.map +1 -0
  104. package/dist/events/noopSink.js +6 -0
  105. package/dist/events/noopSink.js.map +1 -0
  106. package/dist/events/resolveEventSink.js +8 -0
  107. package/dist/events/resolveEventSink.js.map +1 -0
  108. package/dist/events/types.d.ts +31 -0
  109. package/dist/exports/client.d.ts +3 -21
  110. package/dist/exports/client.js +3 -319
  111. package/dist/exports/i18n.d.ts +3 -138
  112. package/dist/exports/i18n.js +2 -2
  113. package/dist/exports/react.d.ts +45 -550
  114. package/dist/exports/react.js +39 -1563
  115. package/dist/exports/rsc.d.ts +2 -16
  116. package/dist/exports/rsc.js +1 -54
  117. package/dist/exports/types.d.ts +28 -5
  118. package/dist/fields/buildFieldBlocks.js +60 -0
  119. package/dist/fields/buildFieldBlocks.js.map +1 -0
  120. package/dist/fields/builtin/calculation.js +24 -0
  121. package/dist/fields/builtin/calculation.js.map +1 -0
  122. package/dist/fields/builtin/checkbox.js +13 -0
  123. package/dist/fields/builtin/checkbox.js.map +1 -0
  124. package/dist/fields/builtin/consent.js +32 -0
  125. package/dist/fields/builtin/consent.js.map +1 -0
  126. package/dist/fields/builtin/email.js +18 -0
  127. package/dist/fields/builtin/email.js.map +1 -0
  128. package/dist/fields/builtin/file.js +40 -0
  129. package/dist/fields/builtin/file.js.map +1 -0
  130. package/dist/fields/builtin/index.js +27 -0
  131. package/dist/fields/builtin/index.js.map +1 -0
  132. package/dist/fields/builtin/number.js +17 -0
  133. package/dist/fields/builtin/number.js.map +1 -0
  134. package/dist/fields/builtin/repeater.js +44 -0
  135. package/dist/fields/builtin/repeater.js.map +1 -0
  136. package/dist/fields/builtin/select.js +44 -0
  137. package/dist/fields/builtin/select.js.map +1 -0
  138. package/dist/fields/builtin/text.js +13 -0
  139. package/dist/fields/builtin/text.js.map +1 -0
  140. package/dist/fields/builtin/textarea.js +13 -0
  141. package/dist/fields/builtin/textarea.js.map +1 -0
  142. package/dist/fields/defineFormField.d.ts +13 -0
  143. package/dist/fields/defineFormField.js +12 -0
  144. package/dist/fields/defineFormField.js.map +1 -0
  145. package/dist/fields/registry.d.ts +10 -0
  146. package/dist/fields/registry.js +24 -0
  147. package/dist/fields/registry.js.map +1 -0
  148. package/dist/fields/sharedConfig.js +89 -0
  149. package/dist/fields/sharedConfig.js.map +1 -0
  150. package/dist/fields/types.d.ts +89 -0
  151. package/dist/flow/engine.d.ts +17 -0
  152. package/dist/flow/engine.js +24 -0
  153. package/dist/flow/engine.js.map +1 -0
  154. package/dist/flow/normalizeFlow.js +35 -0
  155. package/dist/flow/normalizeFlow.js.map +1 -0
  156. package/dist/{types-DsJ_6kGJ.d.ts → flow/types.d.ts} +2 -2
  157. package/dist/index.d.ts +93 -4
  158. package/dist/index.js +43 -1890
  159. package/dist/index.js.map +1 -1
  160. package/dist/plugin/access.js +12 -0
  161. package/dist/plugin/access.js.map +1 -0
  162. package/dist/plugin/collectionOverrides.d.ts +22 -0
  163. package/dist/plugin/registerCollections.js +68 -0
  164. package/dist/plugin/registerCollections.js.map +1 -0
  165. package/dist/plugin/registerTranslations.js +19 -0
  166. package/dist/plugin/registerTranslations.js.map +1 -0
  167. package/dist/prefill/valuesFromSearchParams.d.ts +18 -0
  168. package/dist/prefill/valuesFromSearchParams.js +45 -0
  169. package/dist/prefill/valuesFromSearchParams.js.map +1 -0
  170. package/dist/presentations/defaults.d.ts +33 -0
  171. package/dist/presentations/defaults.js +35 -0
  172. package/dist/presentations/defaults.js.map +1 -0
  173. package/dist/presentations/registry.d.ts +15 -0
  174. package/dist/presentations/registry.js +15 -0
  175. package/dist/presentations/registry.js.map +1 -0
  176. package/dist/presentations/types.d.ts +18 -0
  177. package/dist/react/Form.d.ts +110 -0
  178. package/dist/react/Form.js +499 -0
  179. package/dist/react/Form.js.map +1 -0
  180. package/dist/react/FormContext.d.ts +16 -0
  181. package/dist/react/FormContext.js +14 -0
  182. package/dist/react/FormContext.js.map +1 -0
  183. package/dist/react/FormLayout.d.ts +20 -0
  184. package/dist/react/FormLayout.js +14 -0
  185. package/dist/react/FormLayout.js.map +1 -0
  186. package/dist/react/FormResults.d.ts +25 -0
  187. package/dist/react/FormResults.js +85 -0
  188. package/dist/react/FormResults.js.map +1 -0
  189. package/dist/react/Honeypot.d.ts +22 -0
  190. package/dist/react/Honeypot.js +38 -0
  191. package/dist/react/Honeypot.js.map +1 -0
  192. package/dist/react/Poll.d.ts +32 -0
  193. package/dist/react/Poll.js +77 -0
  194. package/dist/react/Poll.js.map +1 -0
  195. package/dist/react/cn.d.ts +6 -0
  196. package/dist/react/cn.js +8 -0
  197. package/dist/react/cn.js.map +1 -0
  198. package/dist/react/contract.d.ts +32 -0
  199. package/dist/react/contract.js +7 -0
  200. package/dist/react/contract.js.map +1 -0
  201. package/dist/react/events.js +14 -0
  202. package/dist/react/events.js.map +1 -0
  203. package/dist/react/fetchResults.d.ts +25 -0
  204. package/dist/react/fetchResults.js +31 -0
  205. package/dist/react/fetchResults.js.map +1 -0
  206. package/dist/react/presentation/Backdrop.d.ts +18 -0
  207. package/dist/react/presentation/Backdrop.js +14 -0
  208. package/dist/react/presentation/Backdrop.js.map +1 -0
  209. package/dist/react/presentation/DialogSurface.d.ts +35 -0
  210. package/dist/react/presentation/DialogSurface.js +56 -0
  211. package/dist/react/presentation/DialogSurface.js.map +1 -0
  212. package/dist/react/presentation/presentations.d.ts +7 -0
  213. package/dist/react/presentation/presentations.js +32 -0
  214. package/dist/react/presentation/presentations.js.map +1 -0
  215. package/dist/react/presentation/registry.d.ts +11 -0
  216. package/dist/react/presentation/registry.js +12 -0
  217. package/dist/react/presentation/registry.js.map +1 -0
  218. package/dist/react/presentation/types.d.ts +19 -0
  219. package/dist/react/presentation/useDismiss.d.ts +19 -0
  220. package/dist/react/presentation/useDismiss.js +33 -0
  221. package/dist/react/presentation/useDismiss.js.map +1 -0
  222. package/dist/react/presentation/useFocusTrap.d.ts +8 -0
  223. package/dist/react/presentation/useFocusTrap.js +35 -0
  224. package/dist/react/presentation/useFocusTrap.js.map +1 -0
  225. package/dist/react/presentation/useScrollLock.d.ts +6 -0
  226. package/dist/react/presentation/useScrollLock.js +18 -0
  227. package/dist/react/presentation/useScrollLock.js.map +1 -0
  228. package/dist/react/primitives/Checkbox.d.ts +26 -0
  229. package/dist/react/primitives/Checkbox.js +20 -0
  230. package/dist/react/primitives/Checkbox.js.map +1 -0
  231. package/dist/react/primitives/FieldShell.d.ts +31 -0
  232. package/dist/react/primitives/FieldShell.js +51 -0
  233. package/dist/react/primitives/FieldShell.js.map +1 -0
  234. package/dist/react/primitives/Input.d.ts +30 -0
  235. package/dist/react/primitives/Input.js +21 -0
  236. package/dist/react/primitives/Input.js.map +1 -0
  237. package/dist/react/primitives/Select.d.ts +34 -0
  238. package/dist/react/primitives/Select.js +26 -0
  239. package/dist/react/primitives/Select.js.map +1 -0
  240. package/dist/react/primitives/Textarea.d.ts +28 -0
  241. package/dist/react/primitives/Textarea.js +20 -0
  242. package/dist/react/primitives/Textarea.js.map +1 -0
  243. package/dist/react/recall.js +20 -0
  244. package/dist/react/recall.js.map +1 -0
  245. package/dist/react/registry.d.ts +16 -0
  246. package/dist/react/registry.js +16 -0
  247. package/dist/react/registry.js.map +1 -0
  248. package/dist/react/renderers/calculation.js +30 -0
  249. package/dist/react/renderers/calculation.js.map +1 -0
  250. package/dist/react/renderers/checkbox.js +35 -0
  251. package/dist/react/renderers/checkbox.js.map +1 -0
  252. package/dist/react/renderers/consent.js +54 -0
  253. package/dist/react/renderers/consent.js.map +1 -0
  254. package/dist/react/renderers/email.js +37 -0
  255. package/dist/react/renderers/email.js.map +1 -0
  256. package/dist/react/renderers/file.js +92 -0
  257. package/dist/react/renderers/file.js.map +1 -0
  258. package/dist/react/renderers/index.d.ts +8 -0
  259. package/dist/react/renderers/index.js +28 -0
  260. package/dist/react/renderers/index.js.map +1 -0
  261. package/dist/react/renderers/number.js +40 -0
  262. package/dist/react/renderers/number.js.map +1 -0
  263. package/dist/react/renderers/repeater.js +113 -0
  264. package/dist/react/renderers/repeater.js.map +1 -0
  265. package/dist/react/renderers/select.js +38 -0
  266. package/dist/react/renderers/select.js.map +1 -0
  267. package/dist/react/renderers/text.js +37 -0
  268. package/dist/react/renderers/text.js.map +1 -0
  269. package/dist/react/renderers/textarea.js +36 -0
  270. package/dist/react/renderers/textarea.js.map +1 -0
  271. package/dist/react/resolveForm.js +16 -0
  272. package/dist/react/resolveForm.js.map +1 -0
  273. package/dist/react/state.d.ts +15 -0
  274. package/dist/react/state.js +70 -0
  275. package/dist/react/state.js.map +1 -0
  276. package/dist/react/submitForm.d.ts +31 -0
  277. package/dist/react/submitForm.js +58 -0
  278. package/dist/react/submitForm.js.map +1 -0
  279. package/dist/react/toFormDocument.d.ts +24 -0
  280. package/dist/react/toFormDocument.js +22 -0
  281. package/dist/react/toFormDocument.js.map +1 -0
  282. package/dist/react/uploadFile.d.ts +23 -0
  283. package/dist/react/uploadFile.js +39 -0
  284. package/dist/react/uploadFile.js.map +1 -0
  285. package/dist/react/useField.d.ts +14 -0
  286. package/dist/react/useField.js +49 -0
  287. package/dist/react/useField.js.map +1 -0
  288. package/dist/react/useFormState.d.ts +8 -0
  289. package/dist/react/useFormState.js +9 -0
  290. package/dist/react/useFormState.js.map +1 -0
  291. package/dist/react/useFormStep.d.ts +8 -0
  292. package/dist/react/useFormStep.js +9 -0
  293. package/dist/react/useFormStep.js.map +1 -0
  294. package/dist/react/validateField.js +30 -0
  295. package/dist/react/validateField.js.map +1 -0
  296. package/dist/recall/interpolate.d.ts +10 -0
  297. package/dist/recall/interpolate.js +16 -0
  298. package/dist/recall/interpolate.js.map +1 -0
  299. package/dist/recall/resolver.d.ts +22 -0
  300. package/dist/recall/resolver.js +36 -0
  301. package/dist/recall/resolver.js.map +1 -0
  302. package/dist/spam/captcha.d.ts +12 -0
  303. package/dist/spam/captcha.js +11 -0
  304. package/dist/spam/captcha.js.map +1 -0
  305. package/dist/spam/constants.d.ts +12 -0
  306. package/dist/spam/constants.js +15 -0
  307. package/dist/spam/constants.js.map +1 -0
  308. package/dist/spam/identify.d.ts +12 -0
  309. package/dist/spam/identify.js +20 -0
  310. package/dist/spam/identify.js.map +1 -0
  311. package/dist/spam/rateLimiter.d.ts +18 -0
  312. package/dist/spam/rateLimiter.js +41 -0
  313. package/dist/spam/rateLimiter.js.map +1 -0
  314. package/dist/spam/reserved.js +30 -0
  315. package/dist/spam/reserved.js.map +1 -0
  316. package/dist/spam/resolveSpam.d.ts +12 -0
  317. package/dist/spam/resolveSpam.js +42 -0
  318. package/dist/spam/resolveSpam.js.map +1 -0
  319. package/dist/spam/spamGuard.js +68 -0
  320. package/dist/spam/spamGuard.js.map +1 -0
  321. package/dist/spam/types.d.ts +73 -0
  322. package/dist/spam/uploadHooks.js +33 -0
  323. package/dist/spam/uploadHooks.js.map +1 -0
  324. package/dist/submissions/SubmissionAnswers.d.ts +14 -0
  325. package/dist/submissions/SubmissionAnswers.js +133 -0
  326. package/dist/submissions/SubmissionAnswers.js.map +1 -0
  327. package/dist/submissions/SubmissionAnswersClient.js +142 -0
  328. package/dist/submissions/SubmissionAnswersClient.js.map +1 -0
  329. package/dist/submissions/runSubmission.js +257 -0
  330. package/dist/submissions/runSubmission.js.map +1 -0
  331. package/dist/submissions/types.d.ts +34 -0
  332. package/dist/submissions/validateSubmission.js +59 -0
  333. package/dist/submissions/validateSubmission.js.map +1 -0
  334. package/dist/translations/en.d.ts +12 -0
  335. package/dist/{translations-edMqq_2e.js → translations/en.js} +29 -23
  336. package/dist/translations/en.js.map +1 -0
  337. package/dist/translations/index.d.ts +14 -0
  338. package/dist/translations/index.js +26 -0
  339. package/dist/translations/index.js.map +1 -0
  340. package/dist/translations/keys.d.ts +157 -0
  341. package/dist/{keys-N5xGiUsh.js → translations/keys.js} +28 -3
  342. package/dist/translations/keys.js.map +1 -0
  343. package/dist/translations/makeTranslate.d.ts +11 -0
  344. package/dist/translations/makeTranslate.js +11 -0
  345. package/dist/translations/makeTranslate.js.map +1 -0
  346. package/dist/translations/server.js +25 -0
  347. package/dist/translations/server.js.map +1 -0
  348. package/dist/translations/useTranslation.js +12 -0
  349. package/dist/translations/useTranslation.js.map +1 -0
  350. package/dist/uploads/captureFileRef.d.ts +27 -0
  351. package/dist/uploads/captureFileRef.js +34 -0
  352. package/dist/uploads/captureFileRef.js.map +1 -0
  353. package/dist/uploads/resolveFileRef.d.ts +26 -0
  354. package/dist/uploads/resolveFileRef.js +44 -0
  355. package/dist/uploads/resolveFileRef.js.map +1 -0
  356. package/dist/uploads/types.d.ts +20 -0
  357. package/dist/validation/buildRuleBlocks.js +46 -0
  358. package/dist/validation/buildRuleBlocks.js.map +1 -0
  359. package/dist/validation/builtin/email.js +19 -0
  360. package/dist/validation/builtin/email.js.map +1 -0
  361. package/dist/validation/builtin/index.js +27 -0
  362. package/dist/validation/builtin/index.js.map +1 -0
  363. package/dist/validation/builtin/matchesField.js +20 -0
  364. package/dist/validation/builtin/matchesField.js.map +1 -0
  365. package/dist/validation/builtin/max.js +21 -0
  366. package/dist/validation/builtin/max.js.map +1 -0
  367. package/dist/validation/builtin/maxLength.js +26 -0
  368. package/dist/validation/builtin/maxLength.js.map +1 -0
  369. package/dist/validation/builtin/min.js +21 -0
  370. package/dist/validation/builtin/min.js.map +1 -0
  371. package/dist/validation/builtin/minLength.js +26 -0
  372. package/dist/validation/builtin/minLength.js.map +1 -0
  373. package/dist/validation/builtin/notAlreadySubmitted.js +32 -0
  374. package/dist/validation/builtin/notAlreadySubmitted.js.map +1 -0
  375. package/dist/validation/builtin/oneOf.js +34 -0
  376. package/dist/validation/builtin/oneOf.js.map +1 -0
  377. package/dist/validation/builtin/pattern.js +41 -0
  378. package/dist/validation/builtin/pattern.js.map +1 -0
  379. package/dist/validation/builtin/url.js +22 -0
  380. package/dist/validation/builtin/url.js.map +1 -0
  381. package/dist/validation/defineValidationRule.d.ts +12 -0
  382. package/dist/validation/defineValidationRule.js +11 -0
  383. package/dist/validation/defineValidationRule.js.map +1 -0
  384. package/dist/validation/message.js +14 -0
  385. package/dist/validation/message.js.map +1 -0
  386. package/dist/validation/registry.d.ts +10 -0
  387. package/dist/validation/registry.js +20 -0
  388. package/dist/validation/registry.js.map +1 -0
  389. package/dist/validation/runValidation.js +111 -0
  390. package/dist/validation/runValidation.js.map +1 -0
  391. package/dist/validation/types.d.ts +76 -0
  392. package/package.json +8 -5
  393. package/styles/form-builder.css +201 -11
  394. package/dist/constants-B-BUfetP.d.ts +0 -288
  395. package/dist/exports/client.js.map +0 -1
  396. package/dist/exports/react.js.map +0 -1
  397. package/dist/exports/rsc.js.map +0 -1
  398. package/dist/fieldTypes-B8jkNRob.d.ts +0 -188
  399. package/dist/fieldTypes-CzhhJXjg.js.map +0 -1
  400. package/dist/index-DfFYGbVF.d.ts +0 -481
  401. package/dist/keys-N5xGiUsh.js.map +0 -1
  402. package/dist/registry-CoCyhtvB.js +0 -282
  403. package/dist/registry-CoCyhtvB.js.map +0 -1
  404. package/dist/resolver-OeQyVH2N.js +0 -665
  405. package/dist/resolver-OeQyVH2N.js.map +0 -1
  406. package/dist/translations-edMqq_2e.js.map +0 -1
@@ -1,16 +1,2 @@
1
- import { UIFieldServerProps } from "payload";
2
-
3
- //#region src/submissions/SubmissionAnswers.d.ts
4
- /**
5
- * Read-only, localized submission view (server component). Renders each answered field's snapshot
6
- * label next to its type-aware formatted value via the field type's `format`, using the request
7
- * locale and i18n, with no client bundle. The built-in field types are formatted directly; threading
8
- * the full resolved registry (custom types) to the view is a future enhancement.
9
- */
10
- declare const SubmissionAnswers: ({
11
- data,
12
- req
13
- }: UIFieldServerProps) => import("react/jsx-runtime").JSX.Element;
14
- //#endregion
15
- export { SubmissionAnswers };
16
- //# sourceMappingURL=rsc.d.ts.map
1
+ import { SubmissionAnswers } from "../submissions/SubmissionAnswers.js";
2
+ export { SubmissionAnswers };
@@ -1,55 +1,2 @@
1
- import { t as keys } from "../keys-N5xGiUsh.js";
2
- import { a as asFieldTranslate, r as defaultFieldDefinitions, t as buildRegistry } from "../registry-CoCyhtvB.js";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
- //#region src/submissions/SubmissionAnswers.tsx
5
- const registry = buildRegistry(defaultFieldDefinitions);
6
- /** A stored file answer's link, when the captured `FileRef` carries a url; null otherwise. */
7
- const fileHref = (raw) => {
8
- if (raw && typeof raw === "object" && "url" in raw) {
9
- const ref = raw;
10
- if (typeof ref.url === "string" && ref.url.length > 0) return {
11
- url: ref.url,
12
- filename: typeof ref.filename === "string" ? ref.filename : ref.url
13
- };
14
- }
15
- return null;
16
- };
17
- /**
18
- * Read-only, localized submission view (server component). Renders each answered field's snapshot
19
- * label next to its type-aware formatted value via the field type's `format`, using the request
20
- * locale and i18n, with no client bundle. The built-in field types are formatted directly; threading
21
- * the full resolved registry (custom types) to the view is a future enhancement.
22
- */
23
- const SubmissionAnswers = ({ data, req }) => {
24
- const doc = data ?? {};
25
- const descriptors = doc.descriptors ?? [];
26
- const values = doc.values ?? [];
27
- const locale = doc.locale ?? req.locale ?? "en";
28
- const t = asFieldTranslate(req.i18n.t);
29
- if (descriptors.length === 0) return /* @__PURE__ */ jsx("p", { children: t(keys.submissionNoAnswers) });
30
- const valueByField = new Map(values.map((entry) => [entry.field, entry.value]));
31
- return /* @__PURE__ */ jsxs("div", {
32
- className: "form-builder-submission-answers",
33
- children: [/* @__PURE__ */ jsx("h4", { children: t(keys.submissionAnswers) }), /* @__PURE__ */ jsx("dl", { children: descriptors.map((descriptor) => {
34
- const definition = registry.get(descriptor.fieldType);
35
- const raw = valueByField.get(descriptor.field);
36
- const formatted = definition?.format ? definition.format({
37
- value: raw,
38
- config: {},
39
- optionLabels: descriptor.optionLabels,
40
- locale,
41
- t
42
- }) : raw == null ? "" : String(raw);
43
- const href = descriptor.fieldType === "file" ? fileHref(raw) : null;
44
- return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: descriptor.label }), /* @__PURE__ */ jsx("dd", { children: href ? /* @__PURE__ */ jsx("a", {
45
- href: href.url,
46
- rel: "noreferrer",
47
- children: href.filename
48
- }) : formatted })] }, descriptor.field);
49
- }) })]
50
- });
51
- };
52
- //#endregion
1
+ import { SubmissionAnswers } from "../submissions/SubmissionAnswers.js";
53
2
  export { SubmissionAnswers };
54
-
55
- //# sourceMappingURL=rsc.js.map
@@ -1,5 +1,28 @@
1
- import { a as FormFieldFormat, d as FileRefError, i as FormFieldDefinition, l as FileFieldConfig, n as AnyFormFieldDefinition, o as FormFieldValidate, s as FormFieldValueKind, u as FileRef } from "../fieldTypes-B8jkNRob.js";
2
- import { A as FieldMeta, D as AggregationBucket, E as CalcExpression, F as SubmissionValue, N as SubmissionDescriptor, O as AggregationRow, P as SubmissionFieldError, _ as PrefillOptions, b as FieldTypeRegistry, c as PresentationDescriptor, f as ValidationRuleDefinition, g as FormEventSink, h as FormEvent, j as SubmissionStatusFilter, k as FieldAggregation, l as PresentationSurface, m as ValidationSeverity, p as ValidationRuleResult, r as RecallResolver, s as PresentationDensity, u as AnyValidationRuleDefinition, x as FieldTypesConfig, y as FieldTypeOption } from "../constants-B-BUfetP.js";
3
- import { n as FlowTransition, r as FormFlow, t as FlowStep } from "../types-DsJ_6kGJ.js";
4
- import { $ as UploadsCollectionConfig, A as RateLimitResult, C as ValidationRuleRegistry, D as IdentifyFn, E as CaptchaVerifyArgs, F as PresentationDescriptorOption, G as AnyConsentSource, H as ConsentSourceRegistry, I as PresentationDescriptorRegistry, J as ConsentResolved, K as ConsentLink, L as PresentationsDescriptorConfig, M as SpamConfig, N as SpamMetadataConfig, O as RateLimitCheckArgs, P as SpamOption, S as ValidationRuleOption, T as CaptchaProvider, U as ConsentSourcesConfig, V as ConsentSourceOption, Y as ConsentSource, Z as FieldCondition, _t as ActionRunArgs, dt as ActionResult, et as UploadsOption, ft as ActionOption, gt as ActionDefinition, it as ResolveResultsRequestResult, j as RateLimiter, k as RateLimitConfig, mt as ActionsConfig, ot as AggregateFieldResponsesArgs, pt as ActionRegistry, q as ConsentResolveArgs, rt as ResolveResultsRequestArgs, st as AggregateFormResponsesArgs, t as FormBuilderPluginOptions, vt as AnyActionDefinition, w as ValidationRulesConfig, z as ConsentProof } from "../index-DfFYGbVF.js";
5
- export type { ActionDefinition, ActionOption, ActionRegistry, ActionResult, ActionRunArgs, ActionsConfig, AggregateFieldResponsesArgs, AggregateFormResponsesArgs, AggregationBucket, AggregationRow, AnyActionDefinition, AnyConsentSource, AnyFormFieldDefinition, AnyValidationRuleDefinition, CalcExpression, CaptchaProvider, CaptchaVerifyArgs, ConsentLink, ConsentProof, ConsentResolveArgs, ConsentResolved, ConsentSource, ConsentSourceOption, ConsentSourceRegistry, ConsentSourcesConfig, FieldAggregation, FieldCondition, FieldMeta, FieldTypeOption, FieldTypeRegistry, FieldTypesConfig, FileFieldConfig, FileRef, FileRefError, FlowStep, FlowTransition, FormBuilderPluginOptions, FormEvent, FormEventSink, FormFieldDefinition, FormFieldFormat, FormFieldValidate, FormFieldValueKind, FormFlow, IdentifyFn, PrefillOptions, PresentationDensity, PresentationDescriptor, PresentationDescriptorOption, PresentationDescriptorRegistry, PresentationSurface, PresentationsDescriptorConfig, RateLimitCheckArgs, RateLimitConfig, RateLimitResult, RateLimiter, RecallResolver, ResolveResultsRequestArgs, ResolveResultsRequestResult, SpamConfig, SpamMetadataConfig, SpamOption, SubmissionDescriptor, SubmissionFieldError, SubmissionStatusFilter, SubmissionValue, UploadsCollectionConfig, UploadsOption, ValidationRuleDefinition, ValidationRuleOption, ValidationRuleRegistry, ValidationRuleResult, ValidationRulesConfig, ValidationSeverity };
1
+ import { FileFieldConfig, FileRef, FileRefError } from "../uploads/types.js";
2
+ import { AnyFormFieldDefinition, FormFieldDefinition, FormFieldFormat, FormFieldValidate, FormFieldValueKind } from "../fields/types.js";
3
+ import { FormFieldInstance, SubmissionDescriptor, SubmissionFieldError, SubmissionValue } from "../submissions/types.js";
4
+ import { AggregationBucket, AggregationRow, FieldAggregation, FieldMeta, SubmissionStatusFilter } from "../aggregation/types.js";
5
+ import { CalcExpression } from "../calc/types.js";
6
+ import { FlowStep, FlowTransition, FormFlow } from "../flow/types.js";
7
+ import { FieldTypeOption, FieldTypeRegistry, FieldTypesConfig } from "../fields/registry.js";
8
+ import { PrefillOptions } from "../prefill/valuesFromSearchParams.js";
9
+ import { FormEvent, FormEventSink } from "../events/types.js";
10
+ import { AnyValidationRuleDefinition, ValidationRuleDefinition, ValidationRuleResult, ValidationSeverity } from "../validation/types.js";
11
+ import { PresentationDensity, PresentationDescriptor, PresentationSurface } from "../presentations/types.js";
12
+ import { RecallResolver } from "../recall/resolver.js";
13
+ import { ActionDefinition, ActionRunArgs, AnyActionDefinition } from "../actions/defineAction.js";
14
+ import { ActionOption, ActionRegistry, ActionsConfig } from "../actions/registry.js";
15
+ import { ActionResult } from "../actions/runActions.js";
16
+ import { AggregateFieldResponsesArgs, AggregateFormResponsesArgs } from "../aggregation/aggregateResponses.js";
17
+ import { ResolveResultsRequestArgs, ResolveResultsRequestResult } from "../aggregation/resolveResultsRequest.js";
18
+ import { CollectionOverrides, FieldsOverride } from "../plugin/collectionOverrides.js";
19
+ import { UploadsCollectionConfig, UploadsOption } from "../collections/uploads.js";
20
+ import { FieldCondition } from "../conditions/types.js";
21
+ import { AnyConsentSource, ConsentLink, ConsentResolveArgs, ConsentResolved, ConsentSource } from "../consent/defineConsentSource.js";
22
+ import { ConsentSourceOption, ConsentSourceRegistry, ConsentSourcesConfig } from "../consent/registry.js";
23
+ import { ConsentProof } from "../consent/captureConsent.js";
24
+ import { PresentationDescriptorOption, PresentationDescriptorRegistry, PresentationsDescriptorConfig } from "../presentations/registry.js";
25
+ import { CaptchaProvider, CaptchaVerifyArgs, IdentifyFn, RateLimitCheckArgs, RateLimitConfig, RateLimitResult, RateLimiter, SpamConfig, SpamMetadataConfig, SpamOption } from "../spam/types.js";
26
+ import { ValidationRuleOption, ValidationRuleRegistry, ValidationRulesConfig } from "../validation/registry.js";
27
+ import { FormBuilderPluginOptions } from "../index.js";
28
+ export type { ActionDefinition, ActionOption, ActionRegistry, ActionResult, ActionRunArgs, ActionsConfig, AggregateFieldResponsesArgs, AggregateFormResponsesArgs, AggregationBucket, AggregationRow, AnyActionDefinition, AnyConsentSource, AnyFormFieldDefinition, AnyValidationRuleDefinition, CalcExpression, CaptchaProvider, CaptchaVerifyArgs, CollectionOverrides, ConsentLink, ConsentProof, ConsentResolveArgs, ConsentResolved, ConsentSource, ConsentSourceOption, ConsentSourceRegistry, ConsentSourcesConfig, FieldAggregation, FieldCondition, FieldMeta, FieldTypeOption, FieldTypeRegistry, FieldTypesConfig, FieldsOverride, FileFieldConfig, FileRef, FileRefError, FlowStep, FlowTransition, FormBuilderPluginOptions, FormEvent, FormEventSink, FormFieldDefinition, FormFieldFormat, FormFieldInstance, FormFieldValidate, FormFieldValueKind, FormFlow, IdentifyFn, PrefillOptions, PresentationDensity, PresentationDescriptor, PresentationDescriptorOption, PresentationDescriptorRegistry, PresentationSurface, PresentationsDescriptorConfig, RateLimitCheckArgs, RateLimitConfig, RateLimitResult, RateLimiter, RecallResolver, ResolveResultsRequestArgs, ResolveResultsRequestResult, SpamConfig, SpamMetadataConfig, SpamOption, SubmissionDescriptor, SubmissionFieldError, SubmissionStatusFilter, SubmissionValue, UploadsCollectionConfig, UploadsOption, ValidationRuleDefinition, ValidationRuleOption, ValidationRuleRegistry, ValidationRuleResult, ValidationRulesConfig, ValidationSeverity };
@@ -0,0 +1,60 @@
1
+ import { keys } from "../translations/keys.js";
2
+ import { labelFor } from "../translations/server.js";
3
+ import { buildConditionTypeMap } from "../conditions/conditionType.js";
4
+ import { buildConsentSourceConfig } from "../consent/buildConsentSourceConfig.js";
5
+ import { buildRuleBlocks } from "../validation/buildRuleBlocks.js";
6
+ import { sharedFieldConfig } from "./sharedConfig.js";
7
+ //#region src/fields/buildFieldBlocks.ts
8
+ /** One add-field block per registered type: shared config, the type's own config, then its validations. */
9
+ const buildFieldBlocks = (registry, ruleRegistry, consentRegistry) => {
10
+ const conditionTypes = buildConditionTypeMap(registry);
11
+ const blocks = [];
12
+ for (const definition of registry.values()) {
13
+ let typeConfig = definition.config ?? [];
14
+ if (definition.type === "consent" && consentRegistry) {
15
+ const statement = typeConfig.find((f) => f.name === "statement");
16
+ const optional = typeConfig.find((f) => f.name === "optional");
17
+ typeConfig = [
18
+ ...statement ? [statement] : [],
19
+ ...buildConsentSourceConfig(consentRegistry),
20
+ ...optional ? [optional] : []
21
+ ];
22
+ }
23
+ blocks.push({
24
+ slug: definition.type,
25
+ labels: {
26
+ singular: labelFor(definition.label),
27
+ plural: labelFor(definition.label)
28
+ },
29
+ fields: [
30
+ ...sharedFieldConfig(conditionTypes),
31
+ ...typeConfig,
32
+ {
33
+ name: "validations",
34
+ type: "blocks",
35
+ label: labelFor(keys.validationsLabel),
36
+ blocks: buildRuleBlocks(ruleRegistry, definition.type)
37
+ }
38
+ ]
39
+ });
40
+ }
41
+ const repeaterBlock = blocks.find((b) => b.slug === "repeater");
42
+ if (repeaterBlock) {
43
+ const subFieldBlocks = blocks.filter((b) => b.slug !== "repeater");
44
+ const fieldsArr = repeaterBlock.fields;
45
+ const validationsIdx = fieldsArr.findIndex((f) => f.name === "validations");
46
+ const subFieldsField = {
47
+ name: "subFields",
48
+ type: "blocks",
49
+ label: labelFor(keys.configSubFields),
50
+ blocks: subFieldBlocks
51
+ };
52
+ if (validationsIdx >= 0) fieldsArr.splice(validationsIdx, 0, subFieldsField);
53
+ else fieldsArr.push(subFieldsField);
54
+ }
55
+ return blocks;
56
+ };
57
+ //#endregion
58
+ export { buildFieldBlocks };
59
+
60
+ //# sourceMappingURL=buildFieldBlocks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildFieldBlocks.js","names":[],"sources":["../../src/fields/buildFieldBlocks.ts"],"sourcesContent":["import type { Block, Field } from 'payload'\nimport { buildConditionTypeMap } from '../conditions/conditionType'\nimport { buildConsentSourceConfig } from '../consent/buildConsentSourceConfig'\nimport type { ConsentSourceRegistry } from '../consent/registry'\nimport { keys } from '../translations/keys'\nimport { labelFor } from '../translations/server'\nimport { buildRuleBlocks } from '../validation/buildRuleBlocks'\nimport type { ValidationRuleRegistry } from '../validation/registry'\nimport type { FieldTypeRegistry } from './registry'\nimport { sharedFieldConfig } from './sharedConfig'\n\n/** One add-field block per registered type: shared config, the type's own config, then its validations. */\nexport const buildFieldBlocks = (\n\tregistry: FieldTypeRegistry,\n\truleRegistry: ValidationRuleRegistry,\n\tconsentRegistry?: ConsentSourceRegistry\n): Block[] => {\n\tconst conditionTypes = buildConditionTypeMap(registry)\n\tconst blocks: Block[] = []\n\tfor (const definition of registry.values()) {\n\t\tlet typeConfig: Field[] = definition.config ?? []\n\n\t\t// Inject dynamic source select + conditional sourceConfig group for the consent field.\n\t\t// consent.ts intentionally omits source/sourceConfig; the live registry drives the\n\t\t// select options and per-source field visibility (admin.condition).\n\t\tif (definition.type === 'consent' && consentRegistry) {\n\t\t\t// statement is first; optional is last; source/sourceConfig go in between.\n\t\t\tconst statement = typeConfig.find((f) => (f as { name?: string }).name === 'statement')\n\t\t\tconst optional = typeConfig.find((f) => (f as { name?: string }).name === 'optional')\n\t\t\ttypeConfig = [\n\t\t\t\t...(statement ? [statement] : []),\n\t\t\t\t...buildConsentSourceConfig(consentRegistry),\n\t\t\t\t...(optional ? [optional] : []),\n\t\t\t]\n\t\t}\n\n\t\tblocks.push({\n\t\t\tslug: definition.type,\n\t\t\tlabels: { singular: labelFor(definition.label), plural: labelFor(definition.label) },\n\t\t\tfields: [\n\t\t\t\t...sharedFieldConfig(conditionTypes),\n\t\t\t\t...typeConfig,\n\t\t\t\t{\n\t\t\t\t\tname: 'validations',\n\t\t\t\t\ttype: 'blocks',\n\t\t\t\t\tlabel: labelFor(keys.validationsLabel),\n\t\t\t\t\tblocks: buildRuleBlocks(ruleRegistry, definition.type),\n\t\t\t\t},\n\t\t\t],\n\t\t})\n\t}\n\n\t// Second pass: inject subFields into the repeater block using all non-repeater blocks.\n\t// Done after the main loop so every sibling block is already built.\n\t// Repeater-in-repeater is not supported in v1; the repeater block is excluded from subFields.\n\tconst repeaterBlock = blocks.find((b) => b.slug === 'repeater')\n\tif (repeaterBlock) {\n\t\tconst subFieldBlocks = blocks.filter((b) => b.slug !== 'repeater')\n\t\tconst fieldsArr = repeaterBlock.fields as Field[]\n\t\tconst validationsIdx = fieldsArr.findIndex(\n\t\t\t(f) => (f as { name?: string }).name === 'validations'\n\t\t)\n\t\tconst subFieldsField: Field = {\n\t\t\tname: 'subFields',\n\t\t\ttype: 'blocks',\n\t\t\tlabel: labelFor(keys.configSubFields),\n\t\t\tblocks: subFieldBlocks,\n\t\t}\n\t\tif (validationsIdx >= 0) {\n\t\t\tfieldsArr.splice(validationsIdx, 0, subFieldsField)\n\t\t} else {\n\t\t\tfieldsArr.push(subFieldsField)\n\t\t}\n\t}\n\n\treturn blocks\n}\n"],"mappings":";;;;;;;;AAYA,MAAa,oBACZ,UACA,cACA,oBACa;CACb,MAAM,iBAAiB,sBAAsB,QAAQ;CACrD,MAAM,SAAkB,CAAC;CACzB,KAAK,MAAM,cAAc,SAAS,OAAO,GAAG;EAC3C,IAAI,aAAsB,WAAW,UAAU,CAAC;EAKhD,IAAI,WAAW,SAAS,aAAa,iBAAiB;GAErD,MAAM,YAAY,WAAW,MAAM,MAAO,EAAwB,SAAS,WAAW;GACtF,MAAM,WAAW,WAAW,MAAM,MAAO,EAAwB,SAAS,UAAU;GACpF,aAAa;IACZ,GAAI,YAAY,CAAC,SAAS,IAAI,CAAC;IAC/B,GAAG,yBAAyB,eAAe;IAC3C,GAAI,WAAW,CAAC,QAAQ,IAAI,CAAC;GAC9B;EACD;EAEA,OAAO,KAAK;GACX,MAAM,WAAW;GACjB,QAAQ;IAAE,UAAU,SAAS,WAAW,KAAK;IAAG,QAAQ,SAAS,WAAW,KAAK;GAAE;GACnF,QAAQ;IACP,GAAG,kBAAkB,cAAc;IACnC,GAAG;IACH;KACC,MAAM;KACN,MAAM;KACN,OAAO,SAAS,KAAK,gBAAgB;KACrC,QAAQ,gBAAgB,cAAc,WAAW,IAAI;IACtD;GACD;EACD,CAAC;CACF;CAKA,MAAM,gBAAgB,OAAO,MAAM,MAAM,EAAE,SAAS,UAAU;CAC9D,IAAI,eAAe;EAClB,MAAM,iBAAiB,OAAO,QAAQ,MAAM,EAAE,SAAS,UAAU;EACjE,MAAM,YAAY,cAAc;EAChC,MAAM,iBAAiB,UAAU,WAC/B,MAAO,EAAwB,SAAS,aAC1C;EACA,MAAM,iBAAwB;GAC7B,MAAM;GACN,MAAM;GACN,OAAO,SAAS,KAAK,eAAe;GACpC,QAAQ;EACT;EACA,IAAI,kBAAkB,GACrB,UAAU,OAAO,gBAAgB,GAAG,cAAc;OAElD,UAAU,KAAK,cAAc;CAE/B;CAEA,OAAO;AACR"}
@@ -0,0 +1,24 @@
1
+ import { keys } from "../../translations/keys.js";
2
+ import { labelFor } from "../../translations/server.js";
3
+ import { defineFormField } from "../defineFormField.js";
4
+ //#region src/fields/builtin/calculation.ts
5
+ const calculationField = defineFormField({
6
+ type: "calculation",
7
+ label: keys.fieldTypeCalculation,
8
+ value: "number",
9
+ config: [{
10
+ name: "expression",
11
+ type: "json",
12
+ label: labelFor(keys.configExpression)
13
+ }, {
14
+ name: "calcDisplay",
15
+ type: "checkbox",
16
+ defaultValue: true,
17
+ label: labelFor(keys.configCalcDisplay)
18
+ }],
19
+ format: ({ value }) => value == null ? "" : String(value)
20
+ });
21
+ //#endregion
22
+ export { calculationField };
23
+
24
+ //# sourceMappingURL=calculation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculation.js","names":[],"sources":["../../../src/fields/builtin/calculation.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { labelFor } from '../../translations/server'\nimport { defineFormField } from '../defineFormField'\n\nexport const calculationField = defineFormField<'number'>({\n\ttype: 'calculation',\n\tlabel: keys.fieldTypeCalculation,\n\tvalue: 'number',\n\tconfig: [\n\t\t{ name: 'expression', type: 'json', label: labelFor(keys.configExpression) },\n\t\t{\n\t\t\tname: 'calcDisplay',\n\t\t\ttype: 'checkbox',\n\t\t\tdefaultValue: true,\n\t\t\tlabel: labelFor(keys.configCalcDisplay),\n\t\t},\n\t],\n\tformat: ({ value }) => (value == null ? '' : String(value)),\n})\n"],"mappings":";;;;AAIA,MAAa,mBAAmB,gBAA0B;CACzD,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,QAAQ,CACP;EAAE,MAAM;EAAc,MAAM;EAAQ,OAAO,SAAS,KAAK,gBAAgB;CAAE,GAC3E;EACC,MAAM;EACN,MAAM;EACN,cAAc;EACd,OAAO,SAAS,KAAK,iBAAiB;CACvC,CACD;CACA,SAAS,EAAE,YAAa,SAAS,OAAO,KAAK,OAAO,KAAK;AAC1D,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { keys } from "../../translations/keys.js";
2
+ import { defineFormField } from "../defineFormField.js";
3
+ //#region src/fields/builtin/checkbox.ts
4
+ const checkboxField = defineFormField({
5
+ type: "checkbox",
6
+ label: keys.fieldTypeCheckbox,
7
+ value: "boolean",
8
+ format: ({ value, t }) => value ? t(keys.formatYes) : t(keys.formatNo)
9
+ });
10
+ //#endregion
11
+ export { checkboxField };
12
+
13
+ //# sourceMappingURL=checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.js","names":[],"sources":["../../../src/fields/builtin/checkbox.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { defineFormField } from '../defineFormField'\n\nexport const checkboxField = defineFormField<'boolean'>({\n\ttype: 'checkbox',\n\tlabel: keys.fieldTypeCheckbox,\n\tvalue: 'boolean',\n\tformat: ({ value, t }) => (value ? t(keys.formatYes) : t(keys.formatNo)),\n})\n"],"mappings":";;;AAGA,MAAa,gBAAgB,gBAA2B;CACvD,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,SAAS,EAAE,OAAO,QAAS,QAAQ,EAAE,KAAK,SAAS,IAAI,EAAE,KAAK,QAAQ;AACvE,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { keys } from "../../translations/keys.js";
2
+ import { labelFor } from "../../translations/server.js";
3
+ import { defineFormField } from "../defineFormField.js";
4
+ //#region src/fields/builtin/consent.ts
5
+ /**
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`.
9
+ */
10
+ const consentField = defineFormField({
11
+ type: "consent",
12
+ label: keys.fieldTypeConsent,
13
+ value: "boolean",
14
+ config: [{
15
+ name: "statement",
16
+ type: "text",
17
+ label: labelFor(keys.consentConfigStatement)
18
+ }, {
19
+ name: "optional",
20
+ type: "checkbox",
21
+ label: labelFor(keys.consentConfigOptional)
22
+ }],
23
+ validate: ({ value, config, t }) => {
24
+ if (!(config.optional === true) && value !== true) return t(keys.validationRequired);
25
+ return true;
26
+ },
27
+ format: ({ value, t }) => t(value === true ? keys.formatYes : keys.formatNo)
28
+ });
29
+ //#endregion
30
+ export { consentField };
31
+
32
+ //# sourceMappingURL=consent.js.map
@@ -0,0 +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"}
@@ -0,0 +1,18 @@
1
+ import { keys } from "../../translations/keys.js";
2
+ import { defineFormField } from "../defineFormField.js";
3
+ //#region src/fields/builtin/email.ts
4
+ const EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
5
+ const emailField = defineFormField({
6
+ type: "email",
7
+ label: keys.fieldTypeEmail,
8
+ value: "text",
9
+ validate: ({ value, t }) => {
10
+ if (value == null || value === "") return true;
11
+ return EMAIL_PATTERN.test(value) ? true : t(keys.validationEmail);
12
+ },
13
+ format: ({ value }) => value == null ? "" : String(value)
14
+ });
15
+ //#endregion
16
+ export { emailField };
17
+
18
+ //# sourceMappingURL=email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.js","names":[],"sources":["../../../src/fields/builtin/email.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { defineFormField } from '../defineFormField'\n\nconst EMAIL_PATTERN = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/\n\nexport const emailField = defineFormField<'text'>({\n\ttype: 'email',\n\tlabel: keys.fieldTypeEmail,\n\tvalue: 'text',\n\tvalidate: ({ value, t }) => {\n\t\tif (value == null || value === '') {\n\t\t\treturn true\n\t\t}\n\t\treturn EMAIL_PATTERN.test(value) ? true : t(keys.validationEmail)\n\t},\n\tformat: ({ value }) => (value == null ? '' : String(value)),\n})\n"],"mappings":";;;AAGA,MAAM,gBAAgB;AAEtB,MAAa,aAAa,gBAAwB;CACjD,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,WAAW,EAAE,OAAO,QAAQ;EAC3B,IAAI,SAAS,QAAQ,UAAU,IAC9B,OAAO;EAER,OAAO,cAAc,KAAK,KAAK,IAAI,OAAO,EAAE,KAAK,eAAe;CACjE;CACA,SAAS,EAAE,YAAa,SAAS,OAAO,KAAK,OAAO,KAAK;AAC1D,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { keys } from "../../translations/keys.js";
2
+ import { labelFor } from "../../translations/server.js";
3
+ import { defineFormField } from "../defineFormField.js";
4
+ //#region src/fields/builtin/file.ts
5
+ const isFileRef = (value) => typeof value === "object" && value !== null && "filename" in value;
6
+ /**
7
+ * The `file` field type. Its stored value is a server-captured {@link FileRef}; the client only ever submits
8
+ * the upload id, and `runSubmission` re-reads filename/mimeType/filesize from the upload doc at the trust
9
+ * 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.
12
+ */
13
+ const fileField = defineFormField({
14
+ type: "file",
15
+ label: keys.fieldTypeFile,
16
+ value: "file",
17
+ config: [
18
+ {
19
+ name: "relationTo",
20
+ type: "text",
21
+ label: labelFor(keys.fileConfigRelationTo)
22
+ },
23
+ {
24
+ name: "mimeTypes",
25
+ type: "text",
26
+ hasMany: true,
27
+ label: labelFor(keys.fileConfigMimeTypes)
28
+ },
29
+ {
30
+ name: "maxSize",
31
+ type: "number",
32
+ label: labelFor(keys.fileConfigMaxSize)
33
+ }
34
+ ],
35
+ format: ({ value }) => isFileRef(value) ? value.filename : ""
36
+ });
37
+ //#endregion
38
+ export { fileField };
39
+
40
+ //# sourceMappingURL=file.js.map
@@ -0,0 +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"}
@@ -0,0 +1,27 @@
1
+ import { calculationField } from "./calculation.js";
2
+ import { checkboxField } from "./checkbox.js";
3
+ import { consentField } from "./consent.js";
4
+ import { emailField } from "./email.js";
5
+ import { fileField } from "./file.js";
6
+ import { numberField } from "./number.js";
7
+ import { repeaterField } from "./repeater.js";
8
+ import { selectField } from "./select.js";
9
+ import { textField } from "./text.js";
10
+ import { textareaField } from "./textarea.js";
11
+ //#region src/fields/builtin/index.ts
12
+ const defaultFieldDefinitions = [
13
+ textField,
14
+ textareaField,
15
+ emailField,
16
+ numberField,
17
+ selectField,
18
+ checkboxField,
19
+ calculationField,
20
+ consentField,
21
+ fileField,
22
+ repeaterField
23
+ ];
24
+ //#endregion
25
+ export { defaultFieldDefinitions };
26
+
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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"}
@@ -0,0 +1,17 @@
1
+ import { keys } from "../../translations/keys.js";
2
+ import { defineFormField } from "../defineFormField.js";
3
+ //#region src/fields/builtin/number.ts
4
+ const numberField = defineFormField({
5
+ type: "number",
6
+ label: keys.fieldTypeNumber,
7
+ value: "number",
8
+ validate: ({ value, t }) => {
9
+ if (value == null) return true;
10
+ return Number.isFinite(value) ? true : t(keys.validationNumber);
11
+ },
12
+ format: ({ value }) => value == null ? "" : String(value)
13
+ });
14
+ //#endregion
15
+ export { numberField };
16
+
17
+ //# sourceMappingURL=number.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number.js","names":[],"sources":["../../../src/fields/builtin/number.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { defineFormField } from '../defineFormField'\n\nexport const numberField = defineFormField<'number'>({\n\ttype: 'number',\n\tlabel: keys.fieldTypeNumber,\n\tvalue: 'number',\n\tvalidate: ({ value, t }) => {\n\t\tif (value == null) {\n\t\t\treturn true\n\t\t}\n\t\treturn Number.isFinite(value) ? true : t(keys.validationNumber)\n\t},\n\tformat: ({ value }) => (value == null ? '' : String(value)),\n})\n"],"mappings":";;;AAGA,MAAa,cAAc,gBAA0B;CACpD,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,WAAW,EAAE,OAAO,QAAQ;EAC3B,IAAI,SAAS,MACZ,OAAO;EAER,OAAO,OAAO,SAAS,KAAK,IAAI,OAAO,EAAE,KAAK,gBAAgB;CAC/D;CACA,SAAS,EAAE,YAAa,SAAS,OAAO,KAAK,OAAO,KAAK;AAC1D,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { keys } from "../../translations/keys.js";
2
+ import { labelFor } from "../../translations/server.js";
3
+ import { defineFormField } from "../defineFormField.js";
4
+ //#region src/fields/builtin/repeater.ts
5
+ const repeaterField = defineFormField({
6
+ type: "repeater",
7
+ label: keys.fieldTypeRepeater,
8
+ value: "repeater",
9
+ config: [
10
+ {
11
+ name: "minRows",
12
+ type: "number",
13
+ min: 0,
14
+ label: labelFor(keys.configMinRows)
15
+ },
16
+ {
17
+ name: "maxRows",
18
+ type: "number",
19
+ min: 1,
20
+ label: labelFor(keys.configMaxRows)
21
+ },
22
+ {
23
+ name: "addLabel",
24
+ type: "text",
25
+ label: labelFor(keys.configAddLabel)
26
+ }
27
+ ],
28
+ validate: ({ value, config, t }) => {
29
+ const rows = Array.isArray(value) ? value : [];
30
+ const min = typeof config.minRows === "number" ? config.minRows : 0;
31
+ if (rows.length < min) return t(keys.validationRepeaterMin).replace("{min}", String(min));
32
+ const max = typeof config.maxRows === "number" ? config.maxRows : void 0;
33
+ if (max != null && rows.length > max) return t(keys.validationRepeaterMax).replace("{max}", String(max));
34
+ return true;
35
+ },
36
+ format: ({ value, t }) => {
37
+ const count = Array.isArray(value) ? value.length : 0;
38
+ return t(keys.repeaterRowCount).replace("{count}", String(count));
39
+ }
40
+ });
41
+ //#endregion
42
+ export { repeaterField };
43
+
44
+ //# sourceMappingURL=repeater.js.map
@@ -0,0 +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"}
@@ -0,0 +1,44 @@
1
+ import { keys } from "../../translations/keys.js";
2
+ import { labelFor } from "../../translations/server.js";
3
+ import { defineFormField } from "../defineFormField.js";
4
+ //#region src/fields/builtin/select.ts
5
+ const selectField = defineFormField({
6
+ type: "select",
7
+ label: keys.fieldTypeSelect,
8
+ value: "text",
9
+ conditionType: "select",
10
+ config: [{
11
+ name: "options",
12
+ type: "array",
13
+ label: labelFor(keys.configOptions),
14
+ labels: {
15
+ singular: labelFor(keys.configOption),
16
+ plural: labelFor(keys.configOptions)
17
+ },
18
+ fields: [{
19
+ name: "label",
20
+ type: "text",
21
+ required: true,
22
+ label: labelFor(keys.configOptionLabel)
23
+ }, {
24
+ name: "value",
25
+ type: "text",
26
+ required: true,
27
+ label: labelFor(keys.configOptionValue)
28
+ }]
29
+ }],
30
+ validate: ({ value, config, t }) => {
31
+ if (value == null || value === "") return true;
32
+ const options = config.options ?? [];
33
+ if (options.length === 0) return true;
34
+ return options.some((option) => option.value === value) ? true : t(keys.validationSelect);
35
+ },
36
+ format: ({ value, optionLabels }) => {
37
+ if (value == null || value === "") return "";
38
+ return optionLabels?.[value] ?? String(value);
39
+ }
40
+ });
41
+ //#endregion
42
+ export { selectField };
43
+
44
+ //# sourceMappingURL=select.js.map
@@ -0,0 +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"}
@@ -0,0 +1,13 @@
1
+ import { keys } from "../../translations/keys.js";
2
+ import { defineFormField } from "../defineFormField.js";
3
+ //#region src/fields/builtin/text.ts
4
+ const textField = defineFormField({
5
+ type: "text",
6
+ label: keys.fieldTypeText,
7
+ value: "text",
8
+ format: ({ value }) => value == null ? "" : String(value)
9
+ });
10
+ //#endregion
11
+ export { textField };
12
+
13
+ //# sourceMappingURL=text.js.map
@@ -0,0 +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"}
@@ -0,0 +1,13 @@
1
+ import { keys } from "../../translations/keys.js";
2
+ import { defineFormField } from "../defineFormField.js";
3
+ //#region src/fields/builtin/textarea.ts
4
+ const textareaField = defineFormField({
5
+ type: "textarea",
6
+ label: keys.fieldTypeTextarea,
7
+ value: "text",
8
+ format: ({ value }) => value == null ? "" : String(value)
9
+ });
10
+ //#endregion
11
+ export { textareaField };
12
+
13
+ //# sourceMappingURL=textarea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textarea.js","names":[],"sources":["../../../src/fields/builtin/textarea.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { defineFormField } from '../defineFormField'\n\nexport const textareaField = defineFormField<'text'>({\n\ttype: 'textarea',\n\tlabel: keys.fieldTypeTextarea,\n\tvalue: 'text',\n\tformat: ({ value }) => (value == null ? '' : String(value)),\n})\n"],"mappings":";;;AAGA,MAAa,gBAAgB,gBAAwB;CACpD,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,SAAS,EAAE,YAAa,SAAS,OAAO,KAAK,OAAO,KAAK;AAC1D,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { FormFieldConfigValues, FormFieldDefinition, FormFieldValueKind } from "./types.js";
2
+
3
+ //#region src/fields/defineFormField.d.ts
4
+ /**
5
+ * Define a form field type once and get every facet from one object: a Payload `Field[]` for
6
+ * authoring, an isomorphic `validate`, a localized `format`, and a renderer ref. Built-ins use
7
+ * this same primitive, so custom field types are never second-class. The `value` kind drives the
8
+ * typed value threaded into `validate`/`format`; the optional second generic types the config.
9
+ */
10
+ declare const defineFormField: <K extends FormFieldValueKind, TConfig extends FormFieldConfigValues = FormFieldConfigValues>(definition: FormFieldDefinition<K, TConfig>) => FormFieldDefinition<K, TConfig>;
11
+ //#endregion
12
+ export { defineFormField };
13
+ //# sourceMappingURL=defineFormField.d.ts.map
@@ -0,0 +1,12 @@
1
+ //#region src/fields/defineFormField.ts
2
+ /**
3
+ * Define a form field type once and get every facet from one object: a Payload `Field[]` for
4
+ * authoring, an isomorphic `validate`, a localized `format`, and a renderer ref. Built-ins use
5
+ * this same primitive, so custom field types are never second-class. The `value` kind drives the
6
+ * typed value threaded into `validate`/`format`; the optional second generic types the config.
7
+ */
8
+ const defineFormField = (definition) => definition;
9
+ //#endregion
10
+ export { defineFormField };
11
+
12
+ //# sourceMappingURL=defineFormField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineFormField.js","names":[],"sources":["../../src/fields/defineFormField.ts"],"sourcesContent":["import type { FormFieldConfigValues, FormFieldDefinition, FormFieldValueKind } from './types'\n\n/**\n * Define a form field type once and get every facet from one object: a Payload `Field[]` for\n * authoring, an isomorphic `validate`, a localized `format`, and a renderer ref. Built-ins use\n * this same primitive, so custom field types are never second-class. The `value` kind drives the\n * typed value threaded into `validate`/`format`; the optional second generic types the config.\n */\nexport const defineFormField = <\n\tK extends FormFieldValueKind,\n\tTConfig extends FormFieldConfigValues = FormFieldConfigValues,\n>(\n\tdefinition: FormFieldDefinition<K, TConfig>\n): FormFieldDefinition<K, TConfig> => definition\n"],"mappings":";;;;;;;AAQA,MAAa,mBAIZ,eACqC"}
@@ -0,0 +1,10 @@
1
+ import { AnyFormFieldDefinition } from "./types.js";
2
+
3
+ //#region src/fields/registry.d.ts
4
+ type FieldTypeRegistry = Map<string, AnyFormFieldDefinition>;
5
+ /** Per-type opt-in: `false` removes a built-in, `true` keeps it, an object adds a new type or replaces one. */
6
+ type FieldTypeOption = boolean | AnyFormFieldDefinition;
7
+ type FieldTypesConfig = Record<string, FieldTypeOption>;
8
+ //#endregion
9
+ export { FieldTypeOption, FieldTypeRegistry, FieldTypesConfig };
10
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1,24 @@
1
+ //#region src/fields/registry.ts
2
+ const buildRegistry = (definitions) => {
3
+ const registry = /* @__PURE__ */ new Map();
4
+ for (const definition of definitions) registry.set(definition.type, definition);
5
+ return registry;
6
+ };
7
+ /**
8
+ * Resolve the active field-type registry from the built-in defaults and the plugin `fields` option.
9
+ * `false` removes a type, `true` keeps the default, an object adds a new type or replaces an existing
10
+ * one (its `type` is forced to the config key so an override cannot rename the slot).
11
+ */
12
+ const resolveFieldTypes = (defaults, config = {}) => {
13
+ const registry = buildRegistry(defaults);
14
+ for (const [type, option] of Object.entries(config)) if (option === false) registry.delete(type);
15
+ else if (option === true) {} else registry.set(type, {
16
+ ...option,
17
+ type
18
+ });
19
+ return registry;
20
+ };
21
+ //#endregion
22
+ export { buildRegistry, resolveFieldTypes };
23
+
24
+ //# sourceMappingURL=registry.js.map