@adyen/bento-vue3 1.84.1 → 1.84.2

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 (61) 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/file-uploader.css +1 -1
  9. package/dist/assets/inspector.css +1 -1
  10. package/dist/assets/modal-fullscreen.css +1 -1
  11. package/dist/assets/sidepanel.css +1 -1
  12. package/dist/chunks/{code-snippet.4HtbNUDE.js → code-snippet.BX3Yeo0x.js} +2 -2
  13. package/dist/chunks/{code-snippet.4HtbNUDE.js.map → code-snippet.BX3Yeo0x.js.map} +1 -1
  14. package/dist/chunks/{data-grid.DJAYHf2n.js → data-grid.CqtJp9rE.js} +5 -5
  15. package/dist/chunks/{data-grid.DJAYHf2n.js.map → data-grid.CqtJp9rE.js.map} +1 -1
  16. package/dist/chunks/{date-picker.dyp0YK9_.js → date-picker.DGIwFh6T.js} +13 -13
  17. package/dist/chunks/{date-picker.dyp0YK9_.js.map → date-picker.DGIwFh6T.js.map} +1 -1
  18. package/dist/chunks/{date-range-picker.TsUvRvGy.js → date-range-picker.Df9XyFMH.js} +26 -26
  19. package/dist/chunks/{date-range-picker.TsUvRvGy.js.map → date-range-picker.Df9XyFMH.js.map} +1 -1
  20. package/dist/chunks/{dropdown-tag.DtpDzWl4.js → dropdown-tag.Bf6TiNZw.js} +2 -2
  21. package/dist/chunks/{dropdown-tag.DtpDzWl4.js.map → dropdown-tag.Bf6TiNZw.js.map} +1 -1
  22. package/dist/chunks/{dropdown.D0_8f9Mz.js → dropdown.Dct8gr_q.js} +19 -19
  23. package/dist/chunks/{dropdown.D0_8f9Mz.js.map → dropdown.Dct8gr_q.js.map} +1 -1
  24. package/dist/chunks/es6.C1DXQV6f.js.map +1 -1
  25. package/dist/chunks/{filter-bar.D0BEt7ia.js → filter-bar.DHRuvmx9.js} +6 -6
  26. package/dist/chunks/{filter-bar.D0BEt7ia.js.map → filter-bar.DHRuvmx9.js.map} +1 -1
  27. package/dist/chunks/{header-with-views.BGIZadqh.js → header-with-views.XzJCg2Ln.js} +2 -2
  28. package/dist/chunks/{header-with-views.BGIZadqh.js.map → header-with-views.XzJCg2Ln.js.map} +1 -1
  29. package/dist/chunks/{input-field-password.DN3ltmAg.js → input-field-password.Drp3Gn3x.js} +3 -3
  30. package/dist/chunks/{input-field-password.DN3ltmAg.js.map → input-field-password.Drp3Gn3x.js.map} +1 -1
  31. package/dist/chunks/{input-field-phone-number.CouE9QiR.js → input-field-phone-number.CcCrGAZb.js} +3 -3
  32. package/dist/chunks/{input-field-phone-number.CouE9QiR.js.map → input-field-phone-number.CcCrGAZb.js.map} +1 -1
  33. package/dist/chunks/{input-field.C2SQq0V1.js → input-field.CBegTqdQ.js} +2 -2
  34. package/dist/chunks/{input-field.C2SQq0V1.js.map → input-field.CBegTqdQ.js.map} +1 -1
  35. package/dist/chunks/{pagination.Biy7xN75.js → pagination.BofKoYTB.js} +2 -2
  36. package/dist/chunks/{pagination.Biy7xN75.js.map → pagination.BofKoYTB.js.map} +1 -1
  37. package/dist/chunks/{search-bar.BF8M5OSY.js → search-bar.DrkPxPDP.js} +3 -3
  38. package/dist/chunks/{search-bar.BF8M5OSY.js.map → search-bar.DrkPxPDP.js.map} +1 -1
  39. package/dist/chunks/{secondary-nav.D2lBMjqY.js → secondary-nav.C0_VfFa9.js} +2 -2
  40. package/dist/chunks/{secondary-nav.D2lBMjqY.js.map → secondary-nav.C0_VfFa9.js.map} +1 -1
  41. package/dist/code-snippet.js +1 -1
  42. package/dist/data-grid.js +1 -1
  43. package/dist/date-picker.js +1 -1
  44. package/dist/date-range-picker.js +1 -1
  45. package/dist/dropdown.js +2 -2
  46. package/dist/filter-bar.js +1 -1
  47. package/dist/header-with-views.js +1 -1
  48. package/dist/index.js +14 -14
  49. package/dist/input-field-password.js +1 -1
  50. package/dist/input-field-phone-number.js +1 -1
  51. package/dist/input-field.js +1 -1
  52. package/dist/pagination.js +1 -1
  53. package/dist/search-bar.js +2 -2
  54. package/dist/secondary-nav.js +1 -1
  55. package/dist/styles/bento-dark.css +1 -0
  56. package/dist/styles/bento-light.css +1 -0
  57. package/dist/styles/bento.css +1 -0
  58. package/dist/styles/legacy.css +1 -0
  59. package/dist/styles/styleguide.css +1 -0
  60. package/dist/web-types.json +1 -1
  61. package/package.json +3 -3
@@ -2,14 +2,14 @@ import { ref as d, computed as u, defineComponent as te, toRef as x, watch as N,
2
2
  import { g as ue, s as U, e as ce, b as pe } from "./calendar.DKPx_cQU.js";
3
3
  import { h as me } from "./button-actions.Crj4QFAd.js";
4
4
  import { d as ve, B as fe } from "./typography.6Oo5TOMP.js";
5
- import { D as De } from "./dropdown-default-textbox.DFtFMu5G.js";
6
- import { d as be } from "./debounce.DUTu11PS.js";
7
- import { v as ye, f as ke } from "./date-input.BbZqj10S.js";
5
+ import { d as De } from "./debounce.DUTu11PS.js";
6
+ import { v as be, f as ye } from "./date-input.BbZqj10S.js";
8
7
  import { g as I } from "./generate-uid.NJ8tVoha.js";
9
8
  import { u as q } from "./index.pdBj0KQU.js";
10
- import { u as ge } from "./form-field.D_2g7vaP.js";
11
- import { u as Ie } from "./use-form-layout-loading.CWbjZiwP.js";
12
- import { B as Ce } from "./directive.Cbdox5VL.js";
9
+ import { u as ke } from "./form-field.D_2g7vaP.js";
10
+ import { u as ge } from "./use-form-layout-loading.CWbjZiwP.js";
11
+ import { B as Ie } from "./directive.Cbdox5VL.js";
12
+ import { D as Ce } from "./dropdown-default-textbox.DFtFMu5G.js";
13
13
  import { F as Be, E as K } from "./field-label.D7vU2Icm.js";
14
14
  import { _ as we } from "./_plugin-vue_export-helper.CHgC5LLL.js";
15
15
  import "../assets/date-picker.css";
@@ -93,7 +93,7 @@ const T = {
93
93
  },
94
94
  emits: ["update:model-value", "input"],
95
95
  setup(c, { emit: C }) {
96
- const a = c, E = C, { t: f } = q({ messages: T }), o = I("bento-date-picker-container"), A = I("bento-date-picker-label"), h = I("bento-date-picker-description"), D = I("bento-date-picker-error"), r = I("bento-date-picker-date-error"), O = u(() => a.label || f("datePicker", { name: o })), F = d(null), B = d(null), i = d(!1), l = d(!1), R = d(void 0), p = d(a.modelValue), { isReadOnly: L } = Ie(x(a, "readonly")), { emitValue: b } = ge(E), W = u(() => ({
96
+ const a = c, E = C, { t: f } = q({ messages: T }), o = I("bento-date-picker-container"), A = I("bento-date-picker-label"), h = I("bento-date-picker-description"), D = I("bento-date-picker-error"), r = I("bento-date-picker-date-error"), O = u(() => a.label || f("datePicker", { name: o })), F = d(null), B = d(null), i = d(!1), l = d(!1), R = d(void 0), p = d(a.modelValue), { isReadOnly: L } = ge(x(a, "readonly")), { emitValue: b } = ke(E), W = u(() => ({
97
97
  initialFocus: R.value,
98
98
  additionalContainers: [B.value.$el]
99
99
  }));
@@ -131,13 +131,13 @@ const T = {
131
131
  }, X = async () => {
132
132
  i.value && (i.value = !1, s.value = null), b(null);
133
133
  }, Z = (e) => {
134
- ye(e);
134
+ be(e);
135
135
  }, V = (e) => {
136
136
  if (e.length < 10)
137
137
  return;
138
138
  /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/.test(e) && H(new Date(e)) ? (i.value = !1, b(new Date(e))) : e && (i.value = !0, b(null));
139
- }, ee = be(V, 1e3), ae = (e) => {
140
- s.value = ke(e), l.value ? ee(s.value) : V(s.value);
139
+ }, ee = De(V, 1e3), ae = (e) => {
140
+ s.value = ye(e), l.value ? ee(s.value) : V(s.value);
141
141
  }, _ = async (e) => {
142
142
  var m;
143
143
  l.value || (e.preventDefault(), M(), await de(), p.value || (S(/* @__PURE__ */ new Date()), b(/* @__PURE__ */ new Date())), R.value = ((m = F.value) == null ? void 0 : m.$refs.calendarRef[0].focusOnDate(
@@ -161,7 +161,7 @@ const T = {
161
161
  required: e.required
162
162
  }, null, 8, ["id", "label", "tooltip-text", "optional", "required"])) : g("", !0),
163
163
  re("div", null, [
164
- Y(t(De), {
164
+ Y(t(Ce), {
165
165
  ref_key: "inputContainerRef",
166
166
  ref: B,
167
167
  "always-combobox-is-input": "",
@@ -239,11 +239,11 @@ const T = {
239
239
  _: 1
240
240
  }, 8, ["id", "open", "target-element", "aria-label", "trap-all-options"])) : g("", !0)
241
241
  ], 32)), [
242
- [t(Ce), w]
242
+ [t(Ie), w]
243
243
  ]);
244
244
  }
245
245
  }), qe = /* @__PURE__ */ we(Oe, [["__scopeId", "data-v-bc2bac33"]]);
246
246
  export {
247
247
  qe as B
248
248
  };
249
- //# sourceMappingURL=date-picker.dyp0YK9_.js.map
249
+ //# sourceMappingURL=date-picker.DGIwFh6T.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.dyp0YK9_.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 { dateToInputDateString, getDateTimeFormatter } from '@/utils/ts/format-date';\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\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 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 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 if (!dateToFormat) {\n textInputValue.value = '';\n return;\n }\n\n const date = isMonthVariant?.value ? startOfMonth(dateToFormat) : dateToFormat;\n textInputValue.value = dateToInputDateString(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 <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=\"computedTrapAllOptions\"\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=\"internalModelValue\"\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, 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\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 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 { useFormLayoutFieldLoading } 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: 1, // Monday\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 });\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 isDateIncorrect = ref(false);\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\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 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 emitValue(selectedDate);\n };\n\n const clearDatePickerValue = async () => {\n if (isDateIncorrect.value) {\n isDateIncorrect.value = false;\n textInputValue.value = null;\n }\n emitValue(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 emitValue(new Date(stringDate));\n } else if (stringDate) {\n // Only set to true if the value exists (not null/undefined)\n isDateIncorrect.value = true;\n emitValue(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 (!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","isDateIncorrect","isMonthVariant","placeholder","locale","t","useI18n","messages","textInputValue","ref","_a","computed","dateFormatOptions","getDateTimeFormatter","dateToFormat","date","startOfMonth","dateToInputDateString","__default__","props","__props","emit","__emit","datePickerContainerId","generateUid","labelId","descriptionId","errorId","dateErrorId","popoverAriaLabel","calendarContainerRef","inputContainerRef","isDatePickerOpen","initialFocusOnDatePickerOpen","internalModelValue","isReadOnly","useFormLayoutFieldLoading","toRef","emitValue","useFormFieldEmits","computedTrapAllOptions","watch","disabled","newValue","newModelValue","deprecate","dateDisplayValue","formatTextInputDisplayValue","dateErrorText","descriptionConditionalClasses","ariaDescribedBy","isDateEnabled","closeDatePicker","openDatePicker","onDateSelected","selectedDate","clearDatePickerValue","onDateKeyDown","event","valid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AAA,KAAAU,CAAA,CAAA,KAEI5D,EAAA,QAAA,IACAqC,EAAA,IAAA,KAAAuB,CAAA,CAAA,KAA8BA,MAG9B5D,EAAA,QAAA,IACAqC,EAAA,IAAA;AAAA,IACJ,GAGJwB,KAAAC,GAAAH,GAAA,GAAA,GAEAI,KAAA,CAAAH,MAAA;AACI,MAAArD,EAAA,QAAAyD,GAAAJ,CAAA,GAEA7B,EAAA,QACI8B,GAAAtD,EAAA,KAAA,IAEAoD,EAAApD,EAAA,KAAA;AAAA,IACJ,GAUJ0D,IAAA,OAAAR,MAAA;;AACI,MAAA1B,EAAA,UAGA0B,EAAA,eAAA,GAEAL,EAAA,GAGA,MAAAc,GAAA,GAGAjC,EAAA,UAEIa,EAAA,oBAAA,KAAA,CAAA,GACAT,EAAA,oBAAA,KAAA,CAAA,IAIJL,EAAA,UAAAvB,IAAAoB,EAAA,UAAA,gBAAApB,EAAA,MAAA,YAAA,GAAA;AAAA,QACqDS,EAAA,YAAA,UAAAH,EAAAkB,EAAA,KAAA,IAAAA,EAAA;AAAA,QAC2C;AAAA,YACxF;AAAA,IACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"date-picker.DGIwFh6T.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 { dateToInputDateString, getDateTimeFormatter } from '@/utils/ts/format-date';\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\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 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 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 if (!dateToFormat) {\n textInputValue.value = '';\n return;\n }\n\n const date = isMonthVariant?.value ? startOfMonth(dateToFormat) : dateToFormat;\n textInputValue.value = dateToInputDateString(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 <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=\"computedTrapAllOptions\"\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=\"internalModelValue\"\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, 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\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 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 { useFormLayoutFieldLoading } 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: 1, // Monday\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 });\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 isDateIncorrect = ref(false);\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\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 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 emitValue(selectedDate);\n };\n\n const clearDatePickerValue = async () => {\n if (isDateIncorrect.value) {\n isDateIncorrect.value = false;\n textInputValue.value = null;\n }\n emitValue(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 emitValue(new Date(stringDate));\n } else if (stringDate) {\n // Only set to true if the value exists (not null/undefined)\n isDateIncorrect.value = true;\n emitValue(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 (!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","isDateIncorrect","isMonthVariant","placeholder","locale","t","useI18n","messages","textInputValue","ref","_a","computed","dateFormatOptions","getDateTimeFormatter","dateToFormat","date","startOfMonth","dateToInputDateString","__default__","props","__props","emit","__emit","datePickerContainerId","generateUid","labelId","descriptionId","errorId","dateErrorId","popoverAriaLabel","calendarContainerRef","inputContainerRef","isDatePickerOpen","initialFocusOnDatePickerOpen","internalModelValue","isReadOnly","useFormLayoutFieldLoading","toRef","emitValue","useFormFieldEmits","computedTrapAllOptions","watch","disabled","newValue","newModelValue","deprecate","dateDisplayValue","formatTextInputDisplayValue","dateErrorText","descriptionConditionalClasses","ariaDescribedBy","isDateEnabled","closeDatePicker","openDatePicker","onDateSelected","selectedDate","clearDatePickerValue","onDateKeyDown","event","validateDateInput","validateDate","stringDate","validateDateDebounced","debounce","onDateInputChange","formatDateInputValue","onSpaceBarOrEnter","nextTick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAeOA,KAAA,CAAA;AAAA,EAAmE,iBAAAC;AAAA,EACtE,iBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,aAAAC;AAEJ,MAAA;;AACI,QAAA,EAAA,QAAAC,GAAA,GAAAC,EAAA,IAAAC,EAAA,EAAA,UAAAC,EAAA,CAAA,GAEAC,IAAAC,GAAAC,IAAAV,EAAA,UAAA,gBAAAU,EAAA,cAAA;AAyCA,SAAA;AAAA;AAAA,IAAO,kBAvCPC,EAAA,MAAA;AAEI,UAAAV,EAAA;AACI,eAAAO,EAAA;AAIJ,UAAA,CAAAR,EAAA;AACI,gBAAAG,KAAA,gBAAAA,EAAA,UAAAE,EAAA,YAAA;AAKJ,YAAAO,IAAAV,KAAA,QAAAA,EAAA,QAAA,EAAA,OAAA,QAAA,MAAA,UAAA,IAAA,EAAA,KAAA,WAAA,OAAA,SAAA,MAAA,UAAA;AAIA,aAAAW,GAAAT,EAAA,OAAAQ,CAAA,EAAA,OAAAZ,EAAA,KAAA;AAAA,IAAyF,CAAA;AAAA,IAwBzF,gBAAAQ;AAAA;AAAA,IACA,6BAlBJ,CAAAM,IAAAd,EAAA,UAAA;AAEI,UAAAC,EAAA;AACI;AAGJ,UAAA,CAAAa,GAAA;AACI,QAAAN,EAAA,QAAA;AACA;AAAA,MAAA;AAGJ,YAAAO,IAAAb,KAAA,QAAAA,EAAA,QAA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AvD,EAAA,UACIA,EAAA,QAAA,IACAO,EAAA,QAAA,OAEJ8B,EAAA,IAAA;AAAA,IAAc,GAGlBmB,IAAA,CAAAC,MAAA;AACI,MAAAC,GAAAD,CAAA;AAAA,IAAuB,GAG3BE,IAAA,CAAAC,MAAA;AAEI,UAAAA,EAAA,SAAA;AACI;AAMJ,MAFA,qDACA,KAAAA,CAAA,KAAAV,EAAA,IAAA,KAAAU,CAAA,CAAA,KAEI5D,EAAA,QAAA,IACAqC,EAAA,IAAA,KAAAuB,CAAA,CAAA,KAA8BA,MAG9B5D,EAAA,QAAA,IACAqC,EAAA,IAAA;AAAA,IACJ,GAGJwB,KAAAC,GAAAH,GAAA,GAAA,GAEAI,KAAA,CAAAH,MAAA;AACI,MAAArD,EAAA,QAAAyD,GAAAJ,CAAA,GAEA7B,EAAA,QACI8B,GAAAtD,EAAA,KAAA,IAEAoD,EAAApD,EAAA,KAAA;AAAA,IACJ,GAUJ0D,IAAA,OAAAR,MAAA;;AACI,MAAA1B,EAAA,UAGA0B,EAAA,eAAA,GAEAL,EAAA,GAGA,MAAAc,GAAA,GAGAjC,EAAA,UAEIa,EAAA,oBAAA,KAAA,CAAA,GACAT,EAAA,oBAAA,KAAA,CAAA,IAIJL,EAAA,UAAAvB,IAAAoB,EAAA,UAAA,gBAAApB,EAAA,MAAA,YAAA,GAAA;AAAA,QACqDS,EAAA,YAAA,UAAAH,EAAAkB,EAAA,KAAA,IAAAA,EAAA;AAAA,QAC2C;AAAA,YACxF;AAAA,IACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -3,22 +3,22 @@ import { g as Gt } from "./index.E60QniEu.js";
3
3
  import { B as Qt } from "./divider.Dho4_hQ7.js";
4
4
  import { h as $t, B as jt } from "./button-actions.Crj4QFAd.js";
5
5
  import { B as Pe, d as et } from "./typography.6Oo5TOMP.js";
6
- import { D as Kt } from "./dropdown-default-textbox.DFtFMu5G.js";
7
- import { ptBR as Vt } from "./pt-BR.CiGdfP45.js";
8
- import { ja as Xt } from "./ja.Cm9tJMi2.js";
9
- import { fr as Jt } from "./fr.Dj7wEToe.js";
6
+ import { ptBR as Kt } from "./pt-BR.CiGdfP45.js";
7
+ import { ja as Vt } from "./ja.Cm9tJMi2.js";
8
+ import { fr as Xt } from "./fr.Dj7wEToe.js";
10
9
  import { g as Tt } from "./en-US.BZii9jNW.js";
11
- import { de as Zt } from "./de.DvtL0g75.js";
10
+ import { de as Jt } from "./de.DvtL0g75.js";
12
11
  import { g as be } from "./generate-uid.NJ8tVoha.js";
13
12
  import { u as We } from "./index.pdBj0KQU.js";
14
- import { t as x, c as ge, h as pt, g as He, n as zt } from "./getTimezoneOffsetInMilliseconds.C-aIpRfB.js";
15
- import { f as q, h as bt, i as Q, j as ea, k as tt, l as ta, s as at, m as aa, n as we, o as nt, p as na, q as ra, b as ee, u as sa } from "./calendar.DKPx_cQU.js";
13
+ import { t as x, c as ge, h as pt, g as He, n as Zt } from "./getTimezoneOffsetInMilliseconds.C-aIpRfB.js";
14
+ import { f as q, h as bt, i as Q, j as zt, k as tt, l as ea, s as at, m as ta, n as we, o as nt, p as aa, q as na, b as ee, u as ra } from "./calendar.DKPx_cQU.js";
16
15
  import { s as he } from "./startOfWeek.Dxw2MhGp.js";
17
- import { u as ia } from "./use-form-layout-loading.CWbjZiwP.js";
18
- import { B as oa } from "./directive.Cbdox5VL.js";
19
- import { u as la } from "./form-field.D_2g7vaP.js";
20
- import { B as ke } from "./input-field.C2SQq0V1.js";
21
- import { B as ua } from "./dropdown.D0_8f9Mz.js";
16
+ import { u as sa } from "./use-form-layout-loading.CWbjZiwP.js";
17
+ import { B as ia } from "./directive.Cbdox5VL.js";
18
+ import { u as oa } from "./form-field.D_2g7vaP.js";
19
+ import { D as la } from "./dropdown-default-textbox.DFtFMu5G.js";
20
+ import { B as ke } from "./input-field.CBegTqdQ.js";
21
+ import { B as ua } from "./dropdown.Dct8gr_q.js";
22
22
  import { B as da } from "./segmented-control.CFlHfj3N.js";
23
23
  import { d as _e } from "./debounce.DUTu11PS.js";
24
24
  import { u as ca } from "./use-has-slot.B7eQSabc.js";
@@ -31,11 +31,11 @@ import { B as ga } from "./button-actions.types.BptAXjD8.js";
31
31
  import "../assets/date-range-picker.css";
32
32
  function Le() {
33
33
  return {
34
- de: Zt,
34
+ de: Jt,
35
35
  enUS: Tt,
36
- fr: Jt,
37
- ja: Xt,
38
- ptBR: Vt
36
+ fr: Xt,
37
+ ja: Vt,
38
+ ptBR: Kt
39
39
  };
40
40
  }
41
41
  function De(e) {
@@ -63,13 +63,13 @@ const va = ({
63
63
  o = q(r.earliest);
64
64
  else if (o) {
65
65
  const g = he(o, { weekStartsOn: e });
66
- Q(o, g) || (o = q(ea(tt(o, { weekStartsOn: e }), 1)));
66
+ Q(o, g) || (o = q(zt(tt(o, { weekStartsOn: e }), 1)));
67
67
  }
68
68
  if (r.latest)
69
69
  c = V(r.latest);
70
70
  else if (c) {
71
71
  const g = tt(c, { weekStartsOn: e });
72
- Q(c, g) || (c = V(ta(he(c, { weekStartsOn: e }), 1)));
72
+ Q(c, g) || (c = V(ea(he(c, { weekStartsOn: e }), 1)));
73
73
  }
74
74
  }
75
75
  if ((r == null ? void 0 : r.type) === "monthly") {
@@ -83,7 +83,7 @@ const va = ({
83
83
  c = V(r.latest);
84
84
  else if (c) {
85
85
  const g = rt(c);
86
- Q(c, g) || (c = rt(aa(c, 1)));
86
+ Q(c, g) || (c = rt(ta(c, 1)));
87
87
  }
88
88
  }
89
89
  if ((r == null ? void 0 : r.type) === "quarterly") {
@@ -133,7 +133,7 @@ const Ta = /[\d]/, pa = /^\d{2}$/, ba = /^\d{2}:\d{2}$/, wa = (e) => {
133
133
  };
134
134
  function Ma(e, t) {
135
135
  const a = x(e, t == null ? void 0 : t.in);
136
- return na(a, ra(a)) + 1;
136
+ return aa(a, na(a)) + 1;
137
137
  }
138
138
  function Fe(e, t) {
139
139
  return he(e, { ...t, weekStartsOn: 1 });
@@ -1124,7 +1124,7 @@ const St = {
1124
1124
  adjustEndDateInputForMonthly: le,
1125
1125
  adjustStartDateInputForQuarterly: Ue,
1126
1126
  adjustEndDateInputForQuarterly: Me
1127
- } = sa(r.firstDayOfWeek), { savedRanges: X, saveRange: re, resetSavedRanges: ue } = ya(), Y = (s) => {
1127
+ } = ra(r.firstDayOfWeek), { savedRanges: X, saveRange: re, resetSavedRanges: ue } = ya(), Y = (s) => {
1128
1128
  var l;
1129
1129
  return s ? pe(s, N.NUMERIC_DATE_YEAR_FIRST, {
1130
1130
  locale: p[(l = S.value) == null ? void 0 : l.substring(0, 2)] || p.enUS
@@ -1509,7 +1509,7 @@ function ht(e, t) {
1509
1509
  return x(e, t == null ? void 0 : t.in).getFullYear();
1510
1510
  }
1511
1511
  function an(e, t, a) {
1512
- const [n, r] = zt(
1512
+ const [n, r] = Zt(
1513
1513
  a == null ? void 0 : a.in,
1514
1514
  e,
1515
1515
  t
@@ -1670,7 +1670,7 @@ const Ge = {
1670
1670
  timeDifference: w
1671
1671
  }
1672
1672
  };
1673
- })), y = U(!1), H = U(null), h = U(!1), { isReadOnly: T } = ia(Ze(n, "readonly")), { emitValue: L } = la(a);
1673
+ })), y = U(!1), H = U(null), h = U(!1), { isReadOnly: T } = sa(Ze(n, "readonly")), { emitValue: L } = oa(a);
1674
1674
  Ce(
1675
1675
  () => n.disabled,
1676
1676
  () => {
@@ -1787,7 +1787,7 @@ const Ge = {
1787
1787
  oe("div", {
1788
1788
  onKeydown: ze(Z, ["enter"])
1789
1789
  }, [
1790
- ne(D(Kt), {
1790
+ ne(D(la), {
1791
1791
  ref_key: "inputContainerRef",
1792
1792
  ref: H,
1793
1793
  "always-combobox-is-input": "",
@@ -1880,7 +1880,7 @@ const Ge = {
1880
1880
  _: 1
1881
1881
  }, 8, ["id", "open", "target-element", "aria-label"])) : B("", !0)
1882
1882
  ])), [
1883
- [D(oa), le]
1883
+ [D(ia), le]
1884
1884
  ]);
1885
1885
  }
1886
1886
  }), qn = /* @__PURE__ */ wt(ln, [["__scopeId", "data-v-6916f9db"]]);
@@ -1893,4 +1893,4 @@ export {
1893
1893
  Le as g,
1894
1894
  Ie as i
1895
1895
  };
1896
- //# sourceMappingURL=date-range-picker.TsUvRvGy.js.map
1896
+ //# sourceMappingURL=date-range-picker.Df9XyFMH.js.map