@adyen/bento-vue3 1.98.0 → 1.99.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 (74) hide show
  1. package/dist/assets/accordion-item.css +1 -1
  2. package/dist/assets/action-bar.css +1 -1
  3. package/dist/assets/base-modal.css +1 -1
  4. package/dist/assets/button-actions.css +1 -1
  5. package/dist/assets/card.css +1 -1
  6. package/dist/assets/data-grid.css +1 -1
  7. package/dist/assets/dialog-page.css +1 -1
  8. package/dist/assets/dropdown.css +1 -1
  9. package/dist/assets/file-uploader.css +1 -1
  10. package/dist/assets/filter-bar.css +1 -1
  11. package/dist/assets/inspector.css +1 -1
  12. package/dist/assets/modal-fullscreen.css +1 -1
  13. package/dist/assets/navigation-menu-group.css +1 -1
  14. package/dist/assets/secondary-nav.css +1 -1
  15. package/dist/assets/sidepanel.css +1 -1
  16. package/dist/assets/summary-grid.css +1 -1
  17. package/dist/chunks/{calendar.D0RdoofE.js → calendar.B0XfOj2I.js} +2 -2
  18. package/dist/chunks/{calendar.D0RdoofE.js.map → calendar.B0XfOj2I.js.map} +1 -1
  19. package/dist/chunks/{code-snippet.CEsdQBL7.js → code-snippet.DiBQjBoy.js} +2 -2
  20. package/dist/chunks/{code-snippet.CEsdQBL7.js.map → code-snippet.DiBQjBoy.js.map} +1 -1
  21. package/dist/chunks/{data-grid.DXF4Cg7m.js → data-grid.BNFwP2g7.js} +6 -6
  22. package/dist/chunks/{data-grid.DXF4Cg7m.js.map → data-grid.BNFwP2g7.js.map} +1 -1
  23. package/dist/chunks/{date-picker.DhtLcpyr.js → date-picker.ClFHuglH.js} +8 -8
  24. package/dist/chunks/{date-picker.DhtLcpyr.js.map → date-picker.ClFHuglH.js.map} +1 -1
  25. package/dist/chunks/{date-range-picker.CChROXhw.js → date-range-picker.D3iAZN20.js} +35 -35
  26. package/dist/chunks/{date-range-picker.CChROXhw.js.map → date-range-picker.D3iAZN20.js.map} +1 -1
  27. package/dist/chunks/{dropdown-tag.DCwovT-N.js → dropdown-tag.KO0gs2Lb.js} +2 -2
  28. package/dist/chunks/{dropdown-tag.DCwovT-N.js.map → dropdown-tag.KO0gs2Lb.js.map} +1 -1
  29. package/dist/chunks/{dropdown.CGUBk0iO.js → dropdown.DpqCHfi-.js} +751 -745
  30. package/dist/chunks/dropdown.DpqCHfi-.js.map +1 -0
  31. package/dist/chunks/{filter-bar.DjUo6CwN.js → filter-bar.D3Lf7VJF.js} +623 -616
  32. package/dist/chunks/filter-bar.D3Lf7VJF.js.map +1 -0
  33. package/dist/chunks/{header-with-views.-QuYbGZW.js → header-with-views.B-5VCTDp.js} +3 -3
  34. package/dist/chunks/{header-with-views.-QuYbGZW.js.map → header-with-views.B-5VCTDp.js.map} +1 -1
  35. package/dist/chunks/{input-field-password.wB3hoH6J.js → input-field-password.BCme16nn.js} +2 -2
  36. package/dist/chunks/{input-field-password.wB3hoH6J.js.map → input-field-password.BCme16nn.js.map} +1 -1
  37. package/dist/chunks/{input-field-phone-number.BmVS8zco.js → input-field-phone-number.BwVbTNcu.js} +2 -2
  38. package/dist/chunks/{input-field-phone-number.BmVS8zco.js.map → input-field-phone-number.BwVbTNcu.js.map} +1 -1
  39. package/dist/chunks/{input-field.lSSH5S7P.js → input-field.Cox9LW4Z.js} +2 -2
  40. package/dist/chunks/{input-field.lSSH5S7P.js.map → input-field.Cox9LW4Z.js.map} +1 -1
  41. package/dist/chunks/{input-time.nwnBuzgX.js → input-time.bHFZRv6T.js} +3 -3
  42. package/dist/chunks/{input-time.nwnBuzgX.js.map → input-time.bHFZRv6T.js.map} +1 -1
  43. package/dist/chunks/{list-item.DqZuLQXc.js → list-item.CqUFIXPC.js} +77 -68
  44. package/dist/chunks/{list-item.DqZuLQXc.js.map → list-item.CqUFIXPC.js.map} +1 -1
  45. package/dist/chunks/{pagination.DX2mxVYn.js → pagination.CMt-m_-T.js} +2 -2
  46. package/dist/chunks/{pagination.DX2mxVYn.js.map → pagination.CMt-m_-T.js.map} +1 -1
  47. package/dist/chunks/{search-bar.f03s-Ljw.js → search-bar.DSi5ti-s.js} +3 -3
  48. package/dist/chunks/{search-bar.f03s-Ljw.js.map → search-bar.DSi5ti-s.js.map} +1 -1
  49. package/dist/chunks/{secondary-nav.BQOLLVwy.js → secondary-nav.D5w22NJe.js} +2 -2
  50. package/dist/chunks/{secondary-nav.BQOLLVwy.js.map → secondary-nav.D5w22NJe.js.map} +1 -1
  51. package/dist/chunks/{use-date-input-formatter.S-t29v8i.js → use-date-input-formatter.ovThcj9h.js} +2 -2
  52. package/dist/chunks/{use-date-input-formatter.S-t29v8i.js.map → use-date-input-formatter.ovThcj9h.js.map} +1 -1
  53. package/dist/code-snippet.js +1 -1
  54. package/dist/data-grid.js +1 -1
  55. package/dist/date-picker.js +2 -2
  56. package/dist/date-range-picker.js +2 -2
  57. package/dist/date-time-picker.js +75 -75
  58. package/dist/dropdown.js +2 -2
  59. package/dist/filter-bar.js +1 -1
  60. package/dist/header-with-views.js +1 -1
  61. package/dist/index.js +17 -17
  62. package/dist/input-field-password.js +1 -1
  63. package/dist/input-field-phone-number.js +1 -1
  64. package/dist/input-field.js +1 -1
  65. package/dist/input-time.js +1 -1
  66. package/dist/internal.js +2 -2
  67. package/dist/list.js +1 -1
  68. package/dist/pagination.js +1 -1
  69. package/dist/search-bar.js +2 -2
  70. package/dist/secondary-nav.js +1 -1
  71. package/dist/web-types.json +1 -1
  72. package/package.json +2 -2
  73. package/dist/chunks/dropdown.CGUBk0iO.js.map +0 -1
  74. package/dist/chunks/filter-bar.DjUo6CwN.js.map +0 -1
@@ -1,13 +1,13 @@
1
1
  import { ref as p, computed as i, defineComponent as me, toRef as T, watch as w, withDirectives as fe, openBlock as u, createElementBlock as De, withKeys as O, createBlock as v, unref as t, createCommentVNode as k, createElementVNode as be, normalizeClass as ye, withCtx as _, createTextVNode as ge, toDisplayString as ke, createVNode as he, nextTick as Ie } from "vue";
2
- import { g as Fe, f as H, b as Se, h as Ce, i as Ne, p as Be } from "./calendar.D0RdoofE.js";
2
+ import { g as Fe, f as H, b as Se, h as Ce, i as Ne, p as Be } from "./calendar.B0XfOj2I.js";
3
3
  import { h as Re } from "./button-actions.CgZbPzhi.js";
4
4
  import { d as Pe, B as Ee } from "./typography.B3J6_tYk.js";
5
- import { B as Me } from "./input-field.lSSH5S7P.js";
6
- import { D as Te, g as we } from "./dropdown.CGUBk0iO.js";
5
+ import { D as Me, g as Te } from "./dropdown.DpqCHfi-.js";
6
+ import { B as we } from "./input-field.Cox9LW4Z.js";
7
7
  import { g as h } from "./generate-uid.DBWe4g6T.js";
8
8
  import { u as Q } from "./index.B875RXHM.js";
9
9
  import { u as Oe } from "./form-field.D_2g7vaP.js";
10
- import { u as Y, a as Ve } from "./use-date-input-formatter.S-t29v8i.js";
10
+ import { u as Y, a as Ve } from "./use-date-input-formatter.ovThcj9h.js";
11
11
  import { u as Ae } from "./use-form-layout-loading.CWbjZiwP.js";
12
12
  import { u as qe } from "./use-touch-device.DTqFAbXh.js";
13
13
  import { B as ze } from "./directive.D1-d-C2K.js";
@@ -146,7 +146,7 @@ const V = {
146
146
  return;
147
147
  const r = $(e) ? K(e) : null, X = M(r);
148
148
  !X && r ? (l.value = null, d(r)) : e && (l.value = X || "invalidDateFormat", d(null));
149
- }, ve = we(G, 1e3), pe = (e) => {
149
+ }, ve = Te(G, 1e3), pe = (e) => {
150
150
  l.value = null, f.value = ae(e), o.value || P.value ? G(f.value) : ve(f.value);
151
151
  }, J = async (e) => {
152
152
  o.value || (e.preventDefault(), j(), await Ie(), c.value || (U(/* @__PURE__ */ new Date()), d(/* @__PURE__ */ new Date())), z.value = q.value?.$refs.calendarRef[0].focusOnDate(
@@ -170,7 +170,7 @@ const V = {
170
170
  required: e.required
171
171
  }, null, 8, ["id", "label", "tooltip-text", "optional", "required"])) : k("", !0),
172
172
  be("div", null, [
173
- t(P) ? (u(), v(t(Me), {
173
+ t(P) ? (u(), v(t(we), {
174
174
  key: 0,
175
175
  ref_key: "inputContainerRef",
176
176
  ref: g,
@@ -186,7 +186,7 @@ const V = {
186
186
  min: ie.value,
187
187
  max: ne.value,
188
188
  "onUpdate:modelValue": oe
189
- }, null, 8, ["type", "aria-labelledby", "aria-label", "aria-describedby", "aria-required", "disabled", "error", "model-value", "readonly", "min", "max"])) : (u(), v(t(Te), {
189
+ }, null, 8, ["type", "aria-labelledby", "aria-label", "aria-describedby", "aria-required", "disabled", "error", "model-value", "readonly", "min", "max"])) : (u(), v(t(Me), {
190
190
  key: 1,
191
191
  ref_key: "inputContainerRef",
192
192
  ref: g,
@@ -276,4 +276,4 @@ const V = {
276
276
  export {
277
277
  ia as B
278
278
  };
279
- //# sourceMappingURL=date-picker.DhtLcpyr.js.map
279
+ //# sourceMappingURL=date-picker.ClFHuglH.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.DhtLcpyr.js","sources":["../../../vue2/src/components/date-picker/composables/use-date-picker-single-calendar-text.ts","../../../vue2/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 { startOfMonth } from 'date-fns/startOfMonth';\nimport { getDateTimeFormatter } from '@/utils/ts/format-date/format-date';\nimport { useDateInputFormatter } from '@/composables/use-date-input-formatter/use-date-input-formatter';\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 option.datePickerValue Ref to the datePickerValue set in the DatePicker component\n * @param option.dateError The i18n message key for the current error, or null if valid\n * @param option.isMonthVariant Indicates if the date picker has variant \"month\"\n */\nexport const useDatePickerSingleCalendarText: UseDateDisplayText<Date> = ({\n datePickerValue,\n dateError,\n isMonthVariant,\n placeholder,\n}) => {\n const { locale, t } = useI18n<{ message: MessageSchema }>({ messages });\n const { formatDate } = useDateInputFormatter();\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 (dateError.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 const dateFormatOptions: Intl.DateTimeFormatOptions = isMonthVariant?.value\n ? { month: 'long', year: 'numeric' }\n : { day: 'numeric', month: 'short', year: 'numeric' };\n\n return getDateTimeFormatter(locale.value, dateFormatOptions).format(datePickerValue.value);\n });\n\n /**\n * Formats the \"dateToFormat\" date value with the current format and sets it as \"formatTextInputDisplayValue\" value\n * @param 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 (dateError.value) {\n return;\n }\n\n if (!dateToFormat) {\n textInputValue.value = '';\n return;\n }\n\n const date = isMonthVariant?.value ? startOfMonth(dateToFormat) : dateToFormat;\n textInputValue.value = formatDate(date);\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 <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 <bento-input-field\n v-if=\"isTouchDevice\"\n ref=\"inputContainerRef\"\n :type=\"isMonthVariant ? 'month' : 'date'\"\n :aria-labelledby=\"label ? labelId : $attrs?.['aria-labelledby']\"\n :aria-label=\"label || $attrs?.['aria-labelledby'] ? null : popoverAriaLabel\"\n :aria-describedby=\"ariaDescribedBy\"\n :aria-required=\"required\"\n :disabled=\"disabled\"\n :error=\"!!errorMessage || !!dateErrorText\"\n :model-value=\"nativeValue\"\n :readonly=\"isReadOnly\"\n :min=\"formattedMin\"\n :max=\"formattedMax\"\n @update:model-value=\"onNativeDateInput\"\n />\n <dropdown-input-default\n v-else\n ref=\"inputContainerRef\"\n always-combobox-is-input\n :ariaControls=\"datePickerContainerId\"\n :ariaExpanded=\"isDatePickerOpen\"\n :aria-labelledby=\"label ? labelId : $attrs?.['aria-labelledby']\"\n :aria-label=\"label ? null : popoverAriaLabel\"\n :aria-describedby=\"ariaDescribedBy\"\n :aria-required=\"required\"\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 && !errorMessage\"\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 && !isTouchDevice\"\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 overflow-visible\n :trap-all-options=\"computedTrapAllOptions\"\n @keydown.esc.native=\"closeDatePicker\"\n >\n <calendar\n ref=\"calendarContainerRef\"\n :default-display-month=\"defaultDisplayMonth\"\n :first-day-of-week=\"resolvedFirstDayOfWeek\"\n :is-date-disabled=\"isDateDisabled\"\n :number-of-months=\"1\"\n :value=\"internalModelValue\"\n :min=\"min\"\n :max=\"max\"\n :variant=\"variant\"\n :year-range=\"yearRange\"\n @input=\"onDateSelected\"\n />\n </bento-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, nextTick, 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, type CalendarSingleDateValue, ErrorMessage, FieldLabel } from '@/internal';\n import { DropdownInputDefault } from '@/components/dropdown/components';\n import { BentoInputField } from '@/components/input-field';\n\n // Utils\n import { debounce } from '@/utils/ts/debounce';\n import { generateUid } from '@/core/utils/ts';\n import { useI18n } from '@/utils/ts/i18n';\n import { dateToNativeDateString, dateToNativeMonthString, parseNativeDateString } from '@/utils/ts/format-date';\n import { useFormFieldEmits } from '@/utils/ts/form-field/form-field';\n import { deprecate } from '@/utils/ts/deprecate';\n\n // Composables\n import { useDatePickerSingleCalendarText } from './composables/use-date-picker-single-calendar-text';\n import { useDateInputFormatter, useFirstDayOfWeek, useFormLayoutFieldLoading, useTouchDevice } from '@/composables';\n\n // Directive\n import { BentoClickOutsideDirective as vBentoClickOutsideDirective } from '@/directives';\n\n // Types\n import { type BentoDatePickerEmits, 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 = withDefaults(defineProps<BentoDatePickerProps>(), {\n defaultDisplayMonth: null,\n description: undefined,\n disabled: false,\n errorMessage: null,\n firstDayOfWeek: undefined,\n isDateDisabled: undefined,\n label: undefined,\n max: null,\n min: null,\n modelValue: null,\n optional: false,\n placeholder: null,\n readonly: false,\n required: false,\n tooltipText: null,\n value: null,\n variant: undefined, // Default will be set by @/internal/calendar\n yearRange: undefined,\n });\n\n const emit = defineEmits<BentoDatePickerEmits>();\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 dateError = ref<keyof MessageSchema | null>(null);\n const isDatePickerOpen = ref(false);\n const initialFocusOnDatePickerOpen = ref(undefined);\n const internalModelValue = ref<CalendarSingleDateValue | null>(props.modelValue); // to be removed when `props.value` is removed\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n const { emitValue } = useFormFieldEmits<CalendarSingleDateValue>(emit);\n const { resolvedFirstDayOfWeek } = useFirstDayOfWeek(toRef(props, 'firstDayOfWeek'));\n const { isFormatValid, parseDate, onKeyDown, autoFormat } = useDateInputFormatter();\n const { isTouchDevice } = useTouchDevice();\n\n const computedTrapAllOptions = computed(() => ({\n initialFocus: initialFocusOnDatePickerOpen.value,\n additionalContainers: [inputContainerRef.value.$el],\n }));\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 watch(\n [() => props.value, () => props.modelValue],\n ([newValue, newModelValue]) => {\n if (newValue) {\n deprecate(\n 'BentoDatePicker \"value\" property',\n `The use of \"value\" prop in \"BentoDatePicker\" is no longer supported. Use the \"v-model\" or \"model-value\" property instead.`,\n '2.0.0'\n );\n }\n\n internalModelValue.value = newModelValue ?? newValue;\n },\n { immediate: true }\n );\n\n const isMonthVariant = computed(() => props.variant === 'month');\n\n const { dateDisplayValue, textInputValue, formatTextInputDisplayValue } = useDatePickerSingleCalendarText({\n datePickerValue: internalModelValue,\n dateError,\n isMonthVariant,\n placeholder: toRef(props, 'placeholder'),\n });\n\n const formatNativeDate = (date: Date): string => {\n if (!date) {\n return '';\n }\n return isMonthVariant.value ? dateToNativeMonthString(date) : dateToNativeDateString(date);\n };\n\n const nativeValue = computed(() => formatNativeDate(internalModelValue.value));\n\n const onNativeDateInput = (value: string) => {\n if (!value) {\n dateError.value = null;\n emitValue(null);\n return;\n }\n\n const date = parseNativeDateString(value, isMonthVariant.value ? 'month' : 'date');\n dateError.value = getDateErrorReason(date);\n\n if (dateError.value) {\n // Emit null to match the non-touch validation behavior.\n // Note: on repeated invalid selections, the native input may still display\n // the selected date because Vue skips re-rendering when the model stays null.\n emitValue(null);\n return;\n }\n\n emitValue(date);\n };\n\n const formattedMin = computed(() => formatNativeDate(props.min));\n const formattedMax = computed(() => formatNativeDate(props.max));\n\n const getDateErrorReason = (date: Date | null): keyof MessageSchema | null => {\n if (!date || isNaN(date.getTime())) {\n return 'invalidDateFormat';\n }\n\n // Check if date is between min/max bounds, if there are any (inclusive)\n if ((props.min && date < props.min) || (props.max && date > props.max)) {\n return 'invalidDateFormat';\n }\n\n // Check if function is set, otherwise all dates are enabled\n if (props.isDateDisabled && props.isDateDisabled(date)) {\n return 'selectedDateIsNotAvailable';\n }\n\n return null;\n };\n\n const dateErrorText = computed(() => (dateError.value ? t(dateError.value) : null));\n\n watch(\n [isDatePickerOpen, textInputValue, () => props.isDateDisabled, () => props.min, () => props.max],\n ([isOpen, textValue]) => {\n // Re-validate the current input when the picker closes, validation props change or text input change\n if (!isOpen && textValue && isFormatValid(textValue)) {\n dateError.value = getDateErrorReason(parseDate(textValue));\n }\n }\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 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 dateError.value = null;\n\n closeDatePicker();\n emitValue(selectedDate);\n };\n\n const clearDatePickerValue = async () => {\n if (dateError.value) {\n dateError.value = null;\n textInputValue.value = null;\n }\n emitValue(null);\n };\n\n const onDateKeyDown = (event: KeyboardEvent) => {\n onKeyDown(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 const parsedDate = isFormatValid(stringDate) ? parseDate(stringDate) : null;\n const errorKey = getDateErrorReason(parsedDate);\n\n if (!errorKey && parsedDate) {\n dateError.value = null;\n emitValue(parsedDate);\n } else if (stringDate) {\n dateError.value = errorKey || 'invalidDateFormat';\n emitValue(null);\n }\n };\n\n const validateDateDebounced = debounce(validateDate, DEBOUNCE_TIME);\n\n const onDateInputChange = (stringDate: string) => {\n dateError.value = null;\n textInputValue.value = autoFormat(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 // On touch devices with native input, we also want immediate feedback.\n if (isDatePickerOpen.value || isTouchDevice.value) {\n validateDate(textInputValue.value);\n } else {\n validateDateDebounced(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 (!internalModelValue.value) {\n // Format the opened date picker date to YYYY-MM-DD\n formatTextInputDisplayValue(new Date());\n emitValue(new Date());\n }\n\n // Set initial focus\n initialFocusOnDatePickerOpen.value =\n calendarContainerRef.value?.$refs.calendarRef[0].focusOnDate(\n props.variant === 'month' ? startOfMonth(internalModelValue.value) : internalModelValue.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 model: { prop: 'modelValue' },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./date-picker.scss\" />\n"],"names":["useDatePickerSingleCalendarText","datePickerValue","dateError","isMonthVariant","placeholder","locale","t","useI18n","messages","formatDate","useDateInputFormatter","textInputValue","ref","computed","dateFormatOptions","getDateTimeFormatter","dateToFormat","date","startOfMonth","__default__","props","__props","emit","__emit","datePickerContainerId","generateUid","labelId","descriptionId","errorId","dateErrorId","popoverAriaLabel","calendarContainerRef","inputContainerRef","isDatePickerOpen","initialFocusOnDatePickerOpen","internalModelValue","isReadOnly","useFormLayoutFieldLoading","toRef","emitValue","useFormFieldEmits","resolvedFirstDayOfWeek","useFirstDayOfWeek","isFormatValid","parseDate","onKeyDown","autoFormat","isTouchDevice","useTouchDevice","computedTrapAllOptions","watch","disabled","newValue","newModelValue","deprecate","dateDisplayValue","formatTextInputDisplayValue","formatNativeDate","dateToNativeMonthString","dateToNativeDateString","nativeValue","onNativeDateInput","value","parseNativeDateString","getDateErrorReason","formattedMin","formattedMax","dateErrorText","isOpen","textValue","descriptionConditionalClasses","ariaDescribedBy","closeDatePicker","openDatePicker","onDateSelected","selectedDate","clearDatePickerValue","onDateKeyDown","event","validateDate","stringDate","parsedDate","errorKey","validateDateDebounced","debounce","onDateInputChange","onSpaceBarOrEnter","nextTick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgBOA,KAAA,CAAA;AAAA,EAAmE,iBAAAC;AAAA,EACtE,WAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,aAAAC;AAEJ,MAAA;AACI,QAAA,EAAA,QAAAC,GAAA,GAAAC,EAAA,IAAAC,EAAA,EAAA,UAAAC,EAAA,CAAA,GACA,EAAA,YAAAC,EAAA,IAAAC,EAAA,GAEAC,IAAAC,EAAAX,EAAA,OAAA,aAAA,CAAA;AAyCA,SAAA;AAAA;AAAA,IAAO,kBAvCPY,EAAA,MAAA;AAEI,UAAAX,EAAA;AACI,eAAAS,EAAA;AAIJ,UAAA,CAAAV,EAAA;AACI,eAAAG,GAAA,SAAAE,EAAA,YAAA;AAKJ,YAAAQ,IAAAX,GAAA,QAAA,EAAA,OAAA,QAAA,MAAA,UAAA,IAAA,EAAA,KAAA,WAAA,OAAA,SAAA,MAAA,UAAA;AAIA,aAAAY,GAAAV,EAAA,OAAAS,CAAA,EAAA,OAAAb,EAAA,KAAA;AAAA,IAAyF,CAAA;AAAA,IAwBzF,gBAAAU;AAAA;AAAA,IACA,6BAlBJ,CAAAK,IAAAf,EAAA,UAAA;AAEI,UAAAC,EAAA;AACI;AAGJ,UAAA,CAAAc,GAAA;AACI,QAAAL,EAAA,QAAA;AACA;AAAA,MAAA;AAGJ,YAAAM,IAAAd,GAAA,QAAAe,EAAAF,CAAA,IAAAA;AACA,MAAAL,EAAA,QAAAF,EAAAQ,CAAA;AAAA,IAAsC;AAAA,EAStC;AAER,GC6WIE,KAAA;AAAA,EAAe,MAAA,EAAA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,MAEpB9E,EAAA,QAAAgF,KAAA,qBACA3C,EAAA,IAAA;AAAA,IACJ,GAGJ4C,KAAAC,GAAAL,GAAA,GAAA,GAEAM,KAAA,CAAAL,MAAA;AACI,MAAA9E,EAAA,QAAA,MACAS,EAAA,QAAAmC,GAAAkC,CAAA,GAGA/C,EAAA,SAAAc,EAAA,QACIgC,EAAApE,EAAA,KAAA,IAEAwE,GAAAxE,EAAA,KAAA;AAAA,IACJ,GAUJ2E,IAAA,OAAAR,MAAA;AACI,MAAA7C,EAAA,UAGA6C,EAAA,eAAA,GAEAL,EAAA,GAGA,MAAAc,GAAA,GAGApD,EAAA,UAEIqB,EAAA,oBAAA,KAAA,CAAA,GACAjB,EAAA,oBAAA,KAAA,CAAA,IAIJL,EAAA,QAAAH,EAAA,OAAA,MAAA,YAAA,CAAA,EAAA;AAAA,QACqDX,EAAA,YAAA,UAAAF,EAAAiB,EAAA,KAAA,IAAAA,EAAA;AAAA,QAC2C;AAAA,MACxF,KAAA;AAAA,IACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"date-picker.ClFHuglH.js","sources":["../../../vue2/src/components/date-picker/composables/use-date-picker-single-calendar-text.ts","../../../vue2/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 { startOfMonth } from 'date-fns/startOfMonth';\nimport { getDateTimeFormatter } from '@/utils/ts/format-date/format-date';\nimport { useDateInputFormatter } from '@/composables/use-date-input-formatter/use-date-input-formatter';\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 option.datePickerValue Ref to the datePickerValue set in the DatePicker component\n * @param option.dateError The i18n message key for the current error, or null if valid\n * @param option.isMonthVariant Indicates if the date picker has variant \"month\"\n */\nexport const useDatePickerSingleCalendarText: UseDateDisplayText<Date> = ({\n datePickerValue,\n dateError,\n isMonthVariant,\n placeholder,\n}) => {\n const { locale, t } = useI18n<{ message: MessageSchema }>({ messages });\n const { formatDate } = useDateInputFormatter();\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 (dateError.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 const dateFormatOptions: Intl.DateTimeFormatOptions = isMonthVariant?.value\n ? { month: 'long', year: 'numeric' }\n : { day: 'numeric', month: 'short', year: 'numeric' };\n\n return getDateTimeFormatter(locale.value, dateFormatOptions).format(datePickerValue.value);\n });\n\n /**\n * Formats the \"dateToFormat\" date value with the current format and sets it as \"formatTextInputDisplayValue\" value\n * @param 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 (dateError.value) {\n return;\n }\n\n if (!dateToFormat) {\n textInputValue.value = '';\n return;\n }\n\n const date = isMonthVariant?.value ? startOfMonth(dateToFormat) : dateToFormat;\n textInputValue.value = formatDate(date);\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 <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 <bento-input-field\n v-if=\"isTouchDevice\"\n ref=\"inputContainerRef\"\n :type=\"isMonthVariant ? 'month' : 'date'\"\n :aria-labelledby=\"label ? labelId : $attrs?.['aria-labelledby']\"\n :aria-label=\"label || $attrs?.['aria-labelledby'] ? null : popoverAriaLabel\"\n :aria-describedby=\"ariaDescribedBy\"\n :aria-required=\"required\"\n :disabled=\"disabled\"\n :error=\"!!errorMessage || !!dateErrorText\"\n :model-value=\"nativeValue\"\n :readonly=\"isReadOnly\"\n :min=\"formattedMin\"\n :max=\"formattedMax\"\n @update:model-value=\"onNativeDateInput\"\n />\n <dropdown-input-default\n v-else\n ref=\"inputContainerRef\"\n always-combobox-is-input\n :ariaControls=\"datePickerContainerId\"\n :ariaExpanded=\"isDatePickerOpen\"\n :aria-labelledby=\"label ? labelId : $attrs?.['aria-labelledby']\"\n :aria-label=\"label ? null : popoverAriaLabel\"\n :aria-describedby=\"ariaDescribedBy\"\n :aria-required=\"required\"\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 && !errorMessage\"\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 && !isTouchDevice\"\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 overflow-visible\n :trap-all-options=\"computedTrapAllOptions\"\n @keydown.esc.native=\"closeDatePicker\"\n >\n <calendar\n ref=\"calendarContainerRef\"\n :default-display-month=\"defaultDisplayMonth\"\n :first-day-of-week=\"resolvedFirstDayOfWeek\"\n :is-date-disabled=\"isDateDisabled\"\n :number-of-months=\"1\"\n :value=\"internalModelValue\"\n :min=\"min\"\n :max=\"max\"\n :variant=\"variant\"\n :year-range=\"yearRange\"\n @input=\"onDateSelected\"\n />\n </bento-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, nextTick, 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, type CalendarSingleDateValue, ErrorMessage, FieldLabel } from '@/internal';\n import { DropdownInputDefault } from '@/components/dropdown/components';\n import { BentoInputField } from '@/components/input-field';\n\n // Utils\n import { debounce } from '@/utils/ts/debounce';\n import { generateUid } from '@/core/utils/ts';\n import { useI18n } from '@/utils/ts/i18n';\n import { dateToNativeDateString, dateToNativeMonthString, parseNativeDateString } from '@/utils/ts/format-date';\n import { useFormFieldEmits } from '@/utils/ts/form-field/form-field';\n import { deprecate } from '@/utils/ts/deprecate';\n\n // Composables\n import { useDatePickerSingleCalendarText } from './composables/use-date-picker-single-calendar-text';\n import { useDateInputFormatter, useFirstDayOfWeek, useFormLayoutFieldLoading, useTouchDevice } from '@/composables';\n\n // Directive\n import { BentoClickOutsideDirective as vBentoClickOutsideDirective } from '@/directives';\n\n // Types\n import { type BentoDatePickerEmits, 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 = withDefaults(defineProps<BentoDatePickerProps>(), {\n defaultDisplayMonth: null,\n description: undefined,\n disabled: false,\n errorMessage: null,\n firstDayOfWeek: undefined,\n isDateDisabled: undefined,\n label: undefined,\n max: null,\n min: null,\n modelValue: null,\n optional: false,\n placeholder: null,\n readonly: false,\n required: false,\n tooltipText: null,\n value: null,\n variant: undefined, // Default will be set by @/internal/calendar\n yearRange: undefined,\n });\n\n const emit = defineEmits<BentoDatePickerEmits>();\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 dateError = ref<keyof MessageSchema | null>(null);\n const isDatePickerOpen = ref(false);\n const initialFocusOnDatePickerOpen = ref(undefined);\n const internalModelValue = ref<CalendarSingleDateValue | null>(props.modelValue); // to be removed when `props.value` is removed\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n const { emitValue } = useFormFieldEmits<CalendarSingleDateValue>(emit);\n const { resolvedFirstDayOfWeek } = useFirstDayOfWeek(toRef(props, 'firstDayOfWeek'));\n const { isFormatValid, parseDate, onKeyDown, autoFormat } = useDateInputFormatter();\n const { isTouchDevice } = useTouchDevice();\n\n const computedTrapAllOptions = computed(() => ({\n initialFocus: initialFocusOnDatePickerOpen.value,\n additionalContainers: [inputContainerRef.value.$el],\n }));\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 watch(\n [() => props.value, () => props.modelValue],\n ([newValue, newModelValue]) => {\n if (newValue) {\n deprecate(\n 'BentoDatePicker \"value\" property',\n `The use of \"value\" prop in \"BentoDatePicker\" is no longer supported. Use the \"v-model\" or \"model-value\" property instead.`,\n '2.0.0'\n );\n }\n\n internalModelValue.value = newModelValue ?? newValue;\n },\n { immediate: true }\n );\n\n const isMonthVariant = computed(() => props.variant === 'month');\n\n const { dateDisplayValue, textInputValue, formatTextInputDisplayValue } = useDatePickerSingleCalendarText({\n datePickerValue: internalModelValue,\n dateError,\n isMonthVariant,\n placeholder: toRef(props, 'placeholder'),\n });\n\n const formatNativeDate = (date: Date): string => {\n if (!date) {\n return '';\n }\n return isMonthVariant.value ? dateToNativeMonthString(date) : dateToNativeDateString(date);\n };\n\n const nativeValue = computed(() => formatNativeDate(internalModelValue.value));\n\n const onNativeDateInput = (value: string) => {\n if (!value) {\n dateError.value = null;\n emitValue(null);\n return;\n }\n\n const date = parseNativeDateString(value, isMonthVariant.value ? 'month' : 'date');\n dateError.value = getDateErrorReason(date);\n\n if (dateError.value) {\n // Emit null to match the non-touch validation behavior.\n // Note: on repeated invalid selections, the native input may still display\n // the selected date because Vue skips re-rendering when the model stays null.\n emitValue(null);\n return;\n }\n\n emitValue(date);\n };\n\n const formattedMin = computed(() => formatNativeDate(props.min));\n const formattedMax = computed(() => formatNativeDate(props.max));\n\n const getDateErrorReason = (date: Date | null): keyof MessageSchema | null => {\n if (!date || isNaN(date.getTime())) {\n return 'invalidDateFormat';\n }\n\n // Check if date is between min/max bounds, if there are any (inclusive)\n if ((props.min && date < props.min) || (props.max && date > props.max)) {\n return 'invalidDateFormat';\n }\n\n // Check if function is set, otherwise all dates are enabled\n if (props.isDateDisabled && props.isDateDisabled(date)) {\n return 'selectedDateIsNotAvailable';\n }\n\n return null;\n };\n\n const dateErrorText = computed(() => (dateError.value ? t(dateError.value) : null));\n\n watch(\n [isDatePickerOpen, textInputValue, () => props.isDateDisabled, () => props.min, () => props.max],\n ([isOpen, textValue]) => {\n // Re-validate the current input when the picker closes, validation props change or text input change\n if (!isOpen && textValue && isFormatValid(textValue)) {\n dateError.value = getDateErrorReason(parseDate(textValue));\n }\n }\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 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 dateError.value = null;\n\n closeDatePicker();\n emitValue(selectedDate);\n };\n\n const clearDatePickerValue = async () => {\n if (dateError.value) {\n dateError.value = null;\n textInputValue.value = null;\n }\n emitValue(null);\n };\n\n const onDateKeyDown = (event: KeyboardEvent) => {\n onKeyDown(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 const parsedDate = isFormatValid(stringDate) ? parseDate(stringDate) : null;\n const errorKey = getDateErrorReason(parsedDate);\n\n if (!errorKey && parsedDate) {\n dateError.value = null;\n emitValue(parsedDate);\n } else if (stringDate) {\n dateError.value = errorKey || 'invalidDateFormat';\n emitValue(null);\n }\n };\n\n const validateDateDebounced = debounce(validateDate, DEBOUNCE_TIME);\n\n const onDateInputChange = (stringDate: string) => {\n dateError.value = null;\n textInputValue.value = autoFormat(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 // On touch devices with native input, we also want immediate feedback.\n if (isDatePickerOpen.value || isTouchDevice.value) {\n validateDate(textInputValue.value);\n } else {\n validateDateDebounced(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 (!internalModelValue.value) {\n // Format the opened date picker date to YYYY-MM-DD\n formatTextInputDisplayValue(new Date());\n emitValue(new Date());\n }\n\n // Set initial focus\n initialFocusOnDatePickerOpen.value =\n calendarContainerRef.value?.$refs.calendarRef[0].focusOnDate(\n props.variant === 'month' ? startOfMonth(internalModelValue.value) : internalModelValue.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 model: { prop: 'modelValue' },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./date-picker.scss\" />\n"],"names":["useDatePickerSingleCalendarText","datePickerValue","dateError","isMonthVariant","placeholder","locale","t","useI18n","messages","formatDate","useDateInputFormatter","textInputValue","ref","computed","dateFormatOptions","getDateTimeFormatter","dateToFormat","date","startOfMonth","__default__","props","__props","emit","__emit","datePickerContainerId","generateUid","labelId","descriptionId","errorId","dateErrorId","popoverAriaLabel","calendarContainerRef","inputContainerRef","isDatePickerOpen","initialFocusOnDatePickerOpen","internalModelValue","isReadOnly","useFormLayoutFieldLoading","toRef","emitValue","useFormFieldEmits","resolvedFirstDayOfWeek","useFirstDayOfWeek","isFormatValid","parseDate","onKeyDown","autoFormat","isTouchDevice","useTouchDevice","computedTrapAllOptions","watch","disabled","newValue","newModelValue","deprecate","dateDisplayValue","formatTextInputDisplayValue","formatNativeDate","dateToNativeMonthString","dateToNativeDateString","nativeValue","onNativeDateInput","value","parseNativeDateString","getDateErrorReason","formattedMin","formattedMax","dateErrorText","isOpen","textValue","descriptionConditionalClasses","ariaDescribedBy","closeDatePicker","openDatePicker","onDateSelected","selectedDate","clearDatePickerValue","onDateKeyDown","event","validateDate","stringDate","parsedDate","errorKey","validateDateDebounced","debounce","onDateInputChange","onSpaceBarOrEnter","nextTick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgBOA,KAAA,CAAA;AAAA,EAAmE,iBAAAC;AAAA,EACtE,WAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,aAAAC;AAEJ,MAAA;AACI,QAAA,EAAA,QAAAC,GAAA,GAAAC,EAAA,IAAAC,EAAA,EAAA,UAAAC,EAAA,CAAA,GACA,EAAA,YAAAC,EAAA,IAAAC,EAAA,GAEAC,IAAAC,EAAAX,EAAA,OAAA,aAAA,CAAA;AAyCA,SAAA;AAAA;AAAA,IAAO,kBAvCPY,EAAA,MAAA;AAEI,UAAAX,EAAA;AACI,eAAAS,EAAA;AAIJ,UAAA,CAAAV,EAAA;AACI,eAAAG,GAAA,SAAAE,EAAA,YAAA;AAKJ,YAAAQ,IAAAX,GAAA,QAAA,EAAA,OAAA,QAAA,MAAA,UAAA,IAAA,EAAA,KAAA,WAAA,OAAA,SAAA,MAAA,UAAA;AAIA,aAAAY,GAAAV,EAAA,OAAAS,CAAA,EAAA,OAAAb,EAAA,KAAA;AAAA,IAAyF,CAAA;AAAA,IAwBzF,gBAAAU;AAAA;AAAA,IACA,6BAlBJ,CAAAK,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,MAAA;AACI,MAAAjC,GAAAiC,CAAA;AAAA,IAAe,GAGnBC,IAAA,CAAAC,MAAA;AAEI,UAAAA,EAAA,SAAA;AACI;AAGJ,YAAAC,IAAAtC,EAAAqC,CAAA,IAAApC,EAAAoC,CAAA,IAAA,MACAE,IAAAlB,EAAAiB,CAAA;AAEA,MAAA,CAAAC,KAAAD,KACI/E,EAAA,QAAA,MACAqC,EAAA0C,CAAA,KAAoBD,MAEpB9E,EAAA,QAAAgF,KAAA,qBACA3C,EAAA,IAAA;AAAA,IACJ,GAGJ4C,KAAAC,GAAAL,GAAA,GAAA,GAEAM,KAAA,CAAAL,MAAA;AACI,MAAA9E,EAAA,QAAA,MACAS,EAAA,QAAAmC,GAAAkC,CAAA,GAGA/C,EAAA,SAAAc,EAAA,QACIgC,EAAApE,EAAA,KAAA,IAEAwE,GAAAxE,EAAA,KAAA;AAAA,IACJ,GAUJ2E,IAAA,OAAAR,MAAA;AACI,MAAA7C,EAAA,UAGA6C,EAAA,eAAA,GAEAL,EAAA,GAGA,MAAAc,GAAA,GAGApD,EAAA,UAEIqB,EAAA,oBAAA,KAAA,CAAA,GACAjB,EAAA,oBAAA,KAAA,CAAA,IAIJL,EAAA,QAAAH,EAAA,OAAA,MAAA,YAAA,CAAA,EAAA;AAAA,QACqDX,EAAA,YAAA,UAAAF,EAAAiB,EAAA,KAAA,IAAAA,EAAA;AAAA,QAC2C;AAAA,MACxF,KAAA;AAAA,IACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -3,15 +3,15 @@ import { b as _a } from "./index.DtuWfdhd.js";
3
3
  import { B as La } from "./divider.BIY84UH7.js";
4
4
  import { h as Ua, B as Qa } from "./button-actions.CgZbPzhi.js";
5
5
  import { B as Oe, d as He } from "./typography.B3J6_tYk.js";
6
+ import { B as ja, g as Ke, D as Wa } from "./dropdown.DpqCHfi-.js";
6
7
  import { g as oe } from "./generate-uid.DBWe4g6T.js";
7
8
  import { u as xe } from "./index.B875RXHM.js";
8
- import { j as le, k as B, s as F, l as ja, m as Ke, n as Wa, f as Xe, o as Ga, q as $a, r as Ja, t as Ze, u as Ha, b as C, v as Ka, h as Xa, i as Za, e as N, w as ea, x as aa, g as et } from "./calendar.D0RdoofE.js";
9
- import { u as Ne, a as at } from "./use-date-input-formatter.S-t29v8i.js";
10
- import { t as Re, n as tt, c as nt } from "./en-US.BR6y7foR.js";
11
- import { u as rt } from "./use-form-layout-loading.CWbjZiwP.js";
12
- import { B as st } from "./directive.D1-d-C2K.js";
13
- import { u as ot } from "./form-field.D_2g7vaP.js";
14
- import { B as lt, g as ta, D as it } from "./dropdown.CGUBk0iO.js";
9
+ import { j as le, k as B, s as F, l as Ga, m as Xe, n as $a, f as Ze, o as Ja, q as Ha, r as Ka, t as ea, u as Xa, b as C, v as Za, h as et, i as at, e as N, w as aa, x as ta, g as tt } from "./calendar.B0XfOj2I.js";
10
+ import { u as Ne, a as nt } from "./use-date-input-formatter.ovThcj9h.js";
11
+ import { t as Re, n as rt, c as st } from "./en-US.BR6y7foR.js";
12
+ import { u as ot } from "./use-form-layout-loading.CWbjZiwP.js";
13
+ import { B as lt } from "./directive.D1-d-C2K.js";
14
+ import { u as it } from "./form-field.D_2g7vaP.js";
15
15
  import { B as ut } from "./alert.V1imvtyI.js";
16
16
  import { B as dt } from "./segmented-control.CDV9IQDC.js";
17
17
  import { u as ct } from "./use-has-slot.CyMiImRQ.js";
@@ -20,8 +20,8 @@ import { e as U, a as na } from "./differenceInMonths.yz4Dfe-b.js";
20
20
  import { s as ra } from "./startOfWeek.muMEhS7U.js";
21
21
  import { c as Dt } from "./constructNow.DyOJDyZZ.js";
22
22
  import { a as ge, s as sa } from "./set-time-in-date.9-8WOiMT.js";
23
- import { B as vt, i as oa } from "./input-time.nwnBuzgX.js";
24
- import { B as pt } from "./input-field.lSSH5S7P.js";
23
+ import { B as vt, i as oa } from "./input-time.bHFZRv6T.js";
24
+ import { B as pt } from "./input-field.Cox9LW4Z.js";
25
25
  import { B as ft } from "./form-layout-group.08QuvVmC.js";
26
26
  import { _ as va } from "./_plugin-vue_export-helper.CHgC5LLL.js";
27
27
  import { F as gt } from "./field-label.yQ_2Qg88.js";
@@ -35,7 +35,7 @@ function Ee(s, v) {
35
35
  return +Re(s) == +Re(v);
36
36
  }
37
37
  function Mt(s, v, h) {
38
- const [i, d] = tt(
38
+ const [i, d] = rt(
39
39
  h?.in,
40
40
  s,
41
41
  v
@@ -51,7 +51,7 @@ function Fe(s, v) {
51
51
  }
52
52
  function ht(s, v) {
53
53
  return B(
54
- nt(s, s),
54
+ st(s, s),
55
55
  Dt(s)
56
56
  );
57
57
  }
@@ -109,27 +109,27 @@ const Tt = {
109
109
  a = F(d.earliest);
110
110
  else if (a) {
111
111
  const f = ra(a, { weekStartsOn: s });
112
- B(a, f) || (a = F(ja(Ke(a, { weekStartsOn: s }), 1)));
112
+ B(a, f) || (a = F(Ga(Xe(a, { weekStartsOn: s }), 1)));
113
113
  }
114
114
  if (d.latest)
115
115
  o = U(d.latest);
116
116
  else if (o) {
117
- const f = Ke(o, { weekStartsOn: s });
118
- B(o, f) || (o = U(Wa(ra(o, { weekStartsOn: s }), 1)));
117
+ const f = Xe(o, { weekStartsOn: s });
118
+ B(o, f) || (o = U($a(ra(o, { weekStartsOn: s }), 1)));
119
119
  }
120
120
  }
121
121
  if (d?.type === "monthly") {
122
122
  if (d.earliest)
123
123
  a = F(d.earliest);
124
124
  else if (a) {
125
- const f = Xe(a);
126
- B(a, f) || (a = Xe(Ga(a, 1)));
125
+ const f = Ze(a);
126
+ B(a, f) || (a = Ze(Ja(a, 1)));
127
127
  }
128
128
  if (d.latest)
129
129
  o = U(d.latest);
130
130
  else if (o) {
131
131
  const f = na(o);
132
- B(o, f) || (o = na($a(o, 1)));
132
+ B(o, f) || (o = na(Ha(o, 1)));
133
133
  }
134
134
  }
135
135
  if (d?.type === "quarterly") {
@@ -137,13 +137,13 @@ const Tt = {
137
137
  a = le(d.earliest);
138
138
  else if (a) {
139
139
  const f = le(a);
140
- B(a, f) || (a = le(Ja(a, 1)));
140
+ B(a, f) || (a = le(Ka(a, 1)));
141
141
  }
142
142
  if (d.latest)
143
143
  o = U(d.latest);
144
144
  else if (o) {
145
- const f = Ze(o);
146
- B(o, f) || (o = Ze(Ha(o, 1)));
145
+ const f = ea(o);
146
+ B(o, f) || (o = ea(Xa(o, 1)));
147
147
  }
148
148
  }
149
149
  return { min: a, max: o };
@@ -330,7 +330,7 @@ const pa = {
330
330
  adjustEndDateInputForMonthly: de,
331
331
  adjustStartDateInputForQuarterly: $,
332
332
  adjustEndDateInputForQuarterly: Z
333
- } = Ka(a.firstDayOfWeek), { savedRanges: J, saveRange: Ie, resetSavedRanges: ce } = bt(), w = (e) => e ? re(e) : "", y = z(null), M = z(null), me = m(() => y.value ? T(y.value) : null), De = m(() => M.value ? T(M.value) : null), ve = m(
333
+ } = Za(a.firstDayOfWeek), { savedRanges: J, saveRange: Ie, resetSavedRanges: ce } = bt(), w = (e) => e ? re(e) : "", y = z(null), M = z(null), me = m(() => y.value ? T(y.value) : null), De = m(() => M.value ? T(M.value) : null), ve = m(
334
334
  () => y.value === "invalidDateFormat" ? null : me.value
335
335
  ), l = m(() => M.value === "invalidDateFormat" ? null : De.value), A = (e, n, c, p) => {
336
336
  if (!e || !Y(e))
@@ -359,7 +359,7 @@ const pa = {
359
359
  return !0;
360
360
  };
361
361
  return oa(e) && c();
362
- }, ee = m(() => a.variant === "month"), Ce = (e) => e ? ee.value ? Xa(e) : Za(e) : "", fa = m(() => Ce(t.startDate)), ga = m(() => Ce(t.endDate)), ze = m(() => S.value ? ee.value ? "month" : "date" : "text"), ya = m(() => S.value ? fa.value : r.startDate), Ma = m(() => S.value ? ga.value : r.endDate), V = (e, n) => !n || !oa(n) || a.variant === "month" ? e : sa(new Date(e), n), ha = (e) => {
362
+ }, ee = m(() => a.variant === "month"), Ce = (e) => e ? ee.value ? et(e) : at(e) : "", fa = m(() => Ce(t.startDate)), ga = m(() => Ce(t.endDate)), ze = m(() => S.value ? ee.value ? "month" : "date" : "text"), ya = m(() => S.value ? fa.value : r.startDate), Ma = m(() => S.value ? ga.value : r.endDate), V = (e, n) => !n || !oa(n) || a.variant === "month" ? e : sa(new Date(e), n), ha = (e) => {
363
363
  r.startTime = N(
364
364
  a.min && a.allowTimeInput && B(a.min, e.startDate) ? a.min : F(e.startDate)
365
365
  ), r.endTime = N(
@@ -435,10 +435,10 @@ const pa = {
435
435
  });
436
436
  } else
437
437
  y.value = A(e), o(D.ERROR, { ...r });
438
- }, ba = ta(_e, 300), Ya = (e) => {
438
+ }, ba = Ke(_e, 300), Ya = (e) => {
439
439
  if (r.startDate = S.value && ee.value ? e : G(e), S.value)
440
440
  if (ee.value && e) {
441
- const n = ea(e);
441
+ const n = aa(e);
442
442
  t.startDate = V(n, r.startTime), t.range = null, o(D.INPUT, {
443
443
  ...t,
444
444
  range: q.value
@@ -499,10 +499,10 @@ const pa = {
499
499
  });
500
500
  } else
501
501
  M.value = A(e), o(D.ERROR, { ...r });
502
- }, ka = ta(Le, 300), Aa = (e) => {
502
+ }, ka = Ke(Le, 300), Aa = (e) => {
503
503
  if (r.endDate = S.value && ee.value ? e : G(e), S.value)
504
504
  if (ee.value && e) {
505
- const n = ea(e);
505
+ const n = aa(e);
506
506
  t.endDate = V(n, r.endTime), t.range = null, o(D.INPUT, {
507
507
  ...t,
508
508
  range: q.value
@@ -645,7 +645,7 @@ const pa = {
645
645
  }, [
646
646
  te("div", kt, [
647
647
  u(W)("title") ? $e(e.$slots, "title", { key: 0 }, void 0, !0) : x("", !0),
648
- s.quickSelectRanges ? (P(), _(lt, {
648
+ s.quickSelectRanges ? (P(), _(ja, {
649
649
  key: 1,
650
650
  "aria-label": u(T)("customRange"),
651
651
  items: ie.value,
@@ -806,10 +806,10 @@ const pa = {
806
806
  return b.label;
807
807
  }
808
808
  if (s.value.granularity === "quarterly") {
809
- const { startDate: b, endDate: Q } = s.value, G = f("quarter", { quarter: aa(b), year: ia(b) });
809
+ const { startDate: b, endDate: Q } = s.value, G = f("quarter", { quarter: ta(b), year: ia(b) });
810
810
  if (Mt(b, Q))
811
811
  return G;
812
- const re = f("quarter", { quarter: aa(Q), year: ia(Q) });
812
+ const re = f("quarter", { quarter: ta(Q), year: ia(Q) });
813
813
  return `${G} - ${re}`;
814
814
  }
815
815
  if (!T(s.value.startDate) || !T(s.value.endDate))
@@ -821,7 +821,7 @@ const pa = {
821
821
  minute: "numeric",
822
822
  second: "numeric",
823
823
  hour12: !1
824
- }), et(o.value, Y).formatRange(
824
+ }), tt(o.value, Y).formatRange(
825
825
  s.value.startDate,
826
826
  s.value.endDate
827
827
  );
@@ -864,7 +864,7 @@ const pa = {
864
864
  },
865
865
  emits: ["update:model-value", "input"],
866
866
  setup(s, { emit: v }) {
867
- const h = v, i = s, d = Va(), { t: a } = xe({ messages: Be }), { dateToInputDateString: o } = Ne(), f = oe("bento-date-range-picker-container"), W = oe("bento-date-range-picker-label"), T = oe("bento-date-range-picker-description"), I = oe("bento-date-range-picker-error"), S = oe("bento-date-range-picker-date-error"), ne = m(() => i.label || a("dateRangePicker", { name: f })), { resolvedFirstDayOfWeek: Y } = at(we(i, "firstDayOfWeek")), b = _a({
867
+ const h = v, i = s, d = Va(), { t: a } = xe({ messages: Be }), { dateToInputDateString: o } = Ne(), f = oe("bento-date-range-picker-container"), W = oe("bento-date-range-picker-label"), T = oe("bento-date-range-picker-description"), I = oe("bento-date-range-picker-error"), S = oe("bento-date-range-picker-date-error"), ne = m(() => i.label || a("dateRangePicker", { name: f })), { resolvedFirstDayOfWeek: Y } = nt(we(i, "firstDayOfWeek")), b = _a({
868
868
  none: 0,
869
869
  one: 710,
870
870
  // width of date range picker with one panes
@@ -893,7 +893,7 @@ const pa = {
893
893
  timeDifference: A
894
894
  }
895
895
  };
896
- })), re = m(() => i.label ? W : d?.["aria-labelledby"] ?? null), k = z(!1), X = z(null), O = z(!1), { isReadOnly: t } = rt(we(i, "readonly")), { emitValue: q } = ot(h);
896
+ })), re = m(() => i.label ? W : d?.["aria-labelledby"] ?? null), k = z(!1), X = z(null), O = z(!1), { isReadOnly: t } = ot(we(i, "readonly")), { emitValue: q } = it(h);
897
897
  he(
898
898
  () => i.disabled,
899
899
  () => {
@@ -987,7 +987,7 @@ const pa = {
987
987
  te("div", {
988
988
  onKeydown: Je(M, ["enter"])
989
989
  }, [
990
- L(u(it), {
990
+ L(u(Wa), {
991
991
  ref_key: "inputContainerRef",
992
992
  ref: X,
993
993
  "always-combobox-is-input": "",
@@ -1082,7 +1082,7 @@ const pa = {
1082
1082
  _: 1
1083
1083
  }, 8, ["id", "open", "target-element", "aria-label"])) : x("", !0)
1084
1084
  ])), [
1085
- [u(st), H]
1085
+ [u(lt), H]
1086
1086
  ]);
1087
1087
  }
1088
1088
  }), Dn = /* @__PURE__ */ va(xt, [["__scopeId", "data-v-e9cefb1f"]]);
@@ -1092,4 +1092,4 @@ export {
1092
1092
  ht as a,
1093
1093
  Ee as i
1094
1094
  };
1095
- //# sourceMappingURL=date-range-picker.CChROXhw.js.map
1095
+ //# sourceMappingURL=date-range-picker.D3iAZN20.js.map