@adyen/bento-vue2 1.6.1 → 1.7.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 (291) hide show
  1. package/dist/@types/components.d.ts +2 -0
  2. package/dist/@types/packages/core/src/components/button/button.types.d.ts +3 -1
  3. package/dist/@types/packages/vue2/src/components/action-bar/action-bar.vue.d.ts +43 -0
  4. package/dist/@types/packages/vue2/src/components/action-bar/index.d.ts +1 -0
  5. package/dist/@types/packages/vue2/src/components/alert/alert.vue.d.ts +4 -4
  6. package/dist/@types/packages/vue2/src/components/avatar-image/avatar-image.vue.d.ts +1 -1
  7. package/dist/@types/packages/vue2/src/components/button/button.vue.d.ts +290 -281
  8. package/dist/@types/packages/vue2/src/components/button/components/button-actions/button-actions.vue.d.ts +9 -0
  9. package/dist/@types/packages/vue2/src/components/button/components/loading-button/loading-button.vue.d.ts +3 -3
  10. package/dist/@types/packages/vue2/src/components/checkbox/checkbox.vue.d.ts +1 -1
  11. package/dist/@types/packages/vue2/src/components/checkbox/components/checkbox-group/checkbox-group.vue.d.ts +5 -5
  12. package/dist/@types/packages/vue2/src/components/code-snippet/code-snippet.vue.d.ts +1 -1
  13. package/dist/@types/packages/vue2/src/components/country/country.vue.d.ts +4 -3
  14. package/dist/@types/packages/vue2/src/components/data-grid/data-grid.vue.d.ts +53 -70
  15. package/dist/@types/packages/vue2/src/components/date/date.vue.d.ts +1 -1
  16. package/dist/@types/packages/vue2/src/components/date-picker/date-picker.vue.d.ts +20 -2
  17. package/dist/@types/packages/vue2/src/components/date-range-picker/components/date-range-picker-calendar/date-range-picker-calendar.vue.d.ts +18 -0
  18. package/dist/@types/packages/vue2/src/components/date-range-picker/date-range-picker.vue.d.ts +20 -2
  19. package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-base-textbox/dropdown-base-textbox.vue.d.ts +1 -1
  20. package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-default-textbox/dropdown-default-textbox.vue.d.ts +1 -1
  21. package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-options-container/dropdown-options-container.vue.d.ts +45 -27
  22. package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-small-textbox/dropdown-small-textbox.vue.d.ts +1 -1
  23. package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-avatar/dropdown-avatar.vue.d.ts +21 -3
  24. package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-country/dropdown-country.vue.d.ts +24 -6
  25. package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-currency/dropdown-currency.vue.d.ts +21 -3
  26. package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-payment-method/dropdown-payment-method.vue.d.ts +21 -3
  27. package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-tag/dropdown-tag.vue.d.ts +21 -3
  28. package/dist/@types/packages/vue2/src/components/dropdown/dropdown.types.d.ts +2 -0
  29. package/dist/@types/packages/vue2/src/components/dropdown/dropdown.vue.d.ts +22 -4
  30. package/dist/@types/packages/vue2/src/components/empty-state/empty-state.vue.d.ts +5 -2
  31. package/dist/@types/packages/vue2/src/components/filter-bar/components/all-filters-modal/all-filters-modal.vue.d.ts +234 -12
  32. package/dist/@types/packages/vue2/src/components/filter-bar/components/boolean-filter/boolean-filter.vue.d.ts +12 -5
  33. package/dist/@types/packages/vue2/src/components/filter-bar/components/filter-bar-button/filter-bar-button.vue.d.ts +1 -1
  34. package/dist/@types/packages/vue2/src/components/filter-bar/components/select-filter/variants/select-country-filter/select-country-filter.vue.d.ts +2 -1
  35. package/dist/@types/packages/vue2/src/components/filter-bar/components/select-filter/variants/select-tag-filter/select-tag-filter.vue.d.ts +1 -0
  36. package/dist/@types/packages/vue2/src/components/filter-bar/filter-bar.types.d.ts +12 -2
  37. package/dist/@types/packages/vue2/src/components/filter-bar/filter-bar.vue.d.ts +10 -0
  38. package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-field-tip/form-layout-field-tip.vue.d.ts +3 -3
  39. package/dist/@types/packages/vue2/src/components/header/header.vue.d.ts +1 -1
  40. package/dist/@types/packages/vue2/src/components/info-icon/info-icon.vue.d.ts +3 -3
  41. package/dist/@types/packages/vue2/src/components/input-field/input-field.vue.d.ts +1 -1
  42. package/dist/@types/packages/vue2/src/components/internal/button-actions-with-menu/button-actions-with-menu.vue.d.ts +21 -0
  43. package/dist/@types/packages/vue2/src/components/internal/calendar/calendar.vue.d.ts +18 -0
  44. package/dist/@types/packages/vue2/src/components/internal/calendar/components/calendar-month/calendar-month.vue.d.ts +19 -0
  45. package/dist/@types/packages/vue2/src/components/internal/controls-group/controls-group.vue.d.ts +1 -1
  46. package/dist/@types/packages/vue2/src/components/internal/fixed-scroller/fixed-scroller.vue.d.ts +22 -1
  47. package/dist/@types/packages/vue2/src/components/internal/listbox/listbox.vue.d.ts +94 -8
  48. package/dist/@types/packages/vue2/src/components/internal/teleport/index.d.ts +1 -0
  49. package/dist/@types/packages/vue2/src/components/internal/teleport/teleport.vue.d.ts +50 -0
  50. package/dist/@types/packages/vue2/src/components/link/link.vue.d.ts +1 -1
  51. package/dist/@types/packages/vue2/src/components/menu/menu.keys.d.ts +1 -0
  52. package/dist/@types/packages/vue2/src/components/menu/menu.vue.d.ts +15 -11
  53. package/dist/@types/packages/vue2/src/components/pagination/components/pagination-context/pagination-context.vue.d.ts +9 -0
  54. package/dist/@types/packages/vue2/src/components/pagination/pagination.vue.d.ts +9 -0
  55. package/dist/@types/packages/vue2/src/components/payment-method/payment-method.vue.d.ts +1 -0
  56. package/dist/@types/packages/vue2/src/components/popover/popover.vue.d.ts +4 -4
  57. package/dist/@types/packages/vue2/src/components/popper-container/popper-container.vue.d.ts +5 -5
  58. package/dist/@types/packages/vue2/src/components/radio-group/radio-group.vue.d.ts +10 -5
  59. package/dist/@types/packages/vue2/src/components/segmented-control/components/segmented-control-button/segmented-control-button.vue.d.ts +21 -0
  60. package/dist/@types/packages/vue2/src/components/segmented-control/segmented-control.vue.d.ts +21 -5
  61. package/dist/@types/packages/vue2/src/components/stepper/stepper.vue.d.ts +3 -3
  62. package/dist/@types/packages/vue2/src/components/summary-grid/components/summary-grid-item/summary-grid-item.vue.d.ts +1 -2
  63. package/dist/@types/packages/vue2/src/components/summary-grid/components/summary-grid-item-amount/summary-grid-item-amount.vue.d.ts +1 -1
  64. package/dist/@types/packages/vue2/src/components/summary-grid/summary-grid.keys.d.ts +1 -0
  65. package/dist/@types/packages/vue2/src/components/summary-grid/summary-grid.types.d.ts +3 -0
  66. package/dist/@types/packages/vue2/src/components/tabs/components/tab.types.d.ts +1 -0
  67. package/dist/@types/packages/vue2/src/components/tabs/components/tab.vue.d.ts +9 -0
  68. package/dist/@types/packages/vue2/src/components/tabs/tabs.types.d.ts +1 -0
  69. package/dist/@types/packages/vue2/src/components/tabs/tabs.vue.d.ts +2 -0
  70. package/dist/@types/packages/vue2/src/components/textarea/textarea.vue.d.ts +5 -5
  71. package/dist/@types/packages/vue2/src/components/timeline/components/timeline-item/timeline-item.vue.d.ts +6 -3
  72. package/dist/@types/packages/vue2/src/components/timeline/timeline.types.d.ts +9 -2
  73. package/dist/@types/packages/vue2/src/components/tooltip/tooltip.vue.d.ts +13 -13
  74. package/dist/@types/packages/vue2/src/components/tutorial/components/tutorial-popover/components/tutorial-indicator/index.d.ts +1 -0
  75. package/dist/@types/packages/vue2/src/components/tutorial/components/tutorial-popover/components/tutorial-indicator/tutorial-indicator.vue.d.ts +12 -0
  76. package/dist/@types/packages/vue2/src/components/tutorial/components/tutorial-popover/index.d.ts +1 -0
  77. package/dist/@types/packages/vue2/src/components/tutorial/components/tutorial-popover/tutorial-popover.vue.d.ts +226 -0
  78. package/dist/@types/packages/vue2/src/components/tutorial/index.d.ts +2 -0
  79. package/dist/@types/packages/vue2/src/components/tutorial/tutorial.types.d.ts +13 -0
  80. package/dist/@types/packages/vue2/src/components/tutorial/tutorial.vue.d.ts +16 -0
  81. package/dist/@types/packages/vue2/src/composables/index.d.ts +5 -2
  82. package/dist/@types/packages/vue2/src/composables/use-click-outside/use-click-outside.d.ts +3 -0
  83. package/dist/@types/packages/vue2/src/composables/use-form-validate/index.d.ts +2 -0
  84. package/dist/@types/packages/vue2/src/composables/use-form-validate/use-form.d.ts +12 -0
  85. package/dist/@types/packages/vue2/src/composables/use-form-validate/use-form.types.d.ts +5 -0
  86. package/dist/@types/packages/vue2/src/composables/use-virtual-list/index.d.ts +2 -0
  87. package/dist/@types/packages/vue2/src/composables/use-virtual-list/use-virtual-list.d.ts +15 -0
  88. package/dist/@types/packages/vue2/src/composables/use-virtual-list/use-virtual-list.types.d.ts +20 -0
  89. package/dist/@types/packages/vue2/src/index.d.ts +1 -0
  90. package/dist/@types/packages/vue2/src/templates/data-grid-template/data-grid-template.vue.d.ts +2 -2
  91. package/dist/@types/packages/vue2/src/types/listbox.d.ts +12 -0
  92. package/dist/accordion.js +41 -32
  93. package/dist/accordion.js.map +1 -1
  94. package/dist/action-bar.js +191 -0
  95. package/dist/action-bar.js.map +1 -0
  96. package/dist/alert.js +3 -3
  97. package/dist/assets/base-modal.css +1 -1
  98. package/dist/assets/button-actions-with-menu.css +1 -0
  99. package/dist/assets/button.css +1 -1
  100. package/dist/assets/calendar.css +1 -1
  101. package/dist/assets/checkbox.css +1 -1
  102. package/dist/assets/checkmark.css +1 -0
  103. package/dist/assets/chevron-left.css +1 -0
  104. package/dist/assets/dropdown-default-textbox.css +1 -1
  105. package/dist/assets/dropdown.css +1 -1
  106. package/dist/assets/fixed-scroller.css +1 -0
  107. package/dist/assets/index.css +1 -1
  108. package/dist/assets/index10.css +1 -1
  109. package/dist/assets/index11.css +1 -1
  110. package/dist/assets/index12.css +1 -1
  111. package/dist/assets/index13.css +1 -1
  112. package/dist/assets/index14.css +1 -1
  113. package/dist/assets/index15.css +1 -1
  114. package/dist/assets/index16.css +1 -1
  115. package/dist/assets/index17.css +1 -1
  116. package/dist/assets/index18.css +1 -1
  117. package/dist/assets/index19.css +1 -1
  118. package/dist/assets/index2.css +1 -1
  119. package/dist/assets/index20.css +1 -1
  120. package/dist/assets/index21.css +1 -1
  121. package/dist/assets/index22.css +1 -1
  122. package/dist/assets/index23.css +1 -1
  123. package/dist/assets/index24.css +1 -1
  124. package/dist/assets/index25.css +1 -1
  125. package/dist/assets/index26.css +1 -1
  126. package/dist/assets/index27.css +1 -1
  127. package/dist/assets/index28.css +1 -1
  128. package/dist/assets/index29.css +1 -1
  129. package/dist/assets/index3.css +1 -1
  130. package/dist/assets/index30.css +1 -1
  131. package/dist/assets/index31.css +1 -1
  132. package/dist/assets/index32.css +1 -1
  133. package/dist/assets/index33.css +1 -1
  134. package/dist/assets/index34.css +1 -1
  135. package/dist/assets/index35.css +1 -1
  136. package/dist/assets/index36.css +1 -1
  137. package/dist/assets/index37.css +1 -1
  138. package/dist/assets/index39.css +1 -1
  139. package/dist/assets/index4.css +1 -1
  140. package/dist/assets/index40.css +1 -1
  141. package/dist/assets/index41.css +1 -1
  142. package/dist/assets/index42.css +1 -1
  143. package/dist/assets/index43.css +1 -1
  144. package/dist/assets/index44.css +1 -1
  145. package/dist/assets/index45.css +1 -0
  146. package/dist/assets/index5.css +1 -1
  147. package/dist/assets/index6.css +1 -1
  148. package/dist/assets/index7.css +1 -1
  149. package/dist/assets/index8.css +1 -1
  150. package/dist/assets/index9.css +1 -1
  151. package/dist/assets/listbox.css +1 -1
  152. package/dist/assets/refresh.css +1 -0
  153. package/dist/avatar-image.js +1 -1
  154. package/dist/badge.js +1 -1
  155. package/dist/button.js +21 -14
  156. package/dist/button.js.map +1 -1
  157. package/dist/card.js +54 -54
  158. package/dist/card.js.map +1 -1
  159. package/dist/checkbox.js +6 -6
  160. package/dist/chunks/{base-button.d1ba66cd.js → base-button.7886a7e6.js} +2 -2
  161. package/dist/chunks/{base-button.d1ba66cd.js.map → base-button.7886a7e6.js.map} +1 -1
  162. package/dist/chunks/{base-modal.ec74044e.js → base-modal.88e7b9d4.js} +4 -4
  163. package/dist/chunks/{base-modal.ec74044e.js.map → base-modal.88e7b9d4.js.map} +1 -1
  164. package/dist/chunks/button-actions-with-menu.a5413243.js +105 -0
  165. package/dist/chunks/button-actions-with-menu.a5413243.js.map +1 -0
  166. package/dist/chunks/button.e09d5980.js +125 -0
  167. package/dist/chunks/button.e09d5980.js.map +1 -0
  168. package/dist/chunks/{calendar.b74f8a0f.js → calendar.24d0ac04.js} +294 -272
  169. package/dist/chunks/calendar.24d0ac04.js.map +1 -0
  170. package/dist/chunks/{checkbox.96ee3f71.js → checkbox.5343e28e.js} +7 -7
  171. package/dist/chunks/{checkbox.96ee3f71.js.map → checkbox.5343e28e.js.map} +1 -1
  172. package/dist/chunks/checkmark.78f3ed9c.js +26 -0
  173. package/dist/chunks/checkmark.78f3ed9c.js.map +1 -0
  174. package/dist/chunks/{chevron-right.3b826337.js → chevron-left.c10778d3.js} +8 -8
  175. package/dist/chunks/chevron-left.c10778d3.js.map +1 -0
  176. package/dist/chunks/{controls-group.e9537e45.js → controls-group.2a21bd83.js} +2 -2
  177. package/dist/chunks/{controls-group.e9537e45.js.map → controls-group.2a21bd83.js.map} +1 -1
  178. package/dist/chunks/{copy.2ff56819.js → copy.346eadb1.js} +4 -4
  179. package/dist/chunks/{copy.2ff56819.js.map → copy.346eadb1.js.map} +1 -1
  180. package/dist/chunks/{dropdown-default-textbox.3df0bf23.js → dropdown-default-textbox.25134789.js} +4 -4
  181. package/dist/chunks/dropdown-default-textbox.25134789.js.map +1 -0
  182. package/dist/chunks/{dropdown.3f198167.js → dropdown.f1253a54.js} +111 -81
  183. package/dist/chunks/dropdown.f1253a54.js.map +1 -0
  184. package/dist/chunks/{error-message.f5454f19.js → error-message.8302a46c.js} +2 -2
  185. package/dist/chunks/{error-message.f5454f19.js.map → error-message.8302a46c.js.map} +1 -1
  186. package/dist/chunks/fixed-scroller.8994e30a.js +108 -0
  187. package/dist/chunks/fixed-scroller.8994e30a.js.map +1 -0
  188. package/dist/chunks/{footer-actions.00d20947.js → footer-actions.c9b2cb74.js} +3 -3
  189. package/dist/chunks/{footer-actions.00d20947.js.map → footer-actions.c9b2cb74.js.map} +1 -1
  190. package/dist/chunks/{index.c39c64c9.js → index.2625175a.js} +2 -2
  191. package/dist/chunks/{index.c39c64c9.js.map → index.2625175a.js.map} +1 -1
  192. package/dist/chunks/index.37283390.js +475 -0
  193. package/dist/chunks/index.37283390.js.map +1 -0
  194. package/dist/chunks/index.8ac70774.js +1328 -0
  195. package/dist/chunks/index.8ac70774.js.map +1 -0
  196. package/dist/chunks/{index.2fce7703.js → index.965ac1af.js} +2 -2
  197. package/dist/chunks/{index.2fce7703.js.map → index.965ac1af.js.map} +1 -1
  198. package/dist/chunks/{index.eb52e785.js → index.a201f750.js} +6 -5
  199. package/dist/chunks/{index.eb52e785.js.map → index.a201f750.js.map} +1 -1
  200. package/dist/chunks/{index.a709a6b0.js → index.b83f8b7e.js} +2 -2
  201. package/dist/chunks/{index.a709a6b0.js.map → index.b83f8b7e.js.map} +1 -1
  202. package/dist/chunks/{index.298f5eed.js → index.d6b5f5e1.js} +6 -6
  203. package/dist/chunks/{index.298f5eed.js.map → index.d6b5f5e1.js.map} +1 -1
  204. package/dist/chunks/{index.31949c1a.js → index.e566354f.js} +91 -74
  205. package/dist/chunks/index.e566354f.js.map +1 -0
  206. package/dist/chunks/{listbox-option-tag.1362a2d7.js → listbox-option-tag.6a09e8e2.js} +8 -7
  207. package/dist/chunks/{listbox-option-tag.1362a2d7.js.map → listbox-option-tag.6a09e8e2.js.map} +1 -1
  208. package/dist/chunks/{listbox.e7bf46e4.js → listbox.73c38f38.js} +479 -385
  209. package/dist/chunks/listbox.73c38f38.js.map +1 -0
  210. package/dist/chunks/{loading-button.0ad06c99.js → loading-button.c65682d6.js} +2 -2
  211. package/dist/chunks/{loading-button.0ad06c99.js.map → loading-button.c65682d6.js.map} +1 -1
  212. package/dist/chunks/refresh.eb485c6f.js +26 -0
  213. package/dist/chunks/refresh.eb485c6f.js.map +1 -0
  214. package/dist/chunks/summary-grid.keys.1d1028c2.js +5 -0
  215. package/dist/chunks/summary-grid.keys.1d1028c2.js.map +1 -0
  216. package/dist/chunks/{tooltip.68e81e9c.js → tooltip.104e5fac.js} +39 -36
  217. package/dist/chunks/{tooltip.68e81e9c.js.map → tooltip.104e5fac.js.map} +1 -1
  218. package/dist/code-snippet.js +7 -7
  219. package/dist/code-snippet.js.map +1 -1
  220. package/dist/country.js +537 -528
  221. package/dist/country.js.map +1 -1
  222. package/dist/currency.js +1 -1
  223. package/dist/data-grid.js +10 -10
  224. package/dist/data-grid.js.map +1 -1
  225. package/dist/date-picker.js +99 -89
  226. package/dist/date-picker.js.map +1 -1
  227. package/dist/date-range-picker.js +2 -2
  228. package/dist/date.js +1 -1
  229. package/dist/divider.js +1 -1
  230. package/dist/dropdown.js +4 -4
  231. package/dist/empty-state.js +8 -7
  232. package/dist/empty-state.js.map +1 -1
  233. package/dist/filter-bar.js +500 -486
  234. package/dist/filter-bar.js.map +1 -1
  235. package/dist/focus-trap.js +1 -1
  236. package/dist/form-layout.js +2 -2
  237. package/dist/header.js +104 -183
  238. package/dist/header.js.map +1 -1
  239. package/dist/image.js +3 -3
  240. package/dist/index.js +171 -169
  241. package/dist/index.js.map +1 -1
  242. package/dist/info-icon.js +3 -3
  243. package/dist/input-field.js +7 -7
  244. package/dist/internal.js +20 -106
  245. package/dist/internal.js.map +1 -1
  246. package/dist/link.js +2 -2
  247. package/dist/loading-indicator.js +1 -1
  248. package/dist/menu.js +3 -466
  249. package/dist/menu.js.map +1 -1
  250. package/dist/modal.js +3 -3
  251. package/dist/pagination.js +40 -26
  252. package/dist/pagination.js.map +1 -1
  253. package/dist/payment-method.js +33 -26
  254. package/dist/payment-method.js.map +1 -1
  255. package/dist/popover.js +4 -4
  256. package/dist/popper-container.js +6 -1270
  257. package/dist/popper-container.js.map +1 -1
  258. package/dist/radio-group.js +97 -81
  259. package/dist/radio-group.js.map +1 -1
  260. package/dist/search-bar.js +2 -2
  261. package/dist/segmented-control.js +100 -70
  262. package/dist/segmented-control.js.map +1 -1
  263. package/dist/sidepanel.js +53 -51
  264. package/dist/sidepanel.js.map +1 -1
  265. package/dist/status.js +2 -2
  266. package/dist/stepper.js +3 -3
  267. package/dist/structured-list.js +1 -1
  268. package/dist/summary-grid.js +109 -119
  269. package/dist/summary-grid.js.map +1 -1
  270. package/dist/tabs.js +81 -71
  271. package/dist/tabs.js.map +1 -1
  272. package/dist/tag.js +3 -3
  273. package/dist/textarea.js +4 -4
  274. package/dist/timeline.js +170 -162
  275. package/dist/timeline.js.map +1 -1
  276. package/dist/toast.js +3 -3
  277. package/dist/toggle.js +6 -6
  278. package/dist/tutorial.js +307 -0
  279. package/dist/tutorial.js.map +1 -0
  280. package/dist/typography.js +1 -1
  281. package/dist/web-types.json +828 -122
  282. package/package.json +7 -4
  283. package/dist/assets/chevron-right.css +0 -1
  284. package/dist/chunks/button.eb60d460.js +0 -117
  285. package/dist/chunks/button.eb60d460.js.map +0 -1
  286. package/dist/chunks/calendar.b74f8a0f.js.map +0 -1
  287. package/dist/chunks/chevron-right.3b826337.js.map +0 -1
  288. package/dist/chunks/dropdown-default-textbox.3df0bf23.js.map +0 -1
  289. package/dist/chunks/dropdown.3f198167.js.map +0 -1
  290. package/dist/chunks/index.31949c1a.js.map +0 -1
  291. package/dist/chunks/listbox.e7bf46e4.js.map +0 -1
@@ -1,37 +1,39 @@
1
- import { ref as u, computed as p, defineComponent as q, toRef as x, watch as L, nextTick as E } from "vue";
2
- import { c as Y } from "./chunks/dropdown-default-textbox.3df0bf23.js";
3
- import { BentoPopover as W } from "./popover.js";
4
- import { g as d } from "./chunks/unique-id.a2a2b458.js";
5
- import { B as $ } from "./chunks/index.2fce7703.js";
6
- import { u as B } from "./chunks/i18n.155748d6.js";
7
- import { f as O } from "./chunks/index.a709a6b0.js";
8
- import { e as y, d as K, f as j } from "./chunks/index.f55fdc32.js";
9
- import { D as T, v as z, f as G } from "./chunks/date-input.9186a0bf.js";
10
- import { d as H } from "./chunks/debounce.b5ef6acf.js";
11
- import { u as J } from "./chunks/use-form-layout-loading.d03e5d48.js";
12
- import { a as k } from "./chunks/calendar.b74f8a0f.js";
13
- import { C as Be } from "./chunks/calendar.b74f8a0f.js";
14
- import { E as Q } from "./chunks/error-message.f5454f19.js";
15
- import { B as X } from "./chunks/directive.0408e565.js";
16
- import { n as Z } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
17
- import "./assets/index31.css";
18
- var l = /* @__PURE__ */ ((a) => (a.INPUT = "input", a))(l || {});
19
- const ee = ({ datePickerValue: a, isDateIncorrect: e }) => {
20
- const { locale: t, t: n } = B(), f = { de: K, enUS: y, fr: j }, s = u(null);
1
+ import { ref as f, computed as m, defineComponent as L, toRef as E, watch as Y, nextTick as O } from "vue";
2
+ import { c as W } from "./chunks/dropdown-default-textbox.25134789.js";
3
+ import { BentoPopover as $ } from "./popover.js";
4
+ import { g as u } from "./chunks/unique-id.a2a2b458.js";
5
+ import { B as K } from "./chunks/index.965ac1af.js";
6
+ import { u as S } from "./chunks/i18n.155748d6.js";
7
+ import { f as T } from "./chunks/index.b83f8b7e.js";
8
+ import { e as g, d as j, f as z } from "./chunks/index.f55fdc32.js";
9
+ import { D as B, v as G, f as H } from "./chunks/date-input.9186a0bf.js";
10
+ import { d as J } from "./chunks/debounce.b5ef6acf.js";
11
+ import { u as Q } from "./chunks/use-form-layout-loading.d03e5d48.js";
12
+ import "./chunks/index.af05ced4.js";
13
+ import { C as p } from "./chunks/calendar.24d0ac04.js";
14
+ import { b as Re } from "./chunks/calendar.24d0ac04.js";
15
+ import { E as X } from "./chunks/error-message.8302a46c.js";
16
+ import { B as Z } from "./chunks/directive.0408e565.js";
17
+ import { n as ee } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
18
+ import "./assets/index18.css";
19
+ var o = /* @__PURE__ */ ((a) => (a.INPUT = "input", a))(o || {});
20
+ const ae = ({ datePickerValue: a, isDateIncorrect: e }) => {
21
+ var v;
22
+ const { locale: t, t: n } = S(), D = { de: j, enUS: g, fr: z }, s = f((v = a.value) == null ? void 0 : v.toDateString());
21
23
  return {
22
24
  // Values
23
- dateDisplayValue: p(() => e.value ? s.value : a.value ? O(a.value, T.FULL_DATE, {
24
- locale: f[t.value.substring(0, 2)] || y
25
+ dateDisplayValue: m(() => e.value ? s.value : a.value ? T(a.value, B.FULL_DATE, {
26
+ locale: D[t.value.substring(0, 2)] || g
25
27
  }) : n("selectDate")),
26
28
  textInputValue: s,
27
29
  // Methods
28
- formatTextInputDisplayValue: (D = a.value) => {
29
- e.value || (s.value = D ? O(D, T.NUMERIC_DATE_YEAR_FIRST, {
30
- locale: f[t.value.substring(0, 2)] || y
30
+ formatTextInputDisplayValue: (c = a.value) => {
31
+ e.value || (s.value = c ? T(c, B.NUMERIC_DATE_YEAR_FIRST, {
32
+ locale: D[t.value.substring(0, 2)] || g
31
33
  }) : null);
32
34
  }
33
35
  };
34
- }, ae = {
36
+ }, te = {
35
37
  "en-US": {
36
38
  optional: "optional",
37
39
  required: "required",
@@ -41,17 +43,17 @@ const ee = ({ datePickerValue: a, isDateIncorrect: e }) => {
41
43
  selectedDateIsNotAvailable: "Selected date is not available",
42
44
  datePicker: "Date picker"
43
45
  }
44
- }, te = 1e3, re = q({
45
- i18n: { messages: ae },
46
+ }, re = 1e3, ne = L({
47
+ i18n: { messages: te },
46
48
  name: "bento-date-picker",
47
49
  components: {
48
- BentoTypography: $,
49
- BentoPopover: W,
50
- Calendar: k,
51
- ErrorMessage: Q,
52
- DropdownInputDefault: Y
50
+ BentoTypography: K,
51
+ BentoPopover: $,
52
+ Calendar: p,
53
+ ErrorMessage: X,
54
+ DropdownInputDefault: W
53
55
  },
54
- directives: { BentoClickOutsideDirective: X },
56
+ directives: { BentoClickOutsideDirective: Z },
55
57
  props: {
56
58
  /**
57
59
  * Descriptive supporting text visbile underneath the dropdown.
@@ -68,11 +70,19 @@ const ee = ({ datePickerValue: a, isDateIncorrect: e }) => {
68
70
  /**
69
71
  * Allows you to set the first day of the week. 0 is sunday, 1 is monday, 6 is saturday
70
72
  */
71
- firstDayOfWeek: k.props.firstDayOfWeek,
73
+ firstDayOfWeek: p.props.firstDayOfWeek,
72
74
  /**
73
75
  * Indicate if a date should be disabled or not
74
76
  */
75
- isDateDisabled: k.props.isDateDisabled,
77
+ isDateDisabled: p.props.isDateDisabled,
78
+ /**
79
+ * Sets a minimum limit for selectable dates - dates before `min` will not be selectable
80
+ */
81
+ min: p.props.min,
82
+ /**
83
+ * Sets a maximum limit for selectable dates - dates after `max` will not be selectable
84
+ */
85
+ max: p.props.max,
76
86
  /**
77
87
  * Text that is displayed as a label above the element.
78
88
  */
@@ -94,94 +104,94 @@ const ee = ({ datePickerValue: a, isDateIncorrect: e }) => {
94
104
  */
95
105
  value: { type: [Date, Object], default: null }
96
106
  },
97
- emits: [l.INPUT],
107
+ emits: [o.INPUT],
98
108
  setup(a, { emit: e }) {
99
- const { t } = B(), n = d("bento-date-picker-container"), f = d("bento-date-picker-label"), s = d("bento-date-picker-description"), m = d("bento-date-picker-error"), v = d("bento-date-picker-date-error"), D = p(() => a.label || t("datePicker", { name: n })), g = u(null), R = u(null), o = u(!1), i = u(!1), { isReadOnly: S } = J(x(a, "readonly"));
100
- L(
109
+ const { t } = S(), n = u("bento-date-picker-container"), D = u("bento-date-picker-label"), s = u("bento-date-picker-description"), b = u("bento-date-picker-error"), _ = u("bento-date-picker-date-error"), v = m(() => a.label || t("datePicker", { name: n })), c = f(null), R = f(null), i = f(!1), l = f(!1), { isReadOnly: w } = Q(E(a, "readonly"));
110
+ Y(
101
111
  () => a.disabled,
102
112
  (r) => {
103
- r && i.value && (i.value = !1);
113
+ r && l.value && (l.value = !1);
104
114
  }
105
115
  );
106
- const { dateDisplayValue: w, textInputValue: c, formatTextInputDisplayValue: I } = ee({
107
- datePickerValue: x(a, "value"),
108
- isDateIncorrect: o
109
- }), b = p(() => a.isDateDisabled && a.isDateDisabled(new Date(c.value)) ? t("selectedDateIsNotAvailable") : o.value ? t("provideDateInAFormat") : null), V = p(() => ({
110
- "b-date-picker__description--error": a.errorMessage || b.value
111
- })), U = p(
112
- () => `${a.description ? s : ""} ${a.errorMessage ? m : ""} ${b.value ? v : ""}`.trim() || null
113
- ), h = (r) => a.isDateDisabled ? !a.isDateDisabled(r) : !0, C = () => {
114
- i.value = !1;
115
- }, P = () => {
116
- i.value = !0, I();
117
- }, N = (r) => {
118
- o.value = !1, C(), e(l.INPUT, r);
119
- }, M = async () => {
120
- o.value && (o.value = !1, c.value = null), e(l.INPUT, null);
121
- }, A = (r) => {
122
- z(r);
123
- }, F = H((r) => {
116
+ const { dateDisplayValue: U, textInputValue: d, formatTextInputDisplayValue: I } = ae({
117
+ datePickerValue: E(a, "value"),
118
+ isDateIncorrect: i
119
+ }), y = m(() => a.isDateDisabled && a.isDateDisabled(new Date(d.value)) && !l.value ? t("selectedDateIsNotAvailable") : i.value ? t("provideDateInAFormat") : null), V = m(() => ({
120
+ "b-date-picker__description--error": a.errorMessage || y.value
121
+ })), h = m(
122
+ () => `${a.description ? s : ""} ${a.errorMessage ? b : ""} ${y.value ? _ : ""}`.trim() || null
123
+ ), N = (r) => a.min && r <= a.min || a.max && r >= a.max ? !1 : a.isDateDisabled ? !a.isDateDisabled(r) : !0, C = () => {
124
+ l.value = !1;
125
+ }, x = () => {
126
+ l.value = !0, I();
127
+ }, M = (r) => {
128
+ i.value = !1, C(), e(o.INPUT, r);
129
+ }, A = async () => {
130
+ i.value && (i.value = !1, d.value = null), e(o.INPUT, null);
131
+ }, F = (r) => {
132
+ G(r);
133
+ }, P = (r) => {
124
134
  if (r.length < 10)
125
135
  return;
126
- /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/.test(r) && h(new Date(r)) ? (o.value = !1, e(l.INPUT, new Date(r))) : r && (o.value = !0, e(l.INPUT, null));
127
- }, te);
136
+ /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/.test(r) && N(new Date(r)) ? (i.value = !1, e(o.INPUT, new Date(r))) : r && (i.value = !0, e(o.INPUT, null));
137
+ }, q = J(P, re);
128
138
  return {
129
139
  // Refs
130
140
  inputContainerRef: R,
131
- calendarContainerRef: g,
141
+ calendarContainerRef: c,
132
142
  // Values,
133
- dateDisplayValue: w,
143
+ dateDisplayValue: U,
134
144
  datePickerContainerId: n,
135
145
  descriptionConditionalClasses: V,
136
- isDateIncorrect: o,
137
- isDatePickerOpen: i,
138
- isReadOnly: S,
139
- dateErrorText: b,
140
- labelId: f,
146
+ isDateIncorrect: i,
147
+ isDatePickerOpen: l,
148
+ isReadOnly: w,
149
+ dateErrorText: y,
150
+ labelId: D,
141
151
  descriptionId: s,
142
- errorId: m,
143
- dateErrorId: v,
144
- popoverAriaLabel: D,
145
- ariaDescribedBy: U,
146
- textInputValue: c,
152
+ errorId: b,
153
+ dateErrorId: _,
154
+ popoverAriaLabel: v,
155
+ ariaDescribedBy: h,
156
+ textInputValue: d,
147
157
  // Events
148
158
  closeDatePicker: C,
149
- clearDatePickerValue: M,
150
- onDateSelected: N,
151
- openDatePicker: P,
152
- onDateKeyDown: A,
159
+ clearDatePickerValue: A,
160
+ onDateSelected: M,
161
+ openDatePicker: x,
162
+ onDateKeyDown: F,
153
163
  onDateInputChange: (r) => {
154
- c.value = G(r), F(c.value);
164
+ d.value = H(r), l.value ? q(d.value) : P(d.value);
155
165
  },
156
166
  // Keyboard navigation
157
167
  onSpaceBarOrEnter: async (r) => {
158
- var _;
159
- i.value || (r.preventDefault(), P(), await E(), a.value || (I(/* @__PURE__ */ new Date()), e(l.INPUT, /* @__PURE__ */ new Date()), await E()), (_ = g.value) == null || _.$refs.calendarRef[0].focusOnDate(a.value));
168
+ var k;
169
+ l.value || (r.preventDefault(), x(), await O(), a.value || (I(/* @__PURE__ */ new Date()), e(o.INPUT, /* @__PURE__ */ new Date()), await O()), (k = c.value) == null || k.$refs.calendarRef[0].focusOnDate(a.value));
160
170
  }
161
171
  };
162
172
  }
163
173
  });
164
- var ne = function() {
174
+ var ie = function() {
165
175
  var e = this, t = e._self._c;
166
176
  return e._self._setupProxy, t("div", { directives: [{ name: "bento-click-outside-directive", rawName: "v-bento-click-outside-directive", value: e.closeDatePicker, expression: "closeDatePicker" }], staticClass: "b-date-picker", on: { "!keydown": [function(n) {
167
177
  return !n.type.indexOf("key") && e._k(n.keyCode, "space", 32, n.key, [" ", "Spacebar"]) ? null : e.onSpaceBarOrEnter.apply(null, arguments);
168
178
  }, function(n) {
169
179
  return !n.type.indexOf("key") && e._k(n.keyCode, "enter", 13, n.key, "Enter") ? null : e.onSpaceBarOrEnter.apply(null, arguments);
170
- }] } }, [e.label ? t("div", { staticClass: "b-date-picker__label", attrs: { id: e.labelId } }, [t("bento-typography", { attrs: { el: "span", stronger: "" } }, [e._v(e._s(e.label))]), e.optional ? t("bento-typography", { staticClass: "b-date-picker__label-requirement", attrs: { el: "span" } }, [e._v(" (" + e._s(e.$t("optional")) + ") ")]) : e._e(), e.required ? t("bento-typography", { staticClass: "b-date-picker__label-requirement", attrs: { el: "span" } }, [e._v(" (" + e._s(e.$t("required")) + ") ")]) : e._e()], 1) : e._e(), t("div", [t("dropdown-input-default", { ref: "inputContainerRef", attrs: { ariaControls: e.datePickerContainerId, ariaExpanded: e.isDatePickerOpen, "aria-labelledby": e.label ? e.labelId : null, "aria-describedby": e.ariaDescribedBy, disabled: e.disabled, "dynamic-filtering": "", "is-invalid": !!e.errorMessage || !!e.dateErrorText, open: e.isDatePickerOpen, value: e.textInputValue, "display-value": e.dateDisplayValue, "debounce-time": 0, readonly: e.isReadOnly }, on: { input: e.onDateInputChange, open: e.openDatePicker, keydown: e.onDateKeyDown, clear: e.clearDatePickerValue, close: e.closeDatePicker } })], 1), e.dateErrorText ? t("error-message", { staticClass: "b-date-picker__error-message", attrs: { id: e.dateErrorId, "error-message": e.dateErrorText } }) : e._e(), e.errorMessage ? t("error-message", { staticClass: "b-date-picker__error-message", attrs: { id: e.errorId, "error-message": e.errorMessage } }) : e._e(), e.description ? t("bento-typography", { staticClass: "b-date-picker__description", class: e.descriptionConditionalClasses, attrs: { el: "span" } }, [e._v(" " + e._s(e.description) + " ")]) : e._e(), e.inputContainerRef ? t("bento-popover", { staticClass: "b-date-picker__container", attrs: { id: e.datePickerContainerId, role: "dialog", open: e.isDatePickerOpen, "target-element": e.inputContainerRef, "disable-focus-trap": !0, "aria-label": e.popoverAriaLabel, "aria-modal": !0, position: "bottom-start", "fit-content": "" } }, [t("calendar", { ref: "calendarContainerRef", attrs: { "first-day-of-week": e.firstDayOfWeek, "is-date-disabled": e.isDateDisabled, "number-of-months": 1, value: e.value }, on: { input: e.onDateSelected } })], 1) : e._e()], 1);
171
- }, oe = [], le = /* @__PURE__ */ Z(
172
- re,
180
+ }] } }, [e.label ? t("div", { staticClass: "b-date-picker__label", attrs: { id: e.labelId } }, [t("bento-typography", { attrs: { el: "span", stronger: "" } }, [e._v(e._s(e.label))]), e.optional ? t("bento-typography", { staticClass: "b-date-picker__label-requirement", attrs: { el: "span" } }, [e._v(" (" + e._s(e.$t("optional")) + ") ")]) : e._e(), e.required ? t("bento-typography", { staticClass: "b-date-picker__label-requirement", attrs: { el: "span" } }, [e._v(" (" + e._s(e.$t("required")) + ") ")]) : e._e()], 1) : e._e(), t("div", [t("dropdown-input-default", { ref: "inputContainerRef", attrs: { ariaControls: e.datePickerContainerId, ariaExpanded: e.isDatePickerOpen, "aria-labelledby": e.label ? e.labelId : null, "aria-describedby": e.ariaDescribedBy, disabled: e.disabled, "dynamic-filtering": "", "is-invalid": !!e.errorMessage || !!e.dateErrorText, open: e.isDatePickerOpen, value: e.textInputValue, "display-value": e.dateDisplayValue, "debounce-time": 0, readonly: e.isReadOnly }, on: { input: e.onDateInputChange, open: e.openDatePicker, keydown: e.onDateKeyDown, clear: e.clearDatePickerValue, close: e.closeDatePicker } })], 1), e.dateErrorText ? t("error-message", { staticClass: "b-date-picker__error-message", attrs: { id: e.dateErrorId, "error-message": e.dateErrorText } }) : e._e(), e.errorMessage ? t("error-message", { staticClass: "b-date-picker__error-message", attrs: { id: e.errorId, "error-message": e.errorMessage } }) : e._e(), e.description ? t("bento-typography", { staticClass: "b-date-picker__description", class: e.descriptionConditionalClasses, attrs: { el: "span" } }, [e._v(" " + e._s(e.description) + " ")]) : e._e(), e.inputContainerRef ? t("bento-popover", { staticClass: "b-date-picker__container", attrs: { id: e.datePickerContainerId, role: "dialog", open: e.isDatePickerOpen, "target-element": e.inputContainerRef, "disable-focus-trap": !0, "aria-label": e.popoverAriaLabel, "aria-modal": !0, position: "bottom-start", "fit-content": "" } }, [t("calendar", { ref: "calendarContainerRef", attrs: { "first-day-of-week": e.firstDayOfWeek, "is-date-disabled": e.isDateDisabled, "number-of-months": 1, value: e.value, min: e.min, max: e.max }, on: { input: e.onDateSelected } })], 1) : e._e()], 1);
181
+ }, le = [], oe = /* @__PURE__ */ ee(
173
182
  ne,
174
- oe,
183
+ ie,
184
+ le,
175
185
  !1,
176
186
  null,
177
- "6ac76f3e",
187
+ "a1f787f7",
178
188
  null,
179
189
  null
180
190
  );
181
- const xe = le.exports;
191
+ const Oe = oe.exports;
182
192
  export {
183
- xe as BentoDatePicker,
184
- l as BentoDatePickerEvent,
185
- Be as BentoDatePickerFirstDayOfWeek
193
+ Oe as BentoDatePicker,
194
+ o as BentoDatePickerEvent,
195
+ Re as BentoDatePickerFirstDayOfWeek
186
196
  };
187
197
  //# sourceMappingURL=date-picker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.js","sources":["../src/components/date-picker/date-picker.types.ts","../src/components/date-picker/composables/use-date-picker-single-calendar-text.ts","../src/components/date-picker/date-picker.vue"],"sourcesContent":["export { CalendarFirstDayOfWeek as BentoDatePickerFirstDayOfWeek } from '@/internal';\nexport type {\n CalendarIsDateDisabled as BentoDatePickerIsDateDisabled,\n CalendarSingleDateValue as BentoDatePickerValue,\n} from '@/internal';\n\nexport enum BentoDatePickerEvent {\n INPUT = 'input',\n}\n","import { computed, ref } from 'vue';\nimport { de, enUS, fr } from 'date-fns/locale';\nimport { useI18n } from '@/utils/ts/i18n';\nimport { UseDateDisplayText } from './use-date-picker-single-calendar-text.types';\nimport { DateFormat } from '@/types';\nimport format from 'date-fns/format';\n\n/**\n * Composable that sets and formats the date to be displayed in the input box of a Single Date Picker\n * @param {Ref<Date>} option.datePickerValue Ref to the datePickerValue set in the DatePicker component\n * @param {Ref<boolean>} option.isDateIncorrect Indicates if the date is correct or not\n */\nexport const useDatePickerSingleCalendarText: UseDateDisplayText<Date> = ({ datePickerValue, isDateIncorrect }) => {\n const { locale, t } = useI18n();\n const locales = { de, enUS, fr };\n\n const textInputValue = ref(null);\n\n const dateDisplayValue = computed(() => {\n // Display incorrect date when there's an error with the input\n if (isDateIncorrect.value) {\n return textInputValue.value;\n }\n\n // Display \"Select a date\" when there's no date selected or input\n if (!datePickerValue.value) {\n return t('selectDate') as string;\n }\n\n // Display the date in format \"dd MMM, yyyy (25 Jun, 2023)\" if there's a valid date selected\n return format(datePickerValue.value as Date, DateFormat.FULL_DATE, {\n locale: locales[locale.value.substring(0, 2)] || enUS,\n });\n });\n\n /**\n * Formats the \"dateToFormat\" date value with the yyyy-MM-dd format and sets it as \"formatTextInputDisplayValue\" value\n * @param {DATE} dateToFormat - Date to be assigned and formatted\n */\n const formatTextInputDisplayValue = (dateToFormat: Date = datePickerValue.value) => {\n // If date is incorrect, leave the textInputValue intact\n if (isDateIncorrect.value) {\n return;\n }\n\n textInputValue.value = dateToFormat\n ? format(dateToFormat, DateFormat.NUMERIC_DATE_YEAR_FIRST, {\n locale: locales[locale.value.substring(0, 2)] || enUS,\n })\n : null;\n };\n\n return {\n // Values\n dateDisplayValue,\n textInputValue,\n\n // Methods\n formatTextInputDisplayValue,\n };\n};\n","<!-- TODO: Remove aria props as these are part of JSX elements /vue/types/jsx.d.ts -->\n<!-- eslint-disable vue/attribute-hyphenation -->\n<template>\n <div\n v-bento-click-outside-directive=\"closeDatePicker\"\n class=\"b-date-picker\"\n @keydown.space.capture=\"onSpaceBarOrEnter\"\n @keydown.enter.capture=\"onSpaceBarOrEnter\"\n >\n <!-- Label -->\n <div v-if=\"label\" :id=\"labelId\" class=\"b-date-picker__label\">\n <bento-typography el=\"span\" stronger>{{ label }}</bento-typography>\n <bento-typography v-if=\"optional\" class=\"b-date-picker__label-requirement\" el=\"span\">\n ({{ $t('optional') }})\n </bento-typography>\n <bento-typography v-if=\"required\" class=\"b-date-picker__label-requirement\" el=\"span\">\n ({{ $t('required') }})\n </bento-typography>\n </div>\n\n <!-- Input -->\n <div>\n <dropdown-input-default\n ref=\"inputContainerRef\"\n :ariaControls=\"datePickerContainerId\"\n :ariaExpanded=\"isDatePickerOpen\"\n :aria-labelledby=\"label ? labelId : null\"\n :aria-describedby=\"ariaDescribedBy\"\n :disabled=\"disabled\"\n dynamic-filtering\n :is-invalid=\"!!errorMessage || !!dateErrorText\"\n :open=\"isDatePickerOpen\"\n :value=\"textInputValue\"\n :display-value=\"dateDisplayValue\"\n :debounce-time=\"0\"\n :readonly=\"isReadOnly\"\n @input=\"onDateInputChange\"\n @open=\"openDatePicker\"\n @keydown=\"onDateKeyDown\"\n @clear=\"clearDatePickerValue\"\n @close=\"closeDatePicker\"\n />\n </div>\n\n <!-- Error Messages -->\n <error-message\n v-if=\"dateErrorText\"\n :id=\"dateErrorId\"\n :error-message=\"dateErrorText\"\n class=\"b-date-picker__error-message\"\n />\n <error-message\n v-if=\"errorMessage\"\n :id=\"errorId\"\n :error-message=\"errorMessage\"\n class=\"b-date-picker__error-message\"\n />\n\n <!-- Description -->\n <bento-typography\n v-if=\"description\"\n class=\"b-date-picker__description\"\n :class=\"descriptionConditionalClasses\"\n el=\"span\"\n >\n {{ description }}\n </bento-typography>\n\n <!-- Calendar container -->\n <bento-popover\n v-if=\"inputContainerRef\"\n :id=\"datePickerContainerId\"\n class=\"b-date-picker__container\"\n role=\"dialog\"\n :open=\"isDatePickerOpen\"\n :target-element=\"inputContainerRef\"\n :disable-focus-trap=\"true\"\n :aria-label=\"popoverAriaLabel\"\n :aria-modal=\"true\"\n position=\"bottom-start\"\n fit-content\n >\n <calendar\n ref=\"calendarContainerRef\"\n :first-day-of-week=\"firstDayOfWeek\"\n :is-date-disabled=\"isDateDisabled\"\n :number-of-months=\"1\"\n :value=\"value\"\n @input=\"onDateSelected\"\n />\n </bento-popover>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, nextTick, PropType, Ref, ref, toRef, watch } from 'vue';\n import { BentoClickOutsideDirective } from '@/directives';\n import { BentoDatePickerEvent, BentoDatePickerValue } from './date-picker.types';\n import { Calendar, ErrorMessage } from '@/internal';\n import { DropdownInputDefault } from '@/components/dropdown/components';\n import { BentoPopover } from '@/components/popover';\n import { generateUid } from '@/utils/ts/unique-id';\n import { BentoTypography } from '../typography';\n import { useDatePickerSingleCalendarText } from './composables/use-date-picker-single-calendar-text';\n import { formatDateInputValue, validateDateInput } from '@/utils/ts/date-input';\n import { useI18n } from '@/utils/ts/i18n';\n import { debounce } from '@/utils/ts/debounce';\n import { useFormLayoutFieldLoading } from '@/composables';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n const DEBOUNCE_TIME = 1000;\n\n /**\n * Date picker selector.\n *\n * @example\n * import { BentoDatePicker } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoDatePicker },\n * template: `\n * <bento-date-picker\n * label=\"Label\"\n * description=\"Supporting text\"\n * required\n * optional\n * disabled\n * @input=\"onDateChanged\"\n * v-model=\"selectedDate\"\n * />\n * `,\n * setup() {\n * const selectedDate = ref(new Date()); // reactive({ startDate: new Date(), endDate: new Date() })\n * return {\n * selectedDate,\n * }\n * }\n * }\n */\n export default defineComponent({\n i18n: { messages },\n name: 'bento-date-picker',\n components: {\n BentoTypography,\n BentoPopover,\n Calendar,\n ErrorMessage,\n DropdownInputDefault,\n },\n directives: { BentoClickOutsideDirective },\n props: {\n /**\n * Descriptive supporting text visbile underneath the dropdown.\n */\n description: { type: String, default: undefined },\n\n /**\n * Disables dropdown functionality.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Displays component in an error state with an error message\n */\n errorMessage: { type: String, default: null },\n\n /**\n * Allows you to set the first day of the week. 0 is sunday, 1 is monday, 6 is saturday\n */\n firstDayOfWeek: Calendar.props.firstDayOfWeek,\n\n /**\n * Indicate if a date should be disabled or not\n */\n isDateDisabled: Calendar.props.isDateDisabled,\n\n /**\n * Text that is displayed as a label above the element.\n */\n label: { type: String, default: undefined },\n\n /**\n * Highlights the dropdown is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * The Boolean readonly property, when present, makes the element not mutable, meaning the user can not edit the date picker.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Highlights the dropdown is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Selected date\n */\n value: { type: [Date, Object] as PropType<BentoDatePickerValue>, default: null },\n },\n emits: [BentoDatePickerEvent.INPUT],\n setup(props, { emit }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const datePickerContainerId = generateUid('bento-date-picker-container');\n const labelId = generateUid('bento-date-picker-label');\n const descriptionId = generateUid('bento-date-picker-description');\n const errorId = generateUid('bento-date-picker-error');\n const dateErrorId = generateUid('bento-date-picker-date-error');\n const popoverAriaLabel = computed(() => props.label || t('datePicker', { name: datePickerContainerId }));\n\n // Refs\n const calendarContainerRef = ref(null);\n const inputContainerRef = ref(null);\n\n // Values\n const isDateIncorrect = ref(false);\n const isDatePickerOpen = ref(false);\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n watch(\n () => props.disabled,\n disabled => {\n // Close date picker popover if it's opened when it's disabled\n if (disabled && isDatePickerOpen.value) {\n isDatePickerOpen.value = false;\n }\n }\n );\n\n const { dateDisplayValue, textInputValue, formatTextInputDisplayValue } = useDatePickerSingleCalendarText({\n datePickerValue: toRef(props, 'value') as Ref<Date>,\n isDateIncorrect,\n });\n\n const dateErrorText = computed(() => {\n if (props.isDateDisabled && props.isDateDisabled(new Date(textInputValue.value))) {\n return t('selectedDateIsNotAvailable');\n }\n\n return isDateIncorrect.value ? t('provideDateInAFormat') : null;\n });\n\n const descriptionConditionalClasses = computed(() => ({\n 'b-date-picker__description--error': props.errorMessage || dateErrorText.value,\n }));\n\n const ariaDescribedBy = computed(\n () =>\n `${props.description ? descriptionId : ''} ${props.errorMessage ? errorId : ''} ${\n dateErrorText.value ? dateErrorId : ''\n }`.trim() || null\n );\n\n const isDateEnabled = (date: Date) => {\n // Check if function is set, otherwise all dates are enabled\n if (props.isDateDisabled) {\n return !props.isDateDisabled(date);\n }\n\n return true;\n };\n\n const closeDatePicker = () => {\n isDatePickerOpen.value = false;\n };\n\n const openDatePicker = () => {\n isDatePickerOpen.value = true;\n\n formatTextInputDisplayValue();\n };\n\n const onDateSelected = (selectedDate: Date) => {\n // Reset the error state when a valid date is selected\n isDateIncorrect.value = false;\n\n closeDatePicker();\n emit(BentoDatePickerEvent.INPUT, selectedDate);\n };\n\n const clearDatePickerValue = async () => {\n if (isDateIncorrect.value) {\n isDateIncorrect.value = false;\n textInputValue.value = null;\n }\n emit(BentoDatePickerEvent.INPUT, null);\n };\n\n const onDateKeyDown = (event: KeyboardEvent) => {\n validateDateInput(event);\n };\n\n const validateDate = debounce((stringDate: string) => {\n // Validate only if the date is complete\n if (stringDate.length < 10) {\n return;\n }\n\n // Checks for YYYY-MM-DD format\n const dateRegex = /^\\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/;\n const isValidDate = dateRegex.test(stringDate) && isDateEnabled(new Date(stringDate));\n if (isValidDate) {\n isDateIncorrect.value = false;\n emit(BentoDatePickerEvent.INPUT, new Date(stringDate));\n } else if (stringDate) {\n // Only set to true if the value exists (not null/undefined)\n isDateIncorrect.value = true;\n emit(BentoDatePickerEvent.INPUT, null);\n }\n }, DEBOUNCE_TIME);\n\n const onDateInputChange = (stringDate: string) => {\n textInputValue.value = formatDateInputValue(stringDate);\n validateDate(textInputValue.value);\n };\n\n /**\n * Space bar and Enter keyDown event handler.\n *\n * * Opens the date picker dialog on the first keydown.\n * * Move focus to selected date, i.e., the date displayed in the date input text field. If no date has been selected, places focus on the current date.\n * @param {KeyboardEvent} event Event being triggered\n */\n const onSpaceBarOrEnter = async (event: KeyboardEvent) => {\n if (isDatePickerOpen.value) {\n return;\n }\n event.preventDefault();\n\n openDatePicker();\n\n // Wait for the date picker dialog to open\n await nextTick();\n\n // Set current date (today) if no date is selected\n if (!props.value) {\n // Format the opened date picker date to YYYY-MM-DD\n formatTextInputDisplayValue(new Date());\n emit(BentoDatePickerEvent.INPUT, new Date());\n\n // Wait for new value to be set with the emit\n await nextTick();\n }\n\n // Focus on date\n calendarContainerRef.value?.$refs.calendarRef[0].focusOnDate(props.value);\n };\n\n return {\n // Refs\n inputContainerRef,\n calendarContainerRef,\n\n // Values,\n dateDisplayValue,\n datePickerContainerId,\n descriptionConditionalClasses,\n isDateIncorrect,\n isDatePickerOpen,\n isReadOnly,\n dateErrorText,\n labelId,\n descriptionId,\n errorId,\n dateErrorId,\n popoverAriaLabel,\n ariaDescribedBy,\n textInputValue,\n\n // Events\n closeDatePicker,\n clearDatePickerValue,\n onDateSelected,\n openDatePicker,\n onDateKeyDown,\n onDateInputChange,\n\n // Keyboard navigation\n onSpaceBarOrEnter,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./date-picker.scss\" />\n"],"names":["BentoDatePickerEvent","BentoDatePickerEvent2","useDatePickerSingleCalendarText","datePickerValue","isDateIncorrect","locale","t","useI18n","locales","de","enUS","fr","textInputValue","ref","computed","format","DateFormat","dateToFormat","DEBOUNCE_TIME","_sfc_main","defineComponent","messages","BentoTypography","BentoPopover","Calendar","ErrorMessage","DropdownInputDefault","BentoClickOutsideDirective","props","emit","datePickerContainerId","generateUid","labelId","descriptionId","errorId","dateErrorId","popoverAriaLabel","calendarContainerRef","inputContainerRef","isDatePickerOpen","isReadOnly","useFormLayoutFieldLoading","toRef","watch","disabled","dateDisplayValue","formatTextInputDisplayValue","dateErrorText","descriptionConditionalClasses","ariaDescribedBy","isDateEnabled","date","closeDatePicker","openDatePicker","onDateSelected","selectedDate","clearDatePickerValue","onDateKeyDown","event","validateDateInput","validateDate","debounce","stringDate","formatDateInputValue","nextTick","_a"],"mappings":";;;;;;;;;;;;;;;;;AAMY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,QAAA,SADQA,IAAAD,KAAA,CAAA,CAAA;ACML,MAAAE,KAAA,CAAA,EAAA,iBAAAC,GAAA,iBAAAC,EAAA,MAAA;AACH,QAAA,EAAA,QAAAC,GAAA,GAAAC,EAAA,IAAAC,EAAA,GACAC,IAAA,EAAA,IAAAC,GAAA,MAAAC,GAAA,IAAAC,EAAA,GAEAC,IAAAC,EAAA,IAAA;AAoCA,SAAA;AAAA;AAAA,IAAO,kBAlCPC,EAAA,MAEIV,EAAA,QACIQ,EAAA,QAIJT,EAAA,QAKAY,EAAAZ,EAAA,OAAAa,EAAA,WAAA;AAAA,MAAmE,QAAAR,EAAAH,EAAA,MAAA,UAAA,GAAA,CAAA,CAAA,KAAAK;AAAA,IACd,CAAA,IALjDJ,EAAA,YAAA,CAMH;AAAA,IAsBD,gBAAAM;AAAA;AAAA,IACA,6BAhBJ,CAAAK,IAAAd,EAAA,UAAA;AAEI,MAAAC,EAAA,UAIAQ,EAAA,QAAAK,IAAAF,EAAAE,GAAAD,EAAA,yBAAA;AAAA,QAC+D,QAAAR,EAAAH,EAAA,MAAA,UAAA,GAAA,CAAA,CAAA,KAAAK;AAAA,MACJ,CAAA,IAAA;AAAA,IAErD;AAAA,EASN;AAER;;;;;;;;;;GCoDAQ,KAAA,KA6BAC,KAAAC,EAAA;AAAA,EAAA,MAAA,EAAA,UAAAC,GAAA;AAAA,EACA,MAAA;AAAA,EACA,YAAA;AAAA,IACA,iBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,sBAAAC;AAAA,EACA;AAAA,EACA,YAAA,EAAA,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AAA,CAAA,KAAAZ,EAAA,IAAA,KAAAY,CAAA,CAAA,KAEA1D,EAAA,QAAA,IACAyB,EAAA7B,EAAA,OAAA,IAAA,KAAA8D,CAAA,CAAA,KAAAA,MAGA1D,EAAA,QAAA,IACAyB,EAAA7B,EAAA,OAAA,IAAA;AAAA,IACA,GAAAkB,EAAA;AAwCA,WAAA;AAAA;AAAA,MAAA,mBAAAoB;AAAA,MAEA,sBAAAD;AAAA;AAAA,MACA,kBAAAQ;AAAA,MAGA,uBAAAf;AAAA,MACA,+BAAAkB;AAAA,MACA,iBAAA5C;AAAA,MACA,kBAAAmC;AAAA,MACA,YAAAC;AAAA,MACA,eAAAO;AAAA,MACA,SAAAf;AAAA,MACA,eAAAC;AAAA,MACA,SAAAC;AAAA,MACA,aAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,iBAAAa;AAAA,MACA,gBAAArC;AAAA;AAAA,MACA,iBAAAwC;AAAA,MAGA,sBAAAI;AAAA,MACA,gBAAAF;AAAA,MACA,gBAAAD;AAAA,MACA,eAAAI;AAAA,MACA,mBA/DA,CAAAK,MAAA;AACA,QAAAlD,EAAA,QAAAmD,EAAAD,CAAA,GACAF,EAAAhD,EAAA,KAAA;AAAA,MAAA;AAAA;AAAA,MA8DA,mBApDA,OAAA8C,MAAA;;AACA,QAAAnB,EAAA,UAGAmB,EAAA,eAAA,GAEAL,EAAA,GAGA,MAAAW,EAAA,GAGApC,EAAA,UAEAkB,EAAA,oBAAA,KAAA,CAAA,GACAjB,EAAA7B,EAAA,OAAA,oBAAA,KAAA,CAAA,GAGA,MAAAgE,EAAA,KAIAC,IAAA5B,EAAA,UAAA,QAAA4B,EAAA,MAAA,YAAA,GAAA,YAAArC,EAAA;AAAA,MAAA;AAAA,IAiCA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"date-picker.js","sources":["../src/components/date-picker/date-picker.types.ts","../src/components/date-picker/composables/use-date-picker-single-calendar-text.ts","../src/components/date-picker/date-picker.vue"],"sourcesContent":["export { CalendarFirstDayOfWeek as BentoDatePickerFirstDayOfWeek } from '@/internal';\nexport type {\n CalendarIsDateDisabled as BentoDatePickerIsDateDisabled,\n CalendarSingleDateValue as BentoDatePickerValue,\n} from '@/internal';\n\nexport enum BentoDatePickerEvent {\n INPUT = 'input',\n}\n","import { computed, ref } from 'vue';\nimport { de, enUS, fr } from 'date-fns/locale';\nimport { useI18n } from '@/utils/ts/i18n';\nimport { UseDateDisplayText } from './use-date-picker-single-calendar-text.types';\nimport { DateFormat } from '@/types';\nimport format from 'date-fns/format';\n\n/**\n * Composable that sets and formats the date to be displayed in the input box of a Single Date Picker\n * @param {Ref<Date>} option.datePickerValue Ref to the datePickerValue set in the DatePicker component\n * @param {Ref<boolean>} option.isDateIncorrect Indicates if the date is correct or not\n */\nexport const useDatePickerSingleCalendarText: UseDateDisplayText<Date> = ({ datePickerValue, isDateIncorrect }) => {\n const { locale, t } = useI18n();\n const locales = { de, enUS, fr };\n\n const textInputValue = ref(datePickerValue.value?.toDateString());\n\n const dateDisplayValue = computed(() => {\n // Display incorrect date when there's an error with the input\n if (isDateIncorrect.value) {\n return textInputValue.value;\n }\n\n // Display \"Select a date\" when there's no date selected or input\n if (!datePickerValue.value) {\n return t('selectDate') as string;\n }\n\n // Display the date in format \"dd MMM, yyyy (25 Jun, 2023)\" if there's a valid date selected\n return format(datePickerValue.value as Date, DateFormat.FULL_DATE, {\n locale: locales[locale.value.substring(0, 2)] || enUS,\n });\n });\n\n /**\n * Formats the \"dateToFormat\" date value with the yyyy-MM-dd format and sets it as \"formatTextInputDisplayValue\" value\n * @param {DATE} dateToFormat - Date to be assigned and formatted\n */\n const formatTextInputDisplayValue = (dateToFormat: Date = datePickerValue.value) => {\n // If date is incorrect, leave the textInputValue intact\n if (isDateIncorrect.value) {\n return;\n }\n\n textInputValue.value = dateToFormat\n ? format(dateToFormat, DateFormat.NUMERIC_DATE_YEAR_FIRST, {\n locale: locales[locale.value.substring(0, 2)] || enUS,\n })\n : null;\n };\n\n return {\n // Values\n dateDisplayValue,\n textInputValue,\n\n // Methods\n formatTextInputDisplayValue,\n };\n};\n","<!-- TODO: Remove aria props as these are part of JSX elements /vue/types/jsx.d.ts -->\n<!-- eslint-disable vue/attribute-hyphenation -->\n<template>\n <div\n v-bento-click-outside-directive=\"closeDatePicker\"\n class=\"b-date-picker\"\n @keydown.space.capture=\"onSpaceBarOrEnter\"\n @keydown.enter.capture=\"onSpaceBarOrEnter\"\n >\n <!-- Label -->\n <div v-if=\"label\" :id=\"labelId\" class=\"b-date-picker__label\">\n <bento-typography el=\"span\" stronger>{{ label }}</bento-typography>\n <bento-typography v-if=\"optional\" class=\"b-date-picker__label-requirement\" el=\"span\">\n ({{ $t('optional') }})\n </bento-typography>\n <bento-typography v-if=\"required\" class=\"b-date-picker__label-requirement\" el=\"span\">\n ({{ $t('required') }})\n </bento-typography>\n </div>\n\n <!-- Input -->\n <div>\n <dropdown-input-default\n ref=\"inputContainerRef\"\n :ariaControls=\"datePickerContainerId\"\n :ariaExpanded=\"isDatePickerOpen\"\n :aria-labelledby=\"label ? labelId : null\"\n :aria-describedby=\"ariaDescribedBy\"\n :disabled=\"disabled\"\n dynamic-filtering\n :is-invalid=\"!!errorMessage || !!dateErrorText\"\n :open=\"isDatePickerOpen\"\n :value=\"textInputValue\"\n :display-value=\"dateDisplayValue\"\n :debounce-time=\"0\"\n :readonly=\"isReadOnly\"\n @input=\"onDateInputChange\"\n @open=\"openDatePicker\"\n @keydown=\"onDateKeyDown\"\n @clear=\"clearDatePickerValue\"\n @close=\"closeDatePicker\"\n />\n </div>\n\n <!-- Error Messages -->\n <error-message\n v-if=\"dateErrorText\"\n :id=\"dateErrorId\"\n :error-message=\"dateErrorText\"\n class=\"b-date-picker__error-message\"\n />\n <error-message\n v-if=\"errorMessage\"\n :id=\"errorId\"\n :error-message=\"errorMessage\"\n class=\"b-date-picker__error-message\"\n />\n\n <!-- Description -->\n <bento-typography\n v-if=\"description\"\n class=\"b-date-picker__description\"\n :class=\"descriptionConditionalClasses\"\n el=\"span\"\n >\n {{ description }}\n </bento-typography>\n\n <!-- Calendar container -->\n <bento-popover\n v-if=\"inputContainerRef\"\n :id=\"datePickerContainerId\"\n class=\"b-date-picker__container\"\n role=\"dialog\"\n :open=\"isDatePickerOpen\"\n :target-element=\"inputContainerRef\"\n :disable-focus-trap=\"true\"\n :aria-label=\"popoverAriaLabel\"\n :aria-modal=\"true\"\n position=\"bottom-start\"\n fit-content\n >\n <calendar\n ref=\"calendarContainerRef\"\n :first-day-of-week=\"firstDayOfWeek\"\n :is-date-disabled=\"isDateDisabled\"\n :number-of-months=\"1\"\n :value=\"value\"\n :min=\"min\"\n :max=\"max\"\n @input=\"onDateSelected\"\n />\n </bento-popover>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, nextTick, PropType, Ref, ref, toRef, watch } from 'vue';\n import { BentoClickOutsideDirective } from '@/directives';\n import { BentoDatePickerEvent, BentoDatePickerValue } from './date-picker.types';\n import { Calendar, ErrorMessage } from '@/internal';\n import { DropdownInputDefault } from '@/components/dropdown/components';\n import { BentoPopover } from '@/components/popover';\n import { generateUid } from '@/utils/ts/unique-id';\n import { BentoTypography } from '../typography';\n import { useDatePickerSingleCalendarText } from './composables/use-date-picker-single-calendar-text';\n import { formatDateInputValue, validateDateInput } from '@/utils/ts/date-input';\n import { useI18n } from '@/utils/ts/i18n';\n import { debounce } from '@/utils/ts/debounce';\n import { useFormLayoutFieldLoading } from '@/composables';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n const DEBOUNCE_TIME = 1000;\n\n /**\n * Date picker selector.\n *\n * @example\n * import { BentoDatePicker } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoDatePicker },\n * template: `\n * <bento-date-picker\n * label=\"Label\"\n * description=\"Supporting text\"\n * required\n * optional\n * disabled\n * @input=\"onDateChanged\"\n * v-model=\"selectedDate\"\n * />\n * `,\n * setup() {\n * const selectedDate = ref(new Date()); // reactive({ startDate: new Date(), endDate: new Date() })\n * return {\n * selectedDate,\n * }\n * }\n * }\n */\n export default defineComponent({\n i18n: { messages },\n name: 'bento-date-picker',\n components: {\n BentoTypography,\n BentoPopover,\n Calendar,\n ErrorMessage,\n DropdownInputDefault,\n },\n directives: { BentoClickOutsideDirective },\n props: {\n /**\n * Descriptive supporting text visbile underneath the dropdown.\n */\n description: { type: String, default: undefined },\n\n /**\n * Disables dropdown functionality.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Displays component in an error state with an error message\n */\n errorMessage: { type: String, default: null },\n\n /**\n * Allows you to set the first day of the week. 0 is sunday, 1 is monday, 6 is saturday\n */\n firstDayOfWeek: Calendar.props.firstDayOfWeek,\n\n /**\n * Indicate if a date should be disabled or not\n */\n isDateDisabled: Calendar.props.isDateDisabled,\n\n /**\n * Sets a minimum limit for selectable dates - dates before `min` will not be selectable\n */\n min: Calendar.props.min,\n\n /**\n * Sets a maximum limit for selectable dates - dates after `max` will not be selectable\n */\n max: Calendar.props.max,\n\n /**\n * Text that is displayed as a label above the element.\n */\n label: { type: String, default: undefined },\n\n /**\n * Highlights the dropdown is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * The Boolean readonly property, when present, makes the element not mutable, meaning the user can not edit the date picker.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Highlights the dropdown is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Selected date\n */\n value: { type: [Date, Object] as PropType<BentoDatePickerValue>, default: null },\n },\n emits: [BentoDatePickerEvent.INPUT],\n setup(props, { emit }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const datePickerContainerId = generateUid('bento-date-picker-container');\n const labelId = generateUid('bento-date-picker-label');\n const descriptionId = generateUid('bento-date-picker-description');\n const errorId = generateUid('bento-date-picker-error');\n const dateErrorId = generateUid('bento-date-picker-date-error');\n const popoverAriaLabel = computed(() => props.label || t('datePicker', { name: datePickerContainerId }));\n\n // Refs\n const calendarContainerRef = ref(null);\n const inputContainerRef = ref(null);\n\n // Values\n const isDateIncorrect = ref(false);\n const isDatePickerOpen = ref(false);\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n watch(\n () => props.disabled,\n disabled => {\n // Close date picker popover if it's opened when it's disabled\n if (disabled && isDatePickerOpen.value) {\n isDatePickerOpen.value = false;\n }\n }\n );\n\n const { dateDisplayValue, textInputValue, formatTextInputDisplayValue } = useDatePickerSingleCalendarText({\n datePickerValue: toRef(props, 'value') as Ref<Date>,\n isDateIncorrect,\n });\n\n const dateErrorText = computed(() => {\n if (\n props.isDateDisabled &&\n props.isDateDisabled(new Date(textInputValue.value)) &&\n !isDatePickerOpen.value\n ) {\n return t('selectedDateIsNotAvailable');\n }\n\n return isDateIncorrect.value ? t('provideDateInAFormat') : null;\n });\n\n const descriptionConditionalClasses = computed(() => ({\n 'b-date-picker__description--error': props.errorMessage || dateErrorText.value,\n }));\n\n const ariaDescribedBy = computed(\n () =>\n `${props.description ? descriptionId : ''} ${props.errorMessage ? errorId : ''} ${\n dateErrorText.value ? dateErrorId : ''\n }`.trim() || null\n );\n\n const isDateEnabled = (date: Date) => {\n // Check if date is between min/max bounds, if there are any\n if ((props.min && date <= props.min) || (props.max && date >= props.max)) {\n return false;\n }\n\n // Check if function is set, otherwise all dates are enabled\n if (props.isDateDisabled) {\n return !props.isDateDisabled(date);\n }\n\n return true;\n };\n\n const closeDatePicker = () => {\n isDatePickerOpen.value = false;\n };\n\n const openDatePicker = () => {\n isDatePickerOpen.value = true;\n\n formatTextInputDisplayValue();\n };\n\n const onDateSelected = (selectedDate: Date) => {\n // Reset the error state when a valid date is selected\n isDateIncorrect.value = false;\n\n closeDatePicker();\n emit(BentoDatePickerEvent.INPUT, selectedDate);\n };\n\n const clearDatePickerValue = async () => {\n if (isDateIncorrect.value) {\n isDateIncorrect.value = false;\n textInputValue.value = null;\n }\n emit(BentoDatePickerEvent.INPUT, null);\n };\n\n const onDateKeyDown = (event: KeyboardEvent) => {\n validateDateInput(event);\n };\n\n const validateDate = (stringDate: string) => {\n // Validate only if the date is complete\n if (stringDate.length < 10) {\n return;\n }\n\n // Checks for YYYY-MM-DD format\n const dateRegex = /^\\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/;\n const isValidDate = dateRegex.test(stringDate) && isDateEnabled(new Date(stringDate));\n if (isValidDate) {\n isDateIncorrect.value = false;\n emit(BentoDatePickerEvent.INPUT, new Date(stringDate));\n } else if (stringDate) {\n // Only set to true if the value exists (not null/undefined)\n isDateIncorrect.value = true;\n emit(BentoDatePickerEvent.INPUT, null);\n }\n };\n\n const validateDateDebounced = debounce(validateDate, DEBOUNCE_TIME);\n\n const onDateInputChange = (stringDate: string) => {\n textInputValue.value = formatDateInputValue(stringDate);\n // If we are closing the date picker, we should validate (and emit date inputs) immediately so the user doesn't have to wait for the debounce time.\n if (isDatePickerOpen.value) {\n validateDateDebounced(textInputValue.value);\n } else {\n validateDate(textInputValue.value);\n }\n };\n\n /**\n * Space bar and Enter keyDown event handler.\n *\n * * Opens the date picker dialog on the first keydown.\n * * Move focus to selected date, i.e., the date displayed in the date input text field. If no date has been selected, places focus on the current date.\n * @param {KeyboardEvent} event Event being triggered\n */\n const onSpaceBarOrEnter = async (event: KeyboardEvent) => {\n if (isDatePickerOpen.value) {\n return;\n }\n event.preventDefault();\n\n openDatePicker();\n\n // Wait for the date picker dialog to open\n await nextTick();\n\n // Set current date (today) if no date is selected\n if (!props.value) {\n // Format the opened date picker date to YYYY-MM-DD\n formatTextInputDisplayValue(new Date());\n emit(BentoDatePickerEvent.INPUT, new Date());\n\n // Wait for new value to be set with the emit\n await nextTick();\n }\n\n // Focus on date\n calendarContainerRef.value?.$refs.calendarRef[0].focusOnDate(props.value);\n };\n\n return {\n // Refs\n inputContainerRef,\n calendarContainerRef,\n\n // Values,\n dateDisplayValue,\n datePickerContainerId,\n descriptionConditionalClasses,\n isDateIncorrect,\n isDatePickerOpen,\n isReadOnly,\n dateErrorText,\n labelId,\n descriptionId,\n errorId,\n dateErrorId,\n popoverAriaLabel,\n ariaDescribedBy,\n textInputValue,\n\n // Events\n closeDatePicker,\n clearDatePickerValue,\n onDateSelected,\n openDatePicker,\n onDateKeyDown,\n onDateInputChange,\n\n // Keyboard navigation\n onSpaceBarOrEnter,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./date-picker.scss\" />\n"],"names":["BentoDatePickerEvent","BentoDatePickerEvent2","useDatePickerSingleCalendarText","datePickerValue","isDateIncorrect","locale","t","useI18n","locales","de","enUS","fr","textInputValue","ref","_a","computed","format","DateFormat","dateToFormat","DEBOUNCE_TIME","_sfc_main","defineComponent","messages","BentoTypography","BentoPopover","Calendar","ErrorMessage","DropdownInputDefault","BentoClickOutsideDirective","props","emit","datePickerContainerId","generateUid","labelId","descriptionId","errorId","dateErrorId","popoverAriaLabel","calendarContainerRef","inputContainerRef","isDatePickerOpen","isReadOnly","useFormLayoutFieldLoading","toRef","watch","disabled","dateDisplayValue","formatTextInputDisplayValue","dateErrorText","descriptionConditionalClasses","ariaDescribedBy","isDateEnabled","date","closeDatePicker","openDatePicker","onDateSelected","selectedDate","clearDatePickerValue","onDateKeyDown","event","validateDateInput","validateDate","stringDate","validateDateDebounced","debounce","formatDateInputValue","nextTick"],"mappings":";;;;;;;;;;;;;;;;;;AAMY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,QAAA,SADQA,IAAAD,KAAA,CAAA,CAAA;ACML,MAAAE,KAAA,CAAA,EAAA,iBAAAC,GAAA,iBAAAC,EAAA,MAAA;;AACH,QAAA,EAAA,QAAAC,GAAA,GAAAC,EAAA,IAAAC,EAAA,GACAC,IAAA,EAAA,IAAAC,GAAA,MAAAC,GAAA,IAAAC,EAAA,GAEAC,IAAAC,GAAAC,IAAAX,EAAA,UAAA,gBAAAW,EAAA,cAAA;AAoCA,SAAA;AAAA;AAAA,IAAO,kBAlCPC,EAAA,MAEIX,EAAA,Q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,MACA,+BAAAkB;AAAA,MACA,iBAAA7C;AAAA,MACA,kBAAAoC;AAAA,MACA,YAAAC;AAAA,MACA,eAAAO;AAAA,MACA,SAAAf;AAAA,MACA,eAAAC;AAAA,MACA,SAAAC;AAAA,MACA,aAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,iBAAAa;AAAA,MACA,gBAAAtC;AAAA;AAAA,MACA,iBAAAyC;AAAA,MAGA,sBAAAI;AAAA,MACA,gBAAAF;AAAA,MACA,gBAAAD;AAAA,MACA,eAAAI;AAAA,MACA,mBApEA,CAAAI,MAAA;AACA,QAAAlD,EAAA,QAAAqD,EAAAH,CAAA,GAEAtB,EAAA,QACAuB,EAAAnD,EAAA,KAAA,IAEAiD,EAAAjD,EAAA,KAAA;AAAA,MACA;AAAA;AAAA,MA8DA,mBApDA,OAAA+C,MAAA;;AACA,QAAAnB,EAAA,UAGAmB,EAAA,eAAA,GAEAL,EAAA,GAGA,MAAAY,EAAA,GAGArC,EAAA,UAEAkB,EAAA,oBAAA,KAAA,CAAA,GACAjB,EAAA9B,EAAA,OAAA,oBAAA,KAAA,CAAA,GAGA,MAAAkE,EAAA,KAIApD,IAAAwB,EAAA,UAAA,QAAAxB,EAAA,MAAA,YAAA,GAAA,YAAAe,EAAA;AAAA,MAAA;AAAA,IAiCA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
- import { B as t, a as r } from "./chunks/index.31949c1a.js";
2
- import { C as o } from "./chunks/calendar.b74f8a0f.js";
1
+ import { B as t, a as r } from "./chunks/index.e566354f.js";
2
+ import { b as o } from "./chunks/calendar.24d0ac04.js";
3
3
  export {
4
4
  t as BentoDateRangePicker,
5
5
  r as BentoDateRangePickerEvent,
package/dist/date.js CHANGED
@@ -1,4 +1,4 @@
1
- import { B as e, a as o } from "./chunks/index.a709a6b0.js";
1
+ import { B as e, a as o } from "./chunks/index.b83f8b7e.js";
2
2
  export {
3
3
  e as BentoDate,
4
4
  o as BentoDateFormat
package/dist/divider.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as i, computed as n } from "vue";
2
2
  import { n as s } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
3
- import "./assets/index28.css";
3
+ import "./assets/index20.css";
4
4
  const _ = i({
5
5
  name: "bento-divider",
6
6
  setup(a, { attrs: e }) {
package/dist/dropdown.js CHANGED
@@ -1,12 +1,12 @@
1
- import { B as s } from "./chunks/dropdown.3f198167.js";
1
+ import { B as s } from "./chunks/dropdown.f1253a54.js";
2
2
  import { defineComponent as u, computed as l, toRefs as m, provide as f } from "vue";
3
- import { B as y, L as c } from "./chunks/listbox-option-tag.1362a2d7.js";
3
+ import { B as y, L as c } from "./chunks/listbox-option-tag.6a09e8e2.js";
4
4
  import { n as d } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
5
5
  import { BentoCountry as v, BentoCountryVariant as _ } from "./country.js";
6
6
  import { u as w } from "./chunks/useCountryItems.5d7b436e.js";
7
- import { d as b } from "./chunks/index.2fce7703.js";
7
+ import { d as b } from "./chunks/index.965ac1af.js";
8
8
  import { BentoPaymentMethod as I } from "./payment-method.js";
9
- import "./assets/index34.css";
9
+ import "./assets/index23.css";
10
10
  const $ = u({
11
11
  name: "bento-dropdown-avatar",
12
12
  components: {