@adyen/bento-vue3 1.68.0 → 1.68.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.
- package/dist/@types/index.d.ts +296 -25
- package/dist/action-bar.js +1 -1
- package/dist/assets/accordion-item.css +1 -1
- package/dist/assets/action-bar.css +1 -1
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/card.css +1 -1
- package/dist/assets/data-grid.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/file-uploader.css +1 -1
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/menu.css +1 -1
- package/dist/assets/modal-fullscreen.css +1 -1
- package/dist/assets/popover.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/chunks/{action-bar.C93kgr7l.js → action-bar.CflF49oL.js} +2 -2
- package/dist/chunks/{action-bar.C93kgr7l.js.map → action-bar.CflF49oL.js.map} +1 -1
- package/dist/chunks/{button-actions-with-menu.DUccmaB2.js → button-actions-with-menu.8ZYh7-9s.js} +2 -2
- package/dist/chunks/{button-actions-with-menu.DUccmaB2.js.map → button-actions-with-menu.8ZYh7-9s.js.map} +1 -1
- package/dist/chunks/{code-snippet.aucmPbLw.js → code-snippet.D5M76Qy6.js} +2 -2
- package/dist/chunks/{code-snippet.aucmPbLw.js.map → code-snippet.D5M76Qy6.js.map} +1 -1
- package/dist/chunks/{dashboard-section.CUcq2ahu.js → dashboard-section.Bhd5Lsy2.js} +2 -2
- package/dist/chunks/{dashboard-section.CUcq2ahu.js.map → dashboard-section.Bhd5Lsy2.js.map} +1 -1
- package/dist/chunks/{data-grid-template.CDsV2GFG.js → data-grid-template.DSwj7e1E.js} +2 -2
- package/dist/chunks/{data-grid-template.CDsV2GFG.js.map → data-grid-template.DSwj7e1E.js.map} +1 -1
- package/dist/chunks/{data-grid.BJHcfrTG.js → data-grid.BEdELRNZ.js} +10 -11
- package/dist/chunks/data-grid.BEdELRNZ.js.map +1 -0
- package/dist/chunks/{date-picker.DgpMAGYp.js → date-picker.CAoXTiZR.js} +14 -14
- package/dist/chunks/{date-picker.DgpMAGYp.js.map → date-picker.CAoXTiZR.js.map} +1 -1
- package/dist/chunks/{date-range-picker.Bxa_f6Q0.js → date-range-picker.DtV4L3L6.js} +22 -22
- package/dist/chunks/{date-range-picker.Bxa_f6Q0.js.map → date-range-picker.DtV4L3L6.js.map} +1 -1
- package/dist/chunks/{dropdown-tag.AV8Pi1SS.js → dropdown-tag.B3fptORX.js} +2 -2
- package/dist/chunks/{dropdown-tag.AV8Pi1SS.js.map → dropdown-tag.B3fptORX.js.map} +1 -1
- package/dist/chunks/{dropdown.CJBk1euy.js → dropdown.CMOYmQLB.js} +24 -24
- package/dist/chunks/{dropdown.CJBk1euy.js.map → dropdown.CMOYmQLB.js.map} +1 -1
- package/dist/chunks/{filter-bar.6D-9UEng.js → filter-bar.DoHMLZ4O.js} +6 -6
- package/dist/chunks/{filter-bar.6D-9UEng.js.map → filter-bar.DoHMLZ4O.js.map} +1 -1
- package/dist/chunks/{header-with-views.DbBUHvvE.js → header-with-views.BUed3ocZ.js} +4 -4
- package/dist/chunks/{header-with-views.DbBUHvvE.js.map → header-with-views.BUed3ocZ.js.map} +1 -1
- package/dist/chunks/{header.wiq0wlgm.js → header.CwKjDgKv.js} +2 -2
- package/dist/chunks/{header.wiq0wlgm.js.map → header.CwKjDgKv.js.map} +1 -1
- package/dist/chunks/{input-field-password.Cr3A_4n0.js → input-field-password.DN0Jro1V.js} +3 -3
- package/dist/chunks/{input-field-password.Cr3A_4n0.js.map → input-field-password.DN0Jro1V.js.map} +1 -1
- package/dist/chunks/{input-field-phone-number.DZp5IzU3.js → input-field-phone-number.BhPsrafR.js} +3 -3
- package/dist/chunks/{input-field-phone-number.DZp5IzU3.js.map → input-field-phone-number.BhPsrafR.js.map} +1 -1
- package/dist/chunks/{input-field.CmV2d_Zc.js → input-field.su5Cq8Dt.js} +2 -2
- package/dist/chunks/{input-field.CmV2d_Zc.js.map → input-field.su5Cq8Dt.js.map} +1 -1
- package/dist/chunks/{menu.C-3obPGl.js → menu.EtjeOPXX.js} +182 -183
- package/dist/chunks/menu.EtjeOPXX.js.map +1 -0
- package/dist/chunks/{pagination.DLYrWpKr.js → pagination.fYQak4C8.js} +2 -2
- package/dist/chunks/{pagination.DLYrWpKr.js.map → pagination.fYQak4C8.js.map} +1 -1
- package/dist/chunks/popover.types.V8old-GW.js.map +1 -1
- package/dist/chunks/{search-bar.CpQ_MEVj.js → search-bar.CUrcP_wf.js} +3 -3
- package/dist/chunks/{search-bar.CpQ_MEVj.js.map → search-bar.CUrcP_wf.js.map} +1 -1
- package/dist/chunks/{secondary-nav.RTBLEukC.js → secondary-nav.j3ddtYoZ.js} +2 -2
- package/dist/chunks/{secondary-nav.RTBLEukC.js.map → secondary-nav.j3ddtYoZ.js.map} +1 -1
- package/dist/chunks/{tutorial.vue_vue_type_script_setup_true_lang.nYHtTHqy.js → tutorial.vue_vue_type_script_setup_true_lang.Dmf8fGaM.js} +2 -2
- package/dist/chunks/{tutorial.vue_vue_type_script_setup_true_lang.nYHtTHqy.js.map → tutorial.vue_vue_type_script_setup_true_lang.Dmf8fGaM.js.map} +1 -1
- package/dist/code-snippet.js +1 -1
- package/dist/dashboard-template.js +1 -1
- package/dist/data-grid-template.js +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/date-picker.js +1 -1
- package/dist/date-range-picker.js +1 -1
- package/dist/dropdown.js +2 -2
- package/dist/filter-bar.js +1 -1
- package/dist/header-with-views.js +1 -1
- package/dist/header.js +1 -1
- package/dist/index.js +20 -20
- package/dist/input-field-password.js +1 -1
- package/dist/input-field-phone-number.js +1 -1
- package/dist/input-field.js +1 -1
- package/dist/internal.js +1 -1
- package/dist/menu.js +1 -1
- package/dist/pagination.js +1 -1
- package/dist/search-bar.js +2 -2
- package/dist/secondary-nav.js +1 -1
- package/dist/tutorial.js +1 -1
- package/dist/web-types.json +1 -1
- package/package.json +2 -2
- package/dist/chunks/data-grid.BJHcfrTG.js.map +0 -1
- package/dist/chunks/menu.C-3obPGl.js.map +0 -1
|
@@ -2,15 +2,15 @@ import { ref as P, computed as D, defineComponent as X, toRef as U, watch as Z,
|
|
|
2
2
|
import { f as h, s as M, a as I } from "./calendar._oPk_A1C.js";
|
|
3
3
|
import { B as oe } from "./popover.DYgCCUCJ.js";
|
|
4
4
|
import { B as le } from "./typography.DN5eC5ch.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { D as ie } from "./dropdown-default-textbox.Ce5D3ipi.js";
|
|
6
|
+
import { d as se } from "./debounce.DUTu11PS.js";
|
|
7
|
+
import { D as O, v as de, f as ue } from "./date-input.BqBdAO1E.js";
|
|
7
8
|
import { g as C } from "./generate-uid.NJ8tVoha.js";
|
|
8
9
|
import { u as K } from "./i18n.B6g5VX0q.js";
|
|
9
|
-
import { g as
|
|
10
|
-
import { u as
|
|
11
|
-
import { B as
|
|
10
|
+
import { g as pe } from "./get-date-locale.CAyOIbcp.js";
|
|
11
|
+
import { u as ce } from "./use-form-layout-loading.D3lALhtC.js";
|
|
12
|
+
import { B as fe } from "./directive.Cbdox5VL.js";
|
|
12
13
|
import "./events.FNmSWp_P.js";
|
|
13
|
-
import { D as fe } from "./dropdown-default-textbox.Ce5D3ipi.js";
|
|
14
14
|
import { F as me, E as De } from "./error-message.DHMHq9bR.js";
|
|
15
15
|
import { _ as ve } from "./_plugin-vue_export-helper.CHgC5LLL.js";
|
|
16
16
|
import "../assets/date-picker.css";
|
|
@@ -20,7 +20,7 @@ const be = ({
|
|
|
20
20
|
isMonthVariant: n
|
|
21
21
|
}) => {
|
|
22
22
|
var s;
|
|
23
|
-
const { locale: c, t: E } = K(), l =
|
|
23
|
+
const { locale: c, t: E } = K(), l = pe(), i = P((s = e.value) == null ? void 0 : s.toDateString());
|
|
24
24
|
return {
|
|
25
25
|
// Values
|
|
26
26
|
dateDisplayValue: D(() => t.value ? i.value : e.value ? h(
|
|
@@ -67,10 +67,10 @@ const F = {
|
|
|
67
67
|
BentoPopover: oe,
|
|
68
68
|
Calendar: I,
|
|
69
69
|
ErrorMessage: De,
|
|
70
|
-
DropdownInputDefault:
|
|
70
|
+
DropdownInputDefault: ie,
|
|
71
71
|
FieldLabel: me
|
|
72
72
|
},
|
|
73
|
-
directives: { BentoClickOutsideDirective:
|
|
73
|
+
directives: { BentoClickOutsideDirective: fe },
|
|
74
74
|
props: {
|
|
75
75
|
/**
|
|
76
76
|
* Descriptive supporting text visbile underneath the dropdown.
|
|
@@ -143,7 +143,7 @@ const F = {
|
|
|
143
143
|
},
|
|
144
144
|
emits: [p.INPUT],
|
|
145
145
|
setup(e, { emit: t }) {
|
|
146
|
-
const { t: n } = K({ messages: F }), c = C("bento-date-picker-container"), E = C("bento-date-picker-label"), l = C("bento-date-picker-description"), i = C("bento-date-picker-error"), v = C("bento-date-picker-date-error"), b = D(() => e.label || n("datePicker", { name: c })), s = P(null), d = P(null), r = P(!1), o = P(!1), { isReadOnly: y } =
|
|
146
|
+
const { t: n } = K({ messages: F }), c = C("bento-date-picker-container"), E = C("bento-date-picker-label"), l = C("bento-date-picker-description"), i = C("bento-date-picker-error"), v = C("bento-date-picker-date-error"), b = D(() => e.label || n("datePicker", { name: c })), s = P(null), d = P(null), r = P(!1), o = P(!1), { isReadOnly: y } = ce(U(e, "readonly"));
|
|
147
147
|
Z(
|
|
148
148
|
() => e.disabled,
|
|
149
149
|
(a) => {
|
|
@@ -167,12 +167,12 @@ const F = {
|
|
|
167
167
|
}, H = async () => {
|
|
168
168
|
r.value && (r.value = !1, u.value = null), t(p.INPUT, null);
|
|
169
169
|
}, J = (a) => {
|
|
170
|
-
|
|
170
|
+
de(a);
|
|
171
171
|
}, N = (a) => {
|
|
172
172
|
if (a.length < 10)
|
|
173
173
|
return;
|
|
174
174
|
/^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/.test(a) && z(new Date(a)) ? (r.value = !1, t(p.INPUT, new Date(a))) : a && (r.value = !0, t(p.INPUT, null));
|
|
175
|
-
}, Q =
|
|
175
|
+
}, Q = se(N, ye);
|
|
176
176
|
return {
|
|
177
177
|
// Refs
|
|
178
178
|
inputContainerRef: d,
|
|
@@ -199,7 +199,7 @@ const F = {
|
|
|
199
199
|
openDatePicker: R,
|
|
200
200
|
onDateKeyDown: J,
|
|
201
201
|
onDateInputChange: (a) => {
|
|
202
|
-
u.value =
|
|
202
|
+
u.value = ue(a), o.value ? Q(u.value) : N(u.value);
|
|
203
203
|
},
|
|
204
204
|
// Keyboard navigation
|
|
205
205
|
onSpaceBarOrEnter: async (a) => {
|
|
@@ -311,4 +311,4 @@ export {
|
|
|
311
311
|
Me as B,
|
|
312
312
|
p as a
|
|
313
313
|
};
|
|
314
|
-
//# sourceMappingURL=date-picker.
|
|
314
|
+
//# sourceMappingURL=date-picker.CAoXTiZR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.DgpMAGYp.js","sources":["../../../vue2/src/components/date-picker/composables/use-date-picker-single-calendar-text.ts","../../../vue2/src/components/date-picker/date-picker.types.ts","../../../vue2/src/components/date-picker/date-picker.vue"],"sourcesContent":["import { computed, ref } from 'vue';\nimport { useI18n } from '@/utils/ts/i18n';\nimport { UseDateDisplayText } from './use-date-picker-single-calendar-text.types';\nimport { DateFormat } from '@/types';\nimport { getDateLocale } from '@/utils/ts/get-date-locale/get-date-locale';\nimport format from 'date-fns/format';\nimport startOfMonth from 'date-fns/startOfMonth';\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}) => {\n const { locale, t } = useI18n();\n const locales = getDateLocale();\n\n const textInputValue = ref(datePickerValue.value?.toDateString());\n\n const dateDisplayValue = computed(() => {\n // Display incorrect date when there's an error with the input\n if (isDateIncorrect.value) {\n return textInputValue.value;\n }\n\n // Display \"Select a date\" when there's no date selected or input\n if (!datePickerValue.value) {\n return t('selectDate') as string;\n }\n\n // Display the date in format \"dd MMM, yyyy (25 Jun, 2023)\" or \"MMMM yyyy (June 2023)\"\n // if there's a valid date selected\n return format(\n datePickerValue.value,\n isMonthVariant?.value ? DateFormat.LONG_MONTH_YEAR : DateFormat.FULL_DATE,\n {\n locale: locales[locale.value.substring(0, 2)] || locales.enUS,\n }\n );\n });\n\n /**\n * Formats the \"dateToFormat\" date value with the yyyy-MM-dd format and sets it as \"formatTextInputDisplayValue\" value\n * @param {Date} dateToFormat - Date to be assigned and formatted\n */\n const formatTextInputDisplayValue = (dateToFormat: Date = datePickerValue.value) => {\n // If date is incorrect, leave the textInputValue intact\n if (isDateIncorrect.value) {\n return;\n }\n\n const date = isMonthVariant?.value ? startOfMonth(dateToFormat) : dateToFormat;\n textInputValue.value = dateToFormat\n ? format(date, DateFormat.NUMERIC_DATE_YEAR_FIRST, {\n locale: locales[locale.value.substring(0, 2)] || locales.enUS,\n })\n : null;\n };\n\n return {\n // Values\n dateDisplayValue,\n textInputValue,\n\n // Methods\n formatTextInputDisplayValue,\n };\n};\n","export { CalendarFirstDayOfWeek as BentoDatePickerFirstDayOfWeek } from '@/internal';\nexport type {\n CalendarIsDateDisabled as BentoDatePickerIsDateDisabled,\n CalendarSingleDateValue as BentoDatePickerValue,\n CalendarVariant as BentoDatePickerVariant,\n} from '@/internal';\n\nexport enum BentoDatePickerEvent {\n INPUT = 'input',\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 :disable-focus-trap=\"true\"\n :aria-label=\"popoverAriaLabel\"\n :aria-modal=\"true\"\n position=\"bottom-start\"\n fit-content\n >\n <calendar\n ref=\"calendarContainerRef\"\n :default-display-month=\"defaultDisplayMonth\"\n :first-day-of-week=\"firstDayOfWeek\"\n :is-date-disabled=\"isDateDisabled\"\n :number-of-months=\"1\"\n :value=\"value\"\n :min=\"min\"\n :max=\"max\"\n :variant=\"variant\"\n @input=\"onDateSelected\"\n />\n </bento-popover>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, nextTick, PropType, Ref, ref, toRef, watch } from 'vue';\n import startOfMonth from 'date-fns/startOfMonth';\n\n // Components\n import { BentoPopover } from '@/components/popover';\n import { BentoTypography } from '../typography';\n import { Calendar, ErrorMessage, FieldLabel } from '@/internal';\n import { DropdownInputDefault } from '@/components/dropdown/components';\n\n // Utils\n import { debounce } from '@/utils/ts/debounce';\n import { formatDateInputValue, validateDateInput } from '@/utils/ts/date-input';\n import { generateUid } from '@/core/utils/ts';\n import { useI18n } from '@/utils/ts/i18n';\n\n // Composables\n import { useDatePickerSingleCalendarText } from './composables/use-date-picker-single-calendar-text';\n import { useFormLayoutFieldLoading } from '@/composables';\n\n // Directive\n import { BentoClickOutsideDirective } from '@/directives';\n\n // Types\n import { BentoDatePickerEvent, BentoDatePickerValue, BentoDatePickerVariant } 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 /**\n * Date picker selector.\n *\n * @example\n * import { BentoDatePicker } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoDatePicker },\n * template: `\n * <bento-date-picker\n * label=\"Label\"\n * description=\"Supporting text\"\n * required\n * optional\n * disabled\n * @input=\"onDateChanged\"\n * v-model=\"selectedDate\"\n * />\n * `,\n * setup() {\n * const selectedDate = ref(new Date()); // reactive({ startDate: new Date(), endDate: new Date() })\n * return {\n * selectedDate,\n * }\n * }\n * }\n */\n export default defineComponent({\n i18n: { messages },\n name: 'bento-date-picker',\n components: {\n BentoTypography,\n BentoPopover,\n Calendar,\n ErrorMessage,\n DropdownInputDefault,\n FieldLabel,\n },\n directives: { BentoClickOutsideDirective },\n props: {\n /**\n * Descriptive supporting text visbile underneath the dropdown.\n */\n description: { type: String, default: undefined },\n\n /**\n * Disables dropdown functionality.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Displays component in an error state with an error message\n */\n errorMessage: { type: String, default: null },\n\n /**\n * Allows you to set the first day of the week. 0 is sunday, 1 is monday, 6 is saturday\n */\n firstDayOfWeek: Calendar.props.firstDayOfWeek,\n\n /**\n * Indicate if a date should be disabled or not\n */\n isDateDisabled: Calendar.props.isDateDisabled,\n\n /**\n * Sets a minimum limit for selectable dates - dates before `min` will not be selectable\n */\n min: Calendar.props.min,\n\n /**\n * Sets a maximum limit for selectable dates - dates after `max` will not be selectable\n */\n max: Calendar.props.max,\n\n /**\n * Text that is displayed as a label above the element.\n */\n label: { type: String, default: undefined },\n\n /**\n * Highlights the dropdown is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * The Boolean readonly property, when present, makes the element not mutable, meaning the user can not edit the date picker.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Highlights the dropdown is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Adds a info icon next to the label to display the passed tooltip message.\n */\n tooltipText: { type: String, default: null },\n\n /**\n * Selected date\n */\n value: { type: [Date, Object] as PropType<BentoDatePickerValue>, default: null },\n\n /**\n * The type of calendar to display. Defaults to showing days.\n */\n variant: {\n type: String as PropType<`${BentoDatePickerVariant}`>,\n default: undefined, // Default will be set by @/internal/calendar\n },\n\n /**\n * Default start date for the calendar pane\n */\n defaultDisplayMonth: {\n type: String,\n default: null,\n validator: (value: string) => {\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(value);\n\n return isValidDate;\n },\n },\n },\n emits: [BentoDatePickerEvent.INPUT],\n setup(props, { emit }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const datePickerContainerId = generateUid('bento-date-picker-container');\n const labelId = generateUid('bento-date-picker-label');\n const descriptionId = generateUid('bento-date-picker-description');\n const errorId = generateUid('bento-date-picker-error');\n const dateErrorId = generateUid('bento-date-picker-date-error');\n const popoverAriaLabel = computed(() => props.label || t('datePicker', { name: datePickerContainerId }));\n\n // Refs\n const calendarContainerRef = ref(null);\n const inputContainerRef = ref(null);\n\n // Values\n const isDateIncorrect = ref(false);\n const isDatePickerOpen = ref(false);\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n watch(\n () => props.disabled,\n disabled => {\n // Close date picker popover if it's opened when it's disabled\n if (disabled && isDatePickerOpen.value) {\n isDatePickerOpen.value = false;\n }\n }\n );\n\n const isMonthVariant = computed(() => props.variant === 'month');\n\n const { dateDisplayValue, textInputValue, formatTextInputDisplayValue } = useDatePickerSingleCalendarText({\n datePickerValue: toRef(props, 'value') as Ref<Date>,\n isDateIncorrect,\n isMonthVariant,\n });\n\n const dateErrorText = computed(() => {\n if (\n props.isDateDisabled &&\n textInputValue.value &&\n props.isDateDisabled(new Date(textInputValue.value)) &&\n !isDatePickerOpen.value\n ) {\n return t('selectedDateIsNotAvailable');\n }\n\n return isDateIncorrect.value ? t('provideDateInAFormat') : null;\n });\n\n const descriptionConditionalClasses = computed(() => ({\n 'b-date-picker__description--error': props.errorMessage || dateErrorText.value,\n }));\n\n const ariaDescribedBy = computed(\n () =>\n `${props.description ? descriptionId : ''} ${props.errorMessage ? errorId : ''} ${\n dateErrorText.value ? dateErrorId : ''\n }`.trim() || null\n );\n\n const isDateEnabled = (date: Date) => {\n // Check if date is between min/max bounds, if there are any\n if ((props.min && date <= props.min) || (props.max && date >= props.max)) {\n return false;\n }\n\n // Check if function is set, otherwise all dates are enabled\n if (props.isDateDisabled) {\n return !props.isDateDisabled(date);\n }\n\n return true;\n };\n\n const closeDatePicker = () => {\n isDatePickerOpen.value = false;\n };\n\n const openDatePicker = () => {\n isDatePickerOpen.value = true;\n\n formatTextInputDisplayValue();\n };\n\n const onDateSelected = (selectedDate: Date) => {\n // Reset the error state when a valid date is selected\n isDateIncorrect.value = false;\n\n closeDatePicker();\n emit(BentoDatePickerEvent.INPUT, selectedDate);\n };\n\n const clearDatePickerValue = async () => {\n if (isDateIncorrect.value) {\n isDateIncorrect.value = false;\n textInputValue.value = null;\n }\n emit(BentoDatePickerEvent.INPUT, null);\n };\n\n const onDateKeyDown = (event: KeyboardEvent) => {\n validateDateInput(event);\n };\n\n const validateDate = (stringDate: string) => {\n // Validate only if the date is complete\n if (stringDate.length < 10) {\n return;\n }\n\n // Checks for YYYY-MM-DD format\n const dateRegex = /^\\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/;\n const isValidDate = dateRegex.test(stringDate) && isDateEnabled(new Date(stringDate));\n if (isValidDate) {\n isDateIncorrect.value = false;\n emit(BentoDatePickerEvent.INPUT, new Date(stringDate));\n } else if (stringDate) {\n // Only set to true if the value exists (not null/undefined)\n isDateIncorrect.value = true;\n emit(BentoDatePickerEvent.INPUT, null);\n }\n };\n\n const validateDateDebounced = debounce(validateDate, DEBOUNCE_TIME);\n\n const onDateInputChange = (stringDate: string) => {\n textInputValue.value = formatDateInputValue(stringDate);\n // If we are closing the date picker, we should validate (and emit date inputs) immediately so the user doesn't have to wait for the debounce time.\n if (isDatePickerOpen.value) {\n validateDateDebounced(textInputValue.value);\n } else {\n validateDate(textInputValue.value);\n }\n };\n\n /**\n * Space bar and Enter keyDown event handler.\n *\n * * Opens the date picker dialog on the first keydown.\n * * Move focus to selected date, i.e., the date displayed in the date input text field. If no date has been selected, places focus on the current date.\n * @param {KeyboardEvent} event Event being triggered\n */\n const onSpaceBarOrEnter = async (event: KeyboardEvent) => {\n if (isDatePickerOpen.value) {\n return;\n }\n event.preventDefault();\n\n openDatePicker();\n\n // Wait for the date picker dialog to open\n await nextTick();\n\n // Set current date (today) if no date is selected\n if (!props.value) {\n // Format the opened date picker date to YYYY-MM-DD\n formatTextInputDisplayValue(new Date());\n emit(BentoDatePickerEvent.INPUT, new Date());\n\n // Wait for new value to be set with the emit\n await nextTick();\n }\n\n // Focus on date\n calendarContainerRef.value?.$refs.calendarRef[0].focusOnDate(\n props.variant === 'month' ? startOfMonth(props.value) : props.value\n );\n };\n\n return {\n // Refs\n inputContainerRef,\n calendarContainerRef,\n\n // Values,\n dateDisplayValue,\n datePickerContainerId,\n descriptionConditionalClasses,\n isDateIncorrect,\n isDatePickerOpen,\n isReadOnly,\n dateErrorText,\n labelId,\n descriptionId,\n errorId,\n dateErrorId,\n popoverAriaLabel,\n ariaDescribedBy,\n textInputValue,\n\n // Events\n closeDatePicker,\n clearDatePickerValue,\n onDateSelected,\n openDatePicker,\n onDateKeyDown,\n onDateInputChange,\n\n // Keyboard navigation\n onSpaceBarOrEnter,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./date-picker.scss\" />\n"],"names":["useDatePickerSingleCalendarText","datePickerValue","isDateIncorrect","isMonthVariant","locale","t","useI18n","locales","getDateLocale","textInputValue","ref","_a","computed","format","DateFormat","dateToFormat","date","startOfMonth","BentoDatePickerEvent","BentoDatePickerEvent2","DEBOUNCE_TIME","_sfc_main","defineComponent","messages","BentoTypography","BentoPopover","Calendar","ErrorMessage","DropdownInputDefault","FieldLabel","BentoClickOutsideDirective","value","props","emit","datePickerContainerId","generateUid","labelId","descriptionId","errorId","dateErrorId","popoverAriaLabel","calendarContainerRef","inputContainerRef","isDatePickerOpen","isReadOnly","useFormLayoutFieldLoading","toRef","watch","disabled","dateDisplayValue","formatTextInputDisplayValue","dateErrorText","descriptionConditionalClasses","ariaDescribedBy","isDateEnabled","closeDatePicker","openDatePicker","onDateSelected","selectedDate","clearDatePickerValue","onDateKeyDown","event","validateDateInput","validateDate","stringDate","validateDateDebounced","debounce","formatDateInputValue","nextTick","withDirectives","openBlock","createElementBlock","_ctx","createBlock","_component_field_label","optional","required","createCommentVNode","createElementVNode","createVNode","_component_dropdown_input_default","label","onDateInputChange","_component_error_message","_component_bento_typography","normalizeClass","createTextVNode","toDisplayString","_component_bento_popover","withCtx","_component_calendar","defaultDisplayMonth","isDateDisab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OAAA,CAAA,KAAAK,EAAA,IAAA,EAAA;AAAA,IA8FwBL,EAAA,qBAAAF,EAAA,GAAAG,EAAAe,GAAA;AAAA,MAvBc,KAAA;AAAA,MACrB,IAAAhB,EAAA;AAAA,MACA,OAAA;AAAA,MACE7B,MAAAA;AAAAA,MACN,MAAA6B,EAAA;AAAA,MACA,kBAAAA,EAAA;AAAA,MACYhC,sBAAAA;AAAAA,MACI,cAAAgC,EAAA;AAAA,MACR,cAAA;AAAA,MACE,UAAA;AAAA,MAhFvB,eAAA;AAAA,IAAA,GAAA;AAAA,MAmFoB,SAAAiB,EAAA,MAAA;AAAA,QAAAV,EAAAW,GAAA;AAAA,UACoBC,KAAAA;AAAAA,UACvB,yBAAAnB,EAAA;AAAA,UACkBoB,qBAAAA,EAAAA;AAAAA,UACC,oBAAApB,EAAA;AAAA,UACP,oBAAA;AAAA,UACJ,OAAAA,EAAA;AAAA,UACHqB,KAAAA,EAAAA;AAAAA,UACIC,KAAAA,EAAAA;AAAAA,UACFrC,SAAAA,EAAAA;AAAAA;QA5FxB,GAAA,MAAA,GAAA,CAAA,yBAAA,qBAAA,oBAAA,SAAA,OAAA,OAAA,WAAA,SAAA,CAAA;AAAA,MAAA,CAAA;AAAA,MAAA,GAAA;AAAA,IAAA,GAAA,GAAA,CAAA,MAAA,QAAA,kBAAA,YAAA,CAAA,KAAAoB,EAAA,IAAA,EAAA;AAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"date-picker.CAoXTiZR.js","sources":["../../../vue2/src/components/date-picker/composables/use-date-picker-single-calendar-text.ts","../../../vue2/src/components/date-picker/date-picker.types.ts","../../../vue2/src/components/date-picker/date-picker.vue"],"sourcesContent":["import { computed, ref } from 'vue';\nimport { useI18n } from '@/utils/ts/i18n';\nimport { UseDateDisplayText } from './use-date-picker-single-calendar-text.types';\nimport { DateFormat } from '@/types';\nimport { getDateLocale } from '@/utils/ts/get-date-locale/get-date-locale';\nimport format from 'date-fns/format';\nimport startOfMonth from 'date-fns/startOfMonth';\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}) => {\n const { locale, t } = useI18n();\n const locales = getDateLocale();\n\n const textInputValue = ref(datePickerValue.value?.toDateString());\n\n const dateDisplayValue = computed(() => {\n // Display incorrect date when there's an error with the input\n if (isDateIncorrect.value) {\n return textInputValue.value;\n }\n\n // Display \"Select a date\" when there's no date selected or input\n if (!datePickerValue.value) {\n return t('selectDate') as string;\n }\n\n // Display the date in format \"dd MMM, yyyy (25 Jun, 2023)\" or \"MMMM yyyy (June 2023)\"\n // if there's a valid date selected\n return format(\n datePickerValue.value,\n isMonthVariant?.value ? DateFormat.LONG_MONTH_YEAR : DateFormat.FULL_DATE,\n {\n locale: locales[locale.value.substring(0, 2)] || locales.enUS,\n }\n );\n });\n\n /**\n * Formats the \"dateToFormat\" date value with the yyyy-MM-dd format and sets it as \"formatTextInputDisplayValue\" value\n * @param {Date} dateToFormat - Date to be assigned and formatted\n */\n const formatTextInputDisplayValue = (dateToFormat: Date = datePickerValue.value) => {\n // If date is incorrect, leave the textInputValue intact\n if (isDateIncorrect.value) {\n return;\n }\n\n const date = isMonthVariant?.value ? startOfMonth(dateToFormat) : dateToFormat;\n textInputValue.value = dateToFormat\n ? format(date, DateFormat.NUMERIC_DATE_YEAR_FIRST, {\n locale: locales[locale.value.substring(0, 2)] || locales.enUS,\n })\n : null;\n };\n\n return {\n // Values\n dateDisplayValue,\n textInputValue,\n\n // Methods\n formatTextInputDisplayValue,\n };\n};\n","export { CalendarFirstDayOfWeek as BentoDatePickerFirstDayOfWeek } from '@/internal';\nexport type {\n CalendarIsDateDisabled as BentoDatePickerIsDateDisabled,\n CalendarSingleDateValue as BentoDatePickerValue,\n CalendarVariant as BentoDatePickerVariant,\n} from '@/internal';\n\nexport enum BentoDatePickerEvent {\n INPUT = 'input',\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 :disable-focus-trap=\"true\"\n :aria-label=\"popoverAriaLabel\"\n :aria-modal=\"true\"\n position=\"bottom-start\"\n fit-content\n >\n <calendar\n ref=\"calendarContainerRef\"\n :default-display-month=\"defaultDisplayMonth\"\n :first-day-of-week=\"firstDayOfWeek\"\n :is-date-disabled=\"isDateDisabled\"\n :number-of-months=\"1\"\n :value=\"value\"\n :min=\"min\"\n :max=\"max\"\n :variant=\"variant\"\n @input=\"onDateSelected\"\n />\n </bento-popover>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, nextTick, PropType, Ref, ref, toRef, watch } from 'vue';\n import startOfMonth from 'date-fns/startOfMonth';\n\n // Components\n import { BentoPopover } from '@/components/popover';\n import { BentoTypography } from '../typography';\n import { Calendar, ErrorMessage, FieldLabel } from '@/internal';\n import { DropdownInputDefault } from '@/components/dropdown/components';\n\n // Utils\n import { debounce } from '@/utils/ts/debounce';\n import { formatDateInputValue, validateDateInput } from '@/utils/ts/date-input';\n import { generateUid } from '@/core/utils/ts';\n import { useI18n } from '@/utils/ts/i18n';\n\n // Composables\n import { useDatePickerSingleCalendarText } from './composables/use-date-picker-single-calendar-text';\n import { useFormLayoutFieldLoading } from '@/composables';\n\n // Directive\n import { BentoClickOutsideDirective } from '@/directives';\n\n // Types\n import { BentoDatePickerEvent, BentoDatePickerValue, BentoDatePickerVariant } 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 /**\n * Date picker selector.\n *\n * @example\n * import { BentoDatePicker } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoDatePicker },\n * template: `\n * <bento-date-picker\n * label=\"Label\"\n * description=\"Supporting text\"\n * required\n * optional\n * disabled\n * @input=\"onDateChanged\"\n * v-model=\"selectedDate\"\n * />\n * `,\n * setup() {\n * const selectedDate = ref(new Date()); // reactive({ startDate: new Date(), endDate: new Date() })\n * return {\n * selectedDate,\n * }\n * }\n * }\n */\n export default defineComponent({\n i18n: { messages },\n name: 'bento-date-picker',\n components: {\n BentoTypography,\n BentoPopover,\n Calendar,\n ErrorMessage,\n DropdownInputDefault,\n FieldLabel,\n },\n directives: { BentoClickOutsideDirective },\n props: {\n /**\n * Descriptive supporting text visbile underneath the dropdown.\n */\n description: { type: String, default: undefined },\n\n /**\n * Disables dropdown functionality.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Displays component in an error state with an error message\n */\n errorMessage: { type: String, default: null },\n\n /**\n * Allows you to set the first day of the week. 0 is sunday, 1 is monday, 6 is saturday\n */\n firstDayOfWeek: Calendar.props.firstDayOfWeek,\n\n /**\n * Indicate if a date should be disabled or not\n */\n isDateDisabled: Calendar.props.isDateDisabled,\n\n /**\n * Sets a minimum limit for selectable dates - dates before `min` will not be selectable\n */\n min: Calendar.props.min,\n\n /**\n * Sets a maximum limit for selectable dates - dates after `max` will not be selectable\n */\n max: Calendar.props.max,\n\n /**\n * Text that is displayed as a label above the element.\n */\n label: { type: String, default: undefined },\n\n /**\n * Highlights the dropdown is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * The Boolean readonly property, when present, makes the element not mutable, meaning the user can not edit the date picker.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Highlights the dropdown is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Adds a info icon next to the label to display the passed tooltip message.\n */\n tooltipText: { type: String, default: null },\n\n /**\n * Selected date\n */\n value: { type: [Date, Object] as PropType<BentoDatePickerValue>, default: null },\n\n /**\n * The type of calendar to display. Defaults to showing days.\n */\n variant: {\n type: String as PropType<`${BentoDatePickerVariant}`>,\n default: undefined, // Default will be set by @/internal/calendar\n },\n\n /**\n * Default start date for the calendar pane\n */\n defaultDisplayMonth: {\n type: String,\n default: null,\n validator: (value: string) => {\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(value);\n\n return isValidDate;\n },\n },\n },\n emits: [BentoDatePickerEvent.INPUT],\n setup(props, { emit }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const datePickerContainerId = generateUid('bento-date-picker-container');\n const labelId = generateUid('bento-date-picker-label');\n const descriptionId = generateUid('bento-date-picker-description');\n const errorId = generateUid('bento-date-picker-error');\n const dateErrorId = generateUid('bento-date-picker-date-error');\n const popoverAriaLabel = computed(() => props.label || t('datePicker', { name: datePickerContainerId }));\n\n // Refs\n const calendarContainerRef = ref(null);\n const inputContainerRef = ref(null);\n\n // Values\n const isDateIncorrect = ref(false);\n const isDatePickerOpen = ref(false);\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n watch(\n () => props.disabled,\n disabled => {\n // Close date picker popover if it's opened when it's disabled\n if (disabled && isDatePickerOpen.value) {\n isDatePickerOpen.value = false;\n }\n }\n );\n\n const isMonthVariant = computed(() => props.variant === 'month');\n\n const { dateDisplayValue, textInputValue, formatTextInputDisplayValue } = useDatePickerSingleCalendarText({\n datePickerValue: toRef(props, 'value') as Ref<Date>,\n isDateIncorrect,\n isMonthVariant,\n });\n\n const dateErrorText = computed(() => {\n if (\n props.isDateDisabled &&\n textInputValue.value &&\n props.isDateDisabled(new Date(textInputValue.value)) &&\n !isDatePickerOpen.value\n ) {\n return t('selectedDateIsNotAvailable');\n }\n\n return isDateIncorrect.value ? t('provideDateInAFormat') : null;\n });\n\n const descriptionConditionalClasses = computed(() => ({\n 'b-date-picker__description--error': props.errorMessage || dateErrorText.value,\n }));\n\n const ariaDescribedBy = computed(\n () =>\n `${props.description ? descriptionId : ''} ${props.errorMessage ? errorId : ''} ${\n dateErrorText.value ? dateErrorId : ''\n }`.trim() || null\n );\n\n const isDateEnabled = (date: Date) => {\n // Check if date is between min/max bounds, if there are any\n if ((props.min && date <= props.min) || (props.max && date >= props.max)) {\n return false;\n }\n\n // Check if function is set, otherwise all dates are enabled\n if (props.isDateDisabled) {\n return !props.isDateDisabled(date);\n }\n\n return true;\n };\n\n const closeDatePicker = () => {\n isDatePickerOpen.value = false;\n };\n\n const openDatePicker = () => {\n isDatePickerOpen.value = true;\n\n formatTextInputDisplayValue();\n };\n\n const onDateSelected = (selectedDate: Date) => {\n // Reset the error state when a valid date is selected\n isDateIncorrect.value = false;\n\n closeDatePicker();\n emit(BentoDatePickerEvent.INPUT, selectedDate);\n };\n\n const clearDatePickerValue = async () => {\n if (isDateIncorrect.value) {\n isDateIncorrect.value = false;\n textInputValue.value = null;\n }\n emit(BentoDatePickerEvent.INPUT, null);\n };\n\n const onDateKeyDown = (event: KeyboardEvent) => {\n validateDateInput(event);\n };\n\n const validateDate = (stringDate: string) => {\n // Validate only if the date is complete\n if (stringDate.length < 10) {\n return;\n }\n\n // Checks for YYYY-MM-DD format\n const dateRegex = /^\\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/;\n const isValidDate = dateRegex.test(stringDate) && isDateEnabled(new Date(stringDate));\n if (isValidDate) {\n isDateIncorrect.value = false;\n emit(BentoDatePickerEvent.INPUT, new Date(stringDate));\n } else if (stringDate) {\n // Only set to true if the value exists (not null/undefined)\n isDateIncorrect.value = true;\n emit(BentoDatePickerEvent.INPUT, null);\n }\n };\n\n const validateDateDebounced = debounce(validateDate, DEBOUNCE_TIME);\n\n const onDateInputChange = (stringDate: string) => {\n textInputValue.value = formatDateInputValue(stringDate);\n // If we are closing the date picker, we should validate (and emit date inputs) immediately so the user doesn't have to wait for the debounce time.\n if (isDatePickerOpen.value) {\n validateDateDebounced(textInputValue.value);\n } else {\n validateDate(textInputValue.value);\n }\n };\n\n /**\n * Space bar and Enter keyDown event handler.\n *\n * * Opens the date picker dialog on the first keydown.\n * * Move focus to selected date, i.e., the date displayed in the date input text field. If no date has been selected, places focus on the current date.\n * @param {KeyboardEvent} event Event being triggered\n */\n const onSpaceBarOrEnter = async (event: KeyboardEvent) => {\n if (isDatePickerOpen.value) {\n return;\n }\n event.preventDefault();\n\n openDatePicker();\n\n // Wait for the date picker dialog to open\n await nextTick();\n\n // Set current date (today) if no date is selected\n if (!props.value) {\n // Format the opened date picker date to YYYY-MM-DD\n formatTextInputDisplayValue(new Date());\n emit(BentoDatePickerEvent.INPUT, new Date());\n\n // Wait for new value to be set with the emit\n await nextTick();\n }\n\n // Focus on date\n calendarContainerRef.value?.$refs.calendarRef[0].focusOnDate(\n props.variant === 'month' ? startOfMonth(props.value) : props.value\n );\n };\n\n return {\n // Refs\n inputContainerRef,\n calendarContainerRef,\n\n // Values,\n dateDisplayValue,\n datePickerContainerId,\n descriptionConditionalClasses,\n isDateIncorrect,\n isDatePickerOpen,\n isReadOnly,\n dateErrorText,\n labelId,\n descriptionId,\n errorId,\n dateErrorId,\n popoverAriaLabel,\n ariaDescribedBy,\n textInputValue,\n\n // Events\n closeDatePicker,\n clearDatePickerValue,\n onDateSelected,\n openDatePicker,\n onDateKeyDown,\n onDateInputChange,\n\n // Keyboard navigation\n onSpaceBarOrEnter,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./date-picker.scss\" />\n"],"names":["useDatePickerSingleCalendarText","datePickerValue","isDateIncorrect","isMonthVariant","locale","t","useI18n","locales","getDateLocale","textInputValue","ref","_a","computed","format","DateFormat","dateToFormat","date","startOfMonth","BentoDatePickerEvent","BentoDatePickerEvent2","DEBOUNCE_TIME","_sfc_main","defineComponent","messages","BentoTypography","BentoPopover","Calendar","ErrorMessage","DropdownInputDefault","FieldLabel","BentoClickOutsideDirective","value","props","emit","datePickerContainerId","generateUid","labelId","descriptionId","errorId","dateErrorId","popoverAriaLabel","calendarContainerRef","inputContainerRef","isDatePickerOpen","isReadOnly","useFormLayoutFieldLoading","toRef","watch","disabled","dateDisplayValue","formatTextInputDisplayValue","dateErrorText","descriptionConditionalClasses","ariaDescribedBy","isDateEnabled","closeDatePicker","openDatePicker","onDateSelected","selectedDate","clearDatePickerValue","onDateKeyDown","event","validateDateInput","validateDate","stringDate","validateDateDebounced","debounce","formatDateInputValue","nextTick","withDirectives","openBlock","createElementBlock","_ctx","createBlock","_component_field_label","optional","required","createCommentVNode","createElementVNode","createVNode","_component_dropdown_input_default","label","onDateInputChange","_component_error_message","_component_bento_typography","normalizeClass","createTextVNode","toDisplayString","_component_bento_popover","withCtx","_component_calendar","defaultDisplayMonth","isDateDisabled","max","variant"],"mappings":";;;;;;;;;;;;;;;;AAcO,MAAAA,KAAA,CAAA;AAAA,EAAmE,iBAAAC;AAAA,EACtE,iBAAAC;AAAA,EACA,gBAAAC;AAEJ,MAAA;;AACI,QAAA,EAAA,QAAAC,GAAA,GAAAC,EAAA,IAAAC,EAAA,GACAC,IAAAC,GAAA,GAEAC,IAAAC,GAAAC,IAAAV,EAAA,UAAA,gBAAAU,EAAA,cAAA;AA0CA,SAAA;AAAA;AAAA,IAAO,kBAxCPC,EAAA,MAEIV,EAAA,QACIO,EAAA,QAIJR,EAAA,QAMAY;AAAA,MAAOZ,EAAA;AAAA,MACaE,KAAA,QAAAA,EAAA,QAAAW,EAAA,kBAAAA,EAAA;AAAA,MACgD;AAAA,QAChE,QAAAP,EAAAH,EAAA,MAAA,UAAA,GAAA,CAAA,CAAA,KAAAG,EAAA;AAAA,MAC6D;AAAA,IAC7D,IAVAF,EAAA,YAAA,CAWJ;AAAA,IAuBA,gBAAAI;AAAA;AAAA,IACA,6BAjBJ,CAAAM,IAAAd,EAAA,UAAA;AAEI,UAAAC,EAAA;AACI;AAGJ,YAAAc,IAAAb,KAAA,QAAAA,EAAA,QAAAc,EAAAF,CAAA,IAAAA;AACA,MAAAN,EAAA,QAAAM,IAAAF,EAAAG,GAAAF,EAAA,yBAAA;AAAA,QACuD,QAAAP,EAAAH,EAAA,MAAA,UAAA,GAAA,CAAA,CAAA,KAAAG,EAAA;AAAA,MACY,CAAA,I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active as Te, defineComponent as xe, ref as A, computed as I, onMount
|
|
|
2
2
|
import { B as kt } from "./divider.qUOSAbU6.js";
|
|
3
3
|
import { B as Et } from "./popover.DYgCCUCJ.js";
|
|
4
4
|
import { B as tt, d as ht } from "./typography.DN5eC5ch.js";
|
|
5
|
+
import { D as wt } from "./dropdown-default-textbox.Ce5D3ipi.js";
|
|
5
6
|
import { e as P, a as Pe, g as Me } from "./get-date-locale.CAyOIbcp.js";
|
|
6
7
|
import { g as De } from "./generate-uid.NJ8tVoha.js";
|
|
7
8
|
import { u as Ce } from "./i18n.B6g5VX0q.js";
|
|
8
|
-
import { e as at, t as me, g as ce, i as B, h as F, j as qe, k as
|
|
9
|
-
import { f as Ve, v as
|
|
9
|
+
import { e as at, t as me, g as ce, i as B, h as F, j as qe, k as Ot, l as $e, m as Mt, s as Le, n as Ct, o as Ye, a as x, u as At, f as de } from "./calendar._oPk_A1C.js";
|
|
10
|
+
import { f as Ve, v as Ft, D as E } from "./date-input.BqBdAO1E.js";
|
|
10
11
|
import { r as C, t as H } from "./index.BrH1t1iu.js";
|
|
11
|
-
import { u as
|
|
12
|
-
import { B as
|
|
12
|
+
import { u as _t } from "./use-form-layout-loading.D3lALhtC.js";
|
|
13
|
+
import { B as Ut } from "./directive.Cbdox5VL.js";
|
|
13
14
|
import "./events.FNmSWp_P.js";
|
|
14
|
-
import { B as
|
|
15
|
-
import { B as
|
|
16
|
-
import { B as
|
|
15
|
+
import { B as Nt } from "./input-field.su5Cq8Dt.js";
|
|
16
|
+
import { B as Bt } from "./dropdown.CMOYmQLB.js";
|
|
17
|
+
import { B as Pt } from "./segmented-control.5-vlm8Gt.js";
|
|
17
18
|
import { d as ge } from "./debounce.DUTu11PS.js";
|
|
18
|
-
import { u as
|
|
19
|
+
import { u as qt } from "./use-has-slot.B7eQSabc.js";
|
|
19
20
|
import { _ as nt } from "./_plugin-vue_export-helper.CHgC5LLL.js";
|
|
20
|
-
import { D as qt } from "./dropdown-default-textbox.Ce5D3ipi.js";
|
|
21
21
|
import { F as $t, E as Lt } from "./error-message.DHMHq9bR.js";
|
|
22
22
|
import { B as Yt, c as Vt } from "./button-actions.CZdO9YOk.js";
|
|
23
23
|
import "../assets/date-range-picker.css";
|
|
@@ -99,13 +99,13 @@ const zt = ({
|
|
|
99
99
|
D = F(l.earliest);
|
|
100
100
|
else {
|
|
101
101
|
const p = qe(D, { weekStartsOn: e });
|
|
102
|
-
B(D, p) || (D = F(
|
|
102
|
+
B(D, p) || (D = F(Ot($e(D, { weekStartsOn: e }), 1)));
|
|
103
103
|
}
|
|
104
104
|
if (l.latest)
|
|
105
105
|
c = P(l.latest);
|
|
106
106
|
else {
|
|
107
107
|
const p = $e(c, { weekStartsOn: e });
|
|
108
|
-
B(c, p) || (c = P(
|
|
108
|
+
B(c, p) || (c = P(Mt(qe(c, { weekStartsOn: e }), 1)));
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
if ((l == null ? void 0 : l.type) === "monthly") {
|
|
@@ -119,7 +119,7 @@ const zt = ({
|
|
|
119
119
|
c = P(l.latest);
|
|
120
120
|
else {
|
|
121
121
|
const p = Pe(c);
|
|
122
|
-
B(c, p) || (c = Pe(
|
|
122
|
+
B(c, p) || (c = Pe(Ct(c, 1)));
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
if ((l == null ? void 0 : l.type) === "quarterly") {
|
|
@@ -201,9 +201,9 @@ const Xt = /[\d]/, Zt = /^\d{2}$/, xt = /^\d{2}:\d{2}$/, ea = (e) => {
|
|
|
201
201
|
i18n: { messages: ze },
|
|
202
202
|
name: "date-range-picker-calendar",
|
|
203
203
|
components: {
|
|
204
|
-
BentoDropdown:
|
|
205
|
-
BentoInputField:
|
|
206
|
-
BentoSegmentedControl:
|
|
204
|
+
BentoDropdown: Bt,
|
|
205
|
+
BentoInputField: Nt,
|
|
206
|
+
BentoSegmentedControl: Pt,
|
|
207
207
|
BentoTypography: tt,
|
|
208
208
|
Calendar: x
|
|
209
209
|
},
|
|
@@ -371,7 +371,7 @@ const Xt = /[\d]/, Zt = /^\d{2}$/, xt = /^\d{2}:\d{2}$/, ea = (e) => {
|
|
|
371
371
|
adjustEndDateInputForMonthly: ae,
|
|
372
372
|
adjustStartDateInputForQuarterly: be,
|
|
373
373
|
adjustEndDateInputForQuarterly: fe
|
|
374
|
-
} =
|
|
374
|
+
} = At(e.firstDayOfWeek), { savedRanges: Y, saveRange: z, resetSavedRanges: ne } = Jt(), w = (t) => t ? de(t, E.NUMERIC_DATE_YEAR_FIRST, {
|
|
375
375
|
locale: D[d.value.substring(0, 2)] || D.enUS
|
|
376
376
|
}) : "", J = (t) => t ? de(t, E.HOUR_MINUTE_SECONDS, {
|
|
377
377
|
locale: D[d.value.substring(0, 2)] || D.enUS
|
|
@@ -520,7 +520,7 @@ const Xt = /[\d]/, Zt = /^\d{2}$/, xt = /^\d{2}:\d{2}$/, ea = (e) => {
|
|
|
520
520
|
}, Je), ut = (t) => {
|
|
521
521
|
r.endDate = Ve(t), it(r.endDate);
|
|
522
522
|
}, dt = (t) => {
|
|
523
|
-
|
|
523
|
+
Ft(t);
|
|
524
524
|
}, mt = ge((t) => {
|
|
525
525
|
if (m(t, e.dateFormData.startDate)) {
|
|
526
526
|
X.value = !1, n.startDate = b(n.startDate, t);
|
|
@@ -622,7 +622,7 @@ const Xt = /[\d]/, Zt = /^\d{2}$/, xt = /^\d{2}:\d{2}$/, ea = (e) => {
|
|
|
622
622
|
quickSelectRangeDefaultItems: T,
|
|
623
623
|
formInputWrapperConditionalClasses: ee,
|
|
624
624
|
// Methods
|
|
625
|
-
hasSlot:
|
|
625
|
+
hasSlot: qt(s),
|
|
626
626
|
t: l,
|
|
627
627
|
// Events
|
|
628
628
|
onDateInput: oe,
|
|
@@ -850,11 +850,11 @@ const Ze = {
|
|
|
850
850
|
BentoTypography: tt,
|
|
851
851
|
BentoPopover: Et,
|
|
852
852
|
DateRangePickerCalendar: V,
|
|
853
|
-
DropdownInputDefault:
|
|
853
|
+
DropdownInputDefault: wt,
|
|
854
854
|
ErrorMessage: Lt,
|
|
855
855
|
FieldLabel: $t
|
|
856
856
|
},
|
|
857
|
-
directives: { BentoClickOutsideDirective:
|
|
857
|
+
directives: { BentoClickOutsideDirective: Ut },
|
|
858
858
|
props: {
|
|
859
859
|
/**
|
|
860
860
|
* Allows user to enter time values in the form
|
|
@@ -970,7 +970,7 @@ const Ze = {
|
|
|
970
970
|
timeDifference: b
|
|
971
971
|
}
|
|
972
972
|
};
|
|
973
|
-
})), T = A(!1), U = A(null), S = A(!1), { isReadOnly: W } =
|
|
973
|
+
})), T = A(!1), U = A(null), S = A(!1), { isReadOnly: W } = _t(Be(e, "readonly"));
|
|
974
974
|
Ee(
|
|
975
975
|
() => e.disabled,
|
|
976
976
|
() => {
|
|
@@ -1222,4 +1222,4 @@ export {
|
|
|
1222
1222
|
jt as b,
|
|
1223
1223
|
pe as i
|
|
1224
1224
|
};
|
|
1225
|
-
//# sourceMappingURL=date-range-picker.
|
|
1225
|
+
//# sourceMappingURL=date-range-picker.DtV4L3L6.js.map
|