@keenmate/web-multiselect 1.0.0-rc04 → 1.0.0-rc05
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +357 -8
- package/dist/multiselect.js +66 -50
- package/dist/multiselect.umd.js +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](LICENSE)
|
|
4
4
|
[](https://www.npmjs.com/package/@keenmate/web-multiselect)
|
|
5
5
|
|
|
6
|
-
A lightweight, accessible multiselect web component with typeahead search,
|
|
6
|
+
A lightweight, accessible multiselect web component with typeahead search, RTL language support, rich content, and excellent keyboard navigation.
|
|
7
7
|
|
|
8
8
|
## Features
|
|
9
9
|
|
|
@@ -17,6 +17,7 @@ A lightweight, accessible multiselect web component with typeahead search, rich
|
|
|
17
17
|
- 📦 **Grouped Options** - Organize options into collapsible groups
|
|
18
18
|
- 🎉 **Smart Positioning** - Uses Floating UI for intelligent dropdown placement
|
|
19
19
|
- 🌍 **i18n Support** - Customizable callbacks for pluralization and localization
|
|
20
|
+
- 🌐 **RTL Support** - Full right-to-left language support (Arabic, Hebrew, Persian, Urdu, etc.)
|
|
20
21
|
- ✨ **Modern** - Web Component with Shadow DOM, TypeScript, bundled with Vite
|
|
21
22
|
- 🌐 **Framework Agnostic** - Works with any framework or vanilla JS
|
|
22
23
|
|
|
@@ -87,7 +88,7 @@ multiselect.setSelected(['js', 'ts']);
|
|
|
87
88
|
| `show-checkboxes` | `boolean` | `true` | Show checkboxes next to options |
|
|
88
89
|
| `close-on-select` | `boolean` | `false` | Close dropdown after selecting |
|
|
89
90
|
| `dropdown-min-width` | `string` | - | Min width for dropdown (e.g., '20rem') |
|
|
90
|
-
| `pills-display-mode` | `'pills' \| 'count' \| 'compact'` | `'pills'` | How to display selected items |
|
|
91
|
+
| `pills-display-mode` | `'pills' \| 'count' \| 'compact' \| 'partial'` | `'pills'` | How to display selected items |
|
|
91
92
|
| `pills-threshold` | `number` | - | Auto-switch mode when exceeded (see pills-threshold-mode) |
|
|
92
93
|
| `pills-threshold-mode` | `'count' \| 'partial'` | `'count'` | Mode after threshold: 'count' shows badge, 'partial' shows limited pills + more badge |
|
|
93
94
|
| `pills-max-visible` | `number` | `3` | Max pills shown in partial mode |
|
|
@@ -101,6 +102,20 @@ multiselect.setSelected(['js', 'ts']);
|
|
|
101
102
|
| `empty-message` | `string` | `'No results found'` | Message when no options found |
|
|
102
103
|
| `loading-message` | `string` | `'Loading...'` | Message while loading async data |
|
|
103
104
|
| `min-search-length` | `number` | `0` | Minimum search length for async |
|
|
105
|
+
| `sticky-actions` | `boolean` | `true` | Keep Select All/Clear All buttons fixed at top while scrolling |
|
|
106
|
+
| `lock-placement` | `boolean` | `true` | Lock dropdown placement after first open to prevent flipping |
|
|
107
|
+
| `enable-search` | `boolean` | `true` | Enable/disable search functionality |
|
|
108
|
+
| `search-input-mode` | `'normal' \| 'readonly' \| 'hidden'` | `'normal'` | Search input display mode |
|
|
109
|
+
| `allow-add-new` | `boolean` | `false` | Allow adding new options not in the list |
|
|
110
|
+
| `value-member` | `string` | - | Property name for value/ID extraction from custom objects |
|
|
111
|
+
| `display-value-member` | `string` | - | Property name for display text extraction from custom objects |
|
|
112
|
+
| `search-value-member` | `string` | - | Property name for search text extraction from custom objects |
|
|
113
|
+
| `icon-member` | `string` | - | Property name for icon extraction from custom objects |
|
|
114
|
+
| `subtitle-member` | `string` | - | Property name for subtitle extraction from custom objects |
|
|
115
|
+
| `group-member` | `string` | - | Property name for group extraction from custom objects |
|
|
116
|
+
| `disabled-member` | `string` | - | Property name for disabled state extraction from custom objects |
|
|
117
|
+
| `name` | `string` | - | HTML form field name for form integration (creates hidden input) |
|
|
118
|
+
| `value-format` | `'json' \| 'csv' \| 'array'` | `'json'` | Format for form value serialization |
|
|
104
119
|
| `initial-values` | `string` (JSON array) | - | Pre-selected values |
|
|
105
120
|
|
|
106
121
|
## Properties
|
|
@@ -131,6 +146,12 @@ multiselect.onChange = (selectedOptions) => {
|
|
|
131
146
|
console.log('Changed:', selectedOptions);
|
|
132
147
|
};
|
|
133
148
|
|
|
149
|
+
// Pill display customization (show different text in pills vs dropdown)
|
|
150
|
+
multiselect.getPillDisplayCallback = (item) => {
|
|
151
|
+
// Show shorter text in pills (e.g., just name instead of "name (email)")
|
|
152
|
+
return item.name; // Dropdown might show "John Doe (john@example.com)"
|
|
153
|
+
};
|
|
154
|
+
|
|
134
155
|
// Pill tooltip customization
|
|
135
156
|
multiselect.getPillTooltipCallback = (item) => {
|
|
136
157
|
return `${item.label} - ${item.subtitle}`;
|
|
@@ -143,14 +164,51 @@ multiselect.getCountPillCallback = (count, moreCount) => {
|
|
|
143
164
|
}
|
|
144
165
|
return `${count} selected`; // Count mode display
|
|
145
166
|
};
|
|
167
|
+
|
|
168
|
+
// Data extraction - Member properties (for simple property names)
|
|
169
|
+
multiselect.valueMember = 'id';
|
|
170
|
+
multiselect.displayValueMember = 'name';
|
|
171
|
+
multiselect.iconMember = 'icon';
|
|
172
|
+
multiselect.subtitleMember = 'description';
|
|
173
|
+
multiselect.groupMember = 'category';
|
|
174
|
+
multiselect.disabledMember = 'isDisabled';
|
|
175
|
+
|
|
176
|
+
// Data extraction - Callback functions (for complex logic)
|
|
177
|
+
multiselect.getValueCallback = (item) => item.id || item.value;
|
|
178
|
+
multiselect.getDisplayValueCallback = (item) => item.label || item.name;
|
|
179
|
+
multiselect.getSearchValueCallback = (item) => `${item.name} ${item.tags.join(' ')}`;
|
|
180
|
+
multiselect.getIconCallback = (item) => item.icon || '📄';
|
|
181
|
+
multiselect.getSubtitleCallback = (item) => `${item.price} - ${item.stock} in stock`;
|
|
182
|
+
multiselect.getGroupCallback = (item) => item.category;
|
|
183
|
+
multiselect.getDisabledCallback = (item) => item.stock === 0;
|
|
184
|
+
|
|
185
|
+
// Form integration
|
|
186
|
+
multiselect.name = 'selected_items';
|
|
187
|
+
multiselect.valueFormat = 'json'; // 'json' | 'csv' | 'array'
|
|
188
|
+
multiselect.getValueFormatCallback = (values) => values.join('|'); // Custom format
|
|
189
|
+
|
|
190
|
+
// Read-only properties
|
|
191
|
+
const selectedValue = multiselect.selectedValue; // string | number | array | null
|
|
192
|
+
const selectedItem = multiselect.selectedItem; // First selected item object
|
|
193
|
+
|
|
194
|
+
// Add new option callback
|
|
195
|
+
multiselect.addNewCallback = async (value) => {
|
|
196
|
+
// Validate and create new option
|
|
197
|
+
const newOption = await fetch('/api/options', {
|
|
198
|
+
method: 'POST',
|
|
199
|
+
body: JSON.stringify({ name: value })
|
|
200
|
+
}).then(r => r.json());
|
|
201
|
+
return newOption;
|
|
202
|
+
};
|
|
146
203
|
```
|
|
147
204
|
|
|
148
205
|
## Methods
|
|
149
206
|
|
|
150
207
|
| Method | Description |
|
|
151
208
|
|--------|-------------|
|
|
152
|
-
| `getSelected()` | Get currently selected options |
|
|
153
|
-
| `setSelected(values: string[])` | Set selected values |
|
|
209
|
+
| `getSelected()` | Get currently selected options as array of option objects |
|
|
210
|
+
| `setSelected(values: (string \| number)[])` | Set selected values by ID/value |
|
|
211
|
+
| `getValue()` | Get selected value(s) - returns single value in single-select mode, array in multi-select mode |
|
|
154
212
|
| `destroy()` | Clean up and destroy instance |
|
|
155
213
|
|
|
156
214
|
## Events
|
|
@@ -272,7 +330,7 @@ Perfect for different use cases and space constraints:
|
|
|
272
330
|
|
|
273
331
|
### Pills Positioning
|
|
274
332
|
|
|
275
|
-
Control where selected item badges appear:
|
|
333
|
+
Control where selected item badges appear relative to the input:
|
|
276
334
|
|
|
277
335
|
```html
|
|
278
336
|
<!-- Pills below input (default) -->
|
|
@@ -281,13 +339,15 @@ Control where selected item badges appear:
|
|
|
281
339
|
<!-- Pills above input -->
|
|
282
340
|
<multi-select pills-position="top"></multi-select>
|
|
283
341
|
|
|
284
|
-
<!-- Pills to the left
|
|
342
|
+
<!-- Pills to the left of input -->
|
|
285
343
|
<multi-select pills-position="left"></multi-select>
|
|
286
344
|
|
|
287
|
-
<!-- Pills to the right
|
|
345
|
+
<!-- Pills to the right of input -->
|
|
288
346
|
<multi-select pills-position="right"></multi-select>
|
|
289
347
|
```
|
|
290
348
|
|
|
349
|
+
**Note:** In RTL mode, left/right positions are automatically mirrored - `pills-position="left"` will appear on the physical right side in RTL languages.
|
|
350
|
+
|
|
291
351
|
### Pill Tooltips
|
|
292
352
|
|
|
293
353
|
Enable tooltips on selected item pills with customizable placement and delay:
|
|
@@ -342,6 +402,287 @@ Customize count pill text for proper pluralization and localization:
|
|
|
342
402
|
</script>
|
|
343
403
|
```
|
|
344
404
|
|
|
405
|
+
### Right-to-Left (RTL) Language Support
|
|
406
|
+
|
|
407
|
+
Full RTL support for Arabic, Hebrew, Persian, Urdu, and other right-to-left languages with automatic detection and complete UI mirroring:
|
|
408
|
+
|
|
409
|
+
```html
|
|
410
|
+
<!-- Automatic RTL detection from dir attribute -->
|
|
411
|
+
<multi-select dir="rtl" search-placeholder="ابحث..."></multi-select>
|
|
412
|
+
|
|
413
|
+
<!-- RTL inherited from parent element -->
|
|
414
|
+
<div dir="rtl">
|
|
415
|
+
<multi-select search-placeholder="חיפוש..."></multi-select>
|
|
416
|
+
</div>
|
|
417
|
+
|
|
418
|
+
<!-- RTL on page level -->
|
|
419
|
+
<html dir="rtl">
|
|
420
|
+
<!-- All multi-selects will auto-detect RTL -->
|
|
421
|
+
</html>
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
**RTL Features:**
|
|
425
|
+
- ✅ **Auto-detection** - Detects `dir="rtl"` on component or any ancestor element
|
|
426
|
+
- ✅ **Complete UI mirroring** - Toggle icon, text alignment, pills, dropdown, badges
|
|
427
|
+
- ✅ **Logical positioning** - `pills-position="left"` becomes physically right in RTL
|
|
428
|
+
- ✅ **Pills remove buttons** - Flip to left side in RTL mode
|
|
429
|
+
- ✅ **Text direction** - All text content properly right-aligned
|
|
430
|
+
- ✅ **No configuration needed** - Just set `dir="rtl"` attribute
|
|
431
|
+
|
|
432
|
+
### Flexible Data Handling
|
|
433
|
+
|
|
434
|
+
The component supports **any data structure** through a member/callback pattern, allowing you to work with custom objects, tuple arrays, or existing API responses without transformation.
|
|
435
|
+
|
|
436
|
+
#### Member Properties (Simple Property Names)
|
|
437
|
+
|
|
438
|
+
For objects with consistent property names, use member attributes:
|
|
439
|
+
|
|
440
|
+
```html
|
|
441
|
+
<multi-select
|
|
442
|
+
id="products"
|
|
443
|
+
value-member="productId"
|
|
444
|
+
display-value-member="productName"
|
|
445
|
+
icon-member="icon"
|
|
446
|
+
subtitle-member="description"
|
|
447
|
+
group-member="category">
|
|
448
|
+
</multi-select>
|
|
449
|
+
|
|
450
|
+
<script type="module">
|
|
451
|
+
const select = document.getElementById('products');
|
|
452
|
+
select.options = [
|
|
453
|
+
{
|
|
454
|
+
productId: 'p1',
|
|
455
|
+
productName: 'Laptop',
|
|
456
|
+
icon: '💻',
|
|
457
|
+
description: 'High-performance laptop',
|
|
458
|
+
category: 'Electronics'
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
productId: 'p2',
|
|
462
|
+
productName: 'Mouse',
|
|
463
|
+
icon: '🖱️',
|
|
464
|
+
description: 'Wireless mouse',
|
|
465
|
+
category: 'Electronics'
|
|
466
|
+
}
|
|
467
|
+
];
|
|
468
|
+
</script>
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
#### Callback Functions (Complex Logic)
|
|
472
|
+
|
|
473
|
+
For complex data extraction or conditional logic, use callbacks:
|
|
474
|
+
|
|
475
|
+
```javascript
|
|
476
|
+
const select = document.querySelector('multi-select');
|
|
477
|
+
|
|
478
|
+
// Custom value extraction
|
|
479
|
+
select.getValueCallback = (item) => item.id || item.code || item.value;
|
|
480
|
+
|
|
481
|
+
// Combine multiple fields for display
|
|
482
|
+
select.getDisplayValueCallback = (item) => {
|
|
483
|
+
return `${item.firstName} ${item.lastName}`;
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
// Include multiple fields in search
|
|
487
|
+
select.getSearchValueCallback = (item) => {
|
|
488
|
+
return `${item.name} ${item.sku} ${item.tags.join(' ')}`;
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
// Conditional icons
|
|
492
|
+
select.getIconCallback = (item) => {
|
|
493
|
+
return item.inStock ? '✅' : '❌';
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
// Dynamic subtitles
|
|
497
|
+
select.getSubtitleCallback = (item) => {
|
|
498
|
+
return `$${item.price} - ${item.stock} in stock`;
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
// Disable based on conditions
|
|
502
|
+
select.getDisabledCallback = (item) => {
|
|
503
|
+
return item.stock === 0 || item.discontinued;
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
// Customize pill display (show different text in pills vs dropdown)
|
|
507
|
+
select.getPillDisplayCallback = (item) => {
|
|
508
|
+
// Pills show just the name for space efficiency
|
|
509
|
+
return item.name;
|
|
510
|
+
// While dropdown can show full details: "Laptop - $999 - Electronics"
|
|
511
|
+
};
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
#### Tuple Array Auto-Detection
|
|
515
|
+
|
|
516
|
+
The component automatically detects `[key, value]` tuple arrays:
|
|
517
|
+
|
|
518
|
+
```javascript
|
|
519
|
+
select.options = [
|
|
520
|
+
['js', 'JavaScript'],
|
|
521
|
+
['ts', 'TypeScript'],
|
|
522
|
+
['py', 'Python']
|
|
523
|
+
];
|
|
524
|
+
// First element becomes value, second becomes display text
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
#### Priority Order
|
|
528
|
+
|
|
529
|
+
When multiple extraction methods are defined, the component uses this priority:
|
|
530
|
+
|
|
531
|
+
1. **Callbacks** (highest priority) - `getValueCallback`, `getDisplayValueCallback`, etc.
|
|
532
|
+
2. **Member properties** - `valueMember`, `displayValueMember`, etc.
|
|
533
|
+
3. **Default properties** (lowest priority) - Falls back to `value`, `label`, `name`, etc.
|
|
534
|
+
|
|
535
|
+
#### TypeScript Support
|
|
536
|
+
|
|
537
|
+
The component is fully typed with generics:
|
|
538
|
+
|
|
539
|
+
```typescript
|
|
540
|
+
import type { MultiSelectElement } from '@keenmate/web-multiselect';
|
|
541
|
+
|
|
542
|
+
interface Product {
|
|
543
|
+
id: string;
|
|
544
|
+
name: string;
|
|
545
|
+
price: number;
|
|
546
|
+
category: string;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
const select = document.querySelector<MultiSelectElement<Product>>('multi-select');
|
|
550
|
+
select.options = [
|
|
551
|
+
{ id: 'p1', name: 'Laptop', price: 999, category: 'Electronics' }
|
|
552
|
+
];
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
### Form Integration
|
|
556
|
+
|
|
557
|
+
The component seamlessly integrates with standard HTML forms by automatically creating hidden inputs in the light DOM (outside Shadow DOM) so FormData can access them.
|
|
558
|
+
|
|
559
|
+
#### Basic Form Integration
|
|
560
|
+
|
|
561
|
+
```html
|
|
562
|
+
<form id="userForm" action="/submit" method="POST">
|
|
563
|
+
<label>Select Skills:</label>
|
|
564
|
+
<multi-select
|
|
565
|
+
name="skills"
|
|
566
|
+
value-format="json"
|
|
567
|
+
multiple="true">
|
|
568
|
+
</multi-select>
|
|
569
|
+
|
|
570
|
+
<button type="submit">Submit</button>
|
|
571
|
+
</form>
|
|
572
|
+
|
|
573
|
+
<script type="module">
|
|
574
|
+
import '@keenmate/web-multiselect';
|
|
575
|
+
|
|
576
|
+
const form = document.getElementById('userForm');
|
|
577
|
+
const select = form.querySelector('multi-select');
|
|
578
|
+
|
|
579
|
+
select.options = [
|
|
580
|
+
{ value: 'js', label: 'JavaScript' },
|
|
581
|
+
{ value: 'ts', label: 'TypeScript' },
|
|
582
|
+
{ value: 'py', label: 'Python' }
|
|
583
|
+
];
|
|
584
|
+
|
|
585
|
+
form.addEventListener('submit', (e) => {
|
|
586
|
+
e.preventDefault();
|
|
587
|
+
const formData = new FormData(form);
|
|
588
|
+
|
|
589
|
+
// Access the value
|
|
590
|
+
const skills = formData.get('skills');
|
|
591
|
+
console.log('Selected skills:', skills);
|
|
592
|
+
// Output: ["js","ts"] (JSON string)
|
|
593
|
+
});
|
|
594
|
+
</script>
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
#### Value Formats
|
|
598
|
+
|
|
599
|
+
Choose how selected values are serialized in forms:
|
|
600
|
+
|
|
601
|
+
**JSON Format** (default):
|
|
602
|
+
```html
|
|
603
|
+
<multi-select name="items" value-format="json"></multi-select>
|
|
604
|
+
<!-- FormData result: items = ["item1","item2","item3"] -->
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
**CSV Format**:
|
|
608
|
+
```html
|
|
609
|
+
<multi-select name="items" value-format="csv"></multi-select>
|
|
610
|
+
<!-- FormData result: items = "item1,item2,item3" -->
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
**Array Format** (multiple inputs):
|
|
614
|
+
```html
|
|
615
|
+
<multi-select name="items" value-format="array"></multi-select>
|
|
616
|
+
<!-- FormData result:
|
|
617
|
+
items[] = "item1"
|
|
618
|
+
items[] = "item2"
|
|
619
|
+
items[] = "item3"
|
|
620
|
+
-->
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
#### Custom Value Formatting
|
|
624
|
+
|
|
625
|
+
For advanced use cases, provide a custom formatting function:
|
|
626
|
+
|
|
627
|
+
```javascript
|
|
628
|
+
const select = document.querySelector('multi-select');
|
|
629
|
+
|
|
630
|
+
select.name = 'product_ids';
|
|
631
|
+
select.getValueFormatCallback = (values) => {
|
|
632
|
+
// Custom format: pipe-separated with prefix
|
|
633
|
+
return values.map(v => `ID:${v}`).join('|');
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
// When submitted, FormData will have:
|
|
637
|
+
// product_ids = "ID:123|ID:456|ID:789"
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
#### Using getValue() for JavaScript Submissions
|
|
641
|
+
|
|
642
|
+
For JavaScript-based form submissions (AJAX, fetch), use `getValue()`:
|
|
643
|
+
|
|
644
|
+
```javascript
|
|
645
|
+
// Single-select mode
|
|
646
|
+
const select = document.querySelector('multi-select[multiple="false"]');
|
|
647
|
+
const selectedId = select.getValue();
|
|
648
|
+
// Returns: "js" or null
|
|
649
|
+
|
|
650
|
+
// Multi-select mode
|
|
651
|
+
const multiSelect = document.querySelector('multi-select[multiple="true"]');
|
|
652
|
+
const selectedIds = multiSelect.getValue();
|
|
653
|
+
// Returns: ["js", "ts", "py"] or []
|
|
654
|
+
|
|
655
|
+
// Submit with fetch
|
|
656
|
+
const response = await fetch('/api/update', {
|
|
657
|
+
method: 'POST',
|
|
658
|
+
headers: { 'Content-Type': 'application/json' },
|
|
659
|
+
body: JSON.stringify({
|
|
660
|
+
skills: multiSelect.getValue()
|
|
661
|
+
})
|
|
662
|
+
});
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
#### Working with Numeric Values
|
|
666
|
+
|
|
667
|
+
The component handles both string and numeric values correctly:
|
|
668
|
+
|
|
669
|
+
```javascript
|
|
670
|
+
select.options = [
|
|
671
|
+
{ value: 1, label: 'Option 1' },
|
|
672
|
+
{ value: 2, label: 'Option 2' },
|
|
673
|
+
{ value: 3, label: 'Option 3' }
|
|
674
|
+
];
|
|
675
|
+
|
|
676
|
+
// getValue() preserves types
|
|
677
|
+
const values = select.getValue();
|
|
678
|
+
// Returns: [1, 2, 3] (numbers, not strings)
|
|
679
|
+
|
|
680
|
+
// FormData serialization
|
|
681
|
+
// JSON format: [1,2,3]
|
|
682
|
+
// CSV format: 1,2,3
|
|
683
|
+
// Array format: items[]=1, items[]=2, items[]=3
|
|
684
|
+
```
|
|
685
|
+
|
|
345
686
|
### Disabled Options
|
|
346
687
|
|
|
347
688
|
```javascript
|
|
@@ -409,7 +750,15 @@ You can customize the component using CSS variables even with just a `<script>`
|
|
|
409
750
|
|
|
410
751
|
### Available CSS Variables
|
|
411
752
|
|
|
412
|
-
|
|
753
|
+
The component exposes 200+ SCSS variables as CSS custom properties with fallbacks. Below are the **50+ most commonly customized variables** organized by category.
|
|
754
|
+
|
|
755
|
+
For the complete list of all available CSS variables, see the SCSS source files:
|
|
756
|
+
- [_variables.scss](./src/scss/_variables.scss) - Foundation variables (colors, spacing, typography)
|
|
757
|
+
- [_input-dropdown.scss](./src/scss/_input-dropdown.scss) - Input and dropdown styles
|
|
758
|
+
- [_pills-display.scss](./src/scss/_pills-display.scss) - Pills and count display
|
|
759
|
+
- [_options.scss](./src/scss/_options.scss) - Options and groups
|
|
760
|
+
- [_tooltip.scss](./src/scss/_tooltip.scss) - Tooltip styles
|
|
761
|
+
- [_rtl.scss](./src/scss/_rtl.scss) - RTL overrides
|
|
413
762
|
|
|
414
763
|
#### Colors
|
|
415
764
|
|
package/dist/multiselect.js
CHANGED
|
@@ -51,12 +51,12 @@ function Qe(i) {
|
|
|
51
51
|
function fe(i) {
|
|
52
52
|
return i.replace(/start|end/g, (e) => Je[e]);
|
|
53
53
|
}
|
|
54
|
-
const
|
|
54
|
+
const Pe = ["left", "right"], Ae = ["right", "left"], et = ["top", "bottom"], tt = ["bottom", "top"];
|
|
55
55
|
function it(i, e, t) {
|
|
56
56
|
switch (i) {
|
|
57
57
|
case "top":
|
|
58
58
|
case "bottom":
|
|
59
|
-
return t ? e ?
|
|
59
|
+
return t ? e ? Ae : Pe : e ? Pe : Ae;
|
|
60
60
|
case "left":
|
|
61
61
|
case "right":
|
|
62
62
|
return e ? et : tt;
|
|
@@ -301,7 +301,7 @@ const rt = function(i) {
|
|
|
301
301
|
const $ = (((ye = s.flip) == null ? void 0 : ye.index) || 0) + 1, he = F[$];
|
|
302
302
|
if (he && (!(d === "alignment" ? _ !== V(he) : !1) || // We leave the current main axis only if every placement on that axis
|
|
303
303
|
// overflows the main axis.
|
|
304
|
-
B.every((
|
|
304
|
+
B.every((P) => V(P.placement) === _ ? P.overflows[0] > 0 : !0)))
|
|
305
305
|
return {
|
|
306
306
|
data: {
|
|
307
307
|
index: $,
|
|
@@ -311,20 +311,20 @@ const rt = function(i) {
|
|
|
311
311
|
placement: he
|
|
312
312
|
}
|
|
313
313
|
};
|
|
314
|
-
let K = (xe = B.filter((L) => L.overflows[0] <= 0).sort((L,
|
|
314
|
+
let K = (xe = B.filter((L) => L.overflows[0] <= 0).sort((L, P) => L.overflows[1] - P.overflows[1])[0]) == null ? void 0 : xe.placement;
|
|
315
315
|
if (!K)
|
|
316
316
|
switch (u) {
|
|
317
317
|
case "bestFit": {
|
|
318
318
|
var Ce;
|
|
319
|
-
const L = (Ce = B.filter((
|
|
319
|
+
const L = (Ce = B.filter((P) => {
|
|
320
320
|
if (G) {
|
|
321
|
-
const
|
|
322
|
-
return
|
|
321
|
+
const M = V(P.placement);
|
|
322
|
+
return M === _ || // Create a bias to the `y` side axis due to horizontal
|
|
323
323
|
// reading directions favoring greater width.
|
|
324
|
-
|
|
324
|
+
M === "y";
|
|
325
325
|
}
|
|
326
326
|
return !0;
|
|
327
|
-
}).map((
|
|
327
|
+
}).map((P) => [P.placement, P.overflows.filter((M) => M > 0).reduce((M, Ke) => M + Ke, 0)]).sort((P, M) => P[1] - M[1])[0]) == null ? void 0 : Ce[0];
|
|
328
328
|
L && (K = L);
|
|
329
329
|
break;
|
|
330
330
|
}
|
|
@@ -459,14 +459,14 @@ function k(i) {
|
|
|
459
459
|
var e;
|
|
460
460
|
return (i == null || (e = i.ownerDocument) == null ? void 0 : e.defaultView) || window;
|
|
461
461
|
}
|
|
462
|
-
function
|
|
462
|
+
function I(i) {
|
|
463
463
|
var e;
|
|
464
464
|
return (e = (Le(i) ? i.ownerDocument : i.document) || window.document) == null ? void 0 : e.documentElement;
|
|
465
465
|
}
|
|
466
466
|
function Le(i) {
|
|
467
467
|
return re() ? i instanceof Node || i instanceof k(i).Node : !1;
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function A(i) {
|
|
470
470
|
return re() ? i instanceof Element || i instanceof k(i).Element : !1;
|
|
471
471
|
}
|
|
472
472
|
function T(i) {
|
|
@@ -501,7 +501,7 @@ function ae(i) {
|
|
|
501
501
|
}
|
|
502
502
|
const gt = ["transform", "translate", "scale", "rotate", "perspective"], bt = ["transform", "translate", "scale", "rotate", "perspective", "filter"], vt = ["paint", "layout", "strict", "content"];
|
|
503
503
|
function ve(i) {
|
|
504
|
-
const e = we(), t =
|
|
504
|
+
const e = we(), t = A(i) ? S(i) : i;
|
|
505
505
|
return gt.some((l) => t[l] ? t[l] !== "none" : !1) || (t.containerType ? t.containerType !== "normal" : !1) || !e && (t.backdropFilter ? t.backdropFilter !== "none" : !1) || !e && (t.filter ? t.filter !== "none" : !1) || bt.some((l) => (t.willChange || "").includes(l)) || vt.some((l) => (t.contain || "").includes(l));
|
|
506
506
|
}
|
|
507
507
|
function wt(i) {
|
|
@@ -526,7 +526,7 @@ function S(i) {
|
|
|
526
526
|
return k(i).getComputedStyle(i);
|
|
527
527
|
}
|
|
528
528
|
function ce(i) {
|
|
529
|
-
return
|
|
529
|
+
return A(i) ? {
|
|
530
530
|
scrollLeft: i.scrollLeft,
|
|
531
531
|
scrollTop: i.scrollTop
|
|
532
532
|
} : {
|
|
@@ -542,7 +542,7 @@ function D(i) {
|
|
|
542
542
|
i.assignedSlot || // DOM Element detected.
|
|
543
543
|
i.parentNode || // ShadowRoot detected.
|
|
544
544
|
Oe(i) && i.host || // Fallback.
|
|
545
|
-
|
|
545
|
+
I(i)
|
|
546
546
|
);
|
|
547
547
|
return Oe(e) ? e.host : e;
|
|
548
548
|
}
|
|
@@ -574,7 +574,7 @@ function Re(i) {
|
|
|
574
574
|
};
|
|
575
575
|
}
|
|
576
576
|
function _e(i) {
|
|
577
|
-
return
|
|
577
|
+
return A(i) ? i : i.contextElement;
|
|
578
578
|
}
|
|
579
579
|
function H(i) {
|
|
580
580
|
const e = _e(i);
|
|
@@ -606,11 +606,11 @@ function N(i, e, t, l) {
|
|
|
606
606
|
e === void 0 && (e = !1), t === void 0 && (t = !1);
|
|
607
607
|
const o = i.getBoundingClientRect(), s = _e(i);
|
|
608
608
|
let n = O(1);
|
|
609
|
-
e && (l ?
|
|
609
|
+
e && (l ? A(l) && (n = H(l)) : n = H(i));
|
|
610
610
|
const r = xt(s, t, l) ? Ne(s) : O(0);
|
|
611
611
|
let a = (o.left + r.x) / n.x, c = (o.top + r.y) / n.y, p = o.width / n.x, d = o.height / n.y;
|
|
612
612
|
if (s) {
|
|
613
|
-
const m = k(s), u = l &&
|
|
613
|
+
const m = k(s), u = l && A(l) ? k(l) : l;
|
|
614
614
|
let g = m, v = ge(g);
|
|
615
615
|
for (; v && l && u !== g; ) {
|
|
616
616
|
const w = H(v), b = v.getBoundingClientRect(), _ = S(v), y = b.left + (v.clientLeft + parseFloat(_.paddingLeft)) * w.x, C = b.top + (v.clientTop + parseFloat(_.paddingTop)) * w.y;
|
|
@@ -626,7 +626,7 @@ function N(i, e, t, l) {
|
|
|
626
626
|
}
|
|
627
627
|
function de(i, e) {
|
|
628
628
|
const t = ce(i).scrollLeft;
|
|
629
|
-
return e ? e.left + t : N(
|
|
629
|
+
return e ? e.left + t : N(I(i)).left + t;
|
|
630
630
|
}
|
|
631
631
|
function Fe(i, e) {
|
|
632
632
|
const t = i.getBoundingClientRect(), l = t.left + e.scrollLeft - de(i, t), o = t.top + e.scrollTop;
|
|
@@ -642,7 +642,7 @@ function Ct(i) {
|
|
|
642
642
|
offsetParent: l,
|
|
643
643
|
strategy: o
|
|
644
644
|
} = i;
|
|
645
|
-
const s = o === "fixed", n =
|
|
645
|
+
const s = o === "fixed", n = I(l), r = e ? ae(e.floating) : !1;
|
|
646
646
|
if (l === n || r && s)
|
|
647
647
|
return t;
|
|
648
648
|
let a = {
|
|
@@ -665,8 +665,8 @@ function Ct(i) {
|
|
|
665
665
|
function kt(i) {
|
|
666
666
|
return Array.from(i.getClientRects());
|
|
667
667
|
}
|
|
668
|
-
function
|
|
669
|
-
const e =
|
|
668
|
+
function Pt(i) {
|
|
669
|
+
const e = I(i), t = ce(i), l = i.ownerDocument.body, o = z(e.scrollWidth, e.clientWidth, l.scrollWidth, l.clientWidth), s = z(e.scrollHeight, e.clientHeight, l.scrollHeight, l.clientHeight);
|
|
670
670
|
let n = -t.scrollLeft + de(i);
|
|
671
671
|
const r = -t.scrollTop;
|
|
672
672
|
return S(l).direction === "rtl" && (n += z(e.clientWidth, l.clientWidth) - o), {
|
|
@@ -677,8 +677,8 @@ function At(i) {
|
|
|
677
677
|
};
|
|
678
678
|
}
|
|
679
679
|
const Te = 25;
|
|
680
|
-
function
|
|
681
|
-
const t = k(i), l =
|
|
680
|
+
function At(i, e) {
|
|
681
|
+
const t = k(i), l = I(i), o = t.visualViewport;
|
|
682
682
|
let s = l.clientWidth, n = l.clientHeight, r = 0, a = 0;
|
|
683
683
|
if (o) {
|
|
684
684
|
s = o.width, n = o.height;
|
|
@@ -707,13 +707,13 @@ function Ot(i, e) {
|
|
|
707
707
|
y: c
|
|
708
708
|
};
|
|
709
709
|
}
|
|
710
|
-
function
|
|
710
|
+
function Ie(i, e, t) {
|
|
711
711
|
let l;
|
|
712
712
|
if (e === "viewport")
|
|
713
|
-
l =
|
|
713
|
+
l = At(i, t);
|
|
714
714
|
else if (e === "document")
|
|
715
|
-
l =
|
|
716
|
-
else if (
|
|
715
|
+
l = Pt(I(i));
|
|
716
|
+
else if (A(e))
|
|
717
717
|
l = Ot(e, t);
|
|
718
718
|
else {
|
|
719
719
|
const o = Ne(i);
|
|
@@ -728,22 +728,22 @@ function Me(i, e, t) {
|
|
|
728
728
|
}
|
|
729
729
|
function Be(i, e) {
|
|
730
730
|
const t = D(i);
|
|
731
|
-
return t === e || !
|
|
731
|
+
return t === e || !A(t) || W(t) ? !1 : S(t).position === "fixed" || Be(t, e);
|
|
732
732
|
}
|
|
733
733
|
function Tt(i, e) {
|
|
734
734
|
const t = e.get(i);
|
|
735
735
|
if (t)
|
|
736
736
|
return t;
|
|
737
|
-
let l = U(i, [], !1).filter((r) =>
|
|
737
|
+
let l = U(i, [], !1).filter((r) => A(r) && j(r) !== "body"), o = null;
|
|
738
738
|
const s = S(i).position === "fixed";
|
|
739
739
|
let n = s ? D(i) : i;
|
|
740
|
-
for (;
|
|
740
|
+
for (; A(n) && !W(n); ) {
|
|
741
741
|
const r = S(n), a = ve(n);
|
|
742
742
|
!a && r.position === "fixed" && (o = null), (s ? !a && !o : !a && r.position === "static" && !!o && St.has(o.position) || Y(n) && !a && Be(i, n)) ? l = l.filter((p) => p !== n) : o = r, n = D(n);
|
|
743
743
|
}
|
|
744
744
|
return e.set(i, l), l;
|
|
745
745
|
}
|
|
746
|
-
function
|
|
746
|
+
function It(i) {
|
|
747
747
|
let {
|
|
748
748
|
element: e,
|
|
749
749
|
boundary: t,
|
|
@@ -751,9 +751,9 @@ function Mt(i) {
|
|
|
751
751
|
strategy: o
|
|
752
752
|
} = i;
|
|
753
753
|
const n = [...t === "clippingAncestors" ? ae(e) ? [] : Tt(e, this._c) : [].concat(t), l], r = n[0], a = n.reduce((c, p) => {
|
|
754
|
-
const d =
|
|
754
|
+
const d = Ie(e, p, o);
|
|
755
755
|
return c.top = z(d.top, c.top), c.right = te(d.right, c.right), c.bottom = te(d.bottom, c.bottom), c.left = z(d.left, c.left), c;
|
|
756
|
-
},
|
|
756
|
+
}, Ie(e, r, o));
|
|
757
757
|
return {
|
|
758
758
|
width: a.right - a.left,
|
|
759
759
|
height: a.bottom - a.top,
|
|
@@ -761,7 +761,7 @@ function Mt(i) {
|
|
|
761
761
|
y: a.top
|
|
762
762
|
};
|
|
763
763
|
}
|
|
764
|
-
function
|
|
764
|
+
function Mt(i) {
|
|
765
765
|
const {
|
|
766
766
|
width: e,
|
|
767
767
|
height: t
|
|
@@ -772,7 +772,7 @@ function It(i) {
|
|
|
772
772
|
};
|
|
773
773
|
}
|
|
774
774
|
function Et(i, e, t) {
|
|
775
|
-
const l = T(e), o =
|
|
775
|
+
const l = T(e), o = I(e), s = t === "fixed", n = N(i, !0, s, e);
|
|
776
776
|
let r = {
|
|
777
777
|
scrollLeft: 0,
|
|
778
778
|
scrollTop: 0
|
|
@@ -798,13 +798,13 @@ function Et(i, e, t) {
|
|
|
798
798
|
function ue(i) {
|
|
799
799
|
return S(i).position === "static";
|
|
800
800
|
}
|
|
801
|
-
function
|
|
801
|
+
function Me(i, e) {
|
|
802
802
|
if (!T(i) || S(i).position === "fixed")
|
|
803
803
|
return null;
|
|
804
804
|
if (e)
|
|
805
805
|
return e(i);
|
|
806
806
|
let t = i.offsetParent;
|
|
807
|
-
return
|
|
807
|
+
return I(i) === t && (t = t.ownerDocument.body), t;
|
|
808
808
|
}
|
|
809
809
|
function He(i, e) {
|
|
810
810
|
const t = k(i);
|
|
@@ -813,15 +813,15 @@ function He(i, e) {
|
|
|
813
813
|
if (!T(i)) {
|
|
814
814
|
let o = D(i);
|
|
815
815
|
for (; o && !W(o); ) {
|
|
816
|
-
if (
|
|
816
|
+
if (A(o) && !ue(o))
|
|
817
817
|
return o;
|
|
818
818
|
o = D(o);
|
|
819
819
|
}
|
|
820
820
|
return t;
|
|
821
821
|
}
|
|
822
|
-
let l =
|
|
822
|
+
let l = Me(i, e);
|
|
823
823
|
for (; l && mt(l) && ue(l); )
|
|
824
|
-
l =
|
|
824
|
+
l = Me(l, e);
|
|
825
825
|
return l && W(l) && ue(l) && !ve(l) ? t : l || wt(i) || t;
|
|
826
826
|
}
|
|
827
827
|
const Vt = async function(i) {
|
|
@@ -841,14 +841,14 @@ function Dt(i) {
|
|
|
841
841
|
}
|
|
842
842
|
const $t = {
|
|
843
843
|
convertOffsetParentRelativeRectToViewportRelativeRect: Ct,
|
|
844
|
-
getDocumentElement:
|
|
845
|
-
getClippingRect:
|
|
844
|
+
getDocumentElement: I,
|
|
845
|
+
getClippingRect: It,
|
|
846
846
|
getOffsetParent: He,
|
|
847
847
|
getElementRects: Vt,
|
|
848
848
|
getClientRects: kt,
|
|
849
|
-
getDimensions:
|
|
849
|
+
getDimensions: Mt,
|
|
850
850
|
getScale: H,
|
|
851
|
-
isElement:
|
|
851
|
+
isElement: A,
|
|
852
852
|
isRTL: Dt
|
|
853
853
|
};
|
|
854
854
|
function We(i, e) {
|
|
@@ -856,7 +856,7 @@ function We(i, e) {
|
|
|
856
856
|
}
|
|
857
857
|
function Lt(i, e) {
|
|
858
858
|
let t = null, l;
|
|
859
|
-
const o =
|
|
859
|
+
const o = I(i);
|
|
860
860
|
function s() {
|
|
861
861
|
var r;
|
|
862
862
|
clearTimeout(l), (r = t) == null || r.disconnect(), t = null;
|
|
@@ -1069,6 +1069,14 @@ class zt {
|
|
|
1069
1069
|
getItemDisplayValue(e) {
|
|
1070
1070
|
return Array.isArray(e) && e.length === 2 ? String(e[1]) : this.options.displayValueMember && e[this.options.displayValueMember] !== void 0 ? String(e[this.options.displayValueMember]) : this.options.getDisplayValueCallback ? this.options.getDisplayValueCallback(e) : "[N/A]";
|
|
1071
1071
|
}
|
|
1072
|
+
/**
|
|
1073
|
+
* Extract pill display value from item
|
|
1074
|
+
* Precedence: getPillDisplayCallback -> getItemDisplayValue()
|
|
1075
|
+
* This allows customizing pill text separately from dropdown display text
|
|
1076
|
+
*/
|
|
1077
|
+
getItemPillDisplayValue(e) {
|
|
1078
|
+
return this.options.getPillDisplayCallback ? this.options.getPillDisplayCallback(e) : this.getItemDisplayValue(e);
|
|
1079
|
+
}
|
|
1072
1080
|
/**
|
|
1073
1081
|
* Extract search value from item
|
|
1074
1082
|
* Precedence: searchValueMember -> getSearchValueCallback -> displayValue
|
|
@@ -1220,7 +1228,7 @@ class zt {
|
|
|
1220
1228
|
this.input.placeholder = this.options.searchPlaceholder;
|
|
1221
1229
|
if (this.options.isCountBadgeShown && t > 0 ? (this.countBadge.textContent = `[${t}]`, this.countBadge.style.display = "") : this.countBadge.style.display = "none", l === "pills")
|
|
1222
1230
|
this.pillsContainer.className = `ml__pills ml__pills--${this.effectivePillsPosition}`, this.pillsContainer.innerHTML = e.map((s) => {
|
|
1223
|
-
const n = this.getItemValue(s), r = this.
|
|
1231
|
+
const n = this.getItemValue(s), r = this.getItemPillDisplayValue(s);
|
|
1224
1232
|
return `
|
|
1225
1233
|
<div class="ml__pill">
|
|
1226
1234
|
<span class="ml__pill-text">${r}</span>
|
|
@@ -1231,7 +1239,7 @@ class zt {
|
|
|
1231
1239
|
else if (l === "partial") {
|
|
1232
1240
|
this.pillsContainer.className = `ml__pills ml__pills--${this.effectivePillsPosition}`;
|
|
1233
1241
|
const s = this.options.pillsMaxVisible || 3, n = e.slice(0, s), r = t - s, a = n.map((p) => {
|
|
1234
|
-
const d = this.getItemValue(p), m = this.
|
|
1242
|
+
const d = this.getItemValue(p), m = this.getItemPillDisplayValue(p);
|
|
1235
1243
|
return `
|
|
1236
1244
|
<div class="ml__pill">
|
|
1237
1245
|
<span class="ml__pill-text">${m}</span>
|
|
@@ -1565,7 +1573,7 @@ class zt {
|
|
|
1565
1573
|
</div>
|
|
1566
1574
|
<div class="ml__selected-popover-body">
|
|
1567
1575
|
${e.map((l) => {
|
|
1568
|
-
const o = this.getItemValue(l), s = this.
|
|
1576
|
+
const o = this.getItemValue(l), s = this.getItemPillDisplayValue(l);
|
|
1569
1577
|
return `
|
|
1570
1578
|
<div class="ml__pill">
|
|
1571
1579
|
<span class="ml__pill-text">${s}</span>
|
|
@@ -1679,7 +1687,7 @@ class zt {
|
|
|
1679
1687
|
if (!r) return;
|
|
1680
1688
|
const a = o.querySelector(".ml__pill-text");
|
|
1681
1689
|
a && this.createTooltipForElement(a, r, n);
|
|
1682
|
-
const c = this.
|
|
1690
|
+
const c = this.getItemPillDisplayValue(r);
|
|
1683
1691
|
this.createRemoveButtonTooltip(s, c, n);
|
|
1684
1692
|
});
|
|
1685
1693
|
const t = this.pillsContainer.querySelector(".ml__pill--more");
|
|
@@ -1698,7 +1706,7 @@ class zt {
|
|
|
1698
1706
|
if (this.options.getPillTooltipCallback)
|
|
1699
1707
|
s = this.options.getPillTooltipCallback(t), console.log("[Tooltips] Using custom callback for tooltip content");
|
|
1700
1708
|
else {
|
|
1701
|
-
const d = this.
|
|
1709
|
+
const d = this.getItemPillDisplayValue(t), m = this.getItemSubtitle(t);
|
|
1702
1710
|
s = m ? `${d}
|
|
1703
1711
|
${m}` : d, console.log(`[Tooltips] Using default content: "${s}"`);
|
|
1704
1712
|
}
|
|
@@ -1793,6 +1801,7 @@ class Ge extends Nt {
|
|
|
1793
1801
|
h(this, "_getValueCallback");
|
|
1794
1802
|
h(this, "_displayValueMember");
|
|
1795
1803
|
h(this, "_getDisplayValueCallback");
|
|
1804
|
+
h(this, "_getPillDisplayCallback");
|
|
1796
1805
|
h(this, "_searchValueMember");
|
|
1797
1806
|
h(this, "_getSearchValueCallback");
|
|
1798
1807
|
h(this, "_iconMember");
|
|
@@ -1956,6 +1965,7 @@ class Ge extends Nt {
|
|
|
1956
1965
|
// Callback properties (JavaScript only)
|
|
1957
1966
|
getValueCallback: this._getValueCallback,
|
|
1958
1967
|
getDisplayValueCallback: this._getDisplayValueCallback,
|
|
1968
|
+
getPillDisplayCallback: this._getPillDisplayCallback,
|
|
1959
1969
|
getSearchValueCallback: this._getSearchValueCallback,
|
|
1960
1970
|
getIconCallback: this._getIconCallback,
|
|
1961
1971
|
getSubtitleCallback: this._getSubtitleCallback,
|
|
@@ -2082,6 +2092,12 @@ class Ge extends Nt {
|
|
|
2082
2092
|
get getDisplayValueCallback() {
|
|
2083
2093
|
return this._getDisplayValueCallback;
|
|
2084
2094
|
}
|
|
2095
|
+
set getPillDisplayCallback(t) {
|
|
2096
|
+
this._getPillDisplayCallback = t, this.reinitialize();
|
|
2097
|
+
}
|
|
2098
|
+
get getPillDisplayCallback() {
|
|
2099
|
+
return this._getPillDisplayCallback;
|
|
2100
|
+
}
|
|
2085
2101
|
set getSearchValueCallback(t) {
|
|
2086
2102
|
this._getSearchValueCallback = t, this.reinitialize();
|
|
2087
2103
|
}
|
package/dist/multiselect.umd.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(A,C){typeof exports=="object"&&typeof module<"u"?C(exports):typeof define=="function"&&define.amd?define(["exports"],C):(A=typeof globalThis<"u"?globalThis:A||self,C(A.MultiSelect={}))})(this,function(A){"use strict";var Nt=Object.defineProperty;var Ft=(A,C,P)=>C in A?Nt(A,C,{enumerable:!0,configurable:!0,writable:!0,value:P}):A[C]=P;var h=(A,C,P)=>Ft(A,typeof C!="symbol"?C+"":C,P);const C=Math.min,P=Math.max,q=Math.round,Z=Math.floor,I=i=>({x:i,y:i}),Ye={left:"right",right:"left",bottom:"top",top:"bottom"},Xe={start:"end",end:"start"};function Ce(i,e,t){return P(i,C(e,t))}function Q(i,e){return typeof i=="function"?i(e):i}function R(i){return i.split("-")[0]}function ee(i){return i.split("-")[1]}function ke(i){return i==="x"?"y":"x"}function Ae(i){return i==="y"?"height":"width"}const Je=new Set(["top","bottom"]);function D(i){return Je.has(R(i))?"y":"x"}function Se(i){return ke(D(i))}function qe(i,e,t){t===void 0&&(t=!1);const l=ee(i),o=Se(i),s=Ae(o);let n=o==="x"?l===(t?"end":"start")?"right":"left":l==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(n=te(n)),[n,te(n)]}function Ze(i){const e=te(i);return[he(i),e,he(e)]}function he(i){return i.replace(/start|end/g,e=>Xe[e])}const Pe=["left","right"],Oe=["right","left"],Qe=["top","bottom"],et=["bottom","top"];function tt(i,e,t){switch(i){case"top":case"bottom":return t?e?Oe:Pe:e?Pe:Oe;case"left":case"right":return e?Qe:et;default:return[]}}function it(i,e,t,l){const o=ee(i);let s=tt(R(i),t==="start",l);return o&&(s=s.map(n=>n+"-"+o),e&&(s=s.concat(s.map(he)))),s}function te(i){return i.replace(/left|right|bottom|top/g,e=>Ye[e])}function lt(i){return{top:0,right:0,bottom:0,left:0,...i}}function ot(i){return typeof i!="number"?lt(i):{top:i,right:i,bottom:i,left:i}}function ie(i){const{x:e,y:t,width:l,height:o}=i;return{width:l,height:o,top:t,left:e,right:e+l,bottom:t+o,x:e,y:t}}function Te(i,e,t){let{reference:l,floating:o}=i;const s=D(e),n=Se(e),r=Ae(n),a=R(e),c=s==="y",p=l.x+l.width/2-o.width/2,d=l.y+l.height/2-o.height/2,m=l[r]/2-o[r]/2;let u;switch(a){case"top":u={x:p,y:l.y-o.height};break;case"bottom":u={x:p,y:l.y+l.height};break;case"right":u={x:l.x+l.width,y:d};break;case"left":u={x:l.x-o.width,y:d};break;default:u={x:l.x,y:l.y}}switch(ee(e)){case"start":u[n]-=m*(t&&c?-1:1);break;case"end":u[n]+=m*(t&&c?-1:1);break}return u}const st=async(i,e,t)=>{const{placement:l="bottom",strategy:o="absolute",middleware:s=[],platform:n}=t,r=s.filter(Boolean),a=await(n.isRTL==null?void 0:n.isRTL(e));let c=await n.getElementRects({reference:i,floating:e,strategy:o}),{x:p,y:d}=Te(c,l,a),m=l,u={},g=0;for(let v=0;v<r.length;v++){const{name:w,fn:b}=r[v],{x:_,y,data:k,reset:x}=await b({x:p,y:d,initialPlacement:l,placement:m,strategy:o,middlewareData:u,rects:c,platform:n,elements:{reference:i,floating:e}});p=_??p,d=y??d,u={...u,[w]:{...u[w],...k}},x&&g<=50&&(g++,typeof x=="object"&&(x.placement&&(m=x.placement),x.rects&&(c=x.rects===!0?await n.getElementRects({reference:i,floating:e,strategy:o}):x.rects),{x:p,y:d}=Te(c,m,a)),v=-1)}return{x:p,y:d,placement:m,strategy:o,middlewareData:u}};async function Me(i,e){var t;e===void 0&&(e={});const{x:l,y:o,platform:s,rects:n,elements:r,strategy:a}=i,{boundary:c="clippingAncestors",rootBoundary:p="viewport",elementContext:d="floating",altBoundary:m=!1,padding:u=0}=Q(e,i),g=ot(u),w=r[m?d==="floating"?"reference":"floating":d],b=ie(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(w)))==null||t?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(r.floating)),boundary:c,rootBoundary:p,strategy:a})),_=d==="floating"?{x:l,y:o,width:n.floating.width,height:n.floating.height}:n.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(r.floating)),k=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},x=ie(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:r,rect:_,offsetParent:y,strategy:a}):_);return{top:(b.top-x.top+g.top)/k.y,bottom:(x.bottom-b.bottom+g.bottom)/k.y,left:(b.left-x.left+g.left)/k.x,right:(x.right-b.right+g.right)/k.x}}const nt=function(i){return i===void 0&&(i={}),{name:"flip",options:i,async fn(e){var t,l;const{placement:o,middlewareData:s,rects:n,initialPlacement:r,platform:a,elements:c}=e,{mainAxis:p=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...w}=Q(i,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const b=R(o),_=D(r),y=R(r)===r,k=await(a.isRTL==null?void 0:a.isRTL(c.floating)),x=m||(y||!v?[te(r)]:Ze(r)),X=g!=="none";!m&&X&&x.push(...it(r,v,g,k));const G=[r,...x],ye=await Me(e,w),pe=[];let K=((l=s.flip)==null?void 0:l.overflows)||[];if(p&&pe.push(ye[b]),d){const F=qe(o,n,k);pe.push(ye[F[0]],ye[F[1]])}if(K=[...K,{placement:o,overflows:pe}],!pe.every(F=>F<=0)){var Ge,Ke;const F=(((Ge=s.flip)==null?void 0:Ge.index)||0)+1,xe=G[F];if(xe&&(!(d==="alignment"?_!==D(xe):!1)||K.every(M=>D(M.placement)===_?M.overflows[0]>0:!0)))return{data:{index:F,overflows:K},reset:{placement:xe}};let J=(Ke=K.filter(B=>B.overflows[0]<=0).sort((B,M)=>B.overflows[1]-M.overflows[1])[0])==null?void 0:Ke.placement;if(!J)switch(u){case"bestFit":{var Ue;const B=(Ue=K.filter(M=>{if(X){const z=D(M.placement);return z===_||z==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(z=>z>0).reduce((z,Rt)=>z+Rt,0)]).sort((M,z)=>M[1]-z[1])[0])==null?void 0:Ue[0];B&&(J=B);break}case"initialPlacement":J=r;break}if(o!==J)return{reset:{placement:J}}}return{}}}},rt=new Set(["left","top"]);async function at(i,e){const{placement:t,platform:l,elements:o}=i,s=await(l.isRTL==null?void 0:l.isRTL(o.floating)),n=R(t),r=ee(t),a=D(t)==="y",c=rt.has(n)?-1:1,p=s&&a?-1:1,d=Q(e,i);let{mainAxis:m,crossAxis:u,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return r&&typeof g=="number"&&(u=r==="end"?g*-1:g),a?{x:u*p,y:m*c}:{x:m*c,y:u*p}}const ct=function(i){return i===void 0&&(i=0),{name:"offset",options:i,async fn(e){var t,l;const{x:o,y:s,placement:n,middlewareData:r}=e,a=await at(e,i);return n===((t=r.offset)==null?void 0:t.placement)&&(l=r.arrow)!=null&&l.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:n}}}}},dt=function(i){return i===void 0&&(i={}),{name:"shift",options:i,async fn(e){const{x:t,y:l,placement:o}=e,{mainAxis:s=!0,crossAxis:n=!1,limiter:r={fn:w=>{let{x:b,y:_}=w;return{x:b,y:_}}},...a}=Q(i,e),c={x:t,y:l},p=await Me(e,a),d=D(R(o)),m=ke(d);let u=c[m],g=c[d];if(s){const w=m==="y"?"top":"left",b=m==="y"?"bottom":"right",_=u+p[w],y=u-p[b];u=Ce(_,u,y)}if(n){const w=d==="y"?"top":"left",b=d==="y"?"bottom":"right",_=g+p[w],y=g-p[b];g=Ce(_,g,y)}const v=r.fn({...e,[m]:u,[d]:g});return{...v,data:{x:v.x-t,y:v.y-l,enabled:{[m]:s,[d]:n}}}}}};function le(){return typeof window<"u"}function H(i){return Ie(i)?(i.nodeName||"").toLowerCase():"#document"}function S(i){var e;return(i==null||(e=i.ownerDocument)==null?void 0:e.defaultView)||window}function E(i){var e;return(e=(Ie(i)?i.ownerDocument:i.document)||window.document)==null?void 0:e.documentElement}function Ie(i){return le()?i instanceof Node||i instanceof S(i).Node:!1}function O(i){return le()?i instanceof Element||i instanceof S(i).Element:!1}function V(i){return le()?i instanceof HTMLElement||i instanceof S(i).HTMLElement:!1}function Ee(i){return!le()||typeof ShadowRoot>"u"?!1:i instanceof ShadowRoot||i instanceof S(i).ShadowRoot}const pt=new Set(["inline","contents"]);function U(i){const{overflow:e,overflowX:t,overflowY:l,display:o}=T(i);return/auto|scroll|overlay|hidden|clip/.test(e+l+t)&&!pt.has(o)}const ht=new Set(["table","td","th"]);function ut(i){return ht.has(H(i))}const mt=[":popover-open",":modal"];function oe(i){return mt.some(e=>{try{return i.matches(e)}catch{return!1}})}const ft=["transform","translate","scale","rotate","perspective"],gt=["transform","translate","scale","rotate","perspective","filter"],bt=["paint","layout","strict","content"];function ue(i){const e=me(),t=O(i)?T(i):i;return ft.some(l=>t[l]?t[l]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||gt.some(l=>(t.willChange||"").includes(l))||bt.some(l=>(t.contain||"").includes(l))}function vt(i){let e=$(i);for(;V(e)&&!j(e);){if(ue(e))return e;if(oe(e))return null;e=$(e)}return null}function me(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const wt=new Set(["html","body","#document"]);function j(i){return wt.has(H(i))}function T(i){return S(i).getComputedStyle(i)}function se(i){return O(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:{scrollLeft:i.scrollX,scrollTop:i.scrollY}}function $(i){if(H(i)==="html")return i;const e=i.assignedSlot||i.parentNode||Ee(i)&&i.host||E(i);return Ee(e)?e.host:e}function Ve(i){const e=$(i);return j(e)?i.ownerDocument?i.ownerDocument.body:i.body:V(e)&&U(e)?e:Ve(e)}function Y(i,e,t){var l;e===void 0&&(e=[]),t===void 0&&(t=!0);const o=Ve(i),s=o===((l=i.ownerDocument)==null?void 0:l.body),n=S(o);if(s){const r=fe(n);return e.concat(n,n.visualViewport||[],U(o)?o:[],r&&t?Y(r):[])}return e.concat(o,Y(o,[],t))}function fe(i){return i.parent&&Object.getPrototypeOf(i.parent)?i.frameElement:null}function De(i){const e=T(i);let t=parseFloat(e.width)||0,l=parseFloat(e.height)||0;const o=V(i),s=o?i.offsetWidth:t,n=o?i.offsetHeight:l,r=q(t)!==s||q(l)!==n;return r&&(t=s,l=n),{width:t,height:l,$:r}}function ge(i){return O(i)?i:i.contextElement}function W(i){const e=ge(i);if(!V(e))return I(1);const t=e.getBoundingClientRect(),{width:l,height:o,$:s}=De(e);let n=(s?q(t.width):t.width)/l,r=(s?q(t.height):t.height)/o;return(!n||!Number.isFinite(n))&&(n=1),(!r||!Number.isFinite(r))&&(r=1),{x:n,y:r}}const _t=I(0);function $e(i){const e=S(i);return!me()||!e.visualViewport?_t:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function yt(i,e,t){return e===void 0&&(e=!1),!t||e&&t!==S(i)?!1:e}function N(i,e,t,l){e===void 0&&(e=!1),t===void 0&&(t=!1);const o=i.getBoundingClientRect(),s=ge(i);let n=I(1);e&&(l?O(l)&&(n=W(l)):n=W(i));const r=yt(s,t,l)?$e(s):I(0);let a=(o.left+r.x)/n.x,c=(o.top+r.y)/n.y,p=o.width/n.x,d=o.height/n.y;if(s){const m=S(s),u=l&&O(l)?S(l):l;let g=m,v=fe(g);for(;v&&l&&u!==g;){const w=W(v),b=v.getBoundingClientRect(),_=T(v),y=b.left+(v.clientLeft+parseFloat(_.paddingLeft))*w.x,k=b.top+(v.clientTop+parseFloat(_.paddingTop))*w.y;a*=w.x,c*=w.y,p*=w.x,d*=w.y,a+=y,c+=k,g=S(v),v=fe(g)}}return ie({width:p,height:d,x:a,y:c})}function ne(i,e){const t=se(i).scrollLeft;return e?e.left+t:N(E(i)).left+t}function Le(i,e){const t=i.getBoundingClientRect(),l=t.left+e.scrollLeft-ne(i,t),o=t.top+e.scrollTop;return{x:l,y:o}}function xt(i){let{elements:e,rect:t,offsetParent:l,strategy:o}=i;const s=o==="fixed",n=E(l),r=e?oe(e.floating):!1;if(l===n||r&&s)return t;let a={scrollLeft:0,scrollTop:0},c=I(1);const p=I(0),d=V(l);if((d||!d&&!s)&&((H(l)!=="body"||U(n))&&(a=se(l)),V(l))){const u=N(l);c=W(l),p.x=u.x+l.clientLeft,p.y=u.y+l.clientTop}const m=n&&!d&&!s?Le(n,a):I(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-a.scrollLeft*c.x+p.x+m.x,y:t.y*c.y-a.scrollTop*c.y+p.y+m.y}}function Ct(i){return Array.from(i.getClientRects())}function kt(i){const e=E(i),t=se(i),l=i.ownerDocument.body,o=P(e.scrollWidth,e.clientWidth,l.scrollWidth,l.clientWidth),s=P(e.scrollHeight,e.clientHeight,l.scrollHeight,l.clientHeight);let n=-t.scrollLeft+ne(i);const r=-t.scrollTop;return T(l).direction==="rtl"&&(n+=P(e.clientWidth,l.clientWidth)-o),{width:o,height:s,x:n,y:r}}const ze=25;function At(i,e){const t=S(i),l=E(i),o=t.visualViewport;let s=l.clientWidth,n=l.clientHeight,r=0,a=0;if(o){s=o.width,n=o.height;const p=me();(!p||p&&e==="fixed")&&(r=o.offsetLeft,a=o.offsetTop)}const c=ne(l);if(c<=0){const p=l.ownerDocument,d=p.body,m=getComputedStyle(d),u=p.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,g=Math.abs(l.clientWidth-d.clientWidth-u);g<=ze&&(s-=g)}else c<=ze&&(s+=c);return{width:s,height:n,x:r,y:a}}const St=new Set(["absolute","fixed"]);function Pt(i,e){const t=N(i,!0,e==="fixed"),l=t.top+i.clientTop,o=t.left+i.clientLeft,s=V(i)?W(i):I(1),n=i.clientWidth*s.x,r=i.clientHeight*s.y,a=o*s.x,c=l*s.y;return{width:n,height:r,x:a,y:c}}function Re(i,e,t){let l;if(e==="viewport")l=At(i,t);else if(e==="document")l=kt(E(i));else if(O(e))l=Pt(e,t);else{const o=$e(i);l={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return ie(l)}function Ne(i,e){const t=$(i);return t===e||!O(t)||j(t)?!1:T(t).position==="fixed"||Ne(t,e)}function Ot(i,e){const t=e.get(i);if(t)return t;let l=Y(i,[],!1).filter(r=>O(r)&&H(r)!=="body"),o=null;const s=T(i).position==="fixed";let n=s?$(i):i;for(;O(n)&&!j(n);){const r=T(n),a=ue(n);!a&&r.position==="fixed"&&(o=null),(s?!a&&!o:!a&&r.position==="static"&&!!o&&St.has(o.position)||U(n)&&!a&&Ne(i,n))?l=l.filter(p=>p!==n):o=r,n=$(n)}return e.set(i,l),l}function Tt(i){let{element:e,boundary:t,rootBoundary:l,strategy:o}=i;const n=[...t==="clippingAncestors"?oe(e)?[]:Ot(e,this._c):[].concat(t),l],r=n[0],a=n.reduce((c,p)=>{const d=Re(e,p,o);return c.top=P(d.top,c.top),c.right=C(d.right,c.right),c.bottom=C(d.bottom,c.bottom),c.left=P(d.left,c.left),c},Re(e,r,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Mt(i){const{width:e,height:t}=De(i);return{width:e,height:t}}function It(i,e,t){const l=V(e),o=E(e),s=t==="fixed",n=N(i,!0,s,e);let r={scrollLeft:0,scrollTop:0};const a=I(0);function c(){a.x=ne(o)}if(l||!l&&!s)if((H(e)!=="body"||U(o))&&(r=se(e)),l){const u=N(e,!0,s,e);a.x=u.x+e.clientLeft,a.y=u.y+e.clientTop}else o&&c();s&&!l&&o&&c();const p=o&&!l&&!s?Le(o,r):I(0),d=n.left+r.scrollLeft-a.x-p.x,m=n.top+r.scrollTop-a.y-p.y;return{x:d,y:m,width:n.width,height:n.height}}function be(i){return T(i).position==="static"}function Fe(i,e){if(!V(i)||T(i).position==="fixed")return null;if(e)return e(i);let t=i.offsetParent;return E(i)===t&&(t=t.ownerDocument.body),t}function Be(i,e){const t=S(i);if(oe(i))return t;if(!V(i)){let o=$(i);for(;o&&!j(o);){if(O(o)&&!be(o))return o;o=$(o)}return t}let l=Fe(i,e);for(;l&&ut(l)&&be(l);)l=Fe(l,e);return l&&j(l)&&be(l)&&!ue(l)?t:l||vt(i)||t}const Et=async function(i){const e=this.getOffsetParent||Be,t=this.getDimensions,l=await t(i.floating);return{reference:It(i.reference,await e(i.floating),i.strategy),floating:{x:0,y:0,width:l.width,height:l.height}}};function Vt(i){return T(i).direction==="rtl"}const Dt={convertOffsetParentRelativeRectToViewportRelativeRect:xt,getDocumentElement:E,getClippingRect:Tt,getOffsetParent:Be,getElementRects:Et,getClientRects:Ct,getDimensions:Mt,getScale:W,isElement:O,isRTL:Vt};function He(i,e){return i.x===e.x&&i.y===e.y&&i.width===e.width&&i.height===e.height}function $t(i,e){let t=null,l;const o=E(i);function s(){var r;clearTimeout(l),(r=t)==null||r.disconnect(),t=null}function n(r,a){r===void 0&&(r=!1),a===void 0&&(a=1),s();const c=i.getBoundingClientRect(),{left:p,top:d,width:m,height:u}=c;if(r||e(),!m||!u)return;const g=Z(d),v=Z(o.clientWidth-(p+m)),w=Z(o.clientHeight-(d+u)),b=Z(p),y={rootMargin:-g+"px "+-v+"px "+-w+"px "+-b+"px",threshold:P(0,C(1,a))||1};let k=!0;function x(X){const G=X[0].intersectionRatio;if(G!==a){if(!k)return n();G?n(!1,G):l=setTimeout(()=>{n(!1,1e-7)},1e3)}G===1&&!He(c,i.getBoundingClientRect())&&n(),k=!1}try{t=new IntersectionObserver(x,{...y,root:o.ownerDocument})}catch{t=new IntersectionObserver(x,y)}t.observe(i)}return n(!0),s}function re(i,e,t,l){l===void 0&&(l={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:r=typeof IntersectionObserver=="function",animationFrame:a=!1}=l,c=ge(i),p=o||s?[...c?Y(c):[],...Y(e)]:[];p.forEach(b=>{o&&b.addEventListener("scroll",t,{passive:!0}),s&&b.addEventListener("resize",t)});const d=c&&r?$t(c,t):null;let m=-1,u=null;n&&(u=new ResizeObserver(b=>{let[_]=b;_&&_.target===c&&u&&(u.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=u)==null||y.observe(e)})),t()}),c&&!a&&u.observe(c),u.observe(e));let g,v=a?N(i):null;a&&w();function w(){const b=N(i);v&&!He(v,b)&&t(),v=b,g=requestAnimationFrame(w)}return t(),()=>{var b;p.forEach(_=>{o&&_.removeEventListener("scroll",t),s&&_.removeEventListener("resize",t)}),d==null||d(),(b=u)==null||b.disconnect(),u=null,a&&cancelAnimationFrame(g)}}const ae=ct,ce=dt,ve=nt,de=(i,e,t)=>{const l=new Map,o={platform:Dt,...t},s={...o.platform,_c:l};return st(i,e,{...o,platform:s})};let L=0;const f={debug:(i,...e)=>{L++,console.log(`%c[MultiSelect ${L}]%c ${i}`,"color: #0ea5e9; font-weight: bold;","color: inherit;",...e)},info:(i,...e)=>{L++,console.info(`%c[MultiSelect ${L}]%c ${i}`,"color: #10b981; font-weight: bold;","color: inherit;",...e)},warn:(i,...e)=>{L++,console.warn(`%c[MultiSelect ${L}]%c ${i}`,"color: #f59e0b; font-weight: bold;","color: inherit;",...e)},error:(i,...e)=>{L++,console.error(`%c[MultiSelect ${L}]%c ${i}`,"color: #ef4444; font-weight: bold;","color: inherit;",...e)}};class je{constructor(e,t={}){h(this,"element");h(this,"instanceId");h(this,"options");h(this,"isOpen",!1);h(this,"selectedValues",new Set);h(this,"selectedOptions",new Map);h(this,"allOptions",[]);h(this,"filteredOptions",[]);h(this,"hiddenInputs",[]);h(this,"focusedIndex",-1);h(this,"searchTerm","");h(this,"isLoading",!1);h(this,"showSelectedPopover",!1);h(this,"selectedPopoverPlacement",null);h(this,"dropdownPlacement",null);h(this,"isRTL",!1);h(this,"effectivePillsPosition","bottom");h(this,"justClosedViaClick",!1);h(this,"dropdownCleanup",null);h(this,"hintCleanup",null);h(this,"selectedPopoverCleanup",null);h(this,"pillTooltips",new Map);h(this,"pillTooltipCleanups",new Map);h(this,"input");h(this,"dropdown");h(this,"pillsContainer");h(this,"countBadge");h(this,"hint");h(this,"selectedPopover");this.element=e,this.instanceId=`MS-${Math.random().toString(36).substr(2,9)}`,this.options={searchHint:e.dataset.searchHint||"",searchPlaceholder:e.dataset.searchPlaceholder||"Search...",dropdownMinWidth:e.dataset.dropdownMinWidth||void 0,pillsDisplayMode:e.dataset.pillsDisplayMode||"pills",pillsPosition:e.dataset.pillsPosition||"bottom",pillsThresholdMode:e.dataset.pillsThresholdMode||"count",maxHeight:e.dataset.maxHeight||"20rem",emptyMessage:e.dataset.emptyMessage||"No results found",loadingMessage:e.dataset.loadingMessage||"Loading...",searchInputMode:e.dataset.searchInputMode||"normal",pillsThreshold:e.dataset.pillsThreshold?parseInt(e.dataset.pillsThreshold):void 0,minSearchLength:parseInt(e.dataset.minSearchLength||"0")||0,isMultipleEnabled:e.dataset.multiple!=="false",isGroupsAllowed:e.dataset.allowGroups!=="false",isSelectAllAllowed:e.dataset.allowSelectAll!=="false",isClearAllAllowed:e.dataset.allowClearAll!=="false",isCheckboxesShown:e.dataset.showCheckboxes!=="false",isActionsSticky:e.dataset.stickyActions!=="false",isCloseOnSelect:e.dataset.closeOnSelect==="true",isPlacementLocked:e.dataset.lockPlacement!=="false",isSearchEnabled:e.dataset.enableSearch!=="false",isAddNewAllowed:e.dataset.allowAddNew==="true",isCountBadgeShown:e.dataset.showCountBadge==="true",options:[],container:void 0,...t},this.init()}getItemValue(e){return Array.isArray(e)&&e.length===2?e[0]:this.options.valueMember&&e[this.options.valueMember]!==void 0?e[this.options.valueMember]:this.options.getValueCallback?this.options.getValueCallback(e):"[N/A]"}getItemDisplayValue(e){return Array.isArray(e)&&e.length===2?String(e[1]):this.options.displayValueMember&&e[this.options.displayValueMember]!==void 0?String(e[this.options.displayValueMember]):this.options.getDisplayValueCallback?this.options.getDisplayValueCallback(e):"[N/A]"}getItemSearchValue(e){return this.options.searchValueMember&&e[this.options.searchValueMember]!==void 0?String(e[this.options.searchValueMember]):this.options.getSearchValueCallback?this.options.getSearchValueCallback(e):this.getItemDisplayValue(e)}getItemIcon(e){if(!Array.isArray(e)){if(this.options.iconMember&&e[this.options.iconMember]!==void 0)return String(e[this.options.iconMember]);if(this.options.getIconCallback)return this.options.getIconCallback(e)}}getItemSubtitle(e){if(!Array.isArray(e)){if(this.options.subtitleMember&&e[this.options.subtitleMember]!==void 0)return String(e[this.options.subtitleMember]);if(this.options.getSubtitleCallback)return this.options.getSubtitleCallback(e)}}getItemGroup(e){if(!Array.isArray(e)){if(this.options.groupMember&&e[this.options.groupMember]!==void 0)return String(e[this.options.groupMember]);if(this.options.getGroupCallback)return this.options.getGroupCallback(e)}}getItemDisabled(e){return Array.isArray(e)?!1:this.options.disabledMember&&e[this.options.disabledMember]!==void 0?!!e[this.options.disabledMember]:this.options.getDisabledCallback?this.options.getDisabledCallback(e):!1}init(){this.parseOptions(),this.buildHTML(),this.attachEvents(),this.parseInitialSelection(),f.debug(`Initialized [${this.instanceId}] with options:`,{placeholder:this.options.searchPlaceholder,totalOptions:this.allOptions.length,isCloseOnSelect:this.options.isCloseOnSelect,dataAttribute:this.element.dataset.closeOnSelect,isSelectAllAllowed:this.options.isSelectAllAllowed,isClearAllAllowed:this.options.isClearAllAllowed})}parseOptions(){const e=this.element.dataset.options;if(e)try{this.allOptions=JSON.parse(e)}catch(t){console.error("[MultiSelect] Failed to parse data-options:",t),this.allOptions=[]}else this.options.options&&(this.allOptions=this.options.options);this.filteredOptions=[...this.allOptions]}buildHTML(){const e=this.options.container||document.body,t=this.element.getRootNode(),l=t instanceof ShadowRoot?t.host:this.element,o=l.getAttribute("dir")==="rtl",s=l.closest('[dir="rtl"]')!==null;this.isRTL=o||s,console.log("[MultiSelect RTL Debug]",{isShadowRoot:t instanceof ShadowRoot,hostElement:l,elementDir:l.getAttribute("dir"),hasElementDir:o,hasAncestorDir:s,isRTL:this.isRTL}),this.effectivePillsPosition=this.options.pillsPosition||"bottom",this.isRTL&&(this.effectivePillsPosition==="left"?this.effectivePillsPosition="right":this.effectivePillsPosition==="right"&&(this.effectivePillsPosition="left")),this.element.classList.add("ml"),this.isRTL&&(this.element.classList.add("ml--rtl"),console.log("[MultiSelect RTL] Added ml--rtl class to element")),(!this.options.isCheckboxesShown||!this.options.isMultipleEnabled)&&this.element.classList.add("ml--no-checkboxes");const n=document.createElement("div");n.className="ml__input-wrapper",this.input=document.createElement("input"),this.input.type="text",this.input.className="ml__input",this.input.placeholder=this.options.searchPlaceholder,this.input.autocomplete="off",this.options.searchInputMode==="readonly"?this.input.readOnly=!0:this.options.searchInputMode==="hidden"&&(this.input.style.display="none");const r=document.createElement("span");r.className="ml__toggle",r.innerHTML="▼",this.countBadge=document.createElement("span"),this.countBadge.className="ml__count-badge",this.countBadge.style.display="none",n.appendChild(this.input),n.appendChild(this.countBadge),n.appendChild(r),this.pillsContainer=document.createElement("div"),this.pillsContainer.className="ml__pills";const a=document.createElement("div");a.className="ml-wrapper",(this.effectivePillsPosition==="left"||this.effectivePillsPosition==="right")&&a.classList.add("ml-wrapper--inline"),a.appendChild(n),a.appendChild(this.pillsContainer),this.element.appendChild(a),this.dropdown=document.createElement("div"),this.dropdown.className="ml__dropdown",e.appendChild(this.dropdown),this.options.searchHint&&(this.hint=document.createElement("div"),this.hint.className="ml__hint",this.hint.textContent=this.options.searchHint,e.appendChild(this.hint)),this.selectedPopover=document.createElement("div"),this.selectedPopover.className="ml__selected-popover",e.appendChild(this.selectedPopover),this.renderDropdown()}renderDropdown(){let e="";if(this.isLoading){e+='<div class="ml__loader">',e+='<div class="pa-loader pa-loader--sm"></div>',e+=`<div class="ml__loading-text">${this.options.loadingMessage}</div>`,e+="</div>",this.dropdown.innerHTML=e;return}if(this.options.isMultipleEnabled&&(this.options.isSelectAllAllowed||this.options.isClearAllAllowed)){const t=this.options.isActionsSticky?" ml__actions--sticky":"";e+=`<div class="ml__actions${t}">`,this.options.isSelectAllAllowed&&(e+='<button type="button" class="ml__action-btn" data-action="select-all">Select All</button>'),this.options.isClearAllAllowed&&(e+='<button type="button" class="ml__action-btn" data-action="clear-all">Clear All</button>'),e+="</div>"}if(e+='<div class="ml__options">',this.filteredOptions.length===0)e+=`<div class="ml__empty">${this.options.emptyMessage}</div>`;else if(this.options.isGroupsAllowed){const t=this.groupOptions(this.filteredOptions);Object.keys(t).forEach(l=>{e+='<div class="ml__group">',l!=="__ungrouped__"&&(e+=`<div class="ml__group-label">${l}</div>`),t[l].forEach((o,s)=>{e+=this.renderOption(o,s)}),e+="</div>"})}else this.filteredOptions.forEach((t,l)=>{e+=this.renderOption(t,l)});e+="</div>",this.dropdown.innerHTML=e}renderOption(e,t){const l=this.getItemValue(e),o=this.getItemDisplayValue(e),s=this.getItemIcon(e),n=this.getItemSubtitle(e),r=this.getItemDisabled(e),a=this.selectedValues.has(String(l)),c=t===this.focusedIndex,p=["ml__option"];a&&p.push("ml__option--selected"),c&&p.push("ml__option--focused"),r&&p.push("ml__option--disabled");let d=`<div class="${p.join(" ")}" data-value="${l}" data-index="${t}">`;return this.options.isCheckboxesShown&&this.options.isMultipleEnabled&&(d+=`<input type="checkbox" class="ml__checkbox" ${a?"checked":""} ${r?"disabled":""}>`),d+='<div class="ml__option-content">',s&&(d+=`<span class="ml__option-icon">${s}</span>`),d+='<div class="ml__option-text">',d+=`<div class="ml__option-title">${this.highlightMatch(o,this.searchTerm)}</div>`,n&&(d+=`<div class="ml__option-subtitle">${n}</div>`),d+="</div>",d+="</div>",d+="</div>",d}highlightMatch(e,t){if(!t)return e;const l=new RegExp(`(${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return e.replace(l,"<mark>$1</mark>")}groupOptions(e){const t={};return e.forEach(l=>{const o=this.getItemGroup(l)||"__ungrouped__";t[o]||(t[o]=[]),t[o].push(l)}),t}renderPills(){this.destroyAllPillTooltips();const e=Array.from(this.selectedOptions.values()),t=this.selectedValues.size;if(!this.options.isMultipleEnabled){this.pillsContainer.innerHTML="",this.countBadge.style.display="none";const s=e[0]?this.getItemDisplayValue(e[0]):void 0;f.warn(`[${this.instanceId}] renderPills() single-select mode`,{isOpen:this.isOpen,count:t,selectedOptionsLength:e.length,willSetValue:!this.isOpen&&t>0&&e.length>0,selectedLabel:s}),!this.isOpen&&t>0&&e.length>0?(f.info(`[${this.instanceId}] ✅ SETTING input.value = "${s}"`),this.input.value=s,f.info(`[${this.instanceId}] 🔍 VERIFY input.value = "${this.input.value}"`)):this.isOpen?f.info(`[${this.instanceId}] ⏭️ SKIPPING input update (dropdown is open)`):(f.info(`[${this.instanceId}] ❌ CLEARING input.value (no selection)`),this.input.value="");return}let l=this.options.pillsDisplayMode;if(this.options.pillsThreshold!==null&&t>this.options.pillsThreshold&&(l=this.options.pillsThresholdMode||"count"),!this.isOpen)if(t>0&&l==="count"){const s=this.options.getCountPillCallback?this.options.getCountPillCallback(t):`${t} selected`;this.input.placeholder=s}else this.input.placeholder=this.options.searchPlaceholder;if(this.options.isCountBadgeShown&&t>0?(this.countBadge.textContent=`[${t}]`,this.countBadge.style.display=""):this.countBadge.style.display="none",l==="pills")this.pillsContainer.className=`ml__pills ml__pills--${this.effectivePillsPosition}`,this.pillsContainer.innerHTML=e.map(s=>{const n=this.getItemValue(s),r=this.getItemDisplayValue(s);return`
|
|
1
|
+
(function(P,C){typeof exports=="object"&&typeof module<"u"?C(exports):typeof define=="function"&&define.amd?define(["exports"],C):(P=typeof globalThis<"u"?globalThis:P||self,C(P.MultiSelect={}))})(this,function(P){"use strict";var Nt=Object.defineProperty;var Ft=(P,C,S)=>C in P?Nt(P,C,{enumerable:!0,configurable:!0,writable:!0,value:S}):P[C]=S;var h=(P,C,S)=>Ft(P,typeof C!="symbol"?C+"":C,S);const C=Math.min,S=Math.max,q=Math.round,Z=Math.floor,I=i=>({x:i,y:i}),Ye={left:"right",right:"left",bottom:"top",top:"bottom"},Xe={start:"end",end:"start"};function Ce(i,e,t){return S(i,C(e,t))}function Q(i,e){return typeof i=="function"?i(e):i}function R(i){return i.split("-")[0]}function ee(i){return i.split("-")[1]}function ke(i){return i==="x"?"y":"x"}function Pe(i){return i==="y"?"height":"width"}const Je=new Set(["top","bottom"]);function D(i){return Je.has(R(i))?"y":"x"}function Ae(i){return ke(D(i))}function qe(i,e,t){t===void 0&&(t=!1);const l=ee(i),o=Ae(i),s=Pe(o);let n=o==="x"?l===(t?"end":"start")?"right":"left":l==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(n=te(n)),[n,te(n)]}function Ze(i){const e=te(i);return[he(i),e,he(e)]}function he(i){return i.replace(/start|end/g,e=>Xe[e])}const Se=["left","right"],Oe=["right","left"],Qe=["top","bottom"],et=["bottom","top"];function tt(i,e,t){switch(i){case"top":case"bottom":return t?e?Oe:Se:e?Se:Oe;case"left":case"right":return e?Qe:et;default:return[]}}function it(i,e,t,l){const o=ee(i);let s=tt(R(i),t==="start",l);return o&&(s=s.map(n=>n+"-"+o),e&&(s=s.concat(s.map(he)))),s}function te(i){return i.replace(/left|right|bottom|top/g,e=>Ye[e])}function lt(i){return{top:0,right:0,bottom:0,left:0,...i}}function ot(i){return typeof i!="number"?lt(i):{top:i,right:i,bottom:i,left:i}}function ie(i){const{x:e,y:t,width:l,height:o}=i;return{width:l,height:o,top:t,left:e,right:e+l,bottom:t+o,x:e,y:t}}function Te(i,e,t){let{reference:l,floating:o}=i;const s=D(e),n=Ae(e),r=Pe(n),a=R(e),c=s==="y",p=l.x+l.width/2-o.width/2,d=l.y+l.height/2-o.height/2,m=l[r]/2-o[r]/2;let u;switch(a){case"top":u={x:p,y:l.y-o.height};break;case"bottom":u={x:p,y:l.y+l.height};break;case"right":u={x:l.x+l.width,y:d};break;case"left":u={x:l.x-o.width,y:d};break;default:u={x:l.x,y:l.y}}switch(ee(e)){case"start":u[n]-=m*(t&&c?-1:1);break;case"end":u[n]+=m*(t&&c?-1:1);break}return u}const st=async(i,e,t)=>{const{placement:l="bottom",strategy:o="absolute",middleware:s=[],platform:n}=t,r=s.filter(Boolean),a=await(n.isRTL==null?void 0:n.isRTL(e));let c=await n.getElementRects({reference:i,floating:e,strategy:o}),{x:p,y:d}=Te(c,l,a),m=l,u={},g=0;for(let v=0;v<r.length;v++){const{name:w,fn:b}=r[v],{x:_,y,data:k,reset:x}=await b({x:p,y:d,initialPlacement:l,placement:m,strategy:o,middlewareData:u,rects:c,platform:n,elements:{reference:i,floating:e}});p=_??p,d=y??d,u={...u,[w]:{...u[w],...k}},x&&g<=50&&(g++,typeof x=="object"&&(x.placement&&(m=x.placement),x.rects&&(c=x.rects===!0?await n.getElementRects({reference:i,floating:e,strategy:o}):x.rects),{x:p,y:d}=Te(c,m,a)),v=-1)}return{x:p,y:d,placement:m,strategy:o,middlewareData:u}};async function Me(i,e){var t;e===void 0&&(e={});const{x:l,y:o,platform:s,rects:n,elements:r,strategy:a}=i,{boundary:c="clippingAncestors",rootBoundary:p="viewport",elementContext:d="floating",altBoundary:m=!1,padding:u=0}=Q(e,i),g=ot(u),w=r[m?d==="floating"?"reference":"floating":d],b=ie(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(w)))==null||t?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(r.floating)),boundary:c,rootBoundary:p,strategy:a})),_=d==="floating"?{x:l,y:o,width:n.floating.width,height:n.floating.height}:n.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(r.floating)),k=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},x=ie(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:r,rect:_,offsetParent:y,strategy:a}):_);return{top:(b.top-x.top+g.top)/k.y,bottom:(x.bottom-b.bottom+g.bottom)/k.y,left:(b.left-x.left+g.left)/k.x,right:(x.right-b.right+g.right)/k.x}}const nt=function(i){return i===void 0&&(i={}),{name:"flip",options:i,async fn(e){var t,l;const{placement:o,middlewareData:s,rects:n,initialPlacement:r,platform:a,elements:c}=e,{mainAxis:p=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...w}=Q(i,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const b=R(o),_=D(r),y=R(r)===r,k=await(a.isRTL==null?void 0:a.isRTL(c.floating)),x=m||(y||!v?[te(r)]:Ze(r)),X=g!=="none";!m&&X&&x.push(...it(r,v,g,k));const G=[r,...x],ye=await Me(e,w),pe=[];let K=((l=s.flip)==null?void 0:l.overflows)||[];if(p&&pe.push(ye[b]),d){const F=qe(o,n,k);pe.push(ye[F[0]],ye[F[1]])}if(K=[...K,{placement:o,overflows:pe}],!pe.every(F=>F<=0)){var Ge,Ke;const F=(((Ge=s.flip)==null?void 0:Ge.index)||0)+1,xe=G[F];if(xe&&(!(d==="alignment"?_!==D(xe):!1)||K.every(M=>D(M.placement)===_?M.overflows[0]>0:!0)))return{data:{index:F,overflows:K},reset:{placement:xe}};let J=(Ke=K.filter(B=>B.overflows[0]<=0).sort((B,M)=>B.overflows[1]-M.overflows[1])[0])==null?void 0:Ke.placement;if(!J)switch(u){case"bestFit":{var Ue;const B=(Ue=K.filter(M=>{if(X){const z=D(M.placement);return z===_||z==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(z=>z>0).reduce((z,Rt)=>z+Rt,0)]).sort((M,z)=>M[1]-z[1])[0])==null?void 0:Ue[0];B&&(J=B);break}case"initialPlacement":J=r;break}if(o!==J)return{reset:{placement:J}}}return{}}}},rt=new Set(["left","top"]);async function at(i,e){const{placement:t,platform:l,elements:o}=i,s=await(l.isRTL==null?void 0:l.isRTL(o.floating)),n=R(t),r=ee(t),a=D(t)==="y",c=rt.has(n)?-1:1,p=s&&a?-1:1,d=Q(e,i);let{mainAxis:m,crossAxis:u,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return r&&typeof g=="number"&&(u=r==="end"?g*-1:g),a?{x:u*p,y:m*c}:{x:m*c,y:u*p}}const ct=function(i){return i===void 0&&(i=0),{name:"offset",options:i,async fn(e){var t,l;const{x:o,y:s,placement:n,middlewareData:r}=e,a=await at(e,i);return n===((t=r.offset)==null?void 0:t.placement)&&(l=r.arrow)!=null&&l.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:n}}}}},dt=function(i){return i===void 0&&(i={}),{name:"shift",options:i,async fn(e){const{x:t,y:l,placement:o}=e,{mainAxis:s=!0,crossAxis:n=!1,limiter:r={fn:w=>{let{x:b,y:_}=w;return{x:b,y:_}}},...a}=Q(i,e),c={x:t,y:l},p=await Me(e,a),d=D(R(o)),m=ke(d);let u=c[m],g=c[d];if(s){const w=m==="y"?"top":"left",b=m==="y"?"bottom":"right",_=u+p[w],y=u-p[b];u=Ce(_,u,y)}if(n){const w=d==="y"?"top":"left",b=d==="y"?"bottom":"right",_=g+p[w],y=g-p[b];g=Ce(_,g,y)}const v=r.fn({...e,[m]:u,[d]:g});return{...v,data:{x:v.x-t,y:v.y-l,enabled:{[m]:s,[d]:n}}}}}};function le(){return typeof window<"u"}function H(i){return Ie(i)?(i.nodeName||"").toLowerCase():"#document"}function A(i){var e;return(i==null||(e=i.ownerDocument)==null?void 0:e.defaultView)||window}function E(i){var e;return(e=(Ie(i)?i.ownerDocument:i.document)||window.document)==null?void 0:e.documentElement}function Ie(i){return le()?i instanceof Node||i instanceof A(i).Node:!1}function O(i){return le()?i instanceof Element||i instanceof A(i).Element:!1}function V(i){return le()?i instanceof HTMLElement||i instanceof A(i).HTMLElement:!1}function Ee(i){return!le()||typeof ShadowRoot>"u"?!1:i instanceof ShadowRoot||i instanceof A(i).ShadowRoot}const pt=new Set(["inline","contents"]);function U(i){const{overflow:e,overflowX:t,overflowY:l,display:o}=T(i);return/auto|scroll|overlay|hidden|clip/.test(e+l+t)&&!pt.has(o)}const ht=new Set(["table","td","th"]);function ut(i){return ht.has(H(i))}const mt=[":popover-open",":modal"];function oe(i){return mt.some(e=>{try{return i.matches(e)}catch{return!1}})}const ft=["transform","translate","scale","rotate","perspective"],gt=["transform","translate","scale","rotate","perspective","filter"],bt=["paint","layout","strict","content"];function ue(i){const e=me(),t=O(i)?T(i):i;return ft.some(l=>t[l]?t[l]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||gt.some(l=>(t.willChange||"").includes(l))||bt.some(l=>(t.contain||"").includes(l))}function vt(i){let e=$(i);for(;V(e)&&!j(e);){if(ue(e))return e;if(oe(e))return null;e=$(e)}return null}function me(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const wt=new Set(["html","body","#document"]);function j(i){return wt.has(H(i))}function T(i){return A(i).getComputedStyle(i)}function se(i){return O(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:{scrollLeft:i.scrollX,scrollTop:i.scrollY}}function $(i){if(H(i)==="html")return i;const e=i.assignedSlot||i.parentNode||Ee(i)&&i.host||E(i);return Ee(e)?e.host:e}function Ve(i){const e=$(i);return j(e)?i.ownerDocument?i.ownerDocument.body:i.body:V(e)&&U(e)?e:Ve(e)}function Y(i,e,t){var l;e===void 0&&(e=[]),t===void 0&&(t=!0);const o=Ve(i),s=o===((l=i.ownerDocument)==null?void 0:l.body),n=A(o);if(s){const r=fe(n);return e.concat(n,n.visualViewport||[],U(o)?o:[],r&&t?Y(r):[])}return e.concat(o,Y(o,[],t))}function fe(i){return i.parent&&Object.getPrototypeOf(i.parent)?i.frameElement:null}function De(i){const e=T(i);let t=parseFloat(e.width)||0,l=parseFloat(e.height)||0;const o=V(i),s=o?i.offsetWidth:t,n=o?i.offsetHeight:l,r=q(t)!==s||q(l)!==n;return r&&(t=s,l=n),{width:t,height:l,$:r}}function ge(i){return O(i)?i:i.contextElement}function W(i){const e=ge(i);if(!V(e))return I(1);const t=e.getBoundingClientRect(),{width:l,height:o,$:s}=De(e);let n=(s?q(t.width):t.width)/l,r=(s?q(t.height):t.height)/o;return(!n||!Number.isFinite(n))&&(n=1),(!r||!Number.isFinite(r))&&(r=1),{x:n,y:r}}const _t=I(0);function $e(i){const e=A(i);return!me()||!e.visualViewport?_t:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function yt(i,e,t){return e===void 0&&(e=!1),!t||e&&t!==A(i)?!1:e}function N(i,e,t,l){e===void 0&&(e=!1),t===void 0&&(t=!1);const o=i.getBoundingClientRect(),s=ge(i);let n=I(1);e&&(l?O(l)&&(n=W(l)):n=W(i));const r=yt(s,t,l)?$e(s):I(0);let a=(o.left+r.x)/n.x,c=(o.top+r.y)/n.y,p=o.width/n.x,d=o.height/n.y;if(s){const m=A(s),u=l&&O(l)?A(l):l;let g=m,v=fe(g);for(;v&&l&&u!==g;){const w=W(v),b=v.getBoundingClientRect(),_=T(v),y=b.left+(v.clientLeft+parseFloat(_.paddingLeft))*w.x,k=b.top+(v.clientTop+parseFloat(_.paddingTop))*w.y;a*=w.x,c*=w.y,p*=w.x,d*=w.y,a+=y,c+=k,g=A(v),v=fe(g)}}return ie({width:p,height:d,x:a,y:c})}function ne(i,e){const t=se(i).scrollLeft;return e?e.left+t:N(E(i)).left+t}function Le(i,e){const t=i.getBoundingClientRect(),l=t.left+e.scrollLeft-ne(i,t),o=t.top+e.scrollTop;return{x:l,y:o}}function xt(i){let{elements:e,rect:t,offsetParent:l,strategy:o}=i;const s=o==="fixed",n=E(l),r=e?oe(e.floating):!1;if(l===n||r&&s)return t;let a={scrollLeft:0,scrollTop:0},c=I(1);const p=I(0),d=V(l);if((d||!d&&!s)&&((H(l)!=="body"||U(n))&&(a=se(l)),V(l))){const u=N(l);c=W(l),p.x=u.x+l.clientLeft,p.y=u.y+l.clientTop}const m=n&&!d&&!s?Le(n,a):I(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-a.scrollLeft*c.x+p.x+m.x,y:t.y*c.y-a.scrollTop*c.y+p.y+m.y}}function Ct(i){return Array.from(i.getClientRects())}function kt(i){const e=E(i),t=se(i),l=i.ownerDocument.body,o=S(e.scrollWidth,e.clientWidth,l.scrollWidth,l.clientWidth),s=S(e.scrollHeight,e.clientHeight,l.scrollHeight,l.clientHeight);let n=-t.scrollLeft+ne(i);const r=-t.scrollTop;return T(l).direction==="rtl"&&(n+=S(e.clientWidth,l.clientWidth)-o),{width:o,height:s,x:n,y:r}}const ze=25;function Pt(i,e){const t=A(i),l=E(i),o=t.visualViewport;let s=l.clientWidth,n=l.clientHeight,r=0,a=0;if(o){s=o.width,n=o.height;const p=me();(!p||p&&e==="fixed")&&(r=o.offsetLeft,a=o.offsetTop)}const c=ne(l);if(c<=0){const p=l.ownerDocument,d=p.body,m=getComputedStyle(d),u=p.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,g=Math.abs(l.clientWidth-d.clientWidth-u);g<=ze&&(s-=g)}else c<=ze&&(s+=c);return{width:s,height:n,x:r,y:a}}const At=new Set(["absolute","fixed"]);function St(i,e){const t=N(i,!0,e==="fixed"),l=t.top+i.clientTop,o=t.left+i.clientLeft,s=V(i)?W(i):I(1),n=i.clientWidth*s.x,r=i.clientHeight*s.y,a=o*s.x,c=l*s.y;return{width:n,height:r,x:a,y:c}}function Re(i,e,t){let l;if(e==="viewport")l=Pt(i,t);else if(e==="document")l=kt(E(i));else if(O(e))l=St(e,t);else{const o=$e(i);l={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return ie(l)}function Ne(i,e){const t=$(i);return t===e||!O(t)||j(t)?!1:T(t).position==="fixed"||Ne(t,e)}function Ot(i,e){const t=e.get(i);if(t)return t;let l=Y(i,[],!1).filter(r=>O(r)&&H(r)!=="body"),o=null;const s=T(i).position==="fixed";let n=s?$(i):i;for(;O(n)&&!j(n);){const r=T(n),a=ue(n);!a&&r.position==="fixed"&&(o=null),(s?!a&&!o:!a&&r.position==="static"&&!!o&&At.has(o.position)||U(n)&&!a&&Ne(i,n))?l=l.filter(p=>p!==n):o=r,n=$(n)}return e.set(i,l),l}function Tt(i){let{element:e,boundary:t,rootBoundary:l,strategy:o}=i;const n=[...t==="clippingAncestors"?oe(e)?[]:Ot(e,this._c):[].concat(t),l],r=n[0],a=n.reduce((c,p)=>{const d=Re(e,p,o);return c.top=S(d.top,c.top),c.right=C(d.right,c.right),c.bottom=C(d.bottom,c.bottom),c.left=S(d.left,c.left),c},Re(e,r,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Mt(i){const{width:e,height:t}=De(i);return{width:e,height:t}}function It(i,e,t){const l=V(e),o=E(e),s=t==="fixed",n=N(i,!0,s,e);let r={scrollLeft:0,scrollTop:0};const a=I(0);function c(){a.x=ne(o)}if(l||!l&&!s)if((H(e)!=="body"||U(o))&&(r=se(e)),l){const u=N(e,!0,s,e);a.x=u.x+e.clientLeft,a.y=u.y+e.clientTop}else o&&c();s&&!l&&o&&c();const p=o&&!l&&!s?Le(o,r):I(0),d=n.left+r.scrollLeft-a.x-p.x,m=n.top+r.scrollTop-a.y-p.y;return{x:d,y:m,width:n.width,height:n.height}}function be(i){return T(i).position==="static"}function Fe(i,e){if(!V(i)||T(i).position==="fixed")return null;if(e)return e(i);let t=i.offsetParent;return E(i)===t&&(t=t.ownerDocument.body),t}function Be(i,e){const t=A(i);if(oe(i))return t;if(!V(i)){let o=$(i);for(;o&&!j(o);){if(O(o)&&!be(o))return o;o=$(o)}return t}let l=Fe(i,e);for(;l&&ut(l)&&be(l);)l=Fe(l,e);return l&&j(l)&&be(l)&&!ue(l)?t:l||vt(i)||t}const Et=async function(i){const e=this.getOffsetParent||Be,t=this.getDimensions,l=await t(i.floating);return{reference:It(i.reference,await e(i.floating),i.strategy),floating:{x:0,y:0,width:l.width,height:l.height}}};function Vt(i){return T(i).direction==="rtl"}const Dt={convertOffsetParentRelativeRectToViewportRelativeRect:xt,getDocumentElement:E,getClippingRect:Tt,getOffsetParent:Be,getElementRects:Et,getClientRects:Ct,getDimensions:Mt,getScale:W,isElement:O,isRTL:Vt};function He(i,e){return i.x===e.x&&i.y===e.y&&i.width===e.width&&i.height===e.height}function $t(i,e){let t=null,l;const o=E(i);function s(){var r;clearTimeout(l),(r=t)==null||r.disconnect(),t=null}function n(r,a){r===void 0&&(r=!1),a===void 0&&(a=1),s();const c=i.getBoundingClientRect(),{left:p,top:d,width:m,height:u}=c;if(r||e(),!m||!u)return;const g=Z(d),v=Z(o.clientWidth-(p+m)),w=Z(o.clientHeight-(d+u)),b=Z(p),y={rootMargin:-g+"px "+-v+"px "+-w+"px "+-b+"px",threshold:S(0,C(1,a))||1};let k=!0;function x(X){const G=X[0].intersectionRatio;if(G!==a){if(!k)return n();G?n(!1,G):l=setTimeout(()=>{n(!1,1e-7)},1e3)}G===1&&!He(c,i.getBoundingClientRect())&&n(),k=!1}try{t=new IntersectionObserver(x,{...y,root:o.ownerDocument})}catch{t=new IntersectionObserver(x,y)}t.observe(i)}return n(!0),s}function re(i,e,t,l){l===void 0&&(l={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:r=typeof IntersectionObserver=="function",animationFrame:a=!1}=l,c=ge(i),p=o||s?[...c?Y(c):[],...Y(e)]:[];p.forEach(b=>{o&&b.addEventListener("scroll",t,{passive:!0}),s&&b.addEventListener("resize",t)});const d=c&&r?$t(c,t):null;let m=-1,u=null;n&&(u=new ResizeObserver(b=>{let[_]=b;_&&_.target===c&&u&&(u.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=u)==null||y.observe(e)})),t()}),c&&!a&&u.observe(c),u.observe(e));let g,v=a?N(i):null;a&&w();function w(){const b=N(i);v&&!He(v,b)&&t(),v=b,g=requestAnimationFrame(w)}return t(),()=>{var b;p.forEach(_=>{o&&_.removeEventListener("scroll",t),s&&_.removeEventListener("resize",t)}),d==null||d(),(b=u)==null||b.disconnect(),u=null,a&&cancelAnimationFrame(g)}}const ae=ct,ce=dt,ve=nt,de=(i,e,t)=>{const l=new Map,o={platform:Dt,...t},s={...o.platform,_c:l};return st(i,e,{...o,platform:s})};let L=0;const f={debug:(i,...e)=>{L++,console.log(`%c[MultiSelect ${L}]%c ${i}`,"color: #0ea5e9; font-weight: bold;","color: inherit;",...e)},info:(i,...e)=>{L++,console.info(`%c[MultiSelect ${L}]%c ${i}`,"color: #10b981; font-weight: bold;","color: inherit;",...e)},warn:(i,...e)=>{L++,console.warn(`%c[MultiSelect ${L}]%c ${i}`,"color: #f59e0b; font-weight: bold;","color: inherit;",...e)},error:(i,...e)=>{L++,console.error(`%c[MultiSelect ${L}]%c ${i}`,"color: #ef4444; font-weight: bold;","color: inherit;",...e)}};class je{constructor(e,t={}){h(this,"element");h(this,"instanceId");h(this,"options");h(this,"isOpen",!1);h(this,"selectedValues",new Set);h(this,"selectedOptions",new Map);h(this,"allOptions",[]);h(this,"filteredOptions",[]);h(this,"hiddenInputs",[]);h(this,"focusedIndex",-1);h(this,"searchTerm","");h(this,"isLoading",!1);h(this,"showSelectedPopover",!1);h(this,"selectedPopoverPlacement",null);h(this,"dropdownPlacement",null);h(this,"isRTL",!1);h(this,"effectivePillsPosition","bottom");h(this,"justClosedViaClick",!1);h(this,"dropdownCleanup",null);h(this,"hintCleanup",null);h(this,"selectedPopoverCleanup",null);h(this,"pillTooltips",new Map);h(this,"pillTooltipCleanups",new Map);h(this,"input");h(this,"dropdown");h(this,"pillsContainer");h(this,"countBadge");h(this,"hint");h(this,"selectedPopover");this.element=e,this.instanceId=`MS-${Math.random().toString(36).substr(2,9)}`,this.options={searchHint:e.dataset.searchHint||"",searchPlaceholder:e.dataset.searchPlaceholder||"Search...",dropdownMinWidth:e.dataset.dropdownMinWidth||void 0,pillsDisplayMode:e.dataset.pillsDisplayMode||"pills",pillsPosition:e.dataset.pillsPosition||"bottom",pillsThresholdMode:e.dataset.pillsThresholdMode||"count",maxHeight:e.dataset.maxHeight||"20rem",emptyMessage:e.dataset.emptyMessage||"No results found",loadingMessage:e.dataset.loadingMessage||"Loading...",searchInputMode:e.dataset.searchInputMode||"normal",pillsThreshold:e.dataset.pillsThreshold?parseInt(e.dataset.pillsThreshold):void 0,minSearchLength:parseInt(e.dataset.minSearchLength||"0")||0,isMultipleEnabled:e.dataset.multiple!=="false",isGroupsAllowed:e.dataset.allowGroups!=="false",isSelectAllAllowed:e.dataset.allowSelectAll!=="false",isClearAllAllowed:e.dataset.allowClearAll!=="false",isCheckboxesShown:e.dataset.showCheckboxes!=="false",isActionsSticky:e.dataset.stickyActions!=="false",isCloseOnSelect:e.dataset.closeOnSelect==="true",isPlacementLocked:e.dataset.lockPlacement!=="false",isSearchEnabled:e.dataset.enableSearch!=="false",isAddNewAllowed:e.dataset.allowAddNew==="true",isCountBadgeShown:e.dataset.showCountBadge==="true",options:[],container:void 0,...t},this.init()}getItemValue(e){return Array.isArray(e)&&e.length===2?e[0]:this.options.valueMember&&e[this.options.valueMember]!==void 0?e[this.options.valueMember]:this.options.getValueCallback?this.options.getValueCallback(e):"[N/A]"}getItemDisplayValue(e){return Array.isArray(e)&&e.length===2?String(e[1]):this.options.displayValueMember&&e[this.options.displayValueMember]!==void 0?String(e[this.options.displayValueMember]):this.options.getDisplayValueCallback?this.options.getDisplayValueCallback(e):"[N/A]"}getItemPillDisplayValue(e){return this.options.getPillDisplayCallback?this.options.getPillDisplayCallback(e):this.getItemDisplayValue(e)}getItemSearchValue(e){return this.options.searchValueMember&&e[this.options.searchValueMember]!==void 0?String(e[this.options.searchValueMember]):this.options.getSearchValueCallback?this.options.getSearchValueCallback(e):this.getItemDisplayValue(e)}getItemIcon(e){if(!Array.isArray(e)){if(this.options.iconMember&&e[this.options.iconMember]!==void 0)return String(e[this.options.iconMember]);if(this.options.getIconCallback)return this.options.getIconCallback(e)}}getItemSubtitle(e){if(!Array.isArray(e)){if(this.options.subtitleMember&&e[this.options.subtitleMember]!==void 0)return String(e[this.options.subtitleMember]);if(this.options.getSubtitleCallback)return this.options.getSubtitleCallback(e)}}getItemGroup(e){if(!Array.isArray(e)){if(this.options.groupMember&&e[this.options.groupMember]!==void 0)return String(e[this.options.groupMember]);if(this.options.getGroupCallback)return this.options.getGroupCallback(e)}}getItemDisabled(e){return Array.isArray(e)?!1:this.options.disabledMember&&e[this.options.disabledMember]!==void 0?!!e[this.options.disabledMember]:this.options.getDisabledCallback?this.options.getDisabledCallback(e):!1}init(){this.parseOptions(),this.buildHTML(),this.attachEvents(),this.parseInitialSelection(),f.debug(`Initialized [${this.instanceId}] with options:`,{placeholder:this.options.searchPlaceholder,totalOptions:this.allOptions.length,isCloseOnSelect:this.options.isCloseOnSelect,dataAttribute:this.element.dataset.closeOnSelect,isSelectAllAllowed:this.options.isSelectAllAllowed,isClearAllAllowed:this.options.isClearAllAllowed})}parseOptions(){const e=this.element.dataset.options;if(e)try{this.allOptions=JSON.parse(e)}catch(t){console.error("[MultiSelect] Failed to parse data-options:",t),this.allOptions=[]}else this.options.options&&(this.allOptions=this.options.options);this.filteredOptions=[...this.allOptions]}buildHTML(){const e=this.options.container||document.body,t=this.element.getRootNode(),l=t instanceof ShadowRoot?t.host:this.element,o=l.getAttribute("dir")==="rtl",s=l.closest('[dir="rtl"]')!==null;this.isRTL=o||s,console.log("[MultiSelect RTL Debug]",{isShadowRoot:t instanceof ShadowRoot,hostElement:l,elementDir:l.getAttribute("dir"),hasElementDir:o,hasAncestorDir:s,isRTL:this.isRTL}),this.effectivePillsPosition=this.options.pillsPosition||"bottom",this.isRTL&&(this.effectivePillsPosition==="left"?this.effectivePillsPosition="right":this.effectivePillsPosition==="right"&&(this.effectivePillsPosition="left")),this.element.classList.add("ml"),this.isRTL&&(this.element.classList.add("ml--rtl"),console.log("[MultiSelect RTL] Added ml--rtl class to element")),(!this.options.isCheckboxesShown||!this.options.isMultipleEnabled)&&this.element.classList.add("ml--no-checkboxes");const n=document.createElement("div");n.className="ml__input-wrapper",this.input=document.createElement("input"),this.input.type="text",this.input.className="ml__input",this.input.placeholder=this.options.searchPlaceholder,this.input.autocomplete="off",this.options.searchInputMode==="readonly"?this.input.readOnly=!0:this.options.searchInputMode==="hidden"&&(this.input.style.display="none");const r=document.createElement("span");r.className="ml__toggle",r.innerHTML="▼",this.countBadge=document.createElement("span"),this.countBadge.className="ml__count-badge",this.countBadge.style.display="none",n.appendChild(this.input),n.appendChild(this.countBadge),n.appendChild(r),this.pillsContainer=document.createElement("div"),this.pillsContainer.className="ml__pills";const a=document.createElement("div");a.className="ml-wrapper",(this.effectivePillsPosition==="left"||this.effectivePillsPosition==="right")&&a.classList.add("ml-wrapper--inline"),a.appendChild(n),a.appendChild(this.pillsContainer),this.element.appendChild(a),this.dropdown=document.createElement("div"),this.dropdown.className="ml__dropdown",e.appendChild(this.dropdown),this.options.searchHint&&(this.hint=document.createElement("div"),this.hint.className="ml__hint",this.hint.textContent=this.options.searchHint,e.appendChild(this.hint)),this.selectedPopover=document.createElement("div"),this.selectedPopover.className="ml__selected-popover",e.appendChild(this.selectedPopover),this.renderDropdown()}renderDropdown(){let e="";if(this.isLoading){e+='<div class="ml__loader">',e+='<div class="pa-loader pa-loader--sm"></div>',e+=`<div class="ml__loading-text">${this.options.loadingMessage}</div>`,e+="</div>",this.dropdown.innerHTML=e;return}if(this.options.isMultipleEnabled&&(this.options.isSelectAllAllowed||this.options.isClearAllAllowed)){const t=this.options.isActionsSticky?" ml__actions--sticky":"";e+=`<div class="ml__actions${t}">`,this.options.isSelectAllAllowed&&(e+='<button type="button" class="ml__action-btn" data-action="select-all">Select All</button>'),this.options.isClearAllAllowed&&(e+='<button type="button" class="ml__action-btn" data-action="clear-all">Clear All</button>'),e+="</div>"}if(e+='<div class="ml__options">',this.filteredOptions.length===0)e+=`<div class="ml__empty">${this.options.emptyMessage}</div>`;else if(this.options.isGroupsAllowed){const t=this.groupOptions(this.filteredOptions);Object.keys(t).forEach(l=>{e+='<div class="ml__group">',l!=="__ungrouped__"&&(e+=`<div class="ml__group-label">${l}</div>`),t[l].forEach((o,s)=>{e+=this.renderOption(o,s)}),e+="</div>"})}else this.filteredOptions.forEach((t,l)=>{e+=this.renderOption(t,l)});e+="</div>",this.dropdown.innerHTML=e}renderOption(e,t){const l=this.getItemValue(e),o=this.getItemDisplayValue(e),s=this.getItemIcon(e),n=this.getItemSubtitle(e),r=this.getItemDisabled(e),a=this.selectedValues.has(String(l)),c=t===this.focusedIndex,p=["ml__option"];a&&p.push("ml__option--selected"),c&&p.push("ml__option--focused"),r&&p.push("ml__option--disabled");let d=`<div class="${p.join(" ")}" data-value="${l}" data-index="${t}">`;return this.options.isCheckboxesShown&&this.options.isMultipleEnabled&&(d+=`<input type="checkbox" class="ml__checkbox" ${a?"checked":""} ${r?"disabled":""}>`),d+='<div class="ml__option-content">',s&&(d+=`<span class="ml__option-icon">${s}</span>`),d+='<div class="ml__option-text">',d+=`<div class="ml__option-title">${this.highlightMatch(o,this.searchTerm)}</div>`,n&&(d+=`<div class="ml__option-subtitle">${n}</div>`),d+="</div>",d+="</div>",d+="</div>",d}highlightMatch(e,t){if(!t)return e;const l=new RegExp(`(${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return e.replace(l,"<mark>$1</mark>")}groupOptions(e){const t={};return e.forEach(l=>{const o=this.getItemGroup(l)||"__ungrouped__";t[o]||(t[o]=[]),t[o].push(l)}),t}renderPills(){this.destroyAllPillTooltips();const e=Array.from(this.selectedOptions.values()),t=this.selectedValues.size;if(!this.options.isMultipleEnabled){this.pillsContainer.innerHTML="",this.countBadge.style.display="none";const s=e[0]?this.getItemDisplayValue(e[0]):void 0;f.warn(`[${this.instanceId}] renderPills() single-select mode`,{isOpen:this.isOpen,count:t,selectedOptionsLength:e.length,willSetValue:!this.isOpen&&t>0&&e.length>0,selectedLabel:s}),!this.isOpen&&t>0&&e.length>0?(f.info(`[${this.instanceId}] ✅ SETTING input.value = "${s}"`),this.input.value=s,f.info(`[${this.instanceId}] 🔍 VERIFY input.value = "${this.input.value}"`)):this.isOpen?f.info(`[${this.instanceId}] ⏭️ SKIPPING input update (dropdown is open)`):(f.info(`[${this.instanceId}] ❌ CLEARING input.value (no selection)`),this.input.value="");return}let l=this.options.pillsDisplayMode;if(this.options.pillsThreshold!==null&&t>this.options.pillsThreshold&&(l=this.options.pillsThresholdMode||"count"),!this.isOpen)if(t>0&&l==="count"){const s=this.options.getCountPillCallback?this.options.getCountPillCallback(t):`${t} selected`;this.input.placeholder=s}else this.input.placeholder=this.options.searchPlaceholder;if(this.options.isCountBadgeShown&&t>0?(this.countBadge.textContent=`[${t}]`,this.countBadge.style.display=""):this.countBadge.style.display="none",l==="pills")this.pillsContainer.className=`ml__pills ml__pills--${this.effectivePillsPosition}`,this.pillsContainer.innerHTML=e.map(s=>{const n=this.getItemValue(s),r=this.getItemPillDisplayValue(s);return`
|
|
2
2
|
<div class="ml__pill">
|
|
3
3
|
<span class="ml__pill-text">${r}</span>
|
|
4
4
|
<button type="button" class="ml__pill-remove" data-value="${n}" aria-label="Remove ${r}"></button>
|
|
5
5
|
</div>
|
|
6
|
-
`}).join("");else if(l==="partial"){this.pillsContainer.className=`ml__pills ml__pills--${this.effectivePillsPosition}`;const s=this.options.pillsMaxVisible||3,n=e.slice(0,s),r=t-s,a=n.map(p=>{const d=this.getItemValue(p),m=this.
|
|
6
|
+
`}).join("");else if(l==="partial"){this.pillsContainer.className=`ml__pills ml__pills--${this.effectivePillsPosition}`;const s=this.options.pillsMaxVisible||3,n=e.slice(0,s),r=t-s,a=n.map(p=>{const d=this.getItemValue(p),m=this.getItemPillDisplayValue(p);return`
|
|
7
7
|
<div class="ml__pill">
|
|
8
8
|
<span class="ml__pill-text">${m}</span>
|
|
9
9
|
<button type="button" class="ml__pill-remove" data-value="${d}" aria-label="Remove ${m}"></button>
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
<button type="button" class="ml__selected-popover-close" aria-label="Close">×</button>
|
|
27
27
|
</div>
|
|
28
28
|
<div class="ml__selected-popover-body">
|
|
29
|
-
${e.map(l=>{const o=this.getItemValue(l),s=this.
|
|
29
|
+
${e.map(l=>{const o=this.getItemValue(l),s=this.getItemPillDisplayValue(l);return`
|
|
30
30
|
<div class="ml__pill">
|
|
31
31
|
<span class="ml__pill-text">${s}</span>
|
|
32
32
|
<button type="button" class="ml__pill-remove" data-value="${o}" aria-label="Remove ${s}"></button>
|
|
33
33
|
</div>
|
|
34
34
|
`}).join("")}
|
|
35
35
|
</div>
|
|
36
|
-
`}handleSelectedPopoverClick(e){if(e.stopPropagation(),e.target.closest(".ml__selected-popover-close")){e.preventDefault(),this.hideSelectedPopover();return}const l=e.target.closest(".ml__pill-remove");if(l){e.preventDefault();const o=l.dataset.value,s=this.selectedOptions.get(o);s&&(this.deselectOption(s),this.renderSelectedPopover(),this.selectedValues.size===0&&this.hideSelectedPopover())}}positionSelectedPopover(){this.selectedPopoverCleanup=re(this.input,this.selectedPopover,()=>{const e=this.selectedPopoverPlacement||"bottom-start";de(this.input,this.selectedPopover,{placement:e,middleware:[ae(4),...this.selectedPopoverPlacement?[]:[ve()],ce({padding:8})]}).then(({x:t,y:l,placement:o})=>{this.selectedPopoverPlacement||(this.selectedPopoverPlacement=o,f.debug(`[${this.instanceId}] Locked popover placement:`,o));const s={left:`${t}px`,top:`${l}px`,width:`${this.input.offsetWidth}px`};this.options.dropdownMinWidth&&(s.minWidth=this.options.dropdownMinWidth),Object.assign(this.selectedPopover.style,s)})})}updateHiddenInput(){if(!this.options.formFieldId)return;this.hiddenInputs.forEach(o=>o.remove()),this.hiddenInputs=[];const e=this.options.valueFormat||"json",t=Array.from(this.selectedOptions.values()).map(o=>this.getItemValue(o)),l=this.options.hostElement||this.element;if(e==="array")t.forEach(o=>{const s=document.createElement("input");s.type="hidden",s.name=`${this.options.formFieldId}[]`,s.value=String(o),l.appendChild(s),this.hiddenInputs.push(s)});else{const o=document.createElement("input");o.type="hidden",o.name=this.options.formFieldId,o.id=this.options.formFieldId,o.value=this.getFormValue(),l.appendChild(o),this.hiddenInputs.push(o)}}getFormValue(){const e=Array.from(this.selectedOptions.values()).map(l=>this.getItemValue(l));return this.options.getValueFormatCallback?this.options.getValueFormatCallback(e):(this.options.valueFormat||"json")==="csv"?e.join(","):JSON.stringify(e)}getSelected(){return Array.from(this.selectedOptions.values())}setSelected(e){this.selectedValues=new Set(e.map(t=>String(t))),this.selectedOptions.clear(),e.forEach(t=>{const l=String(t),o=this.allOptions.find(s=>String(this.getItemValue(s))===l);o&&this.selectedOptions.set(l,o)}),this.renderDropdown(),this.renderPills(),this.updateHiddenInput()}get selectedItem(){return this.selectedOptions.size===0?null:Array.from(this.selectedOptions.values())[0]}get selectedValue(){if(!this.options.valueMember&&!this.options.getValueCallback)return null;if(this.selectedOptions.size===0)return this.options.isMultipleEnabled?[]:null;const e=Array.from(this.selectedOptions.values()).map(t=>this.getItemValue(t));return this.options.isMultipleEnabled?e:e[0]??null}getValue(){if(this.selectedOptions.size===0)return this.options.isMultipleEnabled?[]:null;const e=Array.from(this.selectedOptions.values()).map(t=>this.getItemValue(t));return this.options.isMultipleEnabled?e:e[0]??null}attachPillTooltips(){if(!this.options.isPillTooltipsEnabled){console.log("[Tooltips] Disabled - isPillTooltipsEnabled is false");return}const e=this.pillsContainer.querySelectorAll(".ml__pill:not(.ml__pill--more)");console.log(`[Tooltips] Found ${e.length} pills to attach tooltips to`),e.forEach(l=>{const o=l,s=o.querySelector(".ml__pill-remove");if(!s)return;const n=s.dataset.value,r=this.selectedOptions.get(n);if(!r)return;const a=o.querySelector(".ml__pill-text");a&&this.createTooltipForElement(a,r,n);const c=this.
|
|
37
|
-
${m}`:d,console.log(`[Tooltips] Using default content: "${s}"`)}typeof s=="string"?o.textContent=s:o.appendChild(s),(this.options.container||document.body).appendChild(o),console.log(`[Tooltips] Tooltip element created and appended for "${l}"`),this.pillTooltips.set(l,o);let r,a;const c=()=>{clearTimeout(a),console.log(`[Tooltips] Mouse entered pill "${l}", will show tooltip in ${this.options.pillTooltipDelay||300}ms`),r=window.setTimeout(()=>{console.log(`[Tooltips] Showing tooltip for "${l}"`),o.classList.add("ml__pill-tooltip--visible"),this.positionPillTooltip(e,o,l)},this.options.pillTooltipDelay||300)},p=()=>{clearTimeout(r),a=window.setTimeout(()=>{o.classList.remove("ml__pill-tooltip--visible"),this.cleanupPillTooltip(l)},100)};e.addEventListener("mouseenter",c),e.addEventListener("mouseleave",p)}createRemoveButtonTooltip(e,t,l){const o=document.createElement("div");o.className="ml__pill-tooltip",o.textContent=`Remove ${t}`,(this.options.container||document.body).appendChild(o);const n=`${l}-remove`;this.pillTooltips.set(n,o);let r,a;const c=()=>{clearTimeout(a);const d=this.pillTooltips.get(l);d&&d.classList.remove("ml__pill-tooltip--visible"),r=window.setTimeout(()=>{o.classList.add("ml__pill-tooltip--visible"),this.positionPillTooltip(e,o,n)},this.options.pillTooltipDelay||300)},p=()=>{clearTimeout(r),a=window.setTimeout(()=>{o.classList.remove("ml__pill-tooltip--visible"),this.cleanupPillTooltip(n)},100)};e.addEventListener("mouseenter",c),e.addEventListener("mouseleave",p)}positionPillTooltip(e,t,l){const o=re(e,t,()=>{de(e,t,{placement:this.options.pillTooltipPlacement||"top",strategy:"fixed",middleware:[ae(this.options.pillTooltipOffset||8),ve(),ce({padding:8})]}).then(({x:s,y:n})=>{Object.assign(t.style,{left:`${s}px`,top:`${n}px`}),console.log(`[Tooltips] Positioned tooltip "${l}" at x:${s}, y:${n}`,{placement:this.options.pillTooltipPlacement||"top",tooltipClasses:t.className,tooltipDisplay:window.getComputedStyle(t).display,tooltipOpacity:window.getComputedStyle(t).opacity,tooltipVisibility:window.getComputedStyle(t).visibility,tooltipZIndex:window.getComputedStyle(t).zIndex,tooltipPosition:window.getComputedStyle(t).position})})});this.pillTooltipCleanups.set(l,o)}cleanupPillTooltip(e){const t=this.pillTooltipCleanups.get(e);t&&(t(),this.pillTooltipCleanups.delete(e))}destroyAllPillTooltips(){this.pillTooltipCleanups.forEach(e=>e()),this.pillTooltipCleanups.clear(),this.pillTooltips.forEach(e=>e.remove()),this.pillTooltips.clear()}destroy(){this.destroyAllPillTooltips(),this.dropdownCleanup&&this.dropdownCleanup(),this.hintCleanup&&this.hintCleanup(),this.selectedPopoverCleanup&&this.selectedPopoverCleanup(),this.dropdown&&this.dropdown.remove(),this.hint&&this.hint.remove(),this.selectedPopover&&this.selectedPopover.remove(),this.element.innerHTML="",this.element.classList.remove("ml","ml--open","ml--no-checkboxes"),console.log("[MultiSelect] Destroyed")}}const Lt='@charset "UTF-8";multi-select:not(:defined){display:block;min-height:2.5rem;color:transparent!important;background:transparent}.ml-wrapper{display:flex;flex-direction:column;align-items:stretch}.ml-wrapper--inline{flex-direction:row;align-items:flex-start}.ml{position:relative;width:100%}.ml__input-wrapper{position:relative;display:flex;align-items:center}.ml__input{width:100%;padding:var(--ml-input-padding, .5rem .75rem);padding-right:var(--ml-input-padding-right, 2.5rem);font-size:var(--ml-input-font-size, .875rem);border:var(--ml-input-border-style, 1px solid #d1d5db);border-radius:var(--ml-input-border-radius, .375rem);background:var(--ml-input-bg, #ffffff);color:var(--ml-input-text, #111827);cursor:pointer;transition:border-color var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}.ml__input:focus{outline:none;border-color:var(--ml-input-focus-border-color, #3b82f6)}.ml__input::placeholder{color:var(--ml-input-placeholder-color, #6b7280);opacity:0;transition:opacity var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}:host([data-ready]) .ml__input::placeholder{opacity:var(--ml-placeholder-opacity, .6)}.ml__toggle{position:absolute;right:var(--ml-toggle-right, .75rem);top:50%;transform:var(--ml-transform-center-y, translateY(-50%));pointer-events:none;color:var(--ml-toggle-color, #6b7280);transition:transform var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}.ml--open .ml__toggle{transform:var(--ml-transform-center-y, translateY(-50%)) rotate(var(--ml-transform-rotate-180, 180deg))}.ml__count-badge{position:absolute;right:var(--ml-count-badge-offset, 2rem);top:50%;transform:var(--ml-transform-center-y, translateY(-50%));padding:var(--ml-count-badge-padding, .125rem .25rem);background:var(--ml-count-badge-bg, #3b82f6);color:var(--ml-count-badge-color, #ffffff);font-size:var(--ml-count-badge-font-size, .75rem);font-weight:var(--ml-count-badge-font-weight, 600);border-radius:var(--ml-count-badge-border-radius, .25rem);cursor:pointer;transition:all var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}.ml__count-badge:hover{background:var(--ml-count-badge-bg-hover, #2563eb);transform:var(--ml-transform-center-y, translateY(-50%)) scale(var(--ml-transform-scale-hover, 1.1))}.ml__hint{display:none;position:absolute;z-index:var(--ml-z-index-popover, 10000);padding:var(--ml-hint-padding, .5rem .75rem);background:var(--ml-hint-bg, #ffffff);border:var(--ml-hint-border, 1px solid #e5e7eb);border-radius:var(--ml-hint-border-radius, .375rem);box-shadow:var(--ml-hint-box-shadow, 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -2px rgba(0, 0, 0, .1));font-size:var(--ml-hint-font-size, .75rem);color:var(--ml-hint-color, #6b7280);line-height:var(--ml-line-height-relaxed, 1.4);max-width:100%}.ml__hint--visible{display:block}.ml__dropdown{display:none;position:absolute;z-index:var(--ml-z-index-dropdown, 9999);background:var(--ml-dropdown-bg, #ffffff);border:var(--ml-dropdown-border, 1px solid #e5e7eb);border-radius:var(--ml-dropdown-border-radius, .375rem);box-shadow:var(--ml-dropdown-box-shadow, 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1));max-height:var(--ml-dropdown-max-height, 20rem);overflow-y:auto;color:var(--ml-dropdown-color, #111827)}.ml__dropdown--visible{display:block}.ml__actions{display:flex;gap:var(--ml-actions-gap, .25rem);padding:var(--ml-actions-padding, .5rem);border-bottom:var(--ml-actions-border-bottom, 1px solid #e5e7eb)}.ml__actions--sticky{position:sticky;top:0;z-index:var(--ml-z-index-sticky, 1);background:var(--ml-actions-bg, #ffffff)}.ml__action-btn{flex:1;padding:var(--ml-action-btn-padding, .25rem .5rem);font-size:var(--ml-action-btn-font-size, .75rem);border:var(--ml-action-btn-border, 1px solid #e5e7eb);border-radius:var(--ml-action-btn-border-radius, .25rem);background:var(--ml-action-btn-bg, transparent);color:var(--ml-action-btn-color, inherit);cursor:pointer;transition:all var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}.ml__action-btn:hover{background:var(--ml-action-btn-bg-hover, #f3f4f6);border-color:var(--ml-action-btn-border-color-hover, #3b82f6)}.ml__action-btn:active{transform:scale(var(--ml-transform-scale-active, .98))}.ml__options{padding:var(--ml-options-padding, .25rem 0)}.ml__group+.ml__group{border-top:var(--ml-group-border-top, 1px solid #e5e7eb);margin-top:var(--ml-group-margin-top, .25rem);padding-top:var(--ml-group-padding-top, .25rem)}.ml__group-label{padding:var(--ml-group-label-padding, .25rem .75rem);font-size:var(--ml-group-label-font-size, .75rem);font-weight:var(--ml-group-label-font-weight, 600);color:var(--ml-group-label-color, #6b7280);text-transform:var(--ml-group-label-transform, uppercase);letter-spacing:var(--ml-group-label-letter-spacing, .05em)}.ml__option{display:flex;align-items:flex-start;gap:var(--ml-option-gap, .5rem);padding:var(--ml-option-padding, .5rem .75rem);cursor:pointer;transition:background-color var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}.ml__option:hover{background:var(--ml-option-bg-hover, #f9fafb)}.ml__option--focused{background:var(--ml-option-bg-focused, #f9fafb);outline:var(--ml-option-outline-focused, 2px solid #3b82f6);outline-offset:var(--ml-option-focus-outline-offset, -2px)}.ml__option--selected{background:var(--ml-option-bg-selected, rgba(59, 130, 246, .1))}.ml__option--disabled{opacity:var(--ml-disabled-opacity, .5);cursor:not-allowed}.ml__option--disabled:hover{background:var(--ml-option-bg, transparent)}.ml__checkbox{flex-shrink:0;margin-top:var(--ml-checkbox-margin-top, .125rem);cursor:pointer}.ml__option--disabled .ml__checkbox{cursor:not-allowed}.ml__option-content{flex:1;display:flex;align-items:flex-start;gap:var(--ml-option-content-gap, .5rem);min-width:0}.ml__option-icon{flex-shrink:0;width:var(--ml-option-icon-size, 1.25rem);height:var(--ml-option-icon-size, 1.25rem);display:flex;align-items:center;justify-content:center;font-size:var(--ml-option-icon-font-size, 1rem)}.ml__option-icon svg{width:100%;height:100%;fill:currentColor}.ml__option-text{flex:1;min-width:0}.ml__option-title{font-size:var(--ml-option-title-font-size, .875rem);color:var(--ml-option-title-color, inherit);line-height:var(--ml-line-height-relaxed, 1.4)}.ml__option-title mark{background:var(--ml-option-mark-bg, rgba(59, 130, 246, .2));color:var(--ml-option-mark-color, inherit);font-weight:var(--ml-option-mark-font-weight, 600)}.ml__option-subtitle{margin-top:var(--ml-option-subtitle-margin-top, .25rem);font-size:var(--ml-option-subtitle-font-size, .75rem);color:var(--ml-option-subtitle-color, #6b7280);line-height:var(--ml-option-subtitle-line-height, 1.3)}.ml__empty{padding:var(--ml-empty-padding, 1rem .75rem);text-align:center;font-size:var(--ml-empty-font-size, .875rem);color:var(--ml-empty-color, #6b7280)}.ml__loader{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:var(--ml-loader-padding, 1rem);gap:var(--ml-loader-gap, .5rem)}.ml__loading-text{font-size:var(--ml-loading-text-font-size, .875rem);color:var(--ml-loading-text-color, #6b7280)}.ml__pills{display:flex;flex-wrap:wrap;gap:var(--ml-pills-gap, .5rem);padding:0}.ml__pills:empty{display:none}.ml__pills--bottom{margin-top:var(--ml-pills-margin-bottom, .5rem)}.ml__pills--top{margin-bottom:var(--ml-pills-margin-top, .5rem);order:var(--ml-order-first, -1)}.ml__pills--left{order:var(--ml-order-first, -1);margin-right:var(--ml-pills-margin-left, .25rem);justify-content:flex-end}.ml__pills--right{margin-left:var(--ml-pills-margin-right, .25rem);justify-content:flex-start}.ml__count-display{display:flex;align-items:center}.ml__count-display:empty{display:none}.ml__count-display--bottom{margin-top:var(--ml-count-display-margin-bottom, .5rem)}.ml__count-display--top{margin-bottom:var(--ml-count-display-margin-top, .5rem);order:var(--ml-order-first, -1)}.ml__count-display--left{order:var(--ml-order-first, -1);margin-right:var(--ml-count-display-margin-left, .5rem);justify-content:flex-start}.ml__count-display--right{margin-left:var(--ml-count-display-margin-right, .5rem);justify-content:flex-end}.ml__count-badge-wrapper{display:inline-flex;align-items:center;gap:var(--ml-count-badge-wrapper-gap, .25rem);background:var(--ml-count-badge-wrapper-bg, transparent);border:var(--ml-count-badge-wrapper-border, 1px solid #e5e7eb);border-radius:var(--ml-count-badge-wrapper-border-radius, .25rem);padding:var(--ml-count-badge-wrapper-padding, .25rem .5rem);transition:all var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}.ml__count-badge-wrapper:hover{background:var(--ml-count-badge-wrapper-bg-hover, #f9fafb);border-color:var(--ml-count-badge-wrapper-border-color-hover, #3b82f6)}.ml__count-text{display:inline-flex;align-items:center;background:var(--ml-count-text-bg, transparent);border:var(--ml-count-text-border, none);padding:0;font-size:var(--ml-count-text-font-size, .875rem);color:var(--ml-count-text-color, #111827);cursor:pointer;transition:color var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}.ml__count-clear{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:var(--ml-count-clear-size, 1rem);height:var(--ml-count-clear-size, 1rem);padding:0;border:none;background:var(--ml-count-clear-bg, transparent);color:var(--ml-count-clear-color, #6b7280);font-size:var(--ml-count-clear-font-size, 1.125rem);line-height:var(--ml-line-height-none, 1);cursor:pointer;border-radius:var(--ml-count-clear-border-radius, 50%);transition:all var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}.ml__count-clear:hover{background:var(--ml-count-clear-bg-hover, rgba(59, 130, 246, .2));color:var(--ml-count-clear-color-hover, #3b82f6)}.ml__count-clear:before{content:var(--ml-icon-clear, "×")}.ml__pill{display:inline-flex;align-items:center;height:var(--ml-pill-height, 1.5rem);font-size:var(--ml-pill-font-size, .75rem);font-weight:var(--ml-pill-font-weight, 600);line-height:var(--ml-line-height-none, 1);border-radius:var(--ml-pill-border-radius, .375rem);overflow:hidden;max-width:100%}.ml__pill-text{display:flex;align-items:center;height:100%;padding:var(--ml-pill-text-padding, 0 .5rem);background:var(--ml-pill-text-bg, #eff6ff);color:var(--ml-pill-text-color, #3b82f6);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition:background-color var(--ml-transition-normal, .2s) ease}.ml__pill-remove{display:flex;align-items:center;justify-content:center;width:var(--ml-pill-remove-width, 1.5rem);height:100%;flex-shrink:0;background:var(--ml-pill-remove-bg, #3b82f6);color:var(--ml-pill-remove-color, #ffffff);border:var(--ml-pill-remove-border, none);cursor:pointer;transition:background-color var(--ml-transition-normal, .2s) ease;font-size:var(--ml-pill-remove-font-size, .75rem)}.ml__pill-remove:hover{background:var(--ml-pill-remove-bg-hover, #2563eb)}.ml__pill-remove:focus{outline:none;box-shadow:var(--ml-pill-remove-box-shadow-focus, 0 0 0 2px rgba(59, 130, 246, .5))}.ml__pill-remove:before{content:var(--ml-icon-remove, "×");font-size:var(--ml-font-size-base, 1rem);line-height:var(--ml-line-height-none, 1)}.ml__pill--more{cursor:pointer}.ml__pill--more .ml__pill-text{background:var(--ml-more-badge-bg, #eff6ff);font-weight:var(--ml-pill-font-weight, 600)}.ml__pill--more:hover .ml__pill-text{background:var(--ml-more-badge-hover-bg, #ffffff)}.ml__pill--more:active .ml__pill-text{background:var(--ml-more-badge-active-bg, #e0f2fe)}.ml__pill-tooltip{position:fixed;z-index:var(--ml-tooltip-z-index, 10000);opacity:0;visibility:hidden;transition:opacity var(--ml-transition-normal, .2s) ease,visibility var(--ml-transition-normal, .2s) ease;background:var(--ml-tooltip-bg, #333);color:var(--ml-tooltip-color, #fff);padding:var(--ml-tooltip-padding, .5rem .75rem);border-radius:var(--ml-tooltip-border-radius, .375rem);font-size:var(--ml-tooltip-font-size, .875rem);line-height:var(--ml-line-height-relaxed, 1.4);max-width:var(--ml-tooltip-max-width, 20rem);word-wrap:break-word;white-space:pre-wrap;box-shadow:var(--ml-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, .15));pointer-events:none}.ml__pill-tooltip--visible{opacity:1;visibility:visible}.ml__selected-popover{display:none;position:absolute;z-index:var(--ml-z-index-popover, 10000);background:var(--ml-selected-popover-bg, #ffffff);border:var(--ml-selected-popover-border, 1px solid #e5e7eb);border-radius:var(--ml-selected-popover-border-radius, .375rem);box-shadow:var(--ml-selected-popover-box-shadow, 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1));width:var(--ml-selected-popover-width, 20rem);max-height:var(--ml-selected-popover-max-height, 20rem);overflow:hidden}.ml__selected-popover--visible{display:flex;flex-direction:column}.ml__selected-popover-header{display:flex;align-items:center;justify-content:space-between;padding:var(--ml-selected-popover-header-padding, .5rem .75rem);background:var(--ml-selected-popover-header-bg, rgba(59, 130, 246, .1));border-bottom:var(--ml-selected-popover-header-border-bottom, 1px solid #e5e7eb);font-size:var(--ml-selected-popover-header-font-size, .875rem);font-weight:var(--ml-selected-popover-header-font-weight, 600);color:var(--ml-selected-popover-header-color, #111827)}.ml__selected-popover-close{display:flex;align-items:center;justify-content:center;width:var(--ml-popover-close-size, 1.5rem);height:var(--ml-popover-close-size, 1.5rem);padding:0;border:none;background:var(--ml-selected-popover-close-bg, transparent);color:var(--ml-selected-popover-close-color, #6b7280);font-size:var(--ml-selected-popover-close-font-size, 1.25rem);line-height:var(--ml-line-height-none, 1);cursor:pointer;border-radius:var(--ml-selected-popover-close-border-radius, 50%);transition:all var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}.ml__selected-popover-close:hover{background:var(--ml-selected-popover-close-bg-hover, rgba(59, 130, 246, .2));color:var(--ml-selected-popover-close-color-hover, #3b82f6)}.ml__selected-popover-body{display:flex;flex-direction:column;gap:var(--ml-selected-popover-body-gap, .25rem);padding:var(--ml-selected-popover-body-padding, .5rem);overflow-y:auto;max-height:var(--ml-selected-popover-body-max-height, 18rem)}.ml__selected-popover-body .ml__pill{width:100%}.ml__selected-popover-body .ml__pill-text{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.ml--rtl .ml__input-wrapper{direction:rtl}.ml--rtl .ml__input{text-align:right;padding-left:var(--ml-input-padding-right, 2.5rem);padding-right:var(--ml-input-padding-h, .75rem)}.ml--rtl .ml__toggle{left:var(--ml-toggle-right, .75rem)!important;right:auto!important}.ml--rtl .ml__count-badge{left:var(--ml-count-badge-offset, 2rem)!important;right:auto!important}.ml--rtl .ml__dropdown{direction:rtl;text-align:right}.ml--rtl .ml__option{flex-direction:row-reverse}.ml--rtl .ml__checkbox{margin-left:var(--ml-spacing-sm, .5rem);margin-right:0}.ml--rtl .ml__option-content{text-align:right}.ml--rtl .ml__option-icon{margin-left:var(--ml-spacing-xs, .25rem);margin-right:0}.ml--rtl .ml__pills{direction:rtl}.ml--rtl .ml__pill{flex-direction:row-reverse}.ml--rtl .ml__pill-remove{border-radius:var(--ml-pill-remove-border-radius-rtl, .375rem) 0 0 var(--ml-pill-remove-border-radius-rtl, .375rem);border-left:var(--ml-pill-remove-border, none);border-right:none}.ml--rtl .ml__pill-text{border-radius:0 var(--ml-pill-text-border-radius-rtl, .375rem) var(--ml-pill-text-border-radius-rtl, .375rem) 0}.ml--rtl .ml__count-display{direction:rtl}.ml--rtl .ml__count-badge-wrapper{flex-direction:row-reverse}.ml--rtl .ml__selected-popover{direction:rtl;text-align:right}.ml--rtl .ml__actions{direction:rtl}.ml--rtl .ml__group-label,.ml--rtl .ml__empty{text-align:right}.ml--rtl .ml__hint{direction:rtl;text-align:right}.ml--xs .ml__input{font-size:var(--ml-font-size-xs, .75rem)}.ml--xs .ml__option{padding:var(--ml-spacing-xs, .25rem) var(--ml-spacing-sm, .5rem)}.ml--xs .ml__option-title{font-size:var(--ml-font-size-xs, .75rem)}.ml--xs .ml__pill{font-size:var(--ml-font-size-2xs, .625rem)}.ml--sm .ml__input,.ml--sm .ml__option-title{font-size:var(--ml-font-size-xs, .75rem)}.ml--lg .ml__input,.ml--lg .ml__option-title{font-size:var(--ml-font-size-base, 1rem)}.ml--lg .ml__pill{font-size:var(--ml-font-size-sm, .875rem)}.ml--xl .ml__input,.ml--xl .ml__option-title{font-size:var(--ml-font-size-lg, 1.125rem)}.ml--xl .ml__pill{font-size:var(--ml-font-size-base, 1rem)}.ml--disabled .ml__input{opacity:var(--ml-disabled-input-opacity, .6);cursor:not-allowed;background:var(--ml-input-bg-disabled, rgba(107, 114, 128, .05))}.ml--disabled .ml__toggle{opacity:var(--ml-disabled-input-opacity, .6)}.ml--no-checkboxes .ml__option{gap:0;padding-left:var(--ml-option-padding-h, .75rem)}.ml--no-checkboxes .ml__option-content{padding-left:0}.ml-debug-info{margin-top:.25rem;padding:.25rem;background-color:#f9fafb;border:1px solid #e5e7eb;border-radius:.375rem;font-size:.75rem;color:#111827}.ml-debug-info details summary{cursor:pointer;font-weight:600;color:#2563eb;-webkit-user-select:none;user-select:none;padding:.25rem;border-radius:.25rem}.ml-debug-info details summary:hover{background-color:#f3f4f6}.ml-debug-info details summary:focus{outline:2px solid #3b82f6;outline-offset:2px}.ml-debug-info .ml-debug-stats{display:flex;flex-direction:column;gap:.25rem;margin-top:.25rem;padding:.25rem;background-color:#fff;border-radius:.25rem}.ml-debug-info .ml-debug-stats span{display:flex;justify-content:space-between;padding:2px 4px;font-family:monospace;font-size:.625rem}.ml-debug-info .ml-debug-stats span:before{content:"•";margin-right:.25rem;color:#3b82f6}',zt=typeof HTMLElement<"u"?HTMLElement:class{},we=new Set;function We(){return Array.from(we)}class _e extends zt{constructor(){super();h(this,"picker");h(this,"containerElement");h(this,"shadow");h(this,"_options");h(this,"_valueMember");h(this,"_getValueCallback");h(this,"_displayValueMember");h(this,"_getDisplayValueCallback");h(this,"_searchValueMember");h(this,"_getSearchValueCallback");h(this,"_iconMember");h(this,"_getIconCallback");h(this,"_subtitleMember");h(this,"_getSubtitleCallback");h(this,"_groupMember");h(this,"_getGroupCallback");h(this,"_disabledMember");h(this,"_getDisabledCallback");h(this,"_getValueFormatCallback");h(this,"_getPillTooltipCallback");h(this,"_getCountPillCallback");h(this,"_searchCallback");h(this,"_addNewCallback");h(this,"_selectCallback");h(this,"_deselectCallback");h(this,"_changeCallback");this.shadow=this.attachShadow({mode:"open"});const t=document.createElement("style");t.textContent=Lt,this.shadow.appendChild(t),requestAnimationFrame(()=>{this.setAttribute("data-ready","")})}static get observedAttributes(){return["search-hint","search-placeholder","multiple","allow-groups","allow-select-all","allow-clear-all","show-checkboxes","sticky-actions","close-on-select","lock-placement","dropdown-min-width","pills-display-mode","pills-threshold","pills-max-visible","pills-threshold-mode","pills-position","show-count-badge","max-height","empty-message","loading-message","min-search-length","enable-search","search-input-mode","allow-add-new","initial-values","value-member","display-value-member","search-value-member","icon-member","subtitle-member","group-member","disabled-member","name","value-format","enable-pill-tooltips","pill-tooltip-placement","show-debug-info"]}connectedCallback(){we.add(this),this.render(),this.initializePicker()}disconnectedCallback(){we.delete(this),this.picker&&this.picker.destroy()}attributeChangedCallback(t,l,o){l!==o&&this.picker&&t!=="initial-values"&&(this.picker.destroy(),this.initializePicker())}render(){this.containerElement=document.createElement("div"),this.containerElement.setAttribute("data-multiselect",""),this.className&&(this.containerElement.className=this.className),this.shadow.appendChild(this.containerElement),this.getAttribute("show-debug-info")==="true"&&this.renderDebugInfo()}renderDebugInfo(){const t=this.shadow.querySelector(".ml-debug-info");t&&t.remove();const l=document.createElement("div");l.className="ml-debug-info";const o=document.createElement("details"),s=document.createElement("summary");s.textContent="Debug Info";const n=document.createElement("div");n.className="ml-debug-stats",o.appendChild(s),o.appendChild(n),l.appendChild(o),this.shadow.appendChild(l),this.updateDebugInfo()}updateDebugInfo(){var u,g;const t=this.shadow.querySelector(".ml-debug-stats");if(!t||!this.picker)return;const l="1.0.0-rc04",o=We().length,n=this.picker.getSelected().length,r=((u=this._options)==null?void 0:u.length)||0,a=this.picker,c=a.isOpen||!1,p=a.searchTerm||"",d=a.isLoading||!1,m=((g=a.filteredOptions)==null?void 0:g.length)||0;t.innerHTML=`
|
|
36
|
+
`}handleSelectedPopoverClick(e){if(e.stopPropagation(),e.target.closest(".ml__selected-popover-close")){e.preventDefault(),this.hideSelectedPopover();return}const l=e.target.closest(".ml__pill-remove");if(l){e.preventDefault();const o=l.dataset.value,s=this.selectedOptions.get(o);s&&(this.deselectOption(s),this.renderSelectedPopover(),this.selectedValues.size===0&&this.hideSelectedPopover())}}positionSelectedPopover(){this.selectedPopoverCleanup=re(this.input,this.selectedPopover,()=>{const e=this.selectedPopoverPlacement||"bottom-start";de(this.input,this.selectedPopover,{placement:e,middleware:[ae(4),...this.selectedPopoverPlacement?[]:[ve()],ce({padding:8})]}).then(({x:t,y:l,placement:o})=>{this.selectedPopoverPlacement||(this.selectedPopoverPlacement=o,f.debug(`[${this.instanceId}] Locked popover placement:`,o));const s={left:`${t}px`,top:`${l}px`,width:`${this.input.offsetWidth}px`};this.options.dropdownMinWidth&&(s.minWidth=this.options.dropdownMinWidth),Object.assign(this.selectedPopover.style,s)})})}updateHiddenInput(){if(!this.options.formFieldId)return;this.hiddenInputs.forEach(o=>o.remove()),this.hiddenInputs=[];const e=this.options.valueFormat||"json",t=Array.from(this.selectedOptions.values()).map(o=>this.getItemValue(o)),l=this.options.hostElement||this.element;if(e==="array")t.forEach(o=>{const s=document.createElement("input");s.type="hidden",s.name=`${this.options.formFieldId}[]`,s.value=String(o),l.appendChild(s),this.hiddenInputs.push(s)});else{const o=document.createElement("input");o.type="hidden",o.name=this.options.formFieldId,o.id=this.options.formFieldId,o.value=this.getFormValue(),l.appendChild(o),this.hiddenInputs.push(o)}}getFormValue(){const e=Array.from(this.selectedOptions.values()).map(l=>this.getItemValue(l));return this.options.getValueFormatCallback?this.options.getValueFormatCallback(e):(this.options.valueFormat||"json")==="csv"?e.join(","):JSON.stringify(e)}getSelected(){return Array.from(this.selectedOptions.values())}setSelected(e){this.selectedValues=new Set(e.map(t=>String(t))),this.selectedOptions.clear(),e.forEach(t=>{const l=String(t),o=this.allOptions.find(s=>String(this.getItemValue(s))===l);o&&this.selectedOptions.set(l,o)}),this.renderDropdown(),this.renderPills(),this.updateHiddenInput()}get selectedItem(){return this.selectedOptions.size===0?null:Array.from(this.selectedOptions.values())[0]}get selectedValue(){if(!this.options.valueMember&&!this.options.getValueCallback)return null;if(this.selectedOptions.size===0)return this.options.isMultipleEnabled?[]:null;const e=Array.from(this.selectedOptions.values()).map(t=>this.getItemValue(t));return this.options.isMultipleEnabled?e:e[0]??null}getValue(){if(this.selectedOptions.size===0)return this.options.isMultipleEnabled?[]:null;const e=Array.from(this.selectedOptions.values()).map(t=>this.getItemValue(t));return this.options.isMultipleEnabled?e:e[0]??null}attachPillTooltips(){if(!this.options.isPillTooltipsEnabled){console.log("[Tooltips] Disabled - isPillTooltipsEnabled is false");return}const e=this.pillsContainer.querySelectorAll(".ml__pill:not(.ml__pill--more)");console.log(`[Tooltips] Found ${e.length} pills to attach tooltips to`),e.forEach(l=>{const o=l,s=o.querySelector(".ml__pill-remove");if(!s)return;const n=s.dataset.value,r=this.selectedOptions.get(n);if(!r)return;const a=o.querySelector(".ml__pill-text");a&&this.createTooltipForElement(a,r,n);const c=this.getItemPillDisplayValue(r);this.createRemoveButtonTooltip(s,c,n)});const t=this.pillsContainer.querySelector(".ml__pill--more");if(t){const l=t.querySelector(".ml__pill-remove");if(l&&l.dataset.action==="remove-hidden"){const o=this.options.pillsMaxVisible||3,n=Array.from(this.selectedOptions.values()).length-o;this.createRemoveButtonTooltip(l,`${n} hidden items`,"more-badge-remove")}}}createTooltipForElement(e,t,l){const o=document.createElement("div");o.className="ml__pill-tooltip";let s;if(this.options.getPillTooltipCallback)s=this.options.getPillTooltipCallback(t),console.log("[Tooltips] Using custom callback for tooltip content");else{const d=this.getItemPillDisplayValue(t),m=this.getItemSubtitle(t);s=m?`${d}
|
|
37
|
+
${m}`:d,console.log(`[Tooltips] Using default content: "${s}"`)}typeof s=="string"?o.textContent=s:o.appendChild(s),(this.options.container||document.body).appendChild(o),console.log(`[Tooltips] Tooltip element created and appended for "${l}"`),this.pillTooltips.set(l,o);let r,a;const c=()=>{clearTimeout(a),console.log(`[Tooltips] Mouse entered pill "${l}", will show tooltip in ${this.options.pillTooltipDelay||300}ms`),r=window.setTimeout(()=>{console.log(`[Tooltips] Showing tooltip for "${l}"`),o.classList.add("ml__pill-tooltip--visible"),this.positionPillTooltip(e,o,l)},this.options.pillTooltipDelay||300)},p=()=>{clearTimeout(r),a=window.setTimeout(()=>{o.classList.remove("ml__pill-tooltip--visible"),this.cleanupPillTooltip(l)},100)};e.addEventListener("mouseenter",c),e.addEventListener("mouseleave",p)}createRemoveButtonTooltip(e,t,l){const o=document.createElement("div");o.className="ml__pill-tooltip",o.textContent=`Remove ${t}`,(this.options.container||document.body).appendChild(o);const n=`${l}-remove`;this.pillTooltips.set(n,o);let r,a;const c=()=>{clearTimeout(a);const d=this.pillTooltips.get(l);d&&d.classList.remove("ml__pill-tooltip--visible"),r=window.setTimeout(()=>{o.classList.add("ml__pill-tooltip--visible"),this.positionPillTooltip(e,o,n)},this.options.pillTooltipDelay||300)},p=()=>{clearTimeout(r),a=window.setTimeout(()=>{o.classList.remove("ml__pill-tooltip--visible"),this.cleanupPillTooltip(n)},100)};e.addEventListener("mouseenter",c),e.addEventListener("mouseleave",p)}positionPillTooltip(e,t,l){const o=re(e,t,()=>{de(e,t,{placement:this.options.pillTooltipPlacement||"top",strategy:"fixed",middleware:[ae(this.options.pillTooltipOffset||8),ve(),ce({padding:8})]}).then(({x:s,y:n})=>{Object.assign(t.style,{left:`${s}px`,top:`${n}px`}),console.log(`[Tooltips] Positioned tooltip "${l}" at x:${s}, y:${n}`,{placement:this.options.pillTooltipPlacement||"top",tooltipClasses:t.className,tooltipDisplay:window.getComputedStyle(t).display,tooltipOpacity:window.getComputedStyle(t).opacity,tooltipVisibility:window.getComputedStyle(t).visibility,tooltipZIndex:window.getComputedStyle(t).zIndex,tooltipPosition:window.getComputedStyle(t).position})})});this.pillTooltipCleanups.set(l,o)}cleanupPillTooltip(e){const t=this.pillTooltipCleanups.get(e);t&&(t(),this.pillTooltipCleanups.delete(e))}destroyAllPillTooltips(){this.pillTooltipCleanups.forEach(e=>e()),this.pillTooltipCleanups.clear(),this.pillTooltips.forEach(e=>e.remove()),this.pillTooltips.clear()}destroy(){this.destroyAllPillTooltips(),this.dropdownCleanup&&this.dropdownCleanup(),this.hintCleanup&&this.hintCleanup(),this.selectedPopoverCleanup&&this.selectedPopoverCleanup(),this.dropdown&&this.dropdown.remove(),this.hint&&this.hint.remove(),this.selectedPopover&&this.selectedPopover.remove(),this.element.innerHTML="",this.element.classList.remove("ml","ml--open","ml--no-checkboxes"),console.log("[MultiSelect] Destroyed")}}const Lt='@charset "UTF-8";multi-select:not(:defined){display:block;min-height:2.5rem;color:transparent!important;background:transparent}.ml-wrapper{display:flex;flex-direction:column;align-items:stretch}.ml-wrapper--inline{flex-direction:row;align-items:flex-start}.ml{position:relative;width:100%}.ml__input-wrapper{position:relative;display:flex;align-items:center}.ml__input{width:100%;padding:var(--ml-input-padding, .5rem .75rem);padding-right:var(--ml-input-padding-right, 2.5rem);font-size:var(--ml-input-font-size, .875rem);border:var(--ml-input-border-style, 1px solid #d1d5db);border-radius:var(--ml-input-border-radius, .375rem);background:var(--ml-input-bg, #ffffff);color:var(--ml-input-text, #111827);cursor:pointer;transition:border-color var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}.ml__input:focus{outline:none;border-color:var(--ml-input-focus-border-color, #3b82f6)}.ml__input::placeholder{color:var(--ml-input-placeholder-color, #6b7280);opacity:0;transition:opacity var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}:host([data-ready]) .ml__input::placeholder{opacity:var(--ml-placeholder-opacity, .6)}.ml__toggle{position:absolute;right:var(--ml-toggle-right, .75rem);top:50%;transform:var(--ml-transform-center-y, translateY(-50%));pointer-events:none;color:var(--ml-toggle-color, #6b7280);transition:transform var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}.ml--open .ml__toggle{transform:var(--ml-transform-center-y, translateY(-50%)) rotate(var(--ml-transform-rotate-180, 180deg))}.ml__count-badge{position:absolute;right:var(--ml-count-badge-offset, 2rem);top:50%;transform:var(--ml-transform-center-y, translateY(-50%));padding:var(--ml-count-badge-padding, .125rem .25rem);background:var(--ml-count-badge-bg, #3b82f6);color:var(--ml-count-badge-color, #ffffff);font-size:var(--ml-count-badge-font-size, .75rem);font-weight:var(--ml-count-badge-font-weight, 600);border-radius:var(--ml-count-badge-border-radius, .25rem);cursor:pointer;transition:all var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}.ml__count-badge:hover{background:var(--ml-count-badge-bg-hover, #2563eb);transform:var(--ml-transform-center-y, translateY(-50%)) scale(var(--ml-transform-scale-hover, 1.1))}.ml__hint{display:none;position:absolute;z-index:var(--ml-z-index-popover, 10000);padding:var(--ml-hint-padding, .5rem .75rem);background:var(--ml-hint-bg, #ffffff);border:var(--ml-hint-border, 1px solid #e5e7eb);border-radius:var(--ml-hint-border-radius, .375rem);box-shadow:var(--ml-hint-box-shadow, 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -2px rgba(0, 0, 0, .1));font-size:var(--ml-hint-font-size, .75rem);color:var(--ml-hint-color, #6b7280);line-height:var(--ml-line-height-relaxed, 1.4);max-width:100%}.ml__hint--visible{display:block}.ml__dropdown{display:none;position:absolute;z-index:var(--ml-z-index-dropdown, 9999);background:var(--ml-dropdown-bg, #ffffff);border:var(--ml-dropdown-border, 1px solid #e5e7eb);border-radius:var(--ml-dropdown-border-radius, .375rem);box-shadow:var(--ml-dropdown-box-shadow, 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1));max-height:var(--ml-dropdown-max-height, 20rem);overflow-y:auto;color:var(--ml-dropdown-color, #111827)}.ml__dropdown--visible{display:block}.ml__actions{display:flex;gap:var(--ml-actions-gap, .25rem);padding:var(--ml-actions-padding, .5rem);border-bottom:var(--ml-actions-border-bottom, 1px solid #e5e7eb)}.ml__actions--sticky{position:sticky;top:0;z-index:var(--ml-z-index-sticky, 1);background:var(--ml-actions-bg, #ffffff)}.ml__action-btn{flex:1;padding:var(--ml-action-btn-padding, .25rem .5rem);font-size:var(--ml-action-btn-font-size, .75rem);border:var(--ml-action-btn-border, 1px solid #e5e7eb);border-radius:var(--ml-action-btn-border-radius, .25rem);background:var(--ml-action-btn-bg, transparent);color:var(--ml-action-btn-color, inherit);cursor:pointer;transition:all var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}.ml__action-btn:hover{background:var(--ml-action-btn-bg-hover, #f3f4f6);border-color:var(--ml-action-btn-border-color-hover, #3b82f6)}.ml__action-btn:active{transform:scale(var(--ml-transform-scale-active, .98))}.ml__options{padding:var(--ml-options-padding, .25rem 0)}.ml__group+.ml__group{border-top:var(--ml-group-border-top, 1px solid #e5e7eb);margin-top:var(--ml-group-margin-top, .25rem);padding-top:var(--ml-group-padding-top, .25rem)}.ml__group-label{padding:var(--ml-group-label-padding, .25rem .75rem);font-size:var(--ml-group-label-font-size, .75rem);font-weight:var(--ml-group-label-font-weight, 600);color:var(--ml-group-label-color, #6b7280);text-transform:var(--ml-group-label-transform, uppercase);letter-spacing:var(--ml-group-label-letter-spacing, .05em)}.ml__option{display:flex;align-items:flex-start;gap:var(--ml-option-gap, .5rem);padding:var(--ml-option-padding, .5rem .75rem);cursor:pointer;transition:background-color var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}.ml__option:hover{background:var(--ml-option-bg-hover, #f9fafb)}.ml__option--focused{background:var(--ml-option-bg-focused, #f9fafb);outline:var(--ml-option-outline-focused, 2px solid #3b82f6);outline-offset:var(--ml-option-focus-outline-offset, -2px)}.ml__option--selected{background:var(--ml-option-bg-selected, rgba(59, 130, 246, .1))}.ml__option--disabled{opacity:var(--ml-disabled-opacity, .5);cursor:not-allowed}.ml__option--disabled:hover{background:var(--ml-option-bg, transparent)}.ml__checkbox{flex-shrink:0;margin-top:var(--ml-checkbox-margin-top, .125rem);cursor:pointer}.ml__option--disabled .ml__checkbox{cursor:not-allowed}.ml__option-content{flex:1;display:flex;align-items:flex-start;gap:var(--ml-option-content-gap, .5rem);min-width:0}.ml__option-icon{flex-shrink:0;width:var(--ml-option-icon-size, 1.25rem);height:var(--ml-option-icon-size, 1.25rem);display:flex;align-items:center;justify-content:center;font-size:var(--ml-option-icon-font-size, 1rem)}.ml__option-icon svg{width:100%;height:100%;fill:currentColor}.ml__option-text{flex:1;min-width:0}.ml__option-title{font-size:var(--ml-option-title-font-size, .875rem);color:var(--ml-option-title-color, inherit);line-height:var(--ml-line-height-relaxed, 1.4)}.ml__option-title mark{background:var(--ml-option-mark-bg, rgba(59, 130, 246, .2));color:var(--ml-option-mark-color, inherit);font-weight:var(--ml-option-mark-font-weight, 600)}.ml__option-subtitle{margin-top:var(--ml-option-subtitle-margin-top, .25rem);font-size:var(--ml-option-subtitle-font-size, .75rem);color:var(--ml-option-subtitle-color, #6b7280);line-height:var(--ml-option-subtitle-line-height, 1.3)}.ml__empty{padding:var(--ml-empty-padding, 1rem .75rem);text-align:center;font-size:var(--ml-empty-font-size, .875rem);color:var(--ml-empty-color, #6b7280)}.ml__loader{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:var(--ml-loader-padding, 1rem);gap:var(--ml-loader-gap, .5rem)}.ml__loading-text{font-size:var(--ml-loading-text-font-size, .875rem);color:var(--ml-loading-text-color, #6b7280)}.ml__pills{display:flex;flex-wrap:wrap;gap:var(--ml-pills-gap, .5rem);padding:0}.ml__pills:empty{display:none}.ml__pills--bottom{margin-top:var(--ml-pills-margin-bottom, .5rem)}.ml__pills--top{margin-bottom:var(--ml-pills-margin-top, .5rem);order:var(--ml-order-first, -1)}.ml__pills--left{order:var(--ml-order-first, -1);margin-right:var(--ml-pills-margin-left, .25rem);justify-content:flex-end}.ml__pills--right{margin-left:var(--ml-pills-margin-right, .25rem);justify-content:flex-start}.ml__count-display{display:flex;align-items:center}.ml__count-display:empty{display:none}.ml__count-display--bottom{margin-top:var(--ml-count-display-margin-bottom, .5rem)}.ml__count-display--top{margin-bottom:var(--ml-count-display-margin-top, .5rem);order:var(--ml-order-first, -1)}.ml__count-display--left{order:var(--ml-order-first, -1);margin-right:var(--ml-count-display-margin-left, .5rem);justify-content:flex-start}.ml__count-display--right{margin-left:var(--ml-count-display-margin-right, .5rem);justify-content:flex-end}.ml__count-badge-wrapper{display:inline-flex;align-items:center;gap:var(--ml-count-badge-wrapper-gap, .25rem);background:var(--ml-count-badge-wrapper-bg, transparent);border:var(--ml-count-badge-wrapper-border, 1px solid #e5e7eb);border-radius:var(--ml-count-badge-wrapper-border-radius, .25rem);padding:var(--ml-count-badge-wrapper-padding, .25rem .5rem);transition:all var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}.ml__count-badge-wrapper:hover{background:var(--ml-count-badge-wrapper-bg-hover, #f9fafb);border-color:var(--ml-count-badge-wrapper-border-color-hover, #3b82f6)}.ml__count-text{display:inline-flex;align-items:center;background:var(--ml-count-text-bg, transparent);border:var(--ml-count-text-border, none);padding:0;font-size:var(--ml-count-text-font-size, .875rem);color:var(--ml-count-text-color, #111827);cursor:pointer;transition:color var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}.ml__count-clear{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:var(--ml-count-clear-size, 1rem);height:var(--ml-count-clear-size, 1rem);padding:0;border:none;background:var(--ml-count-clear-bg, transparent);color:var(--ml-count-clear-color, #6b7280);font-size:var(--ml-count-clear-font-size, 1.125rem);line-height:var(--ml-line-height-none, 1);cursor:pointer;border-radius:var(--ml-count-clear-border-radius, 50%);transition:all var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}.ml__count-clear:hover{background:var(--ml-count-clear-bg-hover, rgba(59, 130, 246, .2));color:var(--ml-count-clear-color-hover, #3b82f6)}.ml__count-clear:before{content:var(--ml-icon-clear, "×")}.ml__pill{display:inline-flex;align-items:center;height:var(--ml-pill-height, 1.5rem);font-size:var(--ml-pill-font-size, .75rem);font-weight:var(--ml-pill-font-weight, 600);line-height:var(--ml-line-height-none, 1);border-radius:var(--ml-pill-border-radius, .375rem);overflow:hidden;max-width:100%}.ml__pill-text{display:flex;align-items:center;height:100%;padding:var(--ml-pill-text-padding, 0 .5rem);background:var(--ml-pill-text-bg, #eff6ff);color:var(--ml-pill-text-color, #3b82f6);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition:background-color var(--ml-transition-normal, .2s) ease}.ml__pill-remove{display:flex;align-items:center;justify-content:center;width:var(--ml-pill-remove-width, 1.5rem);height:100%;flex-shrink:0;background:var(--ml-pill-remove-bg, #3b82f6);color:var(--ml-pill-remove-color, #ffffff);border:var(--ml-pill-remove-border, none);cursor:pointer;transition:background-color var(--ml-transition-normal, .2s) ease;font-size:var(--ml-pill-remove-font-size, .75rem)}.ml__pill-remove:hover{background:var(--ml-pill-remove-bg-hover, #2563eb)}.ml__pill-remove:focus{outline:none;box-shadow:var(--ml-pill-remove-box-shadow-focus, 0 0 0 2px rgba(59, 130, 246, .5))}.ml__pill-remove:before{content:var(--ml-icon-remove, "×");font-size:var(--ml-font-size-base, 1rem);line-height:var(--ml-line-height-none, 1)}.ml__pill--more{cursor:pointer}.ml__pill--more .ml__pill-text{background:var(--ml-more-badge-bg, #eff6ff);font-weight:var(--ml-pill-font-weight, 600)}.ml__pill--more:hover .ml__pill-text{background:var(--ml-more-badge-hover-bg, #ffffff)}.ml__pill--more:active .ml__pill-text{background:var(--ml-more-badge-active-bg, #e0f2fe)}.ml__pill-tooltip{position:fixed;z-index:var(--ml-tooltip-z-index, 10000);opacity:0;visibility:hidden;transition:opacity var(--ml-transition-normal, .2s) ease,visibility var(--ml-transition-normal, .2s) ease;background:var(--ml-tooltip-bg, #333);color:var(--ml-tooltip-color, #fff);padding:var(--ml-tooltip-padding, .5rem .75rem);border-radius:var(--ml-tooltip-border-radius, .375rem);font-size:var(--ml-tooltip-font-size, .875rem);line-height:var(--ml-line-height-relaxed, 1.4);max-width:var(--ml-tooltip-max-width, 20rem);word-wrap:break-word;white-space:pre-wrap;box-shadow:var(--ml-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, .15));pointer-events:none}.ml__pill-tooltip--visible{opacity:1;visibility:visible}.ml__selected-popover{display:none;position:absolute;z-index:var(--ml-z-index-popover, 10000);background:var(--ml-selected-popover-bg, #ffffff);border:var(--ml-selected-popover-border, 1px solid #e5e7eb);border-radius:var(--ml-selected-popover-border-radius, .375rem);box-shadow:var(--ml-selected-popover-box-shadow, 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1));width:var(--ml-selected-popover-width, 20rem);max-height:var(--ml-selected-popover-max-height, 20rem);overflow:hidden}.ml__selected-popover--visible{display:flex;flex-direction:column}.ml__selected-popover-header{display:flex;align-items:center;justify-content:space-between;padding:var(--ml-selected-popover-header-padding, .5rem .75rem);background:var(--ml-selected-popover-header-bg, rgba(59, 130, 246, .1));border-bottom:var(--ml-selected-popover-header-border-bottom, 1px solid #e5e7eb);font-size:var(--ml-selected-popover-header-font-size, .875rem);font-weight:var(--ml-selected-popover-header-font-weight, 600);color:var(--ml-selected-popover-header-color, #111827)}.ml__selected-popover-close{display:flex;align-items:center;justify-content:center;width:var(--ml-popover-close-size, 1.5rem);height:var(--ml-popover-close-size, 1.5rem);padding:0;border:none;background:var(--ml-selected-popover-close-bg, transparent);color:var(--ml-selected-popover-close-color, #6b7280);font-size:var(--ml-selected-popover-close-font-size, 1.25rem);line-height:var(--ml-line-height-none, 1);cursor:pointer;border-radius:var(--ml-selected-popover-close-border-radius, 50%);transition:all var(--ml-transition-fast, .15s) var(--ml-easing-snappy, cubic-bezier(.4, 0, .2, 1))}.ml__selected-popover-close:hover{background:var(--ml-selected-popover-close-bg-hover, rgba(59, 130, 246, .2));color:var(--ml-selected-popover-close-color-hover, #3b82f6)}.ml__selected-popover-body{display:flex;flex-direction:column;gap:var(--ml-selected-popover-body-gap, .25rem);padding:var(--ml-selected-popover-body-padding, .5rem);overflow-y:auto;max-height:var(--ml-selected-popover-body-max-height, 18rem)}.ml__selected-popover-body .ml__pill{width:100%}.ml__selected-popover-body .ml__pill-text{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.ml--rtl .ml__input-wrapper{direction:rtl}.ml--rtl .ml__input{text-align:right;padding-left:var(--ml-input-padding-right, 2.5rem);padding-right:var(--ml-input-padding-h, .75rem)}.ml--rtl .ml__toggle{left:var(--ml-toggle-right, .75rem)!important;right:auto!important}.ml--rtl .ml__count-badge{left:var(--ml-count-badge-offset, 2rem)!important;right:auto!important}.ml--rtl .ml__dropdown{direction:rtl;text-align:right}.ml--rtl .ml__option{flex-direction:row-reverse}.ml--rtl .ml__checkbox{margin-left:var(--ml-spacing-sm, .5rem);margin-right:0}.ml--rtl .ml__option-content{text-align:right}.ml--rtl .ml__option-icon{margin-left:var(--ml-spacing-xs, .25rem);margin-right:0}.ml--rtl .ml__pills{direction:rtl}.ml--rtl .ml__pill{flex-direction:row-reverse}.ml--rtl .ml__pill-remove{border-radius:var(--ml-pill-remove-border-radius-rtl, .375rem) 0 0 var(--ml-pill-remove-border-radius-rtl, .375rem);border-left:var(--ml-pill-remove-border, none);border-right:none}.ml--rtl .ml__pill-text{border-radius:0 var(--ml-pill-text-border-radius-rtl, .375rem) var(--ml-pill-text-border-radius-rtl, .375rem) 0}.ml--rtl .ml__count-display{direction:rtl}.ml--rtl .ml__count-badge-wrapper{flex-direction:row-reverse}.ml--rtl .ml__selected-popover{direction:rtl;text-align:right}.ml--rtl .ml__actions{direction:rtl}.ml--rtl .ml__group-label,.ml--rtl .ml__empty{text-align:right}.ml--rtl .ml__hint{direction:rtl;text-align:right}.ml--xs .ml__input{font-size:var(--ml-font-size-xs, .75rem)}.ml--xs .ml__option{padding:var(--ml-spacing-xs, .25rem) var(--ml-spacing-sm, .5rem)}.ml--xs .ml__option-title{font-size:var(--ml-font-size-xs, .75rem)}.ml--xs .ml__pill{font-size:var(--ml-font-size-2xs, .625rem)}.ml--sm .ml__input,.ml--sm .ml__option-title{font-size:var(--ml-font-size-xs, .75rem)}.ml--lg .ml__input,.ml--lg .ml__option-title{font-size:var(--ml-font-size-base, 1rem)}.ml--lg .ml__pill{font-size:var(--ml-font-size-sm, .875rem)}.ml--xl .ml__input,.ml--xl .ml__option-title{font-size:var(--ml-font-size-lg, 1.125rem)}.ml--xl .ml__pill{font-size:var(--ml-font-size-base, 1rem)}.ml--disabled .ml__input{opacity:var(--ml-disabled-input-opacity, .6);cursor:not-allowed;background:var(--ml-input-bg-disabled, rgba(107, 114, 128, .05))}.ml--disabled .ml__toggle{opacity:var(--ml-disabled-input-opacity, .6)}.ml--no-checkboxes .ml__option{gap:0;padding-left:var(--ml-option-padding-h, .75rem)}.ml--no-checkboxes .ml__option-content{padding-left:0}.ml-debug-info{margin-top:.25rem;padding:.25rem;background-color:#f9fafb;border:1px solid #e5e7eb;border-radius:.375rem;font-size:.75rem;color:#111827}.ml-debug-info details summary{cursor:pointer;font-weight:600;color:#2563eb;-webkit-user-select:none;user-select:none;padding:.25rem;border-radius:.25rem}.ml-debug-info details summary:hover{background-color:#f3f4f6}.ml-debug-info details summary:focus{outline:2px solid #3b82f6;outline-offset:2px}.ml-debug-info .ml-debug-stats{display:flex;flex-direction:column;gap:.25rem;margin-top:.25rem;padding:.25rem;background-color:#fff;border-radius:.25rem}.ml-debug-info .ml-debug-stats span{display:flex;justify-content:space-between;padding:2px 4px;font-family:monospace;font-size:.625rem}.ml-debug-info .ml-debug-stats span:before{content:"•";margin-right:.25rem;color:#3b82f6}',zt=typeof HTMLElement<"u"?HTMLElement:class{},we=new Set;function We(){return Array.from(we)}class _e extends zt{constructor(){super();h(this,"picker");h(this,"containerElement");h(this,"shadow");h(this,"_options");h(this,"_valueMember");h(this,"_getValueCallback");h(this,"_displayValueMember");h(this,"_getDisplayValueCallback");h(this,"_getPillDisplayCallback");h(this,"_searchValueMember");h(this,"_getSearchValueCallback");h(this,"_iconMember");h(this,"_getIconCallback");h(this,"_subtitleMember");h(this,"_getSubtitleCallback");h(this,"_groupMember");h(this,"_getGroupCallback");h(this,"_disabledMember");h(this,"_getDisabledCallback");h(this,"_getValueFormatCallback");h(this,"_getPillTooltipCallback");h(this,"_getCountPillCallback");h(this,"_searchCallback");h(this,"_addNewCallback");h(this,"_selectCallback");h(this,"_deselectCallback");h(this,"_changeCallback");this.shadow=this.attachShadow({mode:"open"});const t=document.createElement("style");t.textContent=Lt,this.shadow.appendChild(t),requestAnimationFrame(()=>{this.setAttribute("data-ready","")})}static get observedAttributes(){return["search-hint","search-placeholder","multiple","allow-groups","allow-select-all","allow-clear-all","show-checkboxes","sticky-actions","close-on-select","lock-placement","dropdown-min-width","pills-display-mode","pills-threshold","pills-max-visible","pills-threshold-mode","pills-position","show-count-badge","max-height","empty-message","loading-message","min-search-length","enable-search","search-input-mode","allow-add-new","initial-values","value-member","display-value-member","search-value-member","icon-member","subtitle-member","group-member","disabled-member","name","value-format","enable-pill-tooltips","pill-tooltip-placement","show-debug-info"]}connectedCallback(){we.add(this),this.render(),this.initializePicker()}disconnectedCallback(){we.delete(this),this.picker&&this.picker.destroy()}attributeChangedCallback(t,l,o){l!==o&&this.picker&&t!=="initial-values"&&(this.picker.destroy(),this.initializePicker())}render(){this.containerElement=document.createElement("div"),this.containerElement.setAttribute("data-multiselect",""),this.className&&(this.containerElement.className=this.className),this.shadow.appendChild(this.containerElement),this.getAttribute("show-debug-info")==="true"&&this.renderDebugInfo()}renderDebugInfo(){const t=this.shadow.querySelector(".ml-debug-info");t&&t.remove();const l=document.createElement("div");l.className="ml-debug-info";const o=document.createElement("details"),s=document.createElement("summary");s.textContent="Debug Info";const n=document.createElement("div");n.className="ml-debug-stats",o.appendChild(s),o.appendChild(n),l.appendChild(o),this.shadow.appendChild(l),this.updateDebugInfo()}updateDebugInfo(){var u,g;const t=this.shadow.querySelector(".ml-debug-stats");if(!t||!this.picker)return;const l="1.0.0-rc04",o=We().length,n=this.picker.getSelected().length,r=((u=this._options)==null?void 0:u.length)||0,a=this.picker,c=a.isOpen||!1,p=a.searchTerm||"",d=a.isLoading||!1,m=((g=a.filteredOptions)==null?void 0:g.length)||0;t.innerHTML=`
|
|
38
38
|
<span>Version: ${l}</span>
|
|
39
39
|
<span>Total Instances: ${o}</span>
|
|
40
40
|
<span>Options: ${r}</span>
|
|
@@ -43,4 +43,4 @@ ${m}`:d,console.log(`[Tooltips] Using default content: "${s}"`)}typeof s=="strin
|
|
|
43
43
|
<span>Dropdown: ${c?"Open":"Closed"}</span>
|
|
44
44
|
<span>Search: ${p||"none"}</span>
|
|
45
45
|
<span>Loading: ${d?"Yes":"No"}</span>
|
|
46
|
-
`,setTimeout(()=>{this.getAttribute("show-debug-info")==="true"&&this.updateDebugInfo()},500)}initializePicker(){if(!this.containerElement)return;let t;const l=this.getAttribute("initial-values");if(l)try{t=JSON.parse(l)}catch(s){console.error("[MultiSelectElement] Failed to parse initial-values:",s)}const o={searchHint:this.getAttribute("search-hint")||void 0,searchPlaceholder:this.getAttribute("search-placeholder")||"Search...",dropdownMinWidth:this.getAttribute("dropdown-min-width")||void 0,pillsDisplayMode:this.getAttribute("pills-display-mode")||"pills",pillsPosition:this.getAttribute("pills-position")||"bottom",pillsThresholdMode:this.getAttribute("pills-threshold-mode")||"count",maxHeight:this.getAttribute("max-height")||"20rem",emptyMessage:this.getAttribute("empty-message")||"No results found",loadingMessage:this.getAttribute("loading-message")||"Loading...",searchInputMode:this.getAttribute("search-input-mode")||"normal",pillsThreshold:this.getAttribute("pills-threshold")?parseInt(this.getAttribute("pills-threshold")):void 0,pillsMaxVisible:this.getAttribute("pills-max-visible")?parseInt(this.getAttribute("pills-max-visible")):void 0,minSearchLength:this.getAttribute("min-search-length")?parseInt(this.getAttribute("min-search-length")):0,isMultipleEnabled:this.getAttribute("multiple")!=="false",isGroupsAllowed:this.getAttribute("allow-groups")!=="false",isSelectAllAllowed:this.getAttribute("allow-select-all")!=="false",isClearAllAllowed:this.getAttribute("allow-clear-all")!=="false",isCheckboxesShown:this.getAttribute("show-checkboxes")!=="false",isActionsSticky:this.getAttribute("sticky-actions")!=="false",isCloseOnSelect:this.getAttribute("close-on-select")==="true",isPlacementLocked:this.getAttribute("lock-placement")!=="false",isSearchEnabled:this.getAttribute("enable-search")!=="false",isAddNewAllowed:this.getAttribute("allow-add-new")==="true",isCountBadgeShown:this.getAttribute("show-count-badge")==="true",valueMember:this.getAttribute("value-member")||this._valueMember,displayValueMember:this.getAttribute("display-value-member")||this._displayValueMember,searchValueMember:this.getAttribute("search-value-member")||this._searchValueMember,iconMember:this.getAttribute("icon-member")||this._iconMember,subtitleMember:this.getAttribute("subtitle-member")||this._subtitleMember,groupMember:this.getAttribute("group-member")||this._groupMember,disabledMember:this.getAttribute("disabled-member")||this._disabledMember,getValueCallback:this._getValueCallback,getDisplayValueCallback:this._getDisplayValueCallback,getSearchValueCallback:this._getSearchValueCallback,getIconCallback:this._getIconCallback,getSubtitleCallback:this._getSubtitleCallback,getGroupCallback:this._getGroupCallback,getDisabledCallback:this._getDisabledCallback,formFieldId:this.getAttribute("name")||void 0,valueFormat:this.getAttribute("value-format")||"json",getValueFormatCallback:this._getValueFormatCallback,isPillTooltipsEnabled:this.getAttribute("enable-pill-tooltips")==="true",getPillTooltipCallback:this._getPillTooltipCallback,pillTooltipPlacement:this.getAttribute("pill-tooltip-placement")||"top",pillTooltipDelay:parseInt(this.getAttribute("pill-tooltip-delay")||"300"),pillTooltipOffset:parseInt(this.getAttribute("pill-tooltip-offset")||"8"),getCountPillCallback:this._getCountPillCallback||((s,n)=>n!==void 0?`+${n} more`:`${s} selected`),options:this._options,searchCallback:this._searchCallback,addNewCallback:this._addNewCallback,selectCallback:s=>{var n,r;this._selectCallback&&this._selectCallback(s),this.dispatchEvent(new CustomEvent("select",{detail:{option:s,selectedOptions:(n=this.picker)==null?void 0:n.getSelected(),selectedValues:Array.from(((r=this.picker)==null?void 0:r.getValue())||[])}}))},deselectCallback:s=>{var n,r;this._deselectCallback&&this._deselectCallback(s),this.dispatchEvent(new CustomEvent("deselect",{detail:{option:s,selectedOptions:(n=this.picker)==null?void 0:n.getSelected(),selectedValues:Array.from(((r=this.picker)==null?void 0:r.getValue())||[])}}))},changeCallback:s=>{var n;this._changeCallback&&this._changeCallback(s),this.dispatchEvent(new CustomEvent("change",{detail:{selectedOptions:s,selectedValues:Array.from(((n=this.picker)==null?void 0:n.getValue())||[])}}))},container:this.shadow,hostElement:this};t&&(this.containerElement.dataset.initialValues=JSON.stringify(t)),this.picker=new je(this.containerElement,o)}reinitialize(){this.picker&&(this.picker.destroy(),this.initializePicker())}get options(){return this._options}set options(t){this._options=t,this.reinitialize()}set valueMember(t){this._valueMember=t||void 0,t?this.setAttribute("value-member",t):this.removeAttribute("value-member")}get valueMember(){return this.getAttribute("value-member")}set displayValueMember(t){this._displayValueMember=t||void 0,t?this.setAttribute("display-value-member",t):this.removeAttribute("display-value-member")}get displayValueMember(){return this.getAttribute("display-value-member")}set searchValueMember(t){this._searchValueMember=t||void 0,t?this.setAttribute("search-value-member",t):this.removeAttribute("search-value-member")}get searchValueMember(){return this.getAttribute("search-value-member")}set iconMember(t){this._iconMember=t||void 0,t?this.setAttribute("icon-member",t):this.removeAttribute("icon-member")}get iconMember(){return this.getAttribute("icon-member")}set subtitleMember(t){this._subtitleMember=t||void 0,t?this.setAttribute("subtitle-member",t):this.removeAttribute("subtitle-member")}get subtitleMember(){return this.getAttribute("subtitle-member")}set groupMember(t){this._groupMember=t||void 0,t?this.setAttribute("group-member",t):this.removeAttribute("group-member")}get groupMember(){return this.getAttribute("group-member")}set disabledMember(t){this._disabledMember=t||void 0,t?this.setAttribute("disabled-member",t):this.removeAttribute("disabled-member")}get disabledMember(){return this.getAttribute("disabled-member")}set getValueCallback(t){this._getValueCallback=t,this.reinitialize()}get getValueCallback(){return this._getValueCallback}set getDisplayValueCallback(t){this._getDisplayValueCallback=t,this.reinitialize()}get getDisplayValueCallback(){return this._getDisplayValueCallback}set getSearchValueCallback(t){this._getSearchValueCallback=t,this.reinitialize()}get getSearchValueCallback(){return this._getSearchValueCallback}set getIconCallback(t){this._getIconCallback=t,this.reinitialize()}get getIconCallback(){return this._getIconCallback}set getSubtitleCallback(t){this._getSubtitleCallback=t,this.reinitialize()}get getSubtitleCallback(){return this._getSubtitleCallback}set getGroupCallback(t){this._getGroupCallback=t,this.reinitialize()}get getGroupCallback(){return this._getGroupCallback}set getDisabledCallback(t){this._getDisabledCallback=t,this.reinitialize()}get getDisabledCallback(){return this._getDisabledCallback}set name(t){t?this.setAttribute("name",t):this.removeAttribute("name")}get name(){return this.getAttribute("name")}set valueFormat(t){t?this.setAttribute("value-format",t):this.removeAttribute("value-format")}get valueFormat(){return this.getAttribute("value-format")}set getValueFormatCallback(t){this._getValueFormatCallback=t,this.reinitialize()}get getValueFormatCallback(){return this._getValueFormatCallback}set thresholdMode(t){t?this.setAttribute("threshold-mode",t):this.removeAttribute("threshold-mode")}get thresholdMode(){return this.getAttribute("threshold-mode")}set pillsMaxVisible(t){t!==null?this.setAttribute("pills-max-visible",String(t)):this.removeAttribute("pills-max-visible")}get pillsMaxVisible(){const t=this.getAttribute("pills-max-visible");return t?parseInt(t):null}set enablePillTooltips(t){t?this.setAttribute("enable-pill-tooltips","true"):this.removeAttribute("enable-pill-tooltips")}get enablePillTooltips(){return this.getAttribute("enable-pill-tooltips")==="true"}set pillTooltipPlacement(t){t?this.setAttribute("pill-tooltip-placement",t):this.removeAttribute("pill-tooltip-placement")}get pillTooltipPlacement(){return this.getAttribute("pill-tooltip-placement")}set getPillTooltipCallback(t){this._getPillTooltipCallback=t,this.reinitialize()}get getPillTooltipCallback(){return this._getPillTooltipCallback}set getCountPillCallback(t){this._getCountPillCallback=t,this.reinitialize()}get getCountPillCallback(){return this._getCountPillCallback}get searchCallback(){return this._searchCallback}set searchCallback(t){this._searchCallback=t,this.reinitialize()}get addNewCallback(){return this._addNewCallback}set addNewCallback(t){this._addNewCallback=t,this.reinitialize()}get selectCallback(){return this._selectCallback}set selectCallback(t){this._selectCallback=t}get deselectCallback(){return this._deselectCallback}set deselectCallback(t){this._deselectCallback=t}get changeCallback(){return this._changeCallback}set changeCallback(t){this._changeCallback=t}get selectedValue(){var t;return((t=this.picker)==null?void 0:t.selectedValue)??null}get selectedItem(){var t;return((t=this.picker)==null?void 0:t.selectedItem)??null}getSelected(){return this.picker?this.picker.getSelected():[]}setSelected(t){this.picker&&this.picker.setSelected(t)}getValue(){return this.picker?this.picker.getValue():null}destroy(){this.picker&&this.picker.destroy()}}typeof window<"u"&&typeof customElements<"u"&&(customElements.get("multi-select")||customElements.define("multi-select",_e)),typeof window<"u"&&(window.keenmate=window.keenmate||{},window.keenmate.multiselect={version:()=>"1.0.0-rc04",config:{name:"@keenmate/web-multiselect",version:"1.0.0-rc04",author:"Keenmate",license:"MIT",repository:"git+https://github.com/keenmate/web-multiselect.git",homepage:"https://github.com/keenmate/web-multiselect#readme"},register:()=>{typeof customElements<"u"&&!customElements.get("multi-select")&&customElements.define("multi-select",_e)},getInstances:()=>We()}),A.MultiSelectElement=_e,A.PureMultiSelect=je,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|
|
46
|
+
`,setTimeout(()=>{this.getAttribute("show-debug-info")==="true"&&this.updateDebugInfo()},500)}initializePicker(){if(!this.containerElement)return;let t;const l=this.getAttribute("initial-values");if(l)try{t=JSON.parse(l)}catch(s){console.error("[MultiSelectElement] Failed to parse initial-values:",s)}const o={searchHint:this.getAttribute("search-hint")||void 0,searchPlaceholder:this.getAttribute("search-placeholder")||"Search...",dropdownMinWidth:this.getAttribute("dropdown-min-width")||void 0,pillsDisplayMode:this.getAttribute("pills-display-mode")||"pills",pillsPosition:this.getAttribute("pills-position")||"bottom",pillsThresholdMode:this.getAttribute("pills-threshold-mode")||"count",maxHeight:this.getAttribute("max-height")||"20rem",emptyMessage:this.getAttribute("empty-message")||"No results found",loadingMessage:this.getAttribute("loading-message")||"Loading...",searchInputMode:this.getAttribute("search-input-mode")||"normal",pillsThreshold:this.getAttribute("pills-threshold")?parseInt(this.getAttribute("pills-threshold")):void 0,pillsMaxVisible:this.getAttribute("pills-max-visible")?parseInt(this.getAttribute("pills-max-visible")):void 0,minSearchLength:this.getAttribute("min-search-length")?parseInt(this.getAttribute("min-search-length")):0,isMultipleEnabled:this.getAttribute("multiple")!=="false",isGroupsAllowed:this.getAttribute("allow-groups")!=="false",isSelectAllAllowed:this.getAttribute("allow-select-all")!=="false",isClearAllAllowed:this.getAttribute("allow-clear-all")!=="false",isCheckboxesShown:this.getAttribute("show-checkboxes")!=="false",isActionsSticky:this.getAttribute("sticky-actions")!=="false",isCloseOnSelect:this.getAttribute("close-on-select")==="true",isPlacementLocked:this.getAttribute("lock-placement")!=="false",isSearchEnabled:this.getAttribute("enable-search")!=="false",isAddNewAllowed:this.getAttribute("allow-add-new")==="true",isCountBadgeShown:this.getAttribute("show-count-badge")==="true",valueMember:this.getAttribute("value-member")||this._valueMember,displayValueMember:this.getAttribute("display-value-member")||this._displayValueMember,searchValueMember:this.getAttribute("search-value-member")||this._searchValueMember,iconMember:this.getAttribute("icon-member")||this._iconMember,subtitleMember:this.getAttribute("subtitle-member")||this._subtitleMember,groupMember:this.getAttribute("group-member")||this._groupMember,disabledMember:this.getAttribute("disabled-member")||this._disabledMember,getValueCallback:this._getValueCallback,getDisplayValueCallback:this._getDisplayValueCallback,getPillDisplayCallback:this._getPillDisplayCallback,getSearchValueCallback:this._getSearchValueCallback,getIconCallback:this._getIconCallback,getSubtitleCallback:this._getSubtitleCallback,getGroupCallback:this._getGroupCallback,getDisabledCallback:this._getDisabledCallback,formFieldId:this.getAttribute("name")||void 0,valueFormat:this.getAttribute("value-format")||"json",getValueFormatCallback:this._getValueFormatCallback,isPillTooltipsEnabled:this.getAttribute("enable-pill-tooltips")==="true",getPillTooltipCallback:this._getPillTooltipCallback,pillTooltipPlacement:this.getAttribute("pill-tooltip-placement")||"top",pillTooltipDelay:parseInt(this.getAttribute("pill-tooltip-delay")||"300"),pillTooltipOffset:parseInt(this.getAttribute("pill-tooltip-offset")||"8"),getCountPillCallback:this._getCountPillCallback||((s,n)=>n!==void 0?`+${n} more`:`${s} selected`),options:this._options,searchCallback:this._searchCallback,addNewCallback:this._addNewCallback,selectCallback:s=>{var n,r;this._selectCallback&&this._selectCallback(s),this.dispatchEvent(new CustomEvent("select",{detail:{option:s,selectedOptions:(n=this.picker)==null?void 0:n.getSelected(),selectedValues:Array.from(((r=this.picker)==null?void 0:r.getValue())||[])}}))},deselectCallback:s=>{var n,r;this._deselectCallback&&this._deselectCallback(s),this.dispatchEvent(new CustomEvent("deselect",{detail:{option:s,selectedOptions:(n=this.picker)==null?void 0:n.getSelected(),selectedValues:Array.from(((r=this.picker)==null?void 0:r.getValue())||[])}}))},changeCallback:s=>{var n;this._changeCallback&&this._changeCallback(s),this.dispatchEvent(new CustomEvent("change",{detail:{selectedOptions:s,selectedValues:Array.from(((n=this.picker)==null?void 0:n.getValue())||[])}}))},container:this.shadow,hostElement:this};t&&(this.containerElement.dataset.initialValues=JSON.stringify(t)),this.picker=new je(this.containerElement,o)}reinitialize(){this.picker&&(this.picker.destroy(),this.initializePicker())}get options(){return this._options}set options(t){this._options=t,this.reinitialize()}set valueMember(t){this._valueMember=t||void 0,t?this.setAttribute("value-member",t):this.removeAttribute("value-member")}get valueMember(){return this.getAttribute("value-member")}set displayValueMember(t){this._displayValueMember=t||void 0,t?this.setAttribute("display-value-member",t):this.removeAttribute("display-value-member")}get displayValueMember(){return this.getAttribute("display-value-member")}set searchValueMember(t){this._searchValueMember=t||void 0,t?this.setAttribute("search-value-member",t):this.removeAttribute("search-value-member")}get searchValueMember(){return this.getAttribute("search-value-member")}set iconMember(t){this._iconMember=t||void 0,t?this.setAttribute("icon-member",t):this.removeAttribute("icon-member")}get iconMember(){return this.getAttribute("icon-member")}set subtitleMember(t){this._subtitleMember=t||void 0,t?this.setAttribute("subtitle-member",t):this.removeAttribute("subtitle-member")}get subtitleMember(){return this.getAttribute("subtitle-member")}set groupMember(t){this._groupMember=t||void 0,t?this.setAttribute("group-member",t):this.removeAttribute("group-member")}get groupMember(){return this.getAttribute("group-member")}set disabledMember(t){this._disabledMember=t||void 0,t?this.setAttribute("disabled-member",t):this.removeAttribute("disabled-member")}get disabledMember(){return this.getAttribute("disabled-member")}set getValueCallback(t){this._getValueCallback=t,this.reinitialize()}get getValueCallback(){return this._getValueCallback}set getDisplayValueCallback(t){this._getDisplayValueCallback=t,this.reinitialize()}get getDisplayValueCallback(){return this._getDisplayValueCallback}set getPillDisplayCallback(t){this._getPillDisplayCallback=t,this.reinitialize()}get getPillDisplayCallback(){return this._getPillDisplayCallback}set getSearchValueCallback(t){this._getSearchValueCallback=t,this.reinitialize()}get getSearchValueCallback(){return this._getSearchValueCallback}set getIconCallback(t){this._getIconCallback=t,this.reinitialize()}get getIconCallback(){return this._getIconCallback}set getSubtitleCallback(t){this._getSubtitleCallback=t,this.reinitialize()}get getSubtitleCallback(){return this._getSubtitleCallback}set getGroupCallback(t){this._getGroupCallback=t,this.reinitialize()}get getGroupCallback(){return this._getGroupCallback}set getDisabledCallback(t){this._getDisabledCallback=t,this.reinitialize()}get getDisabledCallback(){return this._getDisabledCallback}set name(t){t?this.setAttribute("name",t):this.removeAttribute("name")}get name(){return this.getAttribute("name")}set valueFormat(t){t?this.setAttribute("value-format",t):this.removeAttribute("value-format")}get valueFormat(){return this.getAttribute("value-format")}set getValueFormatCallback(t){this._getValueFormatCallback=t,this.reinitialize()}get getValueFormatCallback(){return this._getValueFormatCallback}set thresholdMode(t){t?this.setAttribute("threshold-mode",t):this.removeAttribute("threshold-mode")}get thresholdMode(){return this.getAttribute("threshold-mode")}set pillsMaxVisible(t){t!==null?this.setAttribute("pills-max-visible",String(t)):this.removeAttribute("pills-max-visible")}get pillsMaxVisible(){const t=this.getAttribute("pills-max-visible");return t?parseInt(t):null}set enablePillTooltips(t){t?this.setAttribute("enable-pill-tooltips","true"):this.removeAttribute("enable-pill-tooltips")}get enablePillTooltips(){return this.getAttribute("enable-pill-tooltips")==="true"}set pillTooltipPlacement(t){t?this.setAttribute("pill-tooltip-placement",t):this.removeAttribute("pill-tooltip-placement")}get pillTooltipPlacement(){return this.getAttribute("pill-tooltip-placement")}set getPillTooltipCallback(t){this._getPillTooltipCallback=t,this.reinitialize()}get getPillTooltipCallback(){return this._getPillTooltipCallback}set getCountPillCallback(t){this._getCountPillCallback=t,this.reinitialize()}get getCountPillCallback(){return this._getCountPillCallback}get searchCallback(){return this._searchCallback}set searchCallback(t){this._searchCallback=t,this.reinitialize()}get addNewCallback(){return this._addNewCallback}set addNewCallback(t){this._addNewCallback=t,this.reinitialize()}get selectCallback(){return this._selectCallback}set selectCallback(t){this._selectCallback=t}get deselectCallback(){return this._deselectCallback}set deselectCallback(t){this._deselectCallback=t}get changeCallback(){return this._changeCallback}set changeCallback(t){this._changeCallback=t}get selectedValue(){var t;return((t=this.picker)==null?void 0:t.selectedValue)??null}get selectedItem(){var t;return((t=this.picker)==null?void 0:t.selectedItem)??null}getSelected(){return this.picker?this.picker.getSelected():[]}setSelected(t){this.picker&&this.picker.setSelected(t)}getValue(){return this.picker?this.picker.getValue():null}destroy(){this.picker&&this.picker.destroy()}}typeof window<"u"&&typeof customElements<"u"&&(customElements.get("multi-select")||customElements.define("multi-select",_e)),typeof window<"u"&&(window.keenmate=window.keenmate||{},window.keenmate.multiselect={version:()=>"1.0.0-rc04",config:{name:"@keenmate/web-multiselect",version:"1.0.0-rc04",author:"Keenmate",license:"MIT",repository:"git+https://github.com/keenmate/web-multiselect.git",homepage:"https://github.com/keenmate/web-multiselect#readme"},register:()=>{typeof customElements<"u"&&!customElements.get("multi-select")&&customElements.define("multi-select",_e)},getInstances:()=>We()}),P.MultiSelectElement=_e,P.PureMultiSelect=je,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keenmate/web-multiselect",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-rc05",
|
|
4
4
|
"description": "Lightweight multiselect web component with typeahead search, rich content support, and excellent keyboard navigation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/multiselect.umd.js",
|