@verbb/formie-browser 1.0.1 → 1.0.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 (346) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/chunks/address-finder-CQW81kY0.js +37 -0
  3. package/dist/chunks/bpoint-D8OjLmsn.js +26 -0
  4. package/dist/chunks/calculations-BqZsENCq.js +147 -0
  5. package/dist/chunks/captcha-eu-DIa6aUWz.js +34 -0
  6. package/dist/chunks/checkbox-radio-BI-UjgMF.js +136 -0
  7. package/dist/chunks/conditions-BVl6jTYo.js +433 -0
  8. package/dist/chunks/date-picker-69TgvErA.js +4994 -0
  9. package/dist/chunks/eway-1GPxH6DU.js +74 -0
  10. package/dist/chunks/file-upload-BDZZftgL.js +281 -0
  11. package/dist/chunks/friendly-captcha-v1-DA2QPKA3.js +33 -0
  12. package/dist/chunks/friendly-captcha-v2-BorOWiz_.js +38 -0
  13. package/dist/chunks/go-cardless-DwBgERcA.js +24 -0
  14. package/dist/chunks/google-address-BcTBncyS.js +162 -0
  15. package/dist/chunks/hcaptcha-BchdVCqq.js +56 -0
  16. package/dist/chunks/hidden-D8RqSPt7.js +31 -0
  17. package/dist/chunks/index-BEsfee-D.js +1839 -0
  18. package/dist/chunks/index-BP7Unm5Y.js +863 -0
  19. package/dist/chunks/index-C1ZOKiAi.js +4229 -0
  20. package/dist/chunks/loqate-nXuTX7In.js +55 -0
  21. package/dist/chunks/mollie-qdCynQCd.js +24 -0
  22. package/dist/chunks/moneris-BNEA-laO.js +101 -0
  23. package/dist/chunks/opayo-BJtXOkuK.js +122 -0
  24. package/dist/chunks/paddle-D72Pa8kr.js +60 -0
  25. package/dist/chunks/paypal-Cqt2bned.js +100 -0
  26. package/dist/chunks/payway-BjCqsc0H.js +56 -0
  27. package/dist/chunks/phone-country-K9pYAlzM.js +3765 -0
  28. package/dist/chunks/place-kit-Dg6f_UoM.js +42 -0
  29. package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +1299 -0
  30. package/dist/chunks/recaptcha-enterprise--VYAeeqz.js +71 -0
  31. package/dist/chunks/recaptcha-shared-PSIEEEe1.js +15 -0
  32. package/dist/chunks/recaptcha-v2-checkbox-atBNe5ml.js +41 -0
  33. package/dist/chunks/recaptcha-v2-invisible-DnBufNPT.js +59 -0
  34. package/dist/chunks/recaptcha-v3-CF6O8rDj.js +28 -0
  35. package/dist/chunks/repeater-CB7Yojvx.js +124 -0
  36. package/dist/chunks/rich-text-nAV_SQZo.js +304 -0
  37. package/dist/chunks/scripts-BkAAux0i.js +36 -0
  38. package/dist/chunks/sdk-3SicTWby.js +1559 -0
  39. package/dist/chunks/shared-DGqeMvcJ.js +80 -0
  40. package/dist/chunks/signature-BT6CsQ6n.js +550 -0
  41. package/dist/chunks/snaptcha-C7qQo02f.js +8 -0
  42. package/dist/chunks/square-C5AH3trb.js +46 -0
  43. package/dist/chunks/stripe-EJK0RyUv.js +202 -0
  44. package/dist/chunks/styles-C3aqgtek.js +21 -0
  45. package/dist/chunks/summary-DC_ipXCU.js +126 -0
  46. package/dist/chunks/table-BEAI99qo.js +95 -0
  47. package/dist/chunks/text-limit-Blgq5G-G.js +135 -0
  48. package/dist/chunks/turnstile-_uCRwnU-.js +59 -0
  49. package/dist/chunks/utils-BntI3W4S.js +6149 -0
  50. package/dist/index.d.ts +30 -0
  51. package/dist/index.d.ts.map +1 -0
  52. package/dist/index.js +39 -3205
  53. package/dist/js/compatibility/dom-adapter.d.ts +12 -0
  54. package/dist/js/compatibility/dom-adapter.d.ts.map +1 -0
  55. package/dist/js/compatibility/event-map.d.ts +25 -0
  56. package/dist/js/compatibility/event-map.d.ts.map +1 -0
  57. package/dist/js/compatibility/validator-adapter.d.ts +17 -0
  58. package/dist/js/compatibility/validator-adapter.d.ts.map +1 -0
  59. package/dist/js/contracts/client.d.ts +40 -0
  60. package/dist/js/contracts/client.d.ts.map +1 -0
  61. package/dist/js/contracts/common.d.ts +5 -0
  62. package/dist/js/contracts/common.d.ts.map +1 -0
  63. package/dist/js/contracts/modules.d.ts +47 -0
  64. package/dist/js/contracts/modules.d.ts.map +1 -0
  65. package/dist/js/contracts/schema.d.ts +79 -0
  66. package/dist/js/contracts/schema.d.ts.map +1 -0
  67. package/dist/js/contracts/theme.d.ts +2 -0
  68. package/dist/js/contracts/theme.d.ts.map +1 -0
  69. package/dist/js/core/create-formie-client.d.ts +3 -0
  70. package/dist/js/core/create-formie-client.d.ts.map +1 -0
  71. package/dist/js/core/dom-events.d.ts +2 -0
  72. package/dist/js/core/dom-events.d.ts.map +1 -0
  73. package/dist/js/core/formie.d.ts +27 -0
  74. package/dist/js/core/formie.d.ts.map +1 -0
  75. package/dist/js/core/hydrate-modules.d.ts +22 -0
  76. package/dist/js/core/hydrate-modules.d.ts.map +1 -0
  77. package/dist/js/core/page-client-event.d.ts +9 -0
  78. package/dist/js/core/page-client-event.d.ts.map +1 -0
  79. package/dist/js/core/page-tab-errors.d.ts +2 -0
  80. package/dist/js/core/page-tab-errors.d.ts.map +1 -0
  81. package/dist/js/core/submit-flow.d.ts +21 -0
  82. package/dist/js/core/submit-flow.d.ts.map +1 -0
  83. package/dist/js/core/submit-result-state.d.ts +8 -0
  84. package/dist/js/core/submit-result-state.d.ts.map +1 -0
  85. package/dist/js/core/submit-result-ui.d.ts +10 -0
  86. package/dist/js/core/submit-result-ui.d.ts.map +1 -0
  87. package/dist/js/events/event-bus.d.ts +21 -0
  88. package/dist/js/events/event-bus.d.ts.map +1 -0
  89. package/dist/js/modules/address/address-finder.d.ts +2 -0
  90. package/dist/js/modules/address/address-finder.d.ts.map +1 -0
  91. package/dist/js/modules/address/api.d.ts +8 -0
  92. package/dist/js/modules/address/api.d.ts.map +1 -0
  93. package/dist/js/modules/address/constants.d.ts +15 -0
  94. package/dist/js/modules/address/constants.d.ts.map +1 -0
  95. package/dist/js/modules/address/factories.d.ts +35 -0
  96. package/dist/js/modules/address/factories.d.ts.map +1 -0
  97. package/dist/js/modules/address/google-address.d.ts +2 -0
  98. package/dist/js/modules/address/google-address.d.ts.map +1 -0
  99. package/dist/js/modules/address/host.d.ts +30 -0
  100. package/dist/js/modules/address/host.d.ts.map +1 -0
  101. package/dist/js/modules/address/index.d.ts +3 -0
  102. package/dist/js/modules/address/index.d.ts.map +1 -0
  103. package/dist/js/modules/address/loqate.d.ts +2 -0
  104. package/dist/js/modules/address/loqate.d.ts.map +1 -0
  105. package/dist/js/modules/address/place-kit.d.ts +2 -0
  106. package/dist/js/modules/address/place-kit.d.ts.map +1 -0
  107. package/dist/js/modules/captchas/api.d.ts +9 -0
  108. package/dist/js/modules/captchas/api.d.ts.map +1 -0
  109. package/dist/js/modules/captchas/captcha-eu.d.ts +2 -0
  110. package/dist/js/modules/captchas/captcha-eu.d.ts.map +1 -0
  111. package/dist/js/modules/captchas/constants.d.ts +5 -0
  112. package/dist/js/modules/captchas/constants.d.ts.map +1 -0
  113. package/dist/js/modules/captchas/factories.d.ts +63 -0
  114. package/dist/js/modules/captchas/factories.d.ts.map +1 -0
  115. package/dist/js/modules/captchas/friendly-captcha-v1.d.ts +2 -0
  116. package/dist/js/modules/captchas/friendly-captcha-v1.d.ts.map +1 -0
  117. package/dist/js/modules/captchas/friendly-captcha-v2.d.ts +2 -0
  118. package/dist/js/modules/captchas/friendly-captcha-v2.d.ts.map +1 -0
  119. package/dist/js/modules/captchas/hcaptcha.d.ts +2 -0
  120. package/dist/js/modules/captchas/hcaptcha.d.ts.map +1 -0
  121. package/dist/js/modules/captchas/host.d.ts +78 -0
  122. package/dist/js/modules/captchas/host.d.ts.map +1 -0
  123. package/dist/js/modules/captchas/index.d.ts +3 -0
  124. package/dist/js/modules/captchas/index.d.ts.map +1 -0
  125. package/dist/js/modules/captchas/recaptcha-enterprise.d.ts +2 -0
  126. package/dist/js/modules/captchas/recaptcha-enterprise.d.ts.map +1 -0
  127. package/dist/js/modules/captchas/recaptcha-shared.d.ts +26 -0
  128. package/dist/js/modules/captchas/recaptcha-shared.d.ts.map +1 -0
  129. package/dist/js/modules/captchas/recaptcha-v2-checkbox.d.ts +2 -0
  130. package/dist/js/modules/captchas/recaptcha-v2-checkbox.d.ts.map +1 -0
  131. package/dist/js/modules/captchas/recaptcha-v2-invisible.d.ts +2 -0
  132. package/dist/js/modules/captchas/recaptcha-v2-invisible.d.ts.map +1 -0
  133. package/dist/js/modules/captchas/recaptcha-v3.d.ts +2 -0
  134. package/dist/js/modules/captchas/recaptcha-v3.d.ts.map +1 -0
  135. package/dist/js/modules/captchas/snaptcha.d.ts +2 -0
  136. package/dist/js/modules/captchas/snaptcha.d.ts.map +1 -0
  137. package/dist/js/modules/captchas/turnstile.d.ts +2 -0
  138. package/dist/js/modules/captchas/turnstile.d.ts.map +1 -0
  139. package/dist/js/modules/captchas/utils.d.ts +13 -0
  140. package/dist/js/modules/captchas/utils.d.ts.map +1 -0
  141. package/dist/js/modules/fields/calculations.d.ts +3 -0
  142. package/dist/js/modules/fields/calculations.d.ts.map +1 -0
  143. package/dist/js/modules/fields/checkbox-radio.d.ts +3 -0
  144. package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -0
  145. package/dist/js/modules/fields/conditions/config.d.ts +5 -0
  146. package/dist/js/modules/fields/conditions/config.d.ts.map +1 -0
  147. package/dist/js/modules/fields/conditions/effects.d.ts +2 -0
  148. package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -0
  149. package/dist/js/modules/fields/conditions/evaluator.d.ts +6 -0
  150. package/dist/js/modules/fields/conditions/evaluator.d.ts.map +1 -0
  151. package/dist/js/modules/fields/conditions/references.d.ts +5 -0
  152. package/dist/js/modules/fields/conditions/references.d.ts.map +1 -0
  153. package/dist/js/modules/fields/conditions/transforms.d.ts +3 -0
  154. package/dist/js/modules/fields/conditions/transforms.d.ts.map +1 -0
  155. package/dist/js/modules/fields/conditions/types.d.ts +30 -0
  156. package/dist/js/modules/fields/conditions/types.d.ts.map +1 -0
  157. package/dist/js/modules/fields/conditions/values.d.ts +5 -0
  158. package/dist/js/modules/fields/conditions/values.d.ts.map +1 -0
  159. package/dist/js/modules/fields/conditions.d.ts +3 -0
  160. package/dist/js/modules/fields/conditions.d.ts.map +1 -0
  161. package/dist/js/modules/fields/date-picker.d.ts +3 -0
  162. package/dist/js/modules/fields/date-picker.d.ts.map +1 -0
  163. package/dist/js/modules/fields/file-upload.d.ts +3 -0
  164. package/dist/js/modules/fields/file-upload.d.ts.map +1 -0
  165. package/dist/js/modules/fields/hidden.d.ts +3 -0
  166. package/dist/js/modules/fields/hidden.d.ts.map +1 -0
  167. package/dist/js/modules/fields/index.d.ts +3 -0
  168. package/dist/js/modules/fields/index.d.ts.map +1 -0
  169. package/dist/js/modules/fields/phone-country.d.ts +3 -0
  170. package/dist/js/modules/fields/phone-country.d.ts.map +1 -0
  171. package/dist/js/modules/fields/repeater.d.ts +3 -0
  172. package/dist/js/modules/fields/repeater.d.ts.map +1 -0
  173. package/dist/js/modules/fields/rich-text.d.ts +3 -0
  174. package/dist/js/modules/fields/rich-text.d.ts.map +1 -0
  175. package/dist/js/modules/fields/shared.d.ts +20 -0
  176. package/dist/js/modules/fields/shared.d.ts.map +1 -0
  177. package/dist/js/modules/fields/signature.d.ts +3 -0
  178. package/dist/js/modules/fields/signature.d.ts.map +1 -0
  179. package/dist/js/modules/fields/summary.d.ts +3 -0
  180. package/dist/js/modules/fields/summary.d.ts.map +1 -0
  181. package/dist/js/modules/fields/table.d.ts +3 -0
  182. package/dist/js/modules/fields/table.d.ts.map +1 -0
  183. package/dist/js/modules/fields/text-limit.d.ts +3 -0
  184. package/dist/js/modules/fields/text-limit.d.ts.map +1 -0
  185. package/dist/js/modules/loader.d.ts +11 -0
  186. package/dist/js/modules/loader.d.ts.map +1 -0
  187. package/dist/js/modules/payments/api.d.ts +8 -0
  188. package/dist/js/modules/payments/api.d.ts.map +1 -0
  189. package/dist/js/modules/payments/bpoint.d.ts +2 -0
  190. package/dist/js/modules/payments/bpoint.d.ts.map +1 -0
  191. package/dist/js/modules/payments/constants.d.ts +5 -0
  192. package/dist/js/modules/payments/constants.d.ts.map +1 -0
  193. package/dist/js/modules/payments/eway.d.ts +9 -0
  194. package/dist/js/modules/payments/eway.d.ts.map +1 -0
  195. package/dist/js/modules/payments/factories.d.ts +54 -0
  196. package/dist/js/modules/payments/factories.d.ts.map +1 -0
  197. package/dist/js/modules/payments/go-cardless.d.ts +2 -0
  198. package/dist/js/modules/payments/go-cardless.d.ts.map +1 -0
  199. package/dist/js/modules/payments/host.d.ts +70 -0
  200. package/dist/js/modules/payments/host.d.ts.map +1 -0
  201. package/dist/js/modules/payments/index.d.ts +3 -0
  202. package/dist/js/modules/payments/index.d.ts.map +1 -0
  203. package/dist/js/modules/payments/mollie.d.ts +2 -0
  204. package/dist/js/modules/payments/mollie.d.ts.map +1 -0
  205. package/dist/js/modules/payments/moneris.d.ts +2 -0
  206. package/dist/js/modules/payments/moneris.d.ts.map +1 -0
  207. package/dist/js/modules/payments/opayo.d.ts +25 -0
  208. package/dist/js/modules/payments/opayo.d.ts.map +1 -0
  209. package/dist/js/modules/payments/paddle.d.ts +2 -0
  210. package/dist/js/modules/payments/paddle.d.ts.map +1 -0
  211. package/dist/js/modules/payments/paypal.d.ts +2 -0
  212. package/dist/js/modules/payments/paypal.d.ts.map +1 -0
  213. package/dist/js/modules/payments/payway.d.ts +2 -0
  214. package/dist/js/modules/payments/payway.d.ts.map +1 -0
  215. package/dist/js/modules/payments/square.d.ts +2 -0
  216. package/dist/js/modules/payments/square.d.ts.map +1 -0
  217. package/dist/js/modules/payments/stripe.d.ts +2 -0
  218. package/dist/js/modules/payments/stripe.d.ts.map +1 -0
  219. package/dist/js/modules/payments/utils.d.ts +17 -0
  220. package/dist/js/modules/payments/utils.d.ts.map +1 -0
  221. package/dist/js/modules/registry.d.ts +9 -0
  222. package/dist/js/modules/registry.d.ts.map +1 -0
  223. package/dist/js/modules/styles.d.ts +2 -0
  224. package/dist/js/modules/styles.d.ts.map +1 -0
  225. package/dist/js/submit/pipeline.d.ts +18 -0
  226. package/dist/js/submit/pipeline.d.ts.map +1 -0
  227. package/dist/js/theme/theme-classes.d.ts +10 -0
  228. package/dist/js/theme/theme-classes.d.ts.map +1 -0
  229. package/dist/js/transport/forms-api.d.ts +11 -0
  230. package/dist/js/transport/forms-api.d.ts.map +1 -0
  231. package/dist/js/utils/async.d.ts +8 -0
  232. package/dist/js/utils/async.d.ts.map +1 -0
  233. package/dist/js/utils/debug.d.ts +10 -0
  234. package/dist/js/utils/debug.d.ts.map +1 -0
  235. package/dist/js/utils/event-names.d.ts +13 -0
  236. package/dist/js/utils/event-names.d.ts.map +1 -0
  237. package/dist/js/utils/field-references.d.ts +6 -0
  238. package/dist/js/utils/field-references.d.ts.map +1 -0
  239. package/dist/js/utils/field-references.keys.d.ts +4 -0
  240. package/dist/js/utils/field-references.keys.d.ts.map +1 -0
  241. package/dist/js/utils/field-references.parser.d.ts +3 -0
  242. package/dist/js/utils/field-references.parser.d.ts.map +1 -0
  243. package/dist/js/utils/field-references.registry.d.ts +3 -0
  244. package/dist/js/utils/field-references.registry.d.ts.map +1 -0
  245. package/dist/js/utils/field-references.resolver.d.ts +4 -0
  246. package/dist/js/utils/field-references.resolver.d.ts.map +1 -0
  247. package/dist/js/utils/field-references.types.d.ts +27 -0
  248. package/dist/js/utils/field-references.types.d.ts.map +1 -0
  249. package/dist/js/utils/fields.d.ts +5 -0
  250. package/dist/js/utils/fields.d.ts.map +1 -0
  251. package/dist/js/utils/http.d.ts +9 -0
  252. package/dist/js/utils/http.d.ts.map +1 -0
  253. package/dist/js/utils/i18n.d.ts +7 -0
  254. package/dist/js/utils/i18n.d.ts.map +1 -0
  255. package/dist/js/utils/scripts.d.ts +13 -0
  256. package/dist/js/utils/scripts.d.ts.map +1 -0
  257. package/dist/js/utils/unload-warning.d.ts +10 -0
  258. package/dist/js/utils/unload-warning.d.ts.map +1 -0
  259. package/dist/js/validation/rules/email.d.ts +4 -0
  260. package/dist/js/validation/rules/email.d.ts.map +1 -0
  261. package/dist/js/validation/rules/match.d.ts +4 -0
  262. package/dist/js/validation/rules/match.d.ts.map +1 -0
  263. package/dist/js/validation/rules/number.d.ts +4 -0
  264. package/dist/js/validation/rules/number.d.ts.map +1 -0
  265. package/dist/js/validation/rules/required.d.ts +4 -0
  266. package/dist/js/validation/rules/required.d.ts.map +1 -0
  267. package/dist/js/validation/rules/shared.d.ts +7 -0
  268. package/dist/js/validation/rules/shared.d.ts.map +1 -0
  269. package/dist/js/validation/rules/url.d.ts +4 -0
  270. package/dist/js/validation/rules/url.d.ts.map +1 -0
  271. package/dist/js/validation/rules.d.ts +10 -0
  272. package/dist/js/validation/rules.d.ts.map +1 -0
  273. package/dist/js/validation/types.d.ts +44 -0
  274. package/dist/js/validation/types.d.ts.map +1 -0
  275. package/dist/js/validation/validator.d.ts +53 -0
  276. package/dist/js/validation/validator.d.ts.map +1 -0
  277. package/package.json +3 -2
  278. package/src/js/modules/fields/file-upload.ts +1 -1
  279. package/src/js/modules/fields/repeater.ts +1 -1
  280. package/src/js/modules/fields/rich-text.ts +2 -2
  281. package/src/js/modules/fields/signature.ts +1 -1
  282. package/src/js/modules/fields/summary.ts +1 -1
  283. package/src/js/modules/fields/table.ts +1 -1
  284. package/src/js/modules/fields/text-limit.ts +1 -1
  285. package/src/js/modules/payments/paypal.ts +1 -1
  286. package/src/js/modules/payments/payway.ts +1 -1
  287. package/src/js/modules/payments/stripe.ts +1 -1
  288. package/dist/chunks/address-finder-DfMCiW89.js +0 -47
  289. package/dist/chunks/api-CbqEMQT5.js +0 -181
  290. package/dist/chunks/api-DE7LfK-R.js +0 -960
  291. package/dist/chunks/api-DOfDzYC_.js +0 -538
  292. package/dist/chunks/async-B3DUf1GZ.js +0 -26
  293. package/dist/chunks/bpoint-Ciy3yY9Q.js +0 -34
  294. package/dist/chunks/calculations-CkYAqO_-.js +0 -197
  295. package/dist/chunks/captcha-eu-DnOWhMwr.js +0 -43
  296. package/dist/chunks/checkbox-radio-0x7Tc0br.js +0 -197
  297. package/dist/chunks/chunk-K6L4z4UQ.js +0 -24
  298. package/dist/chunks/conditions-4fXKhEJS.js +0 -609
  299. package/dist/chunks/date-picker-B6iZkjHS.js +0 -6204
  300. package/dist/chunks/debug-KnZeKYBI.js +0 -39
  301. package/dist/chunks/dist-D09GnXMW.js +0 -2663
  302. package/dist/chunks/event-names-DamGPtXR.js +0 -51
  303. package/dist/chunks/eway-DEAYcwT0.js +0 -86
  304. package/dist/chunks/field-references.keys-BpBZ_quS.js +0 -24
  305. package/dist/chunks/field-references.resolver-Ba6xhiJC.js +0 -183
  306. package/dist/chunks/file-upload-BIj85NFH.js +0 -428
  307. package/dist/chunks/friendly-captcha-v1-CqO4WVre.js +0 -40
  308. package/dist/chunks/friendly-captcha-v2-CyykcJcM.js +0 -47
  309. package/dist/chunks/friendly-challenge-Dg8XkStd.js +0 -1101
  310. package/dist/chunks/go-cardless-CuND59rR.js +0 -26
  311. package/dist/chunks/google-address--uR8WDSm.js +0 -208
  312. package/dist/chunks/hcaptcha-CmaFUesv.js +0 -72
  313. package/dist/chunks/hidden-CYnZYple.js +0 -36
  314. package/dist/chunks/http-18nn97DZ.js +0 -29
  315. package/dist/chunks/i18n-vUh-KGiH.js +0 -55
  316. package/dist/chunks/loqate-BICNJlVK.js +0 -97
  317. package/dist/chunks/mollie-DwlsgHZ1.js +0 -26
  318. package/dist/chunks/moneris-B_IFZFTx.js +0 -159
  319. package/dist/chunks/opayo-U2x_TOII.js +0 -192
  320. package/dist/chunks/paddle-BqXFrc79.js +0 -75
  321. package/dist/chunks/paypal-VowQ3ilP.js +0 -121
  322. package/dist/chunks/payway-VOO-ajyg.js +0 -75
  323. package/dist/chunks/phone-country-B6Me4lK0.js +0 -3317
  324. package/dist/chunks/place-kit-ldUl-u9w.js +0 -56
  325. package/dist/chunks/placekit-autocomplete.esm-D-lGeaZl.js +0 -1771
  326. package/dist/chunks/recaptcha-enterprise-DPJNyv1X.js +0 -72
  327. package/dist/chunks/recaptcha-shared-DTI4qWVR.js +0 -22
  328. package/dist/chunks/recaptcha-v2-checkbox-zFjpvJ5c.js +0 -49
  329. package/dist/chunks/recaptcha-v2-invisible-CnYtkNvz.js +0 -62
  330. package/dist/chunks/recaptcha-v3-EAlWhnkX.js +0 -33
  331. package/dist/chunks/repeater-BPm7Mkyn.js +0 -149
  332. package/dist/chunks/rich-text-CHSly1Hq.js +0 -438
  333. package/dist/chunks/scripts-BGD_iU_6.js +0 -41
  334. package/dist/chunks/sdk-B7u9fTlP.js +0 -2103
  335. package/dist/chunks/shared-DC6_1u8X.js +0 -85
  336. package/dist/chunks/signature-DNMCgrMd.js +0 -763
  337. package/dist/chunks/snaptcha-CCDunGeb.js +0 -8
  338. package/dist/chunks/square-BLqK51rS.js +0 -61
  339. package/dist/chunks/stripe-B6ZcDQdx.js +0 -273
  340. package/dist/chunks/styles-BIh6g7V_.js +0 -22
  341. package/dist/chunks/summary-BTG0uIOt.js +0 -189
  342. package/dist/chunks/table-BTYc0Qm8.js +0 -122
  343. package/dist/chunks/text-limit-CgBMu4sJ.js +0 -177
  344. package/dist/chunks/theme-classes-vSHpdCUO.js +0 -59
  345. package/dist/chunks/turnstile-DP0bdR7T.js +0 -68
  346. package/dist/chunks/utils-ByrEVYrJ.js +0 -49584
@@ -1,8 +0,0 @@
1
- import { n as definePassiveCaptchaModule } from "./api-DOfDzYC_.js";
2
- //#region src/js/modules/captchas/snaptcha.ts
3
- var snaptchaModule = definePassiveCaptchaModule({
4
- id: "snaptcha",
5
- defaultPlaceholderSelector: "[data-snaptcha-captcha-placeholder]"
6
- });
7
- //#endregion
8
- export { snaptchaModule };
@@ -1,61 +0,0 @@
1
- import { t as definePaymentModule } from "./api-DE7LfK-R.js";
2
- import { r as loadScriptAndEnsureGlobal } from "./scripts-BGD_iU_6.js";
3
- //#region src/js/modules/payments/square.ts
4
- var SCRIPT_ID = "FORMIE_SQUARE_SCRIPT";
5
- var squareModule = definePaymentModule({
6
- id: "square",
7
- defaultRequiredInputSuffixes: ["squarePaymentId"],
8
- load: async (ctx) => {
9
- const { provider } = ctx.options;
10
- const applicationId = provider.applicationId;
11
- const locationId = provider.locationId;
12
- if (!applicationId?.trim() || !locationId?.trim()) {
13
- console.error("[formie] Missing applicationId or locationId for Square.");
14
- return null;
15
- }
16
- await loadScriptAndEnsureGlobal("Square", {
17
- id: SCRIPT_ID,
18
- src: provider.environment === "sandbox" ? "https://sandbox.web.squarecdn.com/v1/square.js" : "https://web.squarecdn.com/v1/square.js"
19
- });
20
- return window.Square;
21
- },
22
- mount: async (args) => {
23
- const { api, field, services, options } = args;
24
- const provider = options.provider;
25
- const placeholder = field.querySelector("[data-formie-square-button]");
26
- if (!placeholder || !api) return null;
27
- try {
28
- const card = await api.payments(provider.applicationId || "", provider.locationId || "").card();
29
- await card.attach(placeholder);
30
- return card;
31
- } catch (error) {
32
- services.addError(error instanceof Error ? error.message : "Unable to initialize payment.");
33
- return null;
34
- }
35
- },
36
- unmount: async () => {},
37
- onBeforeAuthorize: async (args) => {
38
- const { widget, services } = args;
39
- if (!widget) {
40
- services.addError("Square card is not ready.");
41
- return false;
42
- }
43
- try {
44
- const result = await widget.tokenize();
45
- if (result.status === "OK" && result.token) {
46
- services.updateInputs("squarePaymentId", result.token);
47
- return true;
48
- }
49
- services.addError(result.errors?.[0]?.message || "Tokenization failed.");
50
- return false;
51
- } catch {
52
- services.addError("Payment tokenization failed. Please try again.");
53
- return false;
54
- }
55
- },
56
- onAfterSubmit: async ({ services }) => {
57
- services.updateInputs("squarePaymentId", "");
58
- }
59
- });
60
- //#endregion
61
- export { squareModule };
@@ -1,273 +0,0 @@
1
- import { s as getPaymentProviderActionEventName } from "./event-names-DamGPtXR.js";
2
- import { t as definePaymentModule } from "./api-DE7LfK-R.js";
3
- import { r as removeThemeClasses, t as addThemeClasses } from "./theme-classes-vSHpdCUO.js";
4
- import { r as loadScriptAndEnsureGlobal } from "./scripts-BGD_iU_6.js";
5
- import { t as ensureModuleStyles } from "./styles-BIh6g7V_.js";
6
- import stripeCss from "#theme/integrations/_stripe.css?inline";
7
- //#region src/js/modules/payments/stripe.ts
8
- ensureModuleStyles("stripe", [stripeCss]);
9
- var SCRIPT_ID = "FORMIE_STRIPE_SCRIPT";
10
- var CONFIRM_EVENT = getPaymentProviderActionEventName("stripe", "confirm");
11
- var PLACEHOLDER_SELECTOR = "[data-formie-stripe-elements-placeholder]";
12
- var ZERO_DECIMAL_CURRENCIES = new Set([
13
- "BIF",
14
- "CLP",
15
- "DJF",
16
- "GNF",
17
- "JPY",
18
- "KMF",
19
- "KRW",
20
- "MGA",
21
- "PYG",
22
- "RWF",
23
- "UGX",
24
- "VND",
25
- "VUV",
26
- "XAF",
27
- "XOF",
28
- "XPF"
29
- ]);
30
- function toStripeSubunitAmount(amount, currency) {
31
- if (ZERO_DECIMAL_CURRENCIES.has(currency.toUpperCase())) return Math.ceil(amount);
32
- return Math.ceil(amount * 100);
33
- }
34
- function clearPlaceholderError(placeholder, themeSource) {
35
- if (!placeholder) return;
36
- removeThemeClasses(placeholder, themeSource, "fieldErrors", "fieldError");
37
- placeholder.querySelectorAll("[data-payment-placeholder-error]").forEach((el) => {
38
- removeThemeClasses(el, themeSource, "fieldError");
39
- });
40
- }
41
- function renderPlaceholderLoading(placeholder, themeSource, message = "Loading payment options...") {
42
- if (!placeholder) return;
43
- clearPlaceholderError(placeholder, themeSource);
44
- placeholder.removeAttribute("hidden");
45
- placeholder.innerHTML = "";
46
- const spinner = document.createElement("div");
47
- spinner.className = "formie-loading";
48
- const text = document.createElement("div");
49
- text.textContent = message;
50
- placeholder.append(spinner, text);
51
- }
52
- function showPlaceholderMessage(placeholder, themeSource, message) {
53
- if (!placeholder) return;
54
- clearPlaceholderError(placeholder, themeSource);
55
- placeholder.removeAttribute("hidden");
56
- addThemeClasses(placeholder, themeSource, "fieldErrors");
57
- placeholder.innerHTML = "";
58
- const error = document.createElement("div");
59
- error.setAttribute("data-payment-placeholder-error", "");
60
- error.textContent = message;
61
- addThemeClasses(error, themeSource, "fieldError");
62
- placeholder.appendChild(error);
63
- }
64
- var stripeModule = definePaymentModule({
65
- id: "stripe",
66
- defaultRequiredInputSuffixes: ["stripePaymentIntentId"],
67
- load: async (ctx) => {
68
- const { provider } = ctx.options;
69
- const publishableKey = provider.publishableKey;
70
- if (!publishableKey?.trim()) {
71
- console.error("[formie] Missing publishableKey for Stripe.");
72
- return null;
73
- }
74
- return (await loadScriptAndEnsureGlobal("Stripe", {
75
- id: SCRIPT_ID,
76
- src: "https://js.stripe.com/v3"
77
- }))(publishableKey);
78
- },
79
- mount: async (args) => {
80
- const { api, field, services, provider } = args;
81
- const placeholder = field.querySelector("[data-formie-stripe-elements]");
82
- const loadingPlaceholder = field.querySelector(PLACEHOLDER_SELECTOR);
83
- const stripeField = field;
84
- const themeSource = services.form || services.root;
85
- if (!placeholder || !api) return null;
86
- const initial = provider.initialPaymentInformation || {};
87
- const dynamicHandles = [initial.amount, initial.currency].map((value) => String(value ?? "").trim()).filter((value, index) => {
88
- return (index === 0 ? provider.amountType : provider.currencyType) === "dynamic" && value !== "";
89
- });
90
- const getResolvedPaymentInfo = () => {
91
- const amountResult = services.resolveAmount({ value: initial.amount });
92
- if (!amountResult.ok) return {
93
- ok: false,
94
- error: "error" in amountResult ? amountResult.error : "Provide a payment amount to proceed."
95
- };
96
- const currencyResult = services.resolveCurrency({ value: initial.currency });
97
- if (!currencyResult.ok) return {
98
- ok: false,
99
- error: "error" in currencyResult ? currencyResult.error : "Provide a payment currency to proceed."
100
- };
101
- const currencyCode = currencyResult.value.toLowerCase();
102
- const amountValue = provider.amountType === "dynamic" ? toStripeSubunitAmount(amountResult.value, currencyCode) : amountResult.value;
103
- return {
104
- ok: true,
105
- value: {
106
- ...initial,
107
- capture_method: "automatic",
108
- mode: provider.paymentType === "subscription" ? "subscription" : "payment",
109
- appearance: {},
110
- amount: amountValue,
111
- currency: currencyCode
112
- }
113
- };
114
- };
115
- const destroyWidget = () => {
116
- try {
117
- stripeField.__formieStripeWidget?.paymentElement?.destroy?.();
118
- } catch (error) {}
119
- stripeField.__formieStripeWidget = null;
120
- stripeField.__formieStripeElements = void 0;
121
- placeholder.innerHTML = "";
122
- };
123
- const evaluateAndRender = () => {
124
- const resolved = getResolvedPaymentInfo();
125
- if (!resolved.ok) {
126
- destroyWidget();
127
- showPlaceholderMessage(loadingPlaceholder, themeSource, "error" in resolved ? resolved.error : "Unable to resolve payment details.");
128
- return;
129
- }
130
- try {
131
- if (stripeField.__formieStripeWidget && stripeField.__formieStripeElements) {
132
- stripeField.__formieStripeElements.update(resolved.value);
133
- clearPlaceholderError(loadingPlaceholder, themeSource);
134
- loadingPlaceholder?.setAttribute("hidden", "hidden");
135
- return;
136
- }
137
- renderPlaceholderLoading(loadingPlaceholder, themeSource);
138
- const elements = api.elements(resolved.value);
139
- const paymentElement = elements.create("payment", {});
140
- paymentElement.mount(placeholder);
141
- paymentElement.on?.("loaderror", (event) => {
142
- const message = event?.error?.message || "Unable to load payment options.";
143
- destroyWidget();
144
- showPlaceholderMessage(loadingPlaceholder, themeSource, message);
145
- });
146
- paymentElement.on?.("ready", () => {
147
- clearPlaceholderError(loadingPlaceholder, themeSource);
148
- loadingPlaceholder?.setAttribute("hidden", "hidden");
149
- });
150
- stripeField.__formieStripeElements = elements;
151
- stripeField.__formieStripeInstance = api;
152
- stripeField.__formieStripeWidget = {
153
- elements,
154
- paymentElement
155
- };
156
- if (!paymentElement.on) {
157
- clearPlaceholderError(loadingPlaceholder, themeSource);
158
- loadingPlaceholder?.setAttribute("hidden", "hidden");
159
- }
160
- } catch (error) {
161
- destroyWidget();
162
- showPlaceholderMessage(loadingPlaceholder, themeSource, error instanceof Error ? error.message : "Unable to initialize Stripe payment element.");
163
- }
164
- };
165
- stripeField.__formieStripeEvaluateAndRender = evaluateAndRender;
166
- stripeField.__formieStripeDynamicUnbind?.();
167
- if (dynamicHandles.length > 0) stripeField.__formieStripeDynamicUnbind = services.watchFieldValueChanges(dynamicHandles, () => {
168
- evaluateAndRender();
169
- }, 600);
170
- evaluateAndRender();
171
- return stripeField.__formieStripeWidget || null;
172
- },
173
- unmount: async (args) => {
174
- args.widget?.paymentElement?.destroy();
175
- const stripeField = args.field;
176
- stripeField.__formieStripeWidget = null;
177
- stripeField.__formieStripeElements = void 0;
178
- stripeField.__formieStripeInstance = null;
179
- stripeField.__formieStripeLastClientSecret = void 0;
180
- stripeField.__formieStripeEvaluateAndRender = null;
181
- stripeField.__formieStripeDynamicUnbind?.();
182
- stripeField.__formieStripeDynamicUnbind = null;
183
- },
184
- onBeforeAuthorize: async (args) => {
185
- const { widget, services, field } = args;
186
- const stripeField = field;
187
- let activeWidget = widget;
188
- if (!activeWidget?.elements) {
189
- stripeField.__formieStripeEvaluateAndRender?.();
190
- activeWidget = stripeField.__formieStripeWidget || null;
191
- }
192
- if (!activeWidget?.elements) return false;
193
- const result = await activeWidget.elements.submit();
194
- if (result?.error) {
195
- services.addError(result.error.message);
196
- return false;
197
- }
198
- return true;
199
- },
200
- setup: async (ctx) => {
201
- const { services, options } = ctx;
202
- const provider = options.provider;
203
- const field = ctx.target;
204
- const handler = async (event) => {
205
- try {
206
- const data = event.detail?.data;
207
- if (!data?.clientSecret) return;
208
- if (field.__formieStripeConfirming) return;
209
- if (field.__formieStripeLastClientSecret === data.clientSecret) return;
210
- const elements = field.__formieStripeElements;
211
- if (!elements) {
212
- services.addError("Stripe elements not ready for 3DS.");
213
- return;
214
- }
215
- const instance = field.__formieStripeInstance;
216
- const publishableKey = provider.publishableKey;
217
- if (!instance || !publishableKey) {
218
- services.addError("Stripe is not initialized.");
219
- return;
220
- }
221
- field.__formieStripeConfirming = true;
222
- const returnUrl = new URL(data.returnUrl || window.location.href);
223
- returnUrl.searchParams.set("origin", window.location.href);
224
- const result = await (data.type === "setup" ? instance.confirmSetup : instance.confirmPayment)({
225
- elements,
226
- clientSecret: data.clientSecret,
227
- redirect: "if_required",
228
- confirmParams: { return_url: returnUrl.toString() }
229
- });
230
- if (result?.error) {
231
- services.releaseSubmitLoading();
232
- services.addError(result.error.message);
233
- return;
234
- }
235
- if (data.subscriptionId) services.updateInputs("stripeSubscriptionId", data.subscriptionId);
236
- const pi = result && "paymentIntent" in result ? result.paymentIntent : null;
237
- const si = result && "setupIntent" in result ? result.setupIntent : null;
238
- if (pi?.id) services.updateInputs("stripePaymentIntentId", pi.id);
239
- else if (si?.id) services.updateInputs("stripePaymentIntentId", si.id);
240
- else {
241
- services.releaseSubmitLoading();
242
- services.addError("Stripe confirmation did not return an intent ID.");
243
- return;
244
- }
245
- field.__formieStripeLastClientSecret = data.clientSecret;
246
- services.triggerSubmit();
247
- } catch (error) {
248
- services.releaseSubmitLoading();
249
- services.addError(error instanceof Error ? error.message : "Unable to confirm Stripe payment.");
250
- } finally {
251
- field.__formieStripeConfirming = false;
252
- }
253
- };
254
- field.__formieStripeConfirmUnbind?.();
255
- field.__formieStripeConfirmUnbind = services.events.onForm(CONFIRM_EVENT, handler);
256
- return { destroy: () => {
257
- field.__formieStripeConfirmUnbind?.();
258
- field.__formieStripeConfirmUnbind = null;
259
- } };
260
- },
261
- onAfterSubmit: async (args) => {
262
- const stripeField = args.field;
263
- if (args.result?.ok && !args.result?.nextPage) {
264
- stripeField.__formieStripeWidget?.paymentElement?.destroy?.();
265
- stripeField.__formieStripeWidget = null;
266
- stripeField.__formieStripeElements = void 0;
267
- args.services.updateInputs(["stripePaymentIntentId", "stripeSubscriptionId"], "");
268
- stripeField.__formieStripeLastClientSecret = void 0;
269
- }
270
- }
271
- });
272
- //#endregion
273
- export { stripeModule };
@@ -1,22 +0,0 @@
1
- //#region src/js/modules/styles.ts
2
- var injectedModuleStyles = /* @__PURE__ */ new Set();
3
- function ensureModuleStyles(moduleId, styles) {
4
- if (typeof document === "undefined") return;
5
- const styleId = `formie-module-style:${moduleId}`;
6
- if (injectedModuleStyles.has(styleId) || document.querySelector(`style[data-formie-module-style="${moduleId}"]`)) {
7
- injectedModuleStyles.add(styleId);
8
- return;
9
- }
10
- const cssText = styles.filter((style) => typeof style === "string" && style.trim().length > 0).join("\n");
11
- if (!cssText) {
12
- injectedModuleStyles.add(styleId);
13
- return;
14
- }
15
- const style = document.createElement("style");
16
- style.setAttribute("data-formie-module-style", moduleId);
17
- style.textContent = cssText;
18
- document.head.appendChild(style);
19
- injectedModuleStyles.add(styleId);
20
- }
21
- //#endregion
22
- export { ensureModuleStyles as t };
@@ -1,189 +0,0 @@
1
- import { t as createDebug } from "./debug-KnZeKYBI.js";
2
- import { i as toggleThemeClasses } from "./theme-classes-vSHpdCUO.js";
3
- import { n as requestText } from "./http-18nn97DZ.js";
4
- import { t as debounce } from "./async-B3DUf1GZ.js";
5
- import { t as ensureModuleStyles } from "./styles-BIh6g7V_.js";
6
- import { r as getModuleFieldContainers, t as dispatchFieldEvent } from "./shared-DC6_1u8X.js";
7
- import summaryCss from "#theme/fields/_summary.css?inline";
8
- //#region src/js/modules/fields/summary.ts
9
- var BLOCKS_SELECTOR = "[data-formie-summary-blocks]";
10
- var CONTAINER_SELECTOR = "[data-formie-summary-container]";
11
- var SUMMARY_ACTION = "formie/fields/get-summary-html";
12
- var MODULE_ID = "summary";
13
- var debug = createDebug("fields", "summary");
14
- ensureModuleStyles(MODULE_ID, [summaryCss]);
15
- function getSummaryRequestUrl() {
16
- const url = new URL(window.location.href);
17
- url.hash = "";
18
- return url.toString();
19
- }
20
- function getSummaryRequestState(field) {
21
- return { accessToken: field.querySelector("[data-formie-summary-token]")?.value?.trim() || null };
22
- }
23
- async function requestSummaryHtml(form, state, signal) {
24
- if (!state.accessToken) throw new Error("Summary field requires an access token.");
25
- const formData = new FormData(form);
26
- formData.set("action", SUMMARY_ACTION);
27
- formData.set("accessToken", state.accessToken);
28
- return requestText(getSummaryRequestUrl(), {
29
- method: "POST",
30
- body: formData,
31
- signal,
32
- headers: { Accept: "text/html" }
33
- });
34
- }
35
- function initSummaryField(field, root) {
36
- const form = field.closest("form");
37
- if (!(form instanceof HTMLFormElement)) {
38
- debug.warn("Missing form ancestor; skipping field.");
39
- return () => {};
40
- }
41
- let hasFetched = false;
42
- let isDirty = true;
43
- let isVisible = false;
44
- let dirtyVersion = 0;
45
- let requestVersion = 0;
46
- let activeRequest = null;
47
- const getBlocks = () => {
48
- const blocks = field.querySelector(BLOCKS_SELECTOR);
49
- return blocks instanceof HTMLElement ? blocks : null;
50
- };
51
- const getContainer = () => {
52
- const container = field.querySelector(CONTAINER_SELECTOR);
53
- return container instanceof HTMLElement ? container : null;
54
- };
55
- const setLoadingState = (isLoading) => {
56
- const blocks = getBlocks();
57
- if (!blocks) return;
58
- if (isLoading) {
59
- blocks.setAttribute("data-formie-loading", "true");
60
- blocks.setAttribute("aria-busy", "true");
61
- toggleThemeClasses(blocks, form, "loading", true);
62
- return;
63
- }
64
- blocks.removeAttribute("data-formie-loading");
65
- blocks.removeAttribute("aria-busy");
66
- toggleThemeClasses(blocks, form, "loading", false);
67
- };
68
- setLoadingState(!!getSummaryRequestState(field).accessToken);
69
- const queueFetch = () => {
70
- if (!isVisible || hasFetched && !isDirty) return;
71
- debug.log("Queueing fetch.");
72
- fetchSummary();
73
- };
74
- const fetchSummary = debounce(async () => {
75
- const state = getSummaryRequestState(field);
76
- if (!getBlocks() || !state.accessToken) {
77
- debug.warn("Missing state for fetch.", state);
78
- setLoadingState(false);
79
- return;
80
- }
81
- requestVersion += 1;
82
- const currentRequestVersion = requestVersion;
83
- const requestDirtyVersion = dirtyVersion;
84
- activeRequest?.abort();
85
- activeRequest = new AbortController();
86
- setLoadingState(true);
87
- try {
88
- const html = await requestSummaryHtml(form, state, activeRequest.signal);
89
- if (currentRequestVersion !== requestVersion) return;
90
- const container = getContainer();
91
- const nextMarkup = document.createElement("template");
92
- nextMarkup.innerHTML = html.trim();
93
- const nextContainer = nextMarkup.content.querySelector(CONTAINER_SELECTOR);
94
- if (container && nextContainer instanceof HTMLElement) container.replaceWith(nextContainer);
95
- else if (container) container.innerHTML = html;
96
- hasFetched = true;
97
- isDirty = dirtyVersion !== requestDirtyVersion;
98
- debug.log("Fetch complete.", {
99
- isDirty,
100
- dirtyVersion,
101
- requestVersion: currentRequestVersion
102
- });
103
- dispatchFieldEvent(field, MODULE_ID, "fetch-summary", {
104
- summary: field,
105
- html
106
- });
107
- } catch (error) {
108
- if (error instanceof DOMException && error.name === "AbortError") {
109
- debug.log("Fetch aborted.");
110
- return;
111
- }
112
- console.error("[formie] Failed to load summary field HTML.", error);
113
- } finally {
114
- if (currentRequestVersion === requestVersion) {
115
- setLoadingState(false);
116
- activeRequest = null;
117
- if (isDirty) queueFetch();
118
- }
119
- }
120
- }, 300);
121
- const markDirty = (event) => {
122
- const target = event?.target;
123
- if (target instanceof Node && field.contains(target)) return;
124
- isDirty = true;
125
- dirtyVersion += 1;
126
- debug.log("Marked dirty.", { dirtyVersion });
127
- };
128
- const handleFieldMutation = (event) => {
129
- markDirty(event);
130
- queueFetch();
131
- };
132
- const handleSubmitResult = () => {
133
- isDirty = true;
134
- debug.log("Submit result received; refreshing.");
135
- queueFetch();
136
- };
137
- const handlePageNavigate = () => {
138
- isDirty = true;
139
- debug.log("Page navigation received; refreshing.");
140
- queueFetch();
141
- };
142
- const observer = new IntersectionObserver((entries) => {
143
- isVisible = !!entries[0]?.isIntersecting;
144
- if (!isVisible) return;
145
- debug.log("Field became visible.");
146
- dispatchFieldEvent(field, MODULE_ID, "field-visible", { summary: field });
147
- queueFetch();
148
- }, {
149
- root: form,
150
- rootMargin: "50px"
151
- });
152
- observer.observe(field);
153
- form.addEventListener("input", handleFieldMutation);
154
- form.addEventListener("change", handleFieldMutation);
155
- root.addEventListener("formie:page:navigate:after", handlePageNavigate);
156
- root.addEventListener("formie:submit:result", handleSubmitResult);
157
- return () => {
158
- activeRequest?.abort();
159
- observer.disconnect();
160
- form.removeEventListener("input", handleFieldMutation);
161
- form.removeEventListener("change", handleFieldMutation);
162
- root.removeEventListener("formie:page:navigate:after", handlePageNavigate);
163
- root.removeEventListener("formie:submit:result", handleSubmitResult);
164
- debug.log("Field destroyed.");
165
- };
166
- }
167
- var summaryModule = {
168
- id: MODULE_ID,
169
- kind: "field",
170
- match: (ctx) => {
171
- return !!ctx.target.querySelector(BLOCKS_SELECTOR);
172
- },
173
- setup: async (ctx) => {
174
- const cleanups = getModuleFieldContainers(ctx).map((field) => {
175
- return initSummaryField(field, ctx.root);
176
- });
177
- debug.log("Module setup.", { fieldCount: cleanups.length });
178
- await ctx.emit("formie:module:summary:init", { count: cleanups.length });
179
- return { destroy: () => {
180
- cleanups.forEach((cleanup) => {
181
- cleanup();
182
- });
183
- debug.log("Module destroy.", { fieldCount: cleanups.length });
184
- ctx.emit("formie:module:summary:destroy", {});
185
- } };
186
- }
187
- };
188
- //#endregion
189
- export { summaryModule };
@@ -1,122 +0,0 @@
1
- import { n as sleep } from "./async-B3DUf1GZ.js";
2
- import { t as ensureModuleStyles } from "./styles-BIh6g7V_.js";
3
- import { a as getTemplateSource, o as getTemplateSourceHtml, t as dispatchFieldEvent } from "./shared-DC6_1u8X.js";
4
- import tableCss from "#theme/fields/_table.css?inline";
5
- //#region src/js/modules/fields/table.ts
6
- var FIELD_SELECTOR = "[data-formie-table-field-layout]";
7
- var TABLE_SELECTOR = "[data-formie-table]";
8
- var TABLE_BODY_SELECTOR = "[data-formie-table-body]";
9
- var ROW_SELECTOR = "[data-formie-table-row]";
10
- var ADD_SELECTOR = "[data-formie-table-add]";
11
- var REMOVE_SELECTOR = "[data-formie-table-remove]";
12
- var TEMPLATE_ID_ATTR = "data-formie-template-id";
13
- var ROW_ID_ATTR = "data-formie-table-row-id";
14
- var MODULE_ID = "table";
15
- ensureModuleStyles(MODULE_ID, [tableCss]);
16
- function getTemplate(field, templateId) {
17
- return getTemplateSource(field, templateId);
18
- }
19
- function getRowCount(field) {
20
- return field.querySelectorAll(ROW_SELECTOR).length;
21
- }
22
- function getNextRowId(field) {
23
- return Array.from(field.querySelectorAll(ROW_SELECTOR)).reduce((max, row) => {
24
- const current = parseInt(row.getAttribute(ROW_ID_ATTR) || "", 10);
25
- return Number.isNaN(current) ? max : Math.max(max, current + 1);
26
- }, 0);
27
- }
28
- function syncAddButton(addButton, rowCount) {
29
- if (!addButton) return;
30
- const maxRows = parseInt(addButton.getAttribute("data-formie-max-rows") || "", 10);
31
- addButton.disabled = maxRows > 0 && rowCount >= maxRows;
32
- }
33
- function bindTableField(field, options) {
34
- const table = field.querySelector(TABLE_SELECTOR);
35
- const tbody = field.querySelector(TABLE_BODY_SELECTOR);
36
- const addButton = field.querySelector(ADD_SELECTOR);
37
- if (!(table instanceof HTMLElement) || !(tbody instanceof HTMLElement)) return () => {};
38
- const removeHandlers = /* @__PURE__ */ new Map();
39
- let rowCounter = getNextRowId(field);
40
- const bindRemoveButtons = () => {
41
- field.querySelectorAll(REMOVE_SELECTOR).forEach((button) => {
42
- if (!(button instanceof HTMLElement) || removeHandlers.has(button)) return;
43
- const handler = (event) => {
44
- event.preventDefault();
45
- const row = button.closest(ROW_SELECTOR);
46
- if (!(row instanceof HTMLElement)) return;
47
- const minRows = parseInt((addButton instanceof HTMLButtonElement ? addButton.getAttribute("data-formie-min-rows") : "") || "", 10);
48
- if (minRows > 0 && getRowCount(field) <= minRows) return;
49
- row.remove();
50
- syncAddButton(addButton instanceof HTMLButtonElement ? addButton : null, getRowCount(field));
51
- dispatchFieldEvent(field, MODULE_ID, "remove", {
52
- table: field,
53
- row
54
- });
55
- };
56
- button.addEventListener("click", handler);
57
- removeHandlers.set(button, handler);
58
- });
59
- };
60
- const addRow = async () => {
61
- if (options.static || !(addButton instanceof HTMLButtonElement)) return;
62
- if (!addButton.getAttribute("data-formie-table-add")) return;
63
- const templateId = addButton.getAttribute(TEMPLATE_ID_ATTR) || field.getAttribute(TEMPLATE_ID_ATTR);
64
- const maxRows = parseInt(addButton.getAttribute("data-formie-max-rows") || "", 10);
65
- if (maxRows > 0 && getRowCount(field) >= maxRows) return;
66
- const template = getTemplate(field, templateId);
67
- if (!template) return;
68
- const html = getTemplateSourceHtml(template).replaceAll("__ROW__", String(rowCounter++));
69
- const row = document.createElement("tr");
70
- row.setAttribute("data-formie-table-row", "true");
71
- row.setAttribute(ROW_ID_ATTR, String(rowCounter - 1));
72
- row.innerHTML = html;
73
- tbody.appendChild(row);
74
- await sleep(50);
75
- bindRemoveButtons();
76
- syncAddButton(addButton, getRowCount(field));
77
- dispatchFieldEvent(field, MODULE_ID, "append", {
78
- table: field,
79
- row
80
- });
81
- };
82
- const addHandler = (event) => {
83
- event.preventDefault();
84
- addRow();
85
- };
86
- if (addButton instanceof HTMLButtonElement && !options.static) addButton.addEventListener("click", addHandler);
87
- bindRemoveButtons();
88
- syncAddButton(addButton instanceof HTMLButtonElement ? addButton : null, getRowCount(field));
89
- dispatchFieldEvent(field, MODULE_ID, "init", { table: field });
90
- return () => {
91
- if (addButton instanceof HTMLButtonElement) addButton.removeEventListener("click", addHandler);
92
- removeHandlers.forEach((handler, button) => {
93
- button.removeEventListener("click", handler);
94
- });
95
- };
96
- }
97
- var tableModule = {
98
- id: MODULE_ID,
99
- kind: "field",
100
- match: (ctx) => {
101
- return ctx.target instanceof HTMLElement && (ctx.target.matches(FIELD_SELECTOR) || !!ctx.target.querySelector(FIELD_SELECTOR));
102
- },
103
- setup: async (ctx) => {
104
- const options = ctx.options || {};
105
- if (!(ctx.target instanceof HTMLElement)) return;
106
- const fields = ctx.target.matches(FIELD_SELECTOR) ? [ctx.target] : Array.from(ctx.target.querySelectorAll(FIELD_SELECTOR)).filter((field) => {
107
- return field instanceof HTMLElement;
108
- });
109
- const destroyBindings = fields.map((field) => {
110
- return bindTableField(field, options);
111
- });
112
- await ctx.emit("formie:module:table:init", { count: fields.length });
113
- return { destroy: () => {
114
- destroyBindings.forEach((destroyBinding) => {
115
- destroyBinding();
116
- });
117
- ctx.emit("formie:module:table:destroy", {});
118
- } };
119
- }
120
- };
121
- //#endregion
122
- export { tableModule };