@nylas/react 1.3.3 → 1.3.5
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-00c87903.js +15 -0
- package/dist/{add-circle-icon.entry-89060fe6.cjs → add-circle-icon.entry-640d2b46.cjs} +1 -1
- package/dist/archive-icon.entry-5b209336.cjs +1 -0
- package/dist/archive-icon.entry-e8a39eda.js +15 -0
- package/dist/{arrow-icon.entry-e8dbe365.cjs → arrow-icon.entry-a25b7b7e.cjs} +1 -1
- package/dist/{arrow-icon.entry-7c38f4ad.js → arrow-icon.entry-fa9584cf.js} +2 -2
- package/dist/{bold-icon.entry-4ce7cfee.js → bold-icon.entry-ac6a4956.js} +4 -4
- package/dist/{bold-icon.entry-665901ce.cjs → bold-icon.entry-d837c73d.cjs} +1 -1
- package/dist/{button-component_2.entry-ca263036.cjs → button-component_2.entry-1471422a.cjs} +1 -1
- package/dist/{button-component_2.entry-89ea010b.js → button-component_2.entry-caf33abf.js} +9 -9
- package/dist/calendar-agenda-fill-icon_53.entry-094bd4b9.cjs +6 -0
- package/dist/{calendar-agenda-fill-icon_53.entry-347662f3.js → calendar-agenda-fill-icon_53.entry-6d7f9c79.js} +1820 -1401
- package/dist/{calendar-cancel-icon.entry-c1d33f90.js → calendar-cancel-icon.entry-02015d74.js} +4 -4
- package/dist/{calendar-cancel-icon.entry-6b7836c9.cjs → calendar-cancel-icon.entry-42d3d226.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-222e3c0b.js → calendar-check-icon_2.entry-2f7dc236.js} +7 -7
- package/dist/{calendar-check-icon_2.entry-67024cd6.cjs → calendar-check-icon_2.entry-45aacd91.cjs} +1 -1
- package/dist/{calendar-icon.entry-c08a8f21.js → calendar-icon.entry-70ac9bd6.js} +5 -5
- package/dist/{calendar-icon.entry-380048b0.cjs → calendar-icon.entry-90d67b03.cjs} +1 -1
- package/dist/{checkbox-component_3.entry-52b27cb9.cjs → checkbox-component_3.entry-231b2254.cjs} +1 -1
- package/dist/{checkbox-component_3.entry-dab3c3c8.js → checkbox-component_3.entry-7270533c.js} +5 -5
- package/dist/{chevron-icon_3.entry-7be40d99.js → chevron-icon_3.entry-3c95cc88.js} +13 -13
- package/dist/{chevron-icon_3.entry-17bb7d23.cjs → chevron-icon_3.entry-ead3d4c8.cjs} +1 -1
- package/dist/{clock-icon_4.entry-89e0dd55.js → clock-icon_4.entry-af5301d7.js} +18 -18
- package/dist/{clock-icon_4.entry-875db481.cjs → clock-icon_4.entry-b50cce70.cjs} +1 -1
- package/dist/close-icon.entry-04008446.cjs +1 -0
- package/dist/close-icon.entry-0a4105c9.js +15 -0
- package/dist/constants-f6e79ab7-23d7236b.cjs +1 -0
- package/dist/{constants-54af2051-767e8462.js → constants-f6e79ab7-24392f9e.js} +28 -14
- package/dist/{copy-icon.entry-eecc7301.js → copy-icon.entry-312ff230.js} +6 -6
- package/dist/copy-icon.entry-74f8ebcd.cjs +1 -0
- package/dist/{delete-icon.entry-4b341b41.js → delete-icon.entry-00cb3ee8.js} +2 -2
- package/dist/{delete-icon.entry-1e6c99ee.cjs → delete-icon.entry-b61a6706.cjs} +1 -1
- package/dist/document-refresh-icon.entry-1c985b1e.js +15 -0
- package/dist/{document-refresh-icon.entry-612c5d4f.cjs → document-refresh-icon.entry-27ff5cb2.cjs} +1 -1
- package/dist/{feedbackSync-e5cb0245-013ce5ec.cjs → feedbackSync-547e51ee-9b572309.cjs} +1 -1
- package/dist/{feedbackSync-e5cb0245-f8e4575c.js → feedbackSync-547e51ee-bcaf691c.js} +1 -1
- package/dist/{folder-icon.entry-8d91bc75.js → folder-icon.entry-60b3eda5.js} +2 -2
- package/dist/{folder-icon.entry-5bc752d4.cjs → folder-icon.entry-c32a6e15.cjs} +1 -1
- package/dist/forward-icon.entry-5f9a7639.js +15 -0
- package/dist/forward-icon.entry-8cd805dc.cjs +1 -0
- package/dist/{globe-icon.entry-13f5dd98.cjs → globe-icon.entry-21a80591.cjs} +1 -1
- package/dist/{globe-icon.entry-c2ddabb6.js → globe-icon.entry-397727e1.js} +4 -4
- package/dist/google-logo-icon_4.entry-42e87368.cjs +1 -0
- package/dist/{google-logo-icon_4.entry-b58af39b.js → google-logo-icon_4.entry-6ccf8379.js} +168 -148
- package/dist/inbox-icon.entry-1e448b4b.js +15 -0
- package/dist/inbox-icon.entry-50605b1d.cjs +1 -0
- package/dist/index-594c8e7b.js +16763 -0
- package/dist/index-cfb93df6.cjs +81 -0
- package/dist/{index.es-e9d66a9b-fa36c085.cjs → index.es-2d849a15-2d84f7a5.cjs} +1 -1
- package/dist/{index.es-e9d66a9b-a07a895d.js → index.es-2d849a15-4eb8e180.js} +1 -1
- package/dist/{info-icon_2.entry-14cad09c.js → info-icon_2.entry-65e0023f.js} +5 -5
- package/dist/{info-icon_2.entry-fce3a1ce.cjs → info-icon_2.entry-e7b86847.cjs} +1 -1
- package/dist/{input-color-picker.entry-2079f40e.js → input-color-picker.entry-37d2fb66.js} +4 -4
- package/dist/{input-color-picker.entry-785e80b1.cjs → input-color-picker.entry-aabfe638.cjs} +1 -1
- package/dist/{input-component.entry-0edf62cf.cjs → input-component.entry-51f6da14.cjs} +1 -1
- package/dist/{input-component.entry-cee3fa04.js → input-component.entry-c07d92b1.js} +3 -3
- package/dist/input-dropdown_2.entry-20fb0552.cjs +1 -0
- package/dist/input-dropdown_2.entry-90c08f10.js +228 -0
- package/dist/italic-icon.entry-8e5599ff.js +15 -0
- package/dist/italic-icon.entry-ee10a040.cjs +1 -0
- package/dist/multi-select-dropdown.entry-656d2791.cjs +1 -0
- package/dist/multi-select-dropdown.entry-c143becc.js +116 -0
- package/dist/{nylas-booked-event-card_12.entry-56068565.js → nylas-booked-event-card_12.entry-4974ffe6.js} +211 -190
- package/dist/nylas-booked-event-card_12.entry-669bb872.cjs +1 -0
- package/dist/{nylas-form-card.entry-df1c70ff.js → nylas-form-card.entry-42e718e2.js} +8 -8
- package/dist/{nylas-form-card.entry-77485e1d.cjs → nylas-form-card.entry-55d3909c.cjs} +1 -1
- package/dist/{nylas-if-state.entry-0271bf92.cjs → nylas-if-state.entry-4de782b7.cjs} +1 -1
- package/dist/{nylas-if-state.entry-74c342ef.js → nylas-if-state.entry-beef8af6.js} +3 -3
- package/dist/{nylas-login.entry-6a308ac9.js → nylas-login.entry-1661cbd4.js} +3 -3
- package/dist/{nylas-login.entry-2483aa51.cjs → nylas-login.entry-d6b80abe.cjs} +1 -1
- package/dist/{nylas-provider.entry-5cbbd312.js → nylas-provider.entry-1f140378.js} +5 -5
- package/dist/{nylas-provider.entry-df790de3.cjs → nylas-provider.entry-d5495e1a.cjs} +1 -1
- package/dist/nylas-scheduler-editor.entry-bebe4e7d.cjs +2 -0
- package/dist/{nylas-scheduler-editor.entry-b6793c45.js → nylas-scheduler-editor.entry-f184f72e.js} +54 -30
- package/dist/{nylas-scheduling.entry-2a9aed18.cjs → nylas-scheduling.entry-21c04831.cjs} +1 -1
- package/dist/{nylas-scheduling.entry-fea8dca0.js → nylas-scheduling.entry-c335ad21.js} +7 -7
- package/dist/{nylas-time-window-picker_2.entry-fc5aa4be.js → nylas-time-window-picker_2.entry-9e0dd470.js} +30 -30
- package/dist/{nylas-time-window-picker_2.entry-32f657a2.cjs → nylas-time-window-picker_2.entry-a2651ee7.cjs} +1 -1
- package/dist/{person-icon.entry-c853f6b5.cjs → person-icon.entry-21946944.cjs} +1 -1
- package/dist/{person-icon.entry-fae1d972.js → person-icon.entry-f9ca9147.js} +4 -4
- package/dist/{play-icon.entry-b07a4311.cjs → play-icon.entry-b27fcb18.cjs} +1 -1
- package/dist/{play-icon.entry-6ccd7cb6.js → play-icon.entry-dbfed5e8.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-7886041f.js} +4 -4
- package/dist/{refresh-icon.entry-a218275f.cjs → refresh-icon.entry-9d94a60b.cjs} +1 -1
- package/dist/{register-component-5d7bcc15-43981253.js → register-component-677d8d2b-0113766e.js} +1 -1
- package/dist/{register-component-5d7bcc15-bb9405d1.cjs → register-component-677d8d2b-4738af1d.cjs} +1 -1
- package/dist/{reply-all-icon.entry-cd2bafd1.cjs → reply-all-icon.entry-f0e0a5c4.cjs} +1 -1
- package/dist/{reply-all-icon.entry-f20c4a10.js → reply-all-icon.entry-fdd0058e.js} +5 -5
- package/dist/reply-icon.entry-0a42fb2c.cjs +1 -0
- package/dist/reply-icon.entry-a8d2b0f8.js +15 -0
- package/dist/{scheduler-config-store-ed4a8dfd-2619e757.js → scheduler-config-store-ed4a8dfd-012dcf85.js} +1 -1
- package/dist/{scheduler-config-store-ed4a8dfd-96520080.cjs → scheduler-config-store-ed4a8dfd-a16d5c62.cjs} +1 -1
- package/dist/{scheduler-store-3acf4d70-68aacbea.js → scheduler-store-92eb8804-bc68a43a.js} +2 -2
- package/dist/{scheduler-store-3acf4d70-53282ac4.cjs → scheduler-store-92eb8804-c3deee73.cjs} +1 -1
- package/dist/sent-icon.entry-c3f84a59.cjs +1 -0
- package/dist/sent-icon.entry-e047f087.js +15 -0
- package/dist/spam-icon.entry-55d01416.js +15 -0
- package/dist/spam-icon.entry-671eb165.cjs +1 -0
- package/dist/{star-icon.entry-a6e85c82.cjs → star-icon.entry-4dcae472.cjs} +1 -1
- package/dist/{star-icon.entry-6fc95071.js → star-icon.entry-501083c1.js} +5 -5
- package/dist/{stop-icon.entry-8b041eda.js → stop-icon.entry-130a28b2.js} +2 -2
- package/dist/{stop-icon.entry-eee61c96.cjs → stop-icon.entry-ed949255.cjs} +1 -1
- package/dist/{textarea-component.entry-cbe424d4.cjs → textarea-component.entry-65dd740a.cjs} +1 -1
- package/dist/{textarea-component.entry-dc92a53f.js → textarea-component.entry-efae9031.js} +2 -2
- package/dist/{translate-icon.entry-7307d3f1.cjs → translate-icon.entry-2591baf8.cjs} +1 -1
- package/dist/{translate-icon.entry-447f1502.js → translate-icon.entry-676a4150.js} +4 -4
- package/dist/trash-fill-icon.entry-5b373be7.js +15 -0
- package/dist/trash-fill-icon.entry-c411d0e0.cjs +1 -0
- package/dist/{underline-icon.entry-6acfca57.js → underline-icon.entry-3513c5ef.js} +2 -2
- package/dist/{underline-icon.entry-c636ca0e.cjs → underline-icon.entry-6bf14476.cjs} +1 -1
- package/dist/{warning-icon.entry-290eb052.js → warning-icon.entry-6e723597.js} +7 -7
- package/dist/{warning-icon.entry-03615141.cjs → warning-icon.entry-719a094d.cjs} +1 -1
- 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/constants-54af2051-a3596673.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-594c8e7b.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
|
+
};
|