@adyen/bento-vue2 1.19.0 → 1.20.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 (205) hide show
  1. package/dist/@types/packages/vue2/src/components/code-snippet/utils/indent-same-as-line-before-extension.d.ts +8 -0
  2. package/dist/@types/packages/vue2/src/components/code-snippet/utils/index.d.ts +2 -0
  3. package/dist/@types/packages/vue2/src/components/date-range-picker/components/date-range-picker-calendar/date-range-picker-calendar.types.d.ts +2 -1
  4. package/dist/@types/packages/vue2/src/components/filter-bar/components/all-filters-modal/all-filters-modal.vue.d.ts +2 -2
  5. package/dist/@types/packages/vue2/src/components/filter-bar/components/date-range-filter/date-range-filter.vue.d.ts +1 -0
  6. package/dist/@types/packages/vue2/src/components/link/link.vue.d.ts +1 -0
  7. package/dist/@types/packages/vue2/src/components/payment-method/payment-method.types.d.ts +3 -1079
  8. package/dist/@types/packages/vue2/src/components/payment-method/payment-method.vue.d.ts +7 -8
  9. package/dist/@types/packages/vue2/src/components/segmented-control/components/segmented-control-button/segmented-control-button.vue.d.ts +1 -1
  10. package/dist/accordion.js +3 -3
  11. package/dist/action-bar.js +7 -7
  12. package/dist/alert.js +7 -7
  13. package/dist/assets/base-modal.css +1 -1
  14. package/dist/assets/dialog-page.css +1 -1
  15. package/dist/assets/dropdown-default-textbox.css +1 -1
  16. package/dist/assets/index10.css +1 -1
  17. package/dist/assets/index11.css +1 -1
  18. package/dist/assets/index12.css +1 -1
  19. package/dist/assets/index13.css +1 -1
  20. package/dist/assets/index14.css +1 -1
  21. package/dist/assets/index15.css +1 -1
  22. package/dist/assets/index16.css +1 -1
  23. package/dist/assets/index17.css +1 -1
  24. package/dist/assets/index18.css +1 -1
  25. package/dist/assets/index19.css +1 -1
  26. package/dist/assets/index20.css +1 -1
  27. package/dist/assets/index21.css +1 -1
  28. package/dist/assets/index22.css +1 -1
  29. package/dist/assets/index23.css +1 -1
  30. package/dist/assets/index24.css +1 -1
  31. package/dist/assets/index25.css +1 -1
  32. package/dist/assets/index26.css +1 -1
  33. package/dist/assets/index27.css +1 -1
  34. package/dist/assets/index29.css +1 -1
  35. package/dist/assets/index3.css +1 -1
  36. package/dist/assets/index32.css +1 -1
  37. package/dist/assets/index33.css +1 -1
  38. package/dist/assets/index34.css +1 -1
  39. package/dist/assets/index35.css +1 -1
  40. package/dist/assets/index36.css +1 -1
  41. package/dist/assets/index37.css +1 -1
  42. package/dist/assets/index38.css +1 -1
  43. package/dist/assets/index39.css +1 -1
  44. package/dist/assets/index40.css +1 -1
  45. package/dist/assets/index41.css +1 -1
  46. package/dist/assets/index42.css +1 -1
  47. package/dist/assets/index43.css +1 -1
  48. package/dist/assets/index44.css +1 -1
  49. package/dist/assets/index45.css +1 -1
  50. package/dist/assets/index46.css +1 -1
  51. package/dist/assets/index47.css +1 -1
  52. package/dist/assets/index48.css +1 -1
  53. package/dist/assets/index5.css +1 -1
  54. package/dist/assets/index6.css +1 -1
  55. package/dist/assets/index7.css +1 -1
  56. package/dist/assets/index8.css +1 -1
  57. package/dist/assets/index9.css +1 -1
  58. package/dist/avatar-image.js +1 -1
  59. package/dist/button.js +5 -5
  60. package/dist/card.js +4 -4
  61. package/dist/checkbox.js +6 -6
  62. package/dist/chunks/{arrow-left.2db60716.js → arrow-left.93ae08f5.js} +2 -2
  63. package/dist/chunks/{arrow-left.2db60716.js.map → arrow-left.93ae08f5.js.map} +1 -1
  64. package/dist/chunks/{base-button.3c3d473d.js → base-button.2abda566.js} +2 -2
  65. package/dist/chunks/{base-button.3c3d473d.js.map → base-button.2abda566.js.map} +1 -1
  66. package/dist/chunks/{base-modal.27c6f2db.js → base-modal.9d4f6201.js} +38 -33
  67. package/dist/chunks/base-modal.9d4f6201.js.map +1 -0
  68. package/dist/chunks/{button-actions-with-menu.a38327c2.js → button-actions-with-menu.db38aa1d.js} +4 -4
  69. package/dist/chunks/{button-actions-with-menu.a38327c2.js.map → button-actions-with-menu.db38aa1d.js.map} +1 -1
  70. package/dist/chunks/{button-actions.1dc90a19.js → button-actions.0ed5f462.js} +3 -3
  71. package/dist/chunks/{button-actions.1dc90a19.js.map → button-actions.0ed5f462.js.map} +1 -1
  72. package/dist/chunks/{button.0b6cda85.js → button.8738aa07.js} +3 -3
  73. package/dist/chunks/{button.0b6cda85.js.map → button.8738aa07.js.map} +1 -1
  74. package/dist/chunks/{calendar.263cfc88.js → calendar.ce3f34b7.js} +137 -137
  75. package/dist/chunks/{calendar.263cfc88.js.map → calendar.ce3f34b7.js.map} +1 -1
  76. package/dist/chunks/{checkbox.c7a74005.js → checkbox.4f4e8f67.js} +4 -4
  77. package/dist/chunks/{checkbox.c7a74005.js.map → checkbox.4f4e8f67.js.map} +1 -1
  78. package/dist/chunks/{checkmark-circle-fill.345311d2.js → checkmark-circle-fill.d1cdb44b.js} +2 -2
  79. package/dist/chunks/{checkmark-circle-fill.345311d2.js.map → checkmark-circle-fill.d1cdb44b.js.map} +1 -1
  80. package/dist/chunks/{checkmark-small.520f01b1.js → checkmark-small.73cf8f1d.js} +2 -2
  81. package/dist/chunks/{checkmark-small.520f01b1.js.map → checkmark-small.73cf8f1d.js.map} +1 -1
  82. package/dist/chunks/{checkmark.a6ed8f47.js → checkmark.b6d2d4d1.js} +2 -2
  83. package/dist/chunks/{checkmark.a6ed8f47.js.map → checkmark.b6d2d4d1.js.map} +1 -1
  84. package/dist/chunks/{chevron-left.5edf02ac.js → chevron-left.ddc658ff.js} +2 -2
  85. package/dist/chunks/{chevron-left.5edf02ac.js.map → chevron-left.ddc658ff.js.map} +1 -1
  86. package/dist/chunks/{chevron-up.81185563.js → chevron-up.52aea493.js} +2 -2
  87. package/dist/chunks/{chevron-up.81185563.js.map → chevron-up.52aea493.js.map} +1 -1
  88. package/dist/chunks/{controls-group.8abe0bd1.js → controls-group.0e3d1fc5.js} +3 -3
  89. package/dist/chunks/{controls-group.8abe0bd1.js.map → controls-group.0e3d1fc5.js.map} +1 -1
  90. package/dist/chunks/{copy.647aae54.js → copy.2aca9aaf.js} +4 -4
  91. package/dist/chunks/{copy.647aae54.js.map → copy.2aca9aaf.js.map} +1 -1
  92. package/dist/chunks/{cross-circle-fill.27580c4b.js → cross-circle-fill.42f9b938.js} +2 -2
  93. package/dist/chunks/{cross-circle-fill.27580c4b.js.map → cross-circle-fill.42f9b938.js.map} +1 -1
  94. package/dist/chunks/{cross-small.e851e0de.js → cross-small.3aadf170.js} +2 -2
  95. package/dist/chunks/{cross-small.e851e0de.js.map → cross-small.3aadf170.js.map} +1 -1
  96. package/dist/chunks/{cross.04678d81.js → cross.eaaaf355.js} +2 -2
  97. package/dist/chunks/{cross.04678d81.js.map → cross.eaaaf355.js.map} +1 -1
  98. package/dist/chunks/{dialog-page.f787969c.js → dialog-page.6bc19d1a.js} +4 -4
  99. package/dist/chunks/{dialog-page.f787969c.js.map → dialog-page.6bc19d1a.js.map} +1 -1
  100. package/dist/chunks/{dropdown-default-textbox.59803edd.js → dropdown-default-textbox.a55b9de3.js} +94 -92
  101. package/dist/chunks/dropdown-default-textbox.a55b9de3.js.map +1 -0
  102. package/dist/chunks/{dropdown.0574f613.js → dropdown.7ad3a860.js} +7 -7
  103. package/dist/chunks/{dropdown.0574f613.js.map → dropdown.7ad3a860.js.map} +1 -1
  104. package/dist/chunks/{error-message.75666843.js → error-message.775f9114.js} +3 -3
  105. package/dist/chunks/{error-message.75666843.js.map → error-message.775f9114.js.map} +1 -1
  106. package/dist/chunks/{fixed-scroller.06574a66.js → fixed-scroller.5764a0d4.js} +3 -3
  107. package/dist/chunks/{fixed-scroller.06574a66.js.map → fixed-scroller.5764a0d4.js.map} +1 -1
  108. package/dist/chunks/{footer-actions.0268a57b.js → footer-actions.093f0cbe.js} +4 -4
  109. package/dist/chunks/{footer-actions.0268a57b.js.map → footer-actions.093f0cbe.js.map} +1 -1
  110. package/dist/chunks/{index.302e9cf2.js → index.096f3429.js} +2 -2
  111. package/dist/chunks/{index.302e9cf2.js.map → index.096f3429.js.map} +1 -1
  112. package/dist/chunks/{index.932c230b.js → index.4c011bf9.js} +7 -7
  113. package/dist/chunks/{index.932c230b.js.map → index.4c011bf9.js.map} +1 -1
  114. package/dist/chunks/index.7e9406c4.js +32 -0
  115. package/dist/chunks/{index.026ae47b.js.map → index.7e9406c4.js.map} +1 -1
  116. package/dist/chunks/{index.45cd2344.js → index.973e0dbe.js} +15 -15
  117. package/dist/chunks/{index.45cd2344.js.map → index.973e0dbe.js.map} +1 -1
  118. package/dist/chunks/{index.408e1419.js → index.9e16359f.js} +138 -137
  119. package/dist/chunks/index.9e16359f.js.map +1 -0
  120. package/dist/chunks/{index.0bb773a7.js → index.9f7e23cb.js} +7 -7
  121. package/dist/chunks/{index.0bb773a7.js.map → index.9f7e23cb.js.map} +1 -1
  122. package/dist/chunks/{index.10b9618d.js → index.b86a901b.js} +2 -2
  123. package/dist/chunks/{index.10b9618d.js.map → index.b86a901b.js.map} +1 -1
  124. package/dist/chunks/{index.5bfc67d1.js → index.e1f51235.js} +2 -2
  125. package/dist/chunks/{index.5bfc67d1.js.map → index.e1f51235.js.map} +1 -1
  126. package/dist/chunks/{index.5b47c56b.js → index.e537c4f4.js} +18 -16
  127. package/dist/chunks/index.e537c4f4.js.map +1 -0
  128. package/dist/chunks/{index.a52b98d1.js → index.efda8afc.js} +8 -8
  129. package/dist/chunks/{index.a52b98d1.js.map → index.efda8afc.js.map} +1 -1
  130. package/dist/chunks/{index.dc985e76.js → index.f03831cf.js} +3 -3
  131. package/dist/chunks/{index.dc985e76.js.map → index.f03831cf.js.map} +1 -1
  132. package/dist/chunks/{index.de687404.js → index.f64eee15.js} +22 -22
  133. package/dist/chunks/{index.de687404.js.map → index.f64eee15.js.map} +1 -1
  134. package/dist/chunks/{info-filled.c37e091d.js → info-filled.c7bd493a.js} +2 -2
  135. package/dist/chunks/{info-filled.c37e091d.js.map → info-filled.c7bd493a.js.map} +1 -1
  136. package/dist/chunks/{info.8b6328aa.js → info.04ff164c.js} +2 -2
  137. package/dist/chunks/{info.8b6328aa.js.map → info.04ff164c.js.map} +1 -1
  138. package/dist/chunks/{listbox-option-tag.89846151.js → listbox-option-tag.1c6a0605.js} +3 -3
  139. package/dist/chunks/{listbox-option-tag.89846151.js.map → listbox-option-tag.1c6a0605.js.map} +1 -1
  140. package/dist/chunks/{listbox.a8180c4a.js → listbox.2a5fb14f.js} +8 -8
  141. package/dist/chunks/{listbox.a8180c4a.js.map → listbox.2a5fb14f.js.map} +1 -1
  142. package/dist/chunks/{loading-button.50dddf2f.js → loading-button.c7b30923.js} +4 -4
  143. package/dist/chunks/{loading-button.50dddf2f.js.map → loading-button.c7b30923.js.map} +1 -1
  144. package/dist/chunks/{refresh.71a03998.js → refresh.14e39831.js} +2 -2
  145. package/dist/chunks/{refresh.71a03998.js.map → refresh.14e39831.js.map} +1 -1
  146. package/dist/chunks/{search.471270fe.js → search.eca6bd88.js} +2 -2
  147. package/dist/chunks/{search.471270fe.js.map → search.eca6bd88.js.map} +1 -1
  148. package/dist/chunks/{tooltip.6748027a.js → tooltip.a76de645.js} +3 -3
  149. package/dist/chunks/{tooltip.6748027a.js.map → tooltip.a76de645.js.map} +1 -1
  150. package/dist/code-snippet.js +181 -165
  151. package/dist/code-snippet.js.map +1 -1
  152. package/dist/country.js +2 -2
  153. package/dist/currency.js +1 -1
  154. package/dist/data-grid.js +1 -1
  155. package/dist/date-picker.js +8 -8
  156. package/dist/date-range-picker.js +2 -2
  157. package/dist/date.js +1 -1
  158. package/dist/divider.js +1 -1
  159. package/dist/dropdown.js +6 -6
  160. package/dist/empty-state.js +3 -3
  161. package/dist/filter-bar.js +608 -602
  162. package/dist/filter-bar.js.map +1 -1
  163. package/dist/focus-trap.js +1 -1
  164. package/dist/form-layout.js +2 -2
  165. package/dist/header.js +5 -5
  166. package/dist/index.js +19 -19
  167. package/dist/info-icon.js +4 -4
  168. package/dist/input-field.js +4 -4
  169. package/dist/internal.js +8 -8
  170. package/dist/link.js +1 -1
  171. package/dist/loading-indicator.js +1 -1
  172. package/dist/menu.js +1 -1
  173. package/dist/modal-fullscreen.js +7 -7
  174. package/dist/modal.js +6 -6
  175. package/dist/pagination.js +4 -4
  176. package/dist/payment-method.js +43 -43
  177. package/dist/payment-method.js.map +1 -1
  178. package/dist/popover.js +1 -1
  179. package/dist/popper-container.js +1 -1
  180. package/dist/radio-group.js +4 -4
  181. package/dist/search-bar.js +10 -10
  182. package/dist/search-bar.js.map +1 -1
  183. package/dist/secondary-nav.js +2 -2
  184. package/dist/segmented-control.js +3 -3
  185. package/dist/sidepanel.js +6 -6
  186. package/dist/status.js +1 -1
  187. package/dist/stepper.js +3 -3
  188. package/dist/structured-list.js +1 -1
  189. package/dist/summary-grid.js +3 -3
  190. package/dist/tabs.js +3 -3
  191. package/dist/tag.js +3 -3
  192. package/dist/textarea.js +4 -4
  193. package/dist/timeline.js +7 -7
  194. package/dist/toast.js +5 -5
  195. package/dist/toggle.js +3 -3
  196. package/dist/tutorial.js +7 -7
  197. package/dist/typography.js +1 -1
  198. package/dist/web-types.json +10 -1
  199. package/package.json +3 -3
  200. package/dist/chunks/base-modal.27c6f2db.js.map +0 -1
  201. package/dist/chunks/dropdown-default-textbox.59803edd.js.map +0 -1
  202. package/dist/chunks/index.026ae47b.js +0 -32
  203. package/dist/chunks/index.408e1419.js.map +0 -1
  204. package/dist/chunks/index.5b47c56b.js.map +0 -1
  205. /package/dist/assets/{cross.css → checkmark-circle-fill.css} +0 -0
@@ -1,8 +1,8 @@
1
1
  import { defineComponent as d, computed as r } from "vue";
2
2
  import { BentoLoadingIndicator as p } from "../loading-indicator.js";
3
- import { a as i } from "./button.0b6cda85.js";
4
- import { C as u } from "./cross-circle-fill.27580c4b.js";
5
- import { C as _ } from "./checkmark-circle-fill.345311d2.js";
3
+ import { a as i } from "./button.8738aa07.js";
4
+ import { C as u } from "./cross-circle-fill.42f9b938.js";
5
+ import { C as _ } from "./checkmark-circle-fill.d1cdb44b.js";
6
6
  import { n as f } from "./_plugin-vue2_normalizer.71e2aa87.js";
7
7
  import "../assets/loading-button.css";
8
8
  var e = /* @__PURE__ */ ((s) => (s.START = "start", s.LOADING = "loading", s.SUCCESS = "success", s.FAIL = "fail", s))(e || {});
@@ -96,4 +96,4 @@ export {
96
96
  T as B,
97
97
  e as a
98
98
  };
99
- //# sourceMappingURL=loading-button.50dddf2f.js.map
99
+ //# sourceMappingURL=loading-button.c7b30923.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"loading-button.50dddf2f.js","sources":["../../src/components/button/components/loading-button/loading-button.types.ts","../../src/components/button/components/loading-button/loading-button.vue"],"sourcesContent":["export enum BentoLoadingButtonState {\n START = 'start',\n LOADING = 'loading',\n SUCCESS = 'success',\n FAIL = 'fail',\n}\n\nexport type BentoLoadingButtonIconState = Partial<{ [key in BentoLoadingButtonState]: string }>;\n","<template>\n <bento-button\n :critical=\"isCritical\"\n :variant=\"variant\"\n :condensed=\"condensed\"\n :disabled=\"disabled\"\n :inverse=\"inverse\"\n class=\"b-loading-button\"\n :class=\"conditionalClasses\"\n @click.capture.stop=\"onClick\"\n >\n <slot></slot>\n <template v-if=\"state !== 'start'\" #iconLeft>\n <span class=\"b-loading-button__icon\" data-testid=\"loading-button-rotating-icon\">\n <cross v-if=\"state === 'fail'\" svg-title=\"failed\" />\n <checkmark v-else-if=\"state === 'success'\" svg-title=\"succeded\" />\n <!-- TODO: Replace with new loading-indicator component -->\n <bento-loading-indicator v-else-if=\"state === 'loading'\" small :inverse=\"isInverseLoadingIndicator\" />\n </span>\n </template>\n </bento-button>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, PropType } from 'vue';\n import { BentoLoadingButtonState } from './loading-button.types';\n import { BentoLoadingIndicator } from '@/components/loading-indicator';\n import BentoButton from '@/components/button/button.vue';\n import Cross from '@adyen/ui-assets-icons-16/vue/cross-circle-fill';\n import Checkmark from '@adyen/ui-assets-icons-16/vue/checkmark-circle-fill';\n\n const props = defineProps({\n /**\n * Reduces sizing of button\n */\n condensed: {\n type: BentoButton.props.condensed.type,\n default: false,\n },\n\n /**\n * Displays loading-button as critical\n */\n critical: {\n type: BentoButton.props.critical.type,\n default: false,\n },\n\n /**\n * Disables button functonality\n */\n disabled: {\n type: BentoButton.props.disabled.type,\n default: false,\n },\n\n /**\n * Sets color set to inverse\n */\n inverse: {\n type: Boolean,\n default: false,\n },\n\n /**\n * State of the button.\n * @values start, loading, success, fail\n */\n state: {\n type: String as PropType<BentoLoadingButtonState | `${BentoLoadingButtonState}`>,\n default: BentoLoadingButtonState.START,\n validator: (value: BentoLoadingButtonState) => Object.values(BentoLoadingButtonState).includes(value),\n },\n\n /**\n * Types of flavour of Button\n * @values primary, secondary, tertiary\n */\n variant: {\n type: BentoButton.props.variant.type,\n default: 'primary',\n validator: BentoButton.props.variant.validator,\n },\n });\n\n const emit = defineEmits<{\n /**\n * Click event handler\n */\n (e: 'click', event: MouseEvent): void;\n }>();\n\n const conditionalClasses = computed(() => ({\n [`b-loading-button--${props.variant}-${BentoLoadingButtonState.LOADING}`]:\n props.state === BentoLoadingButtonState.LOADING && !props.disabled,\n 'b-loading-button--loading': props.state === BentoLoadingButtonState.LOADING && !props.disabled,\n [`b-loading-button--${props.variant}-${BentoLoadingButtonState.SUCCESS}`]:\n props.state === BentoLoadingButtonState.SUCCESS,\n [`b-loading-button--inverse`]: props.inverse,\n }));\n\n const isInverseLoadingIndicator = computed(\n () => (props.variant === 'primary' && !props.inverse) || (props.variant !== 'primary' && props.inverse)\n );\n const isCritical = computed(\n () =>\n (props.critical && props.state === BentoLoadingButtonState.START) ||\n props.state === BentoLoadingButtonState.FAIL\n );\n\n const onClick = (e: MouseEvent) => {\n // Prevent Vue3 from triggering event twice\n e.stopPropagation();\n\n if (props.state !== BentoLoadingButtonState.LOADING) {\n emit('click', e);\n }\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * Loading Button component is used for cases where pressing a button starts an event that requires a loading state, e.g. when you have any sort of asynchronous action and are waiting for a response\n *\n * @example\n * import { BentoLoadingButton } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoLoadingButton },\n * template: `\n * <bento-loading-button state=\"loading\" variant=\"secondary\">\n * Loading\n * </bento-loading button>\n * `\n * }\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./loading-button.scss\" />\n"],"names":["BentoLoadingButtonState","BentoLoadingButtonState2","__default__","conditionalClasses","computed","props","isInverseLoadingIndicator","isCritical","e","emit"],"mappings":";;;;;;;AAAY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,QAAA,SACAA,EAAA,UAAA,WACAA,EAAA,UAAA,WACAA,EAAA,OAAA,QAJQA,IAAAD,KAAA,CAAA,CAAA;ACwIR,MAAAE,IAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA5CAC,IAAAC,EAAA,OAAA;AAAA,MAA2C,CAAA,qBAAAC,EAAA,WAAAL,EAAA,SAAA,GAAAK,EAAA,UAAAL,EAAA,WAAA,CAAAK,EAAA;AAAA,MAEuB,6BAAAA,EAAA,UAAAL,EAAA,WAAA,CAAAK,EAAA;AAAA,MACyB,CAAA,qBAAAA,EAAA,WAAAL,EAAA,SAAA,GAAAK,EAAA,UAAAL,EAAA;AAAA,MAE3C,CAAA,2BAAA,GAAAK,EAAA;AAAA,IACP,EAAA,GAGzCC,IAAAF;AAAA,MAAkC,MAAAC,EAAA,YAAA,aAAA,CAAAA,EAAA,WAAAA,EAAA,YAAA,aAAAA,EAAA;AAAA,IACiE,GAEnGE,IAAAH;AAAA,MAAmB,MAAAC,EAAA,YAAAA,EAAA,UAAAL,EAAA,SAAAK,EAAA,UAAAL,EAAA;AAAA,IAG6B;wHAGhD,CAAAQ,MAAA;AAEI,MAAAA,EAAA,gBAAA,GAEAH,EAAA,UAAAL,EAAA,WACIS,EAAA,SAAAD,CAAA;AAAA,IACJ;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"loading-button.c7b30923.js","sources":["../../src/components/button/components/loading-button/loading-button.types.ts","../../src/components/button/components/loading-button/loading-button.vue"],"sourcesContent":["export enum BentoLoadingButtonState {\n START = 'start',\n LOADING = 'loading',\n SUCCESS = 'success',\n FAIL = 'fail',\n}\n\nexport type BentoLoadingButtonIconState = Partial<{ [key in BentoLoadingButtonState]: string }>;\n","<template>\n <bento-button\n :critical=\"isCritical\"\n :variant=\"variant\"\n :condensed=\"condensed\"\n :disabled=\"disabled\"\n :inverse=\"inverse\"\n class=\"b-loading-button\"\n :class=\"conditionalClasses\"\n @click.capture.stop=\"onClick\"\n >\n <slot></slot>\n <template v-if=\"state !== 'start'\" #iconLeft>\n <span class=\"b-loading-button__icon\" data-testid=\"loading-button-rotating-icon\">\n <cross v-if=\"state === 'fail'\" svg-title=\"failed\" />\n <checkmark v-else-if=\"state === 'success'\" svg-title=\"succeded\" />\n <!-- TODO: Replace with new loading-indicator component -->\n <bento-loading-indicator v-else-if=\"state === 'loading'\" small :inverse=\"isInverseLoadingIndicator\" />\n </span>\n </template>\n </bento-button>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, PropType } from 'vue';\n import { BentoLoadingButtonState } from './loading-button.types';\n import { BentoLoadingIndicator } from '@/components/loading-indicator';\n import BentoButton from '@/components/button/button.vue';\n import Cross from '@adyen/ui-assets-icons-16/vue/cross-circle-fill';\n import Checkmark from '@adyen/ui-assets-icons-16/vue/checkmark-circle-fill';\n\n const props = defineProps({\n /**\n * Reduces sizing of button\n */\n condensed: {\n type: BentoButton.props.condensed.type,\n default: false,\n },\n\n /**\n * Displays loading-button as critical\n */\n critical: {\n type: BentoButton.props.critical.type,\n default: false,\n },\n\n /**\n * Disables button functonality\n */\n disabled: {\n type: BentoButton.props.disabled.type,\n default: false,\n },\n\n /**\n * Sets color set to inverse\n */\n inverse: {\n type: Boolean,\n default: false,\n },\n\n /**\n * State of the button.\n * @values start, loading, success, fail\n */\n state: {\n type: String as PropType<BentoLoadingButtonState | `${BentoLoadingButtonState}`>,\n default: BentoLoadingButtonState.START,\n validator: (value: BentoLoadingButtonState) => Object.values(BentoLoadingButtonState).includes(value),\n },\n\n /**\n * Types of flavour of Button\n * @values primary, secondary, tertiary\n */\n variant: {\n type: BentoButton.props.variant.type,\n default: 'primary',\n validator: BentoButton.props.variant.validator,\n },\n });\n\n const emit = defineEmits<{\n /**\n * Click event handler\n */\n (e: 'click', event: MouseEvent): void;\n }>();\n\n const conditionalClasses = computed(() => ({\n [`b-loading-button--${props.variant}-${BentoLoadingButtonState.LOADING}`]:\n props.state === BentoLoadingButtonState.LOADING && !props.disabled,\n 'b-loading-button--loading': props.state === BentoLoadingButtonState.LOADING && !props.disabled,\n [`b-loading-button--${props.variant}-${BentoLoadingButtonState.SUCCESS}`]:\n props.state === BentoLoadingButtonState.SUCCESS,\n [`b-loading-button--inverse`]: props.inverse,\n }));\n\n const isInverseLoadingIndicator = computed(\n () => (props.variant === 'primary' && !props.inverse) || (props.variant !== 'primary' && props.inverse)\n );\n const isCritical = computed(\n () =>\n (props.critical && props.state === BentoLoadingButtonState.START) ||\n props.state === BentoLoadingButtonState.FAIL\n );\n\n const onClick = (e: MouseEvent) => {\n // Prevent Vue3 from triggering event twice\n e.stopPropagation();\n\n if (props.state !== BentoLoadingButtonState.LOADING) {\n emit('click', e);\n }\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * Loading Button component is used for cases where pressing a button starts an event that requires a loading state, e.g. when you have any sort of asynchronous action and are waiting for a response\n *\n * @example\n * import { BentoLoadingButton } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoLoadingButton },\n * template: `\n * <bento-loading-button state=\"loading\" variant=\"secondary\">\n * Loading\n * </bento-loading button>\n * `\n * }\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./loading-button.scss\" />\n"],"names":["BentoLoadingButtonState","BentoLoadingButtonState2","__default__","conditionalClasses","computed","props","isInverseLoadingIndicator","isCritical","e","emit"],"mappings":";;;;;;;AAAY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,QAAA,SACAA,EAAA,UAAA,WACAA,EAAA,UAAA,WACAA,EAAA,OAAA,QAJQA,IAAAD,KAAA,CAAA,CAAA;ACwIR,MAAAE,IAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA5CAC,IAAAC,EAAA,OAAA;AAAA,MAA2C,CAAA,qBAAAC,EAAA,WAAAL,EAAA,SAAA,GAAAK,EAAA,UAAAL,EAAA,WAAA,CAAAK,EAAA;AAAA,MAEuB,6BAAAA,EAAA,UAAAL,EAAA,WAAA,CAAAK,EAAA;AAAA,MACyB,CAAA,qBAAAA,EAAA,WAAAL,EAAA,SAAA,GAAAK,EAAA,UAAAL,EAAA;AAAA,MAE3C,CAAA,2BAAA,GAAAK,EAAA;AAAA,IACP,EAAA,GAGzCC,IAAAF;AAAA,MAAkC,MAAAC,EAAA,YAAA,aAAA,CAAAA,EAAA,WAAAA,EAAA,YAAA,aAAAA,EAAA;AAAA,IACiE,GAEnGE,IAAAH;AAAA,MAAmB,MAAAC,EAAA,YAAAA,EAAA,UAAAL,EAAA,SAAAK,EAAA,UAAAL,EAAA;AAAA,IAG6B;wHAGhD,CAAAQ,MAAA;AAEI,MAAAA,EAAA,gBAAA,GAEAH,EAAA,UAAAL,EAAA,WACIS,EAAA,SAAAD,CAAA;AAAA,IACJ;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { n as r } from "./_plugin-vue2_normalizer.71e2aa87.js";
2
- import "../assets/cross.css";
2
+ import "../assets/checkmark-circle-fill.css";
3
3
  let e = 0;
4
4
  const n = {
5
5
  beforeCreate() {
@@ -23,4 +23,4 @@ const c = i.exports;
23
23
  export {
24
24
  c as R
25
25
  };
26
- //# sourceMappingURL=refresh.71a03998.js.map
26
+ //# sourceMappingURL=refresh.14e39831.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"refresh.71a03998.js","sources":["../../../../node_modules/@adyen/ui-assets-icons-16/dist/vue/refresh.vue"],"sourcesContent":["\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><path fill=\"#00112C\" d=\"M2.75 8C2.75 5.10421 5.10421 2.75 8 2.75C9.88725 2.75 11.5441 3.74881 12.472 5.25H9.25V6.75H14.75V1.25H13.25V3.75995C12.0118 2.23 10.1214 1.25 8 1.25C4.27579 1.25 1.25 4.27579 1.25 8C1.25 11.7242 4.27579 14.75 8 14.75C11.7242 14.75 14.75 11.7242 14.75 8H13.25C13.25 10.8958 10.8958 13.25 8 13.25C5.10421 13.25 2.75 10.8958 2.75 8Z\"/></svg>\n</template>\n<script>\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n<style>\n @import '../css/main.css';\n</style>\n"],"names":["uuid","_sfc_main"],"mappings":";;AAKA,IAAAA,IAAA;AAEA,MAAAC,IAAA;AAAA,EACA,eAAA;AACA,SAAA,OAAAD,EAAA,SAAA,GACAA,KAAA;AAAA,EACA;AACA;;;;;;;;;;;;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"refresh.14e39831.js","sources":["../../../../node_modules/@adyen/ui-assets-icons-16/dist/vue/refresh.vue"],"sourcesContent":["\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><path fill=\"#00112C\" d=\"M2.75 8C2.75 5.10421 5.10421 2.75 8 2.75C9.88725 2.75 11.5441 3.74881 12.472 5.25H9.25V6.75H14.75V1.25H13.25V3.75995C12.0118 2.23 10.1214 1.25 8 1.25C4.27579 1.25 1.25 4.27579 1.25 8C1.25 11.7242 4.27579 14.75 8 14.75C11.7242 14.75 14.75 11.7242 14.75 8H13.25C13.25 10.8958 10.8958 13.25 8 13.25C5.10421 13.25 2.75 10.8958 2.75 8Z\"/></svg>\n</template>\n<script>\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n<style>\n @import '../css/main.css';\n</style>\n"],"names":["uuid","_sfc_main"],"mappings":";;AAKA,IAAAA,IAAA;AAEA,MAAAC,IAAA;AAAA,EACA,eAAA;AACA,SAAA,OAAAD,EAAA,SAAA,GACAA,KAAA;AAAA,EACA;AACA;;;;;;;;;;;;;;;","x_google_ignoreList":[0]}
@@ -1,5 +1,5 @@
1
1
  import { n as r } from "./_plugin-vue2_normalizer.71e2aa87.js";
2
- import "../assets/cross.css";
2
+ import "../assets/checkmark-circle-fill.css";
3
3
  let e = 0;
4
4
  const a = {
5
5
  beforeCreate() {
@@ -23,4 +23,4 @@ const c = l.exports;
23
23
  export {
24
24
  c as S
25
25
  };
26
- //# sourceMappingURL=search.471270fe.js.map
26
+ //# sourceMappingURL=search.eca6bd88.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"search.471270fe.js","sources":["../../../../node_modules/@adyen/ui-assets-icons-16/dist/vue/search.vue"],"sourcesContent":["\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><g :clip-path=\"'url(#uia-icons-16-search__a' + uuid + ')'\"><path fill=\"#00112C\" d=\"M8.31686 0.379702C7.00749 0.119252 5.65029 0.252925 4.41689 0.763816C3.18349 1.27471 2.12928 2.13987 1.38758 3.2499C0.645881 4.35994 0.25 5.66498 0.25 7C0.25 8.79021 0.961159 10.5071 2.22703 11.773C3.4929 13.0388 5.20979 13.75 7 13.75C8.33502 13.75 9.64007 13.3541 10.7501 12.6124C10.9096 12.5059 11.064 12.3928 11.2131 12.2738L15.0001 16.0608L16.0608 15.0001L12.2737 11.2131C12.6674 10.7203 12.9922 10.1721 13.2362 9.58312C13.7471 8.34972 13.8808 6.99252 13.6203 5.68314C13.3598 4.37377 12.717 3.17104 11.773 2.22703C10.829 1.28303 9.62623 0.640153 8.31686 0.379702ZM4.99091 2.14964C5.95022 1.75228 7.00582 1.64831 8.02422 1.85088C9.04262 2.05345 9.97808 2.55347 10.7123 3.28769C11.4465 4.02192 11.9465 4.95738 12.1491 5.97578C12.3517 6.99418 12.2477 8.04978 11.8504 9.00909C11.453 9.9684 10.7801 10.7883 9.91674 11.3652C9.05339 11.9421 8.03835 12.25 7 12.25C5.60761 12.25 4.27225 11.6969 3.28769 10.7123C2.30312 9.72775 1.75 8.39239 1.75 7C1.75 5.96165 2.05791 4.94662 2.63478 4.08326C3.21166 3.2199 4.0316 2.547 4.99091 2.14964Z\"/></g><defs><clipPath :id=\"'uia-icons-16-search__a' + uuid\"><rect width=\"16\" height=\"16\" fill=\"#fff\"/></clipPath></defs></svg>\n</template>\n<script>\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n<style>\n @import '../css/main.css';\n</style>\n"],"names":["uuid","_sfc_main"],"mappings":";;AAKA,IAAAA,IAAA;AAEA,MAAAC,IAAA;AAAA,EACA,eAAA;AACA,SAAA,OAAAD,EAAA,SAAA,GACAA,KAAA;AAAA,EACA;AACA;;;;;;;;;;;;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"search.eca6bd88.js","sources":["../../../../node_modules/@adyen/ui-assets-icons-16/dist/vue/search.vue"],"sourcesContent":["\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><g :clip-path=\"'url(#uia-icons-16-search__a' + uuid + ')'\"><path fill=\"#00112C\" d=\"M8.31686 0.379702C7.00749 0.119252 5.65029 0.252925 4.41689 0.763816C3.18349 1.27471 2.12928 2.13987 1.38758 3.2499C0.645881 4.35994 0.25 5.66498 0.25 7C0.25 8.79021 0.961159 10.5071 2.22703 11.773C3.4929 13.0388 5.20979 13.75 7 13.75C8.33502 13.75 9.64007 13.3541 10.7501 12.6124C10.9096 12.5059 11.064 12.3928 11.2131 12.2738L15.0001 16.0608L16.0608 15.0001L12.2737 11.2131C12.6674 10.7203 12.9922 10.1721 13.2362 9.58312C13.7471 8.34972 13.8808 6.99252 13.6203 5.68314C13.3598 4.37377 12.717 3.17104 11.773 2.22703C10.829 1.28303 9.62623 0.640153 8.31686 0.379702ZM4.99091 2.14964C5.95022 1.75228 7.00582 1.64831 8.02422 1.85088C9.04262 2.05345 9.97808 2.55347 10.7123 3.28769C11.4465 4.02192 11.9465 4.95738 12.1491 5.97578C12.3517 6.99418 12.2477 8.04978 11.8504 9.00909C11.453 9.9684 10.7801 10.7883 9.91674 11.3652C9.05339 11.9421 8.03835 12.25 7 12.25C5.60761 12.25 4.27225 11.6969 3.28769 10.7123C2.30312 9.72775 1.75 8.39239 1.75 7C1.75 5.96165 2.05791 4.94662 2.63478 4.08326C3.21166 3.2199 4.0316 2.547 4.99091 2.14964Z\"/></g><defs><clipPath :id=\"'uia-icons-16-search__a' + uuid\"><rect width=\"16\" height=\"16\" fill=\"#fff\"/></clipPath></defs></svg>\n</template>\n<script>\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n<style>\n @import '../css/main.css';\n</style>\n"],"names":["uuid","_sfc_main"],"mappings":";;AAKA,IAAAA,IAAA;AAEA,MAAAC,IAAA;AAAA,EACA,eAAA;AACA,SAAA,OAAAD,EAAA,SAAA,GACAA,KAAA;AAAA,EACA;AACA;;;;;;;;;;;;;;;","x_google_ignoreList":[0]}
@@ -1,9 +1,9 @@
1
1
  import { computed as d, defineComponent as b, reactive as g, nextTick as w } from "vue";
2
2
  import { l as r } from "./events.58c00e6d.js";
3
3
  import { g as v } from "./unique-id.a2a2b458.js";
4
- import { P as S, a as D, b as N } from "./index.dc985e76.js";
4
+ import { P as S, a as D, b as N } from "./index.f03831cf.js";
5
5
  import { V as W } from "./index.4c062058.js";
6
- import { B as I } from "./index.de687404.js";
6
+ import { B as I } from "./index.f64eee15.js";
7
7
  import { n as x } from "./_plugin-vue2_normalizer.71e2aa87.js";
8
8
  import "../assets/tooltip.css";
9
9
  const l = { ...S };
@@ -170,4 +170,4 @@ export {
170
170
  l as a,
171
171
  A as b
172
172
  };
173
- //# sourceMappingURL=tooltip.6748027a.js.map
173
+ //# sourceMappingURL=tooltip.a76de645.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.6748027a.js","sources":["../../src/directives/tooltip/tooltip.types.ts","../../src/types/utils-events.ts","../../src/components/tooltip/tooltip.vue","../../src/directives/tooltip/tooltip.ts"],"sourcesContent":["import { PopperContainerPositionBasic } from '@/components/popper-container';\nimport type { DirectiveBinding } from 'vue/types/options';\n\nexport const BentoTooltipPosition = { ...PopperContainerPositionBasic };\nexport type BentoTooltipPosition = PopperContainerPositionBasic;\n\nexport enum BentoTooltipState {\n HIDDEN = 'hidden',\n}\n\nexport interface BentoTooltipDirectiveBinding extends Readonly<DirectiveBinding> {\n readonly value: string;\n}\n","import type { Vue } from 'vue-demi';\n\nexport interface ListenOptions {\n capture?: boolean;\n passive?: boolean;\n once?: boolean;\n self?: boolean;\n vm?: Vue;\n onCleanup?: () => void;\n}\n\nexport enum EventKey {\n ESCAPE = 'Escape',\n ENTER = 'Enter',\n ARROW_LEFT = 'ArrowLeft',\n ARROW_UP = 'ArrowUp',\n ARROW_RIGHT = 'ArrowRight',\n ARROW_DOWN = 'ArrowDown',\n PAGE_UP = 'PageUp',\n PAGE_DOWN = 'PageDown',\n END = 'End',\n HOME = 'Home',\n}\n\n/**\n * @deprecated `Event.keyCode` is deprecated. Use `EventKey` instead\n */\nexport enum KeyCode {\n ESCAPE = 27,\n ENTER = 13,\n ARROW_LEFT = 37,\n ARROW_UP = 38,\n ARROW_RIGHT = 39,\n ARROW_DOWN = 40,\n PAGE_UP = 33,\n PAGE_DOWN = 34,\n END = 35,\n HOME = 36,\n}\n","<template>\n <popper-container\n :id=\"id\"\n :aria-role=\"PopperContainerAriaRole.TOOLTIP\"\n :aria-hidden=\"!isShown\"\n :arrow=\"{ classes: ['b-tooltip__arrow'] }\"\n :class=\"conditionalClasses\"\n :fallback-position=\"['top', 'bottom', 'right', 'left']\"\n :is-hidden=\"!isShown\"\n :offset=\"[0, 4]\"\n :position=\"position\"\n :tabindex=\"tabIndex\"\n :target-element=\"targetElement\"\n class=\"b-tooltip\"\n >\n <bento-typography el=\"span\" variant=\"caption\">\n {{ content }}\n </bento-typography>\n </popper-container>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType } from 'vue';\n import { BentoTooltipPosition, BentoTooltipState } from '@/directives/tooltip/tooltip.types';\n import { PopperContainer, PopperContainerAriaRole } from '@/components/popper-container';\n import { BentoTypography } from '@/components/typography';\n import { VueNodeElement } from '@/types';\n\n /**\n * Tooltip container, to be used internally to render the tooltip container where the text is shown.\n */\n export const Tooltip = {\n name: 'tooltip',\n components: { BentoTypography, PopperContainer },\n props: {\n /**\n * The tooltip's id. Necessary for accessibility purposes.\n */\n id: { type: String, default: null },\n /**\n * Tooltip's target reference to the DOM element or Vue component.\n * The tooltip will position itself relatively to target element, in the specified position.\n */\n targetElement: { type: [Element, Object] as PropType<VueNodeElement>, required: true },\n /**\n * Tooltip's position relative to the target element.\n * Possible values are: 'top', 'bottom', 'left' and 'right'.\n */\n position: {\n type: String as PropType<BentoTooltipPosition>,\n default: BentoTooltipPosition.TOP,\n validator: value => Object.values(BentoTooltipPosition).includes(value as BentoTooltipPosition),\n },\n /**\n * Tooltip's offset.\n * If specified, the tooltip will have an offset in pixels between it and the target element\n * in specified position.\n */\n offset: { type: Number, default: 0 },\n /**\n * Tooltip's text content.\n */\n content: { type: String, required: true },\n /**\n * Shows / Hides the Tooltip component\n */\n isShown: { type: Boolean, default: false },\n },\n setup(props) {\n const conditionalClasses = computed(() => ({\n [`b-tooltip--${BentoTooltipState.HIDDEN}`]: !props.isShown,\n }));\n\n const tabIndex = computed((): number => (props.isShown ? 1 : -1));\n\n return {\n // Enums\n PopperContainerAriaRole,\n\n // Values\n conditionalClasses,\n tabIndex,\n };\n },\n };\n\n export default defineComponent(Tooltip);\n</script>\n\n<style lang=\"scss\" scoped src=\"./tooltip.scss\" />\n","import { nextTick, reactive } from 'vue';\nimport { listen } from '@/utils/ts/events';\nimport { generateUid } from '@/utils/ts/unique-id';\nimport { EventKey } from '@/types/utils-events';\nimport { BentoTooltipDirectiveBinding, BentoTooltipPosition } from './tooltip.types';\nimport { createApp, h, isVue2, Vue2 } from 'vue-demi';\nimport BentoTooltip from '@/components/tooltip/tooltip.vue';\n\ninterface TooltipInstance {\n target: HTMLElement;\n content: string;\n position: BentoTooltipPosition;\n removeListeners: Array<() => void>;\n}\n\n/**\n * Tooltip directive to render a tooltip on a given HTML element or component.\n *\n * @usage\n * import { BentoTooltipDirective, BentoTooltipPosition } from '@adyen/bento-vue2';\n *\n * export default {\n * directives: { BentoTooltipDirective },\n * template: `\n * <bento-button\n * v-bento-tooltip-directive:BentoTooltipPosition.BOTTOM=\"refToTextContent\"\n * >\n * Button text\n * </bento-button>\n * `,\n * }\n */\nconst tooltipInstances: Array<TooltipInstance> = [];\nconst ariaDescribedByAttr = 'aria-describedby';\nconst tooltipId = generateUid('tooltip');\n\nlet tooltipVNode;\n\n// Reusable Tooltip component instance.\nlet tooltip;\n// Global visibility state to prevent tooltips from showing after it being instructed to hide\nlet open = false;\n\nconst tooltipProps = reactive({\n targetElement: null,\n content: 'START_MESSAGE',\n id: tooltipId,\n position: undefined,\n isShown: false,\n});\n\n/**\n * Creates a new Tooltip component instance and inserts it into DOM.\n * @param {HTMLElement} el the target element for the Tooltip\n * @internal\n */\nconst createTooltip = (el: HTMLElement) => {\n // Sets the target's tabindex so as to make the tooltip interactive via keyboard navigation\n el.setAttribute('tabindex', '0');\n\n if (isVue2) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore: Type error for Vue method in Vue 3 but this code only executes in vue 2 so ignoring.\n const TooltipComponent = Vue2.extend(BentoTooltip);\n tooltip = new TooltipComponent({ propsData: { targetElement: el, content: '', id: tooltipId } }).$mount();\n document.body.appendChild(tooltip.$el);\n } else {\n tooltipProps.targetElement = el;\n tooltip = createApp({\n components: { BentoTooltip },\n setup() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore: Type error for h method in Vue 2 but this code only executes in vue 3 so ignoring.\n return () => h(BentoTooltip, { ...tooltipProps }, '');\n },\n });\n tooltipVNode = document.createElement('div');\n tooltipVNode.id = 'tooltip-parent';\n document.body.appendChild(tooltipVNode);\n tooltip.mount('#tooltip-parent');\n }\n};\n\n/**\n * Removes Tooltip component instance from the DOM and destroys it.\n * @internal\n */\nconst destroyTooltip = () => {\n if (isVue2) {\n if (document.contains(tooltip.$el)) {\n document.body.removeChild(tooltip.$el);\n }\n tooltip.$destroy();\n } else {\n tooltip.unmount();\n if (document.contains(tooltipVNode)) {\n document.body.removeChild(tooltipVNode);\n }\n }\n\n tooltip = undefined;\n};\n\n/**\n * Returns tooltip position based on the specified argument.\n * By default returns 'top' if no argument is specified.\n * @param {BentoTooltipDirectiveBinding} binding Directive binding object.\n * @returns {string} Tooltip position.\n * @internal\n */\nconst getTooltipPosition = (binding: BentoTooltipDirectiveBinding): BentoTooltipPosition =>\n Object.values(BentoTooltipPosition).includes(binding.arg as BentoTooltipPosition)\n ? (binding.arg as BentoTooltipPosition)\n : BentoTooltipPosition.TOP;\n\n/**\n * Get the correct Tooltip instance for the given target element\n * @param {HTMLElement} el the target element for the Tooltip\n * @returns\n */\nconst getTooltipInstanceForTarget = (el: HTMLElement): TooltipInstance =>\n tooltipInstances.find(\n ctx =>\n // isEqualNode doesn't work correct for svg element, hence the second check here\n ctx.target.isEqualNode(el) && ctx.target === el\n );\n\n/**\n * On mouse enter event updates tooltip with correct content and position, and shows tooltip.\n * @param {?HTMLElement} el - Target element\n * @internal\n */\nconst showTooltip = (el?: HTMLElement) => {\n const tooltipInstance = getTooltipInstanceForTarget(el);\n\n // If tooltip content is empty – do not show the tooltip\n if (!tooltipInstance.content || !el) {\n return;\n }\n\n if (el) {\n el.setAttribute(ariaDescribedByAttr, tooltipId);\n }\n\n // If the Tooltip is inside a dialog, move tooltip element inside of it\n // It gets restored to <body> when it gets hidden\n let isDialogOpen = false;\n document.querySelectorAll('dialog').forEach(node => {\n isDialogOpen = node?.open || isDialogOpen;\n });\n\n if (isDialogOpen) {\n if (isVue2) {\n el.after(tooltip.$el);\n // eslint-disable-next-line no-underscore-dangle\n } else if (tooltip?._instance?.vnode?.el) {\n // eslint-disable-next-line no-underscore-dangle\n el.after(tooltip?._instance?.vnode?.el);\n }\n isDialogOpen = false;\n }\n\n open = true;\n\n tooltip.content = tooltipInstance.content;\n tooltip.position = tooltipInstance.position;\n\n tooltipProps.content = tooltipInstance.content;\n tooltipProps.position = tooltipInstance.position;\n\n // Do calculations on a next tick, otherwise tooltip position calculations will be wrong\n nextTick(() => {\n // Do not open tooltip if it has been instructed to hide in process\n if (!open) {\n return;\n }\n tooltip.targetElement = el;\n tooltip.isShown = true;\n\n tooltipProps.targetElement = el;\n tooltipProps.isShown = true;\n });\n};\n\n/**\n * On mouse leave event hides the tooltip.\n * @internal\n */\nconst hideTooltip = (el?: HTMLElement) => {\n // Restore the tooltip element to body if it got move out of <body>\n if (tooltip.$el?.parentElement?.tagName && tooltip.$el?.parentElement?.tagName !== 'BODY') {\n document.body.appendChild(tooltip.$el);\n }\n\n open = false;\n tooltip.isShown = false;\n tooltipProps.isShown = false;\n if (el) {\n el.removeAttribute(ariaDescribedByAttr);\n }\n};\n\nconst tooltipBind = (el: HTMLElement, binding: BentoTooltipDirectiveBinding) => {\n // eslint-disable-next-line no-prototype-builtins\n if (!binding.hasOwnProperty('value') || binding.value) {\n // Create Tooltip component singleton instance\n if (tooltipInstances.length === 0) {\n createTooltip(el);\n }\n\n const show = () => showTooltip(el);\n const hide = () => hideTooltip(el);\n\n // Create and store context object, which has directive related handlers and content.\n const tooltipInstance: TooltipInstance = {\n target: el,\n content: binding.value,\n position: getTooltipPosition(binding),\n removeListeners: [\n listen(el, 'mouseenter', show),\n listen(el, 'mouseleave', hide),\n listen(el, 'focus', show),\n listen(el, 'blur', hide),\n listen(el, 'keydown', evt => {\n const keyboardEvent = <KeyboardEvent>evt;\n if (keyboardEvent.key === EventKey.ESCAPE) {\n hide();\n }\n }),\n ],\n };\n\n tooltipInstances.push(tooltipInstance);\n }\n};\n\nconst tooltipUpdate = (el: HTMLElement, binding: BentoTooltipDirectiveBinding) => {\n const tooltipInstance = getTooltipInstanceForTarget(el);\n if (tooltipInstance) {\n // Update tooltip content value if it is changed\n if (tooltipInstance?.content !== binding.value) {\n tooltipInstance.content = binding.value;\n // If tooltip is currently shown for current element – update tooltip's content value\n if (tooltip.isShown && tooltip.targetElement.isEqualNode(el)) {\n if (!tooltipInstance.content) {\n tooltip.isShown = false;\n } else {\n tooltip.content = binding.value;\n }\n }\n }\n // Update tooltip position if it is changed\n if (tooltipInstance.position !== binding.arg) {\n const position = getTooltipPosition(binding);\n tooltipInstance.position = position;\n tooltip.position = position;\n }\n } else if (!tooltipInstance && binding.value) {\n // If I don't have a tooltip instance yet but the value passed was updated\n tooltipBind(el, binding);\n }\n};\n\nconst tooltipUnbind = (el: HTMLElement) => {\n const context = getTooltipInstanceForTarget(el);\n\n // Prevent unbinding/removing when there's nothing to unbind, leads to stack overflow errors\n if (!context) {\n return;\n }\n\n context.removeListeners.forEach(removeListener => {\n removeListener();\n });\n\n // If el is removed while tooltip is displayed, the tooltip doesnt hide as\n // there is no el to trigger mouseleave/blur.\n hideTooltip();\n\n tooltipInstances.splice(tooltipInstances.indexOf(context), 1);\n\n // If all the elements using the directive are removed, then no point having\n // the component on the page.\n if (tooltipInstances.length === 0) {\n destroyTooltip();\n }\n};\n\n/**\n * This directive allows you to bind a tooltip to an element.\n * Tooltip can be configured to be shown in one of four positions: 'top', 'left', 'right' and 'bottom'.\n *\n * @example\n * import { BentoTooltipDirective as BentoTooltip, BentoTooltipPosition } from '@adyen/bento-vue2';\n *\n * export default {\n * directives: { BentoTooltip },\n * methods: {\n * contentExpression() {\n * return 'tooltip content';\n * },\n * },\n * template: `<div>\n * <div v-bento-tooltip:left=\"refToTooltipContent\"></div>\n * <div v-bento-tooltip:[TooltipPosition.BOTTOM]=\"refToTooltipContent\"></div>\n *\n * <!-- If you don't specify the position then by default it's `TooltipPosition.TOP` -->\n * <div v-bento-tooltip=\"refToTooltipContent\"></div>\n *\n * <!-- Tooltip content can also be a data property or a method or a computed property as well -->\n * <div v-bento-tooltip=\"contentExpression()\"></div>\n * </div>`,\n * };\n */\nexport const BentoTooltipDirective = {\n // Vue 2 Directive hooks\n bind(el, binding) {\n tooltipBind(el, binding);\n },\n update(el, binding) {\n tooltipUpdate(el, binding);\n },\n unbind(el) {\n tooltipUnbind(el);\n },\n // Vue 3 Directive hooks\n beforeMount(el, binding) {\n tooltipBind(el, binding);\n },\n mounted(el, binding) {\n tooltipUpdate(el, binding);\n },\n updated(el, binding) {\n tooltipUpdate(el, binding);\n },\n unmounted(el) {\n tooltipUnbind(el);\n },\n};\n"],"names":["BentoTooltipPosition","PopperContainerPositionBasic","BentoTooltipState","BentoTooltipState2","EventKey","EventKey2","KeyCode","KeyCode2","Tooltip","BentoTypography","PopperContainer","value","props","conditionalClasses","computed","tabIndex","PopperContainerAriaRole","_sfc_main","defineComponent","tooltipInstances","ariaDescribedByAttr","tooltipId","generateUid","tooltip","open","tooltipProps","reactive","createTooltip","el","TooltipComponent","Vue2","BentoTooltip","destroyTooltip","getTooltipPosition","binding","getTooltipInstanceForTarget","ctx","showTooltip","tooltipInstance","isDialogOpen","node","nextTick","hideTooltip","_b","_a","_d","_c","tooltipBind","show","hide","listen","evt","tooltipUpdate","position","tooltipUnbind","context","removeListener","BentoTooltipDirective"],"mappings":";;;;;;;;AAGa,MAAAA,IAAA,EAAA,GAAAC,EAAA;AAGD,IAAAC,IAAA,kBAAAC,OACRA,EAAA,SAAA,UADQA,IAAAD,KAAA,CAAA,CAAA,GCKAE,IAAA,kBAAAC,OACRA,EAAA,SAAA,UACAA,EAAA,QAAA,SACAA,EAAA,aAAA,aACAA,EAAA,WAAA,WACAA,EAAA,cAAA,cACAA,EAAA,aAAA,aACAA,EAAA,UAAA,UACAA,EAAA,YAAA,YACAA,EAAA,MAAA,OACAA,EAAA,OAAA,QAVQA,IAAAD,KAAA,CAAA,CAAA,GAgBAE,IAAA,kBAAAC,OACRA,EAAAA,EAAA,SAAA,EAAA,IAAA,UACAA,EAAAA,EAAA,QAAA,EAAA,IAAA,SACAA,EAAAA,EAAA,aAAA,EAAA,IAAA,cACAA,EAAAA,EAAA,WAAA,EAAA,IAAA,YACAA,EAAAA,EAAA,cAAA,EAAA,IAAA,eACAA,EAAAA,EAAA,aAAA,EAAA,IAAA,cACAA,EAAAA,EAAA,UAAA,EAAA,IAAA,WACAA,EAAAA,EAAA,YAAA,EAAA,IAAA,aACAA,EAAAA,EAAA,MAAA,EAAA,IAAA,OACAA,EAAAA,EAAA,OAAA,EAAA,IAAA,QAVQA,IAAAD,KAAA,CAAA,CAAA;ACIZ,MAAAE,IAAA;AAAA,EAAA,MAAA;AAAA,EACA,YAAA,EAAA,iBAAAC,GAAA,iBAAAC,EAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA,IACA,IAAA,EAAA,MAAA,QAAA,SAAA,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAIA,eAAA,EAAA,MAAA,CAAA,SAAA,MAAA,GAAA,UAAA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,UAAA;AAAA,MAKA,MAAA;AAAA,MACA,SAAAV,EAAA;AAAA,MACA,WAAA,CAAAW,M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AoC,CAAA,GAAA,CAAA,GAIApC,EAAA,WAAA,KACIa,EAAA;AAER,GA4BOyB,IAAA;AAAA;AAAA,EAA8B,KAAA7B,GAAAM,GAAA;AAG7B,IAAAa,EAAAnB,GAAAM,CAAA;AAAA,EAAuB;AAAA,EAC3B,OAAAN,GAAAM,GAAA;AAEI,IAAAkB,EAAAxB,GAAAM,CAAA;AAAA,EAAyB;AAAA,EAC7B,OAAAN,GAAA;AAEI,IAAA0B,EAAA1B,CAAA;AAAA,EAAgB;AAAA;AAAA,EACpB,YAAAA,GAAAM,GAAA;AAGI,IAAAa,EAAAnB,GAAAM,CAAA;AAAA,EAAuB;AAAA,EAC3B,QAAAN,GAAAM,GAAA;AAEI,IAAAkB,EAAAxB,GAAAM,CAAA;AAAA,EAAyB;AAAA,EAC7B,QAAAN,GAAAM,GAAA;AAEI,IAAAkB,EAAAxB,GAAAM,CAAA;AAAA,EAAyB;AAAA,EAC7B,UAAAN,GAAA;AAEI,IAAA0B,EAAA1B,CAAA;AAAA,EAAgB;AAExB;"}
1
+ {"version":3,"file":"tooltip.a76de645.js","sources":["../../src/directives/tooltip/tooltip.types.ts","../../src/types/utils-events.ts","../../src/components/tooltip/tooltip.vue","../../src/directives/tooltip/tooltip.ts"],"sourcesContent":["import { PopperContainerPositionBasic } from '@/components/popper-container';\nimport type { DirectiveBinding } from 'vue/types/options';\n\nexport const BentoTooltipPosition = { ...PopperContainerPositionBasic };\nexport type BentoTooltipPosition = PopperContainerPositionBasic;\n\nexport enum BentoTooltipState {\n HIDDEN = 'hidden',\n}\n\nexport interface BentoTooltipDirectiveBinding extends Readonly<DirectiveBinding> {\n readonly value: string;\n}\n","import type { Vue } from 'vue-demi';\n\nexport interface ListenOptions {\n capture?: boolean;\n passive?: boolean;\n once?: boolean;\n self?: boolean;\n vm?: Vue;\n onCleanup?: () => void;\n}\n\nexport enum EventKey {\n ESCAPE = 'Escape',\n ENTER = 'Enter',\n ARROW_LEFT = 'ArrowLeft',\n ARROW_UP = 'ArrowUp',\n ARROW_RIGHT = 'ArrowRight',\n ARROW_DOWN = 'ArrowDown',\n PAGE_UP = 'PageUp',\n PAGE_DOWN = 'PageDown',\n END = 'End',\n HOME = 'Home',\n}\n\n/**\n * @deprecated `Event.keyCode` is deprecated. Use `EventKey` instead\n */\nexport enum KeyCode {\n ESCAPE = 27,\n ENTER = 13,\n ARROW_LEFT = 37,\n ARROW_UP = 38,\n ARROW_RIGHT = 39,\n ARROW_DOWN = 40,\n PAGE_UP = 33,\n PAGE_DOWN = 34,\n END = 35,\n HOME = 36,\n}\n","<template>\n <popper-container\n :id=\"id\"\n :aria-role=\"PopperContainerAriaRole.TOOLTIP\"\n :aria-hidden=\"!isShown\"\n :arrow=\"{ classes: ['b-tooltip__arrow'] }\"\n :class=\"conditionalClasses\"\n :fallback-position=\"['top', 'bottom', 'right', 'left']\"\n :is-hidden=\"!isShown\"\n :offset=\"[0, 4]\"\n :position=\"position\"\n :tabindex=\"tabIndex\"\n :target-element=\"targetElement\"\n class=\"b-tooltip\"\n >\n <bento-typography el=\"span\" variant=\"caption\">\n {{ content }}\n </bento-typography>\n </popper-container>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType } from 'vue';\n import { BentoTooltipPosition, BentoTooltipState } from '@/directives/tooltip/tooltip.types';\n import { PopperContainer, PopperContainerAriaRole } from '@/components/popper-container';\n import { BentoTypography } from '@/components/typography';\n import { VueNodeElement } from '@/types';\n\n /**\n * Tooltip container, to be used internally to render the tooltip container where the text is shown.\n */\n export const Tooltip = {\n name: 'tooltip',\n components: { BentoTypography, PopperContainer },\n props: {\n /**\n * The tooltip's id. Necessary for accessibility purposes.\n */\n id: { type: String, default: null },\n /**\n * Tooltip's target reference to the DOM element or Vue component.\n * The tooltip will position itself relatively to target element, in the specified position.\n */\n targetElement: { type: [Element, Object] as PropType<VueNodeElement>, required: true },\n /**\n * Tooltip's position relative to the target element.\n * Possible values are: 'top', 'bottom', 'left' and 'right'.\n */\n position: {\n type: String as PropType<BentoTooltipPosition>,\n default: BentoTooltipPosition.TOP,\n validator: value => Object.values(BentoTooltipPosition).includes(value as BentoTooltipPosition),\n },\n /**\n * Tooltip's offset.\n * If specified, the tooltip will have an offset in pixels between it and the target element\n * in specified position.\n */\n offset: { type: Number, default: 0 },\n /**\n * Tooltip's text content.\n */\n content: { type: String, required: true },\n /**\n * Shows / Hides the Tooltip component\n */\n isShown: { type: Boolean, default: false },\n },\n setup(props) {\n const conditionalClasses = computed(() => ({\n [`b-tooltip--${BentoTooltipState.HIDDEN}`]: !props.isShown,\n }));\n\n const tabIndex = computed((): number => (props.isShown ? 1 : -1));\n\n return {\n // Enums\n PopperContainerAriaRole,\n\n // Values\n conditionalClasses,\n tabIndex,\n };\n },\n };\n\n export default defineComponent(Tooltip);\n</script>\n\n<style lang=\"scss\" scoped src=\"./tooltip.scss\" />\n","import { nextTick, reactive } from 'vue';\nimport { listen } from '@/utils/ts/events';\nimport { generateUid } from '@/utils/ts/unique-id';\nimport { EventKey } from '@/types/utils-events';\nimport { BentoTooltipDirectiveBinding, BentoTooltipPosition } from './tooltip.types';\nimport { createApp, h, isVue2, Vue2 } from 'vue-demi';\nimport BentoTooltip from '@/components/tooltip/tooltip.vue';\n\ninterface TooltipInstance {\n target: HTMLElement;\n content: string;\n position: BentoTooltipPosition;\n removeListeners: Array<() => void>;\n}\n\n/**\n * Tooltip directive to render a tooltip on a given HTML element or component.\n *\n * @usage\n * import { BentoTooltipDirective, BentoTooltipPosition } from '@adyen/bento-vue2';\n *\n * export default {\n * directives: { BentoTooltipDirective },\n * template: `\n * <bento-button\n * v-bento-tooltip-directive:BentoTooltipPosition.BOTTOM=\"refToTextContent\"\n * >\n * Button text\n * </bento-button>\n * `,\n * }\n */\nconst tooltipInstances: Array<TooltipInstance> = [];\nconst ariaDescribedByAttr = 'aria-describedby';\nconst tooltipId = generateUid('tooltip');\n\nlet tooltipVNode;\n\n// Reusable Tooltip component instance.\nlet tooltip;\n// Global visibility state to prevent tooltips from showing after it being instructed to hide\nlet open = false;\n\nconst tooltipProps = reactive({\n targetElement: null,\n content: 'START_MESSAGE',\n id: tooltipId,\n position: undefined,\n isShown: false,\n});\n\n/**\n * Creates a new Tooltip component instance and inserts it into DOM.\n * @param {HTMLElement} el the target element for the Tooltip\n * @internal\n */\nconst createTooltip = (el: HTMLElement) => {\n // Sets the target's tabindex so as to make the tooltip interactive via keyboard navigation\n el.setAttribute('tabindex', '0');\n\n if (isVue2) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore: Type error for Vue method in Vue 3 but this code only executes in vue 2 so ignoring.\n const TooltipComponent = Vue2.extend(BentoTooltip);\n tooltip = new TooltipComponent({ propsData: { targetElement: el, content: '', id: tooltipId } }).$mount();\n document.body.appendChild(tooltip.$el);\n } else {\n tooltipProps.targetElement = el;\n tooltip = createApp({\n components: { BentoTooltip },\n setup() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore: Type error for h method in Vue 2 but this code only executes in vue 3 so ignoring.\n return () => h(BentoTooltip, { ...tooltipProps }, '');\n },\n });\n tooltipVNode = document.createElement('div');\n tooltipVNode.id = 'tooltip-parent';\n document.body.appendChild(tooltipVNode);\n tooltip.mount('#tooltip-parent');\n }\n};\n\n/**\n * Removes Tooltip component instance from the DOM and destroys it.\n * @internal\n */\nconst destroyTooltip = () => {\n if (isVue2) {\n if (document.contains(tooltip.$el)) {\n document.body.removeChild(tooltip.$el);\n }\n tooltip.$destroy();\n } else {\n tooltip.unmount();\n if (document.contains(tooltipVNode)) {\n document.body.removeChild(tooltipVNode);\n }\n }\n\n tooltip = undefined;\n};\n\n/**\n * Returns tooltip position based on the specified argument.\n * By default returns 'top' if no argument is specified.\n * @param {BentoTooltipDirectiveBinding} binding Directive binding object.\n * @returns {string} Tooltip position.\n * @internal\n */\nconst getTooltipPosition = (binding: BentoTooltipDirectiveBinding): BentoTooltipPosition =>\n Object.values(BentoTooltipPosition).includes(binding.arg as BentoTooltipPosition)\n ? (binding.arg as BentoTooltipPosition)\n : BentoTooltipPosition.TOP;\n\n/**\n * Get the correct Tooltip instance for the given target element\n * @param {HTMLElement} el the target element for the Tooltip\n * @returns\n */\nconst getTooltipInstanceForTarget = (el: HTMLElement): TooltipInstance =>\n tooltipInstances.find(\n ctx =>\n // isEqualNode doesn't work correct for svg element, hence the second check here\n ctx.target.isEqualNode(el) && ctx.target === el\n );\n\n/**\n * On mouse enter event updates tooltip with correct content and position, and shows tooltip.\n * @param {?HTMLElement} el - Target element\n * @internal\n */\nconst showTooltip = (el?: HTMLElement) => {\n const tooltipInstance = getTooltipInstanceForTarget(el);\n\n // If tooltip content is empty – do not show the tooltip\n if (!tooltipInstance.content || !el) {\n return;\n }\n\n if (el) {\n el.setAttribute(ariaDescribedByAttr, tooltipId);\n }\n\n // If the Tooltip is inside a dialog, move tooltip element inside of it\n // It gets restored to <body> when it gets hidden\n let isDialogOpen = false;\n document.querySelectorAll('dialog').forEach(node => {\n isDialogOpen = node?.open || isDialogOpen;\n });\n\n if (isDialogOpen) {\n if (isVue2) {\n el.after(tooltip.$el);\n // eslint-disable-next-line no-underscore-dangle\n } else if (tooltip?._instance?.vnode?.el) {\n // eslint-disable-next-line no-underscore-dangle\n el.after(tooltip?._instance?.vnode?.el);\n }\n isDialogOpen = false;\n }\n\n open = true;\n\n tooltip.content = tooltipInstance.content;\n tooltip.position = tooltipInstance.position;\n\n tooltipProps.content = tooltipInstance.content;\n tooltipProps.position = tooltipInstance.position;\n\n // Do calculations on a next tick, otherwise tooltip position calculations will be wrong\n nextTick(() => {\n // Do not open tooltip if it has been instructed to hide in process\n if (!open) {\n return;\n }\n tooltip.targetElement = el;\n tooltip.isShown = true;\n\n tooltipProps.targetElement = el;\n tooltipProps.isShown = true;\n });\n};\n\n/**\n * On mouse leave event hides the tooltip.\n * @internal\n */\nconst hideTooltip = (el?: HTMLElement) => {\n // Restore the tooltip element to body if it got move out of <body>\n if (tooltip.$el?.parentElement?.tagName && tooltip.$el?.parentElement?.tagName !== 'BODY') {\n document.body.appendChild(tooltip.$el);\n }\n\n open = false;\n tooltip.isShown = false;\n tooltipProps.isShown = false;\n if (el) {\n el.removeAttribute(ariaDescribedByAttr);\n }\n};\n\nconst tooltipBind = (el: HTMLElement, binding: BentoTooltipDirectiveBinding) => {\n // eslint-disable-next-line no-prototype-builtins\n if (!binding.hasOwnProperty('value') || binding.value) {\n // Create Tooltip component singleton instance\n if (tooltipInstances.length === 0) {\n createTooltip(el);\n }\n\n const show = () => showTooltip(el);\n const hide = () => hideTooltip(el);\n\n // Create and store context object, which has directive related handlers and content.\n const tooltipInstance: TooltipInstance = {\n target: el,\n content: binding.value,\n position: getTooltipPosition(binding),\n removeListeners: [\n listen(el, 'mouseenter', show),\n listen(el, 'mouseleave', hide),\n listen(el, 'focus', show),\n listen(el, 'blur', hide),\n listen(el, 'keydown', evt => {\n const keyboardEvent = <KeyboardEvent>evt;\n if (keyboardEvent.key === EventKey.ESCAPE) {\n hide();\n }\n }),\n ],\n };\n\n tooltipInstances.push(tooltipInstance);\n }\n};\n\nconst tooltipUpdate = (el: HTMLElement, binding: BentoTooltipDirectiveBinding) => {\n const tooltipInstance = getTooltipInstanceForTarget(el);\n if (tooltipInstance) {\n // Update tooltip content value if it is changed\n if (tooltipInstance?.content !== binding.value) {\n tooltipInstance.content = binding.value;\n // If tooltip is currently shown for current element – update tooltip's content value\n if (tooltip.isShown && tooltip.targetElement.isEqualNode(el)) {\n if (!tooltipInstance.content) {\n tooltip.isShown = false;\n } else {\n tooltip.content = binding.value;\n }\n }\n }\n // Update tooltip position if it is changed\n if (tooltipInstance.position !== binding.arg) {\n const position = getTooltipPosition(binding);\n tooltipInstance.position = position;\n tooltip.position = position;\n }\n } else if (!tooltipInstance && binding.value) {\n // If I don't have a tooltip instance yet but the value passed was updated\n tooltipBind(el, binding);\n }\n};\n\nconst tooltipUnbind = (el: HTMLElement) => {\n const context = getTooltipInstanceForTarget(el);\n\n // Prevent unbinding/removing when there's nothing to unbind, leads to stack overflow errors\n if (!context) {\n return;\n }\n\n context.removeListeners.forEach(removeListener => {\n removeListener();\n });\n\n // If el is removed while tooltip is displayed, the tooltip doesnt hide as\n // there is no el to trigger mouseleave/blur.\n hideTooltip();\n\n tooltipInstances.splice(tooltipInstances.indexOf(context), 1);\n\n // If all the elements using the directive are removed, then no point having\n // the component on the page.\n if (tooltipInstances.length === 0) {\n destroyTooltip();\n }\n};\n\n/**\n * This directive allows you to bind a tooltip to an element.\n * Tooltip can be configured to be shown in one of four positions: 'top', 'left', 'right' and 'bottom'.\n *\n * @example\n * import { BentoTooltipDirective as BentoTooltip, BentoTooltipPosition } from '@adyen/bento-vue2';\n *\n * export default {\n * directives: { BentoTooltip },\n * methods: {\n * contentExpression() {\n * return 'tooltip content';\n * },\n * },\n * template: `<div>\n * <div v-bento-tooltip:left=\"refToTooltipContent\"></div>\n * <div v-bento-tooltip:[TooltipPosition.BOTTOM]=\"refToTooltipContent\"></div>\n *\n * <!-- If you don't specify the position then by default it's `TooltipPosition.TOP` -->\n * <div v-bento-tooltip=\"refToTooltipContent\"></div>\n *\n * <!-- Tooltip content can also be a data property or a method or a computed property as well -->\n * <div v-bento-tooltip=\"contentExpression()\"></div>\n * </div>`,\n * };\n */\nexport const BentoTooltipDirective = {\n // Vue 2 Directive hooks\n bind(el, binding) {\n tooltipBind(el, binding);\n },\n update(el, binding) {\n tooltipUpdate(el, binding);\n },\n unbind(el) {\n tooltipUnbind(el);\n },\n // Vue 3 Directive hooks\n beforeMount(el, binding) {\n tooltipBind(el, binding);\n },\n mounted(el, binding) {\n tooltipUpdate(el, binding);\n },\n updated(el, binding) {\n tooltipUpdate(el, binding);\n },\n unmounted(el) {\n tooltipUnbind(el);\n },\n};\n"],"names":["BentoTooltipPosition","PopperContainerPositionBasic","BentoTooltipState","BentoTooltipState2","EventKey","EventKey2","KeyCode","KeyCode2","Tooltip","BentoTypography","PopperContainer","value","props","conditionalClasses","computed","tabIndex","PopperContainerAriaRole","_sfc_main","defineComponent","tooltipInstances","ariaDescribedByAttr","tooltipId","generateUid","tooltip","open","tooltipProps","reactive","createTooltip","el","TooltipComponent","Vue2","BentoTooltip","destroyTooltip","getTooltipPosition","binding","getTooltipInstanceForTarget","ctx","showTooltip","tooltipInstance","isDialogOpen","node","nextTick","hideTooltip","_b","_a","_d","_c","tooltipBind","show","hide","listen","evt","tooltipUpdate","position","tooltipUnbind","context","removeListener","BentoTooltipDirective"],"mappings":";;;;;;;;AAGa,MAAAA,IAAA,EAAA,GAAAC,EAAA;AAGD,IAAAC,IAAA,kBAAAC,OACRA,EAAA,SAAA,UADQA,IAAAD,KAAA,CAAA,CAAA,GCKAE,IAAA,kBAAAC,OACRA,EAAA,SAAA,UACAA,EAAA,QAAA,SACAA,EAAA,aAAA,aACAA,EAAA,WAAA,WACAA,EAAA,cAAA,cACAA,EAAA,aAAA,aACAA,EAAA,UAAA,UACAA,EAAA,YAAA,YACAA,EAAA,MAAA,OACAA,EAAA,OAAA,QAVQA,IAAAD,KAAA,CAAA,CAAA,GAgBAE,IAAA,kBAAAC,OACRA,EAAAA,EAAA,SAAA,EAAA,IAAA,UACAA,EAAAA,EAAA,QAAA,EAAA,IAAA,SACAA,EAAAA,EAAA,aAAA,EAAA,IAAA,cACAA,EAAAA,EAAA,WAAA,EAAA,IAAA,YACAA,EAAAA,EAAA,cAAA,EAAA,IAAA,eACAA,EAAAA,EAAA,aAAA,EAAA,IAAA,cACAA,EAAAA,EAAA,UAAA,EAAA,IAAA,WACAA,EAAAA,EAAA,YAAA,EAAA,IAAA,aACAA,EAAAA,EAAA,MAAA,EAAA,IAAA,OACAA,EAAAA,EAAA,OAAA,EAAA,IAAA,QAVQA,IAAAD,KAAA,CAAA,CAAA;ACIZ,MAAAE,IAAA;AAAA,EAAA,MAAA;AAAA,EACA,YAAA,EAAA,iBAAAC,GAAA,iBAAAC,EAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA,IACA,IAAA,EAAA,MAAA,QAAA,SA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