@nylas/react 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-circle-icon.entry-d8358e3f.js → add-circle-icon.entry-0ea05c5b.js} +1 -1
- package/dist/{add-circle-icon.entry-606d3096.cjs → add-circle-icon.entry-10f2c319.cjs} +1 -1
- package/dist/{archive-icon.entry-e8ce8c7d.cjs → archive-icon.entry-7eeea6f4.cjs} +1 -1
- package/dist/{archive-icon.entry-8c6d31f2.js → archive-icon.entry-a0af58f2.js} +1 -1
- package/dist/{arrow-icon.entry-d950ddce.js → arrow-icon.entry-7fd7c18e.js} +1 -1
- package/dist/{arrow-icon.entry-13d23d01.cjs → arrow-icon.entry-954f2ba8.cjs} +1 -1
- package/dist/{bold-icon.entry-5382fea2.js → bold-icon.entry-690ecac8.js} +1 -1
- package/dist/{bold-icon.entry-12072568.cjs → bold-icon.entry-e970c498.cjs} +1 -1
- package/dist/{button-component_2.entry-4aa63891.js → button-component_2.entry-b57d03fc.js} +1 -1
- package/dist/{button-component_2.entry-d34ed360.cjs → button-component_2.entry-b7d39903.cjs} +1 -1
- package/dist/{calendar-agenda-fill-icon_54.entry-50c9ed7b.js → calendar-agenda-fill-icon_53.entry-7792b45c.js} +432 -442
- package/dist/calendar-agenda-fill-icon_53.entry-89e5ac45.cjs +9 -0
- package/dist/{calendar-cancel-icon.entry-64ea7038.js → calendar-cancel-icon.entry-5757c056.js} +1 -1
- package/dist/{calendar-cancel-icon.entry-b13aa245.cjs → calendar-cancel-icon.entry-8cd02237.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-9cbe60a8.cjs → calendar-check-icon_2.entry-4f59d206.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-935310fc.js → calendar-check-icon_2.entry-6864b9d5.js} +1 -1
- package/dist/{calendar-icon.entry-0c560a35.cjs → calendar-icon.entry-0b1edb49.cjs} +1 -1
- package/dist/{calendar-icon.entry-2448eea2.js → calendar-icon.entry-3798880d.js} +1 -1
- package/dist/checkbox-component_3.entry-10293364.cjs +1 -0
- package/dist/checkbox-component_3.entry-3d9fa7b5.js +140 -0
- package/dist/{chevron-icon_3.entry-1f72ef71.js → chevron-icon_3.entry-43e83594.js} +11 -11
- package/dist/{chevron-icon_3.entry-da1751d2.cjs → chevron-icon_3.entry-a5175d87.cjs} +1 -1
- package/dist/{clock-icon_4.entry-4502c9f0.js → clock-icon_4.entry-219733d8.js} +1 -1
- package/dist/{clock-icon_4.entry-b87aaaa9.cjs → clock-icon_4.entry-76751b46.cjs} +1 -1
- package/dist/{close-icon.entry-e96749ed.js → close-icon.entry-286fc5ca.js} +1 -1
- package/dist/{close-icon.entry-92e93293.cjs → close-icon.entry-cecd3cdd.cjs} +1 -1
- package/dist/{constants-24eca8c9-922dc05c.js → constants-54af2051-767e8462.js} +12 -0
- package/dist/{constants-24eca8c9-d0d9f3ec.cjs → constants-54af2051-a3596673.cjs} +1 -1
- package/dist/{copy-icon.entry-7c958d7c.js → copy-icon.entry-121dd297.js} +1 -1
- package/dist/{copy-icon.entry-19bb7d2f.cjs → copy-icon.entry-d4835d9a.cjs} +1 -1
- package/dist/{delete-icon.entry-41c7d463.cjs → delete-icon.entry-14249f70.cjs} +1 -1
- package/dist/{delete-icon.entry-59c9ca04.js → delete-icon.entry-497ac8a2.js} +1 -1
- package/dist/{document-refresh-icon.entry-afc75ddb.cjs → document-refresh-icon.entry-c0eacb66.cjs} +1 -1
- package/dist/{document-refresh-icon.entry-c32cda4f.js → document-refresh-icon.entry-f265bb1b.js} +1 -1
- package/dist/elements/index.d.ts +1 -0
- package/dist/{feedbackSync-b4015b72-0785986b.js → feedbackSync-e5cb0245-d84015c5.js} +1 -1
- package/dist/{feedbackSync-b4015b72-d343d411.cjs → feedbackSync-e5cb0245-ea7ddac9.cjs} +1 -1
- package/dist/{folder-icon.entry-5dcf707b.js → folder-icon.entry-d22b3e80.js} +1 -1
- package/dist/{folder-icon.entry-61ccaddd.cjs → folder-icon.entry-e4806f0a.cjs} +1 -1
- package/dist/{forward-icon.entry-3d598cb4.cjs → forward-icon.entry-42b98c73.cjs} +1 -1
- package/dist/{forward-icon.entry-5a156d37.js → forward-icon.entry-b6711af7.js} +1 -1
- package/dist/{globe-icon.entry-a88502ce.cjs → globe-icon.entry-18605371.cjs} +1 -1
- package/dist/{globe-icon.entry-99e8bebf.js → globe-icon.entry-4c5d6be0.js} +1 -1
- package/dist/google-logo-icon_4.entry-007f2813.cjs +1 -0
- package/dist/{google-logo-icon_4.entry-531021bd.js → google-logo-icon_4.entry-c3bae7b7.js} +176 -168
- package/dist/{inbox-icon.entry-6eadce9b.cjs → inbox-icon.entry-02c59267.cjs} +1 -1
- package/dist/{inbox-icon.entry-b2a2f48e.js → inbox-icon.entry-ae4383af.js} +1 -1
- package/dist/{index-13a43508.js → index-ad112f6a.js} +166 -161
- package/dist/{index-7dbf0ae7.cjs → index-bbbc79ad.cjs} +17 -17
- package/dist/{index.es-aa323594-17c2a3f6.js → index.es-e9d66a9b-62be34ce.js} +214 -211
- package/dist/{index.es-aa323594-84331fa3.cjs → index.es-e9d66a9b-a29322e0.cjs} +5 -5
- package/dist/{info-icon_2.entry-c6e650c4.js → info-icon_2.entry-3f143408.js} +5 -5
- package/dist/{info-icon_2.entry-f53d81e5.cjs → info-icon_2.entry-d10f1df5.cjs} +1 -1
- package/dist/{input-color-picker.entry-16fa8456.cjs → input-color-picker.entry-45caaa1d.cjs} +1 -1
- package/dist/{input-color-picker.entry-cd398537.js → input-color-picker.entry-8ce41f49.js} +1 -1
- package/dist/{input-component.entry-74b63249.cjs → input-component.entry-37b106dc.cjs} +1 -1
- package/dist/{input-component.entry-b471f023.js → input-component.entry-6db98fb0.js} +1 -1
- package/dist/{input-dropdown.entry-32b4b8be.cjs → input-dropdown.entry-1a2cdf40.cjs} +1 -1
- package/dist/{input-dropdown.entry-14e1f6cb.js → input-dropdown.entry-ec3d04ad.js} +1 -1
- package/dist/{italic-icon.entry-8a1a7568.js → italic-icon.entry-36d1e644.js} +1 -1
- package/dist/{italic-icon.entry-c9ae0186.cjs → italic-icon.entry-b5e4eec9.cjs} +1 -1
- package/dist/{multi-select-dropdown.entry-58b860a0.cjs → multi-select-dropdown.entry-00e43a89.cjs} +1 -1
- package/dist/{multi-select-dropdown.entry-bc4901aa.js → multi-select-dropdown.entry-6f22740f.js} +1 -1
- package/dist/nylas-booked-event-card_12.entry-4f115674.cjs +1 -0
- package/dist/{nylas-booked-event-card_12.entry-fbdb2f3d.js → nylas-booked-event-card_12.entry-cb6b2ce6.js} +270 -265
- package/dist/{nylas-form-card.entry-aa1d5aca.js → nylas-form-card.entry-07e46491.js} +11 -11
- package/dist/{nylas-form-card.entry-7e9a0cf1.cjs → nylas-form-card.entry-e2749723.cjs} +1 -1
- package/dist/{nylas-if-state.entry-96914d61.cjs → nylas-if-state.entry-88e01248.cjs} +1 -1
- package/dist/{nylas-if-state.entry-5e30f6b3.js → nylas-if-state.entry-e34c5cbb.js} +2 -2
- package/dist/{nylas-login.entry-e52648da.js → nylas-login.entry-a30bbd87.js} +3 -3
- package/dist/{nylas-login.entry-e26689b0.cjs → nylas-login.entry-ab50ca6a.cjs} +1 -1
- package/dist/{nylas-provider.entry-ac669351.js → nylas-provider.entry-070f8090.js} +5 -5
- package/dist/{nylas-provider.entry-9d43f4f0.cjs → nylas-provider.entry-7f4a1520.cjs} +1 -1
- package/dist/{nylas-scheduler-editor.entry-9655ce2e.js → nylas-scheduler-editor.entry-23e68865.js} +3 -3
- package/dist/{nylas-scheduler-editor.entry-0f1370d9.cjs → nylas-scheduler-editor.entry-287ca230.cjs} +2 -2
- package/dist/{nylas-scheduling.entry-14d4cd69.js → nylas-scheduling.entry-19fca55a.js} +8 -8
- package/dist/{nylas-scheduling.entry-ab10f8a4.cjs → nylas-scheduling.entry-c882ee9a.cjs} +1 -1
- package/dist/nylas-time-window-picker_2.entry-3d24eec4.js +336 -0
- package/dist/nylas-time-window-picker_2.entry-9a216230.cjs +1 -0
- package/dist/{person-icon.entry-40b5a8c5.js → person-icon.entry-a6d86572.js} +1 -1
- package/dist/{person-icon.entry-a45918af.cjs → person-icon.entry-b26a199b.cjs} +1 -1
- package/dist/{play-icon.entry-c5757946.cjs → play-icon.entry-5fc66fe6.cjs} +1 -1
- package/dist/{play-icon.entry-b2315f8c.js → play-icon.entry-87939760.js} +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +73 -72
- package/dist/{refresh-icon.entry-b9afd192.cjs → refresh-icon.entry-3a8ae0f6.cjs} +1 -1
- package/dist/{refresh-icon.entry-37d038f8.js → refresh-icon.entry-820111be.js} +1 -1
- package/dist/{register-component-555477e7-42247763.js → register-component-5d7bcc15-35e4a5a0.js} +12 -12
- package/dist/{register-component-555477e7-ecafba1c.cjs → register-component-5d7bcc15-d9900fbc.cjs} +1 -1
- package/dist/{reply-all-icon.entry-89fd0e10.js → reply-all-icon.entry-5fbf1103.js} +1 -1
- package/dist/{reply-all-icon.entry-07a6783a.cjs → reply-all-icon.entry-864494e2.cjs} +1 -1
- package/dist/{reply-icon.entry-a53a6fc4.js → reply-icon.entry-7c136d06.js} +1 -1
- package/dist/{reply-icon.entry-8cddb112.cjs → reply-icon.entry-93084ffd.cjs} +1 -1
- package/dist/{scheduler-config-store-ed4a8dfd-733c6442.cjs → scheduler-config-store-ed4a8dfd-b2986359.cjs} +1 -1
- package/dist/{scheduler-config-store-ed4a8dfd-656579e3.js → scheduler-config-store-ed4a8dfd-f7f53255.js} +1 -1
- package/dist/{scheduler-store-c37aa5ca-0484b074.cjs → scheduler-store-20151a77-2dfd28c2.cjs} +1 -1
- package/dist/{scheduler-store-c37aa5ca-c9752707.js → scheduler-store-20151a77-4f7ffb6f.js} +2 -2
- package/dist/{sent-icon.entry-b740a32d.cjs → sent-icon.entry-18afc1f9.cjs} +1 -1
- package/dist/{sent-icon.entry-6ac749b3.js → sent-icon.entry-60f1b814.js} +1 -1
- package/dist/{spam-icon.entry-78cec025.cjs → spam-icon.entry-9d41427e.cjs} +1 -1
- package/dist/{spam-icon.entry-872ff1e4.js → spam-icon.entry-b580b108.js} +1 -1
- package/dist/{star-icon.entry-57246dc1.js → star-icon.entry-7cbe5a81.js} +1 -1
- package/dist/{star-icon.entry-ab9ad7df.cjs → star-icon.entry-8792026f.cjs} +1 -1
- package/dist/{stop-icon.entry-f79dce49.cjs → stop-icon.entry-5b605364.cjs} +1 -1
- package/dist/{stop-icon.entry-5054fa33.js → stop-icon.entry-ae629874.js} +1 -1
- package/dist/{textarea-component.entry-2967dd82.cjs → textarea-component.entry-2dae13db.cjs} +1 -1
- package/dist/{textarea-component.entry-15c9a676.js → textarea-component.entry-fa87a032.js} +2 -2
- package/dist/{time-period-selector.entry-9226fd08.js → time-period-selector.entry-0de79682.js} +2 -2
- package/dist/{time-period-selector.entry-a53c94c2.cjs → time-period-selector.entry-b1f5523b.cjs} +1 -1
- package/dist/{translate-icon.entry-52939fa4.js → translate-icon.entry-07e9c2cf.js} +1 -1
- package/dist/{translate-icon.entry-f4dcc479.cjs → translate-icon.entry-22ef3602.cjs} +1 -1
- package/dist/{trash-fill-icon.entry-b9ab3cfc.js → trash-fill-icon.entry-81ee0fdf.js} +1 -1
- package/dist/{trash-fill-icon.entry-7f4ddaf5.cjs → trash-fill-icon.entry-d332cf5d.cjs} +1 -1
- package/dist/{underline-icon.entry-c8142970.js → underline-icon.entry-dce1c48b.js} +1 -1
- package/dist/{underline-icon.entry-e9959c5c.cjs → underline-icon.entry-e381e3d2.cjs} +1 -1
- package/dist/{warning-icon.entry-00426457.js → warning-icon.entry-76d03910.js} +1 -1
- package/dist/{warning-icon.entry-98c0d003.cjs → warning-icon.entry-b55e52d0.cjs} +1 -1
- package/package.json +3 -3
- package/dist/calendar-agenda-fill-icon_54.entry-33d08f1a.cjs +0 -9
- package/dist/checkbox-component_2.entry-1e3afb3a.cjs +0 -1
- package/dist/checkbox-component_2.entry-ec5e75fb.js +0 -79
- package/dist/google-logo-icon_4.entry-9a7790d2.cjs +0 -1
- package/dist/nylas-booked-event-card_12.entry-f64eecaa.cjs +0 -1
- package/dist/nylas-time-window-picker.entry-a2f71121.js +0 -316
- package/dist/nylas-time-window-picker.entry-dfbd975e.cjs +0 -1
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
import { b as ae, Q as C, r as oe, c as X, R as U, S as V, T as G, U as Q, h as k, H as he, g as me } from "./index-13a43508.js";
|
|
2
|
-
import "react";
|
|
3
|
-
import "react-dom";
|
|
4
|
-
var q = { exports: {} };
|
|
5
|
-
(function(e, t) {
|
|
6
|
-
(function(n, i) {
|
|
7
|
-
e.exports = i();
|
|
8
|
-
})(ae, function() {
|
|
9
|
-
var n = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, i = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, r = /\d\d/, o = /\d\d?/, v = /\d*[^-_:/,()\s\d]+/, x = {}, W = function(s) {
|
|
10
|
-
return (s = +s) + (s > 68 ? 1900 : 2e3);
|
|
11
|
-
}, l = function(s) {
|
|
12
|
-
return function(a) {
|
|
13
|
-
this[s] = +a;
|
|
14
|
-
};
|
|
15
|
-
}, _ = [/[+-]\d\d:?(\d\d)?|Z/, function(s) {
|
|
16
|
-
(this.zone || (this.zone = {})).offset = function(a) {
|
|
17
|
-
if (!a || a === "Z")
|
|
18
|
-
return 0;
|
|
19
|
-
var h = a.match(/([+-]|\d\d)/g), m = 60 * h[1] + (+h[2] || 0);
|
|
20
|
-
return m === 0 ? 0 : h[0] === "+" ? -m : m;
|
|
21
|
-
}(s);
|
|
22
|
-
}], P = function(s) {
|
|
23
|
-
var a = x[s];
|
|
24
|
-
return a && (a.indexOf ? a : a.s.concat(a.f));
|
|
25
|
-
}, j = function(s, a) {
|
|
26
|
-
var h, m = x.meridiem;
|
|
27
|
-
if (m) {
|
|
28
|
-
for (var f = 1; f <= 24; f += 1)
|
|
29
|
-
if (s.indexOf(m(f, 0, a)) > -1) {
|
|
30
|
-
h = f > 12;
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
} else
|
|
34
|
-
h = s === (a ? "pm" : "PM");
|
|
35
|
-
return h;
|
|
36
|
-
}, J = { A: [v, function(s) {
|
|
37
|
-
this.afternoon = j(s, !1);
|
|
38
|
-
}], a: [v, function(s) {
|
|
39
|
-
this.afternoon = j(s, !0);
|
|
40
|
-
}], S: [/\d/, function(s) {
|
|
41
|
-
this.milliseconds = 100 * +s;
|
|
42
|
-
}], SS: [r, function(s) {
|
|
43
|
-
this.milliseconds = 10 * +s;
|
|
44
|
-
}], SSS: [/\d{3}/, function(s) {
|
|
45
|
-
this.milliseconds = +s;
|
|
46
|
-
}], s: [o, l("seconds")], ss: [o, l("seconds")], m: [o, l("minutes")], mm: [o, l("minutes")], H: [o, l("hours")], h: [o, l("hours")], HH: [o, l("hours")], hh: [o, l("hours")], D: [o, l("day")], DD: [r, l("day")], Do: [v, function(s) {
|
|
47
|
-
var a = x.ordinal, h = s.match(/\d+/);
|
|
48
|
-
if (this.day = h[0], a)
|
|
49
|
-
for (var m = 1; m <= 31; m += 1)
|
|
50
|
-
a(m).replace(/\[|\]/g, "") === s && (this.day = m);
|
|
51
|
-
}], M: [o, l("month")], MM: [r, l("month")], MMM: [v, function(s) {
|
|
52
|
-
var a = P("months"), h = (P("monthsShort") || a.map(function(m) {
|
|
53
|
-
return m.slice(0, 3);
|
|
54
|
-
})).indexOf(s) + 1;
|
|
55
|
-
if (h < 1)
|
|
56
|
-
throw new Error();
|
|
57
|
-
this.month = h % 12 || h;
|
|
58
|
-
}], MMMM: [v, function(s) {
|
|
59
|
-
var a = P("months").indexOf(s) + 1;
|
|
60
|
-
if (a < 1)
|
|
61
|
-
throw new Error();
|
|
62
|
-
this.month = a % 12 || a;
|
|
63
|
-
}], Y: [/[+-]?\d+/, l("year")], YY: [r, function(s) {
|
|
64
|
-
this.year = W(s);
|
|
65
|
-
}], YYYY: [/\d{4}/, l("year")], Z: _, ZZ: _ };
|
|
66
|
-
function ee(s) {
|
|
67
|
-
var a, h;
|
|
68
|
-
a = s, h = x && x.formats;
|
|
69
|
-
for (var m = (s = a.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(S, b, u) {
|
|
70
|
-
var d = u && u.toUpperCase();
|
|
71
|
-
return b || h[u] || n[u] || h[d].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(w, T, D) {
|
|
72
|
-
return T || D.slice(1);
|
|
73
|
-
});
|
|
74
|
-
})).match(i), f = m.length, p = 0; p < f; p += 1) {
|
|
75
|
-
var L = m[p], I = J[L], y = I && I[0], g = I && I[1];
|
|
76
|
-
m[p] = g ? { regex: y, parser: g } : L.replace(/^\[|\]$/g, "");
|
|
77
|
-
}
|
|
78
|
-
return function(S) {
|
|
79
|
-
for (var b = {}, u = 0, d = 0; u < f; u += 1) {
|
|
80
|
-
var w = m[u];
|
|
81
|
-
if (typeof w == "string")
|
|
82
|
-
d += w.length;
|
|
83
|
-
else {
|
|
84
|
-
var T = w.regex, D = w.parser, E = S.slice(d), A = T.exec(E)[0];
|
|
85
|
-
D.call(b, A), S = S.replace(A, "");
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return function(M) {
|
|
89
|
-
var c = M.afternoon;
|
|
90
|
-
if (c !== void 0) {
|
|
91
|
-
var Y = M.hours;
|
|
92
|
-
c ? Y < 12 && (M.hours += 12) : Y === 12 && (M.hours = 0), delete M.afternoon;
|
|
93
|
-
}
|
|
94
|
-
}(b), b;
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
return function(s, a, h) {
|
|
98
|
-
h.p.customParseFormat = !0, s && s.parseTwoDigitYear && (W = s.parseTwoDigitYear);
|
|
99
|
-
var m = a.prototype, f = m.parse;
|
|
100
|
-
m.parse = function(p) {
|
|
101
|
-
var L = p.date, I = p.utc, y = p.args;
|
|
102
|
-
this.$u = I;
|
|
103
|
-
var g = y[1];
|
|
104
|
-
if (typeof g == "string") {
|
|
105
|
-
var S = y[2] === !0, b = y[3] === !0, u = S || b, d = y[2];
|
|
106
|
-
b && (d = y[2]), x = this.$locale(), !S && d && (x = h.Ls[d]), this.$d = function(E, A, M) {
|
|
107
|
-
try {
|
|
108
|
-
if (["x", "X"].indexOf(A) > -1)
|
|
109
|
-
return new Date((A === "X" ? 1e3 : 1) * E);
|
|
110
|
-
var c = ee(A)(E), Y = c.year, O = c.month, te = c.day, ie = c.hours, se = c.minutes, ne = c.seconds, re = c.milliseconds, N = c.zone, z = /* @__PURE__ */ new Date(), F = te || (Y || O ? 1 : z.getDate()), H = Y || z.getFullYear(), $ = 0;
|
|
111
|
-
Y && !O || ($ = O > 0 ? O - 1 : z.getMonth());
|
|
112
|
-
var K = ie || 0, R = se || 0, Z = ne || 0, B = re || 0;
|
|
113
|
-
return N ? new Date(Date.UTC(H, $, F, K, R, Z, B + 60 * N.offset * 1e3)) : M ? new Date(Date.UTC(H, $, F, K, R, Z, B)) : new Date(H, $, F, K, R, Z, B);
|
|
114
|
-
} catch {
|
|
115
|
-
return /* @__PURE__ */ new Date("");
|
|
116
|
-
}
|
|
117
|
-
}(L, g, I), this.init(), d && d !== !0 && (this.$L = this.locale(d).$L), u && L != this.format(g) && (this.$d = /* @__PURE__ */ new Date("")), x = {};
|
|
118
|
-
} else if (g instanceof Array)
|
|
119
|
-
for (var w = g.length, T = 1; T <= w; T += 1) {
|
|
120
|
-
y[1] = g[T - 1];
|
|
121
|
-
var D = h.apply(this, y);
|
|
122
|
-
if (D.isValid()) {
|
|
123
|
-
this.$d = D.$d, this.$L = D.$L, this.init();
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
T === w && (this.$d = /* @__PURE__ */ new Date(""));
|
|
127
|
-
}
|
|
128
|
-
else
|
|
129
|
-
f.call(this, p);
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
});
|
|
133
|
-
})(q);
|
|
134
|
-
const le = q.exports, de = ':host{display:block;position:relative;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif}.time-picker{display:inline-block;width:150px;font-family:var(--nylas-font-family);position:relative}@media screen and (max-width: 768px){.time-picker{width:auto}}.time-picker input{width:150px;height:48px;text-align:center;font-size:16px;font-family:inherit;cursor:pointer;background:transparent;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.time-picker input{width:88px}}@media screen and (max-width: 504px){.time-picker input{width:68px;font-size:15px}}.time-picker input.focus{background:transparent}.time-picker input:hover,.time-picker input:active{border:1px solid var(--nylas-primary)}.time-picker input:active{outline:2px solid var(--nylas-primary)}.time-picker input span.open{transform:rotate(90deg)}.time-picker input span.closed{transform:rotate(270deg)}.time-picker input.error{border:1px solid var(--nylas-error)}.time-picker p.error{color:var(--nylas-error);font-size:0.875rem;margin:0}.times{display:block;margin-top:0.5rem;background-color:var(--nylas-base-0);width:100%;max-height:336px;overflow:auto;border:1px solid #ddd;z-index:1;border-radius:4px;position:absolute;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.0509803922);box-shadow:0px 10px 15px -3px rgba(0, 0, 0, 0.1019607843)}.times ul{padding:0;list-style-type:none;color:var(--nylas-base-900);max-height:336px}.times ul li{padding:16px, 12px, 16px, 12px;color:black;padding:12px 16px;text-decoration:none;display:block;font-family:inherit;font-size:14px;font-weight:400;line-height:20px;letter-spacing:0px;text-align:center;cursor:pointer}.times ul li.focused{background-color:var(--nylas-base-100)}.times ul li:hover,.times ul li:focus{background-color:var(--nylas-base-100)}.times ul li label{display:flex;align-items:center;gap:0.5rem}.times ul li label input{margin:0}', ce = de;
|
|
135
|
-
C.extend(le);
|
|
136
|
-
const ue = class {
|
|
137
|
-
constructor(e) {
|
|
138
|
-
oe(this, e), this.timeChange = X(this, "timeChange", 7), this.formError = X(this, "formError", 7), this.time = void 0, this.minimumStartTime = null, this.placeholder = "hh:mmam/pm", this.name = void 0, this.hasError = !1, this.err = "", this.showTimes = !1, this.ariaActivedescendant = "", this.times = this.generateTimes(), this.shouldAutoScroll = !1;
|
|
139
|
-
}
|
|
140
|
-
handleOutsideClick(e) {
|
|
141
|
-
!e.composedPath().includes(this.el) && this.showTimes && (this.showTimes = !1);
|
|
142
|
-
}
|
|
143
|
-
minimumStartTimeChangedHandler() {
|
|
144
|
-
if (this.minimumStartTime) {
|
|
145
|
-
let e = C().hour(parseInt(this.minimumStartTime)).minute(parseInt(this.minimumStartTime.slice(-4, -2)));
|
|
146
|
-
this.minimumStartTime.slice(-2).toLowerCase() === "pm" && parseInt(this.minimumStartTime) !== 12 ? e = e.add(12, "hour") : this.minimumStartTime.slice(-2).toLowerCase() === "am" && parseInt(this.minimumStartTime) === 12 && (e = e.subtract(12, "hour")), this.times = this.generateTimes();
|
|
147
|
-
const t = C(this.times[0].value, "hh:mma");
|
|
148
|
-
C(this.time, "hh:mma").isBefore(t) && (this.err = "Invalid", this.formError.emit({
|
|
149
|
-
key: this.el.id,
|
|
150
|
-
message: "Invalid"
|
|
151
|
-
}));
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
componentDidRender() {
|
|
155
|
-
if (this.showTimes && this.shouldAutoScroll) {
|
|
156
|
-
const e = U(this.time), t = this.times.findIndex((n) => n.value === e);
|
|
157
|
-
t > -1 && (this.shouldAutoScroll = !1, this.scrollToViewWithinParent(t));
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
handleTimeChange(e, t) {
|
|
162
|
-
const n = t.split(":");
|
|
163
|
-
n[0] === "00" && n[1].slice(-2) == "pm" && (this.err = "Invalid", this.formError.emit({
|
|
164
|
-
key: this.el.id,
|
|
165
|
-
message: "Invalid"
|
|
166
|
-
})), V(t) ? (this.err = "", this.formError.emit({
|
|
167
|
-
key: this.el.id,
|
|
168
|
-
message: ""
|
|
169
|
-
})) : (this.err = "Invalid", this.formError.emit({
|
|
170
|
-
key: this.el.id,
|
|
171
|
-
message: "Invalid"
|
|
172
|
-
})), this.timeChange.emit({
|
|
173
|
-
key: this.el.id,
|
|
174
|
-
value: t
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
handleTimeAutocomplete(e) {
|
|
178
|
-
var n;
|
|
179
|
-
const t = (n = e.target) == null ? void 0 : n.value;
|
|
180
|
-
if (!V(t)) {
|
|
181
|
-
this.err = "Invalid", this.formError.emit({
|
|
182
|
-
key: this.el.id,
|
|
183
|
-
message: "Invalid"
|
|
184
|
-
});
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
if (t === "") {
|
|
188
|
-
const i = G().format("hh:mma");
|
|
189
|
-
this.timeChange.emit({
|
|
190
|
-
key: this.el.id,
|
|
191
|
-
value: i
|
|
192
|
-
});
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
if (!Q(t)) {
|
|
196
|
-
const i = U(t);
|
|
197
|
-
this.timeChange.emit({
|
|
198
|
-
key: this.el.id,
|
|
199
|
-
value: i
|
|
200
|
-
});
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
this.timeChange.emit({
|
|
204
|
-
key: this.el.id,
|
|
205
|
-
value: t
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
handleOnInput(e) {
|
|
209
|
-
var n;
|
|
210
|
-
const t = (n = e.target) == null ? void 0 : n.value;
|
|
211
|
-
if (V(t)) {
|
|
212
|
-
if (t === "") {
|
|
213
|
-
const i = G().format("hh:mma"), r = this.times.findIndex((o) => o.value === i);
|
|
214
|
-
r > -1 && this.scrollToViewWithinParent(r);
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
if (!Q(t)) {
|
|
218
|
-
const i = U(t), r = this.times.findIndex((o) => o.value === i);
|
|
219
|
-
r > -1 && this.scrollToViewWithinParent(r);
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
generateTimes() {
|
|
225
|
-
const e = [];
|
|
226
|
-
let t = C().set("hour", 0).set("minute", 0).set("second", 0);
|
|
227
|
-
this.minimumStartTime && (t = C(this.minimumStartTime, "hh:mma"));
|
|
228
|
-
const n = t.endOf("day").diff(t, "minutes"), i = Math.round(n / 15);
|
|
229
|
-
for (let r = 0; r < i + 1; r++) {
|
|
230
|
-
const o = t.add(r * 15, "minute");
|
|
231
|
-
if (r == i && o.format("hh:mma").includes("am"))
|
|
232
|
-
break;
|
|
233
|
-
e.push({ id: r, value: o.format("hh:mma") });
|
|
234
|
-
}
|
|
235
|
-
return e;
|
|
236
|
-
}
|
|
237
|
-
handleComboboxKeyDown(e) {
|
|
238
|
-
if (e.key === "ArrowDown") {
|
|
239
|
-
if (e.preventDefault(), !this.showTimes) {
|
|
240
|
-
this.showTimes = !0, this.shouldAutoScroll = !0;
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
if (this.ariaActivedescendant === "")
|
|
244
|
-
this.ariaActivedescendant = this.times[0].id.toString(), this.focusOption(0);
|
|
245
|
-
else {
|
|
246
|
-
const t = this.times.findIndex((i) => i.id.toString() === this.ariaActivedescendant), n = t + 1 < this.times.length ? t + 1 : 0;
|
|
247
|
-
this.ariaActivedescendant = this.times[n].id.toString(), this.focusOption(n);
|
|
248
|
-
}
|
|
249
|
-
} else if (e.key === "ArrowUp")
|
|
250
|
-
if (e.preventDefault(), this.ariaActivedescendant === "")
|
|
251
|
-
this.ariaActivedescendant = this.times[this.times.length - 1].id.toString(), this.focusOption(this.times.length - 1);
|
|
252
|
-
else {
|
|
253
|
-
const t = this.times.findIndex((i) => i.id.toString() === this.ariaActivedescendant), n = t - 1 >= 0 ? t - 1 : this.times.length - 1;
|
|
254
|
-
this.ariaActivedescendant = this.times[n].id.toString(), this.focusOption(n);
|
|
255
|
-
}
|
|
256
|
-
else
|
|
257
|
-
e.key === "Escape" && (this.showTimes = !1, this.timeInput.focus());
|
|
258
|
-
}
|
|
259
|
-
handleListboxKeydown(e) {
|
|
260
|
-
const t = this.times, n = t.findIndex((i) => i.id.toString() === this.ariaActivedescendant);
|
|
261
|
-
if (e.key === "ArrowDown" || e.key === "Tab" && !e.shiftKey) {
|
|
262
|
-
e.preventDefault();
|
|
263
|
-
const i = n + 1 < t.length ? n + 1 : 0;
|
|
264
|
-
this.ariaActivedescendant = t[i].id.toString(), this.focusOption(i);
|
|
265
|
-
} else if (e.key === "ArrowUp" || e.key === "Tab" && e.shiftKey) {
|
|
266
|
-
e.preventDefault();
|
|
267
|
-
const i = n - 1 >= 0 ? n - 1 : t.length - 1;
|
|
268
|
-
this.ariaActivedescendant = t[i].id.toString(), this.focusOption(i);
|
|
269
|
-
} else if (e.key === "Enter") {
|
|
270
|
-
if (e.preventDefault(), this.ariaActivedescendant) {
|
|
271
|
-
const i = t[n];
|
|
272
|
-
this.handleTimeChange(e, i.value), this.showTimes = !1, this.ariaActivedescendant = "", this.timeInput.focus();
|
|
273
|
-
}
|
|
274
|
-
} else
|
|
275
|
-
e.key === "Escape" && (this.showTimes = !1, this.timeInput.focus());
|
|
276
|
-
}
|
|
277
|
-
scrollToViewWithinParent(e) {
|
|
278
|
-
var v;
|
|
279
|
-
const t = this.times[e], n = (v = this.el.shadowRoot) == null ? void 0 : v.getElementById(t.id.toString()), i = this.timeMenu;
|
|
280
|
-
this.ariaActivedescendant = t.id.toString();
|
|
281
|
-
const r = n.getBoundingClientRect(), o = i.getBoundingClientRect();
|
|
282
|
-
r.top < o.top ? i.scrollTop -= o.top - r.top : r.bottom > o.bottom && (i.scrollTop += r.bottom - o.bottom), r.left < o.left ? i.scrollLeft -= o.left - r.left : r.right > o.right && (i.scrollLeft += r.right - o.right);
|
|
283
|
-
}
|
|
284
|
-
focusOption(e) {
|
|
285
|
-
var r;
|
|
286
|
-
const t = this.times[e];
|
|
287
|
-
if (!t)
|
|
288
|
-
return;
|
|
289
|
-
const n = t.id.toString(), i = (r = this.el.shadowRoot) == null ? void 0 : r.getElementById(n);
|
|
290
|
-
i && (i.focus(), i.scrollIntoView({ behavior: "smooth", block: "nearest" }));
|
|
291
|
-
}
|
|
292
|
-
render() {
|
|
293
|
-
return k(he, { key: "e83949b2270706557e5d45aff5958d937c6489c9" }, k("div", { key: "0cacfe5530a1186ce2ff50ccc3d9328a62d48e2f", class: "time-picker", part: "time-picker" }, k("input", { key: "8daf647468746997e503883478debf8d335a780d", type: "text", name: this.name, id: this.name, part: "time-input", class: {
|
|
294
|
-
"time-input": !0,
|
|
295
|
-
error: !!this.err || this.hasError
|
|
296
|
-
}, ref: (e) => this.timeInput = e, value: this.time, onClick: () => {
|
|
297
|
-
this.showTimes = !this.showTimes, this.shouldAutoScroll = !0;
|
|
298
|
-
}, "aria-haspopup": "listbox", "aria-label": this.name, "aria-expanded": this.showTimes ? "true" : "false", placeholder: this.placeholder, onKeyDown: (e) => this.handleComboboxKeyDown(e), onInput: (e) => this.handleOnInput(e), onBlur: (e) => this.handleTimeAutocomplete(e) }), this.err && k("div", { class: "invalid-time-icon" }), this.showTimes && k("div", { class: "times", part: "times", ref: (e) => this.timeMenu = e }, k("ul", { tabindex: "-1", role: "listbox", "aria-label": this.name, "aria-activedescendant": this.ariaActivedescendant, onKeyDown: (e) => this.handleListboxKeydown(e) }, this.times.map((e) => k("li", { tabindex: "0", key: e.id, id: e.id.toString(), class: {
|
|
299
|
-
focused: this.ariaActivedescendant === e.id.toString()
|
|
300
|
-
}, onClick: (t) => {
|
|
301
|
-
this.handleTimeChange(t, e.value), this.showTimes = !1, this.timeInput.focus();
|
|
302
|
-
}, role: "option" }, `${e.value}`)))), !this.showTimes && this.err && k("p", { class: "error", id: "email-error" }, this.err)));
|
|
303
|
-
}
|
|
304
|
-
get el() {
|
|
305
|
-
return me(this);
|
|
306
|
-
}
|
|
307
|
-
static get watchers() {
|
|
308
|
-
return {
|
|
309
|
-
minimumStartTime: ["minimumStartTimeChangedHandler"]
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
ue.style = ce;
|
|
314
|
-
export {
|
|
315
|
-
ue as nylas_time_window_picker
|
|
316
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-7dbf0ae7.cjs");require("react");require("react-dom");var _={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(r.commonjsGlobal,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},i=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,a=/\d\d/,h=/\d\d?/,x=/\d*[^-_:/,()\s\d]+/,b={},Z=function(s){return(s=+s)+(s>68?1900:2e3)},d=function(s){return function(o){this[s]=+o}},B=[/[+-]\d\d:?(\d\d)?|Z/,function(s){(this.zone||(this.zone={})).offset=function(o){if(!o||o==="Z")return 0;var m=o.match(/([+-]|\d\d)/g),l=60*m[1]+(+m[2]||0);return l===0?0:m[0]==="+"?-l:l}(s)}],F=function(s){var o=b[s];return o&&(o.indexOf?o:o.s.concat(o.f))},V=function(s,o){var m,l=b.meridiem;if(l){for(var p=1;p<=24;p+=1)if(s.indexOf(l(p,0,o))>-1){m=p>12;break}}else m=s===(o?"pm":"PM");return m},q={A:[x,function(s){this.afternoon=V(s,!1)}],a:[x,function(s){this.afternoon=V(s,!0)}],S:[/\d/,function(s){this.milliseconds=100*+s}],SS:[a,function(s){this.milliseconds=10*+s}],SSS:[/\d{3}/,function(s){this.milliseconds=+s}],s:[h,d("seconds")],ss:[h,d("seconds")],m:[h,d("minutes")],mm:[h,d("minutes")],H:[h,d("hours")],h:[h,d("hours")],HH:[h,d("hours")],hh:[h,d("hours")],D:[h,d("day")],DD:[a,d("day")],Do:[x,function(s){var o=b.ordinal,m=s.match(/\d+/);if(this.day=m[0],o)for(var l=1;l<=31;l+=1)o(l).replace(/\[|\]/g,"")===s&&(this.day=l)}],M:[h,d("month")],MM:[a,d("month")],MMM:[x,function(s){var o=F("months"),m=(F("monthsShort")||o.map(function(l){return l.slice(0,3)})).indexOf(s)+1;if(m<1)throw new Error;this.month=m%12||m}],MMMM:[x,function(s){var o=F("months").indexOf(s)+1;if(o<1)throw new Error;this.month=o%12||o}],Y:[/[+-]?\d+/,d("year")],YY:[a,function(s){this.year=Z(s)}],YYYY:[/\d{4}/,d("year")],Z:B,ZZ:B};function N(s){var o,m;o=s,m=b&&b.formats;for(var l=(s=o.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(S,T,f){var c=f&&f.toUpperCase();return T||m[f]||n[f]||m[c].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(w,k,M){return k||M.slice(1)})})).match(i),p=l.length,y=0;y<p;y+=1){var C=l[y],I=q[C],v=I&&I[0],g=I&&I[1];l[y]=g?{regex:v,parser:g}:C.replace(/^\[|\]$/g,"")}return function(S){for(var T={},f=0,c=0;f<p;f+=1){var w=l[f];if(typeof w=="string")c+=w.length;else{var k=w.regex,M=w.parser,L=S.slice(c),A=k.exec(L)[0];M.call(T,A),S=S.replace(A,"")}}return function(D){var u=D.afternoon;if(u!==void 0){var Y=D.hours;u?Y<12&&(D.hours+=12):Y===12&&(D.hours=0),delete D.afternoon}}(T),T}}return function(s,o,m){m.p.customParseFormat=!0,s&&s.parseTwoDigitYear&&(Z=s.parseTwoDigitYear);var l=o.prototype,p=l.parse;l.parse=function(y){var C=y.date,I=y.utc,v=y.args;this.$u=I;var g=v[1];if(typeof g=="string"){var S=v[2]===!0,T=v[3]===!0,f=S||T,c=v[2];T&&(c=v[2]),b=this.$locale(),!S&&c&&(b=m.Ls[c]),this.$d=function(L,A,D){try{if(["x","X"].indexOf(A)>-1)return new Date((A==="X"?1e3:1)*L);var u=N(A)(L),Y=u.year,E=u.month,X=u.day,G=u.hours,J=u.minutes,Q=u.seconds,ee=u.milliseconds,W=u.zone,$=new Date,P=X||(Y||E?1:$.getDate()),z=Y||$.getFullYear(),O=0;Y&&!E||(O=E>0?E-1:$.getMonth());var j=G||0,H=J||0,K=Q||0,R=ee||0;return W?new Date(Date.UTC(z,O,P,j,H,K,R+60*W.offset*1e3)):D?new Date(Date.UTC(z,O,P,j,H,K,R)):new Date(z,O,P,j,H,K,R)}catch{return new Date("")}}(C,g,I),this.init(),c&&c!==!0&&(this.$L=this.locale(c).$L),f&&C!=this.format(g)&&(this.$d=new Date("")),b={}}else if(g instanceof Array)for(var w=g.length,k=1;k<=w;k+=1){v[1]=g[k-1];var M=m.apply(this,v);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}k===w&&(this.$d=new Date(""))}else p.call(this,y)}}})})(_);const te=_.exports,ie=':host{display:block;position:relative;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif}.time-picker{display:inline-block;width:150px;font-family:var(--nylas-font-family);position:relative}@media screen and (max-width: 768px){.time-picker{width:auto}}.time-picker input{width:150px;height:48px;text-align:center;font-size:16px;font-family:inherit;cursor:pointer;background:transparent;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.time-picker input{width:88px}}@media screen and (max-width: 504px){.time-picker input{width:68px;font-size:15px}}.time-picker input.focus{background:transparent}.time-picker input:hover,.time-picker input:active{border:1px solid var(--nylas-primary)}.time-picker input:active{outline:2px solid var(--nylas-primary)}.time-picker input span.open{transform:rotate(90deg)}.time-picker input span.closed{transform:rotate(270deg)}.time-picker input.error{border:1px solid var(--nylas-error)}.time-picker p.error{color:var(--nylas-error);font-size:0.875rem;margin:0}.times{display:block;margin-top:0.5rem;background-color:var(--nylas-base-0);width:100%;max-height:336px;overflow:auto;border:1px solid #ddd;z-index:1;border-radius:4px;position:absolute;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.0509803922);box-shadow:0px 10px 15px -3px rgba(0, 0, 0, 0.1019607843)}.times ul{padding:0;list-style-type:none;color:var(--nylas-base-900);max-height:336px}.times ul li{padding:16px, 12px, 16px, 12px;color:black;padding:12px 16px;text-decoration:none;display:block;font-family:inherit;font-size:14px;font-weight:400;line-height:20px;letter-spacing:0px;text-align:center;cursor:pointer}.times ul li.focused{background-color:var(--nylas-base-100)}.times ul li:hover,.times ul li:focus{background-color:var(--nylas-base-100)}.times ul li label{display:flex;align-items:center;gap:0.5rem}.times ul li label input{margin:0}',se=ie;r.dayjs.extend(te);const U=class{constructor(e){r.registerInstance(this,e),this.timeChange=r.createEvent(this,"timeChange",7),this.formError=r.createEvent(this,"formError",7),this.time=void 0,this.minimumStartTime=null,this.placeholder="hh:mmam/pm",this.name=void 0,this.hasError=!1,this.err="",this.showTimes=!1,this.ariaActivedescendant="",this.times=this.generateTimes(),this.shouldAutoScroll=!1}handleOutsideClick(e){!e.composedPath().includes(this.el)&&this.showTimes&&(this.showTimes=!1)}minimumStartTimeChangedHandler(){if(this.minimumStartTime){let e=r.dayjs().hour(parseInt(this.minimumStartTime)).minute(parseInt(this.minimumStartTime.slice(-4,-2)));this.minimumStartTime.slice(-2).toLowerCase()==="pm"&&parseInt(this.minimumStartTime)!==12?e=e.add(12,"hour"):this.minimumStartTime.slice(-2).toLowerCase()==="am"&&parseInt(this.minimumStartTime)===12&&(e=e.subtract(12,"hour")),this.times=this.generateTimes();const t=r.dayjs(this.times[0].value,"hh:mma");r.dayjs(this.time,"hh:mma").isBefore(t)&&(this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"}))}}componentDidRender(){if(this.showTimes&&this.shouldAutoScroll){const e=r.autocompleteTimeFormat(this.time),t=this.times.findIndex(n=>n.value===e);t>-1&&(this.shouldAutoScroll=!1,this.scrollToViewWithinParent(t));return}}handleTimeChange(e,t){const n=t.split(":");n[0]==="00"&&n[1].slice(-2)=="pm"&&(this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"})),r.validateTimeFormatInput(t)?(this.err="",this.formError.emit({key:this.el.id,message:""})):(this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"})),this.timeChange.emit({key:this.el.id,value:t})}handleTimeAutocomplete(e){var n;const t=(n=e.target)==null?void 0:n.value;if(!r.validateTimeFormatInput(t)){this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"});return}if(t===""){const i=r.roundToNearest15Minutes().format("hh:mma");this.timeChange.emit({key:this.el.id,value:i});return}if(!r.validateExactTimeFormat(t)){const i=r.autocompleteTimeFormat(t);this.timeChange.emit({key:this.el.id,value:i});return}this.timeChange.emit({key:this.el.id,value:t})}handleOnInput(e){var n;const t=(n=e.target)==null?void 0:n.value;if(r.validateTimeFormatInput(t)){if(t===""){const i=r.roundToNearest15Minutes().format("hh:mma"),a=this.times.findIndex(h=>h.value===i);a>-1&&this.scrollToViewWithinParent(a);return}if(!r.validateExactTimeFormat(t)){const i=r.autocompleteTimeFormat(t),a=this.times.findIndex(h=>h.value===i);a>-1&&this.scrollToViewWithinParent(a);return}}}generateTimes(){const e=[];let t=r.dayjs().set("hour",0).set("minute",0).set("second",0);this.minimumStartTime&&(t=r.dayjs(this.minimumStartTime,"hh:mma"));const n=t.endOf("day").diff(t,"minutes"),i=Math.round(n/15);for(let a=0;a<i+1;a++){const h=t.add(a*15,"minute");if(a==i&&h.format("hh:mma").includes("am"))break;e.push({id:a,value:h.format("hh:mma")})}return e}handleComboboxKeyDown(e){if(e.key==="ArrowDown"){if(e.preventDefault(),!this.showTimes){this.showTimes=!0,this.shouldAutoScroll=!0;return}if(this.ariaActivedescendant==="")this.ariaActivedescendant=this.times[0].id.toString(),this.focusOption(0);else{const t=this.times.findIndex(i=>i.id.toString()===this.ariaActivedescendant),n=t+1<this.times.length?t+1:0;this.ariaActivedescendant=this.times[n].id.toString(),this.focusOption(n)}}else if(e.key==="ArrowUp")if(e.preventDefault(),this.ariaActivedescendant==="")this.ariaActivedescendant=this.times[this.times.length-1].id.toString(),this.focusOption(this.times.length-1);else{const t=this.times.findIndex(i=>i.id.toString()===this.ariaActivedescendant),n=t-1>=0?t-1:this.times.length-1;this.ariaActivedescendant=this.times[n].id.toString(),this.focusOption(n)}else e.key==="Escape"&&(this.showTimes=!1,this.timeInput.focus())}handleListboxKeydown(e){const t=this.times,n=t.findIndex(i=>i.id.toString()===this.ariaActivedescendant);if(e.key==="ArrowDown"||e.key==="Tab"&&!e.shiftKey){e.preventDefault();const i=n+1<t.length?n+1:0;this.ariaActivedescendant=t[i].id.toString(),this.focusOption(i)}else if(e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey){e.preventDefault();const i=n-1>=0?n-1:t.length-1;this.ariaActivedescendant=t[i].id.toString(),this.focusOption(i)}else if(e.key==="Enter"){if(e.preventDefault(),this.ariaActivedescendant){const i=t[n];this.handleTimeChange(e,i.value),this.showTimes=!1,this.ariaActivedescendant="",this.timeInput.focus()}}else e.key==="Escape"&&(this.showTimes=!1,this.timeInput.focus())}scrollToViewWithinParent(e){var x;const t=this.times[e],n=(x=this.el.shadowRoot)==null?void 0:x.getElementById(t.id.toString()),i=this.timeMenu;this.ariaActivedescendant=t.id.toString();const a=n.getBoundingClientRect(),h=i.getBoundingClientRect();a.top<h.top?i.scrollTop-=h.top-a.top:a.bottom>h.bottom&&(i.scrollTop+=a.bottom-h.bottom),a.left<h.left?i.scrollLeft-=h.left-a.left:a.right>h.right&&(i.scrollLeft+=a.right-h.right)}focusOption(e){var a;const t=this.times[e];if(!t)return;const n=t.id.toString(),i=(a=this.el.shadowRoot)==null?void 0:a.getElementById(n);i&&(i.focus(),i.scrollIntoView({behavior:"smooth",block:"nearest"}))}render(){return r.h(r.Host,{key:"e83949b2270706557e5d45aff5958d937c6489c9"},r.h("div",{key:"0cacfe5530a1186ce2ff50ccc3d9328a62d48e2f",class:"time-picker",part:"time-picker"},r.h("input",{key:"8daf647468746997e503883478debf8d335a780d",type:"text",name:this.name,id:this.name,part:"time-input",class:{"time-input":!0,error:!!this.err||this.hasError},ref:e=>this.timeInput=e,value:this.time,onClick:()=>{this.showTimes=!this.showTimes,this.shouldAutoScroll=!0},"aria-haspopup":"listbox","aria-label":this.name,"aria-expanded":this.showTimes?"true":"false",placeholder:this.placeholder,onKeyDown:e=>this.handleComboboxKeyDown(e),onInput:e=>this.handleOnInput(e),onBlur:e=>this.handleTimeAutocomplete(e)}),this.err&&r.h("div",{class:"invalid-time-icon"}),this.showTimes&&r.h("div",{class:"times",part:"times",ref:e=>this.timeMenu=e},r.h("ul",{tabindex:"-1",role:"listbox","aria-label":this.name,"aria-activedescendant":this.ariaActivedescendant,onKeyDown:e=>this.handleListboxKeydown(e)},this.times.map(e=>r.h("li",{tabindex:"0",key:e.id,id:e.id.toString(),class:{focused:this.ariaActivedescendant===e.id.toString()},onClick:t=>{this.handleTimeChange(t,e.value),this.showTimes=!1,this.timeInput.focus()},role:"option"},`${e.value}`)))),!this.showTimes&&this.err&&r.h("p",{class:"error",id:"email-error"},this.err)))}get el(){return r.getElement(this)}static get watchers(){return{minimumStartTime:["minimumStartTimeChangedHandler"]}}};U.style=se;exports.nylas_time_window_picker=U;
|