@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.
Files changed (36) hide show
  1. package/dist/css/dialtone-default-theme.css +20 -1
  2. package/dist/css/dialtone-default-theme.min.css +1 -1
  3. package/dist/css/dialtone-docs.json +1 -1
  4. package/dist/css/dialtone.css +20 -1
  5. package/dist/css/dialtone.min.css +1 -1
  6. package/dist/tokens/doc.json +94613 -94613
  7. package/dist/vue3/component-documentation.json +1 -1
  8. package/dist/vue3/dialtone-vue.cjs +1 -1
  9. package/dist/vue3/dialtone-vue.js +155 -153
  10. package/dist/vue3/dialtone-vue.js.map +1 -1
  11. package/dist/vue3/lib/datepicker/datepicker.cjs +1 -1
  12. package/dist/vue3/lib/datepicker/datepicker.cjs.map +1 -1
  13. package/dist/vue3/lib/datepicker/datepicker.js +306 -242
  14. package/dist/vue3/lib/datepicker/datepicker.js.map +1 -1
  15. package/dist/vue3/lib/datepicker/utils.cjs +1 -1
  16. package/dist/vue3/lib/datepicker/utils.cjs.map +1 -1
  17. package/dist/vue3/lib/datepicker/utils.js +40 -40
  18. package/dist/vue3/lib/datepicker/utils.js.map +1 -1
  19. package/dist/vue3/lib/general-row/index.cjs +1 -1
  20. package/dist/vue3/lib/general-row/index.js +6 -4
  21. package/dist/vue3/lib/general-row/index.js.map +1 -1
  22. package/dist/vue3/lib/message-input/message-input.cjs +1 -1
  23. package/dist/vue3/lib/message-input/message-input.cjs.map +1 -1
  24. package/dist/vue3/lib/message-input/message-input.js +17 -16
  25. package/dist/vue3/lib/message-input/message-input.js.map +1 -1
  26. package/dist/vue3/types/components/datepicker/composables/useMonthYearPicker.d.ts +4 -0
  27. package/dist/vue3/types/components/datepicker/composables/useMonthYearPicker.d.ts.map +1 -1
  28. package/dist/vue3/types/components/datepicker/datepicker.vue.d.ts +8 -0
  29. package/dist/vue3/types/components/datepicker/datepicker.vue.d.ts.map +1 -1
  30. package/dist/vue3/types/components/datepicker/modules/month-year-picker.vue.d.ts +4 -0
  31. package/dist/vue3/types/components/datepicker/modules/month-year-picker.vue.d.ts.map +1 -1
  32. package/dist/vue3/types/components/datepicker/utils.d.ts +1 -1
  33. package/dist/vue3/types/components/datepicker/utils.d.ts.map +1 -1
  34. package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  35. package/dist/vue3/types/recipes/leftbar/general_row/index.d.ts +1 -0
  36. package/package.json +3 -3
@@ -1,104 +1,137 @@
1
- import { ref as E, computed as B, watch as F, onMounted as V, openBlock as $, createBlock as G, unref as e, withCtx as m, createVNode as i, createElementVNode as M, toDisplayString as P, nextTick as N, createElementBlock as g, Fragment as x, renderList as Y, normalizeClass as q, createTextVNode as W, getCurrentInstance as j } from "vue";
2
- import { DtIconChevronsLeft as J, DtIconChevronLeft as Q, DtIconChevronRight as Z, DtIconChevronsRight as ee } from "@dialpad/dialtone-icons/vue3";
3
- import { getMonth as K, getYear as S, getDate as te, set as ae, addMonths as ne, subMonths as re } from "date-fns";
4
- import { getCalendarDays as le, formatMonth as oe, getWeekDayNames as se, calculateNextFocusDate as ce, calculatePrevFocusDate as ue, formatDate as ie } from "./utils.js";
5
- import { INTL_MONTH_FORMAT as U, WEEK_START as de } from "./datepicker-constants.js";
6
- import { returnFirstEl as p, warnIfUnmounted as fe } from "../../common/utils/index.js";
7
- import { DialtoneLocalization as z } from "../../localization/index.js";
8
- import R from "../stack/stack.js";
9
- import w from "../tooltip/tooltip.js";
10
- import I from "../button/button.js";
11
- function ve(d, s) {
12
- const c = E(K(d.selectedDate)), t = E(S(d.selectedDate)), n = E(null), r = E(0), D = E([]), v = new z(), b = B(() => le(c.value, t.value, n.value));
13
- F(c, () => {
14
- l(), s("calendar-days", b.value);
15
- }, { immediate: !0 }), F(t, () => {
16
- l(), s("calendar-days", b.value);
17
- }, { immediate: !0 });
18
- function k(a) {
19
- return oe(a, U, v.currentLocale);
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 h(a) {
22
- D.value.includes(a) || D.value.push(a);
41
+ function i(e) {
42
+ m.value.includes(e) || m.value.push(e);
23
43
  }
24
- function _() {
25
- p(D.value[0].$el).focus();
44
+ function A() {
45
+ v(m.value[0].$el).focus();
26
46
  }
27
- function A(a) {
28
- switch (a.key) {
47
+ function f(e) {
48
+ switch (e.key) {
29
49
  case "ArrowLeft":
30
- a.preventDefault(), r.value === 0 ? (r.value = 3, p(D.value[r.value].$el).focus()) : (r.value--, p(D.value[r.value].$el).focus());
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
- a.preventDefault(), r.value === 3 ? (r.value = 0, p(D.value[r.value].$el).focus()) : (r.value++, p(D.value[r.value].$el).focus());
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
- a.preventDefault(), s("focus-first-day");
56
+ e.preventDefault(), o("focus-first-day");
37
57
  break;
38
58
  case "Tab":
39
- a.preventDefault(), s("focus-first-day");
59
+ e.preventDefault(), o("focus-first-day");
40
60
  break;
41
61
  case "Escape":
42
- s("close-datepicker");
62
+ o("close-datepicker");
43
63
  break;
44
64
  }
45
65
  }
46
- function l() {
47
- const a = S(d.selectedDate), L = K(d.selectedDate);
48
- a !== t.value || L !== c.value ? n.value = null : n.value = te(d.selectedDate);
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 o(a) {
51
- (c.value === 0 && a === -1 || c.value === 11 && a === 1) && (t.value += a);
52
- const L = ae(d.selectedDate, { month: c.value, year: t.value }), X = a === 1 ? ne(L, 1) : re(L, 1);
53
- c.value = K(X);
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 T(a) {
56
- t.value = t.value + a;
76
+ function K(e) {
77
+ e === -1 && b.value || e === 1 && T.value || (a.value = a.value + e);
57
78
  }
58
- function f() {
59
- o(1);
79
+ function F() {
80
+ y(1);
60
81
  }
61
- function C() {
62
- o(-1);
82
+ function z() {
83
+ y(-1);
63
84
  }
64
- function y() {
65
- return `${v.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${v.$t("DIALTONE_DATEPICKER_PREVIOUS_YEAR")} ${t.value - 1}`;
85
+ function H() {
86
+ return `${D.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${D.$t("DIALTONE_DATEPICKER_PREVIOUS_YEAR")} ${a.value - 1}`;
66
87
  }
67
- function O() {
68
- return `${v.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${v.$t("DIALTONE_DATEPICKER_PREVIOUS_MONTH")} ${k(c.value - 1)}`;
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 H() {
71
- return `${v.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${v.$t("DIALTONE_DATEPICKER_NEXT_YEAR")} ${t.value + 1}`;
91
+ function X() {
92
+ return `${D.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${D.$t("DIALTONE_DATEPICKER_NEXT_YEAR")} ${a.value + 1}`;
72
93
  }
73
- function u() {
74
- return `${v.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${v.$t("DIALTONE_DATEPICKER_NEXT_MONTH")} ${k(c.value + 1)}`;
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: c,
78
- selectYear: t,
79
- formattedMonth: k,
80
- setDayRef: h,
81
- focusMonthYearPicker: _,
82
- handleKeyDown: A,
83
- changeMonth: o,
84
- changeYear: T,
85
- goToNextMonth: f,
86
- goToPrevMonth: C,
87
- previousYearAriaLabel: y,
88
- previousMonthAriaLabel: O,
89
- nextYearAriaLabel: H,
90
- nextMonthAriaLabel: u
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 pe = {
118
+ const _e = {
94
119
  id: "calendar-heading",
95
120
  class: "d-datepicker__month-year-title"
96
- }, De = {
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(d, { expose: s, emit: c }) {
132
- const t = d, n = c, r = new z(), {
133
- selectMonth: D,
134
- selectYear: v,
135
- formattedMonth: b,
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: h,
138
- handleKeyDown: _,
139
- changeMonth: A,
140
- changeYear: l,
141
- goToNextMonth: o,
142
- goToPrevMonth: T,
143
- previousYearAriaLabel: f,
144
- previousMonthAriaLabel: C,
145
- nextMonthAriaLabel: y,
146
- nextYearAriaLabel: O
147
- } = ve(t, n);
148
- return V(() => {
149
- h();
150
- }), s({
151
- focusMonthYearPicker: h,
152
- goToNextMonth: o,
153
- goToPrevMonth: T
154
- }), (H, u) => ($(), G(e(R), {
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: m(() => [
160
- i(e(R), {
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: m(() => [
167
- i(e(w), {
203
+ default: p(() => [
204
+ d(t(R), {
168
205
  "fallback-placements": ["top-start", "auto"],
169
- message: e(r).$t("DIALTONE_DATEPICKER_PREVIOUS_YEAR"),
206
+ message: t(r).$t("DIALTONE_DATEPICKER_PREVIOUS_YEAR"),
170
207
  placement: "top"
171
208
  }, {
172
- anchor: m(() => [
173
- i(e(I), {
209
+ anchor: p(() => [
210
+ d(t(C), {
174
211
  id: "prevYearButton",
175
- ref: (a) => {
176
- a && e(k)(a);
212
+ ref: (e) => {
213
+ e && t(k)(e);
177
214
  },
178
- "aria-label": e(f)(),
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: u[0] || (u[0] = (a) => e(l)(-1)),
186
- onKeydown: u[1] || (u[1] = (a) => e(_)(a))
223
+ onClick: c[0] || (c[0] = (e) => t(s)(-1)),
224
+ onKeydown: c[1] || (c[1] = (e) => t(b)(e))
187
225
  }, {
188
- default: m(() => [
189
- i(e(J), { size: "200" })
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
- i(e(w), {
234
+ d(t(R), {
197
235
  "fallback-placements": ["top-start", "auto"],
198
- message: e(r).$t("DIALTONE_DATEPICKER_PREVIOUS_MONTH"),
236
+ message: t(r).$t("DIALTONE_DATEPICKER_PREVIOUS_MONTH"),
199
237
  placement: "top"
200
238
  }, {
201
- anchor: m(() => [
202
- i(e(I), {
239
+ anchor: p(() => [
240
+ d(t(C), {
203
241
  id: "prevMonthButton",
204
- ref: (a) => {
205
- a && e(k)(a);
242
+ ref: (e) => {
243
+ e && t(k)(e);
206
244
  },
207
- "aria-label": e(C)(),
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: u[2] || (u[2] = (a) => e(A)(-1)),
215
- onKeydown: u[3] || (u[3] = (a) => e(_)(a))
253
+ onClick: c[2] || (c[2] = (e) => t(T)(-1)),
254
+ onKeydown: c[3] || (c[3] = (e) => t(b)(e))
216
255
  }, {
217
- default: m(() => [
218
- i(e(Q), { size: "200" })
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", pe, P(e(b)(e(D))) + " " + P(e(v)), 1),
229
- i(e(R), {
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: m(() => [
236
- i(e(w), {
274
+ default: p(() => [
275
+ d(t(R), {
237
276
  "fallback-placements": ["top-end", "auto"],
238
- message: e(r).$t("DIALTONE_DATEPICKER_NEXT_MONTH"),
277
+ message: t(r).$t("DIALTONE_DATEPICKER_NEXT_MONTH"),
239
278
  placement: "top"
240
279
  }, {
241
- anchor: m(() => [
242
- i(e(I), {
280
+ anchor: p(() => [
281
+ d(t(C), {
243
282
  id: "nextMonthButton",
244
- ref: (a) => {
245
- a && e(k)(a);
283
+ ref: (e) => {
284
+ e && t(k)(e);
246
285
  },
247
- "aria-label": e(y)(),
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: u[4] || (u[4] = (a) => e(A)(1)),
255
- onKeydown: u[5] || (u[5] = (a) => e(_)(a))
294
+ onClick: c[4] || (c[4] = (e) => t(T)(1)),
295
+ onKeydown: c[5] || (c[5] = (e) => t(b)(e))
256
296
  }, {
257
- default: m(() => [
258
- i(e(Z), { size: "200" })
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
- i(e(w), {
305
+ d(t(R), {
266
306
  "fallback-placements": ["top-end", "auto"],
267
- message: e(r).$t("DIALTONE_DATEPICKER_NEXT_YEAR"),
307
+ message: t(r).$t("DIALTONE_DATEPICKER_NEXT_YEAR"),
268
308
  placement: "top"
269
309
  }, {
270
- anchor: m(() => [
271
- i(e(I), {
310
+ anchor: p(() => [
311
+ d(t(C), {
272
312
  id: "nextYearButton",
273
- ref: (a) => {
274
- a && e(k)(a);
313
+ ref: (e) => {
314
+ e && t(k)(e);
275
315
  },
276
- "aria-label": e(O)(),
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: u[6] || (u[6] = (a) => e(l)(1)),
284
- onKeydown: u[7] || (u[7] = (a) => e(_)(a))
324
+ onClick: c[6] || (c[6] = (e) => t(s)(1)),
325
+ onKeydown: c[7] || (c[7] = (e) => t(b)(e))
285
326
  }, {
286
- default: m(() => [
287
- i(e(ee), { size: "200" })
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 me(d, s) {
303
- const c = E(null), t = E(0), n = E([]), r = new z(), D = B(() => se(d.locale, de));
304
- F(() => d.calendarDays, () => {
305
- t.value = 0, n.value = [], c.value = null;
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 v(l) {
308
- return r.$t("DIALTONE_DATEPICKER_SELECT_DAY") + ` ${ie(l.value, U, r.currentLocale)}`;
348
+ function D(s) {
349
+ return r.$t("DIALTONE_DATEPICKER_SELECT_DAY") + ` ${ke(s.value, te, r.currentLocale)}`;
309
350
  }
310
- function b(l, o) {
311
- !n.value.some((T) => T.el === l) && o.currentMonth && n.value.push({ el: l, day: o });
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(l) {
314
- switch (l.key) {
354
+ function k(s) {
355
+ switch (s.key) {
315
356
  case "ArrowUp":
316
- l.preventDefault(), t.value -= 7;
357
+ s.preventDefault(), a.value -= 7;
317
358
  try {
318
- p(n.value[t.value].el.$el).focus();
359
+ v(n.value[a.value].el.$el).focus();
319
360
  } catch {
320
- const o = ue(n.value[t.value + 7].day.value);
321
- s("go-to-prev-month"), N(() => {
322
- p(n.value[o - 1].el.$el).focus(), t.value += o - 1;
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
- l.preventDefault(), t.value += 7;
368
+ s.preventDefault(), a.value += 7;
328
369
  try {
329
- p(n.value[t.value].el.$el).focus();
370
+ v(n.value[a.value].el.$el).focus();
330
371
  } catch {
331
- const o = ce(n.value[t.value - 7].day.value);
332
- s("go-to-next-month"), N(() => {
333
- p(n.value[o - 1].el.$el).focus(), t.value += o - 1;
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
- l.preventDefault(), t.value > 0 ? (t.value -= 1, p(n.value[t.value].el.$el).focus()) : (s("go-to-prev-month"), _());
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
- l.preventDefault(), t.value < n.value.length - 1 ? (t.value += 1, p(n.value[t.value].el.$el).focus()) : (s("go-to-next-month"), h());
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
- l.preventDefault(), s("focus-month-year-picker");
385
+ s.preventDefault(), o("focus-month-year-picker");
345
386
  break;
346
387
  case "Escape":
347
- s("close-datepicker");
388
+ o("close-datepicker");
348
389
  break;
349
390
  }
350
391
  }
351
- function h() {
352
- t.value = 0, N(() => {
353
- p(n.value[t.value].el.$el).focus();
392
+ function _() {
393
+ a.value = 0, L(() => {
394
+ v(n.value[a.value].el.$el).focus();
354
395
  });
355
396
  }
356
- function _() {
357
- N(() => {
358
- t.value = n.value.length - 1, p(n.value[t.value].el.$el).focus();
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 A(l) {
362
- l.currentMonth && (c.value = l.text, s("select-date", l.value));
402
+ function T(s) {
403
+ s.disabled || (u.value = s.text, o("select-date", s.value));
363
404
  }
364
405
  return {
365
- selectedDay: c,
366
- weekDays: D,
367
- dayAriaLabel: v,
368
- setDayRef: b,
406
+ selectedDay: u,
407
+ weekDays: m,
408
+ dayAriaLabel: D,
409
+ setDayRef: h,
369
410
  handleKeyDown: k,
370
- focusFirstDay: h,
371
- selectDay: A
411
+ focusFirstDay: _,
412
+ selectDay: T
372
413
  };
373
414
  }
374
- const ke = {
415
+ const Te = {
375
416
  class: "d-datepicker__calendar",
376
417
  "aria-labelledby": "calendar-heading"
377
- }, _e = ["title", "aria-label"], he = {
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(d, { expose: s, emit: c }) {
419
- const t = d, n = c, {
459
+ setup(l, { expose: o, emit: u }) {
460
+ const a = l, n = u, {
420
461
  selectedDay: r,
421
- weekDays: D,
422
- dayAriaLabel: v,
423
- setDayRef: b,
462
+ weekDays: m,
463
+ dayAriaLabel: D,
464
+ setDayRef: h,
424
465
  handleKeyDown: k,
425
- focusFirstDay: h,
426
- selectDay: _
427
- } = me(t, n);
428
- return s({
429
- focusFirstDay: h
430
- }), (A, l) => ($(), g("table", ke, [
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(x, null, Y(e(D), (o) => ($(), g("th", {
434
- key: o,
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: o,
441
- "aria-label": o
442
- }, P(o), 9, _e)
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(x, null, Y(d.calendarDays, (o, T) => ($(), g("tr", { key: T }, [
448
- ($(!0), g(x, null, Y(o.days, (f, C) => ($(), g("td", {
449
- key: T + C,
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
- i(e(I), {
494
+ d(t(C), {
454
495
  ref_for: !0,
455
496
  ref: (y) => {
456
- y && e(b)(y, f);
497
+ y && t(h)(y, f);
457
498
  },
458
- class: q(["d-datepicker__day", {
459
- "d-datepicker__day--disabled": !f.currentMonth,
460
- "d-datepicker__day--selected": e(r) ? f.text === e(r) && f.currentMonth : f.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: !f.currentMonth,
506
+ disabled: f.disabled,
466
507
  type: "button",
467
- "aria-selected": e(r) ? f.text === e(r) && f.currentMonth : f.selected,
468
- "aria-label": e(v)(f),
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) => e(_)(f),
471
- onKeydown: l[0] || (l[0] = (y) => e(k)(y))
511
+ onClick: (y) => t(b)(f),
512
+ onKeydown: s[0] || (s[0] = (y) => t(k)(y))
472
513
  }, {
473
- default: m(() => [
474
- W(P(f.text), 1)
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
- }, ye = { class: "d-datepicker__hd" }, $e = { class: "d-datepicker__bd" }, we = {
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(d) {
512
- const s = E([]);
513
- function c(t) {
514
- s.value = t;
573
+ setup(l) {
574
+ const o = E([]);
575
+ function u(a) {
576
+ o.value = a;
515
577
  }
516
- return V(() => {
517
- const t = j();
518
- fe(p(t.proxy.$el), "datepicker");
519
- }), (t, n) => ($(), G(e(R), {
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: m(() => [
524
- M("div", ye, [
525
- i(De, {
585
+ default: p(() => [
586
+ M("div", Me, [
587
+ d($e, {
526
588
  ref: "monthYearPicker",
527
- "selected-date": d.selectedDate,
528
- onCalendarDays: c,
529
- onFocusFirstDay: n[0] || (n[0] = (r) => t.$refs.calendar.focusFirstDay()),
530
- onFocusLastDay: n[1] || (n[1] = (r) => t.$refs.calendar.focusLastDay()),
531
- onCloseDatepicker: n[2] || (n[2] = (r) => t.$emit("close-datepicker"))
532
- }, null, 8, ["selected-date"])
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", $e, [
535
- i(he, {
598
+ M("div", xe, [
599
+ d(ge, {
536
600
  ref: "calendar",
537
- "calendar-days": s.value,
538
- onSelectDate: n[3] || (n[3] = (r) => t.$emit("selected-date", r)),
539
- onFocusMonthYearPicker: n[4] || (n[4] = (r) => t.$refs.monthYearPicker.focusMonthYearPicker()),
540
- onCloseDatepicker: n[5] || (n[5] = (r) => t.$emit("close-datepicker")),
541
- onGoToNextMonth: n[6] || (n[6] = (r) => t.$refs.monthYearPicker.goToNextMonth()),
542
- onGoToPrevMonth: n[7] || (n[7] = (r) => t.$refs.monthYearPicker.goToPrevMonth())
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
- we as default
615
+ Fe as default
552
616
  };
553
617
  //# sourceMappingURL=datepicker.js.map