@dialpad/dialtone 9.158.0 → 9.159.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/css/dialtone-default-theme.css +20 -1
- package/dist/css/dialtone-default-theme.min.css +1 -1
- package/dist/css/dialtone-docs.json +1 -1
- package/dist/css/dialtone.css +20 -1
- package/dist/css/dialtone.min.css +1 -1
- package/dist/tokens/doc.json +94613 -94613
- package/dist/vue3/component-documentation.json +1 -1
- package/dist/vue3/dialtone-vue.cjs +1 -1
- package/dist/vue3/dialtone-vue.js +155 -153
- package/dist/vue3/dialtone-vue.js.map +1 -1
- package/dist/vue3/lib/datepicker/datepicker.cjs +1 -1
- package/dist/vue3/lib/datepicker/datepicker.cjs.map +1 -1
- package/dist/vue3/lib/datepicker/datepicker.js +306 -242
- package/dist/vue3/lib/datepicker/datepicker.js.map +1 -1
- package/dist/vue3/lib/datepicker/utils.cjs +1 -1
- package/dist/vue3/lib/datepicker/utils.cjs.map +1 -1
- package/dist/vue3/lib/datepicker/utils.js +40 -40
- package/dist/vue3/lib/datepicker/utils.js.map +1 -1
- package/dist/vue3/lib/general-row/index.cjs +1 -1
- package/dist/vue3/lib/general-row/index.js +6 -4
- package/dist/vue3/lib/general-row/index.js.map +1 -1
- package/dist/vue3/lib/message-input/message-input.cjs +1 -1
- package/dist/vue3/lib/message-input/message-input.cjs.map +1 -1
- package/dist/vue3/lib/message-input/message-input.js +17 -16
- package/dist/vue3/lib/message-input/message-input.js.map +1 -1
- package/dist/vue3/types/components/datepicker/composables/useMonthYearPicker.d.ts +4 -0
- package/dist/vue3/types/components/datepicker/composables/useMonthYearPicker.d.ts.map +1 -1
- package/dist/vue3/types/components/datepicker/datepicker.vue.d.ts +8 -0
- package/dist/vue3/types/components/datepicker/datepicker.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/datepicker/modules/month-year-picker.vue.d.ts +4 -0
- package/dist/vue3/types/components/datepicker/modules/month-year-picker.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/datepicker/utils.d.ts +1 -1
- package/dist/vue3/types/components/datepicker/utils.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/leftbar/general_row/index.d.ts +1 -0
- package/package.json +3 -3
|
@@ -1,104 +1,137 @@
|
|
|
1
|
-
import { ref as E, computed as
|
|
2
|
-
import { DtIconChevronsLeft as
|
|
3
|
-
import { getMonth as
|
|
4
|
-
import { getCalendarDays as
|
|
5
|
-
import { INTL_MONTH_FORMAT as
|
|
6
|
-
import { returnFirstEl as
|
|
7
|
-
import { DialtoneLocalization as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
function
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return
|
|
1
|
+
import { ref as E, computed as N, watch as w, onMounted as Z, openBlock as $, createBlock as ee, unref as t, withCtx as p, createVNode as d, createElementVNode as M, toDisplayString as O, nextTick as L, createElementBlock as g, Fragment as B, renderList as V, normalizeClass as ne, createTextVNode as le, getCurrentInstance as re } from "vue";
|
|
2
|
+
import { DtIconChevronsLeft as oe, DtIconChevronLeft as se, DtIconChevronRight as ue, DtIconChevronsRight as ie } from "@dialpad/dialtone-icons/vue3";
|
|
3
|
+
import { getMonth as G, getYear as q, subMonths as W, endOfMonth as j, startOfDay as P, addMonths as J, startOfMonth as Q, getDate as ce, set as de } from "date-fns";
|
|
4
|
+
import { getCalendarDays as fe, formatMonth as De, getWeekDayNames as ve, calculateNextFocusDate as me, calculatePrevFocusDate as pe, formatDate as ke } from "./utils.js";
|
|
5
|
+
import { INTL_MONTH_FORMAT as te, WEEK_START as be } from "./datepicker-constants.js";
|
|
6
|
+
import { returnFirstEl as v, warnIfUnmounted as ye } from "../../common/utils/index.js";
|
|
7
|
+
import { DialtoneLocalization as U } from "../../localization/index.js";
|
|
8
|
+
import Y from "../stack/stack.js";
|
|
9
|
+
import R from "../tooltip/tooltip.js";
|
|
10
|
+
import C from "../button/button.js";
|
|
11
|
+
function he(l, o) {
|
|
12
|
+
const u = E(G(l.selectedDate)), a = E(q(l.selectedDate)), n = E(null), r = E(0), m = E([]), D = new U(), h = N(() => fe(u.value, a.value, n.value, l.minDate, l.maxDate)), k = N(() => {
|
|
13
|
+
if (!l.minDate) return !1;
|
|
14
|
+
const e = W(new Date(a.value, u.value, 1), 1);
|
|
15
|
+
return j(e) < P(l.minDate);
|
|
16
|
+
}), _ = N(() => {
|
|
17
|
+
if (!l.maxDate) return !1;
|
|
18
|
+
const e = J(new Date(a.value, u.value, 1), 1);
|
|
19
|
+
return Q(e) > P(l.maxDate);
|
|
20
|
+
}), b = N(() => {
|
|
21
|
+
if (!l.minDate) return !1;
|
|
22
|
+
const e = new Date(a.value - 1, u.value, 1);
|
|
23
|
+
return j(e) < P(l.minDate);
|
|
24
|
+
}), T = N(() => {
|
|
25
|
+
if (!l.maxDate) return !1;
|
|
26
|
+
const e = new Date(a.value + 1, u.value, 1);
|
|
27
|
+
return Q(e) > P(l.maxDate);
|
|
28
|
+
});
|
|
29
|
+
w(u, () => {
|
|
30
|
+
x(), o("calendar-days", h.value);
|
|
31
|
+
}, { immediate: !0 }), w(a, () => {
|
|
32
|
+
x(), o("calendar-days", h.value);
|
|
33
|
+
}, { immediate: !0 }), w(() => l.minDate, () => {
|
|
34
|
+
o("calendar-days", h.value);
|
|
35
|
+
}), w(() => l.maxDate, () => {
|
|
36
|
+
o("calendar-days", h.value);
|
|
37
|
+
});
|
|
38
|
+
function s(e) {
|
|
39
|
+
return De(e, te, D.currentLocale);
|
|
20
40
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
41
|
+
function i(e) {
|
|
42
|
+
m.value.includes(e) || m.value.push(e);
|
|
23
43
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
44
|
+
function A() {
|
|
45
|
+
v(m.value[0].$el).focus();
|
|
26
46
|
}
|
|
27
|
-
function
|
|
28
|
-
switch (
|
|
47
|
+
function f(e) {
|
|
48
|
+
switch (e.key) {
|
|
29
49
|
case "ArrowLeft":
|
|
30
|
-
|
|
50
|
+
e.preventDefault(), r.value === 0 ? (r.value = 3, v(m.value[r.value].$el).focus()) : (r.value--, v(m.value[r.value].$el).focus());
|
|
31
51
|
break;
|
|
32
52
|
case "ArrowRight":
|
|
33
|
-
|
|
53
|
+
e.preventDefault(), r.value === 3 ? (r.value = 0, v(m.value[r.value].$el).focus()) : (r.value++, v(m.value[r.value].$el).focus());
|
|
34
54
|
break;
|
|
35
55
|
case "ArrowDown":
|
|
36
|
-
|
|
56
|
+
e.preventDefault(), o("focus-first-day");
|
|
37
57
|
break;
|
|
38
58
|
case "Tab":
|
|
39
|
-
|
|
59
|
+
e.preventDefault(), o("focus-first-day");
|
|
40
60
|
break;
|
|
41
61
|
case "Escape":
|
|
42
|
-
|
|
62
|
+
o("close-datepicker");
|
|
43
63
|
break;
|
|
44
64
|
}
|
|
45
65
|
}
|
|
46
|
-
function
|
|
47
|
-
const
|
|
48
|
-
|
|
66
|
+
function x() {
|
|
67
|
+
const e = q(l.selectedDate), I = G(l.selectedDate);
|
|
68
|
+
e !== a.value || I !== u.value ? n.value = null : n.value = ce(l.selectedDate);
|
|
49
69
|
}
|
|
50
|
-
function
|
|
51
|
-
(
|
|
52
|
-
|
|
53
|
-
|
|
70
|
+
function y(e) {
|
|
71
|
+
if (e === -1 && k.value || e === 1 && _.value) return;
|
|
72
|
+
(u.value === 0 && e === -1 || u.value === 11 && e === 1) && (a.value += e);
|
|
73
|
+
const I = de(l.selectedDate, { month: u.value, year: a.value }), ae = e === 1 ? J(I, 1) : W(I, 1);
|
|
74
|
+
u.value = G(ae);
|
|
54
75
|
}
|
|
55
|
-
function
|
|
56
|
-
|
|
76
|
+
function K(e) {
|
|
77
|
+
e === -1 && b.value || e === 1 && T.value || (a.value = a.value + e);
|
|
57
78
|
}
|
|
58
|
-
function
|
|
59
|
-
|
|
79
|
+
function F() {
|
|
80
|
+
y(1);
|
|
60
81
|
}
|
|
61
|
-
function
|
|
62
|
-
|
|
82
|
+
function z() {
|
|
83
|
+
y(-1);
|
|
63
84
|
}
|
|
64
|
-
function
|
|
65
|
-
return `${
|
|
85
|
+
function H() {
|
|
86
|
+
return `${D.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${D.$t("DIALTONE_DATEPICKER_PREVIOUS_YEAR")} ${a.value - 1}`;
|
|
66
87
|
}
|
|
67
|
-
function
|
|
68
|
-
return `${
|
|
88
|
+
function S() {
|
|
89
|
+
return `${D.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${D.$t("DIALTONE_DATEPICKER_PREVIOUS_MONTH")} ${s(u.value - 1)}`;
|
|
69
90
|
}
|
|
70
|
-
function
|
|
71
|
-
return `${
|
|
91
|
+
function X() {
|
|
92
|
+
return `${D.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${D.$t("DIALTONE_DATEPICKER_NEXT_YEAR")} ${a.value + 1}`;
|
|
72
93
|
}
|
|
73
|
-
function
|
|
74
|
-
return `${
|
|
94
|
+
function c() {
|
|
95
|
+
return `${D.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${D.$t("DIALTONE_DATEPICKER_NEXT_MONTH")} ${s(u.value + 1)}`;
|
|
75
96
|
}
|
|
76
97
|
return {
|
|
77
|
-
selectMonth:
|
|
78
|
-
selectYear:
|
|
79
|
-
formattedMonth:
|
|
80
|
-
setDayRef:
|
|
81
|
-
focusMonthYearPicker:
|
|
82
|
-
handleKeyDown:
|
|
83
|
-
changeMonth:
|
|
84
|
-
changeYear:
|
|
85
|
-
goToNextMonth:
|
|
86
|
-
goToPrevMonth:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
98
|
+
selectMonth: u,
|
|
99
|
+
selectYear: a,
|
|
100
|
+
formattedMonth: s,
|
|
101
|
+
setDayRef: i,
|
|
102
|
+
focusMonthYearPicker: A,
|
|
103
|
+
handleKeyDown: f,
|
|
104
|
+
changeMonth: y,
|
|
105
|
+
changeYear: K,
|
|
106
|
+
goToNextMonth: F,
|
|
107
|
+
goToPrevMonth: z,
|
|
108
|
+
isPrevMonthDisabled: k,
|
|
109
|
+
isNextMonthDisabled: _,
|
|
110
|
+
isPrevYearDisabled: b,
|
|
111
|
+
isNextYearDisabled: T,
|
|
112
|
+
previousYearAriaLabel: H,
|
|
113
|
+
previousMonthAriaLabel: S,
|
|
114
|
+
nextYearAriaLabel: X,
|
|
115
|
+
nextMonthAriaLabel: c
|
|
91
116
|
};
|
|
92
117
|
}
|
|
93
|
-
const
|
|
118
|
+
const _e = {
|
|
94
119
|
id: "calendar-heading",
|
|
95
120
|
class: "d-datepicker__month-year-title"
|
|
96
|
-
},
|
|
121
|
+
}, $e = {
|
|
97
122
|
__name: "month-year-picker",
|
|
98
123
|
props: {
|
|
99
124
|
selectedDate: {
|
|
100
125
|
type: Date,
|
|
101
126
|
required: !0
|
|
127
|
+
},
|
|
128
|
+
minDate: {
|
|
129
|
+
type: Date,
|
|
130
|
+
default: null
|
|
131
|
+
},
|
|
132
|
+
maxDate: {
|
|
133
|
+
type: Date,
|
|
134
|
+
default: null
|
|
102
135
|
}
|
|
103
136
|
},
|
|
104
137
|
emits: [
|
|
@@ -128,166 +161,174 @@ const pe = {
|
|
|
128
161
|
*/
|
|
129
162
|
"close-datepicker"
|
|
130
163
|
],
|
|
131
|
-
setup(
|
|
132
|
-
const
|
|
133
|
-
selectMonth:
|
|
134
|
-
selectYear:
|
|
135
|
-
formattedMonth:
|
|
164
|
+
setup(l, { expose: o, emit: u }) {
|
|
165
|
+
const a = l, n = u, r = new U(), {
|
|
166
|
+
selectMonth: m,
|
|
167
|
+
selectYear: D,
|
|
168
|
+
formattedMonth: h,
|
|
136
169
|
setDayRef: k,
|
|
137
|
-
focusMonthYearPicker:
|
|
138
|
-
handleKeyDown:
|
|
139
|
-
changeMonth:
|
|
140
|
-
changeYear:
|
|
141
|
-
goToNextMonth:
|
|
142
|
-
goToPrevMonth:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}), (
|
|
170
|
+
focusMonthYearPicker: _,
|
|
171
|
+
handleKeyDown: b,
|
|
172
|
+
changeMonth: T,
|
|
173
|
+
changeYear: s,
|
|
174
|
+
goToNextMonth: i,
|
|
175
|
+
goToPrevMonth: A,
|
|
176
|
+
isPrevMonthDisabled: f,
|
|
177
|
+
isNextMonthDisabled: x,
|
|
178
|
+
isPrevYearDisabled: y,
|
|
179
|
+
isNextYearDisabled: K,
|
|
180
|
+
previousYearAriaLabel: F,
|
|
181
|
+
previousMonthAriaLabel: z,
|
|
182
|
+
nextMonthAriaLabel: H,
|
|
183
|
+
nextYearAriaLabel: S
|
|
184
|
+
} = he(a, n);
|
|
185
|
+
return Z(() => {
|
|
186
|
+
_();
|
|
187
|
+
}), o({
|
|
188
|
+
focusMonthYearPicker: _,
|
|
189
|
+
goToNextMonth: i,
|
|
190
|
+
goToPrevMonth: A
|
|
191
|
+
}), (X, c) => ($(), ee(t(Y), {
|
|
155
192
|
class: "d-datepicker__month-year",
|
|
156
193
|
direction: "row",
|
|
157
194
|
gap: "300"
|
|
158
195
|
}, {
|
|
159
|
-
default:
|
|
160
|
-
|
|
196
|
+
default: p(() => [
|
|
197
|
+
d(t(Y), {
|
|
161
198
|
as: "nav",
|
|
162
199
|
class: "d-datepicker__nav",
|
|
163
200
|
direction: "row",
|
|
164
201
|
gap: "200"
|
|
165
202
|
}, {
|
|
166
|
-
default:
|
|
167
|
-
|
|
203
|
+
default: p(() => [
|
|
204
|
+
d(t(R), {
|
|
168
205
|
"fallback-placements": ["top-start", "auto"],
|
|
169
|
-
message:
|
|
206
|
+
message: t(r).$t("DIALTONE_DATEPICKER_PREVIOUS_YEAR"),
|
|
170
207
|
placement: "top"
|
|
171
208
|
}, {
|
|
172
|
-
anchor:
|
|
173
|
-
|
|
209
|
+
anchor: p(() => [
|
|
210
|
+
d(t(C), {
|
|
174
211
|
id: "prevYearButton",
|
|
175
|
-
ref: (
|
|
176
|
-
|
|
212
|
+
ref: (e) => {
|
|
213
|
+
e && t(k)(e);
|
|
177
214
|
},
|
|
178
|
-
"aria-label":
|
|
215
|
+
"aria-label": t(F)(),
|
|
179
216
|
circle: !0,
|
|
217
|
+
disabled: t(y),
|
|
180
218
|
class: "d-datepicker__nav-btn",
|
|
181
219
|
importance: "clear",
|
|
182
220
|
kind: "muted",
|
|
183
221
|
size: "xs",
|
|
184
222
|
type: "button",
|
|
185
|
-
onClick:
|
|
186
|
-
onKeydown:
|
|
223
|
+
onClick: c[0] || (c[0] = (e) => t(s)(-1)),
|
|
224
|
+
onKeydown: c[1] || (c[1] = (e) => t(b)(e))
|
|
187
225
|
}, {
|
|
188
|
-
default:
|
|
189
|
-
|
|
226
|
+
default: p(() => [
|
|
227
|
+
d(t(oe), { size: "200" })
|
|
190
228
|
]),
|
|
191
229
|
_: 1
|
|
192
|
-
}, 8, ["aria-label"])
|
|
230
|
+
}, 8, ["aria-label", "disabled"])
|
|
193
231
|
]),
|
|
194
232
|
_: 1
|
|
195
233
|
}, 8, ["message"]),
|
|
196
|
-
|
|
234
|
+
d(t(R), {
|
|
197
235
|
"fallback-placements": ["top-start", "auto"],
|
|
198
|
-
message:
|
|
236
|
+
message: t(r).$t("DIALTONE_DATEPICKER_PREVIOUS_MONTH"),
|
|
199
237
|
placement: "top"
|
|
200
238
|
}, {
|
|
201
|
-
anchor:
|
|
202
|
-
|
|
239
|
+
anchor: p(() => [
|
|
240
|
+
d(t(C), {
|
|
203
241
|
id: "prevMonthButton",
|
|
204
|
-
ref: (
|
|
205
|
-
|
|
242
|
+
ref: (e) => {
|
|
243
|
+
e && t(k)(e);
|
|
206
244
|
},
|
|
207
|
-
"aria-label":
|
|
245
|
+
"aria-label": t(z)(),
|
|
208
246
|
circle: !0,
|
|
247
|
+
disabled: t(f),
|
|
209
248
|
class: "d-datepicker__nav-btn",
|
|
210
249
|
importance: "clear",
|
|
211
250
|
kind: "muted",
|
|
212
251
|
size: "xs",
|
|
213
252
|
type: "button",
|
|
214
|
-
onClick:
|
|
215
|
-
onKeydown:
|
|
253
|
+
onClick: c[2] || (c[2] = (e) => t(T)(-1)),
|
|
254
|
+
onKeydown: c[3] || (c[3] = (e) => t(b)(e))
|
|
216
255
|
}, {
|
|
217
|
-
default:
|
|
218
|
-
|
|
256
|
+
default: p(() => [
|
|
257
|
+
d(t(se), { size: "200" })
|
|
219
258
|
]),
|
|
220
259
|
_: 1
|
|
221
|
-
}, 8, ["aria-label"])
|
|
260
|
+
}, 8, ["aria-label", "disabled"])
|
|
222
261
|
]),
|
|
223
262
|
_: 1
|
|
224
263
|
}, 8, ["message"])
|
|
225
264
|
]),
|
|
226
265
|
_: 1
|
|
227
266
|
}),
|
|
228
|
-
M("div",
|
|
229
|
-
|
|
267
|
+
M("div", _e, O(t(h)(t(m))) + " " + O(t(D)), 1),
|
|
268
|
+
d(t(Y), {
|
|
230
269
|
as: "nav",
|
|
231
270
|
class: "d-datepicker__nav",
|
|
232
271
|
direction: "row",
|
|
233
272
|
gap: "200"
|
|
234
273
|
}, {
|
|
235
|
-
default:
|
|
236
|
-
|
|
274
|
+
default: p(() => [
|
|
275
|
+
d(t(R), {
|
|
237
276
|
"fallback-placements": ["top-end", "auto"],
|
|
238
|
-
message:
|
|
277
|
+
message: t(r).$t("DIALTONE_DATEPICKER_NEXT_MONTH"),
|
|
239
278
|
placement: "top"
|
|
240
279
|
}, {
|
|
241
|
-
anchor:
|
|
242
|
-
|
|
280
|
+
anchor: p(() => [
|
|
281
|
+
d(t(C), {
|
|
243
282
|
id: "nextMonthButton",
|
|
244
|
-
ref: (
|
|
245
|
-
|
|
283
|
+
ref: (e) => {
|
|
284
|
+
e && t(k)(e);
|
|
246
285
|
},
|
|
247
|
-
"aria-label":
|
|
286
|
+
"aria-label": t(H)(),
|
|
248
287
|
circle: !0,
|
|
288
|
+
disabled: t(x),
|
|
249
289
|
class: "d-datepicker__nav-btn",
|
|
250
290
|
importance: "clear",
|
|
251
291
|
kind: "muted",
|
|
252
292
|
size: "xs",
|
|
253
293
|
type: "button",
|
|
254
|
-
onClick:
|
|
255
|
-
onKeydown:
|
|
294
|
+
onClick: c[4] || (c[4] = (e) => t(T)(1)),
|
|
295
|
+
onKeydown: c[5] || (c[5] = (e) => t(b)(e))
|
|
256
296
|
}, {
|
|
257
|
-
default:
|
|
258
|
-
|
|
297
|
+
default: p(() => [
|
|
298
|
+
d(t(ue), { size: "200" })
|
|
259
299
|
]),
|
|
260
300
|
_: 1
|
|
261
|
-
}, 8, ["aria-label"])
|
|
301
|
+
}, 8, ["aria-label", "disabled"])
|
|
262
302
|
]),
|
|
263
303
|
_: 1
|
|
264
304
|
}, 8, ["message"]),
|
|
265
|
-
|
|
305
|
+
d(t(R), {
|
|
266
306
|
"fallback-placements": ["top-end", "auto"],
|
|
267
|
-
message:
|
|
307
|
+
message: t(r).$t("DIALTONE_DATEPICKER_NEXT_YEAR"),
|
|
268
308
|
placement: "top"
|
|
269
309
|
}, {
|
|
270
|
-
anchor:
|
|
271
|
-
|
|
310
|
+
anchor: p(() => [
|
|
311
|
+
d(t(C), {
|
|
272
312
|
id: "nextYearButton",
|
|
273
|
-
ref: (
|
|
274
|
-
|
|
313
|
+
ref: (e) => {
|
|
314
|
+
e && t(k)(e);
|
|
275
315
|
},
|
|
276
|
-
"aria-label":
|
|
316
|
+
"aria-label": t(S)(),
|
|
277
317
|
circle: !0,
|
|
318
|
+
disabled: t(K),
|
|
278
319
|
class: "d-datepicker__nav-btn",
|
|
279
320
|
importance: "clear",
|
|
280
321
|
kind: "muted",
|
|
281
322
|
size: "xs",
|
|
282
323
|
type: "button",
|
|
283
|
-
onClick:
|
|
284
|
-
onKeydown:
|
|
324
|
+
onClick: c[6] || (c[6] = (e) => t(s)(1)),
|
|
325
|
+
onKeydown: c[7] || (c[7] = (e) => t(b)(e))
|
|
285
326
|
}, {
|
|
286
|
-
default:
|
|
287
|
-
|
|
327
|
+
default: p(() => [
|
|
328
|
+
d(t(ie), { size: "200" })
|
|
288
329
|
]),
|
|
289
330
|
_: 1
|
|
290
|
-
}, 8, ["aria-label"])
|
|
331
|
+
}, 8, ["aria-label", "disabled"])
|
|
291
332
|
]),
|
|
292
333
|
_: 1
|
|
293
334
|
}, 8, ["message"])
|
|
@@ -299,82 +340,82 @@ const pe = {
|
|
|
299
340
|
}));
|
|
300
341
|
}
|
|
301
342
|
};
|
|
302
|
-
function
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
|
|
343
|
+
function Ee(l, o) {
|
|
344
|
+
const u = E(null), a = E(0), n = E([]), r = new U(), m = N(() => ve(l.locale, be));
|
|
345
|
+
w(() => l.calendarDays, () => {
|
|
346
|
+
a.value = 0, n.value = [], u.value = null;
|
|
306
347
|
});
|
|
307
|
-
function
|
|
308
|
-
return r.$t("DIALTONE_DATEPICKER_SELECT_DAY") + ` ${
|
|
348
|
+
function D(s) {
|
|
349
|
+
return r.$t("DIALTONE_DATEPICKER_SELECT_DAY") + ` ${ke(s.value, te, r.currentLocale)}`;
|
|
309
350
|
}
|
|
310
|
-
function
|
|
311
|
-
!n.value.some((
|
|
351
|
+
function h(s, i) {
|
|
352
|
+
!n.value.some((A) => A.el === s) && !i.disabled && n.value.push({ el: s, day: i });
|
|
312
353
|
}
|
|
313
|
-
function k(
|
|
314
|
-
switch (
|
|
354
|
+
function k(s) {
|
|
355
|
+
switch (s.key) {
|
|
315
356
|
case "ArrowUp":
|
|
316
|
-
|
|
357
|
+
s.preventDefault(), a.value -= 7;
|
|
317
358
|
try {
|
|
318
|
-
|
|
359
|
+
v(n.value[a.value].el.$el).focus();
|
|
319
360
|
} catch {
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
|
|
361
|
+
const i = pe(n.value[a.value + 7].day.value);
|
|
362
|
+
o("go-to-prev-month"), L(() => {
|
|
363
|
+
v(n.value[i - 1].el.$el).focus(), a.value += i - 1;
|
|
323
364
|
});
|
|
324
365
|
}
|
|
325
366
|
break;
|
|
326
367
|
case "ArrowDown":
|
|
327
|
-
|
|
368
|
+
s.preventDefault(), a.value += 7;
|
|
328
369
|
try {
|
|
329
|
-
|
|
370
|
+
v(n.value[a.value].el.$el).focus();
|
|
330
371
|
} catch {
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
|
|
372
|
+
const i = me(n.value[a.value - 7].day.value);
|
|
373
|
+
o("go-to-next-month"), L(() => {
|
|
374
|
+
v(n.value[i - 1].el.$el).focus(), a.value += i - 1;
|
|
334
375
|
});
|
|
335
376
|
}
|
|
336
377
|
break;
|
|
337
378
|
case "ArrowLeft":
|
|
338
|
-
|
|
379
|
+
s.preventDefault(), a.value > 0 ? (a.value -= 1, v(n.value[a.value].el.$el).focus()) : (o("go-to-prev-month"), b());
|
|
339
380
|
break;
|
|
340
381
|
case "ArrowRight":
|
|
341
|
-
|
|
382
|
+
s.preventDefault(), a.value < n.value.length - 1 ? (a.value += 1, v(n.value[a.value].el.$el).focus()) : (o("go-to-next-month"), _());
|
|
342
383
|
break;
|
|
343
384
|
case "Tab":
|
|
344
|
-
|
|
385
|
+
s.preventDefault(), o("focus-month-year-picker");
|
|
345
386
|
break;
|
|
346
387
|
case "Escape":
|
|
347
|
-
|
|
388
|
+
o("close-datepicker");
|
|
348
389
|
break;
|
|
349
390
|
}
|
|
350
391
|
}
|
|
351
|
-
function
|
|
352
|
-
|
|
353
|
-
|
|
392
|
+
function _() {
|
|
393
|
+
a.value = 0, L(() => {
|
|
394
|
+
v(n.value[a.value].el.$el).focus();
|
|
354
395
|
});
|
|
355
396
|
}
|
|
356
|
-
function
|
|
357
|
-
|
|
358
|
-
|
|
397
|
+
function b() {
|
|
398
|
+
L(() => {
|
|
399
|
+
a.value = n.value.length - 1, v(n.value[a.value].el.$el).focus();
|
|
359
400
|
});
|
|
360
401
|
}
|
|
361
|
-
function
|
|
362
|
-
|
|
402
|
+
function T(s) {
|
|
403
|
+
s.disabled || (u.value = s.text, o("select-date", s.value));
|
|
363
404
|
}
|
|
364
405
|
return {
|
|
365
|
-
selectedDay:
|
|
366
|
-
weekDays:
|
|
367
|
-
dayAriaLabel:
|
|
368
|
-
setDayRef:
|
|
406
|
+
selectedDay: u,
|
|
407
|
+
weekDays: m,
|
|
408
|
+
dayAriaLabel: D,
|
|
409
|
+
setDayRef: h,
|
|
369
410
|
handleKeyDown: k,
|
|
370
|
-
focusFirstDay:
|
|
371
|
-
selectDay:
|
|
411
|
+
focusFirstDay: _,
|
|
412
|
+
selectDay: T
|
|
372
413
|
};
|
|
373
414
|
}
|
|
374
|
-
const
|
|
415
|
+
const Te = {
|
|
375
416
|
class: "d-datepicker__calendar",
|
|
376
417
|
"aria-labelledby": "calendar-heading"
|
|
377
|
-
},
|
|
418
|
+
}, Ae = ["title", "aria-label"], ge = {
|
|
378
419
|
__name: "calendar",
|
|
379
420
|
props: {
|
|
380
421
|
calendarDays: {
|
|
@@ -415,63 +456,63 @@ const ke = {
|
|
|
415
456
|
*/
|
|
416
457
|
"go-to-prev-month"
|
|
417
458
|
],
|
|
418
|
-
setup(
|
|
419
|
-
const
|
|
459
|
+
setup(l, { expose: o, emit: u }) {
|
|
460
|
+
const a = l, n = u, {
|
|
420
461
|
selectedDay: r,
|
|
421
|
-
weekDays:
|
|
422
|
-
dayAriaLabel:
|
|
423
|
-
setDayRef:
|
|
462
|
+
weekDays: m,
|
|
463
|
+
dayAriaLabel: D,
|
|
464
|
+
setDayRef: h,
|
|
424
465
|
handleKeyDown: k,
|
|
425
|
-
focusFirstDay:
|
|
426
|
-
selectDay:
|
|
427
|
-
} =
|
|
428
|
-
return
|
|
429
|
-
focusFirstDay:
|
|
430
|
-
}), (
|
|
466
|
+
focusFirstDay: _,
|
|
467
|
+
selectDay: b
|
|
468
|
+
} = Ee(a, n);
|
|
469
|
+
return o({
|
|
470
|
+
focusFirstDay: _
|
|
471
|
+
}), (T, s) => ($(), g("table", Te, [
|
|
431
472
|
M("thead", null, [
|
|
432
473
|
M("tr", null, [
|
|
433
|
-
($(!0), g(
|
|
434
|
-
key:
|
|
474
|
+
($(!0), g(B, null, V(t(m), (i) => ($(), g("th", {
|
|
475
|
+
key: i,
|
|
435
476
|
scope: "col",
|
|
436
477
|
class: "d-datepicker__cell d-datepicker__cell--header"
|
|
437
478
|
}, [
|
|
438
479
|
M("span", {
|
|
439
480
|
class: "d-datepicker__weekday",
|
|
440
|
-
title:
|
|
441
|
-
"aria-label":
|
|
442
|
-
},
|
|
481
|
+
title: i,
|
|
482
|
+
"aria-label": i
|
|
483
|
+
}, O(i), 9, Ae)
|
|
443
484
|
]))), 128))
|
|
444
485
|
])
|
|
445
486
|
]),
|
|
446
487
|
M("tbody", null, [
|
|
447
|
-
($(!0), g(
|
|
448
|
-
($(!0), g(
|
|
449
|
-
key:
|
|
488
|
+
($(!0), g(B, null, V(l.calendarDays, (i, A) => ($(), g("tr", { key: A }, [
|
|
489
|
+
($(!0), g(B, null, V(i.days, (f, x) => ($(), g("td", {
|
|
490
|
+
key: A + x,
|
|
450
491
|
class: "d-datepicker__cell",
|
|
451
492
|
role: "listbox"
|
|
452
493
|
}, [
|
|
453
|
-
|
|
494
|
+
d(t(C), {
|
|
454
495
|
ref_for: !0,
|
|
455
496
|
ref: (y) => {
|
|
456
|
-
y &&
|
|
497
|
+
y && t(h)(y, f);
|
|
457
498
|
},
|
|
458
|
-
class:
|
|
459
|
-
"d-datepicker__day--disabled":
|
|
460
|
-
"d-datepicker__day--selected":
|
|
499
|
+
class: ne(["d-datepicker__day", {
|
|
500
|
+
"d-datepicker__day--disabled": f.disabled,
|
|
501
|
+
"d-datepicker__day--selected": t(r) ? f.text === t(r) && !f.disabled : f.selected
|
|
461
502
|
}]),
|
|
462
503
|
circle: !0,
|
|
463
504
|
size: "sm",
|
|
464
505
|
importance: "clear",
|
|
465
|
-
disabled:
|
|
506
|
+
disabled: f.disabled,
|
|
466
507
|
type: "button",
|
|
467
|
-
"aria-selected":
|
|
468
|
-
"aria-label":
|
|
508
|
+
"aria-selected": t(r) ? f.text === t(r) && !f.disabled : f.selected,
|
|
509
|
+
"aria-label": t(D)(f),
|
|
469
510
|
role: "option",
|
|
470
|
-
onClick: (y) =>
|
|
471
|
-
onKeydown:
|
|
511
|
+
onClick: (y) => t(b)(f),
|
|
512
|
+
onKeydown: s[0] || (s[0] = (y) => t(k)(y))
|
|
472
513
|
}, {
|
|
473
|
-
default:
|
|
474
|
-
|
|
514
|
+
default: p(() => [
|
|
515
|
+
le(O(f.text), 1)
|
|
475
516
|
]),
|
|
476
517
|
_: 2
|
|
477
518
|
}, 1032, ["disabled", "class", "aria-selected", "aria-label", "onClick"])
|
|
@@ -480,7 +521,7 @@ const ke = {
|
|
|
480
521
|
])
|
|
481
522
|
]));
|
|
482
523
|
}
|
|
483
|
-
},
|
|
524
|
+
}, Me = { class: "d-datepicker__hd" }, xe = { class: "d-datepicker__bd" }, Fe = {
|
|
484
525
|
__name: "datepicker",
|
|
485
526
|
props: {
|
|
486
527
|
/**
|
|
@@ -491,6 +532,27 @@ const ke = {
|
|
|
491
532
|
selectedDate: {
|
|
492
533
|
type: Date,
|
|
493
534
|
default: () => /* @__PURE__ */ new Date()
|
|
535
|
+
},
|
|
536
|
+
/**
|
|
537
|
+
* Minimum selectable date. Days before this date will be disabled.
|
|
538
|
+
* Must be before or equal to maxDate when both are provided.
|
|
539
|
+
*
|
|
540
|
+
* @type {Date}
|
|
541
|
+
*/
|
|
542
|
+
minDate: {
|
|
543
|
+
type: Date,
|
|
544
|
+
default: null
|
|
545
|
+
},
|
|
546
|
+
/**
|
|
547
|
+
* Maximum selectable date. Days after this date will be disabled.
|
|
548
|
+
* Must be after or equal to minDate when both are provided.
|
|
549
|
+
*
|
|
550
|
+
* @type {Date}
|
|
551
|
+
*/
|
|
552
|
+
maxDate: {
|
|
553
|
+
type: Date,
|
|
554
|
+
default: null,
|
|
555
|
+
validator: (l, o) => l && o.minDate && l < o.minDate ? (console.warn("[DtDatepicker]: maxDate must be after or equal to minDate."), !1) : !0
|
|
494
556
|
}
|
|
495
557
|
},
|
|
496
558
|
emits: [
|
|
@@ -508,38 +570,40 @@ const ke = {
|
|
|
508
570
|
*/
|
|
509
571
|
"close-datepicker"
|
|
510
572
|
],
|
|
511
|
-
setup(
|
|
512
|
-
const
|
|
513
|
-
function
|
|
514
|
-
|
|
573
|
+
setup(l) {
|
|
574
|
+
const o = E([]);
|
|
575
|
+
function u(a) {
|
|
576
|
+
o.value = a;
|
|
515
577
|
}
|
|
516
|
-
return
|
|
517
|
-
const
|
|
518
|
-
|
|
519
|
-
}), (
|
|
578
|
+
return Z(() => {
|
|
579
|
+
const a = re();
|
|
580
|
+
ye(v(a.proxy.$el), "datepicker");
|
|
581
|
+
}), (a, n) => ($(), ee(t(Y), {
|
|
520
582
|
class: "d-datepicker",
|
|
521
583
|
gap: "400"
|
|
522
584
|
}, {
|
|
523
|
-
default:
|
|
524
|
-
M("div",
|
|
525
|
-
|
|
585
|
+
default: p(() => [
|
|
586
|
+
M("div", Me, [
|
|
587
|
+
d($e, {
|
|
526
588
|
ref: "monthYearPicker",
|
|
527
|
-
"selected-date":
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
589
|
+
"selected-date": l.selectedDate,
|
|
590
|
+
"min-date": l.minDate,
|
|
591
|
+
"max-date": l.maxDate,
|
|
592
|
+
onCalendarDays: u,
|
|
593
|
+
onFocusFirstDay: n[0] || (n[0] = (r) => a.$refs.calendar.focusFirstDay()),
|
|
594
|
+
onFocusLastDay: n[1] || (n[1] = (r) => a.$refs.calendar.focusLastDay()),
|
|
595
|
+
onCloseDatepicker: n[2] || (n[2] = (r) => a.$emit("close-datepicker"))
|
|
596
|
+
}, null, 8, ["selected-date", "min-date", "max-date"])
|
|
533
597
|
]),
|
|
534
|
-
M("div",
|
|
535
|
-
|
|
598
|
+
M("div", xe, [
|
|
599
|
+
d(ge, {
|
|
536
600
|
ref: "calendar",
|
|
537
|
-
"calendar-days":
|
|
538
|
-
onSelectDate: n[3] || (n[3] = (r) =>
|
|
539
|
-
onFocusMonthYearPicker: n[4] || (n[4] = (r) =>
|
|
540
|
-
onCloseDatepicker: n[5] || (n[5] = (r) =>
|
|
541
|
-
onGoToNextMonth: n[6] || (n[6] = (r) =>
|
|
542
|
-
onGoToPrevMonth: n[7] || (n[7] = (r) =>
|
|
601
|
+
"calendar-days": o.value,
|
|
602
|
+
onSelectDate: n[3] || (n[3] = (r) => a.$emit("selected-date", r)),
|
|
603
|
+
onFocusMonthYearPicker: n[4] || (n[4] = (r) => a.$refs.monthYearPicker.focusMonthYearPicker()),
|
|
604
|
+
onCloseDatepicker: n[5] || (n[5] = (r) => a.$emit("close-datepicker")),
|
|
605
|
+
onGoToNextMonth: n[6] || (n[6] = (r) => a.$refs.monthYearPicker.goToNextMonth()),
|
|
606
|
+
onGoToPrevMonth: n[7] || (n[7] = (r) => a.$refs.monthYearPicker.goToPrevMonth())
|
|
543
607
|
}, null, 8, ["calendar-days"])
|
|
544
608
|
])
|
|
545
609
|
]),
|
|
@@ -548,6 +612,6 @@ const ke = {
|
|
|
548
612
|
}
|
|
549
613
|
};
|
|
550
614
|
export {
|
|
551
|
-
|
|
615
|
+
Fe as default
|
|
552
616
|
};
|
|
553
617
|
//# sourceMappingURL=datepicker.js.map
|