@nylas/react 1.3.3 → 1.3.4
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-321c1dd1.js +15 -0
- package/dist/{add-circle-icon.entry-89060fe6.cjs → add-circle-icon.entry-dcc45961.cjs} +1 -1
- package/dist/archive-icon.entry-715e139b.js +15 -0
- package/dist/archive-icon.entry-c4da9f4f.cjs +1 -0
- package/dist/{arrow-icon.entry-7c38f4ad.js → arrow-icon.entry-9311463c.js} +2 -2
- package/dist/{arrow-icon.entry-e8dbe365.cjs → arrow-icon.entry-bdccce8a.cjs} +1 -1
- package/dist/{bold-icon.entry-665901ce.cjs → bold-icon.entry-06fa4738.cjs} +1 -1
- package/dist/{bold-icon.entry-4ce7cfee.js → bold-icon.entry-c531dff1.js} +4 -4
- package/dist/{button-component_2.entry-89ea010b.js → button-component_2.entry-5aad0ec4.js} +9 -9
- package/dist/{button-component_2.entry-ca263036.cjs → button-component_2.entry-db911efe.cjs} +1 -1
- package/dist/{calendar-agenda-fill-icon_53.entry-347662f3.js → calendar-agenda-fill-icon_53.entry-6f1aa42c.js} +1846 -1433
- package/dist/calendar-agenda-fill-icon_53.entry-affead77.cjs +6 -0
- package/dist/{calendar-cancel-icon.entry-6b7836c9.cjs → calendar-cancel-icon.entry-3bd1c8e9.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-c1d33f90.js → calendar-cancel-icon.entry-59375bc4.js} +4 -4
- package/dist/{calendar-check-icon_2.entry-222e3c0b.js → calendar-check-icon_2.entry-1ca369b6.js} +7 -7
- package/dist/{calendar-check-icon_2.entry-67024cd6.cjs → calendar-check-icon_2.entry-540dde9d.cjs} +1 -1
- package/dist/{calendar-icon.entry-380048b0.cjs → calendar-icon.entry-1d9773d5.cjs} +1 -1
- package/dist/{calendar-icon.entry-c08a8f21.js → calendar-icon.entry-66517be4.js} +5 -5
- package/dist/{checkbox-component_3.entry-52b27cb9.cjs → checkbox-component_3.entry-3918885e.cjs} +1 -1
- package/dist/{checkbox-component_3.entry-dab3c3c8.js → checkbox-component_3.entry-cf9507ac.js} +5 -5
- package/dist/{chevron-icon_3.entry-17bb7d23.cjs → chevron-icon_3.entry-27b71bd6.cjs} +1 -1
- package/dist/{chevron-icon_3.entry-7be40d99.js → chevron-icon_3.entry-afc62aa5.js} +13 -13
- package/dist/{clock-icon_4.entry-89e0dd55.js → clock-icon_4.entry-ab2c2eaf.js} +18 -18
- package/dist/{clock-icon_4.entry-875db481.cjs → clock-icon_4.entry-f46a42fc.cjs} +1 -1
- package/dist/close-icon.entry-791cb99c.js +15 -0
- package/dist/close-icon.entry-be2b5f87.cjs +1 -0
- package/dist/{constants-54af2051-a3596673.cjs → constants-91d76d21-0f7c85cc.cjs} +1 -1
- package/dist/{constants-54af2051-767e8462.js → constants-91d76d21-1638ead6.js} +23 -11
- package/dist/copy-icon.entry-16835c5d.cjs +1 -0
- package/dist/{copy-icon.entry-eecc7301.js → copy-icon.entry-c009a659.js} +6 -6
- package/dist/{delete-icon.entry-1e6c99ee.cjs → delete-icon.entry-3c295200.cjs} +1 -1
- package/dist/{delete-icon.entry-4b341b41.js → delete-icon.entry-e8815e15.js} +2 -2
- package/dist/document-refresh-icon.entry-1628d0dd.js +15 -0
- package/dist/{document-refresh-icon.entry-612c5d4f.cjs → document-refresh-icon.entry-7d84ace4.cjs} +1 -1
- package/dist/{feedbackSync-e5cb0245-013ce5ec.cjs → feedbackSync-b5d35a5b-1343e33b.cjs} +1 -1
- package/dist/{feedbackSync-e5cb0245-f8e4575c.js → feedbackSync-b5d35a5b-20032e5d.js} +1 -1
- package/dist/{folder-icon.entry-5bc752d4.cjs → folder-icon.entry-1837e7eb.cjs} +1 -1
- package/dist/{folder-icon.entry-8d91bc75.js → folder-icon.entry-1a70f499.js} +2 -2
- package/dist/forward-icon.entry-7a9952fe.cjs +1 -0
- package/dist/forward-icon.entry-92fa4f95.js +15 -0
- package/dist/{globe-icon.entry-c2ddabb6.js → globe-icon.entry-2886c103.js} +4 -4
- package/dist/{globe-icon.entry-13f5dd98.cjs → globe-icon.entry-5ea64e36.cjs} +1 -1
- package/dist/{google-logo-icon_4.entry-b58af39b.js → google-logo-icon_4.entry-c0413818.js} +168 -148
- package/dist/google-logo-icon_4.entry-ff5ebfd9.cjs +1 -0
- package/dist/inbox-icon.entry-893a70b6.js +15 -0
- package/dist/inbox-icon.entry-ad864253.cjs +1 -0
- package/dist/index-94416062.cjs +81 -0
- package/dist/index-cd93b584.js +16202 -0
- package/dist/{index.es-e9d66a9b-fa36c085.cjs → index.es-ef72cd61-0860521c.cjs} +1 -1
- package/dist/{index.es-e9d66a9b-a07a895d.js → index.es-ef72cd61-3075f564.js} +1 -1
- package/dist/{info-icon_2.entry-14cad09c.js → info-icon_2.entry-891619f7.js} +5 -5
- package/dist/{info-icon_2.entry-fce3a1ce.cjs → info-icon_2.entry-cfa2954a.cjs} +1 -1
- package/dist/{input-color-picker.entry-2079f40e.js → input-color-picker.entry-58c5f4d3.js} +4 -4
- package/dist/{input-color-picker.entry-785e80b1.cjs → input-color-picker.entry-5c3e8407.cjs} +1 -1
- package/dist/{input-component.entry-cee3fa04.js → input-component.entry-a45cff7f.js} +3 -3
- package/dist/{input-component.entry-0edf62cf.cjs → input-component.entry-f6f257b9.cjs} +1 -1
- package/dist/input-dropdown_2.entry-0518caac.js +228 -0
- package/dist/input-dropdown_2.entry-85077fff.cjs +1 -0
- package/dist/italic-icon.entry-7f971c72.cjs +1 -0
- package/dist/italic-icon.entry-a9a0be67.js +15 -0
- package/dist/multi-select-dropdown.entry-0b7e26c0.js +116 -0
- package/dist/multi-select-dropdown.entry-2c5b3f8d.cjs +1 -0
- package/dist/{nylas-booked-event-card_12.entry-56068565.js → nylas-booked-event-card_12.entry-8eed168c.js} +211 -190
- package/dist/nylas-booked-event-card_12.entry-d416f896.cjs +1 -0
- package/dist/{nylas-form-card.entry-77485e1d.cjs → nylas-form-card.entry-2c336c14.cjs} +1 -1
- package/dist/{nylas-form-card.entry-df1c70ff.js → nylas-form-card.entry-8842785d.js} +8 -8
- package/dist/{nylas-if-state.entry-0271bf92.cjs → nylas-if-state.entry-e6c90919.cjs} +1 -1
- package/dist/{nylas-if-state.entry-74c342ef.js → nylas-if-state.entry-fdc20d01.js} +3 -3
- package/dist/{nylas-login.entry-6a308ac9.js → nylas-login.entry-16f39c90.js} +3 -3
- package/dist/{nylas-login.entry-2483aa51.cjs → nylas-login.entry-dcdc4d06.cjs} +1 -1
- package/dist/{nylas-provider.entry-df790de3.cjs → nylas-provider.entry-0cc093e4.cjs} +1 -1
- package/dist/{nylas-provider.entry-5cbbd312.js → nylas-provider.entry-d51de210.js} +5 -5
- package/dist/nylas-scheduler-editor.entry-af211f07.cjs +2 -0
- package/dist/{nylas-scheduler-editor.entry-b6793c45.js → nylas-scheduler-editor.entry-d0214565.js} +48 -30
- package/dist/{nylas-scheduling.entry-fea8dca0.js → nylas-scheduling.entry-3d3a4eb4.js} +7 -7
- package/dist/{nylas-scheduling.entry-2a9aed18.cjs → nylas-scheduling.entry-ce1ef505.cjs} +1 -1
- package/dist/{nylas-time-window-picker_2.entry-fc5aa4be.js → nylas-time-window-picker_2.entry-24672606.js} +30 -30
- package/dist/{nylas-time-window-picker_2.entry-32f657a2.cjs → nylas-time-window-picker_2.entry-52a54abb.cjs} +1 -1
- package/dist/{person-icon.entry-c853f6b5.cjs → person-icon.entry-954d4c10.cjs} +1 -1
- package/dist/{person-icon.entry-fae1d972.js → person-icon.entry-dcdc2118.js} +4 -4
- package/dist/{play-icon.entry-b07a4311.cjs → play-icon.entry-7e17d583.cjs} +1 -1
- package/dist/{play-icon.entry-6ccd7cb6.js → play-icon.entry-e727a1d6.js} +4 -4
- package/dist/react.cjs +1 -1
- package/dist/react.js +1 -1
- package/dist/{refresh-icon.entry-b717e4fe.js → refresh-icon.entry-d5e50180.js} +4 -4
- package/dist/{refresh-icon.entry-a218275f.cjs → refresh-icon.entry-f735be78.cjs} +1 -1
- package/dist/{register-component-5d7bcc15-bb9405d1.cjs → register-component-a169494c-3d95c4fd.cjs} +1 -1
- package/dist/{register-component-5d7bcc15-43981253.js → register-component-a169494c-62768a00.js} +1 -1
- package/dist/{reply-all-icon.entry-f20c4a10.js → reply-all-icon.entry-848cd16f.js} +5 -5
- package/dist/{reply-all-icon.entry-cd2bafd1.cjs → reply-all-icon.entry-c847636d.cjs} +1 -1
- package/dist/reply-icon.entry-028435a1.cjs +1 -0
- package/dist/reply-icon.entry-9e3e5122.js +15 -0
- package/dist/{scheduler-config-store-ed4a8dfd-96520080.cjs → scheduler-config-store-ed4a8dfd-0e3f540f.cjs} +1 -1
- package/dist/{scheduler-config-store-ed4a8dfd-2619e757.js → scheduler-config-store-ed4a8dfd-622802c7.js} +1 -1
- package/dist/{scheduler-store-3acf4d70-53282ac4.cjs → scheduler-store-8e74959b-c8514d9a.cjs} +1 -1
- package/dist/{scheduler-store-3acf4d70-68aacbea.js → scheduler-store-8e74959b-ffa0b3c6.js} +2 -2
- package/dist/sent-icon.entry-eef67c1a.cjs +1 -0
- package/dist/sent-icon.entry-f8fda6ff.js +15 -0
- package/dist/spam-icon.entry-22437325.cjs +1 -0
- package/dist/spam-icon.entry-ec4f3144.js +15 -0
- package/dist/{star-icon.entry-6fc95071.js → star-icon.entry-d7cd7608.js} +5 -5
- package/dist/{star-icon.entry-a6e85c82.cjs → star-icon.entry-f275321a.cjs} +1 -1
- package/dist/{stop-icon.entry-8b041eda.js → stop-icon.entry-55779283.js} +2 -2
- package/dist/{stop-icon.entry-eee61c96.cjs → stop-icon.entry-89c2bae7.cjs} +1 -1
- package/dist/{textarea-component.entry-dc92a53f.js → textarea-component.entry-02360e34.js} +2 -2
- package/dist/{textarea-component.entry-cbe424d4.cjs → textarea-component.entry-5e8cb080.cjs} +1 -1
- package/dist/{translate-icon.entry-7307d3f1.cjs → translate-icon.entry-a7915e82.cjs} +1 -1
- package/dist/{translate-icon.entry-447f1502.js → translate-icon.entry-b0b36e4c.js} +4 -4
- package/dist/trash-fill-icon.entry-1fd28f47.js +15 -0
- package/dist/trash-fill-icon.entry-e933f219.cjs +1 -0
- package/dist/{underline-icon.entry-6acfca57.js → underline-icon.entry-1636f401.js} +2 -2
- package/dist/{underline-icon.entry-c636ca0e.cjs → underline-icon.entry-8bf17177.cjs} +1 -1
- package/dist/{warning-icon.entry-03615141.cjs → warning-icon.entry-27c0cdd6.cjs} +1 -1
- package/dist/{warning-icon.entry-290eb052.js → warning-icon.entry-cef2e7c1.js} +7 -7
- package/package.json +3 -3
- package/dist/add-circle-icon.entry-8b883ae4.js +0 -15
- package/dist/archive-icon.entry-62c7e06e.js +0 -15
- package/dist/archive-icon.entry-e9038aeb.cjs +0 -1
- package/dist/calendar-agenda-fill-icon_53.entry-da0fac2a.cjs +0 -9
- package/dist/close-icon.entry-4b2a2974.js +0 -15
- package/dist/close-icon.entry-e52d8440.cjs +0 -1
- package/dist/copy-icon.entry-f3370220.cjs +0 -1
- package/dist/document-refresh-icon.entry-653dc173.js +0 -15
- package/dist/forward-icon.entry-1d14a631.js +0 -15
- package/dist/forward-icon.entry-fe0f2a3a.cjs +0 -1
- package/dist/google-logo-icon_4.entry-59423b91.cjs +0 -1
- package/dist/inbox-icon.entry-2e8c1cf5.cjs +0 -1
- package/dist/inbox-icon.entry-5a452db1.js +0 -15
- package/dist/index-5611d3d5.cjs +0 -81
- package/dist/index-589f8eee.js +0 -13086
- package/dist/input-dropdown.entry-63cf88c1.cjs +0 -1
- package/dist/input-dropdown.entry-a1bac5bf.js +0 -134
- package/dist/italic-icon.entry-85a90ace.js +0 -15
- package/dist/italic-icon.entry-9ced8045.cjs +0 -1
- package/dist/multi-select-dropdown.entry-dd699cdf.js +0 -112
- package/dist/multi-select-dropdown.entry-f6ac5ae9.cjs +0 -1
- package/dist/nylas-booked-event-card_12.entry-89bcf205.cjs +0 -1
- package/dist/nylas-scheduler-editor.entry-c23fd4d8.cjs +0 -2
- package/dist/reply-icon.entry-30b5222b.cjs +0 -1
- package/dist/reply-icon.entry-abfbde42.js +0 -15
- package/dist/sent-icon.entry-2b183210.cjs +0 -1
- package/dist/sent-icon.entry-77bb678e.js +0 -15
- package/dist/spam-icon.entry-42f9c9e7.js +0 -15
- package/dist/spam-icon.entry-cbeaca0c.cjs +0 -1
- package/dist/time-period-selector.entry-45ca7b1a.js +0 -99
- package/dist/time-period-selector.entry-60718809.cjs +0 -1
- package/dist/trash-fill-icon.entry-1138f73e.cjs +0 -1
- package/dist/trash-fill-icon.entry-7d11144b.js +0 -15
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { r as d, c, d as r, h as s, H as p, g as b } from "./index-cd93b584.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import "react-dom";
|
|
4
|
+
const h = ':host{display:block;width:inherit;--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}.dropdown{display:inline-block;width:100%;position:relative}.dropdown .dropdown-label{display:flex;align-items:center;gap:0.25rem;color:var(--nylas-base-800)}.dropdown .dropdown-label p{margin:0}.dropdown .dropdown-label span.required{color:var(--nylas-error);padding:0 0.25rem}.dropdown span.error{color:var(--nylas-error);font-size:14px}.dropbtn{width:inherit;height:48px;color:black;padding:0.5rem;font-size:16px;cursor:pointer;display:flex;gap:0.5rem;justify-content:space-between;align-items:center;background:transparent;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}.dropbtn.focus{background:transparent}.dropbtn.error{border:1px solid var(--nylas-error)}.dropbtn:hover,.dropbtn:active{border:1px solid var(--nylas-primary)}.dropbtn:active{outline:2px solid var(--nylas-primary)}.dropbtn span.open{transform:rotate(90deg)}.dropbtn span.closed{transform:rotate(270deg)}.dropdown-content{display:block;margin-top:0.5rem;background-color:var(--nylas-base-0);width:100%;max-height:336px;overflow:auto;z-index:1;border-radius:4px;position:absolute;top:72px;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.0509803922);box-shadow:0px 10px 15px -3px rgba(0, 0, 0, 0.1019607843)}.dropdown-content ul{padding:0;list-style-type:none;color:var(--nylas-base-900);max-height:336px}.dropdown-content 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:left;cursor:pointer}.dropdown-content ul li:hover,.dropdown-content ul li:focus{background-color:var(--nylas-base-100)}.dropdown-content ul li label{display:flex;align-items:center;gap:0.5rem}.dropdown-content ul li label input{margin:0}.selected-options{display:flex;flex-wrap:wrap;gap:0.5rem;padding:0.5rem 0;margin-top:0.25rem;background:var(--nylas-base-0)}.selected-options .selected-option{display:flex;align-items:center;gap:0.5rem;padding:4px 8px;border-radius:var(--nylas-border-radius-2x);background:var(--nylas-base-100);color:var(--nylas-base-800);font-size:16px;font-weight:500;line-height:1.5rem;letter-spacing:0.5px}.selected-options .selected-option button{background:transparent;border:none;cursor:pointer;padding:0}.selected-options .selected-option button:hover{color:var(--nylas-primary)}', u = h, f = class {
|
|
5
|
+
constructor(e) {
|
|
6
|
+
d(this, e), this.selectedOptionsChanged = c(this, "selectedOptionsChanged", 7), this.name = void 0, this.label = void 0, this.options = [], this.error = "", this.required = !1, this.availableOptions = this.options, this.isOpen = !1, this.ariaActivedescendant = "", this.shouldFocusFirstOption = !1;
|
|
7
|
+
}
|
|
8
|
+
areOptionsEqual(e, a) {
|
|
9
|
+
if (e.length !== a.length)
|
|
10
|
+
return !1;
|
|
11
|
+
const t = [...e].sort((n, o) => n.label.localeCompare(o.label) || n.value.localeCompare(o.value)), i = [...a].sort((n, o) => n.label.localeCompare(o.label) || n.value.localeCompare(o.value));
|
|
12
|
+
return t.every((n, o) => {
|
|
13
|
+
const l = i[o];
|
|
14
|
+
return n.label === l.label && n.value === l.value;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
optionsChangedHandler(e) {
|
|
18
|
+
this.areOptionsEqual(e, this.availableOptions) || (this.availableOptions = e);
|
|
19
|
+
}
|
|
20
|
+
componentDidLoad() {
|
|
21
|
+
r("multi-select-dropdown", "componentDidLoad"), this.options && (this.availableOptions = this.options);
|
|
22
|
+
}
|
|
23
|
+
componentDidRender() {
|
|
24
|
+
var e;
|
|
25
|
+
r("multi-select-dropdown", "componentDidRender"), this.isOpen && this.shouldFocusFirstOption && (this.ariaActivedescendant = (e = this.availableOptions[0]) == null ? void 0 : e.value, this.focusOption(0), this.shouldFocusFirstOption = !1);
|
|
26
|
+
}
|
|
27
|
+
handleOutsideClick(e) {
|
|
28
|
+
!e.composedPath().includes(this.el) && this.isOpen && (this.isOpen = !1);
|
|
29
|
+
}
|
|
30
|
+
handleBookingFormSubmitted(e) {
|
|
31
|
+
const a = this.availableOptions.filter((t) => t.selected).map((t) => t.value);
|
|
32
|
+
this.required && (!a || a.length <= 0) && (this.error = "Please select at least one option"), this.error && e.preventDefault();
|
|
33
|
+
}
|
|
34
|
+
selectOption(e) {
|
|
35
|
+
this.availableOptions = this.availableOptions.map((t) => (t.value === e.value && (t.selected = !e.selected, t.selected && (this.error = "")), t));
|
|
36
|
+
const a = this.availableOptions.filter((t) => t.selected).map((t) => t.value);
|
|
37
|
+
this.selectedOptionsChanged.emit({
|
|
38
|
+
value: a,
|
|
39
|
+
name: this.name
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
toggleDropdown() {
|
|
43
|
+
this.isOpen = !this.isOpen, this.isOpen ? this.shouldFocusFirstOption = !0 : this.ariaActivedescendant = "";
|
|
44
|
+
}
|
|
45
|
+
handleSelectButtonKeyDown(e) {
|
|
46
|
+
switch (e.key) {
|
|
47
|
+
case "ArrowDown":
|
|
48
|
+
case "Enter":
|
|
49
|
+
e.preventDefault(), this.isOpen || this.toggleDropdown();
|
|
50
|
+
break;
|
|
51
|
+
case "Escape":
|
|
52
|
+
this.isOpen = !1;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
handleListboxKeydown(e) {
|
|
57
|
+
const a = this.availableOptions, t = a.findIndex((i) => i.value === this.ariaActivedescendant);
|
|
58
|
+
switch (e.key) {
|
|
59
|
+
case "ArrowDown":
|
|
60
|
+
case "Tab":
|
|
61
|
+
if (e.shiftKey) {
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
const n = t - 1 >= 0 ? t - 1 : a.length - 1;
|
|
64
|
+
this.ariaActivedescendant = a[n].value, this.focusOption(n);
|
|
65
|
+
} else {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
const n = t + 1 < a.length ? t + 1 : 0;
|
|
68
|
+
this.ariaActivedescendant = a[n].value, this.focusOption(n);
|
|
69
|
+
}
|
|
70
|
+
break;
|
|
71
|
+
case "ArrowUp":
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
const i = t - 1 >= 0 ? t - 1 : a.length - 1;
|
|
74
|
+
this.ariaActivedescendant = a[i].value, this.focusOption(i);
|
|
75
|
+
break;
|
|
76
|
+
case "Enter":
|
|
77
|
+
e.preventDefault(), this.ariaActivedescendant && this.selectOption(a[t]);
|
|
78
|
+
break;
|
|
79
|
+
case "Escape":
|
|
80
|
+
this.isOpen = !1;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
focusOption(e) {
|
|
85
|
+
var n;
|
|
86
|
+
const a = this.availableOptions[e];
|
|
87
|
+
if (!a)
|
|
88
|
+
return;
|
|
89
|
+
const t = a.value, i = (n = this.el.shadowRoot) == null ? void 0 : n.getElementById(t);
|
|
90
|
+
i && (i.focus(), i.scrollIntoView({ behavior: "smooth", block: "nearest" }));
|
|
91
|
+
}
|
|
92
|
+
getSelectedOptions() {
|
|
93
|
+
return this.availableOptions.filter((e) => e.selected);
|
|
94
|
+
}
|
|
95
|
+
renderOption(e) {
|
|
96
|
+
return s("li", { key: e.value, id: e.value, role: "option", tabindex: "0", "aria-selected": e.selected ? "true" : "false", onClick: (a) => {
|
|
97
|
+
a.stopImmediatePropagation(), this.selectOption(e);
|
|
98
|
+
}, class: { selected: !!e.selected } }, s("label", { htmlFor: e.value }, s("input", { "aria-hidden": "true", id: e.value, type: "checkbox", checked: e.selected }), s("span", null, e.label)));
|
|
99
|
+
}
|
|
100
|
+
render() {
|
|
101
|
+
var e, a;
|
|
102
|
+
return s(p, { key: "f4652f92d5814ddc59b0af4f430b8c6bf8c53056" }, s("div", { key: "ef1db0ae49a7c75cb9cfc909ac83b65d172d242b", class: "dropdown", part: "msd_dropdown" }, s("label", { key: "14c4bfa2dfebf9bb1c84f31926c0cb5113867218", class: "dropdown-label", part: "msd_dropdown-label" }, s("p", { key: "588aad0241a5afd894f11ab4826ec1c2e159e51e" }, s("span", { key: "b99c592d1895a51075ea46e2f5ac94bed4d7d8d7", class: "label" }, this.label), this.required && s("span", { class: "required" }, "*")), s("slot", { key: "2161c9a28066e0cf26289cb2fb20493ef7be51da", name: "label-icon", "aria-hidden": "true" })), s("button", { key: "3a39cfacf9faaae6177df65e49e61ec5167be1b1", name: this.name, part: `msd_dropdown-button ${this.error ? "msd_dropdown-button--error" : ""}`, class: { dropbtn: !0, open: this.isOpen, error: !!this.error }, onClick: () => this.toggleDropdown(), "aria-haspopup": "listbox", "aria-expanded": this.isOpen ? "true" : "false", "aria-label": this.name, onKeyDown: (t) => this.handleSelectButtonKeyDown(t) }, s("slot", { key: "5d09d93a9565e2f12c8d3f8f2a391832b576e5ee", name: "select-icon", "aria-hidden": "true" }), s("span", { key: "7f15d2a1644a44448cef246c4480354d4fa2c3d0", class: "selected-option", part: "msd_dropdown-button-selected-label" }, this.getSelectedOptions().length > 1 ? "Multiple options selected" : ((e = this.availableOptions.filter((t) => t.selected)[0]) == null ? void 0 : e.label) ?? ((a = this.availableOptions[0]) == null ? void 0 : a.label)), s("span", { key: "af988d0cb66e710b0a23e72392d4cc84d36a6e17", class: this.isOpen ? "open" : "closed", "aria-hidden": "true" }, s("chevron-icon", { key: "64efffb0e7ab44bc44b210eea413d946cbad4dc5", width: "16", height: "16" }))), this.error ? s("span", { class: "error", part: "msd_dropdown_error" }, this.error) : null, this.isOpen ? null : s("div", { class: "selected-options" }, this.getSelectedOptions().map((t) => s("span", { class: "selected-option" }, t.label, s("button", { key: t.label, onClick: () => this.selectOption(t) }, s("close-icon", null))))), this.isOpen ? s("div", { class: "dropdown-content", part: "msd_dropdown-content" }, s("ul", { tabindex: "-1", role: "listbox", "aria-label": this.name, "aria-multiselectable": !0, "aria-activedescendant": this.ariaActivedescendant, onKeyDown: (t) => this.handleListboxKeydown(t) }, this.availableOptions.map((t) => this.renderOption(t)))) : null));
|
|
103
|
+
}
|
|
104
|
+
get el() {
|
|
105
|
+
return b(this);
|
|
106
|
+
}
|
|
107
|
+
static get watchers() {
|
|
108
|
+
return {
|
|
109
|
+
options: ["optionsChangedHandler"]
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
f.style = u;
|
|
114
|
+
export {
|
|
115
|
+
f as multi_select_dropdown
|
|
116
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-94416062.cjs");require("react");require("react-dom");const d=':host{display:block;width:inherit;--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}.dropdown{display:inline-block;width:100%;position:relative}.dropdown .dropdown-label{display:flex;align-items:center;gap:0.25rem;color:var(--nylas-base-800)}.dropdown .dropdown-label p{margin:0}.dropdown .dropdown-label span.required{color:var(--nylas-error);padding:0 0.25rem}.dropdown span.error{color:var(--nylas-error);font-size:14px}.dropbtn{width:inherit;height:48px;color:black;padding:0.5rem;font-size:16px;cursor:pointer;display:flex;gap:0.5rem;justify-content:space-between;align-items:center;background:transparent;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}.dropbtn.focus{background:transparent}.dropbtn.error{border:1px solid var(--nylas-error)}.dropbtn:hover,.dropbtn:active{border:1px solid var(--nylas-primary)}.dropbtn:active{outline:2px solid var(--nylas-primary)}.dropbtn span.open{transform:rotate(90deg)}.dropbtn span.closed{transform:rotate(270deg)}.dropdown-content{display:block;margin-top:0.5rem;background-color:var(--nylas-base-0);width:100%;max-height:336px;overflow:auto;z-index:1;border-radius:4px;position:absolute;top:72px;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.0509803922);box-shadow:0px 10px 15px -3px rgba(0, 0, 0, 0.1019607843)}.dropdown-content ul{padding:0;list-style-type:none;color:var(--nylas-base-900);max-height:336px}.dropdown-content 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:left;cursor:pointer}.dropdown-content ul li:hover,.dropdown-content ul li:focus{background-color:var(--nylas-base-100)}.dropdown-content ul li label{display:flex;align-items:center;gap:0.5rem}.dropdown-content ul li label input{margin:0}.selected-options{display:flex;flex-wrap:wrap;gap:0.5rem;padding:0.5rem 0;margin-top:0.25rem;background:var(--nylas-base-0)}.selected-options .selected-option{display:flex;align-items:center;gap:0.5rem;padding:4px 8px;border-radius:var(--nylas-border-radius-2x);background:var(--nylas-base-100);color:var(--nylas-base-800);font-size:16px;font-weight:500;line-height:1.5rem;letter-spacing:0.5px}.selected-options .selected-option button{background:transparent;border:none;cursor:pointer;padding:0}.selected-options .selected-option button:hover{color:var(--nylas-primary)}',c=d,r=class{constructor(e){a.registerInstance(this,e),this.selectedOptionsChanged=a.createEvent(this,"selectedOptionsChanged",7),this.name=void 0,this.label=void 0,this.options=[],this.error="",this.required=!1,this.availableOptions=this.options,this.isOpen=!1,this.ariaActivedescendant="",this.shouldFocusFirstOption=!1}areOptionsEqual(e,s){if(e.length!==s.length)return!1;const t=[...e].sort((n,o)=>n.label.localeCompare(o.label)||n.value.localeCompare(o.value)),i=[...s].sort((n,o)=>n.label.localeCompare(o.label)||n.value.localeCompare(o.value));return t.every((n,o)=>{const l=i[o];return n.label===l.label&&n.value===l.value})}optionsChangedHandler(e){this.areOptionsEqual(e,this.availableOptions)||(this.availableOptions=e)}componentDidLoad(){a.debug("multi-select-dropdown","componentDidLoad"),this.options&&(this.availableOptions=this.options)}componentDidRender(){var e;a.debug("multi-select-dropdown","componentDidRender"),this.isOpen&&this.shouldFocusFirstOption&&(this.ariaActivedescendant=(e=this.availableOptions[0])==null?void 0:e.value,this.focusOption(0),this.shouldFocusFirstOption=!1)}handleOutsideClick(e){!e.composedPath().includes(this.el)&&this.isOpen&&(this.isOpen=!1)}handleBookingFormSubmitted(e){const s=this.availableOptions.filter(t=>t.selected).map(t=>t.value);this.required&&(!s||s.length<=0)&&(this.error="Please select at least one option"),this.error&&e.preventDefault()}selectOption(e){this.availableOptions=this.availableOptions.map(t=>(t.value===e.value&&(t.selected=!e.selected,t.selected&&(this.error="")),t));const s=this.availableOptions.filter(t=>t.selected).map(t=>t.value);this.selectedOptionsChanged.emit({value:s,name:this.name})}toggleDropdown(){this.isOpen=!this.isOpen,this.isOpen?this.shouldFocusFirstOption=!0:this.ariaActivedescendant=""}handleSelectButtonKeyDown(e){switch(e.key){case"ArrowDown":case"Enter":e.preventDefault(),this.isOpen||this.toggleDropdown();break;case"Escape":this.isOpen=!1;break}}handleListboxKeydown(e){const s=this.availableOptions,t=s.findIndex(i=>i.value===this.ariaActivedescendant);switch(e.key){case"ArrowDown":case"Tab":if(e.shiftKey){e.preventDefault();const n=t-1>=0?t-1:s.length-1;this.ariaActivedescendant=s[n].value,this.focusOption(n)}else{e.preventDefault();const n=t+1<s.length?t+1:0;this.ariaActivedescendant=s[n].value,this.focusOption(n)}break;case"ArrowUp":e.preventDefault();const i=t-1>=0?t-1:s.length-1;this.ariaActivedescendant=s[i].value,this.focusOption(i);break;case"Enter":e.preventDefault(),this.ariaActivedescendant&&this.selectOption(s[t]);break;case"Escape":this.isOpen=!1;break}}focusOption(e){var n;const s=this.availableOptions[e];if(!s)return;const t=s.value,i=(n=this.el.shadowRoot)==null?void 0:n.getElementById(t);i&&(i.focus(),i.scrollIntoView({behavior:"smooth",block:"nearest"}))}getSelectedOptions(){return this.availableOptions.filter(e=>e.selected)}renderOption(e){return a.h("li",{key:e.value,id:e.value,role:"option",tabindex:"0","aria-selected":e.selected?"true":"false",onClick:s=>{s.stopImmediatePropagation(),this.selectOption(e)},class:{selected:!!e.selected}},a.h("label",{htmlFor:e.value},a.h("input",{"aria-hidden":"true",id:e.value,type:"checkbox",checked:e.selected}),a.h("span",null,e.label)))}render(){var e,s;return a.h(a.Host,{key:"f4652f92d5814ddc59b0af4f430b8c6bf8c53056"},a.h("div",{key:"ef1db0ae49a7c75cb9cfc909ac83b65d172d242b",class:"dropdown",part:"msd_dropdown"},a.h("label",{key:"14c4bfa2dfebf9bb1c84f31926c0cb5113867218",class:"dropdown-label",part:"msd_dropdown-label"},a.h("p",{key:"588aad0241a5afd894f11ab4826ec1c2e159e51e"},a.h("span",{key:"b99c592d1895a51075ea46e2f5ac94bed4d7d8d7",class:"label"},this.label),this.required&&a.h("span",{class:"required"},"*")),a.h("slot",{key:"2161c9a28066e0cf26289cb2fb20493ef7be51da",name:"label-icon","aria-hidden":"true"})),a.h("button",{key:"3a39cfacf9faaae6177df65e49e61ec5167be1b1",name:this.name,part:`msd_dropdown-button ${this.error?"msd_dropdown-button--error":""}`,class:{dropbtn:!0,open:this.isOpen,error:!!this.error},onClick:()=>this.toggleDropdown(),"aria-haspopup":"listbox","aria-expanded":this.isOpen?"true":"false","aria-label":this.name,onKeyDown:t=>this.handleSelectButtonKeyDown(t)},a.h("slot",{key:"5d09d93a9565e2f12c8d3f8f2a391832b576e5ee",name:"select-icon","aria-hidden":"true"}),a.h("span",{key:"7f15d2a1644a44448cef246c4480354d4fa2c3d0",class:"selected-option",part:"msd_dropdown-button-selected-label"},this.getSelectedOptions().length>1?"Multiple options selected":((e=this.availableOptions.filter(t=>t.selected)[0])==null?void 0:e.label)??((s=this.availableOptions[0])==null?void 0:s.label)),a.h("span",{key:"af988d0cb66e710b0a23e72392d4cc84d36a6e17",class:this.isOpen?"open":"closed","aria-hidden":"true"},a.h("chevron-icon",{key:"64efffb0e7ab44bc44b210eea413d946cbad4dc5",width:"16",height:"16"}))),this.error?a.h("span",{class:"error",part:"msd_dropdown_error"},this.error):null,this.isOpen?null:a.h("div",{class:"selected-options"},this.getSelectedOptions().map(t=>a.h("span",{class:"selected-option"},t.label,a.h("button",{key:t.label,onClick:()=>this.selectOption(t)},a.h("close-icon",null))))),this.isOpen?a.h("div",{class:"dropdown-content",part:"msd_dropdown-content"},a.h("ul",{tabindex:"-1",role:"listbox","aria-label":this.name,"aria-multiselectable":!0,"aria-activedescendant":this.ariaActivedescendant,onKeyDown:t=>this.handleListboxKeydown(t)},this.availableOptions.map(t=>this.renderOption(t)))):null))}get el(){return a.getElement(this)}static get watchers(){return{options:["optionsChangedHandler"]}}};r.style=c;exports.multi_select_dropdown=r;
|