@nylas/react 1.1.0-canary.9 → 1.1.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/README.md +110 -2
- package/dist/add-circle-icon_2.entry-7165bd0e.js +25 -0
- package/dist/add-circle-icon_2.entry-f1ddca18.cjs +1 -0
- package/dist/archive-icon_7.entry-7411c224.js +75 -0
- package/dist/archive-icon_7.entry-e3df60ed.cjs +1 -0
- package/dist/arrow-icon.entry-280e18b0.cjs +1 -0
- package/dist/arrow-icon.entry-38949317.js +15 -0
- package/dist/bold-icon_3.entry-5963945c.js +35 -0
- package/dist/bold-icon_3.entry-5dffbedd.cjs +1 -0
- package/dist/button-component_2.entry-237733b4.js +26 -0
- package/dist/button-component_2.entry-b29d2873.cjs +1 -0
- package/dist/calendar-agenda-fill-icon_48.entry-9afba869.js +5105 -0
- package/dist/calendar-agenda-fill-icon_48.entry-d3830dbb.cjs +7 -0
- package/dist/calendar-cancel-icon.entry-77ccf227.cjs +1 -0
- package/dist/calendar-cancel-icon.entry-780723a6.js +15 -0
- package/dist/calendar-check-icon_2.entry-2c89c230.js +25 -0
- package/dist/calendar-check-icon_2.entry-b37ac7f0.cjs +1 -0
- package/dist/calendar-icon.entry-02dd3990.js +15 -0
- package/dist/calendar-icon.entry-ffc93569.cjs +1 -0
- package/dist/checkbox-component_2.entry-00b6a1e9.cjs +1 -0
- package/dist/checkbox-component_2.entry-ee9d0e6c.js +56 -0
- package/dist/chevron-icon_3.entry-468abc26.cjs +1 -0
- package/dist/chevron-icon_3.entry-f62e9ef1.js +129 -0
- package/dist/clock-icon_4.entry-766a1b23.js +45 -0
- package/dist/clock-icon_4.entry-7dc2cc4a.cjs +1 -0
- package/dist/constants-50c3e067-8a40a5fe.js +3883 -0
- package/dist/constants-50c3e067-9f2a6372.cjs +15 -0
- package/dist/copy-icon.entry-2a841508.js +15 -0
- package/dist/copy-icon.entry-e5251410.cjs +1 -0
- package/dist/core-js-38e53e34.cjs +4 -0
- package/dist/core-js-a9d3b6e1.js +3297 -0
- package/dist/delete-icon_2.entry-1a5c39dc.cjs +1 -0
- package/dist/delete-icon_2.entry-64555a2f.js +25 -0
- package/dist/document-refresh-icon.entry-4bf6398b.js +15 -0
- package/dist/document-refresh-icon.entry-fdc7ddda.cjs +1 -0
- package/dist/dom-68f08be9.cjs +15 -0
- package/dist/dom-86e17616.js +664 -0
- package/dist/{types/elements → elements}/index.d.ts +47 -1
- package/dist/elements-dc5b338e-2da1fe61.js +28031 -0
- package/dist/elements-dc5b338e-c8016c3d.cjs +16516 -0
- package/dist/flow-40ff9cea-6f8c30e2.cjs +9 -0
- package/dist/flow-40ff9cea-ee70fdf5.js +505 -0
- package/dist/focus-visible-e8093c16-0a38a184.cjs +1 -0
- package/dist/focus-visible-e8093c16-9d0c98c0.js +84 -0
- package/dist/forward-icon_6.entry-390ef70a.js +953 -0
- package/dist/forward-icon_6.entry-7238ef38.cjs +3 -0
- package/dist/globe-icon.entry-81f42f89.cjs +1 -0
- package/dist/globe-icon.entry-8d106260.js +15 -0
- package/dist/google-logo-icon_4.entry-aabd3886.js +680 -0
- package/dist/google-logo-icon_4.entry-fa2b8999.cjs +1 -0
- package/dist/index-53420959-5fc8ad2b.js +5 -0
- package/dist/index-53420959-fcf45780.cjs +1 -0
- package/dist/index-5ccfd9df.js +7859 -0
- package/dist/index-6d9eeb53-58c8980a.js +4971 -0
- package/dist/index-6d9eeb53-b2a6d09f.cjs +41 -0
- package/dist/index-eb33703c.cjs +42 -0
- package/dist/index.es-c9454237-00ccd1e6.js +3135 -0
- package/dist/index.es-c9454237-b64161d1.cjs +7 -0
- package/dist/info-icon_2.entry-b2e11336.cjs +1 -0
- package/dist/info-icon_2.entry-bb8ed71c.js +34 -0
- package/dist/input-component.entry-378b1ccc.cjs +1 -0
- package/dist/input-component.entry-cb86170f.js +65 -0
- package/dist/input-dropdown.entry-98954c93.cjs +1 -0
- package/dist/input-dropdown.entry-a76c339e.js +134 -0
- package/dist/mailbox-store-edc386fc-156b7236.cjs +1 -0
- package/dist/mailbox-store-edc386fc-8bc7558b.js +380 -0
- package/dist/multi-select-dropdown.entry-40b855e1.cjs +1 -0
- package/dist/multi-select-dropdown.entry-6b686695.js +91 -0
- package/dist/nylas-booked-event-card_12.entry-9d693125.cjs +1 -0
- package/dist/nylas-booked-event-card_12.entry-e861bb16.js +1134 -0
- package/dist/nylas-form-card.entry-b158d789.js +57 -0
- package/dist/nylas-form-card.entry-ca4a8746.cjs +1 -0
- package/dist/nylas-if-state.entry-8e4d922c.js +94 -0
- package/dist/nylas-if-state.entry-95fac42d.cjs +1 -0
- package/dist/nylas-list-folders.entry-83c39684.js +120 -0
- package/dist/nylas-list-folders.entry-8a22e0c8.cjs +1 -0
- package/dist/nylas-list-threads.entry-54c582af.cjs +1 -0
- package/dist/nylas-list-threads.entry-7ea370e1.js +70 -0
- package/dist/nylas-login.entry-9115fd81.js +73 -0
- package/dist/nylas-login.entry-fb627e40.cjs +1 -0
- package/dist/nylas-mailbox-pagination.entry-04626d27.cjs +1 -0
- package/dist/nylas-mailbox-pagination.entry-3ff02cf9.js +101 -0
- package/dist/nylas-mailbox-toolbar-button.entry-8d00c789.cjs +1 -0
- package/dist/nylas-mailbox-toolbar-button.entry-f752e925.js +82 -0
- package/dist/nylas-mailbox.entry-99c27b6c.js +134 -0
- package/dist/nylas-mailbox.entry-b3974f4e.cjs +1 -0
- package/dist/nylas-provider.entry-a3ad02a5.cjs +1 -0
- package/dist/nylas-provider.entry-c206aa32.js +145 -0
- package/dist/nylas-reminder-emails.entry-414ce6fe.js +129 -0
- package/dist/nylas-reminder-emails.entry-59c07bfe.cjs +4 -0
- package/dist/nylas-reminder-time_2.entry-197d83a0.js +105 -0
- package/dist/nylas-reminder-time_2.entry-d79dcd85.cjs +1 -0
- package/dist/nylas-scheduler-editor.entry-7f389982.js +1447 -0
- package/dist/nylas-scheduler-editor.entry-f1c6964a.cjs +2 -0
- package/dist/nylas-scheduling.entry-1a8bd6fc.cjs +1 -0
- package/dist/nylas-scheduling.entry-4fa5381d.js +345 -0
- package/dist/nylas-threads-refresh.entry-20602e7b.js +74 -0
- package/dist/nylas-threads-refresh.entry-56b53449.cjs +1 -0
- package/dist/nylas-threads-search.entry-8872473c.js +69 -0
- package/dist/nylas-threads-search.entry-8e0ec3ae.cjs +1 -0
- package/dist/nylas-time-window-picker.entry-9ac542b7.js +316 -0
- package/dist/nylas-time-window-picker.entry-ca47f721.cjs +1 -0
- package/dist/nylas-view-thread.entry-1f758e43.cjs +1 -0
- package/dist/nylas-view-thread.entry-dcd3d5be.js +203 -0
- package/dist/person-icon.entry-63b28ace.cjs +1 -0
- package/dist/person-icon.entry-93130c05.js +15 -0
- package/dist/play-icon_2.entry-6a99c32d.js +25 -0
- package/dist/play-icon_2.entry-b67fb649.cjs +1 -0
- package/dist/react.cjs +1 -0
- package/dist/react.js +144 -0
- package/dist/refresh-icon.entry-84783c91.js +15 -0
- package/dist/refresh-icon.entry-b49792fc.cjs +1 -0
- package/dist/register-component-887199a9-003f96c5.cjs +1 -0
- package/dist/register-component-887199a9-b41dfa7a.js +109 -0
- package/dist/scheduler-config-store-2a3b403d-73610089.js +27 -0
- package/dist/scheduler-config-store-2a3b403d-a5e3433a.cjs +1 -0
- package/dist/scheduler-store-fe281404-bddb1b6a.js +469 -0
- package/dist/scheduler-store-fe281404-c3e477f6.cjs +1 -0
- package/dist/textarea-component.entry-28c4bc05.cjs +1 -0
- package/dist/textarea-component.entry-40e959e5.js +36 -0
- package/dist/time-period-selector.entry-af71523a.cjs +1 -0
- package/dist/time-period-selector.entry-da5d8652.js +93 -0
- package/dist/translate-icon.entry-92b83635.js +15 -0
- package/dist/translate-icon.entry-a2ed4f76.cjs +1 -0
- package/dist/warning-icon.entry-19f721c3.js +15 -0
- package/dist/warning-icon.entry-3ab9a59e.cjs +1 -0
- package/package.json +12 -8
- package/dist/elements/index.js +0 -92
- package/dist/elements/index.js.map +0 -1
- package/dist/elements/react-component-lib/createComponent.js +0 -65
- package/dist/elements/react-component-lib/createComponent.js.map +0 -1
- package/dist/elements/react-component-lib/createOverlayComponent.js +0 -98
- package/dist/elements/react-component-lib/createOverlayComponent.js.map +0 -1
- package/dist/elements/react-component-lib/index.js +0 -3
- package/dist/elements/react-component-lib/index.js.map +0 -1
- package/dist/elements/react-component-lib/interfaces.js +0 -2
- package/dist/elements/react-component-lib/interfaces.js.map +0 -1
- package/dist/elements/react-component-lib/utils/attachProps.js +0 -92
- package/dist/elements/react-component-lib/utils/attachProps.js.map +0 -1
- package/dist/elements/react-component-lib/utils/case.js +0 -7
- package/dist/elements/react-component-lib/utils/case.js.map +0 -1
- package/dist/elements/react-component-lib/utils/dev.js +0 -13
- package/dist/elements/react-component-lib/utils/dev.js.map +0 -1
- package/dist/elements/react-component-lib/utils/index.js +0 -31
- package/dist/elements/react-component-lib/utils/index.js.map +0 -1
- package/dist/index.js +0 -29
- package/dist/index.js.map +0 -1
- /package/dist/{types/elements → elements}/react-component-lib/createComponent.d.ts +0 -0
- /package/dist/{types/elements → elements}/react-component-lib/createOverlayComponent.d.ts +0 -0
- /package/dist/{types/elements → elements}/react-component-lib/index.d.ts +0 -0
- /package/dist/{types/elements → elements}/react-component-lib/interfaces.d.ts +0 -0
- /package/dist/{types/elements → elements}/react-component-lib/utils/attachProps.d.ts +0 -0
- /package/dist/{types/elements → elements}/react-component-lib/utils/case.d.ts +0 -0
- /package/dist/{types/elements → elements}/react-component-lib/utils/dev.d.ts +0 -0
- /package/dist/{types/elements → elements}/react-component-lib/utils/index.d.ts +0 -0
- /package/dist/{types/index.d.ts → index.d.ts} +0 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { r as f, c as p, d as i, h as o, H as u } from "./index-5ccfd9df.js";
|
|
2
|
+
import { R as m } from "./register-component-887199a9-b41dfa7a.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import "react-dom";
|
|
5
|
+
const g = ":host{display:contents}.container{width:100%;overflow:auto;-webkit-overflow-scrolling:touch}.pull-to-refresh{display:none;border:0;background-color:transparent;text-align:center;width:100%;justify-content:center}.pulling{position:relative;display:flex;margin:0 auto;padding:1rem}.pulling svg{width:24px;height:24px;color:var(--nylas-color-primary-500);transform:rotate(90deg)}.refreshing{position:relative;display:flex;margin:0 auto;padding:1rem}.refreshing svg{width:24px;height:24px;fill:var(--nylas-color-primary-500);animation:rotate 1s linear infinite}@keyframes rotate{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}", y = g;
|
|
6
|
+
var v = function(t, e, s, r) {
|
|
7
|
+
var a = arguments.length, n = a < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, s) : r, h;
|
|
8
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
|
|
9
|
+
n = Reflect.decorate(t, e, s, r);
|
|
10
|
+
else
|
|
11
|
+
for (var l = t.length - 1; l >= 0; l--)
|
|
12
|
+
(h = t[l]) && (n = (a < 3 ? h(n) : a > 3 ? h(e, s, n) : h(e, s)) || n);
|
|
13
|
+
return a > 3 && n && Object.defineProperty(e, s, n), n;
|
|
14
|
+
}, c = function(t, e) {
|
|
15
|
+
if (typeof Reflect == "object" && typeof Reflect.metadata == "function")
|
|
16
|
+
return Reflect.metadata(t, e);
|
|
17
|
+
};
|
|
18
|
+
const d = class {
|
|
19
|
+
constructor(t) {
|
|
20
|
+
f(this, t), this.refresh = p(this, "refresh", 7), this.threshold = 100, this.onTouchStart = (e) => {
|
|
21
|
+
var s, r, a, n;
|
|
22
|
+
i("[nylas-threads-refresh] Touch start", e.touches[0].pageY, (s = this.containerElement) == null ? void 0 : s.scrollTop, (r = this.containerElement) == null ? void 0 : r.offsetHeight, (a = this.contentElement) == null ? void 0 : a.scrollTop), ((n = this.containerElement) == null ? void 0 : n.scrollTop) === 0 ? this.start = e.touches[0].pageY : this.start = 0;
|
|
23
|
+
}, this.onTouchMove = (e) => {
|
|
24
|
+
this.start && (e.touches[0].pageY - this.start > this.threshold ? this.pulling = !0 : this.pulling = !1);
|
|
25
|
+
}, this.onTouchEnd = (e) => {
|
|
26
|
+
this.start && (e.changedTouches[0].pageY - this.start > this.threshold && (this.pulling = !1, this.refresh.emit({
|
|
27
|
+
updateState: this.updateState
|
|
28
|
+
})), this.start = 0);
|
|
29
|
+
}, this.start = 0, this.state = "ready", this.pulling = !1, i("[nylas-threads-refresh] Constructor"), this.updateState = this.updateState.bind(this);
|
|
30
|
+
}
|
|
31
|
+
connectedCallback() {
|
|
32
|
+
}
|
|
33
|
+
async componentWillLoad() {
|
|
34
|
+
i("[nylas-threads-refresh] Component will load");
|
|
35
|
+
}
|
|
36
|
+
componentDidLoad() {
|
|
37
|
+
var t, e, s;
|
|
38
|
+
i("[nylas-threads-refresh] Component did load"), (t = this.containerElement) == null || t.addEventListener("touchstart", this.onTouchStart), (e = this.containerElement) == null || e.addEventListener("touchmove", this.onTouchMove), (s = this.containerElement) == null || s.addEventListener("touchend", this.onTouchEnd);
|
|
39
|
+
}
|
|
40
|
+
disconnectedCallback() {
|
|
41
|
+
var t, e, s;
|
|
42
|
+
i("[nylas-threads-refresh] Component disconnected"), (t = this.containerElement) == null || t.removeEventListener("touchstart", this.onTouchStart), (e = this.containerElement) == null || e.removeEventListener("touchmove", this.onTouchMove), (s = this.containerElement) == null || s.removeEventListener("touchend", this.onTouchEnd);
|
|
43
|
+
}
|
|
44
|
+
async updateState(t) {
|
|
45
|
+
this.state = t;
|
|
46
|
+
}
|
|
47
|
+
render() {
|
|
48
|
+
return o(u, { key: "a3cbbe605d8d26999432651d0d60312647da8f86" }, o("div", { key: "1a59758a0cb17a919b7160fa260d1be527d62376", class: "container", ref: (t) => this.containerElement = t }, o("button", { key: "ed5e199459b3e4810143905c4983d5b1cfd1d755", class: {
|
|
49
|
+
"pull-to-refresh": !0,
|
|
50
|
+
pulling: this.pulling,
|
|
51
|
+
refreshing: this.state === "loading"
|
|
52
|
+
}, "aria-label": "Refreshing..." }, this.state === "loading" && o("refresh-icon", { slot: "icon" }), this.state !== "loading" && o("arrow-icon", { slot: "icon" })), o("div", { key: "044db42a017e65e10920661b8f83d7f98ac0fe35", class: "content", ref: (t) => this.contentElement = t }, o("slot", { key: "359a095179a1ef2e5733f843dc140171bc0bddfe" }))));
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
v([
|
|
56
|
+
m({
|
|
57
|
+
name: "nylas-threads-refresh",
|
|
58
|
+
eventToProps: {
|
|
59
|
+
refresh: async (t, e) => {
|
|
60
|
+
i("[nylas-threads-refresh] Refreshing threads");
|
|
61
|
+
const { updateState: s } = t.detail;
|
|
62
|
+
await s("loading"), await e.threads.getThreads(void 0, "overwrite", !1), await s("ready");
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
fireRegisterEvent: !0
|
|
66
|
+
}),
|
|
67
|
+
c("design:type", Function),
|
|
68
|
+
c("design:paramtypes", []),
|
|
69
|
+
c("design:returntype", void 0)
|
|
70
|
+
], d.prototype, "render", null);
|
|
71
|
+
d.style = y;
|
|
72
|
+
export {
|
|
73
|
+
d as nylas_threads_refresh
|
|
74
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-eb33703c.cjs"),c=require("./register-component-887199a9-003f96c5.cjs");require("react");require("react-dom");const f=":host{display:contents}.container{width:100%;overflow:auto;-webkit-overflow-scrolling:touch}.pull-to-refresh{display:none;border:0;background-color:transparent;text-align:center;width:100%;justify-content:center}.pulling{position:relative;display:flex;margin:0 auto;padding:1rem}.pulling svg{width:24px;height:24px;color:var(--nylas-color-primary-500);transform:rotate(90deg)}.refreshing{position:relative;display:flex;margin:0 auto;padding:1rem}.refreshing svg{width:24px;height:24px;fill:var(--nylas-color-primary-500);animation:rotate 1s linear infinite}@keyframes rotate{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}",u=f;var p=function(t,e,n,a){var i=arguments.length,r=i<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,n):a,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,a);else for(var h=t.length-1;h>=0;h--)(o=t[h])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);return i>3&&r&&Object.defineProperty(e,n,r),r},l=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};const d=class{constructor(t){s.registerInstance(this,t),this.refresh=s.createEvent(this,"refresh",7),this.threshold=100,this.onTouchStart=e=>{var n,a,i,r;s.debug("[nylas-threads-refresh] Touch start",e.touches[0].pageY,(n=this.containerElement)==null?void 0:n.scrollTop,(a=this.containerElement)==null?void 0:a.offsetHeight,(i=this.contentElement)==null?void 0:i.scrollTop),((r=this.containerElement)==null?void 0:r.scrollTop)===0?this.start=e.touches[0].pageY:this.start=0},this.onTouchMove=e=>{this.start&&(e.touches[0].pageY-this.start>this.threshold?this.pulling=!0:this.pulling=!1)},this.onTouchEnd=e=>{this.start&&(e.changedTouches[0].pageY-this.start>this.threshold&&(this.pulling=!1,this.refresh.emit({updateState:this.updateState})),this.start=0)},this.start=0,this.state="ready",this.pulling=!1,s.debug("[nylas-threads-refresh] Constructor"),this.updateState=this.updateState.bind(this)}connectedCallback(){}async componentWillLoad(){s.debug("[nylas-threads-refresh] Component will load")}componentDidLoad(){var t,e,n;s.debug("[nylas-threads-refresh] Component did load"),(t=this.containerElement)==null||t.addEventListener("touchstart",this.onTouchStart),(e=this.containerElement)==null||e.addEventListener("touchmove",this.onTouchMove),(n=this.containerElement)==null||n.addEventListener("touchend",this.onTouchEnd)}disconnectedCallback(){var t,e,n;s.debug("[nylas-threads-refresh] Component disconnected"),(t=this.containerElement)==null||t.removeEventListener("touchstart",this.onTouchStart),(e=this.containerElement)==null||e.removeEventListener("touchmove",this.onTouchMove),(n=this.containerElement)==null||n.removeEventListener("touchend",this.onTouchEnd)}async updateState(t){this.state=t}render(){return s.h(s.Host,{key:"a3cbbe605d8d26999432651d0d60312647da8f86"},s.h("div",{key:"1a59758a0cb17a919b7160fa260d1be527d62376",class:"container",ref:t=>this.containerElement=t},s.h("button",{key:"ed5e199459b3e4810143905c4983d5b1cfd1d755",class:{"pull-to-refresh":!0,pulling:this.pulling,refreshing:this.state==="loading"},"aria-label":"Refreshing..."},this.state==="loading"&&s.h("refresh-icon",{slot:"icon"}),this.state!=="loading"&&s.h("arrow-icon",{slot:"icon"})),s.h("div",{key:"044db42a017e65e10920661b8f83d7f98ac0fe35",class:"content",ref:t=>this.contentElement=t},s.h("slot",{key:"359a095179a1ef2e5733f843dc140171bc0bddfe"}))))}};p([c.RegisterComponent({name:"nylas-threads-refresh",eventToProps:{refresh:async(t,e)=>{s.debug("[nylas-threads-refresh] Refreshing threads");const{updateState:n}=t.detail;await n("loading"),await e.threads.getThreads(void 0,"overwrite",!1),await n("ready")}},fireRegisterEvent:!0}),l("design:type",Function),l("design:paramtypes",[]),l("design:returntype",void 0)],d.prototype,"render",null);d.style=u;exports.nylas_threads_refresh=d;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { r as u, c as y, d as h, h as i, H as f } from "./index-5ccfd9df.js";
|
|
2
|
+
import { R as p } from "./register-component-887199a9-b41dfa7a.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import "react-dom";
|
|
5
|
+
const m = ":host{display:block}sp-search{width:100%;border:0}", g = m;
|
|
6
|
+
var b = function(t, e, n, r) {
|
|
7
|
+
var s = arguments.length, a = s < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, n) : r, o;
|
|
8
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
|
|
9
|
+
a = Reflect.decorate(t, e, n, r);
|
|
10
|
+
else
|
|
11
|
+
for (var c = t.length - 1; c >= 0; c--)
|
|
12
|
+
(o = t[c]) && (a = (s < 3 ? o(a) : s > 3 ? o(e, n, a) : o(e, n)) || a);
|
|
13
|
+
return s > 3 && a && Object.defineProperty(e, n, a), a;
|
|
14
|
+
}, l = function(t, e) {
|
|
15
|
+
if (typeof Reflect == "object" && typeof Reflect.metadata == "function")
|
|
16
|
+
return Reflect.metadata(t, e);
|
|
17
|
+
};
|
|
18
|
+
const d = class {
|
|
19
|
+
constructor(t) {
|
|
20
|
+
u(this, t), this.search = y(this, "search", 7), this.onSearch = async (e) => {
|
|
21
|
+
e.preventDefault(), e.stopPropagation();
|
|
22
|
+
const r = e.target.value;
|
|
23
|
+
r !== this.internalQuery && (this.internalQuery = r, this.search.emit(this.internalQuery));
|
|
24
|
+
}, this.query = "", this.internalQuery = "";
|
|
25
|
+
}
|
|
26
|
+
connectedCallback() {
|
|
27
|
+
}
|
|
28
|
+
disconnectedCallback() {
|
|
29
|
+
}
|
|
30
|
+
async componentWillLoad() {
|
|
31
|
+
h("[nylas-threads-search] Component will load");
|
|
32
|
+
}
|
|
33
|
+
async componentDidLoad() {
|
|
34
|
+
h("[nylas-threads-search] Component did load");
|
|
35
|
+
}
|
|
36
|
+
onQueryChange() {
|
|
37
|
+
this.internalQuery = this.query;
|
|
38
|
+
}
|
|
39
|
+
render() {
|
|
40
|
+
return i(f, { key: "b61eeaa00c7e01d06d5b867958ac4979169f20b6" }, i("sp-theme", { key: "52d3212dc5223063e1f3f26cd8a29d555eaa3fac", scale: "medium", color: "dark" }, i("sp-search", { key: "2a15f291ae4a2e118398a01c2ddf68f1912f13fb", quiet: !0, onSubmit: this.onSearch, onBlur: this.onSearch, value: this.internalQuery })));
|
|
41
|
+
}
|
|
42
|
+
static get watchers() {
|
|
43
|
+
return {
|
|
44
|
+
query: ["onQueryChange"]
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
b([
|
|
49
|
+
p({
|
|
50
|
+
name: "nylas-pagination",
|
|
51
|
+
stateToProps: /* @__PURE__ */ new Map([["mailbox.searchQuery", "query"]]),
|
|
52
|
+
eventToProps: {
|
|
53
|
+
search: async (t, e) => {
|
|
54
|
+
await e.threads.getThreads({
|
|
55
|
+
search_query_native: t.detail || void 0,
|
|
56
|
+
page_token: void 0
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
fireRegisterEvent: !0
|
|
61
|
+
}),
|
|
62
|
+
l("design:type", Function),
|
|
63
|
+
l("design:paramtypes", []),
|
|
64
|
+
l("design:returntype", void 0)
|
|
65
|
+
], d.prototype, "render", null);
|
|
66
|
+
d.style = g;
|
|
67
|
+
export {
|
|
68
|
+
d as nylas_threads_search
|
|
69
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-eb33703c.cjs"),d=require("./register-component-887199a9-003f96c5.cjs");require("react");require("react-dom");const u=":host{display:block}sp-search{width:100%;border:0}",y=u;var f=function(t,e,s,n){var o=arguments.length,r=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,s):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,s,n);else for(var i=t.length-1;i>=0;i--)(c=t[i])&&(r=(o<3?c(r):o>3?c(e,s,r):c(e,s))||r);return o>3&&r&&Object.defineProperty(e,s,r),r},l=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};const h=class{constructor(t){a.registerInstance(this,t),this.search=a.createEvent(this,"search",7),this.onSearch=async e=>{e.preventDefault(),e.stopPropagation();const n=e.target.value;n!==this.internalQuery&&(this.internalQuery=n,this.search.emit(this.internalQuery))},this.query="",this.internalQuery=""}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){a.debug("[nylas-threads-search] Component will load")}async componentDidLoad(){a.debug("[nylas-threads-search] Component did load")}onQueryChange(){this.internalQuery=this.query}render(){return a.h(a.Host,{key:"b61eeaa00c7e01d06d5b867958ac4979169f20b6"},a.h("sp-theme",{key:"52d3212dc5223063e1f3f26cd8a29d555eaa3fac",scale:"medium",color:"dark"},a.h("sp-search",{key:"2a15f291ae4a2e118398a01c2ddf68f1912f13fb",quiet:!0,onSubmit:this.onSearch,onBlur:this.onSearch,value:this.internalQuery})))}static get watchers(){return{query:["onQueryChange"]}}};f([d.RegisterComponent({name:"nylas-pagination",stateToProps:new Map([["mailbox.searchQuery","query"]]),eventToProps:{search:async(t,e)=>{await e.threads.getThreads({search_query_native:t.detail||void 0,page_token:void 0})}},fireRegisterEvent:!0}),l("design:type",Function),l("design:paramtypes",[]),l("design:returntype",void 0)],h.prototype,"render",null);h.style=y;exports.nylas_threads_search=h;
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { i as ae, W as C, r as oe, c as N, X as _, Y as B, Z as G, _ as q, h as k, H as he, g as me } from "./index-5ccfd9df.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import "react-dom";
|
|
4
|
+
var J = { 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 = {}, V = function(s) {
|
|
10
|
+
return (s = +s) + (s > 68 ? 1900 : 2e3);
|
|
11
|
+
}, l = function(s) {
|
|
12
|
+
return function(a) {
|
|
13
|
+
this[s] = +a;
|
|
14
|
+
};
|
|
15
|
+
}, U = [/[+-]\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
|
+
}, X = 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
|
+
}, Q = { A: [v, function(s) {
|
|
37
|
+
this.afternoon = X(s, !1);
|
|
38
|
+
}], a: [v, function(s) {
|
|
39
|
+
this.afternoon = X(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 = V(s);
|
|
65
|
+
}], YYYY: [/\d{4}/, l("year")], Z: U, ZZ: U };
|
|
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 = Q[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 && (V = 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, j = 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, Z = se || 0, R = ne || 0, W = re || 0;
|
|
113
|
+
return j ? new Date(Date.UTC(H, $, F, K, Z, R, W + 60 * j.offset * 1e3)) : M ? new Date(Date.UTC(H, $, F, K, Z, R, W)) : new Date(H, $, F, K, Z, R, W);
|
|
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
|
+
})(J);
|
|
134
|
+
const le = J.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 = N(this, "timeChange", 7), this.formError = N(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 = _(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
|
+
})), B(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 (!B(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 = _(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 (B(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 = _(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: "f9e043d1053de00843aab2ba2fc790fa03710a6c" }, k("div", { key: "c94d6067be1848d766075088fc8b7b7b9f894302", class: "time-picker", part: "time-picker" }, k("input", { key: "4f9826a61fc6a5c39c9af5c17489be9d1b177c22", 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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-eb33703c.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:"f9e043d1053de00843aab2ba2fc790fa03710a6c"},r.h("div",{key:"c94d6067be1848d766075088fc8b7b7b9f894302",class:"time-picker",part:"time-picker"},r.h("input",{key:"4f9826a61fc6a5c39c9af5c17489be9d1b177c22",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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-eb33703c.cjs"),w=require("./register-component-887199a9-003f96c5.cjs");require("react");require("react-dom");function b(t,a,s,o,r){if(!o||!s||s.children.length>0)return;e.debug("[nylas-view-thread] Rendering email",{message:t,attachments:a,viewEmailElement:o});const n=o.cloneNode(!0);n.message=t.data,n.parent=r,s.appendChild(n)}const c=({viewEmailElement:t,message:a,attachments:s,onMessageClick:o,onShowContactDataClick:r,parent:n})=>{var l,i,d,g,u,v,y;return e.h(e.Fragment,null,e.h("div",{key:a.id,class:"message"},e.h("div",{class:"sub-header","data-id":a.data.id,onClick:o},e.h("div",{class:"avatar"},a.data.from&&((l=a.data.from[0])==null?void 0:l.name)&&((d=(i=a.data.from[0])==null?void 0:i.name[0])==null?void 0:d.toUpperCase())),e.h("div",{class:"from"},e.h("span",{class:"name"},a.data.from&&((g=a.data.from[0])==null?void 0:g.name))," ",e.h("span",{class:"email"},a.data.from&&((u=a.data.from[0])==null?void 0:u.email))),e.h("div",{class:"date"},new Date(a.data.date*1e3).toLocaleTimeString(void 0,{timeStyle:"short"})," ","(",e.formatTimeAgo(new Date(a.data.date*1e3)),")"),e.h("sp-button-group",{class:"buttons"},e.h("nylas-summarize-message-button",{message:a.data})),a.collapse&&e.h("div",{class:"snippet"},a.data.snippet),!a.collapse&&a.data.to&&e.h("div",{class:"to"},e.h("span",null,"to")," ",e.formatParticipants(a.data.to)," ",e.h("button",{type:"button",value:a.data.id,onClick:r,class:{expand:!0,"expand--showContactData":a.showContactData}},e.h("chevron-icon",null)))),a.showContactData&&e.h("div",{class:"address-info"},e.h("div",{class:"label"},"From"),e.h("div",{class:"value"},e.formatRecipient((v=a.data)!=null&&v.from?(y=a==null?void 0:a.data)==null?void 0:y.from[0]:{name:"",email:""})),a.data.to&&e.h(e.Fragment,null,e.h("div",{class:"label"},"To"),e.h("div",{class:"value"},a.data.to.map(h=>e.h("div",null,e.formatRecipient(h))))),typeof a.data.cc<"u"&&a.data.cc.length>0&&e.h(e.Fragment,null,e.h("div",{class:"label"},"CC"),e.h("div",{class:"value"},a.data.cc.map(h=>e.h("div",null,e.formatRecipient(h)))))),!a.collapse&&t&&e.h("div",{key:a.id,ref:h=>b(a,s,h,t,n)}),!a.collapse&&!t&&e.h("nylas-view-email",{key:a.id,message:a.data,parent:n})),e.h("hr",null))},f=':host{display:block;font-size:inherit}.avatar{z-index:1;border-radius:100%;background-color:var(--nylas-color-primary-200);height:40px;width:40px;align-items:center;display:flex;justify-content:center;border:1px solid var(--nylas-color-primary-200)}.view-thread{display:grid;grid-auto-flow:row;width:100%}.view-thread .header{display:grid;grid-gap:1rem;align-items:center;margin-bottom:1rem}.view-thread .header .subject{font-size:1.25rem;font-weight:600;line-height:1.5rem}.view-thread .header .folders{display:grid;grid-auto-flow:column;grid-auto-columns:min-content;overflow-x:auto;gap:1rem}.view-thread .header .folders .folder{padding:0 0.5rem;font-size:0.9rem;color:var(--nylas-color-primary-900);background-color:var(--nylas-color-primary-300)}.view-thread .messages{display:grid;gap:1rem}.view-thread .messages hr{margin:0;width:100%;border:1px solid var(--nylas-color-primary-200)}.view-thread .messages hr:last-of-type{display:none}.view-thread .messages .message{display:grid;grid-auto-flow:row;gap:1rem}.view-thread .messages .message:last-of-type .sub-header{cursor:default}.view-thread .messages .message .sub-header{display:grid;grid-template:"avatar from date buttons" "avatar to to buttons";grid-column-gap:1rem;grid-template-columns:auto 1fr auto auto;cursor:pointer}.view-thread .messages .message .sub-header>*{pointer-events:none}.view-thread .messages .message .sub-header .avatar{grid-area:avatar}.view-thread .messages .message .sub-header .from{grid-area:from}.view-thread .messages .message .sub-header .from span.email{display:none;color:var(--nylas-color-primary-400);font-weight:600}.view-thread .messages .message .sub-header .buttons{grid-area:buttons;align-self:center}.view-thread .messages .message .sub-header .buttons *{pointer-events:all}.view-thread .messages .message .sub-header .date{grid-area:date;align-self:center;color:var(--nylas-color-primary-400)}.view-thread .messages .message .sub-header .snippet{width:90%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--nylas-color-primary-600)}.view-thread .messages .message .sub-header .to{grid-area:to;color:var(--nylas-color-primary-400)}.view-thread .messages .message .sub-header .to>span{color:var(--nylas-color-primary-400)}.view-thread .messages .message .sub-header .to button{border:0;background-color:transparent;cursor:pointer;pointer-events:all;padding:0;margin:0}.view-thread .messages .message .sub-header .to button>*{pointer-events:none}.view-thread .messages .message .sub-header .to button chevron-icon{display:inline-table;fill:var(--nylas-color-primary-400);width:15px;height:15px;vertical-align:middle}.view-thread .messages .message .sub-header .to button chevron-icon svg{width:15px;height:15px;transform:rotate(90deg)}.view-thread .messages .message .sub-header .to button.expand--showContactData chevron-icon svg{transform:rotate(270deg)}.view-thread .messages .message .address-info{display:grid;column-gap:1rem;row-gap:0.5rem;grid-template-columns:auto 1fr;grid-template-rows:1fr;padding:1rem 2rem;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-color-primary-200);align-items:flex-start;color:var(--nylas-color-primary-600)}.view-thread .messages .message .address-info .label{color:var(--nylas-color-primary-400);font-weight:600}.show-more{position:relative;display:flex;width:100%}.show-more .sr-only{display:none}.show-more button{position:relative;display:inline-flex;width:100%;padding:0;border:0;background-color:transparent;cursor:pointer;text-align:left;overflow:hidden}.show-more button span{border:1px solid var(--nylas-color-primary-400)}.show-more button:hover span{background-color:var(--nylas-color-primary-700)}.show-more button::after{border-top:1px solid rgba(100, 121, 143, 0.122);border-bottom:1px solid rgba(100, 121, 143, 0.122);content:"";height:4px;width:100%;position:absolute;top:50%}.loading{position:absolute;width:100%;height:100%;background-color:var(--loading__background-color);top:0;bottom:0;left:0;z-index:1;display:grid;justify-content:center;align-items:center;font-weight:600;overflow:hidden}.reply-buttons{display:grid;grid-auto-flow:column;grid-auto-columns:min-content;gap:1rem;margin-top:1rem}.reply-buttons sp-button{border-radius:var(--nylas-border-radius);background-color:var(--nylas-color-primary-400);color:var(--nylas-color-primary-900);fill:var(--nylas-color-primary-900)}.reply-buttons sp-button:hover{background-color:var(--nylas-color-primary-500)}.reply-buttons sp-button:disabled{background-color:var(--nylas-color-primary-200);color:var(--nylas-color-primary-600);cursor:not-allowed}.reply-buttons sp-button chevron-icon{display:inline-block}@media only screen and (min-width: 768px){.view-thread .messages .message .sub-header .from span.email{display:inline}}',C=f;var k=function(t,a,s,o){var r=arguments.length,n=r<3?a:o===null?o=Object.getOwnPropertyDescriptor(a,s):o,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(t,a,s,o);else for(var i=t.length-1;i>=0;i--)(l=t[i])&&(n=(r<3?l(n):r>3?l(a,s,n):l(a,s))||n);return r>3&&n&&Object.defineProperty(a,s,n),n},m=function(t,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,a)};const p=class{constructor(t){e.registerInstance(this,t),this.threadSelected=e.createEvent(this,"threadSelected",7),this.showContactDataClicked=e.createEvent(this,"showContactDataClicked",7),this.messageClicked=e.createEvent(this,"messageClicked",7),this.nylasViewEmailElement=null,this.nylasComposerElement=null,this.onShowContactDataClick=a=>{a.stopPropagation();const o=a.target.value,r=this.internalMessages.find(l=>l.data.id===o);if(!r){e.debug(`[nylas-view-thread] Could not find message ${o}`);return}this.showContactDataClicked.emit(r.data).defaultPrevented||(r.showContactData=!r.showContactData,this.internalMessages=[...this.internalMessages]),e.debug(`[nylas-view-thread] show contact data clicked ${o} ${r.showContactData?"collapsed":"expanded"}`)},this.onMessageClick=a=>{var l;const o=a.target.dataset.id,r=this.internalMessages.find(i=>i.data.id===o);if(!r){e.debug(`[nylas-view-thread] Could not find message ${o}`);return}this.messageClicked.emit(r.data).defaultPrevented||(r.id!==((l=this.internalMessages[this.internalMessages.length-1])==null?void 0:l.id)&&(r.collapse=!r.collapse,r.collapse&&(r.showContactData=!1)),this.internalMessages=[...this.internalMessages]),e.debug(`[nylas-view-thread] message clicked ${o} ${r.collapse?"collapsed":"expanded"}`)},this.onShowAllEmailsClick=()=>{this.showAllEmails=!this.showAllEmails},this.showComposerClick=()=>{this.showComposer=!this.showComposer},this.draft=void 0,this.thread=void 0,this.messages=[],this.attachments=[],this.state="loading",this.internalMessages=[],this.showAllEmails=!1,this.showComposer=!1}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){e.debug("[nylas-view-thread] Component will load"),this.updateInternalMessages(this.messages);const t=this.host.querySelector("template.nylas-view-email");if(!t){e.debug("[nylas-view-thread] Could not find template");return}const a=document.importNode(t.content,!0);this.nylasViewEmailElement=a.querySelector("nylas-view-email");const s=this.host.querySelector("template.nylas-composer");if(!s){e.debug("[nylas-view-thread] Could not find composer template");return}const o=document.importNode(s.content,!0);this.nylasComposerElement=o.querySelector("nylas-composer")}async componentDidLoad(){e.debug("[nylas-view-thread] Component did load")}async threadChanged(t){e.debug("[nylas-view-thread] Thread changed",{thread:t}),this.internalMessages=[],this.threadSelected.emit(t).defaultPrevented||e.debug("[nylas-view-thread] Default event not prevented, initializing")}updateInternalMessages(t){e.debug("[nylas-view-thread] Updating internal messages",{messages:t});const a=t.sort((s,o)=>s.date>o.date?1:-1).map((s,o)=>({id:s.id,data:s,collapse:o!==t.length-1,showContactData:!1}));this.internalMessages=a}render(){var r,n,l;const t=this.internalMessages.length>2?this.internalMessages[0]:null,a=this.internalMessages.slice(this.internalMessages.length-2,this.internalMessages.length),s=this.internalMessages.slice(1,this.internalMessages.length-2),o=this.internalMessages[this.internalMessages.length-1];return e.h(e.Host,{key:"8ded7fac7238425d362b59a6754cc8c0ee36dc13"},e.h("sp-theme",{key:"709b8e7877cb108bb09199db5ba6306ea9b130a0",scale:"medium",color:"dark"},e.h("div",{key:"19d5912e09475417c50b27b24979e5337806b94c",class:"view-thread"},e.h("div",{key:"46c2022b7a45b8d05f8f23068828579b4294fee4",class:"header"},e.h("div",{key:"5e748e44ef6683d4215fbe0afff040f2091e376c",class:"subject"},(r=this.thread)==null?void 0:r.subject),e.h("div",{key:"3106d62c0ecf951ccf58fd32bb171ae4ce846909",class:"folders"},(l=(n=this.thread)==null?void 0:n.folders)==null?void 0:l.map(i=>e.h("sp-tag",{size:"s"},e.toTitleCase(i.replace("CATEGORY_","").replace("_"," ")))))),e.h("div",{key:"f2c2bfb336520c4dafa6597c417efee372648354",class:"messages"},t&&e.h(c,{message:t,attachments:this.attachments.filter(i=>i.messageId===t.id),onMessageClick:this.onMessageClick,onShowContactDataClick:this.onShowContactDataClick,parent:this.host,viewEmailElement:this.nylasViewEmailElement,composerElement:this.nylasComposerElement}),s.length>0&&this.messages.length>1&&!this.showAllEmails&&a.length>0&&e.h(e.Fragment,null,e.h("div",{class:"show-more"},e.h("button",{type:"button",onClick:this.onShowAllEmailsClick},e.h("span",{class:"avatar"},s.length)," ",e.h("span",{class:"sr-only"},"Show ",s.length," more emails"))),e.h("hr",null)),s.length>0&&this.showAllEmails&&this.messages.length>2&&s.map(i=>e.h(c,{message:i,attachments:this.attachments.filter(d=>d.messageId===(t==null?void 0:t.id)),onMessageClick:this.onMessageClick,onShowContactDataClick:this.onShowContactDataClick,parent:this.host,viewEmailElement:this.nylasViewEmailElement,composerElement:this.nylasComposerElement})),a.length>0&&a.map(i=>e.h(c,{message:i,attachments:this.attachments.filter(d=>d.messageId===(t==null?void 0:t.id)),onMessageClick:this.onMessageClick,onShowContactDataClick:this.onShowContactDataClick,parent:this.host,viewEmailElement:this.nylasViewEmailElement,composerElement:this.nylasComposerElement}))),!(this.showComposer&&o)&&e.h("div",{class:"reply-buttons"},e.h("sp-button",{variant:"cta",type:"button",onClick:this.showComposerClick},e.h("span",{slot:"icon"},e.h("reply-icon",null)),e.h("span",null,"Reply")),e.h("sp-button",{variant:"cta",type:"button"},e.h("span",{slot:"icon"},e.h("reply-all-icon",null)),e.h("span",null,"Reply All")),e.h("sp-button",{variant:"cta",type:"button"},e.h("span",{slot:"icon"},e.h("forward-icon",null)),e.h("span",null,"Forward"))),this.showComposer&&o&&e.h("div",{class:"composer"},e.h("nylas-composer",{message:o.data,onClose:this.showComposerClick,onSend:i=>{e.debug("[nylas-view-thread] Send event",{message:i.detail.message,replyBody:i.detail.replyBody})}})))))}get host(){return e.getElement(this)}static get watchers(){return{thread:["threadChanged"],messages:["updateInternalMessages"]}}};k([w.RegisterComponent({name:"nylas-view-thread",stateToProps:new Map([["mailbox.selectedThread","thread"],["mailbox.messages","messages"],["mailbox.state","state"]]),eventToProps:{threadSelected:async(t,a)=>{e.debug("[nylas-view-thread] Nylas init event. Fetching thread messages.",{event:t});const s=t.detail;s&&s.id&&await a.messages.getThreadMessages(s.id)}},fireRegisterEvent:!0}),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",void 0)],p.prototype,"render",null);p.style=C;exports.nylas_view_thread=p;
|