@adyen/bento-vue2 1.74.0 → 1.76.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 (139) hide show
  1. package/dist/@types/index.d.ts +1693 -616
  2. package/dist/assets/accordion-item.css +1 -1
  3. package/dist/assets/action-bar.css +1 -1
  4. package/dist/assets/base-modal.css +1 -1
  5. package/dist/assets/button-actions.css +1 -1
  6. package/dist/assets/calendar.css +1 -1
  7. package/dist/assets/card.css +1 -1
  8. package/dist/assets/data-grid-template.css +1 -1
  9. package/dist/assets/data-grid.css +1 -1
  10. package/dist/assets/date-picker.css +1 -1
  11. package/dist/assets/date-range-picker.css +1 -1
  12. package/dist/assets/dialog-page.css +1 -1
  13. package/dist/assets/dropdown-tag.css +1 -1
  14. package/dist/assets/file-uploader.css +1 -1
  15. package/dist/assets/filter-bar.css +1 -1
  16. package/dist/assets/header-meta.css +1 -1
  17. package/dist/assets/input-field-password.css +1 -1
  18. package/dist/assets/input-field.css +1 -1
  19. package/dist/assets/inspector.css +1 -1
  20. package/dist/assets/modal-fullscreen.css +1 -1
  21. package/dist/assets/selection-card-group.css +1 -1
  22. package/dist/assets/sidepanel.css +1 -1
  23. package/dist/assets/timeline-item.css +1 -1
  24. package/dist/assets/use-cached-selected-values.css +1 -1
  25. package/dist/checkbox.js +2 -2
  26. package/dist/chunks/calendar.Fm_dfQC5.js +1871 -0
  27. package/dist/chunks/calendar.Fm_dfQC5.js.map +1 -0
  28. package/dist/chunks/{checkbox-group.DETXTJqI.js → checkbox-group.CtNVRcmP.js} +2 -2
  29. package/dist/chunks/{checkbox-group.DETXTJqI.js.map → checkbox-group.CtNVRcmP.js.map} +1 -1
  30. package/dist/chunks/{checkbox.BPtHAAEa.js → checkbox.nyUc0gLb.js} +18 -18
  31. package/dist/chunks/{checkbox.BPtHAAEa.js.map → checkbox.nyUc0gLb.js.map} +1 -1
  32. package/dist/chunks/{code-snippet.VtrsOTEC.js → code-snippet.DFf3KMSi.js} +2 -2
  33. package/dist/chunks/{code-snippet.VtrsOTEC.js.map → code-snippet.DFf3KMSi.js.map} +1 -1
  34. package/dist/chunks/constructNow.CHWWeLPc.js +8 -0
  35. package/dist/chunks/constructNow.CHWWeLPc.js.map +1 -0
  36. package/dist/chunks/{currency.DDB4G_A8.js → currency.AvvbekWO.js} +15 -14
  37. package/dist/chunks/{currency.DDB4G_A8.js.map → currency.AvvbekWO.js.map} +1 -1
  38. package/dist/chunks/{dashboard-section.jIpBvP6X.js → dashboard-section.D1l7wDX3.js} +2 -2
  39. package/dist/chunks/{dashboard-section.jIpBvP6X.js.map → dashboard-section.D1l7wDX3.js.map} +1 -1
  40. package/dist/chunks/{data-grid-template.CozTcWQ0.js → data-grid-template.DGUDqzjj.js} +2 -2
  41. package/dist/chunks/{data-grid-template.CozTcWQ0.js.map → data-grid-template.DGUDqzjj.js.map} +1 -1
  42. package/dist/chunks/{data-grid.DN9xml8y.js → data-grid.B5aCkT0o.js} +1257 -1223
  43. package/dist/chunks/data-grid.B5aCkT0o.js.map +1 -0
  44. package/dist/chunks/{date-picker.DoYYzWcA.js → date-picker.DImAYvoM.js} +14 -14
  45. package/dist/chunks/date-picker.DImAYvoM.js.map +1 -0
  46. package/dist/chunks/date-range-picker.DgZMERzx.js +914 -0
  47. package/dist/chunks/date-range-picker.DgZMERzx.js.map +1 -0
  48. package/dist/chunks/{get-date-locale.CAyOIbcp.js → differenceInMonths.C8FyCrav.js} +580 -364
  49. package/dist/chunks/differenceInMonths.C8FyCrav.js.map +1 -0
  50. package/dist/chunks/dropdown-tag.CpvU8eSZ.js +260 -0
  51. package/dist/chunks/dropdown-tag.CpvU8eSZ.js.map +1 -0
  52. package/dist/chunks/{dropdown.BOvtYKXS.js → dropdown.RxD2TqnP.js} +14 -14
  53. package/dist/chunks/{dropdown.BOvtYKXS.js.map → dropdown.RxD2TqnP.js.map} +1 -1
  54. package/dist/chunks/es6.MoTTyETW.js.map +1 -1
  55. package/dist/chunks/{filter-bar.DzHJi42d.js → filter-bar.C0S87JZD.js} +511 -486
  56. package/dist/chunks/filter-bar.C0S87JZD.js.map +1 -0
  57. package/dist/chunks/getRoundingMethod.C3eaeGLR.js +10 -0
  58. package/dist/chunks/getRoundingMethod.C3eaeGLR.js.map +1 -0
  59. package/dist/chunks/{index.BrH1t1iu.js → getTimezoneOffsetInMilliseconds.BW7U6PxE.js} +254 -177
  60. package/dist/chunks/getTimezoneOffsetInMilliseconds.BW7U6PxE.js.map +1 -0
  61. package/dist/chunks/header-meta.D-6dL1Vg.js +170 -0
  62. package/dist/chunks/header-meta.D-6dL1Vg.js.map +1 -0
  63. package/dist/chunks/{header-with-views.t5Fr63SD.js → header-with-views.j16q5wEc.js} +4 -4
  64. package/dist/chunks/{header-with-views.t5Fr63SD.js.map → header-with-views.j16q5wEc.js.map} +1 -1
  65. package/dist/chunks/{header.DwSyDQ68.js → header.DoWKsA15.js} +2 -2
  66. package/dist/chunks/{header.DwSyDQ68.js.map → header.DoWKsA15.js.map} +1 -1
  67. package/dist/chunks/{input-field-password.Dm3HYonF.js → input-field-password.CSfXqEbT.js} +47 -38
  68. package/dist/chunks/input-field-password.CSfXqEbT.js.map +1 -0
  69. package/dist/chunks/{input-field-phone-number.bZauIuHJ.js → input-field-phone-number.oa4hXQdK.js} +3 -3
  70. package/dist/chunks/{input-field-phone-number.bZauIuHJ.js.map → input-field-phone-number.oa4hXQdK.js.map} +1 -1
  71. package/dist/chunks/input-field.DdQu3b1-.js +161 -0
  72. package/dist/chunks/input-field.DdQu3b1-.js.map +1 -0
  73. package/dist/chunks/{pagination.CKD9FDrA.js → pagination.C0YW_A_o.js} +2 -2
  74. package/dist/chunks/{pagination.CKD9FDrA.js.map → pagination.C0YW_A_o.js.map} +1 -1
  75. package/dist/chunks/radio-group.AcYMFudv.js.map +1 -1
  76. package/dist/chunks/{rich-text-editor.BZgQ578S.js → rich-text-editor.eYW8X_YP.js} +354 -352
  77. package/dist/chunks/{rich-text-editor.BZgQ578S.js.map → rich-text-editor.eYW8X_YP.js.map} +1 -1
  78. package/dist/chunks/{search-bar.c-w7Uky2.js → search-bar.DJVfPz-f.js} +3 -3
  79. package/dist/chunks/{search-bar.c-w7Uky2.js.map → search-bar.DJVfPz-f.js.map} +1 -1
  80. package/dist/chunks/{secondary-nav.D69COlqF.js → secondary-nav.BFiTQaag.js} +2 -2
  81. package/dist/chunks/{secondary-nav.D69COlqF.js.map → secondary-nav.BFiTQaag.js.map} +1 -1
  82. package/dist/chunks/{selection-card-group.8UIir78G.js → selection-card-group.D4rcUyvV.js} +58 -120
  83. package/dist/chunks/{selection-card-group.8UIir78G.js.map → selection-card-group.D4rcUyvV.js.map} +1 -1
  84. package/dist/chunks/textarea.CIQuLWQ8.js.map +1 -1
  85. package/dist/chunks/{timeline-item.VSw9vKdO.js → timeline-item.CZBuknZ_.js} +156 -168
  86. package/dist/chunks/timeline-item.CZBuknZ_.js.map +1 -0
  87. package/dist/chunks/{use-cached-selected-values.IsfhJHxQ.js → use-cached-selected-values.BZd3CTeP.js} +334 -314
  88. package/dist/chunks/use-cached-selected-values.BZd3CTeP.js.map +1 -0
  89. package/dist/code-snippet.js +1 -1
  90. package/dist/currency.js +1 -1
  91. package/dist/dashboard-template.js +1 -1
  92. package/dist/data-grid-template.js +1 -1
  93. package/dist/data-grid.js +1 -1
  94. package/dist/date-picker.js +2 -2
  95. package/dist/date-range-picker.js +2 -2
  96. package/dist/dropdown.js +3 -3
  97. package/dist/filter-bar.js +1 -1
  98. package/dist/header-with-views.js +1 -1
  99. package/dist/header.js +1 -1
  100. package/dist/index.js +221 -220
  101. package/dist/input-field-password.js +1 -1
  102. package/dist/input-field-phone-number.js +1 -1
  103. package/dist/input-field.js +1 -1
  104. package/dist/internal.js +3 -3
  105. package/dist/pagination.js +1 -1
  106. package/dist/rich-text-editor.js +1 -1
  107. package/dist/search-bar.js +2 -2
  108. package/dist/secondary-nav.js +1 -1
  109. package/dist/selection-card.js +1 -1
  110. package/dist/styles/bento-dark.css +7 -5
  111. package/dist/styles/bento-light.css +7 -5
  112. package/dist/styles/bento.css +7 -5
  113. package/dist/styles/legacy.css +7 -5
  114. package/dist/styles/styleguide.css +7 -5
  115. package/dist/timeline.js +1 -1
  116. package/dist/web-types.json +692 -1390
  117. package/package.json +12 -27
  118. package/dist/chunks/_commonjsHelpers.C6fGbg64.js +0 -7
  119. package/dist/chunks/_commonjsHelpers.C6fGbg64.js.map +0 -1
  120. package/dist/chunks/calendar.EfqJlztU.js +0 -2093
  121. package/dist/chunks/calendar.EfqJlztU.js.map +0 -1
  122. package/dist/chunks/data-grid.DN9xml8y.js.map +0 -1
  123. package/dist/chunks/date-picker.DoYYzWcA.js.map +0 -1
  124. package/dist/chunks/date-range-picker.C_pJ8yH5.js +0 -917
  125. package/dist/chunks/date-range-picker.C_pJ8yH5.js.map +0 -1
  126. package/dist/chunks/dropdown-tag.DBnurtCQ.js +0 -245
  127. package/dist/chunks/dropdown-tag.DBnurtCQ.js.map +0 -1
  128. package/dist/chunks/filter-bar.DzHJi42d.js.map +0 -1
  129. package/dist/chunks/get-date-locale.CAyOIbcp.js.map +0 -1
  130. package/dist/chunks/header-meta.uiIO1wHP.js +0 -185
  131. package/dist/chunks/header-meta.uiIO1wHP.js.map +0 -1
  132. package/dist/chunks/index.BrH1t1iu.js.map +0 -1
  133. package/dist/chunks/index.BxBB1rsx.js +0 -15
  134. package/dist/chunks/index.BxBB1rsx.js.map +0 -1
  135. package/dist/chunks/input-field-password.Dm3HYonF.js.map +0 -1
  136. package/dist/chunks/input-field.D52XYEzU.js +0 -157
  137. package/dist/chunks/input-field.D52XYEzU.js.map +0 -1
  138. package/dist/chunks/timeline-item.VSw9vKdO.js.map +0 -1
  139. package/dist/chunks/use-cached-selected-values.IsfhJHxQ.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-picker.DoYYzWcA.js","sources":["../../src/components/date-picker/composables/use-date-picker-single-calendar-text.ts","../../src/components/date-picker/date-picker.types.ts","../../src/components/date-picker/date-picker.vue"],"sourcesContent":["import { computed, ref } from 'vue';\nimport { useI18n } from '@/utils/ts/i18n';\nimport { type UseDateDisplayText } from './use-date-picker-single-calendar-text.types';\nimport { DateFormat } from '@/types/date-format';\nimport { getDateLocale } from '@/utils/ts/get-date-locale/get-date-locale';\nimport format from 'date-fns/format';\nimport startOfMonth from 'date-fns/startOfMonth';\nimport messages from '../messages.json';\n\ntype MessageSchema = (typeof messages)['en-US'];\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 * @param {?Ref<boolean>} option.isMonthVariant Indicates if the date picker has variant \"month\"\n */\nexport const useDatePickerSingleCalendarText: UseDateDisplayText<Date> = ({\n datePickerValue,\n isDateIncorrect,\n isMonthVariant,\n placeholder,\n}) => {\n const { locale, t } = useI18n<{ message: MessageSchema }>({ messages });\n const locales = getDateLocale();\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 placeholder?.value || (t('selectDate') as string);\n }\n\n // Display the date in format \"dd MMM, yyyy (25 Jun, 2023)\" or \"MMMM yyyy (June 2023)\"\n // if there's a valid date selected\n return format(\n datePickerValue.value,\n isMonthVariant?.value ? DateFormat.LONG_MONTH_YEAR : DateFormat.FULL_DATE,\n {\n locale: locales[locale.value?.substring(0, 2)] || locales.enUS,\n }\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 const date = isMonthVariant?.value ? startOfMonth(dateToFormat) : dateToFormat;\n textInputValue.value = dateToFormat\n ? format(date, DateFormat.NUMERIC_DATE_YEAR_FIRST, {\n locale: locales[locale.value?.substring(0, 2)] || locales.enUS,\n })\n : null;\n };\n\n return {\n // Values\n dateDisplayValue,\n textInputValue,\n\n // Methods\n formatTextInputDisplayValue,\n };\n};\n","import type { FormField } from '../../types/form-field';\nimport {\n CalendarFirstDayOfWeek as BentoDatePickerFirstDayOfWeek,\n type CalendarIsDateDisabled as BentoDatePickerIsDateDisabled,\n type CalendarSingleDateValue as BentoDatePickerValue,\n CalendarVariant as BentoDatePickerVariant,\n} from '@/internal';\n\nexport {\n BentoDatePickerFirstDayOfWeek,\n type BentoDatePickerIsDateDisabled,\n type BentoDatePickerValue,\n BentoDatePickerVariant,\n};\n\nexport enum BentoDatePickerEvent {\n INPUT = 'input',\n}\n\nexport interface BentoDatePickerProps extends FormField {\n /**\n * Default start date for the calendar pane.\n * Expected format: YYYY-MM-DD\n * @default null\n */\n defaultDisplayMonth?: string | null;\n\n /**\n * Allows you to set the first day of the week. 0 is sunday, 1 is monday, 6 is saturday\n * @default 1\n */\n firstDayOfWeek?: BentoDatePickerFirstDayOfWeek;\n\n /**\n * Indicate if a date should be disabled or not\n */\n isDateDisabled?: BentoDatePickerIsDateDisabled;\n\n /**\n * Sets a minimum limit for selectable dates - dates before `min` will not be selectable\n * @default null\n */\n min?: Date | null;\n\n /**\n * Sets a maximum limit for selectable dates - dates after `max` will not be selectable\n * @default null\n */\n max?: Date | null;\n\n /**\n * Selected date\n * @default null\n */\n value?: BentoDatePickerValue | null;\n\n /**\n * The type of calendar to display. Defaults to showing days.\n */\n variant?: `${BentoDatePickerVariant}`;\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 <field-label\n v-if=\"label\"\n :id=\"labelId\"\n :label=\"label\"\n :tooltip-text=\"tooltipText\"\n :optional=\"optional\"\n :required=\"required\"\n />\n\n <!-- Input -->\n <div>\n <dropdown-input-default\n ref=\"inputContainerRef\"\n always-combobox-is-input\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 :aria-label=\"popoverAriaLabel\"\n :aria-modal=\"true\"\n position=\"bottom-start\"\n fit-content\n trap-all\n :trap-all-options=\"{\n initialFocus: initialFocusOnDatePickerOpen,\n }\"\n @keydown.esc.native=\"closeDatePicker\"\n >\n <calendar\n ref=\"calendarContainerRef\"\n :default-display-month=\"defaultDisplayMonth\"\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 :variant=\"variant\"\n @input=\"onDateSelected\"\n />\n </bento-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, nextTick, type Ref, ref, toRef, watch } from 'vue';\n import startOfMonth from 'date-fns/startOfMonth';\n\n // Components\n import { BentoPopover } from '@/components/popover';\n import { BentoTypography } from '../typography';\n import { Calendar, ErrorMessage, FieldLabel } from '@/internal';\n import { DropdownInputDefault } from '@/components/dropdown/components';\n\n // Utils\n import { debounce } from '@/utils/ts/debounce';\n import { formatDateInputValue, validateDateInput } from '@/utils/ts/date-input';\n import { generateUid } from '@/core/utils/ts';\n import { useI18n } from '@/utils/ts/i18n';\n\n // Composables\n import { useDatePickerSingleCalendarText } from './composables/use-date-picker-single-calendar-text';\n import { useFormLayoutFieldLoading } from '@/composables';\n\n // Directive\n import { BentoClickOutsideDirective as vBentoClickOutsideDirective } from '@/directives';\n\n // Types\n import { BentoDatePickerEvent, type BentoDatePickerProps } from './date-picker.types';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n const DEBOUNCE_TIME = 1000;\n\n const props = defineProps({\n description: { default: undefined },\n disabled: { type: Boolean, default: false },\n errorMessage: { default: null },\n label: { default: undefined },\n optional: { type: Boolean, default: false },\n placeholder: { default: null },\n readonly: { type: Boolean, default: false },\n required: { type: Boolean, default: false },\n tooltipText: { default: null },\n defaultDisplayMonth: { default: null },\n firstDayOfWeek: { default: 1 },\n isDateDisabled: { default: undefined },\n min: { default: null },\n max: { default: null },\n value: { default: null },\n variant: { default: undefined }\n});\n\n const emit = defineEmits([BentoDatePickerEvent.INPUT]);\n\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 initialFocusOnDatePickerOpen = ref(undefined);\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 isMonthVariant = computed(() => props.variant === 'month');\n\n const { dateDisplayValue, textInputValue, formatTextInputDisplayValue } = useDatePickerSingleCalendarText({\n datePickerValue: toRef(props, 'value') as Ref<Date>,\n isDateIncorrect,\n isMonthVariant,\n placeholder: toRef(props, 'placeholder'),\n });\n\n const dateErrorText = computed(() => {\n if (\n props.isDateDisabled &&\n textInputValue.value &&\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\n // Set initial focus\n initialFocusOnDatePickerOpen.value =\n calendarContainerRef.value?.$refs.calendarRef[0].focusOnDate(\n props.variant === 'month' ? startOfMonth(props.value) : props.value,\n true\n ) ?? undefined;\n };\n</script>\n\n<script lang=\"ts\">\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 {\n i18n: { messages },\n name: 'bento-date-picker',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./date-picker.scss\" />\n"],"names":["useDatePickerSingleCalendarText","datePickerValue","isDateIncorrect","isMonthVariant","placeholder","locale","t","useI18n","locales","getDateLocale","textInputValue","ref","_a","computed","format","DateFormat","dateToFormat","date","startOfMonth","BentoDatePickerEvent","BentoDatePickerEvent2","__default__","messages","DEBOUNCE_TIME","datePickerContainerId","generateUid","labelId","descriptionId","errorId","dateErrorId","popoverAriaLabel","props","calendarContainerRef","inputContainerRef","isDatePickerOpen","initialFocusOnDatePickerOpen","isReadOnly","useFormLayoutFieldLoading","toRef","watch","disabled","dateDisplayValue","formatTextInputDisplayValue","dateErrorText","descriptionConditionalClasses","ariaDescribedBy","isDateEnabled","closeDatePicker","openDatePicker","onDateSelected","selectedDate","emit","clearDatePickerValue","onDateKeyDown","event","validateDateInput","validateDate","stringDate","validateDateDebounced","debounce","formatDateInputValue","nextTick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiBOA,KAAA,CAAA;AAAA,EAAmE,iBAAAC;AAAA,EACtE,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