@adyen/bento-vue2 1.78.2 → 1.79.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 (263) hide show
  1. package/dist/@types/index.d.ts +77 -28
  2. package/dist/accordion.js +1 -1
  3. package/dist/action-bar.js +1 -1
  4. package/dist/assets/accordion-item.css +1 -1
  5. package/dist/assets/action-bar.css +1 -1
  6. package/dist/assets/ai-button.css +1 -1
  7. package/dist/assets/base-modal.css +1 -1
  8. package/dist/assets/button-actions.css +1 -1
  9. package/dist/assets/button.css +1 -1
  10. package/dist/assets/calendar.css +1 -1
  11. package/dist/assets/card.css +1 -1
  12. package/dist/assets/checkbox-group.css +1 -1
  13. package/dist/assets/dashboard-section.css +1 -1
  14. package/dist/assets/data-grid.css +1 -1
  15. package/dist/assets/date-range-picker.css +1 -1
  16. package/dist/assets/dialog-page.css +1 -1
  17. package/dist/assets/file-uploader.css +1 -1
  18. package/dist/assets/filter-bar.css +1 -1
  19. package/dist/assets/form-layout-title.css +1 -1
  20. package/dist/assets/header-with-views.css +1 -1
  21. package/dist/assets/index.css +1 -1
  22. package/dist/assets/input-field-password.css +1 -1
  23. package/dist/assets/input-field-phone-number.css +1 -1
  24. package/dist/assets/input-field.css +1 -1
  25. package/dist/assets/inspector.css +1 -1
  26. package/dist/assets/layout-row.css +1 -1
  27. package/dist/assets/modal-fullscreen.css +1 -1
  28. package/dist/assets/search-bar.css +1 -1
  29. package/dist/assets/secondary-nav.css +1 -1
  30. package/dist/assets/sidepanel.css +1 -1
  31. package/dist/assets/step.css +1 -1
  32. package/dist/assets/structured-list-item.css +1 -1
  33. package/dist/assets/summary-grid.css +1 -1
  34. package/dist/assets/tab.css +1 -1
  35. package/dist/assets/teleport.css +1 -0
  36. package/dist/assets/toast.css +1 -1
  37. package/dist/assets/tooltip.css +1 -1
  38. package/dist/assets/tutorial.css +1 -1
  39. package/dist/assets/use-cached-selected-values.css +1 -1
  40. package/dist/button.js +1 -1
  41. package/dist/card.js +1 -1
  42. package/dist/checkbox.js +2 -2
  43. package/dist/chunks/{accordion-item.nQhXD2tV.js → accordion-item.G1q4zgBG.js} +2 -2
  44. package/dist/chunks/{accordion-item.nQhXD2tV.js.map → accordion-item.G1q4zgBG.js.map} +1 -1
  45. package/dist/chunks/{action-bar.MXZTIUNk.js → action-bar.DOaFj-A2.js} +3 -3
  46. package/dist/chunks/{action-bar.MXZTIUNk.js.map → action-bar.DOaFj-A2.js.map} +1 -1
  47. package/dist/chunks/{base-modal.BMdlCSd0.js → base-modal.BJ6315kP.js} +13 -13
  48. package/dist/chunks/{base-modal.BMdlCSd0.js.map → base-modal.BJ6315kP.js.map} +1 -1
  49. package/dist/chunks/{button-actions-with-menu.BFRkPi6g.js → button-actions-with-menu.DPKvfKJY.js} +2 -2
  50. package/dist/chunks/{button-actions-with-menu.BFRkPi6g.js.map → button-actions-with-menu.DPKvfKJY.js.map} +1 -1
  51. package/dist/chunks/{button-actions.B81vY51z.js → button-actions.C3cP-anb.js} +228 -347
  52. package/dist/chunks/button-actions.C3cP-anb.js.map +1 -0
  53. package/dist/chunks/{calendar.Fm_dfQC5.js → calendar.Bhj58zR3.js} +4 -43
  54. package/dist/chunks/{calendar.Fm_dfQC5.js.map → calendar.Bhj58zR3.js.map} +1 -1
  55. package/dist/chunks/{card.VOCKI7Ad.js → card.XfRuWGfC.js} +2 -2
  56. package/dist/chunks/{card.VOCKI7Ad.js.map → card.XfRuWGfC.js.map} +1 -1
  57. package/dist/chunks/{checkbox-group.tm9zLXkK.js → checkbox-group.CGxWh-no.js} +35 -34
  58. package/dist/chunks/checkbox-group.CGxWh-no.js.map +1 -0
  59. package/dist/chunks/{checkbox.itbBlXev.js → checkbox.C6NSiW_I.js} +18 -18
  60. package/dist/chunks/{checkbox.itbBlXev.js.map → checkbox.C6NSiW_I.js.map} +1 -1
  61. package/dist/chunks/{code-snippet.trioWquF.js → code-snippet.bzFOFUj4.js} +5 -5
  62. package/dist/chunks/{code-snippet.trioWquF.js.map → code-snippet.bzFOFUj4.js.map} +1 -1
  63. package/dist/chunks/{codemirror.Zv80n3Z2.js → codemirror.Cy7iSLbd.js} +12 -12
  64. package/dist/chunks/{codemirror.Zv80n3Z2.js.map → codemirror.Cy7iSLbd.js.map} +1 -1
  65. package/dist/chunks/constructNow.BhymNmy5.js +8 -0
  66. package/dist/chunks/{constructNow.CHWWeLPc.js.map → constructNow.BhymNmy5.js.map} +1 -1
  67. package/dist/chunks/{controls-group.82mB_GDw.js → controls-group.D62vSDSk.js} +2 -2
  68. package/dist/chunks/{controls-group.82mB_GDw.js.map → controls-group.D62vSDSk.js.map} +1 -1
  69. package/dist/chunks/{copy.WQDLcs_T.js → copy.Hu3DFJwv.js} +2 -2
  70. package/dist/chunks/{copy.WQDLcs_T.js.map → copy.Hu3DFJwv.js.map} +1 -1
  71. package/dist/chunks/{country.CGn5WjFx.js → country.B3z3-QRY.js} +2 -2
  72. package/dist/chunks/{country.CGn5WjFx.js.map → country.B3z3-QRY.js.map} +1 -1
  73. package/dist/chunks/{dashboard-section.D1l7wDX3.js → dashboard-section.BvGMr9Vl.js} +4 -4
  74. package/dist/chunks/{dashboard-section.D1l7wDX3.js.map → dashboard-section.BvGMr9Vl.js.map} +1 -1
  75. package/dist/chunks/{dashed-underline.K-l-7bDq.js → dashed-underline.D107w00E.js} +13 -12
  76. package/dist/chunks/{dashed-underline.K-l-7bDq.js.map → dashed-underline.D107w00E.js.map} +1 -1
  77. package/dist/chunks/{data-grid-template.DGUDqzjj.js → data-grid-template.DShJunDa.js} +4 -4
  78. package/dist/chunks/{data-grid-template.DGUDqzjj.js.map → data-grid-template.DShJunDa.js.map} +1 -1
  79. package/dist/chunks/data-grid-template.keys.VezYtHtM.js +5 -0
  80. package/dist/chunks/{data-grid-template.keys.2_AkxuNT.js.map → data-grid-template.keys.VezYtHtM.js.map} +1 -1
  81. package/dist/chunks/{data-grid.CS7Q8EWs.js → data-grid.BzHb4GUA.js} +18 -18
  82. package/dist/chunks/{data-grid.CS7Q8EWs.js.map → data-grid.BzHb4GUA.js.map} +1 -1
  83. package/dist/chunks/{date-picker.DK-ndVN9.js → date-picker.Dvx50znw.js} +7 -7
  84. package/dist/chunks/{date-picker.DK-ndVN9.js.map → date-picker.Dvx50znw.js.map} +1 -1
  85. package/dist/chunks/{date-range-picker.BkZBhOfu.js → date-range-picker.DYYyE_e2.js} +313 -305
  86. package/dist/chunks/date-range-picker.DYYyE_e2.js.map +1 -0
  87. package/dist/chunks/{dialog-page.D23qNwKW.js → dialog-page.krM2wQpm.js} +2 -2
  88. package/dist/chunks/{dialog-page.D23qNwKW.js.map → dialog-page.krM2wQpm.js.map} +1 -1
  89. package/dist/chunks/{differenceInMonths.C8FyCrav.js → differenceInMonths.Cab3nOsb.js} +2 -2
  90. package/dist/chunks/{differenceInMonths.C8FyCrav.js.map → differenceInMonths.Cab3nOsb.js.map} +1 -1
  91. package/dist/chunks/{divider.CFbtmKeQ.js → divider.DX5gwN7p.js} +2 -2
  92. package/dist/chunks/{divider.CFbtmKeQ.js.map → divider.DX5gwN7p.js.map} +1 -1
  93. package/dist/chunks/{dropdown-default-textbox.BCOVaw-a.js → dropdown-default-textbox.uWZMxeI7.js} +2 -2
  94. package/dist/chunks/{dropdown-default-textbox.BCOVaw-a.js.map → dropdown-default-textbox.uWZMxeI7.js.map} +1 -1
  95. package/dist/chunks/{dropdown-tag.DUP4wYAW.js → dropdown-tag.Ctn5KMFU.js} +4 -4
  96. package/dist/chunks/{dropdown-tag.DUP4wYAW.js.map → dropdown-tag.Ctn5KMFU.js.map} +1 -1
  97. package/dist/chunks/{dropdown.BiA1YOYJ.js → dropdown.BpT6ct8O.js} +28 -28
  98. package/dist/chunks/{dropdown.BiA1YOYJ.js.map → dropdown.BpT6ct8O.js.map} +1 -1
  99. package/dist/chunks/es6.MoTTyETW.js.map +1 -1
  100. package/dist/chunks/{events.CMzGybJJ.js → events.BQOQSSb7.js} +2 -5
  101. package/dist/chunks/{events.CMzGybJJ.js.map → events.BQOQSSb7.js.map} +1 -1
  102. package/dist/chunks/{field-label.Auq-Pzho.js → field-label.C3h8Q8Xd.js} +2 -2
  103. package/dist/chunks/{field-label.Auq-Pzho.js.map → field-label.C3h8Q8Xd.js.map} +1 -1
  104. package/dist/chunks/{file-uploader.DsvADlNb.js → file-uploader.CK6dhx8T.js} +109 -106
  105. package/dist/chunks/file-uploader.CK6dhx8T.js.map +1 -0
  106. package/dist/chunks/{filter-bar.F5drAPol.js → filter-bar.DpjD5bZe.js} +111 -115
  107. package/dist/chunks/filter-bar.DpjD5bZe.js.map +1 -0
  108. package/dist/chunks/{footer-actions.CLq_kBwY.js → footer-actions.DPjWGWhJ.js} +2 -2
  109. package/dist/chunks/{footer-actions.CLq_kBwY.js.map → footer-actions.DPjWGWhJ.js.map} +1 -1
  110. package/dist/chunks/{form-layout-title.DoF6ovPB.js → form-layout-title.B_oVSX5b.js} +2 -2
  111. package/dist/chunks/{form-layout-title.DoF6ovPB.js.map → form-layout-title.B_oVSX5b.js.map} +1 -1
  112. package/dist/chunks/form-layout.types.bZW9iR6_.js +5 -0
  113. package/dist/chunks/{form-layout.types.D3EKzbE7.js.map → form-layout.types.bZW9iR6_.js.map} +1 -1
  114. package/dist/chunks/get-slot-text.Bjb9dTSV.js.map +1 -1
  115. package/dist/chunks/{getTimezoneOffsetInMilliseconds.BW7U6PxE.js → getTimezoneOffsetInMilliseconds.B7sxiukN.js} +2 -2
  116. package/dist/chunks/{getTimezoneOffsetInMilliseconds.BW7U6PxE.js.map → getTimezoneOffsetInMilliseconds.B7sxiukN.js.map} +1 -1
  117. package/dist/chunks/{header-meta.D-6dL1Vg.js → header-meta.qT3_T35I.js} +5 -5
  118. package/dist/chunks/{header-meta.D-6dL1Vg.js.map → header-meta.qT3_T35I.js.map} +1 -1
  119. package/dist/chunks/{header-with-views.CG5FKoC1.js → header-with-views.BSYbvDyP.js} +13 -13
  120. package/dist/chunks/{header-with-views.CG5FKoC1.js.map → header-with-views.BSYbvDyP.js.map} +1 -1
  121. package/dist/chunks/{header.DoWKsA15.js → header.CLDtv3Ir.js} +3 -3
  122. package/dist/chunks/{header.DoWKsA15.js.map → header.CLDtv3Ir.js.map} +1 -1
  123. package/dist/chunks/{info-icon.Bhka3oGh.js → info-icon.DGrrXpIY.js} +2 -2
  124. package/dist/chunks/{info-icon.Bhka3oGh.js.map → info-icon.DGrrXpIY.js.map} +1 -1
  125. package/dist/chunks/{input-field-password.FvLueqmb.js → input-field-password.uhQuUzyj.js} +103 -95
  126. package/dist/chunks/input-field-password.uhQuUzyj.js.map +1 -0
  127. package/dist/chunks/{input-field-phone-number.B-dlJc27.js → input-field-phone-number.BdbaTJwH.js} +1170 -1168
  128. package/dist/chunks/{input-field-phone-number.B-dlJc27.js.map → input-field-phone-number.BdbaTJwH.js.map} +1 -1
  129. package/dist/chunks/{input-field.B1MHu987.js → input-field.C4XJ53Cn.js} +87 -79
  130. package/dist/chunks/input-field.C4XJ53Cn.js.map +1 -0
  131. package/dist/chunks/{keyboard-navigation.pB8weElW.js → keyboard-navigation.DWmhelVv.js} +2 -2
  132. package/dist/chunks/{keyboard-navigation.pB8weElW.js.map → keyboard-navigation.DWmhelVv.js.map} +1 -1
  133. package/dist/chunks/{layout-row.BP3lZAOh.js → layout-row.DwdZbpVG.js} +2 -2
  134. package/dist/chunks/{layout-row.BP3lZAOh.js.map → layout-row.DwdZbpVG.js.map} +1 -1
  135. package/dist/chunks/{listbox-option-tag.DkPz3wPc.js → listbox-option-tag.B94BtpSU.js} +2 -2
  136. package/dist/chunks/{listbox-option-tag.DkPz3wPc.js.map → listbox-option-tag.B94BtpSU.js.map} +1 -1
  137. package/dist/chunks/{modal-fullscreen.BSKm6yn_.js → modal-fullscreen.B3Xx-Hoc.js} +33 -32
  138. package/dist/chunks/modal-fullscreen.B3Xx-Hoc.js.map +1 -0
  139. package/dist/chunks/{modal.Bp5twyjz.js → modal.D3OSxMF6.js} +4 -4
  140. package/dist/chunks/{modal.Bp5twyjz.js.map → modal.D3OSxMF6.js.map} +1 -1
  141. package/dist/chunks/{pagination.D1C0cURM.js → pagination.Bvhpu21H.js} +2 -2
  142. package/dist/chunks/{pagination.D1C0cURM.js.map → pagination.Bvhpu21H.js.map} +1 -1
  143. package/dist/chunks/{payment-method.CcASYR3B.js → payment-method.C8Ie97qE.js} +2 -2
  144. package/dist/chunks/{payment-method.CcASYR3B.js.map → payment-method.C8Ie97qE.js.map} +1 -1
  145. package/dist/chunks/promo-banner.DikQcQU2.js.map +1 -1
  146. package/dist/chunks/{radio-group.DmKiTjS8.js → radio-group.BTu23ZgN.js} +5 -5
  147. package/dist/chunks/{radio-group.DmKiTjS8.js.map → radio-group.BTu23ZgN.js.map} +1 -1
  148. package/dist/chunks/{rich-text-editor.DzH-Z5oi.js → rich-text-editor.BtcSjFpF.js} +12 -12
  149. package/dist/chunks/{rich-text-editor.DzH-Z5oi.js.map → rich-text-editor.BtcSjFpF.js.map} +1 -1
  150. package/dist/chunks/{search-bar.Cvw_nY5M.js → search-bar.BcHoTrjP.js} +11 -11
  151. package/dist/chunks/search-bar.BcHoTrjP.js.map +1 -0
  152. package/dist/chunks/{secondary-nav.CUF6QWjI.js → secondary-nav.DEThy9WH.js} +3 -3
  153. package/dist/chunks/{secondary-nav.CUF6QWjI.js.map → secondary-nav.DEThy9WH.js.map} +1 -1
  154. package/dist/chunks/{segmented-control.Cma_nu0G.js → segmented-control.Dj_ZKhmU.js} +2 -2
  155. package/dist/chunks/{segmented-control.Cma_nu0G.js.map → segmented-control.Dj_ZKhmU.js.map} +1 -1
  156. package/dist/chunks/{selection-card-group.Ddli4Llk.js → selection-card-group.Rz_rTBRp.js} +11 -11
  157. package/dist/chunks/{selection-card-group.Ddli4Llk.js.map → selection-card-group.Rz_rTBRp.js.map} +1 -1
  158. package/dist/chunks/{sidepanel.A9yG4FP_.js → sidepanel.ClG3dhHf.js} +4 -4
  159. package/dist/chunks/{sidepanel.A9yG4FP_.js.map → sidepanel.ClG3dhHf.js.map} +1 -1
  160. package/dist/chunks/{step.TzzZSA9f.js → step.Cnqr8i4V.js} +3 -3
  161. package/dist/chunks/{step.TzzZSA9f.js.map → step.Cnqr8i4V.js.map} +1 -1
  162. package/dist/chunks/{structured-list-item.CMsVwwA6.js → structured-list-item.zoY-ATTu.js} +5 -5
  163. package/dist/chunks/{structured-list-item.CMsVwwA6.js.map → structured-list-item.zoY-ATTu.js.map} +1 -1
  164. package/dist/chunks/summary-grid.keys.Xx-W5a2w.js +6 -0
  165. package/dist/chunks/{summary-grid.keys.CxTf_FOc.js.map → summary-grid.keys.Xx-W5a2w.js.map} +1 -1
  166. package/dist/chunks/{summary-grid.types.CaYrtyVO.js → summary-grid.types.BA0XCVKK.js} +21 -21
  167. package/dist/chunks/summary-grid.types.BA0XCVKK.js.map +1 -0
  168. package/dist/chunks/{tab.CTui3j3e.js → tab.DXE68qVf.js} +2 -2
  169. package/dist/chunks/{tab.CTui3j3e.js.map → tab.DXE68qVf.js.map} +1 -1
  170. package/dist/chunks/tabs.keys.B4qGhjp2.js +7 -0
  171. package/dist/chunks/{tabs.keys.Cb4Vw5Jh.js.map → tabs.keys.B4qGhjp2.js.map} +1 -1
  172. package/dist/chunks/{tag.BltIbSh3.js → tag.BdCP2CN_.js} +2 -2
  173. package/dist/chunks/{tag.BltIbSh3.js.map → tag.BdCP2CN_.js.map} +1 -1
  174. package/dist/chunks/teleport.dQFcCuAw.js +128 -0
  175. package/dist/chunks/teleport.dQFcCuAw.js.map +1 -0
  176. package/dist/chunks/{textarea.CLWZRnAt.js → textarea.DaNiOOJ7.js} +3 -3
  177. package/dist/chunks/{textarea.CLWZRnAt.js.map → textarea.DaNiOOJ7.js.map} +1 -1
  178. package/dist/chunks/{timeline-item.HbtUj1j_.js → timeline-item.D2HsuNh-.js} +7 -7
  179. package/dist/chunks/{timeline-item.HbtUj1j_.js.map → timeline-item.D2HsuNh-.js.map} +1 -1
  180. package/dist/chunks/toast.CA5H8vr9.js +174 -0
  181. package/dist/chunks/toast.CA5H8vr9.js.map +1 -0
  182. package/dist/chunks/{tooltip.D3SDcRef.js → tooltip.Dt87KVh2.js} +2 -2
  183. package/dist/chunks/{tooltip.D3SDcRef.js.map → tooltip.Dt87KVh2.js.map} +1 -1
  184. package/dist/chunks/{tutorial.B32GMtIj.js → tutorial.C-q4mxUb.js} +4 -4
  185. package/dist/chunks/{tutorial.B32GMtIj.js.map → tutorial.C-q4mxUb.js.map} +1 -1
  186. package/dist/chunks/{use-bento-toast-controller.BKHU1qBv.js → use-bento-toast-controller.BhtohoS1.js} +2 -2
  187. package/dist/chunks/{use-bento-toast-controller.BKHU1qBv.js.map → use-bento-toast-controller.BhtohoS1.js.map} +1 -1
  188. package/dist/chunks/{use-cached-selected-values.BZd3CTeP.js → use-cached-selected-values.FoXcm49J.js} +3 -3
  189. package/dist/chunks/{use-cached-selected-values.BZd3CTeP.js.map → use-cached-selected-values.FoXcm49J.js.map} +1 -1
  190. package/dist/chunks/{use-form-layout-loading.D3lALhtC.js → use-form-layout-loading.CWbjZiwP.js} +2 -2
  191. package/dist/chunks/{use-form-layout-loading.D3lALhtC.js.map → use-form-layout-loading.CWbjZiwP.js.map} +1 -1
  192. package/dist/code-snippet.js +1 -1
  193. package/dist/country.js +1 -1
  194. package/dist/dashboard-template.js +1 -1
  195. package/dist/dashed-underline.js +1 -1
  196. package/dist/data-grid-template.js +1 -1
  197. package/dist/data-grid.js +1 -1
  198. package/dist/date-picker.js +2 -2
  199. package/dist/date-range-picker.js +2 -2
  200. package/dist/divider.js +1 -1
  201. package/dist/dropdown.js +4 -4
  202. package/dist/file-uploader.js +1 -1
  203. package/dist/filter-bar.js +1 -1
  204. package/dist/form-layout.js +1 -1
  205. package/dist/header-with-views.js +1 -1
  206. package/dist/header.js +1 -1
  207. package/dist/index.js +289 -288
  208. package/dist/index.js.map +1 -1
  209. package/dist/info-icon.js +1 -1
  210. package/dist/input-field-password.js +1 -1
  211. package/dist/input-field-phone-number.js +1 -1
  212. package/dist/input-field.js +1 -1
  213. package/dist/internal.js +27 -26
  214. package/dist/internal.js.map +1 -1
  215. package/dist/layout.js +1 -1
  216. package/dist/menu.js +1 -1
  217. package/dist/modal-fullscreen.js +1 -1
  218. package/dist/modal.js +2 -2
  219. package/dist/pagination.js +1 -1
  220. package/dist/payment-method.js +1 -1
  221. package/dist/popover.js +1 -1
  222. package/dist/radio-group.js +1 -1
  223. package/dist/rich-text-editor.js +1 -1
  224. package/dist/search-bar.js +2 -2
  225. package/dist/secondary-nav.js +1 -1
  226. package/dist/segmented-control.js +1 -1
  227. package/dist/selection-card.js +1 -1
  228. package/dist/sidepanel.js +1 -1
  229. package/dist/stepper.js +1 -1
  230. package/dist/structured-list.js +1 -1
  231. package/dist/styles/bento-dark.css +4 -1
  232. package/dist/styles/bento-light.css +4 -1
  233. package/dist/styles/bento.css +4 -1
  234. package/dist/styles/legacy.css +4 -1
  235. package/dist/styles/styleguide.css +4 -1
  236. package/dist/summary-grid.js +1 -1
  237. package/dist/tabs.js +1 -1
  238. package/dist/tag.js +1 -1
  239. package/dist/textarea.js +1 -1
  240. package/dist/timeline.js +1 -1
  241. package/dist/toast.js +1 -1
  242. package/dist/tutorial.js +1 -1
  243. package/dist/use-form-v4.js +8 -8
  244. package/dist/use-form-v4.js.map +1 -1
  245. package/dist/web-types.json +105 -5
  246. package/package.json +8 -7
  247. package/dist/chunks/button-actions.B81vY51z.js.map +0 -1
  248. package/dist/chunks/checkbox-group.tm9zLXkK.js.map +0 -1
  249. package/dist/chunks/constructNow.CHWWeLPc.js +0 -8
  250. package/dist/chunks/data-grid-template.keys.2_AkxuNT.js +0 -5
  251. package/dist/chunks/date-range-picker.BkZBhOfu.js.map +0 -1
  252. package/dist/chunks/file-uploader.DsvADlNb.js.map +0 -1
  253. package/dist/chunks/filter-bar.F5drAPol.js.map +0 -1
  254. package/dist/chunks/form-layout.types.D3EKzbE7.js +0 -5
  255. package/dist/chunks/input-field-password.FvLueqmb.js.map +0 -1
  256. package/dist/chunks/input-field.B1MHu987.js.map +0 -1
  257. package/dist/chunks/modal-fullscreen.BSKm6yn_.js.map +0 -1
  258. package/dist/chunks/search-bar.Cvw_nY5M.js.map +0 -1
  259. package/dist/chunks/summary-grid.keys.CxTf_FOc.js +0 -6
  260. package/dist/chunks/summary-grid.types.CaYrtyVO.js.map +0 -1
  261. package/dist/chunks/tabs.keys.Cb4Vw5Jh.js +0 -7
  262. package/dist/chunks/toast.B4J4V6n-.js +0 -171
  263. package/dist/chunks/toast.B4J4V6n-.js.map +0 -1
@@ -8,7 +8,7 @@ import { g as W } from "./generate-uid.NJ8tVoha.js";
8
8
  import { u as F } from "./index.B6WW_F-J.js";
9
9
  import { o as K } from "./resize.Bqks3WUm.js";
10
10
  import { B as N } from "./button-actions.types.BptAXjD8.js";
11
- import { B as P } from "./button-actions.B81vY51z.js";
11
+ import { B as P } from "./button-actions.C3cP-anb.js";
12
12
  import { n as Y } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
13
13
  import "../assets/card.css";
14
14
  var y = /* @__PURE__ */ ((s) => (s.PRIMARY = "primary", s.SECONDARY = "secondary", s))(y || {}), c = /* @__PURE__ */ ((s) => (s.DEFAULT = "default", s.SMALL = "small", s))(c || {});
@@ -134,4 +134,4 @@ export {
134
134
  c as a,
135
135
  ue as c
136
136
  };
137
- //# sourceMappingURL=card.VOCKI7Ad.js.map
137
+ //# sourceMappingURL=card.XfRuWGfC.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"card.VOCKI7Ad.js","sources":["../../src/components/card/card.types.ts","../../src/components/card/card.vue"],"sourcesContent":["/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCardBackground {\n PRIMARY = 'primary',\n SECONDARY = 'secondary',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCardTitleSize {\n DEFAULT = 'default',\n SMALL = 'small',\n}\n","<template>\n <div\n class=\"b-card\"\n :class=\"cardConditionalClasses\"\n :tabindex=\"tabIndex\"\n data-testid=\"card\"\n @click=\"onClick\"\n @keydown.enter=\"onKeyDown\"\n @keydown.space=\"onKeyDown\"\n >\n <div v-if=\"hasSlot('image')\" class=\"b-card__image\">\n <slot name=\"image\"></slot>\n </div>\n <div\n v-if=\"showHeader\"\n class=\"b-card__header\"\n :class=\"cardHeaderConditionalClasses\"\n :tabindex=\"headerTabIndex\"\n :aria-controls=\"expandable && showCardBody ? cardId : null\"\n :aria-expanded=\"expandable ? `${showContent}` : null\"\n :role=\"expandable ? 'button' : null\"\n @click=\"toggleExpansion\"\n @keypress.enter=\"toggleExpansion\"\n @keypress.space=\"toggleExpansion\"\n >\n <div class=\"b-card__header-wrapper\">\n <div v-if=\"showTitleWrapper\" class=\"b-card__header-slot-wrapper\">\n <div class=\"b-card__title-wrapper\" :class=\"cardTitleWrapperConditionalClasses\">\n <div v-if=\"expandable\" class=\"b-card__toggle\" :class=\"cardToggleConditionalClasses\">\n <chevron-up-icon v-if=\"showContent\" :svg-title=\"t('hideContent')\" aria-hidden=\"true\" />\n <chevron-down-icon v-else :svg-title=\"t('showContent')\" aria-hidden=\"true\" />\n </div>\n <bento-typography v-if=\"hasSlot('default')\" class=\"b-card__title\" v-bind=\"typography\">\n <slot />\n </bento-typography>\n </div>\n\n <template v-if=\"hasSlot('header')\">\n <slot name=\"header\"></slot>\n </template>\n </div>\n\n <bento-typography v-if=\"hasSlot('description')\" class=\"b-card__description\" el=\"div\" variant=\"body\">\n <slot name=\"description\" />\n </bento-typography>\n </div>\n </div>\n\n <Transition name=\"b-card__animation\">\n <div v-if=\"showCardBody\" class=\"b-card__wrapper\" :style=\"contentMaxHeight\">\n <div\n :id=\"expandable ? cardId : null\"\n ref=\"contentDiv\"\n class=\"b-card__body\"\n :class=\"cardBodyConditionalClasses\"\n >\n <div v-if=\"hasSlot('content')\" class=\"b-card__content\" :class=\"cardContentConditionalClasses\">\n <slot name=\"content\" />\n </div>\n\n <div v-if=\"actions\" class=\"b-card__actions\" :class=\"cardActionsConditionalClasses\">\n <bento-button-actions :actions=\"actions\" :layout=\"actionsLayout\"></bento-button-actions>\n </div>\n </div>\n </div>\n </Transition>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, ref, useSlots, watch } from 'vue';\n\n // Components\n import { BentoTypography } from '@/components/typography';\n import { BentoButtonActions, BentoButtonActionsLayout, type BentoButtonActionsList } from '@/components/button';\n import { BentoCardBackground, BentoCardTitleSize } from '@/components/card/card.types';\n import ChevronDownIcon from '@adyen/ui-assets-icons-16/vue/chevron-down';\n import ChevronUpIcon from '@adyen/ui-assets-icons-16/vue/chevron-up';\n\n // Composables\n import { useExpandableContentHeight } from '@/composables/use-expandable-content-height/use-expandable-content-height';\n\n // Utils\n import { useHasSlot } from '@/composables';\n import { generateUid } from '@/core/utils/ts';\n import { useI18n } from '@/utils/ts/i18n';\n import { observeSizeOfElement } from '@/utils/ts/resize';\n\n import messages from './messages.json';\n import { deprecate } from '@/utils/ts/deprecate';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n\n const props = defineProps({\n actions: { default: null },\n actionsLayout: { default: BentoButtonActionsLayout.BUTTONS_END },\n background: { default: BentoCardBackground.PRIMARY },\n clickable: { type: Boolean, default: false },\n closed: { type: Boolean, default: false },\n disabled: { type: Boolean, default: false },\n expandable: { type: Boolean, default: false },\n titleSize: { default: BentoCardTitleSize.DEFAULT }\n});\n\n const emit = defineEmits([\"click\", \"expanded\"]);\n\n const contentDiv = ref<HTMLDivElement>(null);\n\n const cardId = generateUid('card');\n const showContent = ref(!props.closed);\n watch(\n () => props.closed,\n value => {\n showContent.value = !value;\n }\n );\n const showHeader = computed(() => hasSlot('default') || hasSlot('description') || hasSlot('header'));\n const showTitleWrapper = computed(() => hasSlot('default') || hasSlot('header'));\n const showCardBody = computed(\n () =>\n (hasSlot('content') || props.actions?.length) &&\n (!props.expandable || (props.expandable && showContent.value))\n );\n const tabIndex = computed(() => (props.clickable && !props.disabled ? 0 : -1));\n const headerTabIndex = computed(() => (props.expandable && !props.disabled ? 0 : -1));\n\n const cardConditionalClasses = computed(() => ({\n [`b-card--${props.background}`]: props.background,\n 'b-card--clickable': props.clickable,\n 'b-card--expandable': props.expandable,\n 'b-card--disabled': (props.clickable || props.expandable) && props.disabled,\n }));\n\n const cardHeaderConditionalClasses = computed(() => ({\n 'b-card__header--expandable': props.expandable,\n 'b-card__header--without-body': !props.expandable && !showCardBody.value,\n }));\n\n const cardToggleConditionalClasses = computed(() => ({\n 'b-card__toggle--small-text': props.titleSize === BentoCardTitleSize.SMALL,\n }));\n\n const cardBodyConditionalClasses = computed(() => ({\n 'b-card__body--expandable': props.expandable && hasSlot('content'),\n 'b-card__body--without-header': !props.expandable && !showHeader.value,\n }));\n\n const cardContentConditionalClasses = computed(() => ({\n 'b-card__content--without-header': !props.expandable && !showHeader.value,\n 'b-card__content--expandable': props.expandable,\n }));\n\n const cardActionsConditionalClasses = computed(() => {\n const isNotExpandableWithoutContent = !props.expandable && props.actions && !hasSlot('content');\n\n return {\n 'b-card__actions--without-content': isNotExpandableWithoutContent,\n 'b-card__actions--without-content-and-with-header': isNotExpandableWithoutContent && showHeader.value,\n };\n });\n\n const cardTitleWrapperConditionalClasses = computed(() => ({\n 'b-card__title-wrapper--truncated': hasSlot('header'),\n }));\n\n const typography = computed(\n () =>\n ({\n el: 'div',\n variant: props.titleSize === BentoCardTitleSize.DEFAULT ? 'title' : 'body',\n strongest: props.titleSize === BentoCardTitleSize.SMALL,\n wide: props.titleSize === BentoCardTitleSize.SMALL,\n }) as InstanceType<typeof BentoTypography>['$props']\n );\n\n // Toggle open and close logic and animation\n const { updateContentHeight, contentHeight } = useExpandableContentHeight(contentDiv, showContent);\n\n const contentMaxHeight = computed(() =>\n props.expandable && contentHeight.value ? { 'max-height': contentHeight.value } : {}\n );\n\n watch(\n () => contentDiv.value,\n () => {\n let observer: ResizeObserver | null = null;\n if (!observer && contentDiv.value) {\n observer = observeSizeOfElement(contentDiv.value, () => {\n if (contentDiv.value) {\n updateContentHeight();\n }\n });\n }\n }\n );\n\n const toggleExpansion = () => {\n if (!props.disabled && props.expandable) {\n showContent.value = !showContent.value;\n emit('expanded', showContent.value);\n updateContentHeight();\n }\n };\n\n const onClick = () => {\n if (!props.disabled) {\n emit('click');\n\n if (!props.clickable) {\n deprecate(\n 'BentoCard \"@click\" property',\n `Use the BentoCard \"@click\" with the \"clickable\" property to enable accessible styles.`,\n '2.0.0'\n );\n }\n }\n };\n\n const onKeyDown = () => {\n if (props.clickable && !props.disabled) {\n emit('click');\n }\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * A card is a flexible and composable container.\n * Use cards to represent a single object or to visually group certain content, like legal information within company settings.\n *\n * @example\n * import { BentoCard } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoCard },\n * template: `\n * <bento-card>\n * Title of the Card\n * </bento-card>\n * `\n * };\n */\n export default {\n i18n: { messages },\n name: 'bento-card',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./card.scss\" />\n"],"names":["BentoCardBackground","BentoCardBackground2","BentoCardTitleSize","BentoCardTitleSize2","__default__","messages","t","useI18n","slots","useSlots","hasSlot","useHasSlot","contentDiv","ref","cardId","generateUid","showContent","props","watch","value","showHeader","computed","showTitleWrapper","showCardBody","_a","tabIndex","headerTabIndex","cardConditionalClasses","cardHeaderConditionalClasses","cardToggleConditionalClasses","cardBodyConditionalClasses","cardContentConditionalClasses","cardActionsConditionalClasses","isNotExpandableWithoutContent","cardTitleWrapperConditionalClasses","typography","updateContentHeight","contentHeight","useExpandableContentHeight","contentMaxHeight","observer","observeSizeOfElement","emit","deprecate"],"mappings":";;;;;;;;;;;;;AAGY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,YAAA,aAFQA,IAAAD,KAAA,CAAA,CAAA,GAQAE,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,QA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AAA;AAAA,MAER;AAAA,IACJ,ogBAGJ,MAAA;AACI,MAAA,CAAAnB,EAAA,YAAAA,EAAA,eACID,EAAA,QAAA,CAAAA,EAAA,OACA0B,EAAA,YAAA1B,EAAA,KAAA,GACAoB,EAAA;AAAA,IACJ,YAGJ,MAAA;AACI,MAAAnB,EAAA,aACIyB,EAAA,OAAA,GAEAzB,EAAA,aACI0B;AAAA,QAAA;AAAA,QACI;AAAA,QACA;AAAA,MACA;AAAA,IAGZ,cAGJ,MAAA;AACI,MAAA1B,EAAA,aAAA,CAAAA,EAAA,YACIyB,EAAA,OAAA;AAAA,IACJ;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"card.XfRuWGfC.js","sources":["../../src/components/card/card.types.ts","../../src/components/card/card.vue"],"sourcesContent":["/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCardBackground {\n PRIMARY = 'primary',\n SECONDARY = 'secondary',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCardTitleSize {\n DEFAULT = 'default',\n SMALL = 'small',\n}\n","<template>\n <div\n class=\"b-card\"\n :class=\"cardConditionalClasses\"\n :tabindex=\"tabIndex\"\n data-testid=\"card\"\n @click=\"onClick\"\n @keydown.enter=\"onKeyDown\"\n @keydown.space=\"onKeyDown\"\n >\n <div v-if=\"hasSlot('image')\" class=\"b-card__image\">\n <slot name=\"image\"></slot>\n </div>\n <div\n v-if=\"showHeader\"\n class=\"b-card__header\"\n :class=\"cardHeaderConditionalClasses\"\n :tabindex=\"headerTabIndex\"\n :aria-controls=\"expandable && showCardBody ? cardId : null\"\n :aria-expanded=\"expandable ? `${showContent}` : null\"\n :role=\"expandable ? 'button' : null\"\n @click=\"toggleExpansion\"\n @keypress.enter=\"toggleExpansion\"\n @keypress.space=\"toggleExpansion\"\n >\n <div class=\"b-card__header-wrapper\">\n <div v-if=\"showTitleWrapper\" class=\"b-card__header-slot-wrapper\">\n <div class=\"b-card__title-wrapper\" :class=\"cardTitleWrapperConditionalClasses\">\n <div v-if=\"expandable\" class=\"b-card__toggle\" :class=\"cardToggleConditionalClasses\">\n <chevron-up-icon v-if=\"showContent\" :svg-title=\"t('hideContent')\" aria-hidden=\"true\" />\n <chevron-down-icon v-else :svg-title=\"t('showContent')\" aria-hidden=\"true\" />\n </div>\n <bento-typography v-if=\"hasSlot('default')\" class=\"b-card__title\" v-bind=\"typography\">\n <slot />\n </bento-typography>\n </div>\n\n <template v-if=\"hasSlot('header')\">\n <slot name=\"header\"></slot>\n </template>\n </div>\n\n <bento-typography v-if=\"hasSlot('description')\" class=\"b-card__description\" el=\"div\" variant=\"body\">\n <slot name=\"description\" />\n </bento-typography>\n </div>\n </div>\n\n <Transition name=\"b-card__animation\">\n <div v-if=\"showCardBody\" class=\"b-card__wrapper\" :style=\"contentMaxHeight\">\n <div\n :id=\"expandable ? cardId : null\"\n ref=\"contentDiv\"\n class=\"b-card__body\"\n :class=\"cardBodyConditionalClasses\"\n >\n <div v-if=\"hasSlot('content')\" class=\"b-card__content\" :class=\"cardContentConditionalClasses\">\n <slot name=\"content\" />\n </div>\n\n <div v-if=\"actions\" class=\"b-card__actions\" :class=\"cardActionsConditionalClasses\">\n <bento-button-actions :actions=\"actions\" :layout=\"actionsLayout\"></bento-button-actions>\n </div>\n </div>\n </div>\n </Transition>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, ref, useSlots, watch } from 'vue';\n\n // Components\n import { BentoTypography } from '@/components/typography';\n import { BentoButtonActions, BentoButtonActionsLayout, type BentoButtonActionsList } from '@/components/button';\n import { BentoCardBackground, BentoCardTitleSize } from '@/components/card/card.types';\n import ChevronDownIcon from '@adyen/ui-assets-icons-16/vue/chevron-down';\n import ChevronUpIcon from '@adyen/ui-assets-icons-16/vue/chevron-up';\n\n // Composables\n import { useExpandableContentHeight } from '@/composables/use-expandable-content-height/use-expandable-content-height';\n\n // Utils\n import { useHasSlot } from '@/composables';\n import { generateUid } from '@/core/utils/ts';\n import { useI18n } from '@/utils/ts/i18n';\n import { observeSizeOfElement } from '@/utils/ts/resize';\n\n import messages from './messages.json';\n import { deprecate } from '@/utils/ts/deprecate';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n\n const props = defineProps({\n actions: { default: null },\n actionsLayout: { default: BentoButtonActionsLayout.BUTTONS_END },\n background: { default: BentoCardBackground.PRIMARY },\n clickable: { type: Boolean, default: false },\n closed: { type: Boolean, default: false },\n disabled: { type: Boolean, default: false },\n expandable: { type: Boolean, default: false },\n titleSize: { default: BentoCardTitleSize.DEFAULT }\n});\n\n const emit = defineEmits([\"click\", \"expanded\"]);\n\n const contentDiv = ref<HTMLDivElement>(null);\n\n const cardId = generateUid('card');\n const showContent = ref(!props.closed);\n watch(\n () => props.closed,\n value => {\n showContent.value = !value;\n }\n );\n const showHeader = computed(() => hasSlot('default') || hasSlot('description') || hasSlot('header'));\n const showTitleWrapper = computed(() => hasSlot('default') || hasSlot('header'));\n const showCardBody = computed(\n () =>\n (hasSlot('content') || props.actions?.length) &&\n (!props.expandable || (props.expandable && showContent.value))\n );\n const tabIndex = computed(() => (props.clickable && !props.disabled ? 0 : -1));\n const headerTabIndex = computed(() => (props.expandable && !props.disabled ? 0 : -1));\n\n const cardConditionalClasses = computed(() => ({\n [`b-card--${props.background}`]: props.background,\n 'b-card--clickable': props.clickable,\n 'b-card--expandable': props.expandable,\n 'b-card--disabled': (props.clickable || props.expandable) && props.disabled,\n }));\n\n const cardHeaderConditionalClasses = computed(() => ({\n 'b-card__header--expandable': props.expandable,\n 'b-card__header--without-body': !props.expandable && !showCardBody.value,\n }));\n\n const cardToggleConditionalClasses = computed(() => ({\n 'b-card__toggle--small-text': props.titleSize === BentoCardTitleSize.SMALL,\n }));\n\n const cardBodyConditionalClasses = computed(() => ({\n 'b-card__body--expandable': props.expandable && hasSlot('content'),\n 'b-card__body--without-header': !props.expandable && !showHeader.value,\n }));\n\n const cardContentConditionalClasses = computed(() => ({\n 'b-card__content--without-header': !props.expandable && !showHeader.value,\n 'b-card__content--expandable': props.expandable,\n }));\n\n const cardActionsConditionalClasses = computed(() => {\n const isNotExpandableWithoutContent = !props.expandable && props.actions && !hasSlot('content');\n\n return {\n 'b-card__actions--without-content': isNotExpandableWithoutContent,\n 'b-card__actions--without-content-and-with-header': isNotExpandableWithoutContent && showHeader.value,\n };\n });\n\n const cardTitleWrapperConditionalClasses = computed(() => ({\n 'b-card__title-wrapper--truncated': hasSlot('header'),\n }));\n\n const typography = computed(\n () =>\n ({\n el: 'div',\n variant: props.titleSize === BentoCardTitleSize.DEFAULT ? 'title' : 'body',\n strongest: props.titleSize === BentoCardTitleSize.SMALL,\n wide: props.titleSize === BentoCardTitleSize.SMALL,\n }) as InstanceType<typeof BentoTypography>['$props']\n );\n\n // Toggle open and close logic and animation\n const { updateContentHeight, contentHeight } = useExpandableContentHeight(contentDiv, showContent);\n\n const contentMaxHeight = computed(() =>\n props.expandable && contentHeight.value ? { 'max-height': contentHeight.value } : {}\n );\n\n watch(\n () => contentDiv.value,\n () => {\n let observer: ResizeObserver | null = null;\n if (!observer && contentDiv.value) {\n observer = observeSizeOfElement(contentDiv.value, () => {\n if (contentDiv.value) {\n updateContentHeight();\n }\n });\n }\n }\n );\n\n const toggleExpansion = () => {\n if (!props.disabled && props.expandable) {\n showContent.value = !showContent.value;\n emit('expanded', showContent.value);\n updateContentHeight();\n }\n };\n\n const onClick = () => {\n if (!props.disabled) {\n emit('click');\n\n if (!props.clickable) {\n deprecate(\n 'BentoCard \"@click\" property',\n `Use the BentoCard \"@click\" with the \"clickable\" property to enable accessible styles.`,\n '2.0.0'\n );\n }\n }\n };\n\n const onKeyDown = () => {\n if (props.clickable && !props.disabled) {\n emit('click');\n }\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * A card is a flexible and composable container.\n * Use cards to represent a single object or to visually group certain content, like legal information within company settings.\n *\n * @example\n * import { BentoCard } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoCard },\n * template: `\n * <bento-card>\n * Title of the Card\n * </bento-card>\n * `\n * };\n */\n export default {\n i18n: { messages },\n name: 'bento-card',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./card.scss\" />\n"],"names":["BentoCardBackground","BentoCardBackground2","BentoCardTitleSize","BentoCardTitleSize2","__default__","messages","t","useI18n","slots","useSlots","hasSlot","useHasSlot","contentDiv","ref","cardId","generateUid","showContent","props","watch","value","showHeader","computed","showTitleWrapper","showCardBody","_a","tabIndex","headerTabIndex","cardConditionalClasses","cardHeaderConditionalClasses","cardToggleConditionalClasses","cardBodyConditionalClasses","cardContentConditionalClasses","cardActionsConditionalClasses","isNotExpandableWithoutContent","cardTitleWrapperConditionalClasses","typography","updateContentHeight","contentHeight","useExpandableContentHeight","contentMaxHeight","observer","observeSizeOfElement","emit","deprecate"],"mappings":";;;;;;;;;;;;;AAGY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,YAAA,aAFQA,IAAAD,KAAA,CAAA,CAAA,GAQAE,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,QAAA,SAFQA,IAAAD,KAAA,CAAA,CAAA;;;;;;;;;;;;;;GC4ORE,IAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAAA,EACM,MAAA;AAErB;;;;;;;;;;;;;;iBA7JA,EAAA,GAAAC,EAAA,IAAAC,EAAA,GAEAC,IAAAC,EAAA,GACAC,IAAAC,EAAAH,CAAA,GAeAI,IAAAC,EAAA,IAAA,GAEAC,IAAAC,EAAA,MAAA,GACAC,IAAAH,EAAA,CAAAI,EAAA,MAAA;AACA,IAAAC;AAAA,MAAA,MAAAD,EAAA;AAAA,MACgB,CAAAE,MAAA;AAER,QAAAH,EAAA,QAAA,CAAAG;AAAA,MAAqB;AAAA,IACzB;AAEJ,UAAAC,IAAAC,EAAA,MAAA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ch as f, ref as x, onMounted as C } from "vue";
2
- import { a as n, B as k } from "./checkbox.itbBlXev.js";
1
+ import { defineComponent as y, useSlots as v, toRef as x, computed as l, watch as f, ref as E, onMounted as k } from "vue";
2
+ import { B as C } from "./checkbox.C6NSiW_I.js";
3
3
  import { g as S } from "./generate-uid.NJ8tVoha.js";
4
4
  import { d as M } from "./typography.hlOAxsEn.js";
5
- import { u as I } from "./use-form-layout-loading.D3lALhtC.js";
6
- import { E as T } from "./field-label.Auq-Pzho.js";
7
- import { C as B } from "./controls-group.82mB_GDw.js";
8
- import { n as w } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
5
+ import { u as w } from "./use-form-layout-loading.CWbjZiwP.js";
6
+ import { u as B } from "./form-field.D_2g7vaP.js";
7
+ import { E as V } from "./field-label.C3h8Q8Xd.js";
8
+ import { C as G } from "./controls-group.D62vSDSk.js";
9
+ import { n as I } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
9
10
  import "../assets/checkbox-group.css";
10
- var u = /* @__PURE__ */ ((a) => (a.HORIZONTAL = "horizontal", a.VERTICAL = "vertical", a))(u || {});
11
+ var n = /* @__PURE__ */ ((a) => (a.HORIZONTAL = "horizontal", a.VERTICAL = "vertical", a))(n || {});
11
12
  const h = "bento-checkbox-group", O = {
12
13
  name: h,
13
14
  model: { prop: "modelValue" }
14
- }, A = /* @__PURE__ */ g({
15
+ }, L = /* @__PURE__ */ y({
15
16
  ...O,
16
17
  props: {
17
18
  /**
@@ -74,36 +75,36 @@ const h = "bento-checkbox-group", O = {
74
75
  */
75
76
  variant: {
76
77
  type: String,
77
- default: u.VERTICAL,
78
- validator: (a) => Object.values(u).includes(a)
78
+ default: n.VERTICAL,
79
+ validator: (a) => Object.values(n).includes(a)
79
80
  }
80
81
  },
81
- emits: [n.UPDATE, n.INPUT],
82
+ emits: ["update:model-value", "input"],
82
83
  setup(a, { emit: e }) {
83
- const r = a, o = v(), t = S("error"), { isReadOnly: d } = I(E(r, "readonly")), b = l(
84
- () => !r.disabled && !d.value && (!!r.errorMessage || r.hasError)
85
- ), _ = l(() => !r.disabled && !d.value && !!r.errorMessage), m = l(() => ({
86
- "b-checkbox-group__checkboxes--horizontal": r.variant === u.HORIZONTAL
87
- })), c = (s) => !!o[s], p = l(() => c("content") && r.variant !== "vertical");
84
+ const r = a, o = v(), t = S("error"), { isReadOnly: u } = w(x(r, "readonly")), { emitValue: i } = B(e), m = l(
85
+ () => !r.disabled && !u.value && (!!r.errorMessage || r.hasError)
86
+ ), b = l(() => !r.disabled && !u.value && !!r.errorMessage), _ = l(() => ({
87
+ "b-checkbox-group__checkboxes--horizontal": r.variant === n.HORIZONTAL
88
+ })), p = (s) => !!o[s], c = l(() => p("content") && r.variant !== "vertical");
88
89
  f(
89
- p,
90
+ c,
90
91
  (s) => {
91
92
  if (s)
92
93
  throw new Error("The content slot is only available for the vertical checkbox group layout");
93
94
  },
94
95
  { immediate: !0 }
95
96
  );
96
- const i = x(r.modelValue);
97
+ const d = E(r.modelValue);
97
98
  f(
98
99
  () => r.modelValue,
99
100
  () => {
100
- i.value = r.modelValue;
101
+ d.value = r.modelValue;
101
102
  }
102
103
  );
103
- const y = (s) => {
104
- i.value = s, e(n.UPDATE, s), e(n.INPUT, s);
104
+ const g = (s) => {
105
+ d.value = s, i(s);
105
106
  };
106
- return C(() => {
107
+ return k(() => {
107
108
  r.hasError && M(
108
109
  'BentoCheckboxGroup "hasError" property',
109
110
  `Use the BentoCheckboxGroup "errorMessage" property instead to indicate that there is a modifier error.
@@ -111,13 +112,13 @@ const h = "bento-checkbox-group", O = {
111
112
  <bento-checkbox-group errorMessage="Error message text" />`,
112
113
  "2.0.0"
113
114
  );
114
- }), { __sfc: !0, COMPONENT_NAME: h, props: r, emit: e, slots: o, errorId: t, isReadOnly: d, shouldShowGroupError: b, shouldShowGroupErrorMessage: _, conditionalClasses: m, hasContentSlot: c, shouldShowSlotsError: p, inputValue: i, onInput: y, ControlsGroup: B, ErrorMessage: T, BentoCheckbox: k };
115
+ }), { __sfc: !0, COMPONENT_NAME: h, props: r, emit: e, slots: o, errorId: t, isReadOnly: u, emitValue: i, shouldShowGroupError: m, shouldShowGroupErrorMessage: b, conditionalClasses: _, hasContentSlot: p, shouldShowSlotsError: c, inputValue: d, onModelValueUpdate: g, ControlsGroup: G, ErrorMessage: V, BentoCheckbox: C };
115
116
  }
116
117
  });
117
- var G = function() {
118
+ var R = function() {
118
119
  var e = this, r = e._self._c, o = e._self._setupProxy;
119
- return r("div", { staticClass: "b-checkbox-group" }, [r(o.ControlsGroup, { staticClass: "b-checkbox-group__checkboxes", class: o.conditionalClasses, attrs: { "aria-describedby": o.shouldShowGroupErrorMessage ? o.errorId : "", "component-name": o.COMPONENT_NAME, description: e.description, disabled: e.disabled, form: e.formId, "hide-label": e.hideLabel, label: e.label, optional: e.optional, required: e.required, "tooltip-text": e.tooltipText } }, e._l(e.items, function(t) {
120
- return r(o.BentoCheckbox, { key: t.value, attrs: { "model-value": o.inputValue, value: t.value, disabled: e.disabled || t.disabled, "has-error": o.shouldShowGroupError || t.hasError, "error-message": o.shouldShowGroupError ? null : t.errorMessage, readonly: o.isReadOnly || t.readonly, tag: t.tag }, on: { "update:model-value": o.onInput }, scopedSlots: e._u([{ key: "default", fn: function() {
120
+ return r("div", { staticClass: "b-checkbox-group" }, [r(o.ControlsGroup, { staticClass: "b-checkbox-group__checkboxes", class: o.conditionalClasses, attrs: { "aria-describedby": o.shouldShowGroupErrorMessage ? o.errorId : "", "component-name": "bento-checkbox-group", description: e.description, disabled: e.disabled, form: e.formId, "hide-label": e.hideLabel, label: e.label, optional: e.optional, required: e.required, "tooltip-text": e.tooltipText } }, e._l(e.items, function(t) {
121
+ return r(o.BentoCheckbox, { key: t.value, attrs: { "model-value": o.inputValue, value: t.value, disabled: e.disabled || t.disabled, "has-error": o.shouldShowGroupError || t.hasError, "error-message": o.shouldShowGroupError ? null : t.errorMessage, readonly: o.isReadOnly || t.readonly, tag: t.tag }, on: { "update:model-value": o.onModelValueUpdate }, scopedSlots: e._u([{ key: "default", fn: function() {
121
122
  return [e._v(e._s(t.label))];
122
123
  }, proxy: !0 }, t.description ? { key: "description", fn: function() {
123
124
  return [e._v(e._s(t.description))];
@@ -125,17 +126,17 @@ var G = function() {
125
126
  return [e._t("content", null, null, t)];
126
127
  }, proxy: !0 } : null], null, !0) });
127
128
  }), 1), o.shouldShowGroupErrorMessage ? r(o.ErrorMessage, { staticClass: "b-checkbox-group__error-message", attrs: { id: o.errorId, "error-message": e.errorMessage } }) : e._e()], 1);
128
- }, N = [], L = /* @__PURE__ */ w(
129
- A,
130
- G,
131
- N,
129
+ }, T = [], A = /* @__PURE__ */ I(
130
+ L,
131
+ R,
132
+ T,
132
133
  !1,
133
134
  null,
134
- "188e88a2"
135
+ "27db5d32"
135
136
  );
136
- const D = L.exports;
137
+ const D = A.exports;
137
138
  export {
138
- u as B,
139
+ n as B,
139
140
  D as c
140
141
  };
141
- //# sourceMappingURL=checkbox-group.tm9zLXkK.js.map
142
+ //# sourceMappingURL=checkbox-group.CGxWh-no.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox-group.CGxWh-no.js","sources":["../../src/components/checkbox/components/checkbox-group/checkbox-group.types.ts","../../src/components/checkbox/components/checkbox-group/checkbox-group.vue"],"sourcesContent":["import { type FormFieldEmits } from '../../../../types/form-field';\nimport type { BentoCheckboxTag } from '../../checkbox.types';\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCheckboxGroupVariant {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n}\n\nexport interface BentoCheckboxGroupItem {\n value: string | number;\n label: string;\n description?: string;\n disabled?: boolean;\n hasError?: boolean;\n errorMessage?: string;\n readonly?: boolean;\n tag?: BentoCheckboxTag;\n}\n\nexport type BentoCheckboxGroupItems = Array<BentoCheckboxGroupItem>;\n\nexport type BentoCheckboxGroupEmits = FormFieldEmits<any>;\n","<template>\n <div class=\"b-checkbox-group\">\n <controls-group\n class=\"b-checkbox-group__checkboxes\"\n :aria-describedby=\"shouldShowGroupErrorMessage ? errorId : ''\"\n component-name=\"bento-checkbox-group\"\n :class=\"conditionalClasses\"\n :description=\"description\"\n :disabled=\"disabled\"\n :form=\"formId\"\n :hide-label=\"hideLabel\"\n :label=\"label\"\n :optional=\"optional\"\n :required=\"required\"\n :tooltip-text=\"tooltipText\"\n >\n <bento-checkbox\n v-for=\"item in items\"\n :key=\"item.value\"\n :model-value=\"inputValue\"\n :value=\"item.value\"\n :disabled=\"disabled || item.disabled\"\n :has-error=\"shouldShowGroupError || item.hasError\"\n :error-message=\"shouldShowGroupError ? null : item.errorMessage\"\n :readonly=\"isReadOnly || item.readonly\"\n :tag=\"item.tag\"\n @update:model-value=\"onModelValueUpdate\"\n >\n <template #default>{{ item.label }}</template>\n <template v-if=\"item.description\" #description>{{ item.description }}</template>\n <template v-if=\"hasContentSlot('content')\" #content>\n <slot name=\"content\" v-bind=\"item\"></slot>\n </template>\n </bento-checkbox>\n </controls-group>\n <error-message\n v-if=\"shouldShowGroupErrorMessage\"\n :id=\"errorId\"\n :error-message=\"errorMessage\"\n class=\"b-checkbox-group__error-message\"\n />\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, onMounted, type PropType, ref, toRef, useSlots, watch } from 'vue';\n import { ControlsGroup } from '@/components/internal/controls-group';\n import { ErrorMessage } from '@/components/internal/error-message';\n import {\n type BentoCheckboxGroupEmits,\n type BentoCheckboxGroupItems,\n BentoCheckboxGroupVariant,\n } from './checkbox-group.types';\n import BentoCheckbox from '@/components/checkbox/checkbox.vue';\n import { generateUid } from '@/core/utils/ts';\n import { deprecate } from '@/utils/ts/deprecate';\n import { useFormLayoutFieldLoading } from '@/composables/use-form-layout-loading/use-form-layout-loading';\n import { useFormFieldEmits } from '@/utils/ts/form-field/form-field';\n\n const props = defineProps({\n /**\n * Descriptive supporting text visbile underneath the label.\n */\n description: { type: String, default: null },\n\n /**\n * If set to true, renders all checkboxes in the group in a disabled state.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Renders all checkboxes in an error state with an error message.\n */\n errorMessage: { type: String, default: null },\n\n /**\n * The form id the checkbox group is associated with. Defaults to null, as a checkbox group can also be used standalone.\n */\n formId: { type: String, default: null },\n\n /**\n * If set to true, renders all checkboxes in the group in an error state.\n *\n * @deprecated Use \"errorMessage\" prop instead\n */\n hasError: { type: Boolean, default: false },\n\n /**\n * Shows/hides the group label.\n */\n hideLabel: { type: Boolean, default: null },\n\n /**\n * The checkbox group's items.\n */\n items: { type: Array as PropType<BentoCheckboxGroupItems>, required: true },\n\n /**\n * The name associated with the group. Required for accessibility purposes.\n */\n label: { type: String, required: true },\n\n /**\n * Determines the initially selected value of the group. Corresponds to the BentoCheckboxButtonItem's value.\n * Defaults to no value selected.\n */\n modelValue: { type: Array as PropType<Array<number | string | null>>, default: () => [] },\n\n /**\n * Indicates the field is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * If set to true, renders all checkboxes in the group in a readonly state.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Indicates the field is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Tooltip message.\n */\n tooltipText: { type: String, default: null },\n\n /**\n * The checkbox group's layout. It can be vertical or horizontal. Defaults to vertical.\n */\n variant: {\n type: String as PropType<BentoCheckboxGroupVariant | `${BentoCheckboxGroupVariant}`>,\n default: BentoCheckboxGroupVariant.VERTICAL,\n validator: (value: BentoCheckboxGroupVariant) => Object.values(BentoCheckboxGroupVariant).includes(value),\n },\n });\n\n const emit = defineEmits([\"update:model-value\", \"input\"]);\n\n const slots = useSlots();\n\n const errorId = generateUid('error');\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n const { emitValue } = useFormFieldEmits(emit);\n\n const shouldShowGroupError = computed(\n () => !props.disabled && !isReadOnly.value && (!!props.errorMessage || props.hasError)\n );\n const shouldShowGroupErrorMessage = computed(() => !props.disabled && !isReadOnly.value && !!props.errorMessage);\n\n const conditionalClasses = computed(() => ({\n 'b-checkbox-group__checkboxes--horizontal': props.variant === BentoCheckboxGroupVariant.HORIZONTAL,\n }));\n\n // Slots logic\n // Temporary, use-has-slots composable doesn't currently work for\n // vue3 named scoped slots\n const hasContentSlot = (name: string) => !!slots[name];\n const shouldShowSlotsError = computed(() => hasContentSlot('content') && props.variant !== 'vertical');\n\n watch(\n shouldShowSlotsError,\n newValue => {\n if (newValue) {\n throw new Error('The content slot is only available for the vertical checkbox group layout');\n }\n },\n { immediate: true }\n );\n\n const inputValue = ref(props.modelValue);\n watch(\n () => props.modelValue,\n () => {\n inputValue.value = props.modelValue;\n }\n );\n\n const onModelValueUpdate = (value: any) => {\n inputValue.value = value;\n emitValue(value);\n };\n\n onMounted(() => {\n if (props.hasError) {\n deprecate(\n 'BentoCheckboxGroup \"hasError\" property',\n `Use the BentoCheckboxGroup \"errorMessage\" property instead to indicate that there is a modifier error.\n Having the field as \"undefined\" will hide/remove the error.\n <bento-checkbox-group errorMessage=\"Error message text\" />`,\n '2.0.0'\n );\n }\n });\n</script>\n\n<script lang=\"ts\">\n const COMPONENT_NAME = 'bento-checkbox-group';\n /**\n * A checkbox group component should be used whenever it is necessary to group a set of checkboxes that are related together\n * This component conforms to the official WAI-ARIA guidelines for grouping controls: https://www.w3.org/WAI/tutorials/forms/grouping/\n *\n * import { BentoCheckboxGroup } from '@adyen/bento-vue2/';\n *\n * export default {\n * components: { BentoCheckboxGroup },\n * template: `\n * <bento-checkbox-group\n * label=\"Your group label\"\n * :items=\"[\n * { value: 1, label: 'Your label' },\n * { value: 2, label: 'Another label', description: 'Your sub label' },\n * ]\"\n * />\n * `\n * };\n */\n export default {\n name: COMPONENT_NAME,\n model: { prop: 'modelValue' },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./checkbox-group.scss\" />\n"],"names":["BentoCheckboxGroupVariant","BentoCheckboxGroupVariant2","COMPONENT_NAME","__default__","slots","useSlots","errorId","generateUid","isReadOnly","useFormLayoutFieldLoading","toRef","props","emitValue","useFormFieldEmits","emit","shouldShowGroupError","computed","shouldShowGroupErrorMessage","conditionalClasses","hasContentSlot","name","shouldShowSlotsError","watch","newValue","inputValue","ref","onModelValueUpdate","value","onMounted","deprecate"],"mappings":";;;;;;;;;;AAMY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,aAAA,cACAA,EAAA,WAAA,YAFQA,IAAAD,KAAA,CAAA,CAAA;ACgMR,MAAAE,IAAA,wBAoBAC,IAAA;AAAA,EAAe,MAAAD;AAAA,EACL,OAAA,EAAA,MAAA,aAAA;AAEV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAjFAE,IAAAC,EAAA,GAEAC,IAAAC,EAAA,OAAA,GACA,EAAA,YAAAC,EAAA,IAAAC,EAAAC,EAAAC,GAAA,UAAA,CAAA,GACA,EAAA,WAAAC,EAAA,IAAAC,EAAAC,CAAA,GAEAC,IAAAC;AAAA,MAA6B,MAAA,CAAAL,EAAA,YAAA,CAAAH,EAAA,UAAA,CAAA,CAAAG,EAAA,gBAAAA,EAAA;AAAA,IACoD,GAEjFM,IAAAD,EAAA,MAAA,CAAAL,EAAA,YAAA,CAAAH,EAAA,SAAA,CAAA,CAAAG,EAAA,YAAA,GAEAO,IAAAF,EAAA,OAAA;AAAA,MAA2C,4CAAAL,EAAA,YAAAX,EAAA;AAAA,IACiD,EAAA,GAM5FmB,IAAA,CAAAC,MAAA,CAAA,CAAAhB,EAAAgB,CAAA,GACAC,IAAAL,EAAA,MAAAG,EAAA,SAAA,KAAAR,EAAA,YAAA,UAAA;AAEA,IAAAW;AAAA,MAAAD;AAAA,MACI,CAAAE,MAAA;AAEI,YAAAA;AACI,gBAAA,IAAA,MAAA,2EAAA;AAAA,MACJ;AAAA,MACJ,EAAA,WAAA,GAAA;AAAA,IACkB;AAGtB,UAAAC,IAAAC,EAAAd,EAAA,UAAA;AACA,IAAAW;AAAA,MAAA,MAAAX,EAAA;AAAA,MACgB,MAAA;AAER,QAAAa,EAAA,QAAAb,EAAA;AAAA,MAAyB;AAAA,IAC7B;AAGJ,UAAAe,IAAA,CAAAC,MAAA;AACI,MAAAH,EAAA,QAAAG,GACAf,EAAAe,CAAA;AAAA,IAAe;AAGnB,WAAAC,EAAA,MAAA;AACI,MAAAjB,EAAA,YACIkB;AAAA,QAAA;AAAA,QACI;AAAA;AAAA;AAAA,QACA;AAAA,MAGA;AAAA,IAER,CAAA;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,15 +1,15 @@
1
1
  import { defineComponent as R, toRefs as k, computed as o, ref as A, onMounted as H, useAttrs as j } from "vue";
2
2
  import { B as F } from "./typography.hlOAxsEn.js";
3
- import { C as z } from "./checkbox-input.B0NsfSNR.js";
4
- import { C } from "./minus-small.DJacLGTw.js";
5
- import { u as J } from "./use-default-slot-validator.BDn0wkYP.js";
6
- import { u as O } from "./use-has-slot.C9lQZ6nz.js";
7
- import { g as B } from "./generate-uid.NJ8tVoha.js";
3
+ import { u as z } from "./use-default-slot-validator.BDn0wkYP.js";
4
+ import { u as J } from "./use-has-slot.C9lQZ6nz.js";
5
+ import { g as C } from "./generate-uid.NJ8tVoha.js";
8
6
  import { g as f } from "./get-slot-text.Bjb9dTSV.js";
9
- import { u as Y } from "./index.B6WW_F-J.js";
10
- import { u as K } from "./aria-label.CaUURpnB.js";
11
- import { B as Q } from "./tag.BltIbSh3.js";
12
- import { E as W } from "./field-label.Auq-Pzho.js";
7
+ import { u as O } from "./index.B6WW_F-J.js";
8
+ import { u as Y } from "./aria-label.CaUURpnB.js";
9
+ import { B as K } from "./tag.BdCP2CN_.js";
10
+ import { E as Q } from "./field-label.C3h8Q8Xd.js";
11
+ import { C as W } from "./checkbox-input.B0NsfSNR.js";
12
+ import { C as B } from "./minus-small.DJacLGTw.js";
13
13
  import { n as X } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
14
14
  import "../assets/checkbox.css";
15
15
  var s = /* @__PURE__ */ ((a) => (a.UPDATE = "update:model-value", a.INPUT = "input", a))(s || {});
@@ -33,10 +33,10 @@ const Z = {
33
33
  name: "bento-checkbox",
34
34
  i18n: { messages: Z },
35
35
  components: {
36
- BentoTag: Q,
36
+ BentoTag: K,
37
37
  BentoTypography: F,
38
- CheckboxInput: z,
39
- ErrorMessage: W
38
+ CheckboxInput: W,
39
+ ErrorMessage: Q
40
40
  },
41
41
  inheritAttrs: !1,
42
42
  model: { prop: "modelValue" },
@@ -105,8 +105,8 @@ const Z = {
105
105
  },
106
106
  emits: [s.UPDATE, s.INPUT],
107
107
  setup(a, { attrs: e, emit: t, slots: l }) {
108
- const { t: m } = Y(), h = B("description"), _ = B("error"), d = O(l), { disabled: y, indeterminate: E, modelValue: u, readonly: I, value: T } = k(a), v = f(l)("default"), g = f(l)("description");
109
- J("bento-checkbox", l.default, l.description);
108
+ const { t: m } = O(), h = C("description"), _ = C("error"), d = J(l), { disabled: y, indeterminate: E, modelValue: u, readonly: I, value: T } = k(a), v = f(l)("default"), g = f(l)("description");
109
+ z("bento-checkbox", l.default, l.description);
110
110
  const n = o(() => Array.isArray(u.value)), b = o(() => n.value ? u.value.some((r) => r === T.value) : u.value), i = o(() => E.value), q = o(
111
111
  () => !a.disabled && !a.readonly && (a.hasError || !!a.errorMessage)
112
112
  ), x = o(() => !a.disabled && !a.readonly && !!a.errorMessage), c = o(() => d("content")), p = o(() => (i == null ? void 0 : i.value) || (b == null ? void 0 : b.value)), D = o(
@@ -118,7 +118,7 @@ const Z = {
118
118
  S.value = m("checkbox");
119
119
  });
120
120
  const U = o(
121
- () => K({
121
+ () => Y({
122
122
  ariaLabel: M.value,
123
123
  // TODO: take this line away when the aria-label props is removed
124
124
  label: P,
@@ -131,8 +131,8 @@ const Z = {
131
131
  style: r
132
132
  };
133
133
  }), N = o(() => ({
134
- [`b-checkbox--${C.DISABLED}`]: y.value,
135
- [`b-checkbox--${C.READONLY}`]: I.value
134
+ [`b-checkbox--${B.DISABLED}`]: y.value,
135
+ [`b-checkbox--${B.READONLY}`]: I.value
136
136
  }));
137
137
  return {
138
138
  // Values
@@ -175,4 +175,4 @@ export {
175
175
  _e as B,
176
176
  s as a
177
177
  };
178
- //# sourceMappingURL=checkbox.itbBlXev.js.map
178
+ //# sourceMappingURL=checkbox.C6NSiW_I.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.itbBlXev.js","sources":["../../src/components/checkbox/checkbox.types.ts","../../src/components/checkbox/checkbox.vue"],"sourcesContent":["import type { BentoTagProps } from '../tag/tag.types';\nimport {\n CheckboxInputState as BentoCheckboxState,\n type CheckboxInputType as BentoCheckboxType,\n type MultiCheckboxInputType as BentoMultiCheckboxType,\n} from '@/internal/checkbox-input/checkbox-input.types';\n\nexport { BentoCheckboxState, BentoCheckboxType, BentoMultiCheckboxType };\n\nexport enum BentoCheckboxEvent {\n UPDATE = 'update:model-value',\n INPUT = 'input',\n}\n\nexport type BentoCheckboxTag = BentoTagProps;\n","<template>\n <label class=\"b-checkbox\" :class=\"conditionalClass\" v-bind=\"styleAttrs\" :aria-hidden=\"getAriaHidden($attrs)\">\n <checkbox-input\n v-bind=\"$attrs\"\n ref=\"input\"\n :aria-label=\"computedAriaLabel\"\n :aria-describedby=\"ariaDescribedBy\"\n :disabled=\"disabled\"\n :has-error=\"shouldShowError\"\n :indeterminate=\"isIndeterminate\"\n :value=\"value\"\n :model-value=\"modelValue\"\n :readonly=\"readonly\"\n @update:model-value=\"onChange\"\n />\n <span v-if=\"hasSlot('default') || shouldShowErrorMessage\" class=\"b-checkbox__text\">\n <bento-typography v-if=\"hasSlot('default')\" class=\"b-checkbox__label\" el=\"span\" variant=\"body\">\n <span><slot /></span>\n <bento-typography v-if=\"optional\" class=\"b-checkbox__label-requirement\" el=\"span\"\n >({{ t('optional') }})</bento-typography\n >\n <bento-typography v-else-if=\"required\" class=\"b-checkbox__label-requirement\" el=\"span\"\n >({{ t('required') }})</bento-typography\n >\n <bento-tag v-if=\"tag\" class=\"b-checkbox__label-tag\" v-bind=\"tag\" />\n </bento-typography>\n <bento-typography\n v-if=\"hasSlot('default') && hasSlot('description')\"\n :id=\"descriptionId\"\n class=\"b-checkbox__description\"\n el=\"span\"\n variant=\"body\"\n >\n <slot name=\"description\"></slot>\n </bento-typography>\n <error-message v-if=\"shouldShowErrorMessage\" :id=\"errorId\" :error-message=\"errorMessage\" />\n\n <bento-typography v-if=\"contentSlotAvailable\" class=\"b-checkbox__content\" el=\"span\" variant=\"body\">\n <slot name=\"content\"></slot>\n </bento-typography>\n </span>\n </label>\n</template>\n\n<script lang=\"ts\">\n import {\n computed,\n defineComponent,\n type HTMLAttributes,\n onMounted,\n type PropType,\n ref,\n toRefs,\n useAttrs,\n } from 'vue';\n import {\n BentoCheckboxEvent,\n BentoCheckboxState,\n type BentoCheckboxTag,\n type BentoCheckboxType,\n type BentoMultiCheckboxType,\n } from './checkbox.types';\n import { BentoTypography } from '@/components/typography';\n import { CheckboxInput } from '@/components/internal/checkbox-input';\n import { ErrorMessage } from '@/components/internal/error-message';\n import { useDefaultSlotValidator, useHasSlot } from '@/composables';\n import { generateUid } from '@/core/utils/ts';\n import { getSlotText } from '@/utils/ts/get-slot-text';\n import { useI18n } from '@/utils/ts/i18n';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { BentoTag } from '@/components/tag';\n import { type BentoCheckboxGroupItems } from './components/checkbox-group/checkbox-group.types';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n /**\n * Checkboxes are used to make a binary choice about an option.\n * The label tag area is also clickable.\n *\n * @usage\n * import { BentoCheckbox } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoCheckbox },\n * template: `\n * <bento-checkbox>\n * Label text\n * <template #description>Sub label text</template>\n * </bento-checkbox>\n * `,\n * }\n */\n export default defineComponent({\n name: 'bento-checkbox',\n i18n: { messages },\n components: {\n BentoTag,\n BentoTypography,\n CheckboxInput,\n ErrorMessage,\n },\n inheritAttrs: false,\n model: { prop: 'modelValue' },\n props: {\n /**\n * @deprecated from version 2.0.0. Use the aria-label attribute instead.\n */\n /**\n * Accessible name for the radio button component. It is strongly recommended to pas this value in case this component is used without a label.\n */\n ariaLabel: { type: String, default: null },\n\n /**\n * Setting this property to true will disable the checkbox in your form.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Renders the checkbox in an error state with an error message.\n */\n errorMessage: { type: String, default: null },\n\n /**\n * Setting this property to true will show the checkbox in error state.\n */\n hasError: { type: Boolean, default: false },\n\n /**\n * The :indeterminate CSS pseudo-class represents any form element\n * whose state is indeterminate, such as checkboxes which have their HTML indeterminate attribute\n * set to true, radio buttons which are members of a group in which all radio buttons are unchecked,\n * and indeterminate <progress> elements. https://developer.mozilla.org/en-US/docs/Web/CSS/:indeterminate\n * This property lets you control the input.indeterminate native property.\n */\n indeterminate: { type: Boolean, default: false },\n\n /**\n * When handling a single checkbox with a singular state, use a boolean.\n *\n * When handling multiple checkboxes, use an array of keys.\n * These keys exist as a set \"value\" prop for each checkbox.\n */\n modelValue: {\n type: [Boolean, Array] as PropType<BentoCheckboxType | BentoCheckboxGroupItems>,\n default: false,\n },\n\n /**\n * Highlights the checkbox is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * Setting this property to true will set the checkbox to read only state.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Highlights the checkbox is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Sets the properties of the BentoTag component that is placed next to the label.\n * {@see BentoTag}\n */\n tag: { type: Object as PropType<BentoCheckboxTag>, default: undefined },\n\n /**\n * The value of the component. The DOM API casts this to a string.\n * The browser uses \"on\" as the default value.\n *\n * In the case of multiple checkboxes this value is used as a unique key.\n */\n value: { type: [String, Number], default: null },\n },\n emits: [BentoCheckboxEvent.UPDATE, BentoCheckboxEvent.INPUT],\n setup(props, { attrs, emit, slots }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const descriptionId = generateUid('description');\n const errorId = generateUid('error');\n const hasSlot = useHasSlot(slots);\n\n const { disabled, indeterminate, modelValue, readonly, value } = toRefs(props);\n\n const defaultSlotValue = getSlotText(slots)('default');\n const descriptionSlotValue = getSlotText(slots)('description');\n\n useDefaultSlotValidator('bento-checkbox', slots.default, slots.description);\n\n const isCheckboxGroup = computed(() => Array.isArray(modelValue.value));\n const isChecked = computed(() => {\n if (!isCheckboxGroup.value) {\n return modelValue.value as boolean;\n }\n\n return (modelValue.value as BentoMultiCheckboxType).some(item => item === value.value);\n });\n const isIndeterminate = computed(() => indeterminate.value);\n\n const shouldShowError = computed(\n () => !props.disabled && !props.readonly && (props.hasError || !!props.errorMessage)\n );\n const shouldShowErrorMessage = computed(() => !props.disabled && !props.readonly && !!props.errorMessage);\n\n // Content slot logic\n const hasContentSlot = computed(() => hasSlot('content'));\n const isCheckedOrIntermediate = computed(() => isIndeterminate?.value || isChecked?.value);\n const contentSlotAvailable = computed(\n () => hasContentSlot?.value && isCheckboxGroup?.value && isCheckedOrIntermediate?.value\n );\n\n // ARIA fields\n const ariaDescribedBy = computed<HTMLAttributes['aria-describedby']>(\n () =>\n `${shouldShowErrorMessage.value ? errorId : ''} ${\n defaultSlotValue && descriptionSlotValue ? descriptionId : ''\n }`.trim() || null\n );\n\n const ariaLabelAttribute = ref(attrs['aria-label']);\n const { ariaLabel } = toRefs(props);\n const checkboxTranslation = ref();\n // Translations used in the script tag need to be inside onMounted otherwise they fail in Vue 3\n onMounted(() => {\n checkboxTranslation.value = t('checkbox');\n });\n // Only add aria-label if no label slot is present\n const computedAriaLabel = computed(\n () =>\n useAriaLabel({\n ariaLabel: ariaLabelAttribute.value as string,\n // TODO: take this line away when the aria-label props is removed\n label: ariaLabel,\n defaultFallback: hasSlot('default')\n ? (getSlotText(slots)('default') as string)\n : checkboxTranslation.value,\n }).value\n );\n const getAriaHidden = (attributes: HTMLAttributes) => attributes?.['aria-hidden'];\n\n const styleAttrs = computed(() => {\n const { style, class: cls } = useAttrs();\n return {\n class: cls as HTMLAttributes['class'],\n style: style as HTMLAttributes['style'],\n };\n });\n\n const conditionalClass = computed(() => ({\n [`b-checkbox--${BentoCheckboxState.DISABLED}`]: disabled.value,\n [`b-checkbox--${BentoCheckboxState.READONLY}`]: readonly.value,\n }));\n\n const onChange = (newValue: BentoCheckboxType | BentoCheckboxGroupItems) => {\n if (disabled.value) {\n return;\n }\n emit(BentoCheckboxEvent.UPDATE, newValue);\n emit(BentoCheckboxEvent.INPUT, newValue);\n };\n\n return {\n // Values\n descriptionId,\n errorId,\n ariaDescribedBy,\n computedAriaLabel,\n conditionalClass,\n defaultSlotValue,\n descriptionSlotValue,\n isIndeterminate,\n shouldShowError,\n shouldShowErrorMessage,\n contentSlotAvailable,\n hasContentSlot,\n styleAttrs,\n\n // Methods\n hasSlot,\n onChange,\n getAriaHidden,\n\n t,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./checkbox.scss\" />\n"],"names":["BentoCheckboxEvent","BentoCheckboxEvent2","_sfc_main","defineComponent","messages","BentoTag","BentoTypography","CheckboxInput","ErrorMessage","props","attrs","emit","slots","t","useI18n","descriptionId","generateUid","errorId","hasSlot","useHasSlot","disabled","indeterminate","modelValue","readonly","value","toRefs","defaultSlotValue","getSlotText","descriptionSlotValue","useDefaultSlotValidator","isCheckboxGroup","computed","isChecked","item","isIndeterminate","shouldShowError","shouldShowErrorMessage","hasContentSlot","isCheckedOrIntermediate","contentSlotAvailable","ariaDescribedBy","ariaLabelAttribute","ref","ariaLabel","checkboxTranslation","onMounted","computedAriaLabel","useAriaLabel","getAriaHidden","attributes","styleAttrs","style","cls","useAttrs","conditionalClass","CheckboxInputState","newValue"],"mappings":";;;;;;;;;;;;;;AASY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,SAAA,sBACAA,EAAA,QAAA,SAFQA,IAAAD,KAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;GCoFZE,IAAAC,EAAA;AAAA,EAAA,MAAA;AAAA,EACA,MAAA,EAAA,UAAAC,EAAA;AAAA,EACA,YAAA;AAAA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A/B,EAAA,UAAA;AAAA,IAAA,CAAA;AAGA,UAAAiC,IAAAf;AAAA,MAAA,MAAAgB,EAAA;AAAA,QAEA,WAAAN,EAAA;AAAA;AAAA,QACA,OAAAE;AAAA,QAEA,iBAAAzB,EAAA,SAAA,IAAAS,EAAAf,CAAA,EAAA,SAAA,IAAAgC,EAAA;AAAA,MAGA,CAAA,EAAA;AAAA,IACA,GAEAI,IAAA,CAAAC,MAAAA,KAAA,gBAAAA,EAAA,gBAEAC,IAAAnB,EAAA,MAAA;AACA,YAAA,EAAA,OAAAoB,GAAA,OAAAC,EAAA,IAAAC,EAAA;AACA,aAAA;AAAA,QAAA,OAAAD;AAAA,QACA,OAAAD;AAAA,MACA;AAAA,IACA,CAAA,GAGAG,IAAAvB,EAAA,OAAA;AAAA,MAAA,CAAA,eAAAwB,EAAA,QAAA,EAAA,GAAAnC,EAAA;AAAA,MACA,CAAA,eAAAmC,EAAA,QAAA,EAAA,GAAAhC,EAAA;AAAA,IACA,EAAA;AAWA,WAAA;AAAA;AAAA,MAAA,eAAAR;AAAA,MAEA,SAAAE;AAAA,MACA,iBAAAuB;AAAA,MACA,mBAAAM;AAAA,MACA,kBAAAQ;AAAA,MACA,kBAAA5B;AAAA,MACA,sBAAAE;AAAA,MACA,iBAAAM;AAAA,MACA,iBAAAC;AAAA,MACA,wBAAAC;AAAA,MACA,sBAAAG;AAAA,MACA,gBAAAF;AAAA,MACA,YAAAa;AAAA;AAAA,MACA,SAAAhC;AAAA,MAGA,UAzBA,CAAAsC,MAAA;AACA,QAAApC,EAAA,UAGAT,EAAAX,EAAA,QAAAwD,CAAA,GACA7C,EAAAX,EAAA,OAAAwD,CAAA;AAAA,MAAA;AAAA,MAqBA,eAAAR;AAAA,MACA,GAAAnC;AAAA,IAEA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"checkbox.C6NSiW_I.js","sources":["../../src/components/checkbox/checkbox.types.ts","../../src/components/checkbox/checkbox.vue"],"sourcesContent":["import type { BentoTagProps } from '../tag/tag.types';\nimport {\n CheckboxInputState as BentoCheckboxState,\n type CheckboxInputType as BentoCheckboxType,\n type MultiCheckboxInputType as BentoMultiCheckboxType,\n} from '@/internal/checkbox-input/checkbox-input.types';\n\nexport { BentoCheckboxState, BentoCheckboxType, BentoMultiCheckboxType };\n\nexport enum BentoCheckboxEvent {\n UPDATE = 'update:model-value',\n INPUT = 'input',\n}\n\nexport type BentoCheckboxTag = BentoTagProps;\n","<template>\n <label class=\"b-checkbox\" :class=\"conditionalClass\" v-bind=\"styleAttrs\" :aria-hidden=\"getAriaHidden($attrs)\">\n <checkbox-input\n v-bind=\"$attrs\"\n ref=\"input\"\n :aria-label=\"computedAriaLabel\"\n :aria-describedby=\"ariaDescribedBy\"\n :disabled=\"disabled\"\n :has-error=\"shouldShowError\"\n :indeterminate=\"isIndeterminate\"\n :value=\"value\"\n :model-value=\"modelValue\"\n :readonly=\"readonly\"\n @update:model-value=\"onChange\"\n />\n <span v-if=\"hasSlot('default') || shouldShowErrorMessage\" class=\"b-checkbox__text\">\n <bento-typography v-if=\"hasSlot('default')\" class=\"b-checkbox__label\" el=\"span\" variant=\"body\">\n <span><slot /></span>\n <bento-typography v-if=\"optional\" class=\"b-checkbox__label-requirement\" el=\"span\"\n >({{ t('optional') }})</bento-typography\n >\n <bento-typography v-else-if=\"required\" class=\"b-checkbox__label-requirement\" el=\"span\"\n >({{ t('required') }})</bento-typography\n >\n <bento-tag v-if=\"tag\" class=\"b-checkbox__label-tag\" v-bind=\"tag\" />\n </bento-typography>\n <bento-typography\n v-if=\"hasSlot('default') && hasSlot('description')\"\n :id=\"descriptionId\"\n class=\"b-checkbox__description\"\n el=\"span\"\n variant=\"body\"\n >\n <slot name=\"description\"></slot>\n </bento-typography>\n <error-message v-if=\"shouldShowErrorMessage\" :id=\"errorId\" :error-message=\"errorMessage\" />\n\n <bento-typography v-if=\"contentSlotAvailable\" class=\"b-checkbox__content\" el=\"span\" variant=\"body\">\n <slot name=\"content\"></slot>\n </bento-typography>\n </span>\n </label>\n</template>\n\n<script lang=\"ts\">\n import {\n computed,\n defineComponent,\n type HTMLAttributes,\n onMounted,\n type PropType,\n ref,\n toRefs,\n useAttrs,\n } from 'vue';\n import {\n BentoCheckboxEvent,\n BentoCheckboxState,\n type BentoCheckboxTag,\n type BentoCheckboxType,\n type BentoMultiCheckboxType,\n } from './checkbox.types';\n import { BentoTypography } from '@/components/typography';\n import { CheckboxInput } from '@/components/internal/checkbox-input';\n import { ErrorMessage } from '@/components/internal/error-message';\n import { useDefaultSlotValidator, useHasSlot } from '@/composables';\n import { generateUid } from '@/core/utils/ts';\n import { getSlotText } from '@/utils/ts/get-slot-text';\n import { useI18n } from '@/utils/ts/i18n';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { BentoTag } from '@/components/tag';\n import { type BentoCheckboxGroupItems } from './components/checkbox-group/checkbox-group.types';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n /**\n * Checkboxes are used to make a binary choice about an option.\n * The label tag area is also clickable.\n *\n * @usage\n * import { BentoCheckbox } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoCheckbox },\n * template: `\n * <bento-checkbox>\n * Label text\n * <template #description>Sub label text</template>\n * </bento-checkbox>\n * `,\n * }\n */\n export default defineComponent({\n name: 'bento-checkbox',\n i18n: { messages },\n components: {\n BentoTag,\n BentoTypography,\n CheckboxInput,\n ErrorMessage,\n },\n inheritAttrs: false,\n model: { prop: 'modelValue' },\n props: {\n /**\n * @deprecated from version 2.0.0. Use the aria-label attribute instead.\n */\n /**\n * Accessible name for the radio button component. It is strongly recommended to pas this value in case this component is used without a label.\n */\n ariaLabel: { type: String, default: null },\n\n /**\n * Setting this property to true will disable the checkbox in your form.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Renders the checkbox in an error state with an error message.\n */\n errorMessage: { type: String, default: null },\n\n /**\n * Setting this property to true will show the checkbox in error state.\n */\n hasError: { type: Boolean, default: false },\n\n /**\n * The :indeterminate CSS pseudo-class represents any form element\n * whose state is indeterminate, such as checkboxes which have their HTML indeterminate attribute\n * set to true, radio buttons which are members of a group in which all radio buttons are unchecked,\n * and indeterminate <progress> elements. https://developer.mozilla.org/en-US/docs/Web/CSS/:indeterminate\n * This property lets you control the input.indeterminate native property.\n */\n indeterminate: { type: Boolean, default: false },\n\n /**\n * When handling a single checkbox with a singular state, use a boolean.\n *\n * When handling multiple checkboxes, use an array of keys.\n * These keys exist as a set \"value\" prop for each checkbox.\n */\n modelValue: {\n type: [Boolean, Array] as PropType<BentoCheckboxType | BentoCheckboxGroupItems>,\n default: false,\n },\n\n /**\n * Highlights the checkbox is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * Setting this property to true will set the checkbox to read only state.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Highlights the checkbox is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Sets the properties of the BentoTag component that is placed next to the label.\n * {@see BentoTag}\n */\n tag: { type: Object as PropType<BentoCheckboxTag>, default: undefined },\n\n /**\n * The value of the component. The DOM API casts this to a string.\n * The browser uses \"on\" as the default value.\n *\n * In the case of multiple checkboxes this value is used as a unique key.\n */\n value: { type: [String, Number], default: null },\n },\n emits: [BentoCheckboxEvent.UPDATE, BentoCheckboxEvent.INPUT],\n setup(props, { attrs, emit, slots }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const descriptionId = generateUid('description');\n const errorId = generateUid('error');\n const hasSlot = useHasSlot(slots);\n\n const { disabled, indeterminate, modelValue, readonly, value } = toRefs(props);\n\n const defaultSlotValue = getSlotText(slots)('default');\n const descriptionSlotValue = getSlotText(slots)('description');\n\n useDefaultSlotValidator('bento-checkbox', slots.default, slots.description);\n\n const isCheckboxGroup = computed(() => Array.isArray(modelValue.value));\n const isChecked = computed(() => {\n if (!isCheckboxGroup.value) {\n return modelValue.value as boolean;\n }\n\n return (modelValue.value as BentoMultiCheckboxType).some(item => item === value.value);\n });\n const isIndeterminate = computed(() => indeterminate.value);\n\n const shouldShowError = computed(\n () => !props.disabled && !props.readonly && (props.hasError || !!props.errorMessage)\n );\n const shouldShowErrorMessage = computed(() => !props.disabled && !props.readonly && !!props.errorMessage);\n\n // Content slot logic\n const hasContentSlot = computed(() => hasSlot('content'));\n const isCheckedOrIntermediate = computed(() => isIndeterminate?.value || isChecked?.value);\n const contentSlotAvailable = computed(\n () => hasContentSlot?.value && isCheckboxGroup?.value && isCheckedOrIntermediate?.value\n );\n\n // ARIA fields\n const ariaDescribedBy = computed<HTMLAttributes['aria-describedby']>(\n () =>\n `${shouldShowErrorMessage.value ? errorId : ''} ${\n defaultSlotValue && descriptionSlotValue ? descriptionId : ''\n }`.trim() || null\n );\n\n const ariaLabelAttribute = ref(attrs['aria-label']);\n const { ariaLabel } = toRefs(props);\n const checkboxTranslation = ref();\n // Translations used in the script tag need to be inside onMounted otherwise they fail in Vue 3\n onMounted(() => {\n checkboxTranslation.value = t('checkbox');\n });\n // Only add aria-label if no label slot is present\n const computedAriaLabel = computed(\n () =>\n useAriaLabel({\n ariaLabel: ariaLabelAttribute.value as string,\n // TODO: take this line away when the aria-label props is removed\n label: ariaLabel,\n defaultFallback: hasSlot('default')\n ? (getSlotText(slots)('default') as string)\n : checkboxTranslation.value,\n }).value\n );\n const getAriaHidden = (attributes: HTMLAttributes) => attributes?.['aria-hidden'];\n\n const styleAttrs = computed(() => {\n const { style, class: cls } = useAttrs();\n return {\n class: cls as HTMLAttributes['class'],\n style: style as HTMLAttributes['style'],\n };\n });\n\n const conditionalClass = computed(() => ({\n [`b-checkbox--${BentoCheckboxState.DISABLED}`]: disabled.value,\n [`b-checkbox--${BentoCheckboxState.READONLY}`]: readonly.value,\n }));\n\n const onChange = (newValue: BentoCheckboxType | BentoCheckboxGroupItems) => {\n if (disabled.value) {\n return;\n }\n emit(BentoCheckboxEvent.UPDATE, newValue);\n emit(BentoCheckboxEvent.INPUT, newValue);\n };\n\n return {\n // Values\n descriptionId,\n errorId,\n ariaDescribedBy,\n computedAriaLabel,\n conditionalClass,\n defaultSlotValue,\n descriptionSlotValue,\n isIndeterminate,\n shouldShowError,\n shouldShowErrorMessage,\n contentSlotAvailable,\n hasContentSlot,\n styleAttrs,\n\n // Methods\n hasSlot,\n onChange,\n getAriaHidden,\n\n t,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./checkbox.scss\" />\n"],"names":["BentoCheckboxEvent","BentoCheckboxEvent2","_sfc_main","defineComponent","messages","BentoTag","BentoTypography","CheckboxInput","ErrorMessage","props","attrs","emit","slots","t","useI18n","descriptionId","generateUid","errorId","hasSlot","useHasSlot","disabled","indeterminate","modelValue","readonly","value","toRefs","defaultSlotValue","getSlotText","descriptionSlotValue","useDefaultSlotValidator","isCheckboxGroup","computed","isChecked","item","isIndeterminate","shouldShowError","shouldShowErrorMessage","hasContentSlot","isCheckedOrIntermediate","contentSlotAvailable","ariaDescribedBy","ariaLabelAttribute","ref","ariaLabel","checkboxTranslation","onMounted","computedAriaLabel","useAriaLabel","getAriaHidden","attributes","styleAttrs","style","cls","useAttrs","conditionalClass","CheckboxInputState","newValue"],"mappings":";;;;;;;;;;;;;;AASY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,SAAA,sBACAA,EAAA,QAAA,SAFQA,IAAAD,KAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;GCoFZE,IAAAC,EAAA;AAAA,EAAA,MAAA;AAAA,EACA,MAAA,EAAA,UAAAC,EAAA;AAAA,EACA,YAAA;AAAA,IACA,UAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,cAAAC;AAAA,EACA;AAAA,EACA,cAAA;AAAA,EACA,OAAA,EAAA,MAAA,aAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IACA,WAAA,EAAA,MAAA,QAAA,SAAA,KAAA;AAAA;AAAA;AAAA;AAAA,IAOA,UAAA,EAAA,MAAA,SAAA,SAA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,EAAA,gBAEAC,IAAAnB,EAAA,MAAA;AACA,YAAA,EAAA,OAAAoB,GAAA,OAAAC,EAAA,IAAAC,EAAA;AACA,aAAA;AAAA,QAAA,OAAAD;AAAA,QACA,OAAAD;AAAA,MACA;AAAA,IACA,CAAA,GAGAG,IAAAvB,EAAA,OAAA;AAAA,MAAA,CAAA,eAAAwB,EAAA,QAAA,EAAA,GAAAnC,EAAA;AAAA,MACA,CAAA,eAAAmC,EAAA,QAAA,EAAA,GAAAhC,EAAA;AAAA,IACA,EAAA;AAWA,WAAA;AAAA;AAAA,MAAA,eAAAR;AAAA,MAEA,SAAAE;AAAA,MACA,iBAAAuB;AAAA,MACA,mBAAAM;AAAA,MACA,kBAAAQ;AAAA,MACA,kBAAA5B;AAAA,MACA,sBAAAE;AAAA,MACA,iBAAAM;AAAA,MACA,iBAAAC;AAAA,MACA,wBAAAC;AAAA,MACA,sBAAAG;AAAA,MACA,gBAAAF;AAAA,MACA,YAAAa;AAAA;AAAA,MACA,SAAAhC;AAAA,MAGA,UAzBA,CAAAsC,MAAA;AACA,QAAApC,EAAA,UAGAT,EAAAX,EAAA,QAAAwD,CAAA,GACA7C,EAAAX,EAAA,OAAAwD,CAAA;AAAA,MAAA;AAAA,MAqBA,eAAAR;AAAA,MACA,GAAAnC;AAAA,IAEA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;"}
@@ -1,14 +1,14 @@
1
1
  import { defineComponent as Y, useAttrs as H, ref as g, computed as l, shallowRef as P, onMounted as V, watch as D, watchEffect as Z } from "vue";
2
- import { s as j, H as J, t as e, L as W, a as U, b as G, c as z, p as F, j as X, d as K, x as q, e as ee, E as te, h as ne, k as ae, C as f, f as _, i as oe, g as A, l as se, m as ie } from "./codemirror.Zv80n3Z2.js";
2
+ import { s as j, H as J, t as e, L as W, a as U, b as G, c as z, p as F, j as X, d as K, x as q, e as ee, E as te, h as ne, k as ae, C as f, f as _, i as oe, g as A, l as se, m as ie } from "./codemirror.Cy7iSLbd.js";
3
3
  import { c as re, d as le, e as ce, f as de } from "./es6.MoTTyETW.js";
4
- import { B as pe } from "./dropdown.BiA1YOYJ.js";
4
+ import { B as pe } from "./dropdown.BpT6ct8O.js";
5
5
  import { B as ue } from "./button.CS_kdxYh.js";
6
6
  import { B as ge } from "./typography.hlOAxsEn.js";
7
7
  import { B as fe } from "./loading-indicator.PxbRzshH.js";
8
8
  import { u as he } from "./index.B6WW_F-J.js";
9
9
  import { E as me } from "./expand.Bbielaja.js";
10
- import { h as be } from "./base-modal.BMdlCSd0.js";
11
- import { C as _e } from "./copy.WQDLcs_T.js";
10
+ import { h as be } from "./base-modal.BJ6315kP.js";
11
+ import { C as _e } from "./copy.Hu3DFJwv.js";
12
12
  import { n as Oe } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
13
13
  import "../assets/code-snippet.css";
14
14
  const ve = {
@@ -265,4 +265,4 @@ export {
265
265
  c as b,
266
266
  Ge as c
267
267
  };
268
- //# sourceMappingURL=code-snippet.trioWquF.js.map
268
+ //# sourceMappingURL=code-snippet.bzFOFUj4.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-snippet.trioWquF.js","sources":["../../src/components/code-snippet/highlight.ts","../../src/components/code-snippet/code-snippet.types.ts","../../../../node_modules/.pnpm/codemirror-lang-csv@0.1.1/node_modules/codemirror-lang-csv/dist/index.js","../../src/components/code-snippet/utils/get-lang-loader.ts","../../src/components/code-snippet/utils/indent-same-as-line-before-extension.ts","../../src/components/code-snippet/code-snippet.vue"],"sourcesContent":["import { HighlightStyle, syntaxHighlighting } from '@codemirror/language';\nimport { tags as t } from '@lezer/highlight';\nimport {\n BCodeSnippetCodeAreaHighlightBlue,\n BCodeSnippetCodeAreaHighlightGreen,\n BCodeSnippetCodeAreaHighlightOrange,\n BCodeSnippetCodeAreaHighlightRed,\n} from '@adyen/bento-design-tokens/dist/js/bento/es6';\nimport { type BentoCodeSnippetSupportedLanguage } from './code-snippet.types';\n\nconst lightThemeColors = {\n red: BCodeSnippetCodeAreaHighlightRed,\n orange: BCodeSnippetCodeAreaHighlightOrange,\n green: BCodeSnippetCodeAreaHighlightGreen,\n blue: BCodeSnippetCodeAreaHighlightBlue,\n invalid: '#ffffff',\n};\n\nconst highlightStyle = (colors, language: BentoCodeSnippetSupportedLanguage | `${BentoCodeSnippetSupportedLanguage}`) =>\n HighlightStyle.define([\n {\n tag: t.keyword,\n color: colors.red,\n },\n {\n tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName],\n color: colors.green,\n },\n {\n tag: [t.function(t.variableName), t.labelName],\n color: colors.blue,\n },\n {\n tag: [t.color, t.constant(t.name), t.standard(t.name)],\n color: colors.red,\n },\n {\n tag: [t.definition(t.name), ...(language !== 'json' ? [t.separator] : [])],\n color: colors.red,\n },\n {\n tag: [t.typeName, t.className, t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace],\n color: colors.orange,\n },\n {\n tag: [t.operator, t.operatorKeyword, t.url, t.escape, t.regexp, t.link, t.special(t.string)],\n color: colors.blue,\n },\n {\n tag: [t.meta, t.comment],\n color: colors.orange,\n },\n {\n tag: t.strong,\n fontWeight: 'bold',\n },\n {\n tag: t.emphasis,\n fontStyle: 'italic',\n },\n {\n tag: t.strikethrough,\n textDecoration: 'line-through',\n },\n {\n tag: t.link,\n color: colors.orange,\n textDecoration: 'underline',\n },\n {\n tag: t.heading,\n fontWeight: 'bold',\n color: colors.blue,\n },\n {\n tag: [t.atom, t.bool, t.special(t.variableName)],\n color: colors.red,\n },\n {\n tag: [t.processingInstruction, t.string, t.inserted],\n color: colors.blue,\n },\n {\n tag: t.invalid,\n color: colors.invalid,\n },\n ]);\n\nexport const lightThemeHighlight = (\n language: BentoCodeSnippetSupportedLanguage | `${BentoCodeSnippetSupportedLanguage}`\n) => syntaxHighlighting(highlightStyle(lightThemeColors, language));\n","/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCodeSnippetVariant {\n INLINE = 'inline',\n SINGLELINE = 'singleline',\n MULTILINE = 'multiline',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCodeSnippetSupportedLanguage {\n JSON = 'json',\n XML = 'xml',\n JAVA = 'java',\n JAVASCRIPT = 'javascript',\n PYTHON = 'python',\n CSV = 'csv',\n}\n\nexport enum BentoCodeSnippetEvent {\n ACTION = 'action',\n CHANGE = 'change',\n}\n\nexport interface BentoCodeSnippetProps {\n /**\n * Displays a button that when clicked will emit an action event\n * Leaves to the parent component the logic of what to do with it\n */\n actionable?: boolean;\n\n /**\n * Displays a button that when clicked will emit a run event\n * Leaves to the parent component the logic of what to do with it\n */\n actionableText?: string;\n\n /**\n * The code content\n */\n content?: string;\n\n /**\n * Displays a button that can expand the codeblock into a modal to easily\n * view large blocks of code.\n */\n expandable?: boolean;\n\n /**\n * Allows editing of the code-snippet content by the user\n */\n editable?: boolean;\n\n /**\n * Language name for syntax highlighting rules\n */\n lang?: BentoCodeSnippetSupportedLanguage | `${BentoCodeSnippetSupportedLanguage}`;\n\n /**\n * Label to show in the action-bar, describing the language\n */\n langLabel?: string;\n\n /**\n * Toggles the loading indicator within the action bar\n */\n loading?: boolean;\n\n /**\n * Defines the variant of code-snippet\n */\n variant?: BentoCodeSnippetVariant | `${BentoCodeSnippetVariant}`;\n}\n","import { LRParser } from '@lezer/lr';\nimport { LRLanguage, LanguageSupport } from '@codemirror/language';\nimport { styleTags, tags } from '@lezer/highlight';\n\n// This file was generated by lezer-generator. You probably shouldn't edit it.\nconst parser = LRParser.deserialize({\n version: 14,\n states: \"nQVQPOOOOQO'#Ce'#CeOOQO'#Ca'#CaQVQPOOOOQO-E6_-E6_\",\n stateData: \"g~OWOS~OQPORPOSPO~OQRSR~\",\n goto: \"eYPPPPPZPPPaQRORSRTQOR\",\n nodeNames: \"⚠ Program String Separator Value\",\n maxTerm: 9,\n skippedNodes: [0],\n repeatNodeCount: 1,\n tokenData: \"'Y~RZOYtYZ!cZrtrs!hs|t|}'T}!]t!]!^'T!^;'St;'S;=`!]<%lOt~yUS~OYtZ|t}!]t!^;'St;'S;=`!]<%lOt~!`P;=`<%lt~!hOW~~!m]S~OY!hYZ#fZr!hrs%Ss|!h|}#f}!]!h!]!^#f!^#O!h#O#P%m#P;'S!h;'S;=`&}<%lO!h~#iVOr#frs$Os#O#f#O#P$T#P;'S#f;'S;=`$|<%lO#f~$TOQ~~$WRO;'S#f;'S;=`$a;=`O#f~$dWOr#frs$Os#O#f#O#P$T#P;'S#f;'S;=`$|;=`<%l#f<%lO#f~%PP;=`<%l#f~%ZUQ~S~OYtZ|t}!]t!^;'St;'S;=`!]<%lOt~%rYS~OY!hYZ#fZ|!h|}#f}!]!h!]!^#f!^;'S!h;'S;=`&b;=`<%l#f<%lO!h~&eWOr#frs$Os#O#f#O#P$T#P;'S#f;'S;=`$|;=`<%l!h<%lO#f~'QP;=`<%l!h~'YOR~\",\n tokenizers: [0],\n topRules: {\"Program\":[0,1]},\n tokenPrec: 18\n});\n\nconst csvLanguage = LRLanguage.define({\n parser: parser.configure({\n props: [\n styleTags({\n Separator: tags.separator,\n Value: tags.string,\n String: tags.string,\n LineComment: tags.lineComment,\n \"( )\": tags.paren,\n }),\n ],\n }),\n});\nfunction csv() {\n return new LanguageSupport(csvLanguage);\n}\n\nexport { csv, csvLanguage };\n","import { BentoCodeSnippetSupportedLanguage } from '@/components/code-snippet/code-snippet.types';\nimport { json } from '@codemirror/lang-json';\nimport { xml } from '@codemirror/lang-xml';\nimport { javascript } from '@codemirror/lang-javascript';\nimport { java } from '@codemirror/lang-java';\nimport { python } from '@codemirror/lang-python';\nimport { csv } from 'codemirror-lang-csv';\nimport type { LanguageSupport } from '@codemirror/language';\n\n/**\n * TODO: This should be handled with dynamic imports,\n * without relying on importing every single language/package available.\n * These supported types need to be kept in line with the ones in packages/vue2/src/components/code-snippet/code-snippet.types.ts enum\n */\nconst importsMap: Record<BentoCodeSnippetSupportedLanguage, () => LanguageSupport> = {\n [BentoCodeSnippetSupportedLanguage.JSON]: json,\n [BentoCodeSnippetSupportedLanguage.XML]: xml,\n [BentoCodeSnippetSupportedLanguage.JAVASCRIPT]: javascript,\n [BentoCodeSnippetSupportedLanguage.JAVA]: java,\n [BentoCodeSnippetSupportedLanguage.PYTHON]: python,\n [BentoCodeSnippetSupportedLanguage.CSV]: csv,\n};\n\n/**\n * Returns a language loder for `CodeMirror`.\n * Supported languages: json, xml, javascript & java\n *\n * @param language Language to be used\n * @returns Language configuration loader to be used in codemirror\n */\nexport const getLangLoader = (language: BentoCodeSnippetSupportedLanguage | `${BentoCodeSnippetSupportedLanguage}`) => {\n const loadLang = async () => importsMap[language];\n\n return loadLang;\n};\n","import { EditorSelection, type EditorState, type SelectionRange } from '@codemirror/state';\n\n/**\n * Calculate indentation for a new line based on line before it.\n * @param state - The editor state\n * @param line - the selection range, in this case one line\n * @returns the indentation string to be pre-pended on a new line.\n */\nconst getIndentation = (state: EditorState, line: SelectionRange) => {\n const currentLine = state.doc.lineAt(line.from);\n const indentMatch = /^\\s*/.exec(currentLine.text);\n return indentMatch ? indentMatch[0] : '';\n};\n\n/**\n * This extension to codemirror will, upon pressing the 'Enter' key, indent the new line\n * the same as the line before it.\n */\nexport const INDENT_SAME_AS_LINE_BEFORE = {\n key: 'Enter',\n run: ({ state, dispatch }) => {\n const changes = state.changeByRange(range => {\n const indentation = getIndentation(state, range);\n const newText = `\\n${indentation}`;\n return {\n changes: { from: range.from, to: range.to, insert: newText },\n range: EditorSelection.cursor(range.from + newText.length),\n };\n });\n dispatch(state.update(changes, { scrollIntoView: true, userEvent: 'input' }));\n return true;\n },\n};\n\nexport default INDENT_SAME_AS_LINE_BEFORE;\n","<template>\n <div class=\"b-code-snippet\" :class=\"conditionalClasses\">\n <section v-if=\"!isInlineVariant\" class=\"b-code-snippet__action-bar\">\n <div class=\"b-code-snippet__action-bar--start\">\n <bento-dropdown\n v-if=\"availableLanguages.length > 0\"\n v-model=\"selectedLanguage\"\n v-bind=\"$props\"\n :disabled=\"availableLanguages.length === 1\"\n :items=\"availableLanguages\"\n class=\"b-code-snippet__language-picker\"\n @input=\"handleChangeLanguage\"\n />\n <bento-typography el=\"span\" stronger>\n {{ displayedLang }}\n </bento-typography>\n </div>\n <div class=\"b-code-snippet__action-bar--end\">\n <bento-loading-indicator v-if=\"loading\" />\n <copy v-if=\"currentContents !== null\" class=\"b-structured-list__icon\" :text=\"currentContents\" />\n <bento-button\n v-if=\"expandable\"\n variant=\"tertiary\"\n condensed\n :aria-label=\"t('expand')\"\n @click=\"showModal = true\"\n >\n <template #iconLeft>\n <expand-icon />\n </template>\n </bento-button>\n <bento-button v-if=\"actionable\" variant=\"primary\" tertiary condensed @click=\"onActionClicked\">\n <template #iconLeft>\n <bento-typography el=\"span\" class=\"b-code-snippet__action-button\">\n {{ runText }}\n </bento-typography>\n </template>\n </bento-button>\n </div>\n </section>\n <code v-if=\"content || editable\" class=\"b-code-snippet__code-area\">\n <div ref=\"container\" class=\"b-code-snippet__code-area-content\" :class=\"codeAreaContentConditionalClasses\" />\n </code>\n <section v-else>\n <slot name=\"empty-state\">\n <!-- TODO: switch with empty-state component when ready -->\n <div class=\"b-code-snippet__empty-state\">{{ t('nothingToDisplay') }}</div>\n </slot>\n </section>\n <base-modal\n v-if=\"expandable\"\n class=\"b-code-snippet__modal\"\n :hide-close-button=\"true\"\n :custom-padding=\"'0px'\"\n :is-dismissible=\"true\"\n :is-open=\"showModal\"\n size=\"large\"\n @close-modal=\"showModal = false\"\n >\n <template #content>\n <bento-code-snippet v-bind=\"{ ...$props, expandable: false }\" />\n </template>\n </base-modal>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, type HTMLAttributes, onMounted, ref, shallowRef, useAttrs, watch, watchEffect } from 'vue';\n import { EditorView, highlightActiveLine, keymap, lineNumbers } from '@codemirror/view';\n import { Compartment, EditorState } from '@codemirror/state';\n import { history, indentWithTab } from '@codemirror/commands';\n import { lightThemeHighlight } from './highlight';\n import { getLangLoader, INDENT_SAME_AS_LINE_BEFORE } from './utils';\n import { BentoDropdown } from '@/components/dropdown';\n import { BentoButton } from '@/components/button';\n import { BentoTypography } from '@/components/typography';\n import { BentoLoadingIndicator } from '@/components/loading-indicator';\n import { useI18n } from '@/utils/ts/i18n';\n import { Copy } from '@/internal';\n import {\n BentoCodeSnippetEvent,\n type BentoCodeSnippetProps,\n BentoCodeSnippetSupportedLanguage,\n BentoCodeSnippetVariant,\n } from './code-snippet.types';\n import ExpandIcon from '@adyen/ui-assets-icons-16/vue/expand';\n import BaseModal from '@/components/modal/components/base-modal/base-modal.vue';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n actionable: { type: Boolean, default: false },\n actionableText: { default: null },\n content: { default: '' },\n expandable: { type: Boolean, default: false },\n editable: { type: Boolean, default: false },\n lang: { default: BentoCodeSnippetSupportedLanguage.JSON },\n langLabel: { default: null },\n loading: { type: Boolean, default: false },\n variant: { default: BentoCodeSnippetVariant.MULTILINE }\n});\n\n const emit = defineEmits([BentoCodeSnippetEvent.ACTION, BentoCodeSnippetEvent.CHANGE]);\n\n const attrs = useAttrs();\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n // language\n const selectedLanguage = ref<string | null>(null);\n const availableLanguages = []; // TODO: implement\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n const handleChangeLanguage = () => {};\n const displayedLang = computed(() => props.langLabel ?? props.lang.toUpperCase());\n\n const isInlineVariant = computed(() => props.variant === BentoCodeSnippetVariant.INLINE);\n\n const conditionalClasses = computed(() => ({\n 'b-code-snippet--inline': isInlineVariant.value,\n 'b-code-snippet--scrollable': !isInlineVariant.value,\n }));\n\n const codeAreaContentConditionalClasses = computed(() => ({\n 'b-code-snippet__code-area-content--editable': props.editable,\n }));\n\n const loadLang = getLangLoader(props.lang);\n\n const container = shallowRef<HTMLDivElement>();\n const editor = shallowRef<EditorView>();\n const languageConf = new Compartment();\n const editorTheme = new Compartment();\n const editorReadOnly = new Compartment();\n const editorAttributes = new Compartment();\n\n const currentContents = ref(null);\n const contentLength = ref(0);\n\n const runText = computed(() => props.actionableText || t('run'));\n\n onMounted(async () => {\n const language = await loadLang();\n\n // alongside the updateListener plugin it acts as a watcher of changes to the editor state\n currentContents.value = props.content;\n const updateCurrentContents = ({ state }) => {\n currentContents.value = state.doc.toString();\n };\n\n const extensions = [\n highlightActiveLine(),\n keymap.of([indentWithTab, INDENT_SAME_AS_LINE_BEFORE]),\n languageConf.of(language()),\n editorTheme.of(lightThemeHighlight(props.lang)),\n editorReadOnly.of(EditorState.readOnly.of(!props.editable)),\n editorAttributes.of(\n EditorView.contentAttributes.of({\n 'aria-label': (attrs['aria-label'] as HTMLAttributes['aria-label']) ?? t('codeSnippet'),\n ...(!isInlineVariant.value && { tabindex: '0' }),\n })\n ),\n EditorView.updateListener.of(content => updateCurrentContents(content)),\n ];\n\n if (props.variant === 'multiline') {\n extensions.push([lineNumbers(), history()]);\n }\n\n const state = EditorState.create({\n doc: props.content,\n extensions: [...extensions],\n });\n contentLength.value = state.doc.length;\n\n editor.value = new EditorView({\n state,\n parent: container.value,\n });\n });\n watch(\n () => props.content,\n () => {\n if (props.content !== currentContents.value) {\n const upcomingContentLength = props.content.length;\n editor.value.dispatch({\n changes: {\n from: 0,\n to: contentLength.value,\n insert: props.content,\n },\n });\n contentLength.value = upcomingContentLength;\n }\n }\n );\n\n const onActionClicked = () => {\n emit(BentoCodeSnippetEvent.ACTION, currentContents.value);\n };\n\n watchEffect(() => {\n if (currentContents.value !== null) {\n emit(BentoCodeSnippetEvent.CHANGE, currentContents.value);\n }\n });\n\n const showModal = ref(false);\n</script>\n\n<script lang=\"ts\">\n /**\n * A code-snippet is a container to display code in a readable way.\n * Come with added functionalities like syntax highlighting, editing and actioning the code\n *\n * @example\n * import { BentoCodeSnippet } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoCodeSnippet },\n * template: `\n * <bento-code-snippet :variant=\"BentoCodeSnippetVariant.MULTILINE\" content=\"{ example: 1234 }\" />\n * `\n * }\n */\n export default {\n i18n: { messages },\n name: 'bento-code-snippet',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./code-snippet.scss\"></style>\n"],"names":["lightThemeColors","BCodeSnippetCodeAreaHighlightRed","BCodeSnippetCodeAreaHighlightOrange","BCodeSnippetCodeAreaHighlightGreen","BCodeSnippetCodeAreaHighlightBlue","highlightStyle","colors","language","HighlightStyle","tags","lightThemeHighlight","syntaxHighlighting","BentoCodeSnippetVariant","BentoCodeSnippetVariant2","BentoCodeSnippetSupportedLanguage","BentoCodeSnippetSupportedLanguage2","BentoCodeSnippetEvent","BentoCodeSnippetEvent2","parser","LRParser","csvLanguage","LRLanguage","styleTags","csv","LanguageSupport","importsMap","json","xml","javascript","java","python","getLangLoader","getIndentation","state","line","currentLine","indentMatch","INDENT_SAME_AS_LINE_BEFORE","dispatch","changes","range","newText","EditorSelection","__default__","messages","attrs","useAttrs","t","useI18n","selectedLanguage","ref","availableLanguages","handleChangeLanguage","displayedLang","computed","props","isInlineVariant","conditionalClasses","codeAreaContentConditionalClasses","loadLang","container","shallowRef","editor","languageConf","Compartment","editorTheme","editorReadOnly","editorAttributes","currentContents","contentLength","runText","onMounted","updateCurrentContents","state2","extensions","highlightActiveLine","keymap","indentWithTab","EditorState","EditorView","content","lineNumbers","history","watch","upcomingContentLength","onActionClicked","emit","watchEffect","showModal"],"mappings":";;;;;;;;;;;;;AAUA,MAAAA,KAAA;AAAA,EAAyB,KAAAC;AAAA,EAChB,QAAAC;AAAA,EACG,OAAAC;AAAA,EACD,MAAAC;AAAA,EACD,SAAA;AAEV,GAEAC,KAAA,CAAAC,GAAAC,MAAAC,EAAA,OAAA;AAAA,EAC0B;AAAA,IAClB,KAAAC,EAAA;AAAA,IACW,OAAAH,EAAA;AAAA,EACO;AAAA,EAClB;AAAA,IACA,KAAA,CAAAG,EAAA,MAAAA,EAAA,SAAAA,EAAA,WAAAA,EAAA,cAAAA,EAAA,SAAA;AAAA,IACqE,OAAAH,EAAA;A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
+ {"version":3,"file":"code-snippet.bzFOFUj4.js","sources":["../../src/components/code-snippet/highlight.ts","../../src/components/code-snippet/code-snippet.types.ts","../../../../node_modules/.pnpm/codemirror-lang-csv@0.1.1/node_modules/codemirror-lang-csv/dist/index.js","../../src/components/code-snippet/utils/get-lang-loader.ts","../../src/components/code-snippet/utils/indent-same-as-line-before-extension.ts","../../src/components/code-snippet/code-snippet.vue"],"sourcesContent":["import { HighlightStyle, syntaxHighlighting } from '@codemirror/language';\nimport { tags as t } from '@lezer/highlight';\nimport {\n BCodeSnippetCodeAreaHighlightBlue,\n BCodeSnippetCodeAreaHighlightGreen,\n BCodeSnippetCodeAreaHighlightOrange,\n BCodeSnippetCodeAreaHighlightRed,\n} from '@adyen/bento-design-tokens/dist/js/bento/es6';\nimport { type BentoCodeSnippetSupportedLanguage } from './code-snippet.types';\n\nconst lightThemeColors = {\n red: BCodeSnippetCodeAreaHighlightRed,\n orange: BCodeSnippetCodeAreaHighlightOrange,\n green: BCodeSnippetCodeAreaHighlightGreen,\n blue: BCodeSnippetCodeAreaHighlightBlue,\n invalid: '#ffffff',\n};\n\nconst highlightStyle = (colors, language: BentoCodeSnippetSupportedLanguage | `${BentoCodeSnippetSupportedLanguage}`) =>\n HighlightStyle.define([\n {\n tag: t.keyword,\n color: colors.red,\n },\n {\n tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName],\n color: colors.green,\n },\n {\n tag: [t.function(t.variableName), t.labelName],\n color: colors.blue,\n },\n {\n tag: [t.color, t.constant(t.name), t.standard(t.name)],\n color: colors.red,\n },\n {\n tag: [t.definition(t.name), ...(language !== 'json' ? [t.separator] : [])],\n color: colors.red,\n },\n {\n tag: [t.typeName, t.className, t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace],\n color: colors.orange,\n },\n {\n tag: [t.operator, t.operatorKeyword, t.url, t.escape, t.regexp, t.link, t.special(t.string)],\n color: colors.blue,\n },\n {\n tag: [t.meta, t.comment],\n color: colors.orange,\n },\n {\n tag: t.strong,\n fontWeight: 'bold',\n },\n {\n tag: t.emphasis,\n fontStyle: 'italic',\n },\n {\n tag: t.strikethrough,\n textDecoration: 'line-through',\n },\n {\n tag: t.link,\n color: colors.orange,\n textDecoration: 'underline',\n },\n {\n tag: t.heading,\n fontWeight: 'bold',\n color: colors.blue,\n },\n {\n tag: [t.atom, t.bool, t.special(t.variableName)],\n color: colors.red,\n },\n {\n tag: [t.processingInstruction, t.string, t.inserted],\n color: colors.blue,\n },\n {\n tag: t.invalid,\n color: colors.invalid,\n },\n ]);\n\nexport const lightThemeHighlight = (\n language: BentoCodeSnippetSupportedLanguage | `${BentoCodeSnippetSupportedLanguage}`\n) => syntaxHighlighting(highlightStyle(lightThemeColors, language));\n","/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCodeSnippetVariant {\n INLINE = 'inline',\n SINGLELINE = 'singleline',\n MULTILINE = 'multiline',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCodeSnippetSupportedLanguage {\n JSON = 'json',\n XML = 'xml',\n JAVA = 'java',\n JAVASCRIPT = 'javascript',\n PYTHON = 'python',\n CSV = 'csv',\n}\n\nexport enum BentoCodeSnippetEvent {\n ACTION = 'action',\n CHANGE = 'change',\n}\n\nexport interface BentoCodeSnippetProps {\n /**\n * Displays a button that when clicked will emit an action event\n * Leaves to the parent component the logic of what to do with it\n */\n actionable?: boolean;\n\n /**\n * Displays a button that when clicked will emit a run event\n * Leaves to the parent component the logic of what to do with it\n */\n actionableText?: string;\n\n /**\n * The code content\n */\n content?: string;\n\n /**\n * Displays a button that can expand the codeblock into a modal to easily\n * view large blocks of code.\n */\n expandable?: boolean;\n\n /**\n * Allows editing of the code-snippet content by the user\n */\n editable?: boolean;\n\n /**\n * Language name for syntax highlighting rules\n */\n lang?: BentoCodeSnippetSupportedLanguage | `${BentoCodeSnippetSupportedLanguage}`;\n\n /**\n * Label to show in the action-bar, describing the language\n */\n langLabel?: string;\n\n /**\n * Toggles the loading indicator within the action bar\n */\n loading?: boolean;\n\n /**\n * Defines the variant of code-snippet\n */\n variant?: BentoCodeSnippetVariant | `${BentoCodeSnippetVariant}`;\n}\n","import { LRParser } from '@lezer/lr';\nimport { LRLanguage, LanguageSupport } from '@codemirror/language';\nimport { styleTags, tags } from '@lezer/highlight';\n\n// This file was generated by lezer-generator. You probably shouldn't edit it.\nconst parser = LRParser.deserialize({\n version: 14,\n states: \"nQVQPOOOOQO'#Ce'#CeOOQO'#Ca'#CaQVQPOOOOQO-E6_-E6_\",\n stateData: \"g~OWOS~OQPORPOSPO~OQRSR~\",\n goto: \"eYPPPPPZPPPaQRORSRTQOR\",\n nodeNames: \"⚠ Program String Separator Value\",\n maxTerm: 9,\n skippedNodes: [0],\n repeatNodeCount: 1,\n tokenData: \"'Y~RZOYtYZ!cZrtrs!hs|t|}'T}!]t!]!^'T!^;'St;'S;=`!]<%lOt~yUS~OYtZ|t}!]t!^;'St;'S;=`!]<%lOt~!`P;=`<%lt~!hOW~~!m]S~OY!hYZ#fZr!hrs%Ss|!h|}#f}!]!h!]!^#f!^#O!h#O#P%m#P;'S!h;'S;=`&}<%lO!h~#iVOr#frs$Os#O#f#O#P$T#P;'S#f;'S;=`$|<%lO#f~$TOQ~~$WRO;'S#f;'S;=`$a;=`O#f~$dWOr#frs$Os#O#f#O#P$T#P;'S#f;'S;=`$|;=`<%l#f<%lO#f~%PP;=`<%l#f~%ZUQ~S~OYtZ|t}!]t!^;'St;'S;=`!]<%lOt~%rYS~OY!hYZ#fZ|!h|}#f}!]!h!]!^#f!^;'S!h;'S;=`&b;=`<%l#f<%lO!h~&eWOr#frs$Os#O#f#O#P$T#P;'S#f;'S;=`$|;=`<%l!h<%lO#f~'QP;=`<%l!h~'YOR~\",\n tokenizers: [0],\n topRules: {\"Program\":[0,1]},\n tokenPrec: 18\n});\n\nconst csvLanguage = LRLanguage.define({\n parser: parser.configure({\n props: [\n styleTags({\n Separator: tags.separator,\n Value: tags.string,\n String: tags.string,\n LineComment: tags.lineComment,\n \"( )\": tags.paren,\n }),\n ],\n }),\n});\nfunction csv() {\n return new LanguageSupport(csvLanguage);\n}\n\nexport { csv, csvLanguage };\n","import { BentoCodeSnippetSupportedLanguage } from '@/components/code-snippet/code-snippet.types';\nimport { json } from '@codemirror/lang-json';\nimport { xml } from '@codemirror/lang-xml';\nimport { javascript } from '@codemirror/lang-javascript';\nimport { java } from '@codemirror/lang-java';\nimport { python } from '@codemirror/lang-python';\nimport { csv } from 'codemirror-lang-csv';\nimport type { LanguageSupport } from '@codemirror/language';\n\n/**\n * TODO: This should be handled with dynamic imports,\n * without relying on importing every single language/package available.\n * These supported types need to be kept in line with the ones in packages/vue2/src/components/code-snippet/code-snippet.types.ts enum\n */\nconst importsMap: Record<BentoCodeSnippetSupportedLanguage, () => LanguageSupport> = {\n [BentoCodeSnippetSupportedLanguage.JSON]: json,\n [BentoCodeSnippetSupportedLanguage.XML]: xml,\n [BentoCodeSnippetSupportedLanguage.JAVASCRIPT]: javascript,\n [BentoCodeSnippetSupportedLanguage.JAVA]: java,\n [BentoCodeSnippetSupportedLanguage.PYTHON]: python,\n [BentoCodeSnippetSupportedLanguage.CSV]: csv,\n};\n\n/**\n * Returns a language loder for `CodeMirror`.\n * Supported languages: json, xml, javascript & java\n *\n * @param language Language to be used\n * @returns Language configuration loader to be used in codemirror\n */\nexport const getLangLoader = (language: BentoCodeSnippetSupportedLanguage | `${BentoCodeSnippetSupportedLanguage}`) => {\n const loadLang = async () => importsMap[language];\n\n return loadLang;\n};\n","import { EditorSelection, type EditorState, type SelectionRange } from '@codemirror/state';\n\n/**\n * Calculate indentation for a new line based on line before it.\n * @param state - The editor state\n * @param line - the selection range, in this case one line\n * @returns the indentation string to be pre-pended on a new line.\n */\nconst getIndentation = (state: EditorState, line: SelectionRange) => {\n const currentLine = state.doc.lineAt(line.from);\n const indentMatch = /^\\s*/.exec(currentLine.text);\n return indentMatch ? indentMatch[0] : '';\n};\n\n/**\n * This extension to codemirror will, upon pressing the 'Enter' key, indent the new line\n * the same as the line before it.\n */\nexport const INDENT_SAME_AS_LINE_BEFORE = {\n key: 'Enter',\n run: ({ state, dispatch }) => {\n const changes = state.changeByRange(range => {\n const indentation = getIndentation(state, range);\n const newText = `\\n${indentation}`;\n return {\n changes: { from: range.from, to: range.to, insert: newText },\n range: EditorSelection.cursor(range.from + newText.length),\n };\n });\n dispatch(state.update(changes, { scrollIntoView: true, userEvent: 'input' }));\n return true;\n },\n};\n\nexport default INDENT_SAME_AS_LINE_BEFORE;\n","<template>\n <div class=\"b-code-snippet\" :class=\"conditionalClasses\">\n <section v-if=\"!isInlineVariant\" class=\"b-code-snippet__action-bar\">\n <div class=\"b-code-snippet__action-bar--start\">\n <bento-dropdown\n v-if=\"availableLanguages.length > 0\"\n v-model=\"selectedLanguage\"\n v-bind=\"$props\"\n :disabled=\"availableLanguages.length === 1\"\n :items=\"availableLanguages\"\n class=\"b-code-snippet__language-picker\"\n @input=\"handleChangeLanguage\"\n />\n <bento-typography el=\"span\" stronger>\n {{ displayedLang }}\n </bento-typography>\n </div>\n <div class=\"b-code-snippet__action-bar--end\">\n <bento-loading-indicator v-if=\"loading\" />\n <copy v-if=\"currentContents !== null\" class=\"b-structured-list__icon\" :text=\"currentContents\" />\n <bento-button\n v-if=\"expandable\"\n variant=\"tertiary\"\n condensed\n :aria-label=\"t('expand')\"\n @click=\"showModal = true\"\n >\n <template #iconLeft>\n <expand-icon />\n </template>\n </bento-button>\n <bento-button v-if=\"actionable\" variant=\"primary\" tertiary condensed @click=\"onActionClicked\">\n <template #iconLeft>\n <bento-typography el=\"span\" class=\"b-code-snippet__action-button\">\n {{ runText }}\n </bento-typography>\n </template>\n </bento-button>\n </div>\n </section>\n <code v-if=\"content || editable\" class=\"b-code-snippet__code-area\">\n <div ref=\"container\" class=\"b-code-snippet__code-area-content\" :class=\"codeAreaContentConditionalClasses\" />\n </code>\n <section v-else>\n <slot name=\"empty-state\">\n <!-- TODO: switch with empty-state component when ready -->\n <div class=\"b-code-snippet__empty-state\">{{ t('nothingToDisplay') }}</div>\n </slot>\n </section>\n <base-modal\n v-if=\"expandable\"\n class=\"b-code-snippet__modal\"\n :hide-close-button=\"true\"\n :custom-padding=\"'0px'\"\n :is-dismissible=\"true\"\n :is-open=\"showModal\"\n size=\"large\"\n @close-modal=\"showModal = false\"\n >\n <template #content>\n <bento-code-snippet v-bind=\"{ ...$props, expandable: false }\" />\n </template>\n </base-modal>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, type HTMLAttributes, onMounted, ref, shallowRef, useAttrs, watch, watchEffect } from 'vue';\n import { EditorView, highlightActiveLine, keymap, lineNumbers } from '@codemirror/view';\n import { Compartment, EditorState } from '@codemirror/state';\n import { history, indentWithTab } from '@codemirror/commands';\n import { lightThemeHighlight } from './highlight';\n import { getLangLoader, INDENT_SAME_AS_LINE_BEFORE } from './utils';\n import { BentoDropdown } from '@/components/dropdown';\n import { BentoButton } from '@/components/button';\n import { BentoTypography } from '@/components/typography';\n import { BentoLoadingIndicator } from '@/components/loading-indicator';\n import { useI18n } from '@/utils/ts/i18n';\n import { Copy } from '@/internal';\n import {\n BentoCodeSnippetEvent,\n type BentoCodeSnippetProps,\n BentoCodeSnippetSupportedLanguage,\n BentoCodeSnippetVariant,\n } from './code-snippet.types';\n import ExpandIcon from '@adyen/ui-assets-icons-16/vue/expand';\n import BaseModal from '@/components/modal/components/base-modal/base-modal.vue';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n actionable: { type: Boolean, default: false },\n actionableText: { default: null },\n content: { default: '' },\n expandable: { type: Boolean, default: false },\n editable: { type: Boolean, default: false },\n lang: { default: BentoCodeSnippetSupportedLanguage.JSON },\n langLabel: { default: null },\n loading: { type: Boolean, default: false },\n variant: { default: BentoCodeSnippetVariant.MULTILINE }\n});\n\n const emit = defineEmits([BentoCodeSnippetEvent.ACTION, BentoCodeSnippetEvent.CHANGE]);\n\n const attrs = useAttrs();\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n // language\n const selectedLanguage = ref<string | null>(null);\n const availableLanguages = []; // TODO: implement\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n const handleChangeLanguage = () => {};\n const displayedLang = computed(() => props.langLabel ?? props.lang.toUpperCase());\n\n const isInlineVariant = computed(() => props.variant === BentoCodeSnippetVariant.INLINE);\n\n const conditionalClasses = computed(() => ({\n 'b-code-snippet--inline': isInlineVariant.value,\n 'b-code-snippet--scrollable': !isInlineVariant.value,\n }));\n\n const codeAreaContentConditionalClasses = computed(() => ({\n 'b-code-snippet__code-area-content--editable': props.editable,\n }));\n\n const loadLang = getLangLoader(props.lang);\n\n const container = shallowRef<HTMLDivElement>();\n const editor = shallowRef<EditorView>();\n const languageConf = new Compartment();\n const editorTheme = new Compartment();\n const editorReadOnly = new Compartment();\n const editorAttributes = new Compartment();\n\n const currentContents = ref(null);\n const contentLength = ref(0);\n\n const runText = computed(() => props.actionableText || t('run'));\n\n onMounted(async () => {\n const language = await loadLang();\n\n // alongside the updateListener plugin it acts as a watcher of changes to the editor state\n currentContents.value = props.content;\n const updateCurrentContents = ({ state }) => {\n currentContents.value = state.doc.toString();\n };\n\n const extensions = [\n highlightActiveLine(),\n keymap.of([indentWithTab, INDENT_SAME_AS_LINE_BEFORE]),\n languageConf.of(language()),\n editorTheme.of(lightThemeHighlight(props.lang)),\n editorReadOnly.of(EditorState.readOnly.of(!props.editable)),\n editorAttributes.of(\n EditorView.contentAttributes.of({\n 'aria-label': (attrs['aria-label'] as HTMLAttributes['aria-label']) ?? t('codeSnippet'),\n ...(!isInlineVariant.value && { tabindex: '0' }),\n })\n ),\n EditorView.updateListener.of(content => updateCurrentContents(content)),\n ];\n\n if (props.variant === 'multiline') {\n extensions.push([lineNumbers(), history()]);\n }\n\n const state = EditorState.create({\n doc: props.content,\n extensions: [...extensions],\n });\n contentLength.value = state.doc.length;\n\n editor.value = new EditorView({\n state,\n parent: container.value,\n });\n });\n watch(\n () => props.content,\n () => {\n if (props.content !== currentContents.value) {\n const upcomingContentLength = props.content.length;\n editor.value.dispatch({\n changes: {\n from: 0,\n to: contentLength.value,\n insert: props.content,\n },\n });\n contentLength.value = upcomingContentLength;\n }\n }\n );\n\n const onActionClicked = () => {\n emit(BentoCodeSnippetEvent.ACTION, currentContents.value);\n };\n\n watchEffect(() => {\n if (currentContents.value !== null) {\n emit(BentoCodeSnippetEvent.CHANGE, currentContents.value);\n }\n });\n\n const showModal = ref(false);\n</script>\n\n<script lang=\"ts\">\n /**\n * A code-snippet is a container to display code in a readable way.\n * Come with added functionalities like syntax highlighting, editing and actioning the code\n *\n * @example\n * import { BentoCodeSnippet } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoCodeSnippet },\n * template: `\n * <bento-code-snippet :variant=\"BentoCodeSnippetVariant.MULTILINE\" content=\"{ example: 1234 }\" />\n * `\n * }\n */\n export default {\n i18n: { messages },\n name: 'bento-code-snippet',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./code-snippet.scss\"></style>\n"],"names":["lightThemeColors","BCodeSnippetCodeAreaHighlightRed","BCodeSnippetCodeAreaHighlightOrange","BCodeSnippetCodeAreaHighlightGreen","BCodeSnippetCodeAreaHighlightBlue","highlightStyle","colors","language","HighlightStyle","tags","lightThemeHighlight","syntaxHighlighting","BentoCodeSnippetVariant","BentoCodeSnippetVariant2","BentoCodeSnippetSupportedLanguage","BentoCodeSnippetSupportedLanguage2","BentoCodeSnippetEvent","BentoCodeSnippetEvent2","parser","LRParser","csvLanguage","LRLanguage","styleTags","csv","LanguageSupport","importsMap","json","xml","javascript","java","python","getLangLoader","getIndentation","state","line","currentLine","indentMatch","INDENT_SAME_AS_LINE_BEFORE","dispatch","changes","range","newText","EditorSelection","__default__","messages","attrs","useAttrs","t","useI18n","selectedLanguage","ref","availableLanguages","handleChangeLanguage","displayedLang","computed","props","isInlineVariant","conditionalClasses","codeAreaContentConditionalClasses","loadLang","container","shallowRef","editor","languageConf","Compartment","editorTheme","editorReadOnly","editorAttributes","currentContents","contentLength","runText","onMounted","updateCurrentContents","state2","extensions","highlightActiveLine","keymap","indentWithTab","EditorState","EditorView","content","lineNumbers","history","watch","upcomingContentLength","onActionClicked","emit","watchEffect","showModal"],"mappings":";;;;;;;;;;;;;AAUA,MAAAA,KAAA;AAAA,EAAyB,KAAAC;AAAA,EAChB,QAAAC;AAAA,EACG,OAAAC;AAAA,EACD,MAAAC;AAAA,EACD,SAAA;AAEV,GAEAC,KAAA,CAAAC,GAAAC,MAAAC,EAAA,OAAA;AAAA,EAC0B;AAAA,IAClB,KAAAC,EAAA;AAAA,IACW,OAAAH,EAAA;AAAA,EACO;AAAA,EAClB;AAAA,IACA,KAAA,CAAAG,EAAA,MAAAA,EAAA,SAAAA,EAAA,WAAAA,EAAA,cAAAA,EAAA,SAAA;AAAA,IACqE,OAAAH,EAAA;AAAA,EACnD;AAAA,EAClB;AAAA,IACA,KAAA,CAAAG,EAAA,SAAAA,EAAA,YAAA,GAAAA,EAAA,SAAA;AAAA,IACiD,OAAAH,EAAA;AAAA,EAC/B;AAAA,EAClB;AAAA,IACA,KAAA,CAAAG,EAAA,OAAAA,EAAA,SAAAA,EAAA,IAAA,GAAAA,EAAA,SAAAA,EAAA,IAAA,CAAA;AAAA,IACyD,OAAAH,EAAA;AAAA,EACvC;AAAA,EAClB;AAAA,IACA,KAAA,CAAAG,EAAA,WAAAA,EAAA,IAAA,GAAA,GAAAF,MAAA,SAAA,CAAAE,EAAA,SAAA,IAAA,CAAA,CAAA;AAAA,IAC6E,OAAAH,EAAA;AAAA,EAC3D;AAAA,EAClB;AAAA,IACA,KAAA,CAAAG,EAAA,UAAAA,EAAA,WAAAA,EAAA,QAAAA,EAAA,SAAAA,EAAA,YAAAA,EAAA,UAAAA,EAAA,MAAAA,EAAA,SAAA;AAAA,IACqG,OAAAH,EAAA;AAAA,EACnF;AAAA,EAClB;AAAA,IACA,KAAA,CAAAG,EAAA,UAAAA,EA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