@ebrains/vue 0.5.0-alpha.0 → 0.7.0-alpha.0

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 (231) hide show
  1. package/{analytics-1cde8e4a-BDRcCMlV.mjs → analytics-44b1416b-3vYuu4Xs.mjs} +10 -6
  2. package/analytics-44b1416b-ol77SdQE.js +1 -0
  3. package/{color-primary-palette_6.entry-CgeStD0V.mjs → color-primary-palette_6.entry-BDyyrFB5.mjs} +17 -17
  4. package/color-primary-palette_6.entry-BhxgE7ff.js +1 -0
  5. package/correct-use-of-colors.entry-DXASqwFp.js +1 -0
  6. package/correct-use-of-colors.entry-z7k3YWpg.mjs +59 -0
  7. package/{eds-alert_17.entry-BfpBSBVW.js → eds-accordion_22.entry-LksMmZ4o.js} +16031 -2217
  8. package/{eds-alert_17.entry-IJq6baZd.mjs → eds-accordion_22.entry-Lqf1NKBk.mjs} +17319 -3219
  9. package/eds-alert.entry-BqjTTCgj.mjs +688 -0
  10. package/eds-alert.entry-DZcz_4Dj.js +608 -0
  11. package/eds-app-root.entry-Cz-9z7Za.js +1 -0
  12. package/eds-app-root.entry-DobAtes_.mjs +25 -0
  13. package/{eds-avatar_4.entry-B7CV7v_n.mjs → eds-avatar_4.entry-BYrgwmj2.mjs} +21 -26
  14. package/{eds-avatar_4.entry-D1CDRW_R.js → eds-avatar_4.entry-Bqr0d5Cj.js} +2 -2
  15. package/eds-breadcrumb.entry-N3NSBwJL.mjs +104 -0
  16. package/eds-breadcrumb.entry-elqbS74P.js +1 -0
  17. package/eds-card-generic.entry-D5pTUUco.js +1 -0
  18. package/{eds-card-generic.entry-DIHPUjbI.mjs → eds-card-generic.entry-zKJ2hHOe.mjs} +9 -16
  19. package/{eds-card-project.entry-C2dWgXXW.mjs → eds-card-project.entry-DDo4ZJs8.mjs} +2 -2
  20. package/{eds-card-project.entry-CunHqbYK.js → eds-card-project.entry-e4n5lQbW.js} +1 -1
  21. package/eds-card-section.entry-C8nt6j3h.mjs +30 -0
  22. package/eds-card-section.entry-CeznIbCo.js +1 -0
  23. package/{eds-card-tags.entry-CQS5AtAg.js → eds-card-tags.entry-Bl3YXNtv.js} +1 -1
  24. package/{eds-card-tags.entry-C6jjLiGA.mjs → eds-card-tags.entry-Do9kx7rP.mjs} +1 -1
  25. package/{eds-card-tool.entry-Bi8w0xds.mjs → eds-card-tool.entry-BewNCjRU.mjs} +2 -2
  26. package/{eds-card-tool.entry-DJA23zJf.js → eds-card-tool.entry-DnVIn9BX.js} +1 -1
  27. package/{eds-card-wrapper.entry-BKPCc7ci.js → eds-card-wrapper.entry-BzKcrwEf.js} +1 -1
  28. package/{eds-card-wrapper.entry-UPnkq2JI.mjs → eds-card-wrapper.entry-DMj1bZ4i.mjs} +1 -1
  29. package/{eds-code-block.entry-Ckb3jisn.js → eds-code-block.entry-DUeN87Fw.js} +1 -1
  30. package/{eds-code-block.entry-BZTLGjqq.mjs → eds-code-block.entry-fqrA-Frf.mjs} +1 -1
  31. package/{eds-components-section.entry-D1ovrn93.mjs → eds-components-section.entry-BgfCSxk1.mjs} +2 -2
  32. package/{eds-components-section.entry-B3WrdIfL.js → eds-components-section.entry-CLJMns6h.js} +2 -2
  33. package/eds-cookies-preference.entry-B1a8qild.mjs +20 -0
  34. package/eds-cookies-preference.entry-BGx0tglE.js +1 -0
  35. package/{eds-docs-palettes.entry-Bk77Xn04.js → eds-docs-palettes.entry-C1EcBwSy.js} +1 -1
  36. package/{eds-docs-palettes.entry-lpT0ypSs.mjs → eds-docs-palettes.entry-TXbXKJJN.mjs} +2 -2
  37. package/{eds-docs-tokens.entry-Bi35zxEM.mjs → eds-docs-tokens.entry-B1xc8BFa.mjs} +2 -2
  38. package/{eds-docs-tokens.entry-DCHw-jrS.js → eds-docs-tokens.entry-BJVBVsOy.js} +1 -1
  39. package/eds-dropdown.entry-CMK8E_J2.mjs +83 -0
  40. package/eds-dropdown.entry-FqX7fOIb.js +1 -0
  41. package/eds-feedback.entry-B-Lue8P0.js +1 -0
  42. package/eds-feedback.entry-fz73-syB.mjs +53 -0
  43. package/{eds-form.entry-a52cYx3b.js → eds-form.entry-0saB-Hm9.js} +2 -2
  44. package/{eds-form.entry-xm937wbh.mjs → eds-form.entry-BB1gfXVy.mjs} +174 -159
  45. package/eds-frame.entry-BvJCKWMT.mjs +73 -0
  46. package/eds-frame.entry-dX3nZxD0.js +1 -0
  47. package/{eds-icon-arrow-diagonal.entry-kClkB8LF.mjs → eds-icon-arrow-diagonal.entry-BD3xdvR4.mjs} +2 -2
  48. package/{eds-icon-arrow-diagonal.entry-fzsCJiPP.js → eds-icon-arrow-diagonal.entry-DkQFuVkT.js} +1 -1
  49. package/eds-icon-arrow-right.entry-BH0zDB1H.js +1 -0
  50. package/eds-icon-arrow-right.entry-Diax6KZB.mjs +13 -0
  51. package/{eds-icon-bluesky.entry-7tzCZSoL.js → eds-icon-bluesky.entry-CDZCjWCh.js} +1 -1
  52. package/eds-icon-bluesky.entry-DwvxMR1q.mjs +13 -0
  53. package/{eds-icon-chevron-down.entry-BUG6E9eR.js → eds-icon-chevron-down.entry-CGsA1rJ0.js} +1 -1
  54. package/eds-icon-chevron-down.entry-CiJcqZuh.mjs +13 -0
  55. package/{eds-icon-chevron-left.entry-Vq-R3b59.mjs → eds-icon-chevron-left.entry-Dt2WsKob.mjs} +2 -2
  56. package/{eds-icon-chevron-left.entry-BT-KYjSo.js → eds-icon-chevron-left.entry-nBBudzCb.js} +1 -1
  57. package/{eds-icon-chevron-right.entry-B1qzmGrD.mjs → eds-icon-chevron-right.entry-BG7_qznz.mjs} +2 -2
  58. package/{eds-icon-chevron-right.entry-BmU_I0Y1.js → eds-icon-chevron-right.entry-CjhJFKog.js} +1 -1
  59. package/eds-icon-chevron-up.entry-DfsbHKk1.mjs +13 -0
  60. package/eds-icon-chevron-up.entry-Dy81hGw-.js +1 -0
  61. package/eds-icon-close.entry-CpGzc34L.mjs +13 -0
  62. package/{eds-icon-close.entry-DS7BLTzl.js → eds-icon-close.entry-DNhXNl8O.js} +1 -1
  63. package/eds-icon-copy.entry-CsD2FpUS.mjs +13 -0
  64. package/eds-icon-copy.entry-DD2HXgFK.js +1 -0
  65. package/eds-icon-eu.entry-BRuCbl7O.mjs +13 -0
  66. package/eds-icon-eu.entry-ChKv8iZB.js +1 -0
  67. package/{eds-icon-facebook.entry-B9szoikj.mjs → eds-icon-facebook.entry--ctHhWkj.mjs} +2 -2
  68. package/{eds-icon-facebook.entry-knUdck2t.js → eds-icon-facebook.entry-Bjkse_bn.js} +1 -1
  69. package/{eds-icon-gitlab.entry-IO7f4hgL.mjs → eds-icon-gitlab.entry-BDqNL5zl.mjs} +2 -2
  70. package/{eds-icon-gitlab.entry-pKxaKA0B.js → eds-icon-gitlab.entry-DUQcgTMM.js} +1 -1
  71. package/eds-icon-linkedin.entry-Cq13-Zdb.mjs +13 -0
  72. package/{eds-icon-linkedin.entry-BD__kbDV.js → eds-icon-linkedin.entry-D-D3hmxE.js} +1 -1
  73. package/eds-icon-loader.entry-DgpUjCng.mjs +13 -0
  74. package/eds-icon-loader.entry-rKBBXz_C.js +1 -0
  75. package/{eds-icon-mastodon.entry-7152lwgd.js → eds-icon-mastodon.entry-CCn_r682.js} +1 -1
  76. package/eds-icon-mastodon.entry-OpdPcGQ7.mjs +13 -0
  77. package/eds-icon-menu.entry-B3mQ8ma1.mjs +13 -0
  78. package/{eds-icon-menu.entry-BVU8htgo.js → eds-icon-menu.entry-DUxzhro5.js} +1 -1
  79. package/{eds-icon-more.entry-lossstHZ.js → eds-icon-more.entry-CBDi0LJC.js} +1 -1
  80. package/{eds-icon-more.entry-KE6_EsAg.mjs → eds-icon-more.entry-CDDxBiBM.mjs} +2 -2
  81. package/eds-icon-search.entry-Bok3Oo0Q.js +1 -0
  82. package/eds-icon-search.entry-CvnFqzlk.mjs +13 -0
  83. package/eds-icon-star.entry-BRQ07hMQ.mjs +13 -0
  84. package/eds-icon-star.entry-CkeEbwgJ.js +1 -0
  85. package/{eds-icon-success.entry-CRu9Ssdi.js → eds-icon-success.entry-DA4C5Hwg.js} +1 -1
  86. package/eds-icon-success.entry-nWUVTFzX.mjs +13 -0
  87. package/eds-icon-thumbs-down.entry-BqEOrmiW.js +1 -0
  88. package/eds-icon-thumbs-down.entry-Dme-Ippn.mjs +13 -0
  89. package/eds-icon-thumbs-up.entry-Dkqv6r_x.js +1 -0
  90. package/eds-icon-thumbs-up.entry-Dp-eslmx.mjs +13 -0
  91. package/eds-icon-twitter.entry-BcZ2atce.js +1 -0
  92. package/eds-icon-twitter.entry-CqalD8Wf.mjs +13 -0
  93. package/eds-icon-user.entry-DU8EF-lQ.mjs +13 -0
  94. package/{eds-icon-user.entry-DkRLDrdp.js → eds-icon-user.entry-DpvoOnVA.js} +1 -1
  95. package/{eds-icon-youtube.entry-DL5fWU8k.js → eds-icon-youtube.entry-DbPAn4pN.js} +1 -1
  96. package/{eds-icon-youtube.entry-CRRGbDsw.mjs → eds-icon-youtube.entry-vFg7QtYg.mjs} +2 -2
  97. package/eds-login_2.entry-6Hxmqih9.js +9 -0
  98. package/{keycloak-d502ec16-Ce0iGqyk.mjs → eds-login_2.entry-DD8g9nqu.mjs} +288 -210
  99. package/eds-logo-variations.entry-CDTTH-iG.mjs +22 -0
  100. package/{eds-logo-variations.entry-BnB25dDH.js → eds-logo-variations.entry-dLBnZPi7.js} +1 -1
  101. package/{eds-modal.entry-CCy9SRVR.mjs → eds-modal.entry-CV3bf08X.mjs} +17 -5
  102. package/{eds-modal.entry-B9gXEOjT.js → eds-modal.entry-DJybVbNk.js} +1 -1
  103. package/{eds-progress-bar.entry-D56TNSGj.js → eds-progress-bar.entry-23-I0rSz.js} +1 -1
  104. package/{eds-progress-bar.entry-BtI2_94Z.mjs → eds-progress-bar.entry-BP6AqtI7.mjs} +2 -2
  105. package/eds-rating.entry-CHo7h3Y4.mjs +61 -0
  106. package/eds-rating.entry-dDYfYR7o.js +1 -0
  107. package/{eds-section-core_2.entry-BmbK_RfT.js → eds-section-core_2.entry-BdnBCBit.js} +1 -1
  108. package/{eds-section-core_2.entry-pmUkAIz7.mjs → eds-section-core_2.entry-DTItYLUC.mjs} +4 -4
  109. package/eds-spinner.entry-BwTZAz8I.mjs +36 -0
  110. package/eds-spinner.entry-CXLe8IAk.js +1 -0
  111. package/eds-steps.entry-Nz_XqcUl.mjs +28 -0
  112. package/eds-steps.entry-ceVyrSe-.js +1 -0
  113. package/{eds-svg-repository.entry-DZ1FMRrQ.js → eds-svg-repository.entry-CKQ6S13R.js} +13 -13
  114. package/{eds-svg-repository.entry-B3xCCFOp.mjs → eds-svg-repository.entry-DoYT85te.mjs} +54 -48
  115. package/eds-switch.entry-4a3DLV-c.js +1 -0
  116. package/eds-switch.entry-DjT9dev_.mjs +20 -0
  117. package/{eds-input_7.entry-BZ9afXqe.js → eds-tabs.entry-BYxiMlkR.mjs} +752 -41
  118. package/{eds-input_7.entry-WvoE_Mue.mjs → eds-tabs.entry-DJKEg0Gs.js} +649 -247
  119. package/eds-timeline.entry-DKx-pd67.js +1 -0
  120. package/eds-timeline.entry-DOSKCjPH.mjs +45 -0
  121. package/eds-toast-manager.entry-BV-sP7cR.mjs +36 -0
  122. package/eds-toast-manager.entry-BopxpC3o.js +1 -0
  123. package/eds-toast.entry-DDBTRdmP.mjs +61 -0
  124. package/eds-toast.entry-DPibhM-Z.js +3 -0
  125. package/{eds-tooltip.entry-CTCdKTKM.mjs → eds-tooltip.entry-B53fpM9t.mjs} +8 -8
  126. package/{eds-tooltip.entry-eiFlYpfl.js → eds-tooltip.entry-Cf6bse_x.js} +1 -1
  127. package/eds-trl.entry-C0cSVG_Q.mjs +34 -0
  128. package/eds-trl.entry-fYVgYPts.js +1 -0
  129. package/eds-user.entry-hUkYJDp4.js +1 -0
  130. package/eds-user.entry-qM0swzIt.mjs +26 -0
  131. package/{eds-vertical-stepper.entry-DpcwvOst.mjs → eds-vertical-stepper.entry-Bb6dUinj.mjs} +5 -5
  132. package/{eds-vertical-stepper.entry-O_GJNo8B.js → eds-vertical-stepper.entry-CvadBA1x.js} +1 -1
  133. package/formUtils-ac68474d-BDuxB0K8.js +1 -0
  134. package/formUtils-ac68474d-D2e59S7S.mjs +122 -0
  135. package/generated/components.d.ts +4 -1
  136. package/incorrect-use-of-colors.entry-B6fKAvAx.mjs +42 -0
  137. package/incorrect-use-of-colors.entry-DZ_SBoa8.js +1 -0
  138. package/index-D4alMZtT.js +21 -0
  139. package/{index-C-Gy1Lax.mjs → index-E1PpO1J3.mjs} +450 -386
  140. package/index.js +1 -1
  141. package/index.mjs +32 -29
  142. package/{logo-space.entry-D56IaLNE.js → logo-space.entry-BOh7Odfh.js} +1 -1
  143. package/{logo-space.entry-DERJLkyL.mjs → logo-space.entry-xGhYUj5r.mjs} +7 -7
  144. package/logo-variations-horizontal_2.entry-BWlXcmRe.js +7 -0
  145. package/logo-variations-horizontal_2.entry-CIUDEw3Y.mjs +29 -0
  146. package/logo-wrong-usage.entry-CtPXf-5h.js +1 -0
  147. package/logo-wrong-usage.entry-D4aBJ6Wk.mjs +14 -0
  148. package/package.json +1 -1
  149. package/sharedUtils-a550989c-Ci3Tx3jc.mjs +15 -0
  150. package/sharedUtils-a550989c-m4pF1Vqy.js +1 -0
  151. package/star-0da9b5e9-B3-jr0yE.js +3 -0
  152. package/star-0da9b5e9-DX8_iFmu.mjs +6 -0
  153. package/thumbs-down-a18fd049-CzuBAj99.mjs +6 -0
  154. package/thumbs-down-a18fd049-DTNIbYbm.js +3 -0
  155. package/thumbs-up-c19a71bc-CjLv5Wgw.mjs +7 -0
  156. package/thumbs-up-c19a71bc-w8Z8gegt.js +4 -0
  157. package/{token-list_3.entry-Zgzwbhio.mjs → token-list_3.entry-DJ-cqa3_.mjs} +4 -4
  158. package/{token-list_3.entry-C0Tohj1W.js → token-list_3.entry-DVoMZtdK.js} +1 -1
  159. package/{token-ratios.entry-B7ZwRluK.mjs → token-ratios.entry-FKky7w4Z.mjs} +2 -2
  160. package/token-ratios.entry-JS-ffZPx.js +1 -0
  161. package/token-spacing.entry-Cf5LP8jh.mjs +12 -0
  162. package/token-spacing.entry-YJWgDaTr.js +1 -0
  163. package/{token-typography.entry-D4bxbB2m.mjs → token-typography.entry-CKyKPdVF.mjs} +2 -2
  164. package/{token-typography.entry-D-PPtDvs.js → token-typography.entry-CuHfxHRU.js} +1 -1
  165. package/analytics-1cde8e4a-B_MD-9qW.js +0 -1
  166. package/color-primary-palette_6.entry-c_K7930i.js +0 -1
  167. package/correct-use-of-colors.entry-De5Tcxdm.mjs +0 -59
  168. package/correct-use-of-colors.entry-DpmXW_CD.js +0 -1
  169. package/eds-accordion.entry-B8TjhnWX.mjs +0 -49
  170. package/eds-accordion.entry-BySfMYU2.js +0 -4
  171. package/eds-card-generic.entry-BhLK-nyp.js +0 -1
  172. package/eds-card-section.entry-0n2V-MH6.js +0 -1
  173. package/eds-card-section.entry-Ccjil38X.mjs +0 -39
  174. package/eds-dropdown_2.entry-Bamjbo1o.mjs +0 -115
  175. package/eds-dropdown_2.entry-YEBzyKJu.js +0 -1
  176. package/eds-frame.entry-BnT9nQwa.js +0 -1
  177. package/eds-frame.entry-CU7GoLj6.mjs +0 -74
  178. package/eds-icon-arrow-right.entry-B75Ra6OD.js +0 -1
  179. package/eds-icon-arrow-right.entry-DX6A-VKL.mjs +0 -13
  180. package/eds-icon-bluesky.entry-BNSdVu2K.mjs +0 -13
  181. package/eds-icon-chevron-down.entry-BLvZ3e_N.mjs +0 -13
  182. package/eds-icon-chevron-up.entry-DXXRgw1V.js +0 -1
  183. package/eds-icon-chevron-up.entry-DuySJU_i.mjs +0 -13
  184. package/eds-icon-close.entry-DDxUAr21.mjs +0 -13
  185. package/eds-icon-copy.entry-DNa1wI4F.mjs +0 -13
  186. package/eds-icon-copy.entry-Nz_P5A7p.js +0 -1
  187. package/eds-icon-eu.entry-CLQcoimB.js +0 -1
  188. package/eds-icon-eu.entry-DTdf6Skc.mjs +0 -13
  189. package/eds-icon-linkedin.entry-CryUW1Er.mjs +0 -13
  190. package/eds-icon-loader.entry-B_3Sd6PB.js +0 -1
  191. package/eds-icon-loader.entry-CxizdRT8.mjs +0 -13
  192. package/eds-icon-mastodon.entry-MyM74vvm.mjs +0 -13
  193. package/eds-icon-menu.entry-5RRmRTxa.mjs +0 -13
  194. package/eds-icon-search.entry-Dg0wabdP.mjs +0 -13
  195. package/eds-icon-search.entry-DiYaxnYX.js +0 -1
  196. package/eds-icon-success.entry-_fWfddhX.mjs +0 -13
  197. package/eds-icon-twitter.entry-B4xPE3Vz.js +0 -1
  198. package/eds-icon-twitter.entry-DHFpeStb.mjs +0 -13
  199. package/eds-icon-user.entry-BOv2lInW.mjs +0 -13
  200. package/eds-login.entry-BRWK6otG.js +0 -1
  201. package/eds-login.entry-C0eOhlEq.mjs +0 -58
  202. package/eds-logo-variations.entry-Cw44vuQE.mjs +0 -22
  203. package/eds-matomo-notice.entry-BpwE1vQ3.js +0 -1
  204. package/eds-matomo-notice.entry-DsLbzeqQ.mjs +0 -91
  205. package/eds-navigator.entry-B9scz8p_.js +0 -1
  206. package/eds-navigator.entry-Dk-4UW_d.mjs +0 -33
  207. package/eds-pagination_2.entry-D_sngThL.js +0 -1
  208. package/eds-pagination_2.entry-M3CLFGN_.mjs +0 -249
  209. package/eds-tab.entry-Bpv6R_M0.mjs +0 -31
  210. package/eds-tab.entry-DjpVgaDN.js +0 -1
  211. package/eds-tabs-content.entry-Bj5wNmkr.js +0 -1
  212. package/eds-tabs-content.entry-CzwoLZzR.mjs +0 -106
  213. package/eds-tabs.entry-BYBPkYRs.mjs +0 -112
  214. package/eds-tabs.entry-Cbc9yhHL.js +0 -1
  215. package/eds-timeline.entry-Bq-eo4Og.js +0 -1
  216. package/eds-timeline.entry-DJYcN7rN.mjs +0 -51
  217. package/eds-trl.entry-8BXrp9SK.mjs +0 -34
  218. package/eds-trl.entry-DtffM-e5.js +0 -1
  219. package/eds-user.entry-DfBE6LuF.js +0 -1
  220. package/eds-user.entry-ybggwcts.mjs +0 -66
  221. package/incorrect-use-of-colors.entry-CDHLoNBa.js +0 -1
  222. package/incorrect-use-of-colors.entry-DbwiJCH0.mjs +0 -42
  223. package/index-D_kZU_4I.js +0 -21
  224. package/keycloak-d502ec16-m7LwS-Gh.js +0 -9
  225. package/logo-variations-horizontal_2.entry-OY3Zka_7.js +0 -7
  226. package/logo-variations-horizontal_2.entry-wp9D1MMl.mjs +0 -29
  227. package/logo-wrong-usage.entry-BniBpQrN.js +0 -1
  228. package/logo-wrong-usage.entry-RgKFDObE.mjs +0 -14
  229. package/token-ratios.entry-bO5CkZ9D.js +0 -1
  230. package/token-spacing.entry-BTYazF9c.js +0 -1
  231. package/token-spacing.entry-_yyMlwbO.mjs +0 -12
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-D_kZU_4I.js"),n=class{constructor(t){e.registerInstance(this,t),this.tabIndex=void 0}renderContent(){switch(this.tabIndex){case 0:return e.h("token-list",{show:"background"});case 1:return e.h("token-list",{show:"text"});case 2:return e.h("token-list",{show:"border"});case 3:return e.h("token-radii",null);case 4:return e.h("token-list",{show:"outline"});case 5:return e.h("token-shadows",null);default:return e.h("p",null,"Content not available.")}}render(){return e.h("div",{key:"b140f7650e5e01711dc0778b04af83f9d004efc7",class:"container"},this.renderContent())}};exports.eds_docs_tokens=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-D4alMZtT.js"),n=class{constructor(t){e.registerInstance(this,t),this.tabIndex=void 0}renderContent(){switch(this.tabIndex){case 0:return e.h("token-list",{show:"background"});case 1:return e.h("token-list",{show:"text"});case 2:return e.h("token-list",{show:"border"});case 3:return e.h("token-radii",null);case 4:return e.h("token-list",{show:"outline"});case 5:return e.h("token-shadows",null);default:return e.h("p",null,"Content not available.")}}render(){return e.h("div",{key:"cf676cf54781de4a4f8b75d174201d24d30d3538",class:"container"},this.renderContent())}};exports.eds_docs_tokens=n;
@@ -0,0 +1,83 @@
1
+ import { r as s, c as i, h as o, g as n } from "./index-E1PpO1J3.mjs";
2
+ import { s as d } from "./analytics-44b1416b-3vYuu4Xs.mjs";
3
+ const r = ".z-focus{z-index:99}.relative{position:relative}.shadow-small{--tw-shadow:0px 1.5px 2px rgba(0, 0, 0, 0.1);--tw-shadow-colored:0px 1.5px 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.bg-inverse{background-color:var(--white)}.border-softest{border:2px solid rgba(0, 0, 0, .05)}.z-10{z-index:10}.z-on-top{z-index:99999}.absolute{position:absolute}.top-full{top:100%}.mt-4{margin-top:0.25rem}.mt-6{margin-top:0.375rem}.mt-8{margin-top:0.5rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.flex-col{flex-direction:column}.gap-y-4{row-gap:0.25rem}.rounded-lg{border-radius:16px}.border-2{border-width:2px}.p-8{padding:0.5rem}.left-0{left:0rem}.left-1\\/2{left:50%}.left-4{left:0.25rem}.left-\\[4px\\]{left:4px}.right-0{right:0rem}.right-4{right:0.25rem}.right-8{right:0.5rem}", a = r, l = class {
4
+ constructor(e) {
5
+ s(this, e), this.dropdown = i(this, "dropdown", 7), this.focusableItems = [], this.handleClick = () => {
6
+ var t;
7
+ this.isOpen = !this.isOpen, this.isOpen ? (this.focusIndex = 0, this.focusItem()) : this.closeDropdown(), this.dropdown.emit({ expanded: this.isOpen }), d({
8
+ category: "ui-component",
9
+ parentContext: null,
10
+ tag: this.host.tagName.toLowerCase(),
11
+ name: ((t = this.label) === null || t === void 0 ? void 0 : t.toLowerCase()) || "",
12
+ action: this.isOpen ? "expanded" : "collapsed"
13
+ });
14
+ }, this.icon = "chevron-down", this.label = void 0, this.rounded = !1, this.ariaLabel = "Open dropdown", this.asNav = !0, this.dropdownPos = "left", this.dropdownOffset = !0, this.intent = "tertiary", this.isOpen = !1, this.focusIndex = -1;
15
+ }
16
+ /**
17
+ * Closes the dropdown when a click occurs outside of it.
18
+ * @param {Event} e - The click event.
19
+ */
20
+ handleWindowClick(e) {
21
+ this.host.contains(e.target) || (this.closeDropdown(), this.dropdown.emit({ expanded: !1 }));
22
+ }
23
+ /**
24
+ * Handles keyboard navigation and accessibility within the dropdown.
25
+ * @param {KeyboardEvent} event - The keyboard event.
26
+ */
27
+ handleKeyDown(e) {
28
+ if (this.isOpen)
29
+ switch (e.key) {
30
+ case "Tab":
31
+ this.closeDropdown(), this.dropdown.emit({ expanded: !1 });
32
+ break;
33
+ case "ArrowUp":
34
+ e.preventDefault(), this.focusIndex = (this.focusIndex - 1 + this.focusableItems.length) % this.focusableItems.length, this.focusItem();
35
+ break;
36
+ case "ArrowDown":
37
+ e.preventDefault(), this.focusIndex = (this.focusIndex + 1) % this.focusableItems.length, this.focusItem();
38
+ break;
39
+ }
40
+ }
41
+ /**
42
+ * Closes the dropdown and resets focus.
43
+ */
44
+ closeDropdown() {
45
+ this.isOpen = !1, this.focusIndex = -1, this.dropdown.emit({ expanded: !1 });
46
+ }
47
+ /**
48
+ * Sets focus on the currently selected item in the dropdown.
49
+ */
50
+ focusItem() {
51
+ var e;
52
+ (e = this.focusableItems[this.focusIndex]) === null || e === void 0 || e.focus();
53
+ }
54
+ /**
55
+ * Lifecycle method that runs after the component has been added to the DOM.
56
+ * Initializes focusable items within the dropdown.
57
+ */
58
+ componentDidLoad() {
59
+ var e;
60
+ this.focusableItems = Array.from(((e = this.dropdownContent) === null || e === void 0 ? void 0 : e.querySelectorAll("a, button")) || []);
61
+ }
62
+ /**
63
+ * Renders the dropdown component and displays its content when open.
64
+ * @returns {JSX.Element} The rendered dropdown component.
65
+ */
66
+ render() {
67
+ return o("div", { key: "3edd3453afbd52ee9e3c4d925baa46e07cfdbfc0", class: "z-focus relative", ref: (e) => this.dropdownContent = e }, o("eds-button", { key: "7c69acb6d6213af2cec8c1e00c68d83a5d23d676", label: this.label, "aria-label": this.ariaLabel, icon: this.icon, intent: this.intent, onClick: this.handleClick, "aria-expanded": this.isOpen.toString(), "aria-haspopup": "menu" }), o("nav", { key: "5048b1c3cb42418736d471c2331330afef49cbc5", role: "menu", class: {
68
+ "shadow-small bg-inverse border-softest z-10 z-on-top absolute top-full mt-4 flex flex-col gap-y-4 border-2 p-8": !0,
69
+ "left-4": this.dropdownPos === "left" && this.dropdownOffset,
70
+ "left-0": this.dropdownPos === "left" && !this.dropdownOffset,
71
+ "right-4": this.dropdownPos === "right" && this.dropdownOffset,
72
+ "right-0": this.dropdownPos === "right" && !this.dropdownOffset,
73
+ "rounded-lg": this.rounded
74
+ }, style: { display: this.isOpen ? "block" : "none" }, "aria-label": "Dropdown", "aria-hidden": !this.isOpen }, o("slot", { key: "842f316e9a7910aa8b34823e883c54c1979668d1" })));
75
+ }
76
+ get host() {
77
+ return n(this);
78
+ }
79
+ };
80
+ l.style = a;
81
+ export {
82
+ l as eds_dropdown
83
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-D4alMZtT.js"),i=require("./analytics-44b1416b-ol77SdQE.js"),n=".z-focus{z-index:99}.relative{position:relative}.shadow-small{--tw-shadow:0px 1.5px 2px rgba(0, 0, 0, 0.1);--tw-shadow-colored:0px 1.5px 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.bg-inverse{background-color:var(--white)}.border-softest{border:2px solid rgba(0, 0, 0, .05)}.z-10{z-index:10}.z-on-top{z-index:99999}.absolute{position:absolute}.top-full{top:100%}.mt-4{margin-top:0.25rem}.mt-6{margin-top:0.375rem}.mt-8{margin-top:0.5rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.flex-col{flex-direction:column}.gap-y-4{row-gap:0.25rem}.rounded-lg{border-radius:16px}.border-2{border-width:2px}.p-8{padding:0.5rem}.left-0{left:0rem}.left-1\\/2{left:50%}.left-4{left:0.25rem}.left-\\[4px\\]{left:4px}.right-0{right:0rem}.right-4{right:0.25rem}.right-8{right:0.5rem}",d=n,s=class{constructor(e){t.registerInstance(this,e),this.dropdown=t.createEvent(this,"dropdown",7),this.focusableItems=[],this.handleClick=()=>{var o;this.isOpen=!this.isOpen,this.isOpen?(this.focusIndex=0,this.focusItem()):this.closeDropdown(),this.dropdown.emit({expanded:this.isOpen}),i.sendAnalytics({category:"ui-component",parentContext:null,tag:this.host.tagName.toLowerCase(),name:((o=this.label)===null||o===void 0?void 0:o.toLowerCase())||"",action:this.isOpen?"expanded":"collapsed"})},this.icon="chevron-down",this.label=void 0,this.rounded=!1,this.ariaLabel="Open dropdown",this.asNav=!0,this.dropdownPos="left",this.dropdownOffset=!0,this.intent="tertiary",this.isOpen=!1,this.focusIndex=-1}handleWindowClick(e){this.host.contains(e.target)||(this.closeDropdown(),this.dropdown.emit({expanded:!1}))}handleKeyDown(e){if(this.isOpen)switch(e.key){case"Tab":this.closeDropdown(),this.dropdown.emit({expanded:!1});break;case"ArrowUp":e.preventDefault(),this.focusIndex=(this.focusIndex-1+this.focusableItems.length)%this.focusableItems.length,this.focusItem();break;case"ArrowDown":e.preventDefault(),this.focusIndex=(this.focusIndex+1)%this.focusableItems.length,this.focusItem();break}}closeDropdown(){this.isOpen=!1,this.focusIndex=-1,this.dropdown.emit({expanded:!1})}focusItem(){var e;(e=this.focusableItems[this.focusIndex])===null||e===void 0||e.focus()}componentDidLoad(){var e;this.focusableItems=Array.from(((e=this.dropdownContent)===null||e===void 0?void 0:e.querySelectorAll("a, button"))||[])}render(){return t.h("div",{key:"3edd3453afbd52ee9e3c4d925baa46e07cfdbfc0",class:"z-focus relative",ref:e=>this.dropdownContent=e},t.h("eds-button",{key:"7c69acb6d6213af2cec8c1e00c68d83a5d23d676",label:this.label,"aria-label":this.ariaLabel,icon:this.icon,intent:this.intent,onClick:this.handleClick,"aria-expanded":this.isOpen.toString(),"aria-haspopup":"menu"}),t.h("nav",{key:"5048b1c3cb42418736d471c2331330afef49cbc5",role:"menu",class:{"shadow-small bg-inverse border-softest z-10 z-on-top absolute top-full mt-4 flex flex-col gap-y-4 border-2 p-8":!0,"left-4":this.dropdownPos==="left"&&this.dropdownOffset,"left-0":this.dropdownPos==="left"&&!this.dropdownOffset,"right-4":this.dropdownPos==="right"&&this.dropdownOffset,"right-0":this.dropdownPos==="right"&&!this.dropdownOffset,"rounded-lg":this.rounded},style:{display:this.isOpen?"block":"none"},"aria-label":"Dropdown","aria-hidden":!this.isOpen},t.h("slot",{key:"842f316e9a7910aa8b34823e883c54c1979668d1"})))}get host(){return t.getElement(this)}};s.style=d;exports.eds_dropdown=s;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-D4alMZtT.js"),a=require("./sharedUtils-a550989c-m4pF1Vqy.js"),r="h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}.text-light{color:var(--grey-700)}.text-lighter{color:var(--grey-600)}.text-lightest{color:var(--grey-500)}.f-body-01{font-family:var(--f-body-01-fontFamily);font-weight:var(--f-body-01-fontWeight);font-size:var(--f-body-01-fontSize);line-height:var(--f-body-01-lineHeight);letter-spacing:var(--f-body-01-letterSpacing)}.f-heading-02{font-family:var(--f-heading-02-fontFamily);font-weight:var(--f-heading-02-fontWeight);font-size:var(--f-heading-02-fontSize);line-height:var(--f-heading-02-lineHeight);letter-spacing:var(--f-heading-02-letterSpacing)}.f-heading-03{font-family:var(--f-heading-03-fontFamily);font-weight:var(--f-heading-03-fontWeight);font-size:var(--f-heading-03-fontSize);line-height:var(--f-heading-03-lineHeight);letter-spacing:var(--f-heading-03-letterSpacing)}.f-heading-04{font-family:var(--f-heading-04-fontFamily);font-weight:var(--f-heading-04-fontWeight);font-size:var(--f-heading-04-fontSize);line-height:var(--f-heading-04-lineHeight);letter-spacing:var(--f-heading-04-letterSpacing)}.f-heading-05{font-family:var(--f-heading-05-fontFamily);font-weight:var(--f-heading-05-fontWeight);font-size:var(--f-heading-05-fontSize);line-height:var(--f-heading-05-lineHeight);letter-spacing:var(--f-heading-05-letterSpacing)}.f-heading-06{font-family:var(--f-heading-06-fontFamily);font-weight:var(--f-heading-06-fontWeight);font-size:var(--f-heading-06-fontSize);line-height:var(--f-heading-06-lineHeight);letter-spacing:var(--f-heading-06-letterSpacing)}.f-body-01{font-family:var(--f-body-01-fontFamily);font-weight:var(--f-body-01-fontWeight);font-size:var(--f-body-01-fontSize);line-height:var(--f-body-01-lineHeight);letter-spacing:var(--f-body-01-letterSpacing)}.f-body-02{font-family:var(--f-body-02-fontFamily);font-weight:var(--f-body-02-fontWeight);font-size:var(--f-body-02-fontSize);line-height:var(--f-body-02-lineHeight);letter-spacing:var(--f-body-02-letterSpacing)}.f-ui-04{font-family:var(--f-ui-04-fontFamily);font-weight:var(--f-ui-04-fontWeight);font-size:var(--f-ui-04-fontSize);line-height:var(--f-ui-04-lineHeight);letter-spacing:var(--f-ui-04-letterSpacing)}.inline{display:inline}.grid{display:grid}.flex{display:flex}.inline-flex{display:inline-flex}.flex-col{flex-direction:column}.my-4{margin-top:0.25rem;margin-bottom:0.25rem}.my-8{margin-top:0.5rem;margin-bottom:0.5rem}.my-16{margin-top:1rem;margin-bottom:1rem}.my-20{margin-top:1.25rem;margin-bottom:1.25rem}",f=r,n=class{constructor(t){e.registerInstance(this,t),this.rating=e.createEvent(this,"rating",7),this.type="star",this.count=5,this.label="Rate your Experience!",this.description="This is a description!",this.textMapping=["Very Poor","Poor","Average","Good","Excellent"],this.selectedRating=0}componentDidLoad(){this.el.shadowRoot.querySelectorAll("eds-button").forEach(i=>{this.emitContext(i)})}emitContext(t){const i=new CustomEvent("parentContext",{detail:{componentName:this.el.tagName.toLowerCase(),identifier:this.selectedRating}});t.dispatchEvent(i)}get parsedMappings(){return a.parseData(this.textMapping)}ratingUpdated(t){this.selectedRating=t.detail}render(){return e.h("div",{key:"125299e9780486a10213fc3c59b15e7a4fb62616",class:"grid inline"},e.h("p",{key:"6a02d78d34a590bc213cd5bf311ec8bed44f8959",class:"f-heading-03 my-4"},this.label),e.h("p",{key:"76146fbade2f864ba7b72429a85218ebf6a24ea7",class:"f-body-02 text-light"},this.description),e.h("eds-rating",{key:"38e0ec9219adaf85f674fab6be471112f06e42ff","rating-type":this.type,"rating-count":this.count}),this.selectedRating>0&&this.parsedMappings[this.selectedRating-1]&&e.h("span",{key:"beab34888d3db63ca2ee374a2d10d407bfc948cc",class:"f-ui-04 text-lighter"},this.parsedMappings[this.selectedRating-1]))}get el(){return e.getElement(this)}};n.style=f;exports.eds_feedback=n;
@@ -0,0 +1,53 @@
1
+ import { r as n, c as a, h as t, g as f } from "./index-E1PpO1J3.mjs";
2
+ import { p as r } from "./sharedUtils-a550989c-Ci3Tx3jc.mjs";
3
+ const o = "h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}.text-light{color:var(--grey-700)}.text-lighter{color:var(--grey-600)}.text-lightest{color:var(--grey-500)}.f-body-01{font-family:var(--f-body-01-fontFamily);font-weight:var(--f-body-01-fontWeight);font-size:var(--f-body-01-fontSize);line-height:var(--f-body-01-lineHeight);letter-spacing:var(--f-body-01-letterSpacing)}.f-heading-02{font-family:var(--f-heading-02-fontFamily);font-weight:var(--f-heading-02-fontWeight);font-size:var(--f-heading-02-fontSize);line-height:var(--f-heading-02-lineHeight);letter-spacing:var(--f-heading-02-letterSpacing)}.f-heading-03{font-family:var(--f-heading-03-fontFamily);font-weight:var(--f-heading-03-fontWeight);font-size:var(--f-heading-03-fontSize);line-height:var(--f-heading-03-lineHeight);letter-spacing:var(--f-heading-03-letterSpacing)}.f-heading-04{font-family:var(--f-heading-04-fontFamily);font-weight:var(--f-heading-04-fontWeight);font-size:var(--f-heading-04-fontSize);line-height:var(--f-heading-04-lineHeight);letter-spacing:var(--f-heading-04-letterSpacing)}.f-heading-05{font-family:var(--f-heading-05-fontFamily);font-weight:var(--f-heading-05-fontWeight);font-size:var(--f-heading-05-fontSize);line-height:var(--f-heading-05-lineHeight);letter-spacing:var(--f-heading-05-letterSpacing)}.f-heading-06{font-family:var(--f-heading-06-fontFamily);font-weight:var(--f-heading-06-fontWeight);font-size:var(--f-heading-06-fontSize);line-height:var(--f-heading-06-lineHeight);letter-spacing:var(--f-heading-06-letterSpacing)}.f-body-01{font-family:var(--f-body-01-fontFamily);font-weight:var(--f-body-01-fontWeight);font-size:var(--f-body-01-fontSize);line-height:var(--f-body-01-lineHeight);letter-spacing:var(--f-body-01-letterSpacing)}.f-body-02{font-family:var(--f-body-02-fontFamily);font-weight:var(--f-body-02-fontWeight);font-size:var(--f-body-02-fontSize);line-height:var(--f-body-02-lineHeight);letter-spacing:var(--f-body-02-letterSpacing)}.f-ui-04{font-family:var(--f-ui-04-fontFamily);font-weight:var(--f-ui-04-fontWeight);font-size:var(--f-ui-04-fontSize);line-height:var(--f-ui-04-lineHeight);letter-spacing:var(--f-ui-04-letterSpacing)}.inline{display:inline}.grid{display:grid}.flex{display:flex}.inline-flex{display:inline-flex}.flex-col{flex-direction:column}.my-4{margin-top:0.25rem;margin-bottom:0.25rem}.my-8{margin-top:0.5rem;margin-bottom:0.5rem}.my-16{margin-top:1rem;margin-bottom:1rem}.my-20{margin-top:1.25rem;margin-bottom:1.25rem}", g = o, h = class {
4
+ constructor(e) {
5
+ n(this, e), this.rating = a(this, "rating", 7), this.type = "star", this.count = 5, this.label = "Rate your Experience!", this.description = "This is a description!", this.textMapping = ["Very Poor", "Poor", "Average", "Good", "Excellent"], this.selectedRating = 0;
6
+ }
7
+ /**
8
+ * Lifecycle method that runs when the component has fully loaded.
9
+ * It emits a custom event for each `eds-button` element contained within the breadcrumb.
10
+ */
11
+ componentDidLoad() {
12
+ this.el.shadowRoot.querySelectorAll("eds-button").forEach((i) => {
13
+ this.emitContext(i);
14
+ });
15
+ }
16
+ /**
17
+ * Emits a custom event called `parentContext` for a given link element.
18
+ * This event provides context information about the breadcrumb component.
19
+ *
20
+ * @param btnElement - The link element to which the event will be dispatched.
21
+ */
22
+ emitContext(e) {
23
+ const i = new CustomEvent("parentContext", {
24
+ detail: {
25
+ componentName: this.el.tagName.toLowerCase(),
26
+ identifier: this.selectedRating
27
+ }
28
+ });
29
+ e.dispatchEvent(i);
30
+ }
31
+ /**
32
+ * Parses the `textMapping` prop into an array of strings.
33
+ */
34
+ get parsedMappings() {
35
+ return r(this.textMapping);
36
+ }
37
+ /**
38
+ * Listens for global custom events to open the modal.
39
+ */
40
+ ratingUpdated(e) {
41
+ this.selectedRating = e.detail;
42
+ }
43
+ render() {
44
+ return t("div", { key: "125299e9780486a10213fc3c59b15e7a4fb62616", class: "grid inline" }, t("p", { key: "6a02d78d34a590bc213cd5bf311ec8bed44f8959", class: "f-heading-03 my-4" }, this.label), t("p", { key: "76146fbade2f864ba7b72429a85218ebf6a24ea7", class: "f-body-02 text-light" }, this.description), t("eds-rating", { key: "38e0ec9219adaf85f674fab6be471112f06e42ff", "rating-type": this.type, "rating-count": this.count }), this.selectedRating > 0 && this.parsedMappings[this.selectedRating - 1] && t("span", { key: "beab34888d3db63ca2ee374a2d10d407bfc948cc", class: "f-ui-04 text-lighter" }, this.parsedMappings[this.selectedRating - 1]));
45
+ }
46
+ get el() {
47
+ return f(this);
48
+ }
49
+ };
50
+ h.style = g;
51
+ export {
52
+ h as eds_feedback
53
+ };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-D_kZU_4I.js"),g=require("./toastManager-d9eee791-DvR_vUPI.js"),x=require("./analytics-1cde8e4a-B_MD-9qW.js"),h=`@font-face {
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-D4alMZtT.js"),b=require("./toastManager-d9eee791-DvR_vUPI.js"),a=require("./analytics-44b1416b-ol77SdQE.js"),h=require("./sharedUtils-a550989c-m4pF1Vqy.js"),s=require("./formUtils-ac68474d-BDuxB0K8.js");async function f(e){const i=await e.json().catch(()=>({}));return e.ok?i:null}async function c(e,i,n={}){const r=i instanceof FormData?n.headers||{}:Object.assign({"Content-Type":"application/json"},n.headers),l=await fetch(e,{method:"POST",headers:r,body:i instanceof FormData?i:JSON.stringify(i)});return f(l)}const m=`@font-face {
2
2
  font-family: "Inter";
3
3
  font-weight: 100 900;
4
4
  font-display: swap;
@@ -7150,4 +7150,4 @@
7150
7150
  padding-right: 0rem;
7151
7151
  }
7152
7152
  }
7153
- `,f=h,b=class{constructor(e){d.registerInstance(this,e),this.formSubmitting=d.createEvent(this,"formSubmitting",7),this.handleChange=(r,n)=>{const i=r.target;this.values=Object.assign(Object.assign({},this.values),{[n.name]:i.value});const l=Object.assign({},this.errors);if(n.type==="checkbox"||n.type==="radio")if(n.options){const t=this.validateFieldGroup(n.name,n.type,n.required);t.length>0?l[n.name]=t:delete l[n.name]}else{const t=this.validateSingleBox(n.name,n.required);t.length>0?l[n.name]=t:delete l[n.name]}else{const t=this.validateField(n.name,i.value,n.type,n.required,n.maxlength);t.length>0?l[n.name]=t:delete l[n.name]}this.errors=l,this.hasError=Object.keys(l).length>0},this.handleSubmit=async r=>{var n,i,l;if(r.preventDefault(),this.isSubmitting)return;if(this.validateForm(),this.hasError){x.sendAnalytics({category:"ui-component",parentContext:null,tag:this.el.tagName.toLowerCase(),name:`${(n=this.submitBtnLabel)===null||n===void 0?void 0:n.toLowerCase()}/error`||"",action:"click"}),this.alertMessage=this.errorMessage;return}this.isSubmitting=!0,this.formSubmitted=!1,this.alertMessage=null,this.errors={};const t=await this.getFormData();this.setFormUrl&&typeof window<"u"&&t.set("form_url",window.location.href),this.authUser&&t.set("form_user",(i=this.authUser)===null||i===void 0?void 0:i.email);const s=this.coupleAuth?{Authorization:`Bearer ${this.authUser.token}`}:{};try{const o=await fetch(this.endpoint,{method:"POST",body:t,headers:s});if(!o.ok){const c=await o.json();this.hasError=!0,g.toast.show(c.error||this.errorMessage,"error");return}const a=await o.json();this.formSubmitted=!0,g.toast.show(a.message||this.successMessage,"success"),this.formEl.reset(),x.sendAnalytics({category:"ui-component",parentContext:null,tag:this.el.tagName.toLowerCase(),name:`${(l=this.submitBtnLabel)===null||l===void 0?void 0:l.toLowerCase()}/success`||"",action:"click"})}catch(o){this.hasError=!0,g.toast.show(`${o}`,"error")}finally{this.isSubmitting=!1,this.formSubmitting.emit(this.isSubmitting)}},this.setFormUrl=!0,this.submitBtn=!0,this.submitBtnLabel="Submit",this.successMessage="Your message has been sent.",this.errorMessage="Some fields in your form are incorrect.",this.submitBtnHintMessage="To participate, please sign in using your EBRAINS account. If you do not have an account yet, you can easily create one on the EBRAINS portal.",this.endpoint=void 0,this.name="form",this.fields=[],this.values={},this.coupleAuth=!1,this.formSubmitted=!1,this.hasError=!1,this.errors={},this.isSubmitting=!1,this.alertMessage=null,this.isAuthenticated=!1,this.authUser=void 0,this.parsedFields=[]}onAuthStatusChanged(e){var r;this.isAuthenticated=(r=e.detail)===null||r===void 0?void 0:r.authenticated,this.authUser=e.detail.user}componentDidLoad(){this.parseFields(this.fields)}isFieldVisible(e){return e.condition?this.values[e.condition.field]===e.condition.value:!0}validateField(e,r,n,i,l){const t=[];return i&&!r&&t.push(`${e} is required.`),l&&typeof r=="string"&&r.length>l&&t.push(`${e} must be at most ${l} characters.`),n==="email"&&r&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r.toString())&&t.push("Invalid email format."),t}validateFieldGroup(e,r,n){const t=Array.from(this.formEl.querySelectorAll("eds-input-field")).filter(o=>{var a,c;return((c=(a=o.shadowRoot)===null||a===void 0?void 0:a.querySelectorAll(`input[name="${e}"]`))===null||c===void 0?void 0:c.length)>0}).flatMap(o=>{var a;return Array.from(((a=o.shadowRoot)===null||a===void 0?void 0:a.querySelectorAll(`input[name="${e}"]`))||[])}).some(o=>o.checked),s=[];return n&&!t&&s.push(`At least one option in ${e} is required.`),s}validateSingleBox(e,r){var n;const i=[],l=Array.from(this.formEl.querySelectorAll("eds-input-field")).find(s=>{var o;return(o=s.shadowRoot)===null||o===void 0?void 0:o.querySelector(`[name="${e}"]`)});if(!l)return r&&i.push(`${e} is required.`),i;const t=(n=l.shadowRoot)===null||n===void 0?void 0:n.querySelector(`[name="${e}"]`);return r&&t&&!t.checked&&i.push(`${e} is required.`),i}validateForm(){this.errors={},this.hasError=!1,this.parsedFields.forEach(e=>{if(e.type!=="hidden")if((e.type==="checkbox"||e.type==="radio")&&!e.options){const r=this.validateSingleBox(e.name,e.required);r.length>0&&(this.errors[e.name]=r,this.hasError=!0)}else if(e.options&&(e.type==="checkbox"||e.type==="radio")){const r=this.validateFieldGroup(e.name,e.type,e.required);r.length>0&&(this.errors[e.name]=r,this.hasError=!0)}else{const r=this.findFieldElement(e.name);if(r){const n=r.value,i=this.validateField(e.name,n,e.type,e.required,e.maxlength);i.length>0&&(this.errors[e.name]=i,this.hasError=!0)}}})}findFieldElement(e){const r=Array.from(this.formEl.querySelectorAll("eds-input-field"));for(const n of r)if(n.shadowRoot){const i=n.shadowRoot.querySelector(`[name="${e}"]`);if(i)return i}return null}async getFormData(){const e=new FormData;return e.append("form_name",this.name),Array.from(this.formEl.querySelectorAll("eds-input-field")).forEach(n=>{if(n.shadowRoot){const i=n.shadowRoot.querySelector("input, textarea, select");if(i&&i.name)if(i.type==="checkbox"||i.type==="radio"){const t=Array.from(n.shadowRoot.querySelectorAll(`input[name="${i.name}"]:checked`)).map(s=>s.value);e.append(i.name,t.join(","))}else if(i.type==="file"){const l=i;l.files&&l.files.length>0&&Array.from(l.files).forEach(t=>{e.append(l.name,t)})}else e.append(i.name,i.value)}}),e}parseFields(e){try{typeof e=="string"?this.parsedFields=JSON.parse(e):Array.isArray(e)?this.parsedFields=e:e&&typeof e=="object"?this.parsedFields=e:this.parsedFields=[]}catch(r){console.error("Error parsing fields prop:",r),this.parsedFields=[]}}render(){const e=this.parsedFields.filter(n=>n.type==="hidden"),r=this.parsedFields.filter(n=>n.type!=="hidden");return d.h("form",{key:"3d4ae34d48c0551f9de6dacb50ceee15b487b5de",ref:n=>this.formEl=n,enctype:"multipart/form-data",autocomplete:"on",method:"post",onSubmit:this.handleSubmit},d.h("div",{key:"344c56dcba3de5a1b55255d794a78fb0f19d04b5"},d.h("slot",{key:"3ca6d203458d67fa66840fac55f94d71acc2ee4d"}),e.map((n,i)=>d.h("eds-input",{key:i,type:"hidden",name:n.name,value:n.value})),r.map((n,i)=>{var l,t;return this.isFieldVisible(n)?d.h("eds-input-field",{key:i,name:n.name,id:`${this.name}_${n.name}`,label:n.label,type:n.type,icon:n.icon||null,required:n.required,maxLength:n.maxlength,hint:n.hint,error:((l=this.errors[n.name])===null||l===void 0?void 0:l.length)>0,errorMessage:(t=this.errors[n.name])===null||t===void 0?void 0:t.join("<br />"),onInput:s=>this.handleChange(s,n),class:i>0?"mt-20":"",options:n.options}):null})),this.submitBtn&&d.h("div",{key:"22915285f3522f6d260e358eea964c59a9557a55",class:"mt-20"},d.h("eds-button",{key:"9e2191ba8cc49d7ac2a6588c0fa468214773c791",intent:"primary",label:this.submitBtnLabel,disabled:this.isSubmitting||this.coupleAuth&&!this.isAuthenticated,loading:this.isSubmitting,onClick:n=>this.handleSubmit(n)}),this.coupleAuth&&!this.isAuthenticated?d.h("p",{class:"f-ui-05 text-lighter mt-8 ml-8"},this.submitBtnHintMessage):null),this.alertMessage&&(this.formSubmitted||this.hasError)&&d.h("div",{key:"8045c3dff26286a6735157b82afd56ec9001ba14",class:"mt-20"},d.h("eds-alert",{key:"dc8c8f74e8aada9023f110bb862afee1fb629601",message:this.alertMessage,intent:this.hasError?"error":"success",direction:"horizontal"})))}get el(){return d.getElement(this)}static get watchers(){return{fields:["parseFields"]}}};b.style=f;exports.eds_form=b;
7153
+ `,p=m,g=class{constructor(e){o.registerInstance(this,e),this.form=o.createEvent(this,"form",7),this.setFormUrl=!0,this.submitBtn=!0,this.submitBtnLabel="Submit",this.successMessage="Your message has been sent.",this.errorMessage="Some fields in your form are incorrect.",this.submitBtnHintMessage="To participate, please sign in using your EBRAINS account. If you do not have an account yet, you can easily create one on the EBRAINS portal.",this.endpoint=void 0,this.name="eds-form",this.fields=[],this.coupleAuth=!1,this.user=null,this.draft=!1,this.draftData={},this.values={},this.formSubmitted=!1,this.hasError=!1,this.errors={},this.isSubmitting=!1,this.alertMessage=null,this.isAuthenticated=!1,this.parsedFields=[]}async componentWillLoad(){this.parseFields(this.fields),this.el.querySelectorAll("eds-button").forEach(i=>{this.emitContext(i)})}async componentDidLoad(){this.shouldFormProcessDraft&&this.loadDraft()}get shouldFormAcceptDraft(){var e;return!!(!((e=this.user)===null||e===void 0)&&e.token&&this.draft)}get shouldFormProcessDraft(){var e;return!!(!((e=this.draftData)===null||e===void 0)&&e._id)}parseFields(e){this.parsedFields=h.parseData(e)}loadDraft(){var e;if(!((e=this.draftData)===null||e===void 0)&&e.completed){this.formSubmitted=!0,b.toast.show(this.draftData.message,"success"),this.formEl.reset();return}this.populateFormWithDraftData(this.draftData)}emitContext(e){const i=new CustomEvent("parentContext",{detail:{componentName:this.el.tagName.toLowerCase(),identifier:null}});e.dispatchEvent(i)}isFieldVisible(e){return e.condition?this.values[e.condition.field]===e.condition.value:!0}validateForm(){const{errors:e,hasError:i}=s.validateFormFields(this.parsedFields,this.formEl,this.values,(n,r)=>n.condition?r[n.condition.field]===n.condition.value:!0);this.errors=e,this.hasError=i}populateFormWithDraftData(e){const{updatedValues:i}=s.getFormDraftData({draftData:e,parsedFields:this.parsedFields,currentValues:this.values,formEl:this.formEl,isFieldVisible:(n,r)=>n.condition?r[n.condition.field]===n.condition.value:!0});this.values=i}getFormData(){var e;const i=new FormData;return i.append("form_name",this.name),this.setFormUrl&&typeof window<"u"&&i.set("form_url",window.location.href),this.user&&i.set("form_user",(e=this.user)===null||e===void 0?void 0:e.email),Array.from(this.formEl.querySelectorAll("eds-input-field")).forEach(r=>{if(r.shadowRoot){const l=r.shadowRoot.querySelector("input, textarea, select");if(l&&l.name)if(l.type==="checkbox"||l.type==="radio"){const d=Array.from(r.shadowRoot.querySelectorAll(`input[name="${l.name}"]:checked`)).map(x=>x.value);i.append(l.name,d.join(","))}else if(l.type==="file"){const t=l;t.files&&t.files.length>0&&Array.from(t.files).forEach(d=>{i.append(t.name,d)})}else i.append(l.name,l.value)}}),i}handleChange(e,i){const n=e.target;this.values=Object.assign(Object.assign({},this.values),{[i.name]:n.value}),this.form.emit({event:"change",field:i.name,value:n.value,message:`${i.name} updated`,data:this.getFormData()}),this.shouldFormAcceptDraft&&this.postFormDataWithoutValidation()}handleInput(e,i){const n=e.target;this.values=Object.assign(Object.assign({},this.values),{[i.name]:n.value});const r=Object.assign({},this.errors),l=s.validateInputField(i,n.value,this.formEl);l.length>0?r[i.name]=l:delete r[i.name],this.errors=r,this.hasError=Object.keys(r).length>0}async handleSubmit(e){var i,n;if(e.preventDefault(),this.isSubmitting)return;if(this.validateForm(),this.hasError){this.form.emit({event:"submit",validated:!1,success:!1,message:this.errorMessage,data:this.getFormData()}),a.sendAnalytics({category:"ui-component",parentContext:null,tag:this.el.tagName.toLowerCase(),name:`${(i=this.submitBtnLabel)===null||i===void 0?void 0:i.toLowerCase()}/error`||"",action:"click"}),this.alertMessage=this.errorMessage;return}this.isSubmitting=!0,this.formSubmitted=!1,this.alertMessage=null,this.errors={};const r=await this.getFormData();if(r.set("draft","false"),r.set("completed","true"),!this.endpoint){this.form.emit({event:"submit",success:!0,validated:!0,message:"Form data validated successfully",data:r}),this.formSubmitted=!0,this.formEl.reset(),this.isSubmitting=!1;return}const l={Authorization:`Bearer ${this.user.token}`};try{const t=await c(this.endpoint,r,{headers:l});this.form.emit({event:"submit",success:!0,validated:!0,message:t.message,data:r}),this.formSubmitted=!0,this.formEl.reset(),a.sendAnalytics({category:"ui-component",parentContext:null,tag:this.el.tagName.toLowerCase(),name:`${(n=this.submitBtnLabel)===null||n===void 0?void 0:n.toLowerCase()}/success`||"",action:"click"})}catch(t){this.hasError=!0,this.form.emit({event:"submit",success:!1,validated:!0,message:t,data:r})}finally{this.isSubmitting=!1}}async postFormDataWithoutValidation(){var e;if(!this.endpoint)return;const i=await this.getFormData();i.set("draft",this.draft.toString());const n={Authorization:`Bearer ${(e=this.user)===null||e===void 0?void 0:e.token}`};try{await c(this.endpoint,i,{headers:n})}catch(r){throw r}}render(){const e=this.parsedFields.filter(n=>n.type==="hidden"),i=this.parsedFields.filter(n=>n.type!=="hidden");return o.h("form",{key:"7ea50f19b8810fb0294bc8527d1c86e74dfc2b69",ref:n=>this.formEl=n,enctype:"multipart/form-data",autocomplete:"on",method:"post",onSubmit:this.handleSubmit},o.h("div",{key:"29e821a2eb706c51fa303b1abf645baeea5ae9d4"},o.h("slot",{key:"b45d74e9a147ab1a932891210c7813d3bd118b07"}),e.map((n,r)=>o.h("eds-input",{key:r,type:"hidden",name:n.name,value:n.value})),i.map((n,r)=>{var l,t;return this.isFieldVisible(n)?o.h("eds-input-field",{key:r,name:n.name,id:`${this.name}_${n.name}`,label:n.label,type:n.type,icon:n.icon||null,required:n.required,maxLength:n.maxlength,hint:n.hint,error:((l=this.errors[n.name])===null||l===void 0?void 0:l.length)>0,errorMessage:(t=this.errors[n.name])===null||t===void 0?void 0:t.join("<br />"),onInput:d=>this.handleInput(d,n),onChange:d=>this.handleChange(d,n),class:r>0?"mt-20":"",options:n.options}):null})),this.submitBtn&&o.h("div",{key:"0a9b9027fc235cd099cc40903bd6711873b9868b",class:"mt-20"},o.h("eds-button",{key:"f7181c19d04a117817f556753cc95c1f49c9fa1c",intent:"primary",label:this.submitBtnLabel,disabled:this.isSubmitting||this.coupleAuth&&!this.isAuthenticated||this.formSubmitted,loading:this.isSubmitting,onClick:n=>this.handleSubmit(n)}),this.coupleAuth&&!this.isAuthenticated?o.h("p",{class:"f-ui-05 text-lighter mt-8 ml-8"},this.submitBtnHintMessage):null),this.alertMessage&&(this.formSubmitted||this.hasError)&&o.h("div",{key:"b999356ec8fc57fc85c2f672a94e95f834d153ea",class:"mt-20"},o.h("eds-alert",{key:"5a743b01991fb5d8f5358abc44639e790f5264ea",message:this.alertMessage,intent:this.hasError?"error":"success",direction:"horizontal"})))}get el(){return o.getElement(this)}static get watchers(){return{fields:["parseFields"]}}};g.style=p;exports.eds_form=g;
@@ -1,7 +1,21 @@
1
- import { r as b, c as h, h as s, g as f } from "./index-C-Gy1Lax.mjs";
2
- import { t as g } from "./toastManager-d9eee791-CEYNwx25.mjs";
3
- import { s as x } from "./analytics-1cde8e4a-BDRcCMlV.mjs";
4
- const m = `@font-face {
1
+ import { r as g, c as x, h as o, g as b } from "./index-E1PpO1J3.mjs";
2
+ import { t as h } from "./toastManager-d9eee791-CEYNwx25.mjs";
3
+ import { s } from "./analytics-44b1416b-3vYuu4Xs.mjs";
4
+ import { p as f } from "./sharedUtils-a550989c-Ci3Tx3jc.mjs";
5
+ import { v as m, b as p, a as u } from "./formUtils-ac68474d-D2e59S7S.mjs";
6
+ async function y(e) {
7
+ const i = await e.json().catch(() => ({}));
8
+ return e.ok ? i : null;
9
+ }
10
+ async function a(e, i, n = {}) {
11
+ const r = i instanceof FormData ? n.headers || {} : Object.assign({ "Content-Type": "application/json" }, n.headers), l = await fetch(e, {
12
+ method: "POST",
13
+ headers: r,
14
+ body: i instanceof FormData ? i : JSON.stringify(i)
15
+ });
16
+ return y(l);
17
+ }
18
+ const v = `@font-face {
5
19
  font-family: "Inter";
6
20
  font-weight: 100 900;
7
21
  font-display: swap;
@@ -7153,180 +7167,181 @@ const m = `@font-face {
7153
7167
  padding-right: 0rem;
7154
7168
  }
7155
7169
  }
7156
- `, p = m, y = class {
7170
+ `, w = v, k = class {
7157
7171
  constructor(e) {
7158
- b(this, e), this.formSubmitting = h(this, "formSubmitting", 7), this.handleChange = (r, n) => {
7159
- const i = r.target;
7160
- this.values = Object.assign(Object.assign({}, this.values), { [n.name]: i.value });
7161
- const l = Object.assign({}, this.errors);
7162
- if (n.type === "checkbox" || n.type === "radio")
7163
- if (n.options) {
7164
- const t = this.validateFieldGroup(n.name, n.type, n.required);
7165
- t.length > 0 ? l[n.name] = t : delete l[n.name];
7166
- } else {
7167
- const t = this.validateSingleBox(n.name, n.required);
7168
- t.length > 0 ? l[n.name] = t : delete l[n.name];
7169
- }
7170
- else {
7171
- const t = this.validateField(n.name, i.value, n.type, n.required, n.maxlength);
7172
- t.length > 0 ? l[n.name] = t : delete l[n.name];
7173
- }
7174
- this.errors = l, this.hasError = Object.keys(l).length > 0;
7175
- }, this.handleSubmit = async (r) => {
7176
- var n, i, l;
7177
- if (r.preventDefault(), this.isSubmitting)
7178
- return;
7179
- if (this.validateForm(), this.hasError) {
7180
- x({
7181
- category: "ui-component",
7182
- parentContext: null,
7183
- tag: this.el.tagName.toLowerCase(),
7184
- name: `${(n = this.submitBtnLabel) === null || n === void 0 ? void 0 : n.toLowerCase()}/error` || "",
7185
- action: "click"
7186
- }), this.alertMessage = this.errorMessage;
7187
- return;
7188
- }
7189
- this.isSubmitting = !0, this.formSubmitted = !1, this.alertMessage = null, this.errors = {};
7190
- const t = await this.getFormData();
7191
- this.setFormUrl && typeof window < "u" && t.set("form_url", window.location.href), this.authUser && t.set("form_user", (i = this.authUser) === null || i === void 0 ? void 0 : i.email);
7192
- const d = this.coupleAuth ? { Authorization: `Bearer ${this.authUser.token}` } : {};
7193
- try {
7194
- const o = await fetch(this.endpoint, {
7195
- method: "POST",
7196
- body: t,
7197
- headers: d
7198
- });
7199
- if (!o.ok) {
7200
- const c = await o.json();
7201
- this.hasError = !0, g.show(c.error || this.errorMessage, "error");
7202
- return;
7203
- }
7204
- const a = await o.json();
7205
- this.formSubmitted = !0, g.show(a.message || this.successMessage, "success"), this.formEl.reset(), x({
7206
- category: "ui-component",
7207
- parentContext: null,
7208
- tag: this.el.tagName.toLowerCase(),
7209
- name: `${(l = this.submitBtnLabel) === null || l === void 0 ? void 0 : l.toLowerCase()}/success` || "",
7210
- action: "click"
7211
- });
7212
- } catch (o) {
7213
- this.hasError = !0, g.show(`${o}`, "error");
7214
- } finally {
7215
- this.isSubmitting = !1, this.formSubmitting.emit(this.isSubmitting);
7216
- }
7217
- }, this.setFormUrl = !0, this.submitBtn = !0, this.submitBtnLabel = "Submit", this.successMessage = "Your message has been sent.", this.errorMessage = "Some fields in your form are incorrect.", this.submitBtnHintMessage = "To participate, please sign in using your EBRAINS account. If you do not have an account yet, you can easily create one on the EBRAINS portal.", this.endpoint = void 0, this.name = "form", this.fields = [], this.values = {}, this.coupleAuth = !1, this.formSubmitted = !1, this.hasError = !1, this.errors = {}, this.isSubmitting = !1, this.alertMessage = null, this.isAuthenticated = !1, this.authUser = void 0, this.parsedFields = [];
7172
+ g(this, e), this.form = x(this, "form", 7), this.setFormUrl = !0, this.submitBtn = !0, this.submitBtnLabel = "Submit", this.successMessage = "Your message has been sent.", this.errorMessage = "Some fields in your form are incorrect.", this.submitBtnHintMessage = "To participate, please sign in using your EBRAINS account. If you do not have an account yet, you can easily create one on the EBRAINS portal.", this.endpoint = void 0, this.name = "eds-form", this.fields = [], this.coupleAuth = !1, this.user = null, this.draft = !1, this.draftData = {}, this.values = {}, this.formSubmitted = !1, this.hasError = !1, this.errors = {}, this.isSubmitting = !1, this.alertMessage = null, this.isAuthenticated = !1, this.parsedFields = [];
7218
7173
  }
7219
- onAuthStatusChanged(e) {
7220
- var r;
7221
- this.isAuthenticated = (r = e.detail) === null || r === void 0 ? void 0 : r.authenticated, this.authUser = e.detail.user;
7174
+ async componentWillLoad() {
7175
+ this.parseFields(this.fields), this.el.querySelectorAll("eds-button").forEach((i) => {
7176
+ this.emitContext(i);
7177
+ });
7222
7178
  }
7223
- componentDidLoad() {
7224
- this.parseFields(this.fields);
7179
+ async componentDidLoad() {
7180
+ this.shouldFormProcessDraft && this.loadDraft();
7225
7181
  }
7226
- /*emitContext(linkElement: HTMLElement) {
7227
- const event = new CustomEvent<ParentContextDetail>('parentContext', {
7228
- detail: {
7229
- componentName: this.el.tagName.toLowerCase(),
7230
- identifier: null
7231
- }
7232
- });
7233
-
7234
- linkElement.dispatchEvent(event);
7235
- }*/
7236
- // Visibility helper
7237
- isFieldVisible(e) {
7238
- return e.condition ? this.values[e.condition.field] === e.condition.value : !0;
7182
+ get shouldFormAcceptDraft() {
7183
+ var e;
7184
+ return !!(!((e = this.user) === null || e === void 0) && e.token && this.draft);
7185
+ }
7186
+ get shouldFormProcessDraft() {
7187
+ var e;
7188
+ return !!(!((e = this.draftData) === null || e === void 0) && e._id);
7189
+ }
7190
+ parseFields(e) {
7191
+ this.parsedFields = f(e);
7192
+ }
7193
+ loadDraft() {
7194
+ var e;
7195
+ if (!((e = this.draftData) === null || e === void 0) && e.completed) {
7196
+ this.formSubmitted = !0, h.show(this.draftData.message, "success"), this.formEl.reset();
7197
+ return;
7198
+ }
7199
+ this.populateFormWithDraftData(this.draftData);
7239
7200
  }
7240
- // Validate individual fields dynamically
7241
- validateField(e, r, n, i, l) {
7242
- const t = [];
7243
- return i && !r && t.push(`${e} is required.`), l && typeof r == "string" && r.length > l && t.push(`${e} must be at most ${l} characters.`), n === "email" && r && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r.toString()) && t.push("Invalid email format."), t;
7244
- }
7245
- validateFieldGroup(e, r, n) {
7246
- const t = Array.from(this.formEl.querySelectorAll("eds-input-field")).filter((o) => {
7247
- var a, c;
7248
- return ((c = (a = o.shadowRoot) === null || a === void 0 ? void 0 : a.querySelectorAll(`input[name="${e}"]`)) === null || c === void 0 ? void 0 : c.length) > 0;
7249
- }).flatMap((o) => {
7250
- var a;
7251
- return Array.from(((a = o.shadowRoot) === null || a === void 0 ? void 0 : a.querySelectorAll(`input[name="${e}"]`)) || []);
7252
- }).some((o) => o.checked), d = [];
7253
- return n && !t && d.push(`At least one option in ${e} is required.`), d;
7254
- }
7255
- validateSingleBox(e, r) {
7256
- var n;
7257
- const i = [], l = Array.from(this.formEl.querySelectorAll("eds-input-field")).find((d) => {
7258
- var o;
7259
- return (o = d.shadowRoot) === null || o === void 0 ? void 0 : o.querySelector(`[name="${e}"]`);
7201
+ emitContext(e) {
7202
+ const i = new CustomEvent("parentContext", {
7203
+ detail: {
7204
+ componentName: this.el.tagName.toLowerCase(),
7205
+ identifier: null
7206
+ }
7260
7207
  });
7261
- if (!l)
7262
- return r && i.push(`${e} is required.`), i;
7263
- const t = (n = l.shadowRoot) === null || n === void 0 ? void 0 : n.querySelector(`[name="${e}"]`);
7264
- return r && t && !t.checked && i.push(`${e} is required.`), i;
7208
+ e.dispatchEvent(i);
7209
+ }
7210
+ isFieldVisible(e) {
7211
+ return e.condition ? this.values[e.condition.field] === e.condition.value : !0;
7265
7212
  }
7266
7213
  validateForm() {
7267
- this.errors = {}, this.hasError = !1, this.parsedFields.forEach((e) => {
7268
- if (e.type !== "hidden")
7269
- if ((e.type === "checkbox" || e.type === "radio") && !e.options) {
7270
- const r = this.validateSingleBox(e.name, e.required);
7271
- r.length > 0 && (this.errors[e.name] = r, this.hasError = !0);
7272
- } else if (e.options && (e.type === "checkbox" || e.type === "radio")) {
7273
- const r = this.validateFieldGroup(e.name, e.type, e.required);
7274
- r.length > 0 && (this.errors[e.name] = r, this.hasError = !0);
7275
- } else {
7276
- const r = this.findFieldElement(e.name);
7277
- if (r) {
7278
- const n = r.value, i = this.validateField(e.name, n, e.type, e.required, e.maxlength);
7279
- i.length > 0 && (this.errors[e.name] = i, this.hasError = !0);
7280
- }
7281
- }
7214
+ const { errors: e, hasError: i } = m(this.parsedFields, this.formEl, this.values, (n, r) => n.condition ? r[n.condition.field] === n.condition.value : !0);
7215
+ this.errors = e, this.hasError = i;
7216
+ }
7217
+ populateFormWithDraftData(e) {
7218
+ const { updatedValues: i } = p({
7219
+ draftData: e,
7220
+ parsedFields: this.parsedFields,
7221
+ currentValues: this.values,
7222
+ formEl: this.formEl,
7223
+ isFieldVisible: (n, r) => n.condition ? r[n.condition.field] === n.condition.value : !0
7282
7224
  });
7283
- }
7284
- // Helper function to find elements in the shadow DOM
7285
- findFieldElement(e) {
7286
- const r = Array.from(this.formEl.querySelectorAll("eds-input-field"));
7287
- for (const n of r)
7288
- if (n.shadowRoot) {
7289
- const i = n.shadowRoot.querySelector(`[name="${e}"]`);
7290
- if (i)
7291
- return i;
7292
- }
7293
- return null;
7294
- }
7295
- async getFormData() {
7296
- const e = new FormData();
7297
- return e.append("form_name", this.name), Array.from(this.formEl.querySelectorAll("eds-input-field")).forEach((n) => {
7298
- if (n.shadowRoot) {
7299
- const i = n.shadowRoot.querySelector("input, textarea, select");
7300
- if (i && i.name)
7301
- if (i.type === "checkbox" || i.type === "radio") {
7302
- const t = Array.from(n.shadowRoot.querySelectorAll(`input[name="${i.name}"]:checked`)).map((d) => d.value);
7303
- e.append(i.name, t.join(","));
7304
- } else if (i.type === "file") {
7305
- const l = i;
7306
- l.files && l.files.length > 0 && Array.from(l.files).forEach((t) => {
7307
- e.append(l.name, t);
7225
+ this.values = i;
7226
+ }
7227
+ getFormData() {
7228
+ var e;
7229
+ const i = new FormData();
7230
+ return i.append("form_name", this.name), this.setFormUrl && typeof window < "u" && i.set("form_url", window.location.href), this.user && i.set("form_user", (e = this.user) === null || e === void 0 ? void 0 : e.email), Array.from(this.formEl.querySelectorAll("eds-input-field")).forEach((r) => {
7231
+ if (r.shadowRoot) {
7232
+ const l = r.shadowRoot.querySelector("input, textarea, select");
7233
+ if (l && l.name)
7234
+ if (l.type === "checkbox" || l.type === "radio") {
7235
+ const d = Array.from(r.shadowRoot.querySelectorAll(`input[name="${l.name}"]:checked`)).map((c) => c.value);
7236
+ i.append(l.name, d.join(","));
7237
+ } else if (l.type === "file") {
7238
+ const t = l;
7239
+ t.files && t.files.length > 0 && Array.from(t.files).forEach((d) => {
7240
+ i.append(t.name, d);
7308
7241
  });
7309
7242
  } else
7310
- e.append(i.name, i.value);
7243
+ i.append(l.name, l.value);
7311
7244
  }
7312
- }), e;
7245
+ }), i;
7246
+ }
7247
+ handleChange(e, i) {
7248
+ const n = e.target;
7249
+ this.values = Object.assign(Object.assign({}, this.values), { [i.name]: n.value }), this.form.emit({
7250
+ event: "change",
7251
+ field: i.name,
7252
+ value: n.value,
7253
+ message: `${i.name} updated`,
7254
+ data: this.getFormData()
7255
+ }), this.shouldFormAcceptDraft && this.postFormDataWithoutValidation();
7256
+ }
7257
+ handleInput(e, i) {
7258
+ const n = e.target;
7259
+ this.values = Object.assign(Object.assign({}, this.values), { [i.name]: n.value });
7260
+ const r = Object.assign({}, this.errors), l = u(i, n.value, this.formEl);
7261
+ l.length > 0 ? r[i.name] = l : delete r[i.name], this.errors = r, this.hasError = Object.keys(r).length > 0;
7262
+ }
7263
+ async handleSubmit(e) {
7264
+ var i, n;
7265
+ if (e.preventDefault(), this.isSubmitting)
7266
+ return;
7267
+ if (this.validateForm(), this.hasError) {
7268
+ this.form.emit({
7269
+ event: "submit",
7270
+ validated: !1,
7271
+ success: !1,
7272
+ message: this.errorMessage,
7273
+ data: this.getFormData()
7274
+ }), s({
7275
+ category: "ui-component",
7276
+ parentContext: null,
7277
+ tag: this.el.tagName.toLowerCase(),
7278
+ name: `${(i = this.submitBtnLabel) === null || i === void 0 ? void 0 : i.toLowerCase()}/error` || "",
7279
+ action: "click"
7280
+ }), this.alertMessage = this.errorMessage;
7281
+ return;
7282
+ }
7283
+ this.isSubmitting = !0, this.formSubmitted = !1, this.alertMessage = null, this.errors = {};
7284
+ const r = await this.getFormData();
7285
+ if (r.set("draft", "false"), r.set("completed", "true"), !this.endpoint) {
7286
+ this.form.emit({
7287
+ event: "submit",
7288
+ success: !0,
7289
+ validated: !0,
7290
+ message: "Form data validated successfully",
7291
+ data: r
7292
+ }), this.formSubmitted = !0, this.formEl.reset(), this.isSubmitting = !1;
7293
+ return;
7294
+ }
7295
+ const l = { Authorization: `Bearer ${this.user.token}` };
7296
+ try {
7297
+ const t = await a(this.endpoint, r, { headers: l });
7298
+ this.form.emit({
7299
+ event: "submit",
7300
+ success: !0,
7301
+ validated: !0,
7302
+ message: t.message,
7303
+ data: r
7304
+ }), this.formSubmitted = !0, this.formEl.reset(), s({
7305
+ category: "ui-component",
7306
+ parentContext: null,
7307
+ tag: this.el.tagName.toLowerCase(),
7308
+ name: `${(n = this.submitBtnLabel) === null || n === void 0 ? void 0 : n.toLowerCase()}/success` || "",
7309
+ action: "click"
7310
+ });
7311
+ } catch (t) {
7312
+ this.hasError = !0, this.form.emit({
7313
+ event: "submit",
7314
+ success: !1,
7315
+ validated: !0,
7316
+ message: t,
7317
+ data: r
7318
+ });
7319
+ } finally {
7320
+ this.isSubmitting = !1;
7321
+ }
7313
7322
  }
7314
- parseFields(e) {
7323
+ async postFormDataWithoutValidation() {
7324
+ var e;
7325
+ if (!this.endpoint)
7326
+ return;
7327
+ const i = await this.getFormData();
7328
+ i.set("draft", this.draft.toString());
7329
+ const n = { Authorization: `Bearer ${(e = this.user) === null || e === void 0 ? void 0 : e.token}` };
7315
7330
  try {
7316
- typeof e == "string" ? this.parsedFields = JSON.parse(e) : Array.isArray(e) ? this.parsedFields = e : e && typeof e == "object" ? this.parsedFields = e : this.parsedFields = [];
7331
+ await a(this.endpoint, i, { headers: n });
7317
7332
  } catch (r) {
7318
- console.error("Error parsing fields prop:", r), this.parsedFields = [];
7333
+ throw r;
7319
7334
  }
7320
7335
  }
7321
7336
  render() {
7322
- const e = this.parsedFields.filter((n) => n.type === "hidden"), r = this.parsedFields.filter((n) => n.type !== "hidden");
7323
- return s("form", { key: "3d4ae34d48c0551f9de6dacb50ceee15b487b5de", ref: (n) => this.formEl = n, enctype: "multipart/form-data", autocomplete: "on", method: "post", onSubmit: this.handleSubmit }, s("div", { key: "344c56dcba3de5a1b55255d794a78fb0f19d04b5" }, s("slot", { key: "3ca6d203458d67fa66840fac55f94d71acc2ee4d" }), e.map((n, i) => s("eds-input", { key: i, type: "hidden", name: n.name, value: n.value })), r.map((n, i) => {
7337
+ const e = this.parsedFields.filter((n) => n.type === "hidden"), i = this.parsedFields.filter((n) => n.type !== "hidden");
7338
+ return o("form", { key: "7ea50f19b8810fb0294bc8527d1c86e74dfc2b69", ref: (n) => this.formEl = n, enctype: "multipart/form-data", autocomplete: "on", method: "post", onSubmit: this.handleSubmit }, o("div", { key: "29e821a2eb706c51fa303b1abf645baeea5ae9d4" }, o("slot", { key: "b45d74e9a147ab1a932891210c7813d3bd118b07" }), e.map((n, r) => o("eds-input", { key: r, type: "hidden", name: n.name, value: n.value })), i.map((n, r) => {
7324
7339
  var l, t;
7325
- return this.isFieldVisible(n) ? s("eds-input-field", { key: i, name: n.name, id: `${this.name}_${n.name}`, label: n.label, type: n.type, icon: n.icon || null, required: n.required, maxLength: n.maxlength, hint: n.hint, error: ((l = this.errors[n.name]) === null || l === void 0 ? void 0 : l.length) > 0, errorMessage: (t = this.errors[n.name]) === null || t === void 0 ? void 0 : t.join("<br />"), onInput: (d) => this.handleChange(d, n), class: i > 0 ? "mt-20" : "", options: n.options }) : null;
7326
- })), this.submitBtn && s("div", { key: "22915285f3522f6d260e358eea964c59a9557a55", class: "mt-20" }, s("eds-button", { key: "9e2191ba8cc49d7ac2a6588c0fa468214773c791", intent: "primary", label: this.submitBtnLabel, disabled: this.isSubmitting || this.coupleAuth && !this.isAuthenticated, loading: this.isSubmitting, onClick: (n) => this.handleSubmit(n) }), this.coupleAuth && !this.isAuthenticated ? s("p", { class: "f-ui-05 text-lighter mt-8 ml-8" }, this.submitBtnHintMessage) : null), this.alertMessage && (this.formSubmitted || this.hasError) && s("div", { key: "8045c3dff26286a6735157b82afd56ec9001ba14", class: "mt-20" }, s("eds-alert", { key: "dc8c8f74e8aada9023f110bb862afee1fb629601", message: this.alertMessage, intent: this.hasError ? "error" : "success", direction: "horizontal" })));
7340
+ return this.isFieldVisible(n) ? o("eds-input-field", { key: r, name: n.name, id: `${this.name}_${n.name}`, label: n.label, type: n.type, icon: n.icon || null, required: n.required, maxLength: n.maxlength, hint: n.hint, error: ((l = this.errors[n.name]) === null || l === void 0 ? void 0 : l.length) > 0, errorMessage: (t = this.errors[n.name]) === null || t === void 0 ? void 0 : t.join("<br />"), onInput: (d) => this.handleInput(d, n), onChange: (d) => this.handleChange(d, n), class: r > 0 ? "mt-20" : "", options: n.options }) : null;
7341
+ })), this.submitBtn && o("div", { key: "0a9b9027fc235cd099cc40903bd6711873b9868b", class: "mt-20" }, o("eds-button", { key: "f7181c19d04a117817f556753cc95c1f49c9fa1c", intent: "primary", label: this.submitBtnLabel, disabled: this.isSubmitting || this.coupleAuth && !this.isAuthenticated || this.formSubmitted, loading: this.isSubmitting, onClick: (n) => this.handleSubmit(n) }), this.coupleAuth && !this.isAuthenticated ? o("p", { class: "f-ui-05 text-lighter mt-8 ml-8" }, this.submitBtnHintMessage) : null), this.alertMessage && (this.formSubmitted || this.hasError) && o("div", { key: "b999356ec8fc57fc85c2f672a94e95f834d153ea", class: "mt-20" }, o("eds-alert", { key: "5a743b01991fb5d8f5358abc44639e790f5264ea", message: this.alertMessage, intent: this.hasError ? "error" : "success", direction: "horizontal" })));
7327
7342
  }
7328
7343
  get el() {
7329
- return f(this);
7344
+ return b(this);
7330
7345
  }
7331
7346
  static get watchers() {
7332
7347
  return {
@@ -7334,7 +7349,7 @@ const m = `@font-face {
7334
7349
  };
7335
7350
  }
7336
7351
  };
7337
- y.style = p;
7352
+ k.style = w;
7338
7353
  export {
7339
- y as eds_form
7354
+ k as eds_form
7340
7355
  };