@adyen/bento-vue2 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/components.d.ts +2 -0
- package/dist/@types/packages/core/src/components/button/button.types.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/action-bar/action-bar.vue.d.ts +11 -0
- package/dist/@types/packages/vue2/src/components/button/components/button-actions/button-actions.types.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/button/components/button-actions/button-actions.vue.d.ts +7 -2
- package/dist/@types/packages/vue2/src/components/button/components/loading-button/loading-button.vue.d.ts +28 -18
- package/dist/@types/packages/vue2/src/components/checkbox/checkbox.vue.d.ts +25 -0
- package/dist/@types/packages/vue2/src/components/data-grid/data-grid.vue.d.ts +13 -1
- package/dist/@types/packages/vue2/src/components/date-picker/date-picker.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/date-range-picker/components/date-range-picker-calendar/date-range-picker-calendar.types.d.ts +6 -2
- package/dist/@types/packages/vue2/src/components/date-range-picker/components/date-range-picker-calendar/date-range-picker-calendar.vue.d.ts +153 -12
- package/dist/@types/packages/vue2/src/components/date-range-picker/date-range-picker.types.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/date-range-picker/date-range-picker.vue.d.ts +18 -0
- package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-options-container/dropdown-options-container.vue.d.ts +320 -21
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-avatar/dropdown-avatar.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-country/dropdown-country.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-currency/dropdown-currency.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-payment-method/dropdown-payment-method.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-tag/dropdown-tag.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/dropdown/dropdown.vue.d.ts +12 -3
- package/dist/@types/packages/vue2/src/components/filter-bar/components/all-filters-modal/all-filters-modal.vue.d.ts +30 -24
- package/dist/@types/packages/vue2/src/components/filter-bar/components/date-range-filter/date-range-filter.vue.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/input-field/input-field.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/internal/calendar/calendar.types.d.ts +12 -0
- package/dist/@types/packages/vue2/src/components/internal/calendar/calendar.vue.d.ts +11 -1
- package/dist/@types/packages/vue2/src/components/internal/calendar/components/calendar-month/composables/granular-min-max-date.d.ts +2 -0
- package/dist/@types/packages/vue2/src/components/internal/calendar/components/calendar-month/composables/granular-min-max-date.types.d.ts +13 -0
- package/dist/@types/packages/vue2/src/components/internal/calendar/composables/use-granularity-adjustments.d.ts +2 -0
- package/dist/@types/packages/vue2/src/components/internal/calendar/composables/use-granularity-adjustments.types.d.ts +14 -0
- package/dist/@types/packages/vue2/src/components/internal/calendar/composables/use-granularity-memory.d.ts +2 -0
- package/dist/@types/packages/vue2/src/components/internal/calendar/composables/use-granularity-memory.types.d.ts +22 -0
- package/dist/@types/packages/vue2/src/components/internal/controls-group/controls-group.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/internal/field-label/field-label.vue.d.ts +48 -0
- package/dist/@types/packages/vue2/src/components/internal/field-label/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/internal/grid-layout/grid-layout.vue.d.ts +11 -0
- package/dist/@types/packages/vue2/src/components/internal/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/modal/components/base-modal/base-modal.vue.d.ts +2 -1
- package/dist/@types/packages/vue2/src/components/popover/popover.keys.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/popover/popover.vue.d.ts +16 -22
- package/dist/@types/packages/vue2/src/components/structured-list/components/structered-list-item/structured-list-item.vue.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/structured-list/structured-list.keys.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/structured-list/structured-list.vue.d.ts +20 -1
- package/dist/@types/packages/vue2/src/components/summary-grid/summary-grid.types.d.ts +4 -4
- package/dist/@types/packages/vue2/src/components/textarea/textarea.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/timeline/components/timeline-item/timeline-item.vue.d.ts +19 -2
- package/dist/@types/packages/vue2/src/components/timeline/timeline.types.d.ts +4 -2
- package/dist/@types/packages/vue2/src/components/timeline/timeline.vue.d.ts +18 -2
- package/dist/@types/packages/vue2/src/index.d.ts +1 -0
- package/dist/accordion.js +1 -1
- package/dist/action-bar.js +112 -93
- package/dist/action-bar.js.map +1 -1
- package/dist/alert.js +1 -1
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/calendar.css +1 -1
- package/dist/assets/checkbox.css +1 -1
- package/dist/assets/controls-group.css +1 -1
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/field-label.css +1 -0
- package/dist/assets/grid-layout.css +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/assets/index11.css +1 -1
- package/dist/assets/index12.css +1 -1
- package/dist/assets/index13.css +1 -1
- package/dist/assets/index14.css +1 -1
- package/dist/assets/index15.css +1 -1
- package/dist/assets/index16.css +1 -1
- package/dist/assets/index17.css +1 -1
- package/dist/assets/index18.css +1 -1
- package/dist/assets/index19.css +1 -1
- package/dist/assets/index2.css +1 -1
- package/dist/assets/index20.css +1 -1
- package/dist/assets/index21.css +1 -1
- package/dist/assets/index22.css +1 -1
- package/dist/assets/index23.css +1 -1
- package/dist/assets/index24.css +1 -1
- package/dist/assets/index25.css +1 -1
- package/dist/assets/index26.css +1 -1
- package/dist/assets/index27.css +1 -1
- package/dist/assets/index28.css +1 -1
- package/dist/assets/index29.css +1 -1
- package/dist/assets/index3.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index32.css +1 -1
- package/dist/assets/index33.css +1 -1
- package/dist/assets/index34.css +1 -1
- package/dist/assets/index35.css +1 -1
- package/dist/assets/index36.css +1 -1
- package/dist/assets/index37.css +1 -1
- package/dist/assets/index38.css +1 -1
- package/dist/assets/index39.css +1 -1
- package/dist/assets/index4.css +1 -1
- package/dist/assets/index40.css +1 -1
- package/dist/assets/index41.css +1 -1
- package/dist/assets/index42.css +1 -1
- package/dist/assets/index43.css +1 -1
- package/dist/assets/index44.css +1 -1
- package/dist/assets/index45.css +1 -1
- package/dist/assets/index5.css +1 -1
- package/dist/assets/index6.css +1 -1
- package/dist/assets/index7.css +1 -1
- package/dist/assets/index8.css +1 -1
- package/dist/assets/index9.css +1 -1
- package/dist/assets/loading-button.css +1 -1
- package/dist/avatar-image.js +1 -1
- package/dist/badge.js +1 -1
- package/dist/button.js +38 -35
- package/dist/button.js.map +1 -1
- package/dist/card.js +1 -1
- package/dist/checkbox.js +5 -5
- package/dist/chunks/{base-modal.88e7b9d4.js → base-modal.31634fe8.js} +60 -49
- package/dist/chunks/base-modal.31634fe8.js.map +1 -0
- package/dist/chunks/{button-actions-with-menu.a5413243.js → button-actions-with-menu.5faea13e.js} +5 -5
- package/dist/chunks/{button-actions-with-menu.a5413243.js.map → button-actions-with-menu.5faea13e.js.map} +1 -1
- package/dist/chunks/button.e09d5980.js.map +1 -1
- package/dist/chunks/calendar.47e9e755.js +959 -0
- package/dist/chunks/calendar.47e9e755.js.map +1 -0
- package/dist/chunks/{checkbox.5343e28e.js → checkbox.2277450e.js} +67 -56
- package/dist/chunks/checkbox.2277450e.js.map +1 -0
- package/dist/chunks/controls-group.6c5bfccd.js +79 -0
- package/dist/chunks/controls-group.6c5bfccd.js.map +1 -0
- package/dist/chunks/{copy.346eadb1.js → copy.a85c2e9f.js} +3 -3
- package/dist/chunks/{copy.346eadb1.js.map → copy.a85c2e9f.js.map} +1 -1
- package/dist/chunks/{dropdown.f1253a54.js → dropdown.ce937989.js} +200 -196
- package/dist/chunks/dropdown.ce937989.js.map +1 -0
- package/dist/chunks/field-label.330edb60.js +107 -0
- package/dist/chunks/field-label.330edb60.js.map +1 -0
- package/dist/chunks/{grid-layout.b7e0d964.js → grid-layout.a806acb2.js} +36 -27
- package/dist/chunks/grid-layout.a806acb2.js.map +1 -0
- package/dist/chunks/index.210d2169.js +290 -0
- package/dist/chunks/index.210d2169.js.map +1 -0
- package/dist/chunks/{index.8ac70774.js → index.66503760.js} +3 -3
- package/dist/chunks/{index.8ac70774.js.map → index.66503760.js.map} +1 -1
- package/dist/chunks/{index.2625175a.js → index.86fc63ca.js} +30 -28
- package/dist/chunks/{index.2625175a.js.map → index.86fc63ca.js.map} +1 -1
- package/dist/chunks/{index.a201f750.js → index.89942d3a.js} +4 -5
- package/dist/chunks/{index.a201f750.js.map → index.89942d3a.js.map} +1 -1
- package/dist/chunks/index.a5de5242.js +130 -0
- package/dist/chunks/index.a5de5242.js.map +1 -0
- package/dist/chunks/index.a99ffd48.js +634 -0
- package/dist/chunks/index.a99ffd48.js.map +1 -0
- package/dist/chunks/index.d80206ed.js +10 -0
- package/dist/chunks/index.d80206ed.js.map +1 -0
- package/dist/chunks/{index.37283390.js → index.d8bd7596.js} +96 -99
- package/dist/chunks/{index.37283390.js.map → index.d8bd7596.js.map} +1 -1
- package/dist/chunks/{listbox-option-tag.6a09e8e2.js → listbox-option-tag.97af47fc.js} +6 -7
- package/dist/chunks/{listbox-option-tag.6a09e8e2.js.map → listbox-option-tag.97af47fc.js.map} +1 -1
- package/dist/chunks/{listbox.73c38f38.js → listbox.d039b178.js} +5 -6
- package/dist/chunks/{listbox.73c38f38.js.map → listbox.d039b178.js.map} +1 -1
- package/dist/chunks/loading-button.9a9cbbad.js +89 -0
- package/dist/chunks/loading-button.9a9cbbad.js.map +1 -0
- package/dist/chunks/{tooltip.104e5fac.js → tooltip.ecd0f707.js} +2 -2
- package/dist/chunks/{tooltip.104e5fac.js.map → tooltip.ecd0f707.js.map} +1 -1
- package/dist/code-snippet.js +4 -4
- package/dist/code-snippet.js.map +1 -1
- package/dist/country.js +1 -1
- package/dist/data-grid.js +563 -541
- package/dist/data-grid.js.map +1 -1
- package/dist/date-picker.js +83 -80
- package/dist/date-picker.js.map +1 -1
- package/dist/date-range-picker.js +2 -2
- package/dist/divider.js +1 -1
- package/dist/dropdown.js +3 -3
- package/dist/empty-state.js +1 -1
- package/dist/filter-bar.js +13 -12
- package/dist/filter-bar.js.map +1 -1
- package/dist/focus-trap.js +1 -1
- package/dist/form-layout.js +1 -1
- package/dist/header.js +63 -67
- package/dist/header.js.map +1 -1
- package/dist/index.js +211 -209
- package/dist/index.js.map +1 -1
- package/dist/info-icon.js +3 -3
- package/dist/input-field.js +57 -55
- package/dist/input-field.js.map +1 -1
- package/dist/internal.js +13 -12
- package/dist/link.js +1 -1
- package/dist/loading-indicator.js +1 -1
- package/dist/menu.js +1 -1
- package/dist/modal.js +2 -2
- package/dist/modal.js.map +1 -1
- package/dist/pagination.js +2 -2
- package/dist/payment-method.js +1 -1
- package/dist/popover.js +3 -305
- package/dist/popover.js.map +1 -1
- package/dist/popper-container.js +1 -1
- package/dist/radio-group.js +3 -3
- package/dist/search-bar.js +2 -2
- package/dist/segmented-control.js +2 -2
- package/dist/sidepanel.js +2 -2
- package/dist/status.js +1 -1
- package/dist/stepper.js +1 -1
- package/dist/structured-list.js +1 -1
- package/dist/summary-grid.js +3 -3
- package/dist/summary-grid.js.map +1 -1
- package/dist/tabs.js +1 -1
- package/dist/tag.js +2 -2
- package/dist/textarea.js +59 -56
- package/dist/textarea.js.map +1 -1
- package/dist/timeline.js +226 -173
- package/dist/timeline.js.map +1 -1
- package/dist/toast.js +1 -1
- package/dist/toggle.js +1 -1
- package/dist/tutorial.js +7 -7
- package/dist/web-types.json +519 -393
- package/package.json +3 -3
- package/dist/@types/packages/vue2/src/components/modal/components/base-modal/__mocks__/base-modal.vue.d.ts +0 -118
- package/dist/assets/error-message.css +0 -1
- package/dist/chunks/base-modal.88e7b9d4.js.map +0 -1
- package/dist/chunks/calendar.24d0ac04.js +0 -821
- package/dist/chunks/calendar.24d0ac04.js.map +0 -1
- package/dist/chunks/checkbox.5343e28e.js.map +0 -1
- package/dist/chunks/controls-group.2a21bd83.js +0 -87
- package/dist/chunks/controls-group.2a21bd83.js.map +0 -1
- package/dist/chunks/dropdown.f1253a54.js.map +0 -1
- package/dist/chunks/error-message.8302a46c.js +0 -47
- package/dist/chunks/error-message.8302a46c.js.map +0 -1
- package/dist/chunks/grid-layout.b7e0d964.js.map +0 -1
- package/dist/chunks/index.d6b5f5e1.js +0 -112
- package/dist/chunks/index.d6b5f5e1.js.map +0 -1
- package/dist/chunks/index.e566354f.js +0 -532
- package/dist/chunks/index.e566354f.js.map +0 -1
- package/dist/chunks/loading-button.c65682d6.js +0 -86
- package/dist/chunks/loading-button.c65682d6.js.map +0 -1
package/dist/date-picker.js
CHANGED
|
@@ -1,59 +1,58 @@
|
|
|
1
|
-
import { ref as f, computed as
|
|
2
|
-
import {
|
|
3
|
-
import { BentoPopover as $ } from "./popover.js";
|
|
4
|
-
import { g as u } from "./chunks/unique-id.a2a2b458.js";
|
|
1
|
+
import { ref as f, computed as D, defineComponent as Y, toRef as E, watch as W, nextTick as T } from "vue";
|
|
2
|
+
import { a as q } from "./chunks/index.210d2169.js";
|
|
5
3
|
import { B as K } from "./chunks/index.965ac1af.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
4
|
+
import { c as j } from "./chunks/dropdown-default-textbox.25134789.js";
|
|
5
|
+
import { d as z } from "./chunks/debounce.b5ef6acf.js";
|
|
6
|
+
import { D as O, v as $, f as G } from "./chunks/date-input.9186a0bf.js";
|
|
7
|
+
import { g as u } from "./chunks/unique-id.a2a2b458.js";
|
|
8
|
+
import { u as B } from "./chunks/i18n.155748d6.js";
|
|
9
|
+
import { f as S } from "./chunks/index.b83f8b7e.js";
|
|
10
|
+
import { e as I, d as H, f as J } from "./chunks/index.f55fdc32.js";
|
|
11
11
|
import { u as Q } from "./chunks/use-form-layout-loading.d03e5d48.js";
|
|
12
|
-
import "./chunks/
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
var o = /* @__PURE__ */ ((a) => (a.INPUT = "input", a))(o || {});
|
|
20
|
-
const ae = ({ datePickerValue: a, isDateIncorrect: e }) => {
|
|
12
|
+
import { C as p } from "./chunks/calendar.47e9e755.js";
|
|
13
|
+
import { b as Re } from "./chunks/calendar.47e9e755.js";
|
|
14
|
+
import { E as X, F as Z } from "./chunks/field-label.330edb60.js";
|
|
15
|
+
import { B as ee } from "./chunks/directive.0408e565.js";
|
|
16
|
+
import { n as ae } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
17
|
+
import "./assets/index12.css";
|
|
18
|
+
const te = ({ datePickerValue: a, isDateIncorrect: e }) => {
|
|
21
19
|
var v;
|
|
22
|
-
const { locale:
|
|
20
|
+
const { locale: r, t: n } = B(), m = { de: H, enUS: I, fr: J }, s = f((v = a.value) == null ? void 0 : v.toDateString());
|
|
23
21
|
return {
|
|
24
22
|
// Values
|
|
25
|
-
dateDisplayValue:
|
|
26
|
-
locale:
|
|
23
|
+
dateDisplayValue: D(() => e.value ? s.value : a.value ? S(a.value, O.FULL_DATE, {
|
|
24
|
+
locale: m[r.value.substring(0, 2)] || I
|
|
27
25
|
}) : n("selectDate")),
|
|
28
26
|
textInputValue: s,
|
|
29
27
|
// Methods
|
|
30
28
|
formatTextInputDisplayValue: (c = a.value) => {
|
|
31
|
-
e.value || (s.value = c ?
|
|
32
|
-
locale:
|
|
29
|
+
e.value || (s.value = c ? S(c, O.NUMERIC_DATE_YEAR_FIRST, {
|
|
30
|
+
locale: m[r.value.substring(0, 2)] || I
|
|
33
31
|
}) : null);
|
|
34
32
|
}
|
|
35
33
|
};
|
|
36
|
-
}
|
|
34
|
+
};
|
|
35
|
+
var o = /* @__PURE__ */ ((a) => (a.INPUT = "input", a))(o || {});
|
|
36
|
+
const re = {
|
|
37
37
|
"en-US": {
|
|
38
|
-
optional: "optional",
|
|
39
|
-
required: "required",
|
|
40
38
|
provideDateInAFormat: "Provide date in a YYYY-MM-DD format",
|
|
41
39
|
selectDate: "Select a date",
|
|
42
40
|
selectDateRange: "Select a date range",
|
|
43
41
|
selectedDateIsNotAvailable: "Selected date is not available",
|
|
44
42
|
datePicker: "Date picker"
|
|
45
43
|
}
|
|
46
|
-
},
|
|
47
|
-
i18n: { messages:
|
|
44
|
+
}, ne = 1e3, le = Y({
|
|
45
|
+
i18n: { messages: re },
|
|
48
46
|
name: "bento-date-picker",
|
|
49
47
|
components: {
|
|
50
48
|
BentoTypography: K,
|
|
51
|
-
BentoPopover:
|
|
49
|
+
BentoPopover: q,
|
|
52
50
|
Calendar: p,
|
|
53
51
|
ErrorMessage: X,
|
|
54
|
-
DropdownInputDefault:
|
|
52
|
+
DropdownInputDefault: j,
|
|
53
|
+
FieldLabel: Z
|
|
55
54
|
},
|
|
56
|
-
directives: { BentoClickOutsideDirective:
|
|
55
|
+
directives: { BentoClickOutsideDirective: ee },
|
|
57
56
|
props: {
|
|
58
57
|
/**
|
|
59
58
|
* Descriptive supporting text visbile underneath the dropdown.
|
|
@@ -99,6 +98,10 @@ const ae = ({ datePickerValue: a, isDateIncorrect: e }) => {
|
|
|
99
98
|
* Highlights the dropdown is required.
|
|
100
99
|
*/
|
|
101
100
|
required: { type: Boolean, default: !1 },
|
|
101
|
+
/**
|
|
102
|
+
* Adds a info icon next to the label to display the passed tooltip message.
|
|
103
|
+
*/
|
|
104
|
+
tooltipText: { type: String, default: null },
|
|
102
105
|
/**
|
|
103
106
|
* Selected date
|
|
104
107
|
*/
|
|
@@ -106,35 +109,35 @@ const ae = ({ datePickerValue: a, isDateIncorrect: e }) => {
|
|
|
106
109
|
},
|
|
107
110
|
emits: [o.INPUT],
|
|
108
111
|
setup(a, { emit: e }) {
|
|
109
|
-
const { t } =
|
|
110
|
-
|
|
112
|
+
const { t: r } = B(), n = u("bento-date-picker-container"), m = u("bento-date-picker-label"), s = u("bento-date-picker-description"), b = u("bento-date-picker-error"), y = u("bento-date-picker-date-error"), v = D(() => a.label || r("datePicker", { name: n })), c = f(null), R = f(null), l = f(!1), i = f(!1), { isReadOnly: w } = Q(E(a, "readonly"));
|
|
113
|
+
W(
|
|
111
114
|
() => a.disabled,
|
|
112
|
-
(
|
|
113
|
-
|
|
115
|
+
(t) => {
|
|
116
|
+
t && i.value && (i.value = !1);
|
|
114
117
|
}
|
|
115
118
|
);
|
|
116
|
-
const { dateDisplayValue: U, textInputValue: d, formatTextInputDisplayValue:
|
|
119
|
+
const { dateDisplayValue: U, textInputValue: d, formatTextInputDisplayValue: g } = te({
|
|
117
120
|
datePickerValue: E(a, "value"),
|
|
118
|
-
isDateIncorrect:
|
|
119
|
-
}),
|
|
120
|
-
"b-date-picker__description--error": a.errorMessage ||
|
|
121
|
-
})),
|
|
122
|
-
() => `${a.description ? s : ""} ${a.errorMessage ? b : ""} ${
|
|
123
|
-
),
|
|
124
|
-
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
}, P = (
|
|
134
|
-
if (
|
|
121
|
+
isDateIncorrect: l
|
|
122
|
+
}), k = D(() => a.isDateDisabled && a.isDateDisabled(new Date(d.value)) && !i.value ? r("selectedDateIsNotAvailable") : l.value ? r("provideDateInAFormat") : null), V = D(() => ({
|
|
123
|
+
"b-date-picker__description--error": a.errorMessage || k.value
|
|
124
|
+
})), N = D(
|
|
125
|
+
() => `${a.description ? s : ""} ${a.errorMessage ? b : ""} ${k.value ? y : ""}`.trim() || null
|
|
126
|
+
), M = (t) => a.min && t <= a.min || a.max && t >= a.max ? !1 : a.isDateDisabled ? !a.isDateDisabled(t) : !0, x = () => {
|
|
127
|
+
i.value = !1;
|
|
128
|
+
}, C = () => {
|
|
129
|
+
i.value = !0, g();
|
|
130
|
+
}, F = (t) => {
|
|
131
|
+
l.value = !1, x(), e(o.INPUT, t);
|
|
132
|
+
}, h = async () => {
|
|
133
|
+
l.value && (l.value = !1, d.value = null), e(o.INPUT, null);
|
|
134
|
+
}, A = (t) => {
|
|
135
|
+
$(t);
|
|
136
|
+
}, P = (t) => {
|
|
137
|
+
if (t.length < 10)
|
|
135
138
|
return;
|
|
136
|
-
/^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/.test(
|
|
137
|
-
},
|
|
139
|
+
/^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/.test(t) && M(new Date(t)) ? (l.value = !1, e(o.INPUT, new Date(t))) : t && (l.value = !0, e(o.INPUT, null));
|
|
140
|
+
}, L = z(P, ne);
|
|
138
141
|
return {
|
|
139
142
|
// Refs
|
|
140
143
|
inputContainerRef: R,
|
|
@@ -143,54 +146,54 @@ const ae = ({ datePickerValue: a, isDateIncorrect: e }) => {
|
|
|
143
146
|
dateDisplayValue: U,
|
|
144
147
|
datePickerContainerId: n,
|
|
145
148
|
descriptionConditionalClasses: V,
|
|
146
|
-
isDateIncorrect:
|
|
147
|
-
isDatePickerOpen:
|
|
149
|
+
isDateIncorrect: l,
|
|
150
|
+
isDatePickerOpen: i,
|
|
148
151
|
isReadOnly: w,
|
|
149
|
-
dateErrorText:
|
|
150
|
-
labelId:
|
|
152
|
+
dateErrorText: k,
|
|
153
|
+
labelId: m,
|
|
151
154
|
descriptionId: s,
|
|
152
155
|
errorId: b,
|
|
153
|
-
dateErrorId:
|
|
156
|
+
dateErrorId: y,
|
|
154
157
|
popoverAriaLabel: v,
|
|
155
|
-
ariaDescribedBy:
|
|
158
|
+
ariaDescribedBy: N,
|
|
156
159
|
textInputValue: d,
|
|
157
160
|
// Events
|
|
158
|
-
closeDatePicker:
|
|
159
|
-
clearDatePickerValue:
|
|
160
|
-
onDateSelected:
|
|
161
|
-
openDatePicker:
|
|
162
|
-
onDateKeyDown:
|
|
163
|
-
onDateInputChange: (
|
|
164
|
-
d.value =
|
|
161
|
+
closeDatePicker: x,
|
|
162
|
+
clearDatePickerValue: h,
|
|
163
|
+
onDateSelected: F,
|
|
164
|
+
openDatePicker: C,
|
|
165
|
+
onDateKeyDown: A,
|
|
166
|
+
onDateInputChange: (t) => {
|
|
167
|
+
d.value = G(t), i.value ? L(d.value) : P(d.value);
|
|
165
168
|
},
|
|
166
169
|
// Keyboard navigation
|
|
167
|
-
onSpaceBarOrEnter: async (
|
|
168
|
-
var
|
|
169
|
-
|
|
170
|
+
onSpaceBarOrEnter: async (t) => {
|
|
171
|
+
var _;
|
|
172
|
+
i.value || (t.preventDefault(), C(), await T(), a.value || (g(/* @__PURE__ */ new Date()), e(o.INPUT, /* @__PURE__ */ new Date()), await T()), (_ = c.value) == null || _.$refs.calendarRef[0].focusOnDate(a.value));
|
|
170
173
|
}
|
|
171
174
|
};
|
|
172
175
|
}
|
|
173
176
|
});
|
|
174
177
|
var ie = function() {
|
|
175
|
-
var e = this,
|
|
176
|
-
return e._self._setupProxy,
|
|
178
|
+
var e = this, r = e._self._c;
|
|
179
|
+
return e._self._setupProxy, r("div", { directives: [{ name: "bento-click-outside-directive", rawName: "v-bento-click-outside-directive", value: e.closeDatePicker, expression: "closeDatePicker" }], staticClass: "b-date-picker", on: { "!keydown": [function(n) {
|
|
177
180
|
return !n.type.indexOf("key") && e._k(n.keyCode, "space", 32, n.key, [" ", "Spacebar"]) ? null : e.onSpaceBarOrEnter.apply(null, arguments);
|
|
178
181
|
}, function(n) {
|
|
179
182
|
return !n.type.indexOf("key") && e._k(n.keyCode, "enter", 13, n.key, "Enter") ? null : e.onSpaceBarOrEnter.apply(null, arguments);
|
|
180
|
-
}] } }, [e.label ?
|
|
181
|
-
},
|
|
182
|
-
ne,
|
|
183
|
-
ie,
|
|
183
|
+
}] } }, [e.label ? r("field-label", { attrs: { id: e.labelId, label: e.label, "tooltip-text": e.tooltipText, optional: e.optional, required: e.required } }) : e._e(), r("div", [r("dropdown-input-default", { ref: "inputContainerRef", attrs: { ariaControls: e.datePickerContainerId, ariaExpanded: e.isDatePickerOpen, "aria-labelledby": e.label ? e.labelId : null, "aria-describedby": e.ariaDescribedBy, disabled: e.disabled, "dynamic-filtering": "", "is-invalid": !!e.errorMessage || !!e.dateErrorText, open: e.isDatePickerOpen, value: e.textInputValue, "display-value": e.dateDisplayValue, "debounce-time": 0, readonly: e.isReadOnly }, on: { input: e.onDateInputChange, open: e.openDatePicker, keydown: e.onDateKeyDown, clear: e.clearDatePickerValue, close: e.closeDatePicker } })], 1), e.dateErrorText ? r("error-message", { staticClass: "b-date-picker__error-message", attrs: { id: e.dateErrorId, "error-message": e.dateErrorText } }) : e._e(), e.errorMessage ? r("error-message", { staticClass: "b-date-picker__error-message", attrs: { id: e.errorId, "error-message": e.errorMessage } }) : e._e(), e.description ? r("bento-typography", { staticClass: "b-date-picker__description", class: e.descriptionConditionalClasses, attrs: { el: "span" } }, [e._v(" " + e._s(e.description) + " ")]) : e._e(), e.inputContainerRef ? r("bento-popover", { staticClass: "b-date-picker__container", attrs: { id: e.datePickerContainerId, role: "dialog", open: e.isDatePickerOpen, "target-element": e.inputContainerRef, "disable-focus-trap": !0, "aria-label": e.popoverAriaLabel, "aria-modal": !0, position: "bottom-start", "fit-content": "" } }, [r("calendar", { ref: "calendarContainerRef", attrs: { "first-day-of-week": e.firstDayOfWeek, "is-date-disabled": e.isDateDisabled, "number-of-months": 1, value: e.value, min: e.min, max: e.max }, on: { input: e.onDateSelected } })], 1) : e._e()], 1);
|
|
184
|
+
}, oe = [], se = /* @__PURE__ */ ae(
|
|
184
185
|
le,
|
|
186
|
+
ie,
|
|
187
|
+
oe,
|
|
185
188
|
!1,
|
|
186
189
|
null,
|
|
187
|
-
"
|
|
190
|
+
"d563c682",
|
|
188
191
|
null,
|
|
189
192
|
null
|
|
190
193
|
);
|
|
191
|
-
const
|
|
194
|
+
const Te = se.exports;
|
|
192
195
|
export {
|
|
193
|
-
|
|
196
|
+
Te as BentoDatePicker,
|
|
194
197
|
o as BentoDatePickerEvent,
|
|
195
198
|
Re as BentoDatePickerFirstDayOfWeek
|
|
196
199
|
};
|
package/dist/date-picker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.js","sources":["../src/components/date-picker/date-picker.types.ts","../src/components/date-picker/composables/use-date-picker-single-calendar-text.ts","../src/components/date-picker/date-picker.vue"],"sourcesContent":["export { CalendarFirstDayOfWeek as BentoDatePickerFirstDayOfWeek } from '@/internal';\nexport type {\n CalendarIsDateDisabled as BentoDatePickerIsDateDisabled,\n CalendarSingleDateValue as BentoDatePickerValue,\n} from '@/internal';\n\nexport enum BentoDatePickerEvent {\n INPUT = 'input',\n}\n","import { computed, ref } from 'vue';\nimport { de, enUS, fr } from 'date-fns/locale';\nimport { useI18n } from '@/utils/ts/i18n';\nimport { UseDateDisplayText } from './use-date-picker-single-calendar-text.types';\nimport { DateFormat } from '@/types';\nimport format from 'date-fns/format';\n\n/**\n * Composable that sets and formats the date to be displayed in the input box of a Single Date Picker\n * @param {Ref<Date>} option.datePickerValue Ref to the datePickerValue set in the DatePicker component\n * @param {Ref<boolean>} option.isDateIncorrect Indicates if the date is correct or not\n */\nexport const useDatePickerSingleCalendarText: UseDateDisplayText<Date> = ({ datePickerValue, isDateIncorrect }) => {\n const { locale, t } = useI18n();\n const locales = { de, enUS, fr };\n\n const textInputValue = ref(datePickerValue.value?.toDateString());\n\n const dateDisplayValue = computed(() => {\n // Display incorrect date when there's an error with the input\n if (isDateIncorrect.value) {\n return textInputValue.value;\n }\n\n // Display \"Select a date\" when there's no date selected or input\n if (!datePickerValue.value) {\n return t('selectDate') as string;\n }\n\n // Display the date in format \"dd MMM, yyyy (25 Jun, 2023)\" if there's a valid date selected\n return format(datePickerValue.value as Date, DateFormat.FULL_DATE, {\n locale: locales[locale.value.substring(0, 2)] || enUS,\n });\n });\n\n /**\n * Formats the \"dateToFormat\" date value with the yyyy-MM-dd format and sets it as \"formatTextInputDisplayValue\" value\n * @param {DATE} dateToFormat - Date to be assigned and formatted\n */\n const formatTextInputDisplayValue = (dateToFormat: Date = datePickerValue.value) => {\n // If date is incorrect, leave the textInputValue intact\n if (isDateIncorrect.value) {\n return;\n }\n\n textInputValue.value = dateToFormat\n ? format(dateToFormat, DateFormat.NUMERIC_DATE_YEAR_FIRST, {\n locale: locales[locale.value.substring(0, 2)] || enUS,\n })\n : null;\n };\n\n return {\n // Values\n dateDisplayValue,\n textInputValue,\n\n // Methods\n formatTextInputDisplayValue,\n };\n};\n","<!-- TODO: Remove aria props as these are part of JSX elements /vue/types/jsx.d.ts -->\n<!-- eslint-disable vue/attribute-hyphenation -->\n<template>\n <div\n v-bento-click-outside-directive=\"closeDatePicker\"\n class=\"b-date-picker\"\n @keydown.space.capture=\"onSpaceBarOrEnter\"\n @keydown.enter.capture=\"onSpaceBarOrEnter\"\n >\n <!-- Label -->\n <div v-if=\"label\" :id=\"labelId\" class=\"b-date-picker__label\">\n <bento-typography el=\"span\" stronger>{{ label }}</bento-typography>\n <bento-typography v-if=\"optional\" class=\"b-date-picker__label-requirement\" el=\"span\">\n ({{ $t('optional') }})\n </bento-typography>\n <bento-typography v-if=\"required\" class=\"b-date-picker__label-requirement\" el=\"span\">\n ({{ $t('required') }})\n </bento-typography>\n </div>\n\n <!-- Input -->\n <div>\n <dropdown-input-default\n ref=\"inputContainerRef\"\n :ariaControls=\"datePickerContainerId\"\n :ariaExpanded=\"isDatePickerOpen\"\n :aria-labelledby=\"label ? labelId : null\"\n :aria-describedby=\"ariaDescribedBy\"\n :disabled=\"disabled\"\n dynamic-filtering\n :is-invalid=\"!!errorMessage || !!dateErrorText\"\n :open=\"isDatePickerOpen\"\n :value=\"textInputValue\"\n :display-value=\"dateDisplayValue\"\n :debounce-time=\"0\"\n :readonly=\"isReadOnly\"\n @input=\"onDateInputChange\"\n @open=\"openDatePicker\"\n @keydown=\"onDateKeyDown\"\n @clear=\"clearDatePickerValue\"\n @close=\"closeDatePicker\"\n />\n </div>\n\n <!-- Error Messages -->\n <error-message\n v-if=\"dateErrorText\"\n :id=\"dateErrorId\"\n :error-message=\"dateErrorText\"\n class=\"b-date-picker__error-message\"\n />\n <error-message\n v-if=\"errorMessage\"\n :id=\"errorId\"\n :error-message=\"errorMessage\"\n class=\"b-date-picker__error-message\"\n />\n\n <!-- Description -->\n <bento-typography\n v-if=\"description\"\n class=\"b-date-picker__description\"\n :class=\"descriptionConditionalClasses\"\n el=\"span\"\n >\n {{ description }}\n </bento-typography>\n\n <!-- Calendar container -->\n <bento-popover\n v-if=\"inputContainerRef\"\n :id=\"datePickerContainerId\"\n class=\"b-date-picker__container\"\n role=\"dialog\"\n :open=\"isDatePickerOpen\"\n :target-element=\"inputContainerRef\"\n :disable-focus-trap=\"true\"\n :aria-label=\"popoverAriaLabel\"\n :aria-modal=\"true\"\n position=\"bottom-start\"\n fit-content\n >\n <calendar\n ref=\"calendarContainerRef\"\n :first-day-of-week=\"firstDayOfWeek\"\n :is-date-disabled=\"isDateDisabled\"\n :number-of-months=\"1\"\n :value=\"value\"\n :min=\"min\"\n :max=\"max\"\n @input=\"onDateSelected\"\n />\n </bento-popover>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, nextTick, PropType, Ref, ref, toRef, watch } from 'vue';\n import { BentoClickOutsideDirective } from '@/directives';\n import { BentoDatePickerEvent, BentoDatePickerValue } from './date-picker.types';\n import { Calendar, ErrorMessage } from '@/internal';\n import { DropdownInputDefault } from '@/components/dropdown/components';\n import { BentoPopover } from '@/components/popover';\n import { generateUid } from '@/utils/ts/unique-id';\n import { BentoTypography } from '../typography';\n import { useDatePickerSingleCalendarText } from './composables/use-date-picker-single-calendar-text';\n import { formatDateInputValue, validateDateInput } from '@/utils/ts/date-input';\n import { useI18n } from '@/utils/ts/i18n';\n import { debounce } from '@/utils/ts/debounce';\n import { useFormLayoutFieldLoading } from '@/composables';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n const DEBOUNCE_TIME = 1000;\n\n /**\n * Date picker selector.\n *\n * @example\n * import { BentoDatePicker } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoDatePicker },\n * template: `\n * <bento-date-picker\n * label=\"Label\"\n * description=\"Supporting text\"\n * required\n * optional\n * disabled\n * @input=\"onDateChanged\"\n * v-model=\"selectedDate\"\n * />\n * `,\n * setup() {\n * const selectedDate = ref(new Date()); // reactive({ startDate: new Date(), endDate: new Date() })\n * return {\n * selectedDate,\n * }\n * }\n * }\n */\n export default defineComponent({\n i18n: { messages },\n name: 'bento-date-picker',\n components: {\n BentoTypography,\n BentoPopover,\n Calendar,\n ErrorMessage,\n DropdownInputDefault,\n },\n directives: { BentoClickOutsideDirective },\n props: {\n /**\n * Descriptive supporting text visbile underneath the dropdown.\n */\n description: { type: String, default: undefined },\n\n /**\n * Disables dropdown functionality.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Displays component in an error state with an error message\n */\n errorMessage: { type: String, default: null },\n\n /**\n * Allows you to set the first day of the week. 0 is sunday, 1 is monday, 6 is saturday\n */\n firstDayOfWeek: Calendar.props.firstDayOfWeek,\n\n /**\n * Indicate if a date should be disabled or not\n */\n isDateDisabled: Calendar.props.isDateDisabled,\n\n /**\n * Sets a minimum limit for selectable dates - dates before `min` will not be selectable\n */\n min: Calendar.props.min,\n\n /**\n * Sets a maximum limit for selectable dates - dates after `max` will not be selectable\n */\n max: Calendar.props.max,\n\n /**\n * Text that is displayed as a label above the element.\n */\n label: { type: String, default: undefined },\n\n /**\n * Highlights the dropdown is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * The Boolean readonly property, when present, makes the element not mutable, meaning the user can not edit the date picker.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Highlights the dropdown is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Selected date\n */\n value: { type: [Date, Object] as PropType<BentoDatePickerValue>, default: null },\n },\n emits: [BentoDatePickerEvent.INPUT],\n setup(props, { emit }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const datePickerContainerId = generateUid('bento-date-picker-container');\n const labelId = generateUid('bento-date-picker-label');\n const descriptionId = generateUid('bento-date-picker-description');\n const errorId = generateUid('bento-date-picker-error');\n const dateErrorId = generateUid('bento-date-picker-date-error');\n const popoverAriaLabel = computed(() => props.label || t('datePicker', { name: datePickerContainerId }));\n\n // Refs\n const calendarContainerRef = ref(null);\n const inputContainerRef = ref(null);\n\n // Values\n const isDateIncorrect = ref(false);\n const isDatePickerOpen = ref(false);\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n watch(\n () => props.disabled,\n disabled => {\n // Close date picker popover if it's opened when it's disabled\n if (disabled && isDatePickerOpen.value) {\n isDatePickerOpen.value = false;\n }\n }\n );\n\n const { dateDisplayValue, textInputValue, formatTextInputDisplayValue } = useDatePickerSingleCalendarText({\n datePickerValue: toRef(props, 'value') as Ref<Date>,\n isDateIncorrect,\n });\n\n const dateErrorText = computed(() => {\n if (\n props.isDateDisabled &&\n props.isDateDisabled(new Date(textInputValue.value)) &&\n !isDatePickerOpen.value\n ) {\n return t('selectedDateIsNotAvailable');\n }\n\n return isDateIncorrect.value ? t('provideDateInAFormat') : null;\n });\n\n const descriptionConditionalClasses = computed(() => ({\n 'b-date-picker__description--error': props.errorMessage || dateErrorText.value,\n }));\n\n const ariaDescribedBy = computed(\n () =>\n `${props.description ? descriptionId : ''} ${props.errorMessage ? errorId : ''} ${\n dateErrorText.value ? dateErrorId : ''\n }`.trim() || null\n );\n\n const isDateEnabled = (date: Date) => {\n // Check if date is between min/max bounds, if there are any\n if ((props.min && date <= props.min) || (props.max && date >= props.max)) {\n return false;\n }\n\n // Check if function is set, otherwise all dates are enabled\n if (props.isDateDisabled) {\n return !props.isDateDisabled(date);\n }\n\n return true;\n };\n\n const closeDatePicker = () => {\n isDatePickerOpen.value = false;\n };\n\n const openDatePicker = () => {\n isDatePickerOpen.value = true;\n\n formatTextInputDisplayValue();\n };\n\n const onDateSelected = (selectedDate: Date) => {\n // Reset the error state when a valid date is selected\n isDateIncorrect.value = false;\n\n closeDatePicker();\n emit(BentoDatePickerEvent.INPUT, selectedDate);\n };\n\n const clearDatePickerValue = async () => {\n if (isDateIncorrect.value) {\n isDateIncorrect.value = false;\n textInputValue.value = null;\n }\n emit(BentoDatePickerEvent.INPUT, null);\n };\n\n const onDateKeyDown = (event: KeyboardEvent) => {\n validateDateInput(event);\n };\n\n const validateDate = (stringDate: string) => {\n // Validate only if the date is complete\n if (stringDate.length < 10) {\n return;\n }\n\n // Checks for YYYY-MM-DD format\n const dateRegex = /^\\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/;\n const isValidDate = dateRegex.test(stringDate) && isDateEnabled(new Date(stringDate));\n if (isValidDate) {\n isDateIncorrect.value = false;\n emit(BentoDatePickerEvent.INPUT, new Date(stringDate));\n } else if (stringDate) {\n // Only set to true if the value exists (not null/undefined)\n isDateIncorrect.value = true;\n emit(BentoDatePickerEvent.INPUT, null);\n }\n };\n\n const validateDateDebounced = debounce(validateDate, DEBOUNCE_TIME);\n\n const onDateInputChange = (stringDate: string) => {\n textInputValue.value = formatDateInputValue(stringDate);\n // If we are closing the date picker, we should validate (and emit date inputs) immediately so the user doesn't have to wait for the debounce time.\n if (isDatePickerOpen.value) {\n validateDateDebounced(textInputValue.value);\n } else {\n validateDate(textInputValue.value);\n }\n };\n\n /**\n * Space bar and Enter keyDown event handler.\n *\n * * Opens the date picker dialog on the first keydown.\n * * Move focus to selected date, i.e., the date displayed in the date input text field. If no date has been selected, places focus on the current date.\n * @param {KeyboardEvent} event Event being triggered\n */\n const onSpaceBarOrEnter = async (event: KeyboardEvent) => {\n if (isDatePickerOpen.value) {\n return;\n }\n event.preventDefault();\n\n openDatePicker();\n\n // Wait for the date picker dialog to open\n await nextTick();\n\n // Set current date (today) if no date is selected\n if (!props.value) {\n // Format the opened date picker date to YYYY-MM-DD\n formatTextInputDisplayValue(new Date());\n emit(BentoDatePickerEvent.INPUT, new Date());\n\n // Wait for new value to be set with the emit\n await nextTick();\n }\n\n // Focus on date\n calendarContainerRef.value?.$refs.calendarRef[0].focusOnDate(props.value);\n };\n\n return {\n // Refs\n inputContainerRef,\n calendarContainerRef,\n\n // Values,\n dateDisplayValue,\n datePickerContainerId,\n descriptionConditionalClasses,\n isDateIncorrect,\n isDatePickerOpen,\n isReadOnly,\n dateErrorText,\n labelId,\n descriptionId,\n errorId,\n dateErrorId,\n popoverAriaLabel,\n ariaDescribedBy,\n textInputValue,\n\n // Events\n closeDatePicker,\n clearDatePickerValue,\n onDateSelected,\n openDatePicker,\n onDateKeyDown,\n onDateInputChange,\n\n // Keyboard navigation\n onSpaceBarOrEnter,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./date-picker.scss\" />\n"],"names":["BentoDatePickerEvent","BentoDatePickerEvent2","useDatePickerSingleCalendarText","datePickerValue","isDateIncorrect","locale","t","useI18n","locales","de","enUS","fr","textInputValue","ref","_a","computed","format","DateFormat","dateToFormat","DEBOUNCE_TIME","_sfc_main","defineComponent","messages","BentoTypography","BentoPopover","Calendar","ErrorMessage","DropdownInputDefault","BentoClickOutsideDirective","props","emit","datePickerContainerId","generateUid","labelId","descriptionId","errorId","dateErrorId","popoverAriaLabel","calendarContainerRef","inputContainerRef","isDatePickerOpen","isReadOnly","useFormLayoutFieldLoading","toRef","watch","disabled","dateDisplayValue","formatTextInputDisplayValue","dateErrorText","descriptionConditionalClasses","ariaDescribedBy","isDateEnabled","date","closeDatePicker","openDatePicker","onDateSelected","selectedDate","clearDatePickerValue","onDateKeyDown","event","validateDateInput","validateDate","stringDate","validateDateDebounced","debounce","formatDateInputValue","nextTick"],"mappings":";;;;;;;;;;;;;;;;;;AAMY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,QAAA,SADQA,IAAAD,KAAA,CAAA,CAAA;ACML,MAAAE,KAAA,CAAA,EAAA,iBAAAC,G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B,EAAA,OAAA,IAAA,KAAA8D,CAAA,CAAA,KAAAA,MAGA1D,EAAA,QAAA,IACA0B,EAAA9B,EAAA,OAAA,IAAA;AAAA,IACA,GAGA+D,IAAAC,EAAAH,GAAA1C,EAAA;AA4CA,WAAA;AAAA;AAAA,MAAA,mBAAAoB;AAAA,MAEA,sBAAAD;AAAA;AAAA,MACA,kBAAAQ;AAAA,MAGA,uBAAAf;AAAA,MACA,+BAAAkB;AAAA,MACA,iBAAA7C;AAAA,MACA,kBAAAoC;AAAA,MACA,YAAAC;AAAA,MACA,eAAAO;AAAA,MACA,SAAAf;AAAA,MACA,eAAAC;AAAA,MACA,SAAAC;AAAA,MACA,aAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,iBAAAa;AAAA,MACA,gBAAAtC;AAAA;AAAA,MACA,iBAAAyC;AAAA,MAGA,sBAAAI;AAAA,MACA,gBAAAF;AAAA,MACA,gBAAAD;AAAA,MACA,eAAAI;AAAA,MACA,mBApEA,CAAAI,MAAA;AACA,QAAAlD,EAAA,QAAAqD,EAAAH,CAAA,GAEAtB,EAAA,QACAuB,EAAAnD,EAAA,KAAA,IAEAiD,EAAAjD,EAAA,KAAA;AAAA,MACA;AAAA;AAAA,MA8DA,mBApDA,OAAA+C,MAAA;;AACA,QAAAnB,EAAA,UAGAmB,EAAA,eAAA,GAEAL,EAAA,GAGA,MAAAY,EAAA,GAGArC,EAAA,UAEAkB,EAAA,oBAAA,KAAA,CAAA,GACAjB,EAAA9B,EAAA,OAAA,oBAAA,KAAA,CAAA,GAGA,MAAAkE,EAAA,KAIApD,IAAAwB,EAAA,UAAA,QAAAxB,EAAA,MAAA,YAAA,GAAA,YAAAe,EAAA;AAAA,MAAA;AAAA,IAiCA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"date-picker.js","sources":["../src/components/date-picker/composables/use-date-picker-single-calendar-text.ts","../src/components/date-picker/date-picker.types.ts","../src/components/date-picker/date-picker.vue"],"sourcesContent":["import { computed, ref } from 'vue';\nimport { de, enUS, fr } from 'date-fns/locale';\nimport { useI18n } from '@/utils/ts/i18n';\nimport { UseDateDisplayText } from './use-date-picker-single-calendar-text.types';\nimport { DateFormat } from '@/types';\nimport format from 'date-fns/format';\n\n/**\n * Composable that sets and formats the date to be displayed in the input box of a Single Date Picker\n * @param {Ref<Date>} option.datePickerValue Ref to the datePickerValue set in the DatePicker component\n * @param {Ref<boolean>} option.isDateIncorrect Indicates if the date is correct or not\n */\nexport const useDatePickerSingleCalendarText: UseDateDisplayText<Date> = ({ datePickerValue, isDateIncorrect }) => {\n const { locale, t } = useI18n();\n const locales = { de, enUS, fr };\n\n const textInputValue = ref(datePickerValue.value?.toDateString());\n\n const dateDisplayValue = computed(() => {\n // Display incorrect date when there's an error with the input\n if (isDateIncorrect.value) {\n return textInputValue.value;\n }\n\n // Display \"Select a date\" when there's no date selected or input\n if (!datePickerValue.value) {\n return t('selectDate') as string;\n }\n\n // Display the date in format \"dd MMM, yyyy (25 Jun, 2023)\" if there's a valid date selected\n return format(datePickerValue.value as Date, DateFormat.FULL_DATE, {\n locale: locales[locale.value.substring(0, 2)] || enUS,\n });\n });\n\n /**\n * Formats the \"dateToFormat\" date value with the yyyy-MM-dd format and sets it as \"formatTextInputDisplayValue\" value\n * @param {DATE} dateToFormat - Date to be assigned and formatted\n */\n const formatTextInputDisplayValue = (dateToFormat: Date = datePickerValue.value) => {\n // If date is incorrect, leave the textInputValue intact\n if (isDateIncorrect.value) {\n return;\n }\n\n textInputValue.value = dateToFormat\n ? format(dateToFormat, DateFormat.NUMERIC_DATE_YEAR_FIRST, {\n locale: locales[locale.value.substring(0, 2)] || enUS,\n })\n : null;\n };\n\n return {\n // Values\n dateDisplayValue,\n textInputValue,\n\n // Methods\n formatTextInputDisplayValue,\n };\n};\n","export { CalendarFirstDayOfWeek as BentoDatePickerFirstDayOfWeek } from '@/internal';\nexport type {\n CalendarIsDateDisabled as BentoDatePickerIsDateDisabled,\n CalendarSingleDateValue as BentoDatePickerValue,\n} from '@/internal';\n\nexport enum BentoDatePickerEvent {\n INPUT = 'input',\n}\n","<!-- 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 :ariaControls=\"datePickerContainerId\"\n :ariaExpanded=\"isDatePickerOpen\"\n :aria-labelledby=\"label ? labelId : null\"\n :aria-describedby=\"ariaDescribedBy\"\n :disabled=\"disabled\"\n dynamic-filtering\n :is-invalid=\"!!errorMessage || !!dateErrorText\"\n :open=\"isDatePickerOpen\"\n :value=\"textInputValue\"\n :display-value=\"dateDisplayValue\"\n :debounce-time=\"0\"\n :readonly=\"isReadOnly\"\n @input=\"onDateInputChange\"\n @open=\"openDatePicker\"\n @keydown=\"onDateKeyDown\"\n @clear=\"clearDatePickerValue\"\n @close=\"closeDatePicker\"\n />\n </div>\n\n <!-- Error Messages -->\n <error-message\n v-if=\"dateErrorText\"\n :id=\"dateErrorId\"\n :error-message=\"dateErrorText\"\n class=\"b-date-picker__error-message\"\n />\n <error-message\n v-if=\"errorMessage\"\n :id=\"errorId\"\n :error-message=\"errorMessage\"\n class=\"b-date-picker__error-message\"\n />\n\n <!-- Description -->\n <bento-typography\n v-if=\"description\"\n class=\"b-date-picker__description\"\n :class=\"descriptionConditionalClasses\"\n el=\"span\"\n >\n {{ description }}\n </bento-typography>\n\n <!-- Calendar container -->\n <bento-popover\n v-if=\"inputContainerRef\"\n :id=\"datePickerContainerId\"\n class=\"b-date-picker__container\"\n role=\"dialog\"\n :open=\"isDatePickerOpen\"\n :target-element=\"inputContainerRef\"\n :disable-focus-trap=\"true\"\n :aria-label=\"popoverAriaLabel\"\n :aria-modal=\"true\"\n position=\"bottom-start\"\n fit-content\n >\n <calendar\n ref=\"calendarContainerRef\"\n :first-day-of-week=\"firstDayOfWeek\"\n :is-date-disabled=\"isDateDisabled\"\n :number-of-months=\"1\"\n :value=\"value\"\n :min=\"min\"\n :max=\"max\"\n @input=\"onDateSelected\"\n />\n </bento-popover>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, nextTick, PropType, Ref, ref, toRef, watch } from 'vue';\n\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 '@/utils/ts/unique-id';\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 } 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 emits: [BentoDatePickerEvent.INPUT],\n setup(props, { emit }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const datePickerContainerId = generateUid('bento-date-picker-container');\n const labelId = generateUid('bento-date-picker-label');\n const descriptionId = generateUid('bento-date-picker-description');\n const errorId = generateUid('bento-date-picker-error');\n const dateErrorId = generateUid('bento-date-picker-date-error');\n const popoverAriaLabel = computed(() => props.label || t('datePicker', { name: datePickerContainerId }));\n\n // Refs\n const calendarContainerRef = ref(null);\n const inputContainerRef = ref(null);\n\n // Values\n const isDateIncorrect = ref(false);\n const isDatePickerOpen = ref(false);\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n watch(\n () => props.disabled,\n disabled => {\n // Close date picker popover if it's opened when it's disabled\n if (disabled && isDatePickerOpen.value) {\n isDatePickerOpen.value = false;\n }\n }\n );\n\n const { dateDisplayValue, textInputValue, formatTextInputDisplayValue } = useDatePickerSingleCalendarText({\n datePickerValue: toRef(props, 'value') as Ref<Date>,\n isDateIncorrect,\n });\n\n const dateErrorText = computed(() => {\n if (\n props.isDateDisabled &&\n props.isDateDisabled(new Date(textInputValue.value)) &&\n !isDatePickerOpen.value\n ) {\n return t('selectedDateIsNotAvailable');\n }\n\n return isDateIncorrect.value ? t('provideDateInAFormat') : null;\n });\n\n const descriptionConditionalClasses = computed(() => ({\n 'b-date-picker__description--error': props.errorMessage || dateErrorText.value,\n }));\n\n const ariaDescribedBy = computed(\n () =>\n `${props.description ? descriptionId : ''} ${props.errorMessage ? errorId : ''} ${\n dateErrorText.value ? dateErrorId : ''\n }`.trim() || null\n );\n\n const isDateEnabled = (date: Date) => {\n // Check if date is between min/max bounds, if there are any\n if ((props.min && date <= props.min) || (props.max && date >= props.max)) {\n return false;\n }\n\n // Check if function is set, otherwise all dates are enabled\n if (props.isDateDisabled) {\n return !props.isDateDisabled(date);\n }\n\n return true;\n };\n\n const closeDatePicker = () => {\n isDatePickerOpen.value = false;\n };\n\n const openDatePicker = () => {\n isDatePickerOpen.value = true;\n\n formatTextInputDisplayValue();\n };\n\n const onDateSelected = (selectedDate: Date) => {\n // Reset the error state when a valid date is selected\n isDateIncorrect.value = false;\n\n closeDatePicker();\n emit(BentoDatePickerEvent.INPUT, selectedDate);\n };\n\n const clearDatePickerValue = async () => {\n if (isDateIncorrect.value) {\n isDateIncorrect.value = false;\n textInputValue.value = null;\n }\n emit(BentoDatePickerEvent.INPUT, null);\n };\n\n const onDateKeyDown = (event: KeyboardEvent) => {\n validateDateInput(event);\n };\n\n const validateDate = (stringDate: string) => {\n // Validate only if the date is complete\n if (stringDate.length < 10) {\n return;\n }\n\n // Checks for YYYY-MM-DD format\n const dateRegex = /^\\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/;\n const isValidDate = dateRegex.test(stringDate) && isDateEnabled(new Date(stringDate));\n if (isValidDate) {\n isDateIncorrect.value = false;\n emit(BentoDatePickerEvent.INPUT, new Date(stringDate));\n } else if (stringDate) {\n // Only set to true if the value exists (not null/undefined)\n isDateIncorrect.value = true;\n emit(BentoDatePickerEvent.INPUT, null);\n }\n };\n\n const validateDateDebounced = debounce(validateDate, DEBOUNCE_TIME);\n\n const onDateInputChange = (stringDate: string) => {\n textInputValue.value = formatDateInputValue(stringDate);\n // If we are closing the date picker, we should validate (and emit date inputs) immediately so the user doesn't have to wait for the debounce time.\n if (isDatePickerOpen.value) {\n validateDateDebounced(textInputValue.value);\n } else {\n validateDate(textInputValue.value);\n }\n };\n\n /**\n * Space bar and Enter keyDown event handler.\n *\n * * Opens the date picker dialog on the first keydown.\n * * Move focus to selected date, i.e., the date displayed in the date input text field. If no date has been selected, places focus on the current date.\n * @param {KeyboardEvent} event Event being triggered\n */\n const onSpaceBarOrEnter = async (event: KeyboardEvent) => {\n if (isDatePickerOpen.value) {\n return;\n }\n event.preventDefault();\n\n openDatePicker();\n\n // Wait for the date picker dialog to open\n await nextTick();\n\n // Set current date (today) if no date is selected\n if (!props.value) {\n // Format the opened date picker date to YYYY-MM-DD\n formatTextInputDisplayValue(new Date());\n emit(BentoDatePickerEvent.INPUT, new Date());\n\n // Wait for new value to be set with the emit\n await nextTick();\n }\n\n // Focus on date\n calendarContainerRef.value?.$refs.calendarRef[0].focusOnDate(props.value);\n };\n\n return {\n // Refs\n inputContainerRef,\n calendarContainerRef,\n\n // Values,\n dateDisplayValue,\n datePickerContainerId,\n descriptionConditionalClasses,\n isDateIncorrect,\n isDatePickerOpen,\n isReadOnly,\n dateErrorText,\n labelId,\n descriptionId,\n errorId,\n dateErrorId,\n popoverAriaLabel,\n ariaDescribedBy,\n textInputValue,\n\n // Events\n closeDatePicker,\n clearDatePickerValue,\n onDateSelected,\n openDatePicker,\n onDateKeyDown,\n onDateInputChange,\n\n // Keyboard navigation\n onSpaceBarOrEnter,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./date-picker.scss\" />\n"],"names":["useDatePickerSingleCalendarText","datePickerValue","isDateIncorrect","locale","t","useI18n","locales","de","enUS","fr","textInputValue","ref","_a","computed","format","DateFormat","dateToFormat","BentoDatePickerEvent","BentoDatePickerEvent2","DEBOUNCE_TIME","_sfc_main","defineComponent","messages","BentoTypography","BentoPopover","Calendar","ErrorMessage","DropdownInputDefault","FieldLabel","BentoClickOutsideDirective","props","emit","datePickerContainerId","generateUid","labelId","descriptionId","errorId","dateErrorId","popoverAriaLabel","calendarContainerRef","inputContainerRef","isDatePickerOpen","isReadOnly","useFormLayoutFieldLoading","toRef","watch","disabled","dateDisplayValue","formatTextInputDisplayValue","dateErrorText","descriptionConditionalClasses","ariaDescribedBy","isDateEnabled","date","closeDatePicker","openDatePicker","onDateSelected","selectedDate","clearDatePickerValue","onDateKeyDown","event","validateDateInput","validateDate","stringDate","validateDateDebounced","debounce","formatDateInputValue","nextTick"],"mappings":";;;;;;;;;;;;;;;;;AAYO,MAAAA,KAAA,CAAA,EAAA,iBAAAC,GAAA,iBAAAC,EAAA,MAAA;;AACH,QAAA,EAAA,QAAAC,GAAA,GAAAC,EAAA,IAAAC,EAAA,GACAC,IAAA,EAAA,IAAAC,GAAA,MAAAC,GAAA,IAAAC,EAAA,GAEAC,IAAAC,GAAAC,IAAAX,EAAA,UAAA,gBAAAW,EAAA,cAAA;AAoCA,SAAA;AAAA;AAAA,IAAO,kBAlCPC,EAAA,MAEIX,EAAA,QACIQ,EAAA,QAIJT,EAAA,QAKAa,EAAAb,EAAA,OAAAc,EAAA,WAAA;AAAA,MAAmE,QAAAT,EAAAH,EAAA,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AAAA,MAEA,sBAAAD;AAAA;AAAA,MACA,kBAAAQ;AAAA,MAGA,uBAAAf;AAAA,MACA,+BAAAkB;AAAA,MACA,iBAAAhD;AAAA,MACA,kBAAAuC;AAAA,MACA,YAAAC;AAAA,MACA,eAAAO;AAAA,MACA,SAAAf;AAAA,MACA,eAAAC;AAAA,MACA,SAAAC;AAAA,MACA,aAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,iBAAAa;AAAA,MACA,gBAAAzC;AAAA;AAAA,MACA,iBAAA4C;AAAA,MAGA,sBAAAI;AAAA,MACA,gBAAAF;AAAA,MACA,gBAAAD;AAAA,MACA,eAAAI;AAAA,MACA,mBApEA,CAAAI,MAAA;AACA,QAAArD,EAAA,QAAAwD,EAAAH,CAAA,GAEAtB,EAAA,QACAuB,EAAAtD,EAAA,KAAA,IAEAoD,EAAApD,EAAA,KAAA;AAAA,MACA;AAAA;AAAA,MA8DA,mBApDA,OAAAkD,MAAA;;AACA,QAAAnB,EAAA,UAGAmB,EAAA,eAAA,GAEAL,EAAA,GAGA,MAAAY,EAAA,GAGArC,EAAA,UAEAkB,EAAA,oBAAA,KAAA,CAAA,GACAjB,EAAAd,EAAA,OAAA,oBAAA,KAAA,CAAA,GAGA,MAAAkD,EAAA,KAIAvD,IAAA2B,EAAA,UAAA,QAAA3B,EAAA,MAAA,YAAA,GAAA,YAAAkB,EAAA;AAAA,MAAA;AAAA,IAiCA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as t, a as r } from "./chunks/index.
|
|
2
|
-
import { b as o } from "./chunks/calendar.
|
|
1
|
+
import { B as t, a as r } from "./chunks/index.a99ffd48.js";
|
|
2
|
+
import { b as o } from "./chunks/calendar.47e9e755.js";
|
|
3
3
|
export {
|
|
4
4
|
t as BentoDateRangePicker,
|
|
5
5
|
r as BentoDateRangePickerEvent,
|
package/dist/divider.js
CHANGED
package/dist/dropdown.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { B as s } from "./chunks/dropdown.
|
|
1
|
+
import { B as s } from "./chunks/dropdown.ce937989.js";
|
|
2
2
|
import { defineComponent as u, computed as l, toRefs as m, provide as f } from "vue";
|
|
3
|
-
import { B as y, L as c } from "./chunks/listbox-option-tag.
|
|
3
|
+
import { B as y, L as c } from "./chunks/listbox-option-tag.97af47fc.js";
|
|
4
4
|
import { n as d } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
5
5
|
import { BentoCountry as v, BentoCountryVariant as _ } from "./country.js";
|
|
6
6
|
import { u as w } from "./chunks/useCountryItems.5d7b436e.js";
|
|
7
7
|
import { d as b } from "./chunks/index.965ac1af.js";
|
|
8
8
|
import { BentoPaymentMethod as I } from "./payment-method.js";
|
|
9
|
-
import "./assets/
|
|
9
|
+
import "./assets/index14.css";
|
|
10
10
|
const $ = u({
|
|
11
11
|
name: "bento-dropdown-avatar",
|
|
12
12
|
components: {
|