@mapsindoors/map-template 1.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +123 -0
  2. package/dist/_commonjsHelpers-ba3f0406-b96e6d6a.mjs +21 -0
  3. package/dist/combo-box-item.entry-92232c29.mjs +12 -0
  4. package/dist/combo-box-item.entry-f244c01a.mjs +14 -0
  5. package/dist/icon-b8d01d6f-ddfa2c17.mjs +24 -0
  6. package/dist/mapsindoors-react.es.js +7 -0
  7. package/dist/mapsindoors-react.umd.js +1391 -0
  8. package/dist/mapsindoors-webcomponent.es.js +5 -0
  9. package/dist/mapsindoors-webcomponent.umd.js +1385 -0
  10. package/dist/mi-card_2.entry-508f65b2.mjs +23 -0
  11. package/dist/mi-card_2.entry-d24478d0.mjs +25 -0
  12. package/dist/mi-chip.entry-74b3118c.mjs +15 -0
  13. package/dist/mi-chip.entry-8bfee95c.mjs +13 -0
  14. package/dist/mi-column.entry-f66623b9.mjs +20 -0
  15. package/dist/mi-column.entry-f901d5d1.mjs +18 -0
  16. package/dist/mi-combo-box.entry-0e6d9797.mjs +262 -0
  17. package/dist/mi-combo-box.entry-69a04955.mjs +260 -0
  18. package/dist/mi-data-table.entry-6cae08b0.mjs +215 -0
  19. package/dist/mi-data-table.entry-7fe09cbe.mjs +213 -0
  20. package/dist/mi-distance_2.entry-dca308c3.mjs +54 -0
  21. package/dist/mi-distance_2.entry-dffb2e64.mjs +56 -0
  22. package/dist/mi-dropdown-item.entry-508c6605.mjs +12 -0
  23. package/dist/mi-dropdown-item.entry-b6aa9d36.mjs +14 -0
  24. package/dist/mi-dropdown.entry-43258637.mjs +296 -0
  25. package/dist/mi-dropdown.entry-e1325610.mjs +298 -0
  26. package/dist/mi-keyboard.entry-60e47fb9.mjs +2962 -0
  27. package/dist/mi-keyboard.entry-c97c80e8.mjs +2960 -0
  28. package/dist/mi-list-item-category.entry-b0f61751.mjs +38 -0
  29. package/dist/mi-list-item-category.entry-bcac342a.mjs +36 -0
  30. package/dist/mi-list-item-location.entry-15ec9c7e.mjs +125 -0
  31. package/dist/mi-list-item-location.entry-ee56967a.mjs +127 -0
  32. package/dist/mi-list.entry-656130ea.mjs +41 -0
  33. package/dist/mi-list.entry-c8f1f377.mjs +39 -0
  34. package/dist/mi-location-booking.entry-a5b9b331.mjs +4863 -0
  35. package/dist/mi-location-booking.entry-ea841d6e.mjs +4865 -0
  36. package/dist/mi-location-info.entry-89b37774.mjs +22 -0
  37. package/dist/mi-location-info.entry-fe2c6c32.mjs +24 -0
  38. package/dist/mi-map-googlemaps.entry-6cb264de.mjs +398 -0
  39. package/dist/mi-map-googlemaps.entry-8877f16d.mjs +396 -0
  40. package/dist/mi-map-mapbox.entry-7a41963d.mjs +298 -0
  41. package/dist/mi-map-mapbox.entry-928da21a.mjs +300 -0
  42. package/dist/mi-metric-card.entry-51daca25.mjs +28 -0
  43. package/dist/mi-metric-card.entry-95dbb9f1.mjs +26 -0
  44. package/dist/mi-notification.entry-29b28ba8.mjs +81 -0
  45. package/dist/mi-notification.entry-f7677761.mjs +83 -0
  46. package/dist/mi-route-instructions-heading.entry-79c22cdd.mjs +72 -0
  47. package/dist/mi-route-instructions-heading.entry-a4c7f18f.mjs +74 -0
  48. package/dist/mi-route-instructions-maneuver_2.entry-383704ad.mjs +115 -0
  49. package/dist/mi-route-instructions-maneuver_2.entry-80c51e6a.mjs +113 -0
  50. package/dist/mi-route-instructions-step-legacy.entry-785cb60b.mjs +199 -0
  51. package/dist/mi-route-instructions-step-legacy.entry-eff068ed.mjs +201 -0
  52. package/dist/mi-route-instructions-step.entry-272e3c84.mjs +199 -0
  53. package/dist/mi-route-instructions-step.entry-95f5dc43.mjs +201 -0
  54. package/dist/mi-route-instructions.entry-0628d220.mjs +139 -0
  55. package/dist/mi-route-instructions.entry-1b4fb352.mjs +141 -0
  56. package/dist/mi-scroll-buttons.entry-274b003f.mjs +48 -0
  57. package/dist/mi-scroll-buttons.entry-6132935b.mjs +46 -0
  58. package/dist/mi-search.entry-994c0189.mjs +206 -0
  59. package/dist/mi-search.entry-d0e582d1.mjs +208 -0
  60. package/dist/mi-share-sms.entry-ae15cf77.mjs +53 -0
  61. package/dist/mi-share-sms.entry-ced7f275.mjs +55 -0
  62. package/dist/mi-step-switcher.entry-812a5096.mjs +24 -0
  63. package/dist/mi-step-switcher.entry-c9e28e79.mjs +26 -0
  64. package/dist/mi-tab-panel.entry-63c34f28.mjs +19 -0
  65. package/dist/mi-tab-panel.entry-bde9bd39.mjs +21 -0
  66. package/dist/mi-tab.entry-1767468e.mjs +13 -0
  67. package/dist/mi-tab.entry-b5ac50ac.mjs +11 -0
  68. package/dist/mi-tabs.entry-1b8327bf.mjs +34 -0
  69. package/dist/mi-tabs.entry-bd190e21.mjs +36 -0
  70. package/dist/mi-variables-9a6c8d4d-e06eec88.mjs +7 -0
  71. package/dist/reactcomponent-2f9f051f.mjs +27190 -0
  72. package/dist/route-travel-mode.enum-7f4ce9c7-a9c95a83.mjs +7 -0
  73. package/dist/sort-order.enum-64ce8998-b75ac596.mjs +317 -0
  74. package/dist/unit-system.enum-eaefb53e-0f424da4.mjs +7 -0
  75. package/dist/utils-ae714467-b07fc3be.mjs +36 -0
  76. package/dist/webcomponent-a10be1e6.mjs +31969 -0
  77. package/package.json +53 -0
@@ -0,0 +1,296 @@
1
+ import { r as c, c as m, h as s, H as p, g as u } from "./webcomponent-a10be1e6.mjs";
2
+ import { S as d, f } from "./sort-order.enum-64ce8998-b75ac596.mjs";
3
+ import "./_commonjsHelpers-ba3f0406-b96e6d6a.mjs";
4
+ const g = `.mi-input[type=text],.mi-input[type=search],.mi-input[type=number],.mi-input[type=password],.mi-input[type=tel]{font-size:1rem;padding:8px;border-style:solid;border-width:1px;border-color:#8d98aa;border-radius:4px}.mi-input[type=text],.mi-input[type=search],.mi-input[type=number],.mi-input[type=password],.mi-input[type=range],.mi-input[type=tel]{display:block}.mi-input[type=radio],.mi-input[type=checkbox]{margin:0px;transform:scale(1.2, 1.2)}.mi-input[type=search]{padding-left:32px;background:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 24 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.6267 8.43836C14.6267 11.8561 11.8561 14.6267 8.43836 14.6267C5.02062 14.6267 2.25 11.8561 2.25 8.43836C2.25 5.02062 5.02062 2.25 8.43836 2.25C11.8561 2.25 14.6267 5.02062 14.6267 8.43836Z' stroke='%23aeb9cb' stroke-width='2.5'/%3E%3Crect x='15.0979' y='14.1614' width='7.34678' height='1.32449' rx='0.662244' transform='rotate(45 15.0979 14.1614)' fill='%23aeb9cb' stroke='%23aeb9cb'/%3E%3Crect x='13.7847' y='13.2916' width='1.05276' height='0.697347' transform='rotate(45 13.7847 13.2916)' stroke='%23aeb9cb' stroke-width='0.697346'/%3E%3C/svg%3E%0A") no-repeat scroll 8px center, white}.mi-input:disabled{opacity:0.48;cursor:not-allowed}.mi-label{font-style:normal;display:block;font-size:1rem;font-weight:500;color:#1e2025}.mi-label>*{margin-top:4px}.mi-label>input[type=radio],.mi-label>input[type=checkbox],.mi-label>label.mi-toggle-btn{margin-right:8px}mi-dropdown-item{display:none}:host{display:inline-block;position:relative;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;font-family:Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"}:host(.open) .button::after{border-top-color:transparent;border-bottom-color:#1f2937;margin-top:-8px}:host(.open) section{display:flex}:host(.open) svg{transform:rotate(180deg)}.button{display:flex;justify-content:flex-start;align-items:center;height:100%;width:100%;font-family:inherit;background:linear-gradient(#f9fafb, #f3f4f6);padding:0;padding-left:16px;padding-right:16px;border-radius:4px;border-width:1px;border-style:solid;border-color:#d1d5db;color:#1c1917;font-size:1rem;font-weight:500;line-height:1rem}.button__left-icon{height:20px;width:20px;margin-right:8px}.button svg{margin-left:auto}.button__label{padding-top:12px;padding-bottom:12px;margin-right:8px;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.button__label--from-inner-html{display:flex;flex-direction:row;align-items:center;gap:8px}.button:disabled{opacity:0.72;cursor:not-allowed}.content{padding-top:12px;padding-bottom:12px;margin-top:12px;margin-bottom:12px;border-radius:8px;color:#1c1917;font-size:1rem;font-weight:500;background-color:#fcfcfc;box-shadow:0px 2px 2px rgba(0, 0, 0, 0.2), 0px 4px 4px rgba(0, 0, 0, 0.18), 0px 8px 8px rgba(0, 0, 0, 0.16);min-width:320px;max-width:480px;max-height:580px;display:none;flex-direction:column;position:fixed;z-index:10000}.content .filter{margin-bottom:16px;padding-left:8px;padding-right:8px;display:flex;position:relative}.content .filter__input{width:100%}.content .filter__clear{width:20px;height:20px;padding:0;border-width:0;display:flex;align-items:center;justify-content:center;position:absolute;right:14px;top:50%;transform:translateY(-50%);background-color:#1f2937;border-radius:50%}.content .filter__clear:focus{outline:0}.content .filter__clear--hidden{opacity:0;pointer-events:none}.content .filter__clear svg{fill:#fcfcfc;width:10px;height:10px}.content .options{margin-bottom:16px;padding-left:16px;padding-right:16px}.content .options__item{padding:0;color:#3b82f6;font-size:0.75rem;font-weight:500;font-family:inherit;background-color:transparent;border:transparent}.content .options__item:hover{text-decoration:underline}.content .options__item:first-child{margin-right:16px}.content .options__item:disabled{color:rgba(48, 113, 217, 0.72);cursor:not-allowed;text-decoration:none}.content .list{padding:0;margin:0;list-style:none;overflow-y:auto}.content .list__item{cursor:pointer}.content .list__item--highlighted{background-color:#f3f4f6}.empty-page{display:flex;align-items:left;flex-direction:column;margin-left:16px;margin-bottom:12px}.empty-page>*{margin:0}.empty-page__header{font-size:1rem;font-weight:400;color:#374151}.label{display:flex;flex-direction:row;align-items:center;padding-left:16px;padding-right:16px;padding-top:8px;padding-bottom:8px}.label__item{display:inline-block;margin-top:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.label__item--from-inner-html{display:flex;flex-direction:row;align-items:center;gap:8px}.label__checkbox{margin-right:12px}.label__checkbox--hidden{display:none}`;
5
+ var r;
6
+ (function(t) {
7
+ t.ArrowDown = "ArrowDown", t.ArrowUp = "ArrowUp", t.Enter = "Enter", t.Esc = "Escape";
8
+ })(r || (r = {}));
9
+ const b = class {
10
+ constructor(t) {
11
+ c(this, t), this.change = m(this, "change", 3), this.isFilterSelectionDisabled = !1, this.isClearButtonVisible = !1, this.isMouseOverEventDisabled = !1, this.currentItemIndex = 0, this.selectedItemIndex = 0, this.highlightedItemClassName = "list__item--highlighted", this.open = !1, this.items = [], this.itemsOrder = void 0, this.label = void 0, this.filterable = !1, this.multiple = !1, this.selected = [], this.noResultsMessage = "No results found", this.iconSrc = void 0, this.iconAlt = void 0, this.currentItems = [], this.disabled = !1;
12
+ }
13
+ onItemsChanged(t) {
14
+ if (t.some((e) => e.tagName.toLowerCase() !== "mi-dropdown-item"))
15
+ throw new Error("Items contains unknown element(s).");
16
+ if (Object.values(d).includes(this.itemsOrder) && (t = this.getSortedItems(t)), this.currentItems = [...t], this.filter(), !this.multiple) {
17
+ const e = this.currentItems.findIndex((i) => i.selected);
18
+ this.currentItemIndex = e > -1 ? e : 0, this.selectedItemIndex = this.currentItemIndex;
19
+ }
20
+ this.items.forEach((e, i) => {
21
+ e.dataset.index = i.toString();
22
+ }), this.selectFirstMiDropdownItem();
23
+ }
24
+ onCurrentItemsChange() {
25
+ this.isFilterSelectionDisabled = this.currentItems.length === 0;
26
+ }
27
+ /**
28
+ * Focusout event handler.
29
+ * If the dropdown loses focus it is closed.
30
+ */
31
+ focusOutEventHandler(t) {
32
+ const e = t.relatedTarget;
33
+ (!e || !this.hostElement.contains(e)) && (this.open = !1);
34
+ }
35
+ /**
36
+ * Outside the dropdown listener. It will close the dropdown when a click is outside a dropdown and dropdown list.
37
+ *
38
+ * @param ev
39
+ */
40
+ checkForClickOutside(t) {
41
+ this.hostElement.contains(t.target) || (this.open = !1);
42
+ }
43
+ /**
44
+ * Mousemove event handler.
45
+ * When the mouse is moved the mouseover event handler is enabled.
46
+ */
47
+ mouseMoveEventHandler() {
48
+ this.isMouseOverEventDisabled = !1;
49
+ }
50
+ /**
51
+ * Scroll event handler.
52
+ * The dropdown is closed when the scroll event is trigget outside the dropdown.
53
+ */
54
+ scrollEventHandler(t) {
55
+ const e = t.target;
56
+ (!e || !this.hostElement.contains(e)) && (this.open = !1);
57
+ }
58
+ /**
59
+ * Resize event handler.
60
+ * Recalculate the position of the dropdown when the window is resized.
61
+ */
62
+ resizeEventHandler() {
63
+ this.calculateDropDownPosition();
64
+ }
65
+ componentDidLoad() {
66
+ this.createMiDropdownItemsFromDocument(), this.selectFirstMiDropdownItem(), this.enableKeyboardNavigationEvents();
67
+ const t = new IntersectionObserver((e, i) => {
68
+ e.forEach((n) => {
69
+ n.isIntersecting === !0 && this.filterElement.focus();
70
+ });
71
+ });
72
+ this.filterElement !== void 0 && (t.observe(this.filterElement), this.filterElement.addEventListener("keydown", (e) => {
73
+ (e.key === r.ArrowDown || e.key === r.ArrowUp) && e.preventDefault();
74
+ }));
75
+ }
76
+ componentDidRender() {
77
+ this.calculateDropDownPosition(), this.multiple || this.highlightItem(this.currentItemIndex, !0);
78
+ }
79
+ /**
80
+ * Gets all mi-dropdown-item elements for the mi-dropdown items property.
81
+ */
82
+ createMiDropdownItemsFromDocument() {
83
+ const t = this.items && this.items.length > 0 ? this.items : this.hostElement.querySelectorAll("mi-dropdown-item");
84
+ t.length > 0 && (this.items = Array.from(t));
85
+ }
86
+ /**
87
+ * Set the first mi-dropdown-item as the textual content of the button.
88
+ */
89
+ selectFirstMiDropdownItem() {
90
+ var t;
91
+ if (!this.multiple) {
92
+ const e = (t = this.items) === null || t === void 0 ? void 0 : t.findIndex((i) => i.selected);
93
+ this.selected = [this.items[e > -1 ? e : 0]];
94
+ }
95
+ }
96
+ /**
97
+ * Enables cycling through the items in the content window using arrow up/down keys.
98
+ */
99
+ enableKeyboardNavigationEvents() {
100
+ this.hostElement.addEventListener("keydown", (t) => {
101
+ if (this.open === !1 && t.key === r.ArrowDown) {
102
+ this.isMouseOverEventDisabled = !0, this.toggleContentWindow(), t.preventDefault();
103
+ return;
104
+ }
105
+ if (this.open === !0 && !this.multiple)
106
+ switch (t.key) {
107
+ case r.ArrowDown:
108
+ this.isMouseOverEventDisabled = !0, this.currentItemIndex = (this.currentItemIndex + 1) % this.currentItems.length, this.highlightItem(this.currentItemIndex, !0), t.preventDefault();
109
+ break;
110
+ case r.ArrowUp:
111
+ this.isMouseOverEventDisabled = !0, this.currentItemIndex = (this.currentItemIndex + this.currentItems.length - 1) % this.currentItems.length, this.highlightItem(this.currentItemIndex, !0), t.preventDefault();
112
+ break;
113
+ case r.Enter:
114
+ if (this.hostElement.shadowRoot.activeElement === this.clearButtonElement)
115
+ return;
116
+ this.currentItems[this.currentItemIndex] !== void 0 && this.onSelect(this.currentItems[this.currentItemIndex]), t.preventDefault();
117
+ break;
118
+ }
119
+ t.key === r.Esc && (this.multiple || (this.currentItemIndex = this.selectedItemIndex, this.highlightItem(this.currentItemIndex)), this.toggleContentWindow(), this.clearFilter());
120
+ });
121
+ }
122
+ /**
123
+ * Updates the currently highlighted item in the markup.
124
+ * @param itemIndex
125
+ */
126
+ highlightItem(t, e = !1) {
127
+ var i, n;
128
+ const l = this.hostElement.shadowRoot.querySelectorAll(".list__item");
129
+ l.forEach((o) => {
130
+ o.classList.remove(this.highlightedItemClassName);
131
+ }), (i = l[t]) === null || i === void 0 || i.classList.add(this.highlightedItemClassName), e && ((n = l[t]) === null || n === void 0 || n.scrollIntoView({ block: "nearest", inline: "nearest" }));
132
+ }
133
+ /**
134
+ * Get sorted items.
135
+ * The sorting order is defined by the itemsOrder attribute.
136
+ *
137
+ * @param {HTMLMiDropdownItemElement[]} items
138
+ * @returns {HTMLMiDropdownItemElement[]}
139
+ */
140
+ getSortedItems(t) {
141
+ return this.itemsOrder === d.Asc ? t.sort((e, i) => (e.text || e.innerText).trimStart().toLowerCase().localeCompare((i.text || i.innerText).trimStart().toLowerCase(), void 0, { numeric: !0 })) : t.sort((e, i) => (i.text || i.innerText).trimStart().toLowerCase().localeCompare((e.text || e.innerText).trimStart().toLowerCase(), void 0, { numeric: !0 })), t;
142
+ }
143
+ /**
144
+ * Update and emit list of selected items.
145
+ */
146
+ onChangedHandler() {
147
+ this.selected = [...this.items.filter((t) => t.selected)], this.change.emit(this.selected);
148
+ }
149
+ /**
150
+ * Toggle visibility of content window.
151
+ */
152
+ toggleContentWindow() {
153
+ this.open = !this.open;
154
+ }
155
+ /**
156
+ * Check all checkboxes.
157
+ */
158
+ selectAll() {
159
+ const t = Array.from(this.currentItems);
160
+ for (const e of t)
161
+ e.selected = !0;
162
+ this.onChangedHandler();
163
+ }
164
+ /**
165
+ * Uncheck all checkboxes.
166
+ */
167
+ selectNone() {
168
+ const t = Array.from(this.currentItems);
169
+ for (const e of t)
170
+ e.selected = !1;
171
+ this.onChangedHandler();
172
+ }
173
+ /**
174
+ * Select or toggle selection of item.
175
+ *
176
+ * @param {HTMLMiDropdownItemElement} item
177
+ */
178
+ onSelect(t) {
179
+ this.multiple || (this.open = !1, Array.from(this.items).forEach((i) => {
180
+ i.selected = !1;
181
+ }), this.clearFilter()), t.selected = !t.selected, this.currentItemIndex = Number(t.dataset.index), this.selectedItemIndex = this.currentItemIndex, this.onChangedHandler();
182
+ }
183
+ /**
184
+ * Highlights the item that the cursor is hovering in the content window.
185
+ * @param filteredItemsIndex
186
+ */
187
+ onMouseOver(t) {
188
+ !this.isMouseOverEventDisabled && !this.multiple && (this.highlightItem(t), this.currentItemIndex = t);
189
+ }
190
+ /**
191
+ * Filter items based on input query.
192
+ *
193
+ * @returns {HTMLMiDropdownItemElement[]}
194
+ */
195
+ filter() {
196
+ if (this.filterElement) {
197
+ const t = this.filterElement.value, e = this.items.map((a) => a.text || a.innerText), i = this.currentItems.length;
198
+ if (t === "")
199
+ return this.currentItemIndex = this.selectedItemIndex, this.isClearButtonVisible = !1, this.currentItems = [...this.items];
200
+ this.isClearButtonVisible = !0;
201
+ const n = {
202
+ limit: 50,
203
+ allowTypo: !1,
204
+ threshold: -1e4
205
+ }, o = f.go(t, e, n).map((a) => this.items.find((h) => (h.text || h.innerText) === a.target));
206
+ this.currentItems = o, i !== this.currentItems.length && (this.currentItemIndex = 0);
207
+ }
208
+ }
209
+ /**
210
+ * Clear filter.
211
+ */
212
+ clearFilter() {
213
+ this.filterElement && (this.filterElement.value = "", this.filterElement.focus(), this.currentItems = this.items), this.isClearButtonVisible = !1;
214
+ }
215
+ render() {
216
+ const t = this.filterable ? this.renderFiltering() : null, e = this.multiple ? this.renderMultipleOptions() : null, i = this.iconSrc ? this.renderLeftSideIcon() : null, n = s("ul", { class: "list" }, this.currentItems.map((l, o) => this.renderListItem(l, o, !!e)));
217
+ return s(p, { class: { open: this.open } }, s("button", { part: "button", class: "button", disabled: this.disabled || this.items.length === 0, onClick: () => this.toggleContentWindow() }, i, this.renderButtonLabel(), s("svg", { part: "icon-down-arrow", width: "12", height: "6", viewBox: "0 0 18 10", xmlns: "http://www.w3.org/2000/svg" }, s("path", { d: "M9.37165 9.58706C9.17303 9.80775 8.82697 9.80775 8.62835 9.58706L0.751035 0.834484C0.46145 0.512722 0.689796 7.73699e-08 1.12268 1.25924e-07L16.8773 1.89302e-06C17.3102 1.94157e-06 17.5386 0.512723 17.249 0.834484L9.37165 9.58706Z" }))), s("section", { ref: (l) => this.listElement = l, part: "dropdown-container", class: "content" }, t, e, this.currentItems.length === 0 ? this.renderNoResultsTemplate() : n));
218
+ }
219
+ /**
220
+ * Helper function to render markup when no items are available to be displayed in the content window.
221
+ *
222
+ * @returns {JSX.Element}
223
+ */
224
+ renderNoResultsTemplate() {
225
+ return s("div", { class: "empty-page" }, s("p", { class: "empty-page__header" }, this.noResultsMessage));
226
+ }
227
+ /**
228
+ * Helper function to render the button label.
229
+ * @returns {JSX.Element}
230
+ */
231
+ renderButtonLabel() {
232
+ var t, e, i, n;
233
+ return this.multiple ? s("div", { part: "button-label", class: "button__label" }, this.label) : !((e = (t = this.selected) === null || t === void 0 ? void 0 : t[0]) === null || e === void 0) && e.text ? s("div", { part: "button-label", class: "button__label" }, this.selected[0].text) : !((n = (i = this.selected) === null || i === void 0 ? void 0 : i[0]) === null || n === void 0) && n.innerHTML ? s("div", { part: "button-label", class: "button__label button__label--from-inner-html", innerHTML: this.selected[0].innerHTML }) : s("div", { part: "button-label", class: "button__label" });
234
+ }
235
+ /**
236
+ * Helper function to render an icon when an image source is provided.
237
+ * @returns {JSX.Element}
238
+ */
239
+ renderLeftSideIcon() {
240
+ return s("img", { part: "button-icon", class: "button__left-icon", src: this.iconSrc, alt: this.iconAlt ? this.iconAlt : "" });
241
+ }
242
+ /**
243
+ * Helper function for rendering the filtering UI.
244
+ *
245
+ * @returns {JSX.Element}
246
+ */
247
+ renderFiltering() {
248
+ return s("div", { class: "filter" }, s("input", { type: "text", class: "mi-input filter__input", placeholder: "Type to filter", ref: (t) => this.filterElement = t, onInput: () => {
249
+ this.filter();
250
+ }, tabIndex: this.open ? 0 : -1 }), s("button", { ref: (t) => this.clearButtonElement = t, tabindex: this.isClearButtonVisible ? 0 : -1, type: "button", onClick: () => this.clearFilter(), class: `filter__clear ${this.isClearButtonVisible === !1 ? "filter__clear--hidden" : ""}`, "aria-label": "Clear" }, s("svg", { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, s("path", { d: "M14 1.41L12.59 0L7 5.59L1.41 0L0 1.41L5.59 7L0 12.59L1.41 14L7 8.41L12.59 14L14 12.59L8.41 7L14 1.41Z" }))));
251
+ }
252
+ /**
253
+ * Helper function for rendering the multi select options.
254
+ *
255
+ * @returns {JSX.Element}
256
+ */
257
+ renderMultipleOptions() {
258
+ return s("div", { class: "options" }, s("button", { class: "options__item", disabled: this.isFilterSelectionDisabled, onClick: () => this.selectAll() }, "Select all"), s("button", { class: "options__item", disabled: this.isFilterSelectionDisabled, onClick: () => this.selectNone() }, "Select none"));
259
+ }
260
+ /**
261
+ * Helper function for rendering list item.
262
+ *
263
+ * @param {HTMLMiDropdownItemElement} item
264
+ * @param {number} index
265
+ * @param {boolean} showCheckBox
266
+ * @returns {JSX.Element}
267
+ */
268
+ renderListItem(t, e, i) {
269
+ let n;
270
+ const l = t.getAttribute("title") || t.text || t.innerText;
271
+ return t.innerText.length > 0 ? n = s("div", { class: "label__item label__item--from-inner-html", innerHTML: t.innerHTML }) : n = s("div", { class: "label__item", innerHTML: t.text }), s("li", { class: "list__item", title: l, onMouseOver: () => {
272
+ this.onMouseOver(e);
273
+ } }, s("label", { class: "mi-label label", tabindex: "-1" }, s("input", { class: { label__checkbox: !0, "label__checkbox--hidden": !i, "mi-input": !0 }, type: "checkbox", value: e, checked: t.selected, onChange: () => this.onSelect(t) }), n));
274
+ }
275
+ /**
276
+ * Function for calculating the position of the dropdown list element.
277
+ */
278
+ calculateDropDownPosition() {
279
+ this.listElement.style.bottom = null, this.listElement.style.left = null, this.listElement.style.right = null, this.listElement.style.top = null, this.listElement.style.maxHeight = null, this.listElement.style.minWidth = null;
280
+ const { clientWidth: t, clientHeight: e } = document.documentElement, i = this.hostElement.getBoundingClientRect(), n = this.listElement.getBoundingClientRect(), l = e - i.bottom, o = i.top, a = 580, h = 12;
281
+ t <= n.width || i.right - n.width < 0 && n.right > t ? (this.listElement.style.right = `${h}px`, this.listElement.style.left = `${h}px`, this.listElement.style.minWidth = "unset") : n.right > t ? (this.listElement.style.left = "unset", this.listElement.style.right = `${t - i.right}px`) : (this.listElement.style.left = `${i.left}px`, this.listElement.style.right = "unset"), o > l ? (this.listElement.style.maxHeight = `${Math.min(o, a)}px`, this.listElement.style.top = "unset", this.listElement.style.bottom = `${e - i.top}px`) : (this.listElement.style.top = `${i.bottom}px`, this.listElement.style.bottom = "unset", this.listElement.style.maxHeight = `${Math.min(l - h * 2, a)}px`);
282
+ }
283
+ get hostElement() {
284
+ return u(this);
285
+ }
286
+ static get watchers() {
287
+ return {
288
+ items: ["onItemsChanged"],
289
+ currentItems: ["onCurrentItemsChange"]
290
+ };
291
+ }
292
+ };
293
+ b.style = g;
294
+ export {
295
+ b as mi_dropdown
296
+ };
@@ -0,0 +1,298 @@
1
+ import { r as c, c as m, h as s, H as p, g as u } from "./reactcomponent-2f9f051f.mjs";
2
+ import { S as d, f } from "./sort-order.enum-64ce8998-b75ac596.mjs";
3
+ import "react";
4
+ import "react-dom";
5
+ import "./_commonjsHelpers-ba3f0406-b96e6d6a.mjs";
6
+ const g = `.mi-input[type=text],.mi-input[type=search],.mi-input[type=number],.mi-input[type=password],.mi-input[type=tel]{font-size:1rem;padding:8px;border-style:solid;border-width:1px;border-color:#8d98aa;border-radius:4px}.mi-input[type=text],.mi-input[type=search],.mi-input[type=number],.mi-input[type=password],.mi-input[type=range],.mi-input[type=tel]{display:block}.mi-input[type=radio],.mi-input[type=checkbox]{margin:0px;transform:scale(1.2, 1.2)}.mi-input[type=search]{padding-left:32px;background:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 24 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.6267 8.43836C14.6267 11.8561 11.8561 14.6267 8.43836 14.6267C5.02062 14.6267 2.25 11.8561 2.25 8.43836C2.25 5.02062 5.02062 2.25 8.43836 2.25C11.8561 2.25 14.6267 5.02062 14.6267 8.43836Z' stroke='%23aeb9cb' stroke-width='2.5'/%3E%3Crect x='15.0979' y='14.1614' width='7.34678' height='1.32449' rx='0.662244' transform='rotate(45 15.0979 14.1614)' fill='%23aeb9cb' stroke='%23aeb9cb'/%3E%3Crect x='13.7847' y='13.2916' width='1.05276' height='0.697347' transform='rotate(45 13.7847 13.2916)' stroke='%23aeb9cb' stroke-width='0.697346'/%3E%3C/svg%3E%0A") no-repeat scroll 8px center, white}.mi-input:disabled{opacity:0.48;cursor:not-allowed}.mi-label{font-style:normal;display:block;font-size:1rem;font-weight:500;color:#1e2025}.mi-label>*{margin-top:4px}.mi-label>input[type=radio],.mi-label>input[type=checkbox],.mi-label>label.mi-toggle-btn{margin-right:8px}mi-dropdown-item{display:none}:host{display:inline-block;position:relative;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;font-family:Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"}:host(.open) .button::after{border-top-color:transparent;border-bottom-color:#1f2937;margin-top:-8px}:host(.open) section{display:flex}:host(.open) svg{transform:rotate(180deg)}.button{display:flex;justify-content:flex-start;align-items:center;height:100%;width:100%;font-family:inherit;background:linear-gradient(#f9fafb, #f3f4f6);padding:0;padding-left:16px;padding-right:16px;border-radius:4px;border-width:1px;border-style:solid;border-color:#d1d5db;color:#1c1917;font-size:1rem;font-weight:500;line-height:1rem}.button__left-icon{height:20px;width:20px;margin-right:8px}.button svg{margin-left:auto}.button__label{padding-top:12px;padding-bottom:12px;margin-right:8px;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.button__label--from-inner-html{display:flex;flex-direction:row;align-items:center;gap:8px}.button:disabled{opacity:0.72;cursor:not-allowed}.content{padding-top:12px;padding-bottom:12px;margin-top:12px;margin-bottom:12px;border-radius:8px;color:#1c1917;font-size:1rem;font-weight:500;background-color:#fcfcfc;box-shadow:0px 2px 2px rgba(0, 0, 0, 0.2), 0px 4px 4px rgba(0, 0, 0, 0.18), 0px 8px 8px rgba(0, 0, 0, 0.16);min-width:320px;max-width:480px;max-height:580px;display:none;flex-direction:column;position:fixed;z-index:10000}.content .filter{margin-bottom:16px;padding-left:8px;padding-right:8px;display:flex;position:relative}.content .filter__input{width:100%}.content .filter__clear{width:20px;height:20px;padding:0;border-width:0;display:flex;align-items:center;justify-content:center;position:absolute;right:14px;top:50%;transform:translateY(-50%);background-color:#1f2937;border-radius:50%}.content .filter__clear:focus{outline:0}.content .filter__clear--hidden{opacity:0;pointer-events:none}.content .filter__clear svg{fill:#fcfcfc;width:10px;height:10px}.content .options{margin-bottom:16px;padding-left:16px;padding-right:16px}.content .options__item{padding:0;color:#3b82f6;font-size:0.75rem;font-weight:500;font-family:inherit;background-color:transparent;border:transparent}.content .options__item:hover{text-decoration:underline}.content .options__item:first-child{margin-right:16px}.content .options__item:disabled{color:rgba(48, 113, 217, 0.72);cursor:not-allowed;text-decoration:none}.content .list{padding:0;margin:0;list-style:none;overflow-y:auto}.content .list__item{cursor:pointer}.content .list__item--highlighted{background-color:#f3f4f6}.empty-page{display:flex;align-items:left;flex-direction:column;margin-left:16px;margin-bottom:12px}.empty-page>*{margin:0}.empty-page__header{font-size:1rem;font-weight:400;color:#374151}.label{display:flex;flex-direction:row;align-items:center;padding-left:16px;padding-right:16px;padding-top:8px;padding-bottom:8px}.label__item{display:inline-block;margin-top:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.label__item--from-inner-html{display:flex;flex-direction:row;align-items:center;gap:8px}.label__checkbox{margin-right:12px}.label__checkbox--hidden{display:none}`;
7
+ var r;
8
+ (function(t) {
9
+ t.ArrowDown = "ArrowDown", t.ArrowUp = "ArrowUp", t.Enter = "Enter", t.Esc = "Escape";
10
+ })(r || (r = {}));
11
+ const b = class {
12
+ constructor(t) {
13
+ c(this, t), this.change = m(this, "change", 3), this.isFilterSelectionDisabled = !1, this.isClearButtonVisible = !1, this.isMouseOverEventDisabled = !1, this.currentItemIndex = 0, this.selectedItemIndex = 0, this.highlightedItemClassName = "list__item--highlighted", this.open = !1, this.items = [], this.itemsOrder = void 0, this.label = void 0, this.filterable = !1, this.multiple = !1, this.selected = [], this.noResultsMessage = "No results found", this.iconSrc = void 0, this.iconAlt = void 0, this.currentItems = [], this.disabled = !1;
14
+ }
15
+ onItemsChanged(t) {
16
+ if (t.some((e) => e.tagName.toLowerCase() !== "mi-dropdown-item"))
17
+ throw new Error("Items contains unknown element(s).");
18
+ if (Object.values(d).includes(this.itemsOrder) && (t = this.getSortedItems(t)), this.currentItems = [...t], this.filter(), !this.multiple) {
19
+ const e = this.currentItems.findIndex((i) => i.selected);
20
+ this.currentItemIndex = e > -1 ? e : 0, this.selectedItemIndex = this.currentItemIndex;
21
+ }
22
+ this.items.forEach((e, i) => {
23
+ e.dataset.index = i.toString();
24
+ }), this.selectFirstMiDropdownItem();
25
+ }
26
+ onCurrentItemsChange() {
27
+ this.isFilterSelectionDisabled = this.currentItems.length === 0;
28
+ }
29
+ /**
30
+ * Focusout event handler.
31
+ * If the dropdown loses focus it is closed.
32
+ */
33
+ focusOutEventHandler(t) {
34
+ const e = t.relatedTarget;
35
+ (!e || !this.hostElement.contains(e)) && (this.open = !1);
36
+ }
37
+ /**
38
+ * Outside the dropdown listener. It will close the dropdown when a click is outside a dropdown and dropdown list.
39
+ *
40
+ * @param ev
41
+ */
42
+ checkForClickOutside(t) {
43
+ this.hostElement.contains(t.target) || (this.open = !1);
44
+ }
45
+ /**
46
+ * Mousemove event handler.
47
+ * When the mouse is moved the mouseover event handler is enabled.
48
+ */
49
+ mouseMoveEventHandler() {
50
+ this.isMouseOverEventDisabled = !1;
51
+ }
52
+ /**
53
+ * Scroll event handler.
54
+ * The dropdown is closed when the scroll event is trigget outside the dropdown.
55
+ */
56
+ scrollEventHandler(t) {
57
+ const e = t.target;
58
+ (!e || !this.hostElement.contains(e)) && (this.open = !1);
59
+ }
60
+ /**
61
+ * Resize event handler.
62
+ * Recalculate the position of the dropdown when the window is resized.
63
+ */
64
+ resizeEventHandler() {
65
+ this.calculateDropDownPosition();
66
+ }
67
+ componentDidLoad() {
68
+ this.createMiDropdownItemsFromDocument(), this.selectFirstMiDropdownItem(), this.enableKeyboardNavigationEvents();
69
+ const t = new IntersectionObserver((e, i) => {
70
+ e.forEach((n) => {
71
+ n.isIntersecting === !0 && this.filterElement.focus();
72
+ });
73
+ });
74
+ this.filterElement !== void 0 && (t.observe(this.filterElement), this.filterElement.addEventListener("keydown", (e) => {
75
+ (e.key === r.ArrowDown || e.key === r.ArrowUp) && e.preventDefault();
76
+ }));
77
+ }
78
+ componentDidRender() {
79
+ this.calculateDropDownPosition(), this.multiple || this.highlightItem(this.currentItemIndex, !0);
80
+ }
81
+ /**
82
+ * Gets all mi-dropdown-item elements for the mi-dropdown items property.
83
+ */
84
+ createMiDropdownItemsFromDocument() {
85
+ const t = this.items && this.items.length > 0 ? this.items : this.hostElement.querySelectorAll("mi-dropdown-item");
86
+ t.length > 0 && (this.items = Array.from(t));
87
+ }
88
+ /**
89
+ * Set the first mi-dropdown-item as the textual content of the button.
90
+ */
91
+ selectFirstMiDropdownItem() {
92
+ var t;
93
+ if (!this.multiple) {
94
+ const e = (t = this.items) === null || t === void 0 ? void 0 : t.findIndex((i) => i.selected);
95
+ this.selected = [this.items[e > -1 ? e : 0]];
96
+ }
97
+ }
98
+ /**
99
+ * Enables cycling through the items in the content window using arrow up/down keys.
100
+ */
101
+ enableKeyboardNavigationEvents() {
102
+ this.hostElement.addEventListener("keydown", (t) => {
103
+ if (this.open === !1 && t.key === r.ArrowDown) {
104
+ this.isMouseOverEventDisabled = !0, this.toggleContentWindow(), t.preventDefault();
105
+ return;
106
+ }
107
+ if (this.open === !0 && !this.multiple)
108
+ switch (t.key) {
109
+ case r.ArrowDown:
110
+ this.isMouseOverEventDisabled = !0, this.currentItemIndex = (this.currentItemIndex + 1) % this.currentItems.length, this.highlightItem(this.currentItemIndex, !0), t.preventDefault();
111
+ break;
112
+ case r.ArrowUp:
113
+ this.isMouseOverEventDisabled = !0, this.currentItemIndex = (this.currentItemIndex + this.currentItems.length - 1) % this.currentItems.length, this.highlightItem(this.currentItemIndex, !0), t.preventDefault();
114
+ break;
115
+ case r.Enter:
116
+ if (this.hostElement.shadowRoot.activeElement === this.clearButtonElement)
117
+ return;
118
+ this.currentItems[this.currentItemIndex] !== void 0 && this.onSelect(this.currentItems[this.currentItemIndex]), t.preventDefault();
119
+ break;
120
+ }
121
+ t.key === r.Esc && (this.multiple || (this.currentItemIndex = this.selectedItemIndex, this.highlightItem(this.currentItemIndex)), this.toggleContentWindow(), this.clearFilter());
122
+ });
123
+ }
124
+ /**
125
+ * Updates the currently highlighted item in the markup.
126
+ * @param itemIndex
127
+ */
128
+ highlightItem(t, e = !1) {
129
+ var i, n;
130
+ const l = this.hostElement.shadowRoot.querySelectorAll(".list__item");
131
+ l.forEach((o) => {
132
+ o.classList.remove(this.highlightedItemClassName);
133
+ }), (i = l[t]) === null || i === void 0 || i.classList.add(this.highlightedItemClassName), e && ((n = l[t]) === null || n === void 0 || n.scrollIntoView({ block: "nearest", inline: "nearest" }));
134
+ }
135
+ /**
136
+ * Get sorted items.
137
+ * The sorting order is defined by the itemsOrder attribute.
138
+ *
139
+ * @param {HTMLMiDropdownItemElement[]} items
140
+ * @returns {HTMLMiDropdownItemElement[]}
141
+ */
142
+ getSortedItems(t) {
143
+ return this.itemsOrder === d.Asc ? t.sort((e, i) => (e.text || e.innerText).trimStart().toLowerCase().localeCompare((i.text || i.innerText).trimStart().toLowerCase(), void 0, { numeric: !0 })) : t.sort((e, i) => (i.text || i.innerText).trimStart().toLowerCase().localeCompare((e.text || e.innerText).trimStart().toLowerCase(), void 0, { numeric: !0 })), t;
144
+ }
145
+ /**
146
+ * Update and emit list of selected items.
147
+ */
148
+ onChangedHandler() {
149
+ this.selected = [...this.items.filter((t) => t.selected)], this.change.emit(this.selected);
150
+ }
151
+ /**
152
+ * Toggle visibility of content window.
153
+ */
154
+ toggleContentWindow() {
155
+ this.open = !this.open;
156
+ }
157
+ /**
158
+ * Check all checkboxes.
159
+ */
160
+ selectAll() {
161
+ const t = Array.from(this.currentItems);
162
+ for (const e of t)
163
+ e.selected = !0;
164
+ this.onChangedHandler();
165
+ }
166
+ /**
167
+ * Uncheck all checkboxes.
168
+ */
169
+ selectNone() {
170
+ const t = Array.from(this.currentItems);
171
+ for (const e of t)
172
+ e.selected = !1;
173
+ this.onChangedHandler();
174
+ }
175
+ /**
176
+ * Select or toggle selection of item.
177
+ *
178
+ * @param {HTMLMiDropdownItemElement} item
179
+ */
180
+ onSelect(t) {
181
+ this.multiple || (this.open = !1, Array.from(this.items).forEach((i) => {
182
+ i.selected = !1;
183
+ }), this.clearFilter()), t.selected = !t.selected, this.currentItemIndex = Number(t.dataset.index), this.selectedItemIndex = this.currentItemIndex, this.onChangedHandler();
184
+ }
185
+ /**
186
+ * Highlights the item that the cursor is hovering in the content window.
187
+ * @param filteredItemsIndex
188
+ */
189
+ onMouseOver(t) {
190
+ !this.isMouseOverEventDisabled && !this.multiple && (this.highlightItem(t), this.currentItemIndex = t);
191
+ }
192
+ /**
193
+ * Filter items based on input query.
194
+ *
195
+ * @returns {HTMLMiDropdownItemElement[]}
196
+ */
197
+ filter() {
198
+ if (this.filterElement) {
199
+ const t = this.filterElement.value, e = this.items.map((a) => a.text || a.innerText), i = this.currentItems.length;
200
+ if (t === "")
201
+ return this.currentItemIndex = this.selectedItemIndex, this.isClearButtonVisible = !1, this.currentItems = [...this.items];
202
+ this.isClearButtonVisible = !0;
203
+ const n = {
204
+ limit: 50,
205
+ allowTypo: !1,
206
+ threshold: -1e4
207
+ }, o = f.go(t, e, n).map((a) => this.items.find((h) => (h.text || h.innerText) === a.target));
208
+ this.currentItems = o, i !== this.currentItems.length && (this.currentItemIndex = 0);
209
+ }
210
+ }
211
+ /**
212
+ * Clear filter.
213
+ */
214
+ clearFilter() {
215
+ this.filterElement && (this.filterElement.value = "", this.filterElement.focus(), this.currentItems = this.items), this.isClearButtonVisible = !1;
216
+ }
217
+ render() {
218
+ const t = this.filterable ? this.renderFiltering() : null, e = this.multiple ? this.renderMultipleOptions() : null, i = this.iconSrc ? this.renderLeftSideIcon() : null, n = s("ul", { class: "list" }, this.currentItems.map((l, o) => this.renderListItem(l, o, !!e)));
219
+ return s(p, { class: { open: this.open } }, s("button", { part: "button", class: "button", disabled: this.disabled || this.items.length === 0, onClick: () => this.toggleContentWindow() }, i, this.renderButtonLabel(), s("svg", { part: "icon-down-arrow", width: "12", height: "6", viewBox: "0 0 18 10", xmlns: "http://www.w3.org/2000/svg" }, s("path", { d: "M9.37165 9.58706C9.17303 9.80775 8.82697 9.80775 8.62835 9.58706L0.751035 0.834484C0.46145 0.512722 0.689796 7.73699e-08 1.12268 1.25924e-07L16.8773 1.89302e-06C17.3102 1.94157e-06 17.5386 0.512723 17.249 0.834484L9.37165 9.58706Z" }))), s("section", { ref: (l) => this.listElement = l, part: "dropdown-container", class: "content" }, t, e, this.currentItems.length === 0 ? this.renderNoResultsTemplate() : n));
220
+ }
221
+ /**
222
+ * Helper function to render markup when no items are available to be displayed in the content window.
223
+ *
224
+ * @returns {JSX.Element}
225
+ */
226
+ renderNoResultsTemplate() {
227
+ return s("div", { class: "empty-page" }, s("p", { class: "empty-page__header" }, this.noResultsMessage));
228
+ }
229
+ /**
230
+ * Helper function to render the button label.
231
+ * @returns {JSX.Element}
232
+ */
233
+ renderButtonLabel() {
234
+ var t, e, i, n;
235
+ return this.multiple ? s("div", { part: "button-label", class: "button__label" }, this.label) : !((e = (t = this.selected) === null || t === void 0 ? void 0 : t[0]) === null || e === void 0) && e.text ? s("div", { part: "button-label", class: "button__label" }, this.selected[0].text) : !((n = (i = this.selected) === null || i === void 0 ? void 0 : i[0]) === null || n === void 0) && n.innerHTML ? s("div", { part: "button-label", class: "button__label button__label--from-inner-html", innerHTML: this.selected[0].innerHTML }) : s("div", { part: "button-label", class: "button__label" });
236
+ }
237
+ /**
238
+ * Helper function to render an icon when an image source is provided.
239
+ * @returns {JSX.Element}
240
+ */
241
+ renderLeftSideIcon() {
242
+ return s("img", { part: "button-icon", class: "button__left-icon", src: this.iconSrc, alt: this.iconAlt ? this.iconAlt : "" });
243
+ }
244
+ /**
245
+ * Helper function for rendering the filtering UI.
246
+ *
247
+ * @returns {JSX.Element}
248
+ */
249
+ renderFiltering() {
250
+ return s("div", { class: "filter" }, s("input", { type: "text", class: "mi-input filter__input", placeholder: "Type to filter", ref: (t) => this.filterElement = t, onInput: () => {
251
+ this.filter();
252
+ }, tabIndex: this.open ? 0 : -1 }), s("button", { ref: (t) => this.clearButtonElement = t, tabindex: this.isClearButtonVisible ? 0 : -1, type: "button", onClick: () => this.clearFilter(), class: `filter__clear ${this.isClearButtonVisible === !1 ? "filter__clear--hidden" : ""}`, "aria-label": "Clear" }, s("svg", { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, s("path", { d: "M14 1.41L12.59 0L7 5.59L1.41 0L0 1.41L5.59 7L0 12.59L1.41 14L7 8.41L12.59 14L14 12.59L8.41 7L14 1.41Z" }))));
253
+ }
254
+ /**
255
+ * Helper function for rendering the multi select options.
256
+ *
257
+ * @returns {JSX.Element}
258
+ */
259
+ renderMultipleOptions() {
260
+ return s("div", { class: "options" }, s("button", { class: "options__item", disabled: this.isFilterSelectionDisabled, onClick: () => this.selectAll() }, "Select all"), s("button", { class: "options__item", disabled: this.isFilterSelectionDisabled, onClick: () => this.selectNone() }, "Select none"));
261
+ }
262
+ /**
263
+ * Helper function for rendering list item.
264
+ *
265
+ * @param {HTMLMiDropdownItemElement} item
266
+ * @param {number} index
267
+ * @param {boolean} showCheckBox
268
+ * @returns {JSX.Element}
269
+ */
270
+ renderListItem(t, e, i) {
271
+ let n;
272
+ const l = t.getAttribute("title") || t.text || t.innerText;
273
+ return t.innerText.length > 0 ? n = s("div", { class: "label__item label__item--from-inner-html", innerHTML: t.innerHTML }) : n = s("div", { class: "label__item", innerHTML: t.text }), s("li", { class: "list__item", title: l, onMouseOver: () => {
274
+ this.onMouseOver(e);
275
+ } }, s("label", { class: "mi-label label", tabindex: "-1" }, s("input", { class: { label__checkbox: !0, "label__checkbox--hidden": !i, "mi-input": !0 }, type: "checkbox", value: e, checked: t.selected, onChange: () => this.onSelect(t) }), n));
276
+ }
277
+ /**
278
+ * Function for calculating the position of the dropdown list element.
279
+ */
280
+ calculateDropDownPosition() {
281
+ this.listElement.style.bottom = null, this.listElement.style.left = null, this.listElement.style.right = null, this.listElement.style.top = null, this.listElement.style.maxHeight = null, this.listElement.style.minWidth = null;
282
+ const { clientWidth: t, clientHeight: e } = document.documentElement, i = this.hostElement.getBoundingClientRect(), n = this.listElement.getBoundingClientRect(), l = e - i.bottom, o = i.top, a = 580, h = 12;
283
+ t <= n.width || i.right - n.width < 0 && n.right > t ? (this.listElement.style.right = `${h}px`, this.listElement.style.left = `${h}px`, this.listElement.style.minWidth = "unset") : n.right > t ? (this.listElement.style.left = "unset", this.listElement.style.right = `${t - i.right}px`) : (this.listElement.style.left = `${i.left}px`, this.listElement.style.right = "unset"), o > l ? (this.listElement.style.maxHeight = `${Math.min(o, a)}px`, this.listElement.style.top = "unset", this.listElement.style.bottom = `${e - i.top}px`) : (this.listElement.style.top = `${i.bottom}px`, this.listElement.style.bottom = "unset", this.listElement.style.maxHeight = `${Math.min(l - h * 2, a)}px`);
284
+ }
285
+ get hostElement() {
286
+ return u(this);
287
+ }
288
+ static get watchers() {
289
+ return {
290
+ items: ["onItemsChanged"],
291
+ currentItems: ["onCurrentItemsChange"]
292
+ };
293
+ }
294
+ };
295
+ b.style = g;
296
+ export {
297
+ b as mi_dropdown
298
+ };