@rcarls/rc-select 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/custom-elements.json +120 -10
- package/dist/{rc-select-Bu4ukw92.js → rc-select-BRp1j-JD.js} +75 -26
- package/dist/rc-select-BRp1j-JD.js.map +1 -0
- package/dist/rc-select-define.js +1 -1
- package/dist/rc-select.js +1 -1
- package/dist/types/packages/rc-select/src/rc-select.d.ts +68 -1
- package/package.json +1 -1
- package/dist/rc-select-Bu4ukw92.js.map +0 -1
package/README.md
CHANGED
|
@@ -49,9 +49,9 @@ import '@rcarls/rc-select/define';
|
|
|
49
49
|
| `disabled` | `boolean` | Mirrors the slotted `<select disabled>` state. |
|
|
50
50
|
| `placeholder` | `string` | Text shown when no value is selected. |
|
|
51
51
|
| `display` | `'auto' \| 'chips' \| 'compact'` | Controls multi-select display. |
|
|
52
|
+
| `value` | `string \| string[]` | Controlled selection. Programmatic writes apply silently. |
|
|
52
53
|
| `openPopup()` | `void` | Opens the listbox popover. |
|
|
53
54
|
| `closePopup(returnFocus?)` | `void` | Closes the listbox and optionally restores focus. |
|
|
54
|
-
| `setSelected(values)` | `void` | Replaces selection without relying on mutation observation. |
|
|
55
55
|
|
|
56
56
|
## Events
|
|
57
57
|
|
|
@@ -89,6 +89,16 @@
|
|
|
89
89
|
"name": "--rc-select-listbox-radius",
|
|
90
90
|
"default": "var(--rc-control-radius)"
|
|
91
91
|
},
|
|
92
|
+
{
|
|
93
|
+
"description": "Popup listbox border.",
|
|
94
|
+
"name": "--rc-select-listbox-border",
|
|
95
|
+
"default": "var(--rc-border)"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"description": "Popup listbox box shadow.",
|
|
99
|
+
"name": "--rc-select-shadow",
|
|
100
|
+
"default": "var(--rc-shadow)"
|
|
101
|
+
},
|
|
92
102
|
{
|
|
93
103
|
"description": "Popup listbox block padding.",
|
|
94
104
|
"name": "--rc-select-listbox-padding-block",
|
|
@@ -109,6 +119,16 @@
|
|
|
109
119
|
"name": "--rc-select-chip-padding-inline",
|
|
110
120
|
"default": "0.3em"
|
|
111
121
|
},
|
|
122
|
+
{
|
|
123
|
+
"description": "Gap between chip label and remove icon.",
|
|
124
|
+
"name": "--rc-select-chip-gap",
|
|
125
|
+
"default": "calc(var(--rc-control-gap, 0.25em) * 0.8)"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"description": "Multi-select chip border.",
|
|
129
|
+
"name": "--rc-select-chip-border",
|
|
130
|
+
"default": "var(--rc-border)"
|
|
131
|
+
},
|
|
112
132
|
{
|
|
113
133
|
"description": "Inline size of the toggle indicator container.",
|
|
114
134
|
"name": "--rc-select-toggle-indicator-size",
|
|
@@ -147,6 +167,10 @@
|
|
|
147
167
|
{
|
|
148
168
|
"description": "The open/close indicator container.",
|
|
149
169
|
"name": "toggle-indicator"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"description": "The `<rc-listbox>` popup element.",
|
|
173
|
+
"name": "listbox"
|
|
150
174
|
}
|
|
151
175
|
],
|
|
152
176
|
"slots": [
|
|
@@ -276,7 +300,7 @@
|
|
|
276
300
|
},
|
|
277
301
|
{
|
|
278
302
|
"kind": "field",
|
|
279
|
-
"name": "
|
|
303
|
+
"name": "_$selectRef",
|
|
280
304
|
"type": {
|
|
281
305
|
"text": "WeakRef<HTMLSelectElement> | null"
|
|
282
306
|
},
|
|
@@ -334,6 +358,36 @@
|
|
|
334
358
|
"privacy": "private",
|
|
335
359
|
"default": "false"
|
|
336
360
|
},
|
|
361
|
+
{
|
|
362
|
+
"kind": "field",
|
|
363
|
+
"name": "_pickerGuardActive",
|
|
364
|
+
"type": {
|
|
365
|
+
"text": "boolean"
|
|
366
|
+
},
|
|
367
|
+
"privacy": "protected",
|
|
368
|
+
"default": "false",
|
|
369
|
+
"description": "True while `_applyPickerGuard` has force-disabled the slotted multiple `<select>`."
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"kind": "field",
|
|
373
|
+
"name": "_pickerGuardConsumerDisabled",
|
|
374
|
+
"type": {
|
|
375
|
+
"text": "boolean"
|
|
376
|
+
},
|
|
377
|
+
"privacy": "protected",
|
|
378
|
+
"default": "false",
|
|
379
|
+
"description": "Consumer's `disabled` state on the select before the picker guard forced it; restored on teardown."
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"kind": "field",
|
|
383
|
+
"name": "_pickerGuardForm",
|
|
384
|
+
"type": {
|
|
385
|
+
"text": "HTMLFormElement | null"
|
|
386
|
+
},
|
|
387
|
+
"privacy": "protected",
|
|
388
|
+
"default": "null",
|
|
389
|
+
"description": "Form currently carrying the picker guard's `formdata` listener."
|
|
390
|
+
},
|
|
337
391
|
{
|
|
338
392
|
"kind": "field",
|
|
339
393
|
"name": "_typeAheadBuffer",
|
|
@@ -459,6 +513,62 @@
|
|
|
459
513
|
"privacy": "protected",
|
|
460
514
|
"description": "Document-capture keydown handler; closes the popup on `Escape`."
|
|
461
515
|
},
|
|
516
|
+
{
|
|
517
|
+
"kind": "field",
|
|
518
|
+
"name": "_onNativeSelectClick",
|
|
519
|
+
"privacy": "protected",
|
|
520
|
+
"description": "Suppress the native `<select>`'s default click action"
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
"kind": "method",
|
|
524
|
+
"name": "_applyPickerGuard",
|
|
525
|
+
"privacy": "protected",
|
|
526
|
+
"return": {
|
|
527
|
+
"type": {
|
|
528
|
+
"text": "void"
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
"parameters": [
|
|
532
|
+
{
|
|
533
|
+
"name": "$select",
|
|
534
|
+
"type": {
|
|
535
|
+
"text": "HTMLSelectElement"
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
],
|
|
539
|
+
"description": "Countermeasure for select[\"multiple\"] bug in Firefox for Android / GeckoView.\n\nWorks around a GeckoView bug where tapping anywhere inside an\nancestor `<label>`'s bounds opens the native picker dialog of a wrapped\n`<select multiple>`, even though the select is hidden and the tap landed on this\ncomponent's own UI.\n\nLabel activation on a disabled control is a spec-defined no-op, so the slotted select\nis force-disabled after upgrade while it is `multiple`. A disabled select submits\nnothing, so form submission is restored by appending the current selection in a\n`formdata` listener on the owning form (`_handleFormData`). A disabled select is also\nbarred from native constraint validation, so `_handleFormSubmit` enforces its\n`ValidityState` at submit time instead.\n\nScoped to multiple selects: the single-select picker path is already suppressed by\n`_onNativeSelectClick`. Pre-upgrade behavior is unaffected — the guard\nonly applies once the component initializes."
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
"kind": "method",
|
|
543
|
+
"name": "_syncFormListeners",
|
|
544
|
+
"privacy": "protected",
|
|
545
|
+
"return": {
|
|
546
|
+
"type": {
|
|
547
|
+
"text": "void"
|
|
548
|
+
}
|
|
549
|
+
},
|
|
550
|
+
"parameters": [
|
|
551
|
+
{
|
|
552
|
+
"name": "$form",
|
|
553
|
+
"type": {
|
|
554
|
+
"text": "HTMLFormElement | null"
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
],
|
|
558
|
+
"description": "Moves the picker guard's `formdata` and `submit` listeners to `$form`; pass `null` to detach."
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
"kind": "field",
|
|
562
|
+
"name": "_handleFormData",
|
|
563
|
+
"privacy": "protected",
|
|
564
|
+
"description": "Appends the current selection to the owning form's entry list.\n\nReplaces the submission the select would have produced were it\nnot force-disabled by `_applyPickerGuard`.\n\nAppend-only: entries from other same-named controls in the form\nare left alone."
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
"kind": "field",
|
|
568
|
+
"name": "_handleFormSubmit",
|
|
569
|
+
"privacy": "protected",
|
|
570
|
+
"description": "Enforces the slotted select's constraints at submit time.\n\nMirrors native scoping: skipped for `novalidate`\nforms and `formnovalidate` submitters, and never runs for `form.submit()`\n\nThe native validation bubble cannot render on a hidden control, so a\ncancelable `invalid` event is fired on the select (matching native\nreporting) and focus moves to the trigger unless the consumer cancels it."
|
|
571
|
+
},
|
|
462
572
|
{
|
|
463
573
|
"kind": "method",
|
|
464
574
|
"name": "_handleSelectSlotChange",
|
|
@@ -854,53 +964,53 @@
|
|
|
854
964
|
],
|
|
855
965
|
"attributes": [
|
|
856
966
|
{
|
|
857
|
-
"description": "
|
|
858
|
-
"name": "has-value"
|
|
859
|
-
},
|
|
860
|
-
{
|
|
967
|
+
"description": "Reflects whether the popup listbox is open.",
|
|
861
968
|
"name": "open",
|
|
862
969
|
"type": {
|
|
863
970
|
"text": "boolean"
|
|
864
971
|
},
|
|
865
972
|
"default": "false",
|
|
866
|
-
"description": "Reflects whether the popup listbox is open.",
|
|
867
973
|
"fieldName": "open"
|
|
868
974
|
},
|
|
869
975
|
{
|
|
976
|
+
"description": "Enables selection of multiple options simultaneously.",
|
|
870
977
|
"name": "multiple",
|
|
871
978
|
"type": {
|
|
872
979
|
"text": "boolean"
|
|
873
980
|
},
|
|
874
981
|
"default": "false",
|
|
875
|
-
"description": "Enables selection of multiple options simultaneously.",
|
|
876
982
|
"fieldName": "multiple"
|
|
877
983
|
},
|
|
878
984
|
{
|
|
985
|
+
"description": "Disables the trigger and prevents the popup from opening.",
|
|
879
986
|
"name": "disabled",
|
|
880
987
|
"type": {
|
|
881
988
|
"text": "boolean"
|
|
882
989
|
},
|
|
883
990
|
"default": "false",
|
|
884
|
-
"description": "Disables the trigger and prevents the popup from opening.",
|
|
885
991
|
"fieldName": "disabled"
|
|
886
992
|
},
|
|
887
993
|
{
|
|
994
|
+
"description": "Text shown in the trigger when no value is selected.",
|
|
888
995
|
"name": "placeholder",
|
|
889
996
|
"type": {
|
|
890
997
|
"text": "string"
|
|
891
998
|
},
|
|
892
999
|
"default": "''",
|
|
893
|
-
"description": "Text shown in the trigger when no value is selected.",
|
|
894
1000
|
"fieldName": "placeholder"
|
|
895
1001
|
},
|
|
896
1002
|
{
|
|
1003
|
+
"description": "Controls how selected values appear in the trigger.\n\n- `'chips'` — each selected value renders as a removable chip.\n- `'compact'` — selected values are summarized as \"First, +N more\".\n- `'auto'` — uses `'chips'` on pointer devices and `'compact'` on touch.",
|
|
897
1004
|
"name": "display",
|
|
898
1005
|
"type": {
|
|
899
1006
|
"text": "'auto' | 'chips' | 'compact'"
|
|
900
1007
|
},
|
|
901
1008
|
"default": "'auto'",
|
|
902
|
-
"description": "Controls how selected values appear in the trigger.\n\n- `'chips'` — each selected value renders as a removable chip.\n- `'compact'` — selected values are summarized as \"First, +N more\".\n- `'auto'` — uses `'chips'` on pointer devices and `'compact'` on touch.",
|
|
903
1009
|
"fieldName": "display"
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
"description": "Present when one or more options are selected. Use with CSS selectors (e.g. `rc-select[has-value]`) for floating-label wrappers.",
|
|
1013
|
+
"name": "has-value"
|
|
904
1014
|
}
|
|
905
1015
|
],
|
|
906
1016
|
"superclass": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css as f, LitElement as b, nothing as _, html as h } from "lit";
|
|
2
|
-
import { property as n, query as
|
|
3
|
-
import { NativeChildController as
|
|
2
|
+
import { property as n, query as d, state as p } from "lit/decorators.js";
|
|
3
|
+
import { NativeChildController as m, ActiveDescendantController as g, AnchorController as y } from "@rcarls/rc-common";
|
|
4
4
|
const x = f`
|
|
5
5
|
:host {
|
|
6
6
|
display: inline-block;
|
|
@@ -177,13 +177,13 @@ var k = Object.defineProperty, a = (v, e, t, i) => {
|
|
|
177
177
|
};
|
|
178
178
|
const u = class u extends b {
|
|
179
179
|
constructor() {
|
|
180
|
-
super(...arguments), this.open = !1, this.multiple = !1, this.disabled = !1, this.placeholder = "", this.display = "auto", this._selectedValues = /* @__PURE__ */ new Set(), this._chipNavIndex = -1, this._options = [], this.
|
|
180
|
+
super(...arguments), this.open = !1, this.multiple = !1, this.disabled = !1, this.placeholder = "", this.display = "auto", this._selectedValues = /* @__PURE__ */ new Set(), this._chipNavIndex = -1, this._options = [], this._$selectRef = null, this._selectController = new m(this, {
|
|
181
181
|
selector: ":scope > select",
|
|
182
182
|
observe: !0,
|
|
183
183
|
onChange: (e) => this._setupSelect(e),
|
|
184
184
|
onMissing: () => {
|
|
185
185
|
}
|
|
186
|
-
}), this._mutationObserver = null, this._selectionInitialized = !1, this._typeAheadBuffer = "", this._typeAheadTimer = 0, this._activeDescendantCtrl = new
|
|
186
|
+
}), this._mutationObserver = null, this._selectionInitialized = !1, this._pickerGuardActive = !1, this._pickerGuardConsumerDisabled = !1, this._pickerGuardForm = null, this._typeAheadBuffer = "", this._typeAheadTimer = 0, this._activeDescendantCtrl = new g(this, {
|
|
187
187
|
host: () => this._$trigger ?? null,
|
|
188
188
|
items: () => this._$listbox?.navigableItems ?? []
|
|
189
189
|
}), this._anchorCtrl = new y(this, {
|
|
@@ -196,15 +196,32 @@ const u = class u extends b {
|
|
|
196
196
|
this.open && (e.composedPath().includes(this) || this.closePopup(!1));
|
|
197
197
|
}, this._onDocKeyDown = (e) => {
|
|
198
198
|
this.open && e.key === "Escape" && (e.preventDefault(), this.closePopup());
|
|
199
|
+
}, this._onNativeSelectClick = (e) => {
|
|
200
|
+
e.preventDefault();
|
|
201
|
+
}, this._handleFormData = (e) => {
|
|
202
|
+
const t = this._$selectRef?.deref();
|
|
203
|
+
if (!(!this._pickerGuardActive || !t?.name))
|
|
204
|
+
for (const i of this.selectedValues)
|
|
205
|
+
e.formData.append(t.name, i);
|
|
206
|
+
}, this._handleFormSubmit = (e) => {
|
|
207
|
+
const t = this._$selectRef?.deref();
|
|
208
|
+
if (!this._pickerGuardActive || !t)
|
|
209
|
+
return;
|
|
210
|
+
const i = e.currentTarget, s = e.submitter;
|
|
211
|
+
if (i.noValidate || s?.formNoValidate || t.validity.valid)
|
|
212
|
+
return;
|
|
213
|
+
e.preventDefault(), t.dispatchEvent(new Event("invalid", { cancelable: !0 })) && this._$trigger?.focus();
|
|
199
214
|
};
|
|
200
215
|
}
|
|
201
216
|
connectedCallback() {
|
|
202
217
|
super.connectedCallback(), document.addEventListener("click", this._onDocClick, { capture: !0 }), document.addEventListener("keydown", this._onDocKeyDown, { capture: !0 });
|
|
218
|
+
const e = this._$selectRef?.deref();
|
|
219
|
+
e && this._pickerGuardActive && this._syncFormListeners(e.form);
|
|
203
220
|
}
|
|
204
221
|
disconnectedCallback() {
|
|
205
222
|
super.disconnectedCallback(), document.removeEventListener("click", this._onDocClick, { capture: !0 }), document.removeEventListener("keydown", this._onDocKeyDown, {
|
|
206
223
|
capture: !0
|
|
207
|
-
}), this._mutationObserver?.disconnect();
|
|
224
|
+
}), this._mutationObserver?.disconnect(), this._syncFormListeners(null);
|
|
208
225
|
}
|
|
209
226
|
updated(e) {
|
|
210
227
|
super.updated(e), this.toggleAttribute("has-value", this._selectedValues.size > 0);
|
|
@@ -270,6 +287,36 @@ const u = class u extends b {
|
|
|
270
287
|
const t = this.multiple ? e : e.slice(0, 1);
|
|
271
288
|
this._selectedValues = new Set(t), this._$listbox?.setSelectedValues(t), this._syncNativeSelect(), this.requestUpdate();
|
|
272
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Countermeasure for select["multiple"] bug in Firefox for Android / GeckoView.
|
|
292
|
+
*
|
|
293
|
+
* Works around a GeckoView bug where tapping anywhere inside an
|
|
294
|
+
* ancestor `<label>`'s bounds opens the native picker dialog of a wrapped
|
|
295
|
+
* `<select multiple>`, even though the select is hidden and the tap landed on this
|
|
296
|
+
* component's own UI.
|
|
297
|
+
*
|
|
298
|
+
* Label activation on a disabled control is a spec-defined no-op, so the slotted select
|
|
299
|
+
* is force-disabled after upgrade while it is `multiple`. A disabled select submits
|
|
300
|
+
* nothing, so form submission is restored by appending the current selection in a
|
|
301
|
+
* `formdata` listener on the owning form (`_handleFormData`). A disabled select is also
|
|
302
|
+
* barred from native constraint validation, so `_handleFormSubmit` enforces its
|
|
303
|
+
* `ValidityState` at submit time instead.
|
|
304
|
+
*
|
|
305
|
+
* Scoped to multiple selects: the single-select picker path is already suppressed by
|
|
306
|
+
* `_onNativeSelectClick`. Pre-upgrade behavior is unaffected — the guard
|
|
307
|
+
* only applies once the component initializes.
|
|
308
|
+
*
|
|
309
|
+
* @see https://bugzilla.mozilla.org/show_bug.cgi?id=1475723
|
|
310
|
+
*/
|
|
311
|
+
_applyPickerGuard(e) {
|
|
312
|
+
e.multiple && !this._pickerGuardActive ? (this._pickerGuardActive = !0, this._pickerGuardConsumerDisabled = e.disabled, e.disabled = !0) : !e.multiple && this._pickerGuardActive ? (this._pickerGuardActive = !1, e.disabled = this._pickerGuardConsumerDisabled) : e.multiple && !e.disabled && (this._pickerGuardConsumerDisabled = !1, this.disabled = !1, e.disabled = !0), this._syncFormListeners(this._pickerGuardActive ? e.form : null);
|
|
313
|
+
}
|
|
314
|
+
/** Moves the picker guard's `formdata` and `submit` listeners to `$form`; pass `null` to detach. */
|
|
315
|
+
_syncFormListeners(e) {
|
|
316
|
+
e !== this._pickerGuardForm && (this._pickerGuardForm?.removeEventListener("formdata", this._handleFormData), this._pickerGuardForm?.removeEventListener("submit", this._handleFormSubmit, {
|
|
317
|
+
capture: !0
|
|
318
|
+
}), this._pickerGuardForm = e, e?.addEventListener("formdata", this._handleFormData), e?.addEventListener("submit", this._handleFormSubmit, { capture: !0 }));
|
|
319
|
+
}
|
|
273
320
|
/**
|
|
274
321
|
* Resolves the slotted `<select>` on every `slotchange`, wires `_mutationObserver`,
|
|
275
322
|
* and seeds initial state via `queueMicrotask` to stay safe inside framework reactive passes.
|
|
@@ -278,22 +325,24 @@ const u = class u extends b {
|
|
|
278
325
|
this._selectController.sync();
|
|
279
326
|
}
|
|
280
327
|
_setupSelect(e) {
|
|
281
|
-
this._mutationObserver?.disconnect(), this._mutationObserver = null
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
328
|
+
this._mutationObserver?.disconnect(), this._mutationObserver = null;
|
|
329
|
+
const t = this._$selectRef?.deref();
|
|
330
|
+
t && (t.removeEventListener("click", this._onNativeSelectClick), this._pickerGuardActive && (t.disabled = this._pickerGuardConsumerDisabled)), this._pickerGuardActive = !1, this._syncFormListeners(null), this._$selectRef = e ? new WeakRef(e) : null, e && (e.addEventListener("click", this._onNativeSelectClick), queueMicrotask(() => {
|
|
331
|
+
e.isConnected && (this.multiple = e.multiple, this.disabled = e.disabled, this._syncOptionsFromSelect(e), this._applyPickerGuard(e), this._mutationObserver = new MutationObserver(() => {
|
|
332
|
+
const i = this._$selectRef?.deref();
|
|
333
|
+
if (i) {
|
|
334
|
+
if (this.multiple = i.multiple, this._pickerGuardActive || (this.disabled = i.disabled), this._applyPickerGuard(i), this._propertyOptions !== void 0) {
|
|
286
335
|
this._applySelectionFromCurrentSource();
|
|
287
336
|
return;
|
|
288
337
|
}
|
|
289
|
-
this._syncOptionsFromSelect(
|
|
338
|
+
this._syncOptionsFromSelect(i);
|
|
290
339
|
}
|
|
291
340
|
}), this._mutationObserver.observe(e, {
|
|
292
341
|
childList: !0,
|
|
293
342
|
subtree: !0,
|
|
294
343
|
attributes: !0
|
|
295
344
|
}), this._syncAccessibleName(e));
|
|
296
|
-
});
|
|
345
|
+
}));
|
|
297
346
|
}
|
|
298
347
|
/**
|
|
299
348
|
* Derives options from `$select` (or defers to `_propertyOptions` when set)
|
|
@@ -331,7 +380,7 @@ const u = class u extends b {
|
|
|
331
380
|
_currentOptions() {
|
|
332
381
|
if (this._propertyOptions !== void 0)
|
|
333
382
|
return this._propertyOptions;
|
|
334
|
-
const e = this.
|
|
383
|
+
const e = this._$selectRef?.deref();
|
|
335
384
|
return e ? this._optionsFromSelect(e) : [];
|
|
336
385
|
}
|
|
337
386
|
/**
|
|
@@ -351,12 +400,12 @@ const u = class u extends b {
|
|
|
351
400
|
}
|
|
352
401
|
/** Returns values of currently selected `<option>` nodes; falls back to `selectedValues` when no native select is present. */
|
|
353
402
|
_selectedValuesFromNativeSelect() {
|
|
354
|
-
const e = this.
|
|
403
|
+
const e = this._$selectRef?.deref();
|
|
355
404
|
return e ? Array.from(e.selectedOptions).map((t) => t.value).filter(Boolean) : this.selectedValues;
|
|
356
405
|
}
|
|
357
406
|
/** Returns values of `defaultSelected` `<option>` nodes (author `selected` attribute); falls back to `selectedValues`. */
|
|
358
407
|
_defaultSelectedValuesFromNativeSelect() {
|
|
359
|
-
const e = this.
|
|
408
|
+
const e = this._$selectRef?.deref();
|
|
360
409
|
return e ? Array.from(e.options).filter((t) => t.defaultSelected).map((t) => t.value).filter(Boolean) : this.selectedValues;
|
|
361
410
|
}
|
|
362
411
|
/**
|
|
@@ -366,7 +415,7 @@ const u = class u extends b {
|
|
|
366
415
|
* while writing to avoid re-entrant sync.
|
|
367
416
|
*/
|
|
368
417
|
_mirrorOptionsToNativeSelect() {
|
|
369
|
-
const e = this.
|
|
418
|
+
const e = this._$selectRef?.deref();
|
|
370
419
|
if (!(!e || this._propertyOptions === void 0)) {
|
|
371
420
|
this._mutationObserver?.disconnect(), e.replaceChildren();
|
|
372
421
|
for (const t of this._propertyOptions) {
|
|
@@ -387,7 +436,7 @@ const u = class u extends b {
|
|
|
387
436
|
_addOption(e) {
|
|
388
437
|
const t = this._options.some((r) => r.value === e.value) ? this._options.map((r) => r.value === e.value ? e : r) : [...this._options, e];
|
|
389
438
|
this._propertyOptions !== void 0 && (this._propertyOptions = t), this._syncOptions(t);
|
|
390
|
-
const i = this.
|
|
439
|
+
const i = this._$selectRef?.deref();
|
|
391
440
|
if (!i || Array.from(i.options).some((r) => r.value === e.value))
|
|
392
441
|
return;
|
|
393
442
|
const s = document.createElement("option");
|
|
@@ -437,7 +486,7 @@ const u = class u extends b {
|
|
|
437
486
|
}
|
|
438
487
|
/** Flips `selected` on each `<option>` in the native `<select>` to match `_selectedValues`; no-op when no native select is present. */
|
|
439
488
|
_syncNativeSelect() {
|
|
440
|
-
const e = this.
|
|
489
|
+
const e = this._$selectRef?.deref();
|
|
441
490
|
if (e)
|
|
442
491
|
for (const t of e.options)
|
|
443
492
|
t.selected = this._selectedValues.has(t.value);
|
|
@@ -471,7 +520,7 @@ const u = class u extends b {
|
|
|
471
520
|
}
|
|
472
521
|
/** Looks up the display label for `value` from native `<select>` option text; returns `value` itself as a fallback. */
|
|
473
522
|
_labelFor(e) {
|
|
474
|
-
const t = this.
|
|
523
|
+
const t = this._$selectRef?.deref();
|
|
475
524
|
if (t) {
|
|
476
525
|
for (const i of t.options)
|
|
477
526
|
if (i.value === e)
|
|
@@ -690,24 +739,24 @@ a([
|
|
|
690
739
|
n()
|
|
691
740
|
], o.prototype, "display");
|
|
692
741
|
a([
|
|
693
|
-
|
|
742
|
+
d("#anchor")
|
|
694
743
|
], o.prototype, "_$anchor");
|
|
695
744
|
a([
|
|
696
|
-
|
|
745
|
+
d("#trigger")
|
|
697
746
|
], o.prototype, "_$trigger");
|
|
698
747
|
a([
|
|
699
|
-
|
|
748
|
+
d("#listbox")
|
|
700
749
|
], o.prototype, "_$listbox");
|
|
701
750
|
a([
|
|
702
|
-
|
|
751
|
+
p()
|
|
703
752
|
], o.prototype, "_selectedValues");
|
|
704
753
|
a([
|
|
705
|
-
|
|
754
|
+
p()
|
|
706
755
|
], o.prototype, "_chipNavIndex");
|
|
707
756
|
a([
|
|
708
|
-
|
|
757
|
+
p()
|
|
709
758
|
], o.prototype, "_options");
|
|
710
759
|
export {
|
|
711
760
|
o as R
|
|
712
761
|
};
|
|
713
|
-
//# sourceMappingURL=rc-select-
|
|
762
|
+
//# sourceMappingURL=rc-select-BRp1j-JD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rc-select-BRp1j-JD.js","sources":["../src/rc-select.styles.ts","../src/rc-select.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const selectStyles = css`\n :host {\n display: inline-block;\n }\n\n #anchor {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: var(--rc-select-gap, var(--rc-control-gap, 0.25em));\n }\n\n #trigger {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: var(--rc-select-gap, var(--rc-control-gap, 0.25em));\n min-block-size: var(--rc-select-control-block-size, var(--rc-control-block-size, auto));\n padding: var(--rc-select-padding-block, var(--rc-control-padding-block, 1px))\n var(--rc-select-padding-inline, var(--rc-control-padding-inline, 4px));\n min-width: 8em;\n cursor: default;\n user-select: none;\n border: var(\n --rc-select-border,\n var(--rc-border, 1px solid var(--rc-border-color, ButtonBorder))\n );\n border-radius: var(--rc-select-radius, var(--rc-control-radius, var(--rc-radius-sm, 0.125em)));\n background: var(--rc-field, Field);\n color: var(--rc-field-text, FieldText);\n font-family: var(--rc-font-family, inherit);\n font-size: var(--rc-font-size, inherit);\n line-height: var(--rc-line-height, normal);\n transition:\n background-color var(--rc-motion-duration, 120ms),\n border-color var(--rc-motion-duration, 120ms),\n box-shadow var(--rc-motion-duration, 120ms);\n\n /* Keyboard focus indicator */\n outline: none;\n &:focus-visible {\n outline: var(--rc-focus-ring, auto);\n outline-offset: var(--rc-focus-ring-offset, 0);\n }\n }\n\n [part='value-display'] {\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n [part='toggle-indicator'] {\n flex-shrink: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n inline-size: var(--rc-select-toggle-indicator-size, 1.1em);\n }\n\n /* Chips — the whole chip is the remove button for a larger touch target */\n [part='chip'] {\n display: inline-flex;\n align-items: center;\n gap: var(--rc-select-chip-gap, calc(var(--rc-control-gap, 0.25em) * 0.8));\n padding: var(--rc-select-chip-padding-block, 0.1em) var(--rc-select-chip-padding-inline, 0.3em);\n border: var(\n --rc-select-chip-border,\n var(--rc-border, 1px solid var(--rc-border-color, ButtonBorder))\n );\n border-radius: var(--rc-select-chip-radius, var(--rc-radius-md, 0.25em));\n background: var(--rc-button-bg, ButtonFace);\n color: var(--rc-button-text, ButtonText);\n font: inherit;\n font-size: 0.875em;\n cursor: pointer;\n\n &:hover {\n background: var(--rc-highlight, Highlight);\n color: var(--rc-highlight-text, HighlightText);\n }\n\n &:focus-visible {\n outline: var(--rc-focus-ring, auto);\n outline-offset: var(--rc-focus-ring-offset, 0);\n }\n }\n\n /* Decorative × icon inside the chip — no interaction, aria-hidden */\n [part='chip-remove'] {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 1em;\n font-size: 0.85em;\n pointer-events: none;\n }\n\n /* Hide the default slot — visually suppresses the slotted native <select> */\n slot:not([name]) {\n display: none;\n }\n\n /* Listbox popup — positioned by AnchorController via adoptedStyleSheets */\n rc-listbox {\n max-height: var(--rc-select-max-height, 20em);\n overflow-y: auto;\n background: var(--rc-surface, Canvas);\n border: var(\n --rc-select-listbox-border,\n var(--rc-border, 1px solid var(--rc-border-color, ButtonBorder))\n );\n border-radius: var(--rc-select-listbox-radius, var(--rc-control-radius, 0));\n box-shadow: var(\n --rc-select-shadow,\n var(--rc-shadow, 0 2px 8px color-mix(in srgb, CanvasText 15%, transparent))\n );\n color: var(--rc-field-text, FieldText);\n padding-block: var(--rc-select-listbox-padding-block, var(--rc-control-padding-block, 0.25em));\n --rc-listbox-option-gap: var(--rc-item-gap, 0.4em);\n --rc-listbox-option-padding-block: var(--rc-item-padding-block, 0.3em);\n --rc-listbox-option-padding-inline: var(--rc-item-padding-inline, 0.75em);\n --rc-listbox-hover-bg: var(--rc-highlight, Highlight);\n --rc-listbox-hover-color: var(--rc-highlight-text, HighlightText);\n --rc-listbox-active-bg: var(--rc-highlight, Highlight);\n --rc-listbox-active-color: var(--rc-highlight-text, HighlightText);\n --rc-listbox-selected-bg: var(--rc-highlight, Highlight);\n --rc-listbox-selected-color: var(--rc-highlight-text, HighlightText);\n --rc-listbox-disabled-opacity: var(--rc-disabled-opacity, 0.5);\n\n &:not(:popover-open) {\n display: none;\n }\n }\n\n rc-listbox [part~='option'][hidden] {\n display: none;\n }\n\n rc-listbox [part~='option'][data-active]:not([aria-disabled='true']) {\n outline: var(--rc-focus-ring, 2px solid var(--rc-accent, Highlight));\n outline-offset: -2px;\n }\n\n rc-listbox [part~='option'][aria-disabled='true'] {\n cursor: not-allowed;\n }\n\n /* Selection checkmark — reserves space whether visible or not */\n rc-listbox [part~='option-checkmark'] {\n flex-shrink: 0;\n width: 1em;\n text-align: center;\n font-size: 0.85em;\n visibility: hidden;\n }\n\n rc-listbox [part~='option'][aria-selected='true'] [part~='option-checkmark'] {\n visibility: visible;\n }\n\n rc-listbox [part~='create-option'] {\n font-style: italic;\n border-top: 1px solid var(--rc-border-color, ButtonBorder);\n margin-top: 0.25em;\n padding-top: 0.3em;\n }\n`;\n\nexport default selectStyles;\n","import { LitElement, html, nothing, type PropertyValues } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport {\n ActiveDescendantController,\n AnchorController,\n NativeChildController,\n warnMissingDirectChild,\n} from '@rcarls/rc-common';\nimport type {\n RCListbox,\n RCListboxChangeEvent,\n ListboxOption,\n ListboxSelectableOption,\n} from '@rcarls/rc-listbox';\n\nimport { selectStyles } from './rc-select.styles.js';\n\nexport type RCSelectValue = string | string[];\n\nexport interface RCSelectChangeEvent {\n /** Updated value after the change. */\n value: RCSelectValue;\n\n /** All selected option values after the change. */\n selectedValues: string[];\n\n /** All selected option objects after the change. */\n selectedOptions: ListboxSelectableOption[];\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'rc-select': RCSelect;\n }\n}\n\n/**\n * Select-only combobox backed by a native <select>, following the WAI-ARIA Combobox\n * pattern.\n *\n * Wraps a native `<select>` (default slot) as the form value reflector while\n * rendering a custom button trigger and popup listbox. Popup placement\n * and `aria-activedescendant` virtual keyboard navigation are supported.\n *\n * @see {@link https://richardcarls.github.io/rc-webcomponents/components/rc-select rc-select docs}\n * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/combobox/ WAI-ARIA Combobox pattern}\n *\n * @slot - Required. A native `<select>` element used for form submission\n * and as the source of truth for options, multiple, and disabled state.\n * @slot display - Optional. Replaces the default value label in the trigger.\n * @slot toggle-indicator - Optional. Replaces the default chevron indicator. Accepts any\n * element(s); the container shifts to inline-start in RTL via flex direction.\n *\n * @fires rc-select-change - When user interaction changes selection.\n * `detail: { value, selectedValues, selectedOptions }`\n * @fires rc-select-open - When the popup opens.\n * @fires rc-select-close - When the popup closes.\n *\n * @csspart anchor - The flex container wrapping chips and trigger.\n * @csspart trigger - The combobox trigger element (div).\n * @csspart chips - The chips group container (when multiple).\n * @csspart chip - Individual chip (when multiple).\n * @csspart chip-label - Text label inside a chip.\n * @csspart chip-remove - Remove button inside a chip.\n * @csspart value-display - The text label showing selected value(s).\n * @csspart toggle-indicator - The open/close indicator container.\n * @csspart listbox - The `<rc-listbox>` popup element.\n *\n * @attr open - Reflects whether the popup listbox is open.\n * @attr multiple - Enables selection of multiple options simultaneously.\n * @attr disabled - Disables the trigger and prevents the popup from opening.\n * @attr placeholder - Text shown in the trigger when no value is selected.\n * @attr display - Controls how selected values appear in the trigger: `'auto'`,\n * `'chips'`, or `'compact'`.\n * @attr [has-value] - Present when one or more options are selected. Use with CSS\n * selectors (e.g. `rc-select[has-value]`) for floating-label wrappers.\n *\n * @cssprop [--rc-select-max-height=20em] - Maximum popup height.\n * @cssprop [--rc-select-control-block-size=var(--rc-control-block-size)] - Trigger block size.\n * @cssprop [--rc-select-padding-block=var(--rc-control-padding-block)] - Trigger block-axis padding.\n * @cssprop [--rc-select-padding-inline=var(--rc-control-padding-inline)] - Trigger inline-axis padding.\n * @cssprop [--rc-select-gap=var(--rc-control-gap)] - Gap between trigger content, chips, and icon.\n * @cssprop [--rc-select-radius=var(--rc-control-radius)] - Trigger border radius.\n * @cssprop [--rc-select-border=var(--rc-border)] - Trigger border.\n * @cssprop [--rc-select-listbox-radius=var(--rc-control-radius)] - Popup listbox border radius.\n * @cssprop [--rc-select-listbox-border=var(--rc-border)] - Popup listbox border.\n * @cssprop [--rc-select-shadow=var(--rc-shadow)] - Popup listbox box shadow.\n * @cssprop [--rc-select-listbox-padding-block=var(--rc-control-padding-block)] - Popup listbox block padding.\n * @cssprop [--rc-select-chip-radius=var(--rc-radius-md)] - Multi-select chip border radius.\n * @cssprop [--rc-select-chip-padding-block=0.1em] - Multi-select chip block-axis padding.\n * @cssprop [--rc-select-chip-padding-inline=0.3em] - Multi-select chip inline-axis padding.\n * @cssprop [--rc-select-chip-gap=calc(var(--rc-control-gap, 0.25em) * 0.8)] - Gap between chip\n * label and remove icon.\n * @cssprop [--rc-select-chip-border=var(--rc-border)] - Multi-select chip border.\n * @cssprop [--rc-select-toggle-indicator-size=1.1em] - Inline size of the toggle indicator container.\n */\nexport class RCSelect extends LitElement {\n static override styles = selectStyles;\n\n /** Reflects whether the popup listbox is open. */\n @property({ type: Boolean, reflect: true })\n open = false;\n\n /** Enables selection of multiple options simultaneously. */\n @property({ type: Boolean, reflect: true })\n multiple = false;\n\n /** Disables the trigger and prevents the popup from opening. */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /** Text shown in the trigger when no value is selected. */\n @property()\n placeholder = '';\n\n /**\n * Controls how selected values appear in the trigger.\n *\n * - `'chips'` — each selected value renders as a removable chip.\n * - `'compact'` — selected values are summarized as \"First, +N more\".\n * - `'auto'` — uses `'chips'` on pointer devices and `'compact'` on touch.\n */\n @property()\n display: 'auto' | 'chips' | 'compact' = 'auto';\n\n /** Flex container used by `_anchorCtrl` as the positioning reference for the popup. */\n @query('#anchor')\n protected _$anchor!: HTMLElement;\n\n /**\n * The combobox trigger div.\n *\n * Owns `role=\"combobox\"`, `aria-activedescendant`,\n * `aria-expanded`, and receives focus during keyboard navigation.\n */\n @query('#trigger')\n protected _$trigger!: HTMLElement;\n\n /** The `<rc-listbox>` popup. Receives option lists and selected-value updates from the host. */\n @query('#listbox')\n protected _$listbox!: RCListbox;\n\n /**\n * Reactive set of currently selected option values.\n *\n * Drive changes through `_applySelection` rather than mutating this directly\n * so the listbox and native `<select>` stay in sync.\n */\n @state()\n protected _selectedValues: Set<string> = new Set();\n\n /**\n * Index into the chip button array for roving-tabindex chip navigation.\n *\n * `-1` means focus is on the trigger.\n */\n @state()\n protected _chipNavIndex = -1;\n\n /**\n * The resolved option list, as rendered in the listbox.\n *\n * `_options` is sourced from the `options` property or the slotted `<select>`.\n */\n @state()\n protected _options: ListboxOption[] = [];\n\n /** WeakRef to the slotted `<select>`. Refreshed on every `slotchange`; `null` when absent. */\n protected _$selectRef: WeakRef<HTMLSelectElement> | null = null;\n\n protected readonly _selectController = new NativeChildController<HTMLSelectElement>(this, {\n selector: ':scope > select',\n observe: true,\n onChange: ($select) => this._setupSelect($select),\n onMissing: () => {\n if (import.meta.env.DEV) {\n warnMissingDirectChild(this, {\n selector: ':scope > select',\n message:\n '[rc-select] No direct child <select> found. Place a native <select> inside <rc-select>.',\n });\n }\n },\n });\n\n /**\n * Watches the slotted `<select>` for `childList`, `subtree`, and `attributes` changes\n * so the option list and disabled/multiple state stay in sync with author mutations.\n */\n protected _mutationObserver: MutationObserver | null = null;\n\n private _defaultValue: RCSelectValue | undefined;\n\n private _propertyOptions: ListboxOption[] | undefined;\n\n private _value: RCSelectValue | undefined;\n\n private _selectionInitialized = false;\n\n /** True while `_applyPickerGuard` has force-disabled the slotted multiple `<select>`. */\n protected _pickerGuardActive = false;\n\n /** Consumer's `disabled` state on the select before the picker guard forced it; restored on teardown. */\n protected _pickerGuardConsumerDisabled = false;\n\n /** Form currently carrying the picker guard's `formdata` listener. */\n protected _pickerGuardForm: HTMLFormElement | null = null;\n\n /** Accumulated printable characters for type-ahead matching; cleared after 500 ms idle. */\n protected _typeAheadBuffer = '';\n\n /** `window.setTimeout` handle for resetting `_typeAheadBuffer`; cancel before modifying. */\n protected _typeAheadTimer = 0;\n\n /**\n * Manages `aria-activedescendant` on `_$trigger` and keyboard cursor position\n * within `_$listbox.navigableItems`.\n */\n protected _activeDescendantCtrl = new ActiveDescendantController(this, {\n host: () => this._$trigger ?? null,\n items: () => this._$listbox?.navigableItems ?? [],\n });\n\n /** Manages CSS-anchored (or JS-fallback) placement of `_$listbox` relative to `_$anchor`. */\n protected _anchorCtrl = new AnchorController(this, {\n anchor: () => this._$anchor ?? null,\n floating: () => this._$listbox ?? null,\n shadowHost: () => this,\n placement: 'bottom-start',\n offset: 2,\n });\n\n override connectedCallback() {\n super.connectedCallback();\n\n document.addEventListener('click', this._onDocClick, { capture: true });\n document.addEventListener('keydown', this._onDocKeyDown, { capture: true });\n\n // Reconnect keeps the same select (NativeChildController only re-fires on\n // identity change), so re-attach the guard's formdata listener directly.\n const $select = this._$selectRef?.deref();\n\n if ($select && this._pickerGuardActive) {\n this._syncFormListeners($select.form);\n }\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n\n document.removeEventListener('click', this._onDocClick, { capture: true });\n document.removeEventListener('keydown', this._onDocKeyDown, {\n capture: true,\n });\n\n this._mutationObserver?.disconnect();\n this._syncFormListeners(null);\n }\n\n override updated(changed: PropertyValues) {\n super.updated(changed);\n this.toggleAttribute('has-value', this._selectedValues.size > 0);\n }\n\n /** Opens the popup listbox if not already open or disabled. */\n openPopup() {\n if (this.open || this.disabled) {\n return;\n }\n\n this.open = true;\n this._$listbox.showPopover();\n this._anchorCtrl.update();\n\n this.dispatchEvent(new CustomEvent('rc-select-open', { bubbles: true, composed: true }));\n this.requestUpdate();\n }\n\n /**\n * Closes the popup listbox.\n *\n * @param returnFocus - When `true` (default), returns focus to the trigger.\n */\n closePopup(returnFocus = true) {\n if (!this.open) {\n return;\n }\n\n this.open = false;\n this._$listbox.hidePopover();\n this._activeDescendantCtrl.clear();\n\n if (returnFocus) {\n this._$trigger?.focus();\n }\n\n this.dispatchEvent(new CustomEvent('rc-select-close', { bubbles: true, composed: true }));\n }\n\n /**\n * Current selection. Host writes update selection silently; user interaction\n * emits `rc-select-change`.\n */\n get value(): RCSelectValue {\n return this.multiple ? this.selectedValues : (this.selectedValues[0] ?? '');\n }\n\n set value(value: RCSelectValue | undefined) {\n const oldValue = this._value;\n\n this._value = value;\n\n if (value === undefined) {\n this.requestUpdate('value', oldValue);\n\n return;\n }\n\n this._selectionInitialized = true;\n this._applySelection(this._normalizeValue(value));\n this.requestUpdate('value', oldValue);\n }\n\n /** Initial uncontrolled selection, applied before user or native state owns the value. */\n get defaultValue(): RCSelectValue | undefined {\n return this._defaultValue;\n }\n\n set defaultValue(value: RCSelectValue | undefined) {\n const oldValue = this._defaultValue;\n\n this._defaultValue = value;\n\n if (!this._selectionInitialized && this._value === undefined && value !== undefined) {\n this._applySelection(this._normalizeValue(value));\n }\n\n this.requestUpdate('defaultValue', oldValue);\n }\n\n /** Programmatic option source. Omit to derive options from the slotted `<select>`. */\n get options(): ListboxOption[] | undefined {\n return this._propertyOptions ? [...this._propertyOptions] : undefined;\n }\n\n set options(options: ListboxOption[] | undefined) {\n const oldValue = this._propertyOptions;\n\n this._propertyOptions = options ? [...options] : undefined;\n this._syncOptions(this._currentOptions());\n this._mirrorOptionsToNativeSelect();\n this.requestUpdate('options', oldValue);\n }\n\n /** Selected values as a consistently-array-shaped convenience getter. */\n get selectedValues(): string[] {\n return [...this._selectedValues];\n }\n\n /** `ListboxOption` objects for the current selection; falls back to label-only stubs for unknown values. */\n protected get selectedOptions(): ListboxSelectableOption[] {\n return this._selectedOptionsFor(this.selectedValues);\n }\n\n /**\n * Applies an already-normalized array of values as the current selection.\n *\n * In single-select mode only the first value is kept. Syncs `_$listbox` and the\n * native `<select>` but does NOT dispatch `rc-select-change`.\n */\n protected _applySelection(values: string[]): void {\n const selectedValues = this.multiple ? values : values.slice(0, 1);\n\n this._selectedValues = new Set(selectedValues);\n this._$listbox?.setSelectedValues(selectedValues);\n this._syncNativeSelect();\n this.requestUpdate();\n }\n\n /** Document-capture click handler that closes the popup when a click lands outside `this`. */\n protected _onDocClick = (e: MouseEvent) => {\n if (!this.open) {\n return;\n }\n\n if (!e.composedPath().includes(this)) {\n this.closePopup(false);\n }\n };\n\n /** Document-capture keydown handler; closes the popup on `Escape`. */\n protected _onDocKeyDown = (e: KeyboardEvent) => {\n if (!this.open) {\n return;\n }\n\n if (e.key === 'Escape') {\n e.preventDefault();\n\n this.closePopup();\n }\n };\n\n /**\n * Suppress the native `<select>`'s default click action\n */\n protected _onNativeSelectClick = (e: Event) => {\n e.preventDefault();\n };\n\n /**\n * Countermeasure for select[\"multiple\"] bug in Firefox for Android / GeckoView.\n *\n * Works around a GeckoView bug where tapping anywhere inside an\n * ancestor `<label>`'s bounds opens the native picker dialog of a wrapped\n * `<select multiple>`, even though the select is hidden and the tap landed on this\n * component's own UI.\n *\n * Label activation on a disabled control is a spec-defined no-op, so the slotted select\n * is force-disabled after upgrade while it is `multiple`. A disabled select submits\n * nothing, so form submission is restored by appending the current selection in a\n * `formdata` listener on the owning form (`_handleFormData`). A disabled select is also\n * barred from native constraint validation, so `_handleFormSubmit` enforces its\n * `ValidityState` at submit time instead.\n *\n * Scoped to multiple selects: the single-select picker path is already suppressed by\n * `_onNativeSelectClick`. Pre-upgrade behavior is unaffected — the guard\n * only applies once the component initializes.\n *\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1475723\n */\n protected _applyPickerGuard($select: HTMLSelectElement): void {\n if ($select.multiple && !this._pickerGuardActive) {\n this._pickerGuardActive = true;\n this._pickerGuardConsumerDisabled = $select.disabled;\n\n $select.disabled = true;\n } else if (!$select.multiple && this._pickerGuardActive) {\n this._pickerGuardActive = false;\n\n $select.disabled = this._pickerGuardConsumerDisabled;\n } else if ($select.multiple && !$select.disabled) {\n // The guard holds `disabled` present, so only the consumer removes it —\n // capture that as enable intent, mirror it on the host, and re-assert the\n // guard. (The reverse — consumer setting disabled while guarded — is a\n // same-value attribute write whose mutation record is indistinguishable\n // from the guard's own writes; disabling is driven through the host\n // instead.)\n this._pickerGuardConsumerDisabled = false;\n this.disabled = false;\n\n $select.disabled = true;\n }\n\n this._syncFormListeners(this._pickerGuardActive ? $select.form : null);\n }\n\n /** Moves the picker guard's `formdata` and `submit` listeners to `$form`; pass `null` to detach. */\n protected _syncFormListeners($form: HTMLFormElement | null): void {\n if ($form === this._pickerGuardForm) {\n return;\n }\n\n this._pickerGuardForm?.removeEventListener('formdata', this._handleFormData);\n this._pickerGuardForm?.removeEventListener('submit', this._handleFormSubmit, {\n capture: true,\n });\n this._pickerGuardForm = $form;\n\n $form?.addEventListener('formdata', this._handleFormData);\n // Capture so invalid submissions are cancelled before consumer submit handlers run.\n $form?.addEventListener('submit', this._handleFormSubmit, { capture: true });\n }\n\n /**\n * Appends the current selection to the owning form's entry list.\n *\n * Replaces the submission the select would have produced were it\n * not force-disabled by `_applyPickerGuard`.\n *\n * Append-only: entries from other same-named controls in the form\n * are left alone.\n */\n protected _handleFormData = (e: FormDataEvent) => {\n const $select = this._$selectRef?.deref();\n\n if (!this._pickerGuardActive || !$select?.name) {\n return;\n }\n\n for (const value of this.selectedValues) {\n e.formData.append($select.name, value);\n }\n };\n\n /**\n * Enforces the slotted select's constraints at submit time.\n *\n * Mirrors native scoping: skipped for `novalidate`\n * forms and `formnovalidate` submitters, and never runs for `form.submit()`\n *\n * The native validation bubble cannot render on a hidden control, so a\n * cancelable `invalid` event is fired on the select (matching native\n * reporting) and focus moves to the trigger unless the consumer cancels it.\n */\n protected _handleFormSubmit = (e: SubmitEvent) => {\n const $select = this._$selectRef?.deref();\n\n if (!this._pickerGuardActive || !$select) {\n return;\n }\n\n const $form = e.currentTarget as HTMLFormElement;\n const $submitter = e.submitter as HTMLButtonElement | HTMLInputElement | null;\n\n if ($form.noValidate || $submitter?.formNoValidate) {\n return;\n }\n\n if ($select.validity.valid) {\n return;\n }\n\n e.preventDefault();\n\n const showFallbackUI = $select.dispatchEvent(new Event('invalid', { cancelable: true }));\n\n if (showFallbackUI) {\n this._$trigger?.focus();\n }\n };\n\n /**\n * Resolves the slotted `<select>` on every `slotchange`, wires `_mutationObserver`,\n * and seeds initial state via `queueMicrotask` to stay safe inside framework reactive passes.\n */\n protected _handleSelectSlotChange() {\n this._selectController.sync();\n }\n\n protected _setupSelect($select: HTMLSelectElement | null) {\n // Disconnect synchronously so the old observer stops immediately.\n this._mutationObserver?.disconnect();\n this._mutationObserver = null;\n\n const $previous = this._$selectRef?.deref();\n\n if ($previous) {\n $previous.removeEventListener('click', this._onNativeSelectClick);\n\n if (this._pickerGuardActive) {\n $previous.disabled = this._pickerGuardConsumerDisabled;\n }\n }\n\n this._pickerGuardActive = false;\n this._syncFormListeners(null);\n\n this._$selectRef = $select ? new WeakRef($select) : null;\n\n if (!$select) {\n return;\n }\n\n $select.addEventListener('click', this._onNativeSelectClick);\n\n // Defer all DOM reads/mutations so this handler is instantaneous when\n // slotchange fires synchronously inside a framework reactive update pass\n // (e.g. SolidJS runUpdates on second+ mount, when shadow DOM already exists).\n queueMicrotask(() => {\n if (!$select.isConnected) {\n return;\n }\n\n this.multiple = $select.multiple;\n this.disabled = $select.disabled;\n this._syncOptionsFromSelect($select);\n this._applyPickerGuard($select);\n\n this._mutationObserver = new MutationObserver(() => {\n const $current = this._$selectRef?.deref();\n\n if (!$current) {\n return;\n }\n\n this.multiple = $current.multiple;\n\n // While the picker guard holds the select disabled, its `disabled`\n // attribute reflects the guard, not author intent — don't echo it.\n if (!this._pickerGuardActive) {\n this.disabled = $current.disabled;\n }\n\n this._applyPickerGuard($current);\n\n if (this._propertyOptions !== undefined) {\n this._applySelectionFromCurrentSource();\n\n return;\n }\n\n this._syncOptionsFromSelect($current);\n });\n this._mutationObserver.observe($select, {\n childList: true,\n subtree: true,\n attributes: true,\n });\n\n this._syncAccessibleName($select);\n });\n }\n\n /**\n * Derives options from `$select` (or defers to `_propertyOptions` when set)\n * and re-applies selection from the current authoritative source.\n */\n protected _syncOptionsFromSelect($select: HTMLSelectElement) {\n if (this._propertyOptions !== undefined) {\n this._syncOptions(this._propertyOptions);\n this._mirrorOptionsToNativeSelect();\n this._applySelectionFromCurrentSource();\n\n return;\n }\n\n const options = this._optionsFromSelect($select);\n\n this._syncOptions(options);\n this._applySelectionFromCurrentSource();\n this._syncAccessibleName($select);\n }\n\n /**\n * Picks the correct selection source in priority order:\n * controlled `_value` → `_defaultValue` → native `<select>` default/current state.\n */\n protected _applySelectionFromCurrentSource(): void {\n if (this._value !== undefined) {\n this._applySelection(this._normalizeValue(this._value));\n\n return;\n }\n\n if (!this._selectionInitialized && this._defaultValue !== undefined) {\n this._selectionInitialized = true;\n this._applySelection(this._normalizeValue(this._defaultValue));\n\n return;\n }\n\n const selected = this._selectionInitialized\n ? this._selectedValuesFromNativeSelect()\n : this._defaultSelectedValuesFromNativeSelect();\n\n this._selectionInitialized = true;\n this._applySelection(selected);\n }\n\n /** Writes `_options` and pushes the list to `_$listbox` when it is mounted. */\n protected _syncOptions(options: ListboxOption[]): void {\n this._options = [...options];\n\n if (this._$listbox) {\n this._$listbox.options = this._options;\n }\n }\n\n /** Returns `_propertyOptions` when set; otherwise reads live from the slotted `<select>`. */\n protected _currentOptions(): ListboxOption[] {\n if (this._propertyOptions !== undefined) {\n return this._propertyOptions;\n }\n\n const $select = this._$selectRef?.deref();\n\n return $select ? this._optionsFromSelect($select) : [];\n }\n\n /**\n * Maps non-empty native `<option>` nodes to `ListboxOption` objects.\n *\n * Options with empty `value` are skipped (placeholder guard).\n */\n protected _optionsFromSelect($select: HTMLSelectElement): ListboxOption[] {\n const options: ListboxOption[] = [];\n\n for (const $option of $select.options) {\n if (!$option.value) {\n continue;\n }\n\n options.push({\n value: $option.value,\n label: $option.text,\n disabled: $option.disabled,\n });\n }\n\n return options;\n }\n\n /** Returns values of currently selected `<option>` nodes; falls back to `selectedValues` when no native select is present. */\n protected _selectedValuesFromNativeSelect(): string[] {\n const $select = this._$selectRef?.deref();\n\n if (!$select) {\n return this.selectedValues;\n }\n\n return Array.from($select.selectedOptions)\n .map(($opt) => $opt.value)\n .filter(Boolean);\n }\n\n /** Returns values of `defaultSelected` `<option>` nodes (author `selected` attribute); falls back to `selectedValues`. */\n protected _defaultSelectedValuesFromNativeSelect(): string[] {\n const $select = this._$selectRef?.deref();\n\n if (!$select) {\n return this.selectedValues;\n }\n\n return Array.from($select.options)\n .filter(($option) => $option.defaultSelected)\n .map(($option) => $option.value)\n .filter(Boolean);\n }\n\n /**\n * Rebuilds native `<select>` options from `_propertyOptions`.\n *\n * Only runs when `_propertyOptions` is set; pauses then resumes `_mutationObserver`\n * while writing to avoid re-entrant sync.\n */\n protected _mirrorOptionsToNativeSelect(): void {\n const $select = this._$selectRef?.deref();\n\n if (!$select || this._propertyOptions === undefined) {\n return;\n }\n\n this._mutationObserver?.disconnect();\n $select.replaceChildren();\n\n for (const opt of this._propertyOptions) {\n const $option = document.createElement('option');\n\n $option.value = opt.value;\n $option.text = opt.label;\n $option.disabled = opt.disabled ?? false;\n $option.selected = this._selectedValues.has(opt.value);\n\n $select.add($option);\n }\n\n this._mutationObserver?.observe($select, {\n childList: true,\n subtree: true,\n attributes: true,\n });\n }\n\n /**\n * Upserts a single option into `_options` (and `_propertyOptions` when set)\n * and adds the corresponding `<option>` to the native `<select>` if absent.\n */\n protected _addOption(option: ListboxOption): void {\n const options = this._options.some((opt) => opt.value === option.value)\n ? this._options.map((opt) => (opt.value === option.value ? option : opt))\n : [...this._options, option];\n\n if (this._propertyOptions !== undefined) {\n this._propertyOptions = options;\n }\n\n this._syncOptions(options);\n\n const $select = this._$selectRef?.deref();\n\n if (!$select || Array.from($select.options).some(($opt) => $opt.value === option.value)) {\n return;\n }\n\n const $option = document.createElement('option');\n\n $option.value = option.value;\n $option.text = option.label;\n $option.disabled = option.disabled ?? false;\n $option.selected = this._selectedValues.has(option.value);\n\n $select.add($option);\n }\n\n /** Coerces `RCSelectValue` (string or string[]) to `string[]`; returns `[]` for empty-string singles. */\n protected _normalizeValue(value: RCSelectValue): string[] {\n return Array.isArray(value) ? value : value ? [value] : [];\n }\n\n /**\n * Copies `aria-label` or first-label text from the native `<select>` to `_$trigger`.\n *\n * No-op when the trigger already has an explicit `aria-label`.\n */\n protected _syncAccessibleName($sel: HTMLSelectElement): void {\n if (!this._$trigger) {\n return;\n }\n\n // Don't clobber an explicit aria-label.\n if (this._$trigger.hasAttribute('aria-label')) {\n return;\n }\n\n const name = $sel.getAttribute('aria-label') ?? $sel.labels?.[0]?.textContent?.trim() ?? null;\n\n if (name) {\n this._$trigger.setAttribute('aria-label', name);\n } else {\n this._$trigger.removeAttribute('aria-label');\n }\n }\n\n /**\n * Handles `rc-listbox-change` from the popup.\n *\n * Stops propagation, mutates `_selectedValues`, syncs state, and fires\n * `rc-select-change`.\n */\n protected _handleListboxChange(e: CustomEvent) {\n const detail = e.detail as RCListboxChangeEvent;\n\n if (detail.reason === 'action') {\n e.stopPropagation();\n return;\n }\n\n const { optionValue, value, selected } = detail;\n const activatedValue = optionValue ?? (Array.isArray(value) ? value.at(-1) : value);\n\n if (!activatedValue) {\n return;\n }\n\n e.stopPropagation();\n\n if (this.multiple) {\n const next = new Set(this._selectedValues);\n\n if (selected) {\n next.add(activatedValue);\n } else {\n next.delete(activatedValue);\n }\n\n this._selectedValues = next;\n } else {\n this._selectedValues = selected ? new Set([activatedValue]) : new Set();\n\n if (selected) {\n this.closePopup();\n }\n }\n\n this._selectionInitialized = true;\n this._syncNativeSelect();\n this._$listbox.setSelectedValues(this.selectedValues);\n this._dispatchChange();\n }\n\n /** Removes a single value from `_selectedValues`, syncs the listbox and native select, and dispatches `rc-select-change`. */\n protected _removeValue(value: string) {\n const next = new Set(this._selectedValues);\n\n next.delete(value);\n\n this._selectedValues = next;\n this._$listbox.setSelectedValues([...next]);\n this._selectionInitialized = true;\n\n this._syncNativeSelect();\n this._dispatchChange();\n }\n\n /** Flips `selected` on each `<option>` in the native `<select>` to match `_selectedValues`; no-op when no native select is present. */\n protected _syncNativeSelect() {\n const $select = this._$selectRef?.deref();\n\n if (!$select) {\n return;\n }\n\n for (const $option of $select.options) {\n $option.selected = this._selectedValues.has($option.value);\n }\n }\n\n /** Constructs and dispatches `rc-select-change` with current `value`, `selectedValues`, and `selectedOptions`. */\n protected _dispatchChange(): void {\n this.dispatchEvent(\n new CustomEvent<RCSelectChangeEvent>('rc-select-change', {\n bubbles: true,\n composed: true,\n detail: {\n value: this.value,\n selectedValues: this.selectedValues,\n selectedOptions: this.selectedOptions,\n },\n }),\n );\n }\n\n /** Maps value strings to `ListboxOption` objects from `_options`; creates label-only fallback stubs for unknown values. */\n protected _selectedOptionsFor(values: string[]): ListboxSelectableOption[] {\n return values.map((value) => {\n return (\n this._options.find(\n (opt): opt is ListboxSelectableOption => opt.kind !== 'action' && opt.value === value,\n ) ?? {\n value,\n label: value,\n }\n );\n });\n }\n\n /** Resolved display mode after `auto` pointer-detection: `'chips'` on fine-pointer devices, `'compact'` on coarse. */\n protected get _effectiveDisplay(): 'chips' | 'compact' {\n if (this.display === 'chips') {\n return 'chips';\n }\n\n if (this.display === 'compact') {\n return 'compact';\n }\n\n return window.matchMedia('(pointer: coarse)').matches ? 'compact' : 'chips';\n }\n\n /** Looks up the display label for `value` from native `<select>` option text; returns `value` itself as a fallback. */\n protected _labelFor(value: string): string {\n const $select = this._$selectRef?.deref();\n\n if ($select) {\n for (const $option of $select.options) {\n if ($option.value === value) {\n return $option.text;\n }\n }\n }\n\n return value;\n }\n\n /** Text shown in the trigger's value-display area; returns placeholder when chips are active or nothing is selected. */\n protected get _displayLabel(): string {\n if (this._selectedValues.size === 0) {\n return this.placeholder;\n }\n\n if (this._effectiveDisplay === 'chips' && this.multiple) {\n return this.placeholder;\n }\n\n if (this._selectedValues.size === 1) {\n return this._labelFor([...this._selectedValues][0]);\n }\n\n // Compact multi: \"First, +N more\"\n const values = [...this._selectedValues];\n const first = this._labelFor(values[0]);\n\n return `${first}, +${values.length - 1} more`;\n }\n\n /**\n * APG Combobox keyboard handler on the trigger.\n *\n * Arrow keys navigate/open, Space/Enter activate, Tab closes without focus return,\n * ArrowLeft enters chip navigation, and printable chars forward to type-ahead.\n */\n protected _handleTriggerKeyDown(e: KeyboardEvent) {\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n if (!this.open) {\n this.openPopup();\n this._activeDescendantCtrl.navigateToFirst();\n } else {\n this._activeDescendantCtrl.navigate(1);\n }\n break;\n\n case 'ArrowUp':\n e.preventDefault();\n if (!this.open) {\n this.openPopup();\n this._activeDescendantCtrl.navigateToLast();\n } else {\n this._activeDescendantCtrl.navigate(-1);\n }\n break;\n\n case 'Home':\n if (this.open) {\n e.preventDefault();\n this._activeDescendantCtrl.navigateToFirst();\n }\n break;\n\n case 'End':\n if (this.open) {\n e.preventDefault();\n this._activeDescendantCtrl.navigateToLast();\n }\n break;\n\n case ' ':\n case 'Enter':\n e.preventDefault();\n if (!this.open) {\n this.openPopup();\n this._activeDescendantCtrl.navigateToFirst();\n } else {\n this._activateActive();\n }\n break;\n\n case 'Tab':\n if (this.open) {\n this.closePopup(false);\n }\n break;\n\n case 'ArrowLeft':\n if (!this.open && this.multiple && this._selectedValues.size > 0) {\n e.preventDefault();\n this._enterChipNav();\n }\n break;\n\n default:\n if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {\n this._handleTypeAhead(e.key);\n }\n }\n }\n\n /**\n * Dispatches a synthetic `pointerdown` on the active listbox item to activate it.\n *\n * Prefers `pointerdown` over a direct call so listbox item click logic\n * (which is bound to `pointerdown`) fires through its normal path.\n */\n protected _activateActive() {\n const $item = this._activeDescendantCtrl.activeItem;\n\n if ($item) {\n $item.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, cancelable: true }));\n }\n }\n\n /**\n * Accumulates characters in `_typeAheadBuffer` and either immediately selects\n * the first match (closed single-select) or moves the virtual cursor (open popup).\n */\n protected _handleTypeAhead(char: string) {\n clearTimeout(this._typeAheadTimer);\n\n this._typeAheadBuffer += char.toLowerCase();\n\n this._typeAheadTimer = window.setTimeout(() => {\n this._typeAheadBuffer = '';\n }, 500);\n\n const options = this._$listbox?.allOptions ?? [];\n const match = options.find(\n (option) => !option.disabled && option.label.toLowerCase().startsWith(this._typeAheadBuffer),\n );\n\n if (!match) {\n return;\n }\n\n if (!this.open) {\n // Select-only type-ahead: immediately select the match\n if (!this.multiple) {\n this._selectionInitialized = true;\n this._applySelection([match.value]);\n this._dispatchChange();\n }\n } else {\n // Open popup: move virtual cursor to match\n const $items = this._$listbox.navigableItems;\n const $item = $items.find(($el) => $el.getAttribute('data-value') === match.value);\n\n if ($item) {\n this._activeDescendantCtrl.navigateToItem($item);\n }\n }\n }\n\n /** Focuses the last chip button and sets `_chipNavIndex` to begin roving-tabindex navigation within the chip group. */\n protected _enterChipNav() {\n const $buttons = this._$chipButtons();\n\n if ($buttons.length === 0) {\n return;\n }\n\n this._chipNavIndex = $buttons.length - 1;\n $buttons[this._chipNavIndex].focus();\n }\n\n /** Queries all `button[part~=\"chip\"]` elements in `renderRoot`; order matches DOM order. */\n protected _$chipButtons(): HTMLButtonElement[] {\n return Array.from(this.renderRoot.querySelectorAll<HTMLButtonElement>('button[part~=\"chip\"]'));\n }\n\n /**\n * Keyboard handler for chip buttons.\n *\n * ArrowLeft/Right rove chip focus, Escape returns to trigger,\n * Delete/Backspace/Enter/Space remove the chip's value\n * and return focus to the trigger.\n */\n protected _handleChipKeyDown(e: KeyboardEvent, value: string) {\n const $buttons = this._$chipButtons();\n\n switch (e.key) {\n case 'ArrowLeft':\n e.preventDefault();\n if (this._chipNavIndex > 0) {\n this._chipNavIndex--;\n $buttons[this._chipNavIndex]?.focus();\n }\n break;\n\n case 'ArrowRight':\n e.preventDefault();\n if (this._chipNavIndex < $buttons.length - 1) {\n this._chipNavIndex++;\n $buttons[this._chipNavIndex]?.focus();\n } else {\n this._chipNavIndex = -1;\n this._$trigger?.focus();\n }\n break;\n\n case 'Escape':\n e.preventDefault();\n this._chipNavIndex = -1;\n this._$trigger?.focus();\n break;\n\n case 'Delete':\n case 'Backspace':\n case 'Enter':\n case ' ':\n e.preventDefault();\n this._removeValue(value);\n this._chipNavIndex = -1;\n this._$trigger?.focus();\n break;\n }\n }\n\n /** Toggles the popup open or closed on trigger click. */\n protected _handleTriggerClick() {\n if (this.open) {\n this.closePopup();\n } else {\n this.openPopup();\n }\n }\n\n protected override render() {\n const showChips =\n this.multiple && this._effectiveDisplay === 'chips' && this._selectedValues.size > 0;\n\n return html`\n <div id=\"anchor\" part=\"anchor\">\n <div\n id=\"trigger\"\n part=\"trigger\"\n role=\"combobox\"\n tabindex=${this.disabled ? '-1' : '0'}\n aria-haspopup=\"listbox\"\n aria-expanded=${this.open ? 'true' : 'false'}\n aria-controls=\"listbox\"\n aria-disabled=${this.disabled ? 'true' : 'false'}\n aria-label=${this.placeholder || nothing}\n @click=${this._handleTriggerClick}\n @keydown=${this._handleTriggerKeyDown}\n >\n ${showChips ? this._renderChips() : nothing}\n\n <span part=\"value-display\">${this._displayLabel}</span>\n\n <span part=\"toggle-indicator\" aria-hidden=\"true\">\n <slot name=\"toggle-indicator\">\n <svg\n width=\"10\"\n height=\"6\"\n viewBox=\"0 0 10 6\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <polyline points=\"1,1 5,5 9,1\" />\n </svg>\n </slot>\n </span>\n </div>\n </div>\n\n <rc-listbox\n id=\"listbox\"\n part=\"listbox\"\n popover=\"manual\"\n ?multiple=${this.multiple}\n checkmark\n @rc-listbox-change=${this._handleListboxChange}\n ></rc-listbox>\n\n <slot @slotchange=${this._handleSelectSlotChange}></slot>\n `;\n }\n\n /** Renders the chip group `<span>` with one `<button>` per selected value for multi-select chip display mode. */\n protected _renderChips() {\n return html`\n <span part=\"chips\" role=\"group\" aria-label=\"Selected items\">\n ${[...this._selectedValues].map((value) => {\n const label = this._labelFor(value);\n return html`\n <button\n type=\"button\"\n part=\"chip\"\n data-value=${value}\n tabindex=\"-1\"\n aria-label=${`Remove ${label}`}\n @click=${(e: MouseEvent) => {\n e.stopPropagation();\n this._removeValue(value);\n }}\n @keydown=${(e: KeyboardEvent) => this._handleChipKeyDown(e, value)}\n >\n <span part=\"chip-label\">${label}</span\n ><span part=\"chip-remove\" aria-hidden=\"true\">×</span>\n </button>\n `;\n })}\n </span>\n `;\n }\n}\n\nexport default RCSelect;\n"],"names":["selectStyles","css","_RCSelect","LitElement","NativeChildController","$select","ActiveDescendantController","AnchorController","value","$form","$submitter","changed","returnFocus","oldValue","options","values","selectedValues","$previous","$current","selected","$option","$opt","opt","option","$sel","name","detail","optionValue","activatedValue","next","$item","char","match","$el","$buttons","showChips","html","nothing","label","e","RCSelect","__decorateClass","property","query","state"],"mappings":";;;AAEO,MAAMA,IAAeC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;AC8FrB,MAAMC,IAAN,MAAMA,UAAiBC,EAA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,CAAK;AAAA;AAAA;AAAA;AAAA,IAIrC,CAAC,CAAC;AAAA;AAAA;AAAA,EAGR;AACF;AA1oCEpC,EAAgB,SAASF;AADpB,IAAMwC,IAANtC;AAKLuC,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAJ/BF,EAKX,WAAA,MAAA;AAIAC,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAR/BF,EASX,WAAA,UAAA;AAIAC,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAZ/BF,EAaX,WAAA,UAAA;AAIAC,EAAA;AAAA,EADCC,EAAA;AAAS,GAhBCF,EAiBX,WAAA,aAAA;AAUAC,EAAA;AAAA,EADCC,EAAA;AAAS,GA1BCF,EA2BX,WAAA,SAAA;AAIUC,EAAA;AAAA,EADTE,EAAM,SAAS;AAAA,GA9BLH,EA+BD,WAAA,UAAA;AASAC,EAAA;AAAA,EADTE,EAAM,UAAU;AAAA,GAvCNH,EAwCD,WAAA,WAAA;AAIAC,EAAA;AAAA,EADTE,EAAM,UAAU;AAAA,GA3CNH,EA4CD,WAAA,WAAA;AASAC,EAAA;AAAA,EADTG,EAAA;AAAM,GApDIJ,EAqDD,WAAA,iBAAA;AAQAC,EAAA;AAAA,EADTG,EAAA;AAAM,GA5DIJ,EA6DD,WAAA,eAAA;AAQAC,EAAA;AAAA,EADTG,EAAA;AAAM,GApEIJ,EAqED,WAAA,UAAA;"}
|
package/dist/rc-select-define.js
CHANGED
package/dist/rc-select.js
CHANGED
|
@@ -45,7 +45,14 @@ declare global {
|
|
|
45
45
|
* @csspart chip-remove - Remove button inside a chip.
|
|
46
46
|
* @csspart value-display - The text label showing selected value(s).
|
|
47
47
|
* @csspart toggle-indicator - The open/close indicator container.
|
|
48
|
+
* @csspart listbox - The `<rc-listbox>` popup element.
|
|
48
49
|
*
|
|
50
|
+
* @attr open - Reflects whether the popup listbox is open.
|
|
51
|
+
* @attr multiple - Enables selection of multiple options simultaneously.
|
|
52
|
+
* @attr disabled - Disables the trigger and prevents the popup from opening.
|
|
53
|
+
* @attr placeholder - Text shown in the trigger when no value is selected.
|
|
54
|
+
* @attr display - Controls how selected values appear in the trigger: `'auto'`,
|
|
55
|
+
* `'chips'`, or `'compact'`.
|
|
49
56
|
* @attr [has-value] - Present when one or more options are selected. Use with CSS
|
|
50
57
|
* selectors (e.g. `rc-select[has-value]`) for floating-label wrappers.
|
|
51
58
|
*
|
|
@@ -57,10 +64,15 @@ declare global {
|
|
|
57
64
|
* @cssprop [--rc-select-radius=var(--rc-control-radius)] - Trigger border radius.
|
|
58
65
|
* @cssprop [--rc-select-border=var(--rc-border)] - Trigger border.
|
|
59
66
|
* @cssprop [--rc-select-listbox-radius=var(--rc-control-radius)] - Popup listbox border radius.
|
|
67
|
+
* @cssprop [--rc-select-listbox-border=var(--rc-border)] - Popup listbox border.
|
|
68
|
+
* @cssprop [--rc-select-shadow=var(--rc-shadow)] - Popup listbox box shadow.
|
|
60
69
|
* @cssprop [--rc-select-listbox-padding-block=var(--rc-control-padding-block)] - Popup listbox block padding.
|
|
61
70
|
* @cssprop [--rc-select-chip-radius=var(--rc-radius-md)] - Multi-select chip border radius.
|
|
62
71
|
* @cssprop [--rc-select-chip-padding-block=0.1em] - Multi-select chip block-axis padding.
|
|
63
72
|
* @cssprop [--rc-select-chip-padding-inline=0.3em] - Multi-select chip inline-axis padding.
|
|
73
|
+
* @cssprop [--rc-select-chip-gap=calc(var(--rc-control-gap, 0.25em) * 0.8)] - Gap between chip
|
|
74
|
+
* label and remove icon.
|
|
75
|
+
* @cssprop [--rc-select-chip-border=var(--rc-border)] - Multi-select chip border.
|
|
64
76
|
* @cssprop [--rc-select-toggle-indicator-size=1.1em] - Inline size of the toggle indicator container.
|
|
65
77
|
*/
|
|
66
78
|
export declare class RCSelect extends LitElement {
|
|
@@ -112,7 +124,7 @@ export declare class RCSelect extends LitElement {
|
|
|
112
124
|
*/
|
|
113
125
|
protected _options: ListboxOption[];
|
|
114
126
|
/** WeakRef to the slotted `<select>`. Refreshed on every `slotchange`; `null` when absent. */
|
|
115
|
-
protected
|
|
127
|
+
protected _$selectRef: WeakRef<HTMLSelectElement> | null;
|
|
116
128
|
protected readonly _selectController: NativeChildController<HTMLSelectElement>;
|
|
117
129
|
/**
|
|
118
130
|
* Watches the slotted `<select>` for `childList`, `subtree`, and `attributes` changes
|
|
@@ -123,6 +135,12 @@ export declare class RCSelect extends LitElement {
|
|
|
123
135
|
private _propertyOptions;
|
|
124
136
|
private _value;
|
|
125
137
|
private _selectionInitialized;
|
|
138
|
+
/** True while `_applyPickerGuard` has force-disabled the slotted multiple `<select>`. */
|
|
139
|
+
protected _pickerGuardActive: boolean;
|
|
140
|
+
/** Consumer's `disabled` state on the select before the picker guard forced it; restored on teardown. */
|
|
141
|
+
protected _pickerGuardConsumerDisabled: boolean;
|
|
142
|
+
/** Form currently carrying the picker guard's `formdata` listener. */
|
|
143
|
+
protected _pickerGuardForm: HTMLFormElement | null;
|
|
126
144
|
/** Accumulated printable characters for type-ahead matching; cleared after 500 ms idle. */
|
|
127
145
|
protected _typeAheadBuffer: string;
|
|
128
146
|
/** `window.setTimeout` handle for resetting `_typeAheadBuffer`; cancel before modifying. */
|
|
@@ -172,6 +190,55 @@ export declare class RCSelect extends LitElement {
|
|
|
172
190
|
protected _onDocClick: (e: MouseEvent) => void;
|
|
173
191
|
/** Document-capture keydown handler; closes the popup on `Escape`. */
|
|
174
192
|
protected _onDocKeyDown: (e: KeyboardEvent) => void;
|
|
193
|
+
/**
|
|
194
|
+
* Suppress the native `<select>`'s default click action
|
|
195
|
+
*/
|
|
196
|
+
protected _onNativeSelectClick: (e: Event) => void;
|
|
197
|
+
/**
|
|
198
|
+
* Countermeasure for select["multiple"] bug in Firefox for Android / GeckoView.
|
|
199
|
+
*
|
|
200
|
+
* Works around a GeckoView bug where tapping anywhere inside an
|
|
201
|
+
* ancestor `<label>`'s bounds opens the native picker dialog of a wrapped
|
|
202
|
+
* `<select multiple>`, even though the select is hidden and the tap landed on this
|
|
203
|
+
* component's own UI.
|
|
204
|
+
*
|
|
205
|
+
* Label activation on a disabled control is a spec-defined no-op, so the slotted select
|
|
206
|
+
* is force-disabled after upgrade while it is `multiple`. A disabled select submits
|
|
207
|
+
* nothing, so form submission is restored by appending the current selection in a
|
|
208
|
+
* `formdata` listener on the owning form (`_handleFormData`). A disabled select is also
|
|
209
|
+
* barred from native constraint validation, so `_handleFormSubmit` enforces its
|
|
210
|
+
* `ValidityState` at submit time instead.
|
|
211
|
+
*
|
|
212
|
+
* Scoped to multiple selects: the single-select picker path is already suppressed by
|
|
213
|
+
* `_onNativeSelectClick`. Pre-upgrade behavior is unaffected — the guard
|
|
214
|
+
* only applies once the component initializes.
|
|
215
|
+
*
|
|
216
|
+
* @see https://bugzilla.mozilla.org/show_bug.cgi?id=1475723
|
|
217
|
+
*/
|
|
218
|
+
protected _applyPickerGuard($select: HTMLSelectElement): void;
|
|
219
|
+
/** Moves the picker guard's `formdata` and `submit` listeners to `$form`; pass `null` to detach. */
|
|
220
|
+
protected _syncFormListeners($form: HTMLFormElement | null): void;
|
|
221
|
+
/**
|
|
222
|
+
* Appends the current selection to the owning form's entry list.
|
|
223
|
+
*
|
|
224
|
+
* Replaces the submission the select would have produced were it
|
|
225
|
+
* not force-disabled by `_applyPickerGuard`.
|
|
226
|
+
*
|
|
227
|
+
* Append-only: entries from other same-named controls in the form
|
|
228
|
+
* are left alone.
|
|
229
|
+
*/
|
|
230
|
+
protected _handleFormData: (e: FormDataEvent) => void;
|
|
231
|
+
/**
|
|
232
|
+
* Enforces the slotted select's constraints at submit time.
|
|
233
|
+
*
|
|
234
|
+
* Mirrors native scoping: skipped for `novalidate`
|
|
235
|
+
* forms and `formnovalidate` submitters, and never runs for `form.submit()`
|
|
236
|
+
*
|
|
237
|
+
* The native validation bubble cannot render on a hidden control, so a
|
|
238
|
+
* cancelable `invalid` event is fired on the select (matching native
|
|
239
|
+
* reporting) and focus moves to the trigger unless the consumer cancels it.
|
|
240
|
+
*/
|
|
241
|
+
protected _handleFormSubmit: (e: SubmitEvent) => void;
|
|
175
242
|
/**
|
|
176
243
|
* Resolves the slotted `<select>` on every `slotchange`, wires `_mutationObserver`,
|
|
177
244
|
* and seeds initial state via `queueMicrotask` to stay safe inside framework reactive passes.
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rc-select-Bu4ukw92.js","sources":["../src/rc-select.styles.ts","../src/rc-select.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const selectStyles = css`\n :host {\n display: inline-block;\n }\n\n #anchor {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: var(--rc-select-gap, var(--rc-control-gap, 0.25em));\n }\n\n #trigger {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: var(--rc-select-gap, var(--rc-control-gap, 0.25em));\n min-block-size: var(--rc-select-control-block-size, var(--rc-control-block-size, auto));\n padding: var(--rc-select-padding-block, var(--rc-control-padding-block, 1px))\n var(--rc-select-padding-inline, var(--rc-control-padding-inline, 4px));\n min-width: 8em;\n cursor: default;\n user-select: none;\n border: var(\n --rc-select-border,\n var(--rc-border, 1px solid var(--rc-border-color, ButtonBorder))\n );\n border-radius: var(--rc-select-radius, var(--rc-control-radius, var(--rc-radius-sm, 0.125em)));\n background: var(--rc-field, Field);\n color: var(--rc-field-text, FieldText);\n font-family: var(--rc-font-family, inherit);\n font-size: var(--rc-font-size, inherit);\n line-height: var(--rc-line-height, normal);\n transition:\n background-color var(--rc-motion-duration, 120ms),\n border-color var(--rc-motion-duration, 120ms),\n box-shadow var(--rc-motion-duration, 120ms);\n\n /* Keyboard focus indicator */\n outline: none;\n &:focus-visible {\n outline: var(--rc-focus-ring, auto);\n outline-offset: var(--rc-focus-ring-offset, 0);\n }\n }\n\n [part='value-display'] {\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n [part='toggle-indicator'] {\n flex-shrink: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n inline-size: var(--rc-select-toggle-indicator-size, 1.1em);\n }\n\n /* Chips — the whole chip is the remove button for a larger touch target */\n [part='chip'] {\n display: inline-flex;\n align-items: center;\n gap: var(--rc-select-chip-gap, calc(var(--rc-control-gap, 0.25em) * 0.8));\n padding: var(--rc-select-chip-padding-block, 0.1em) var(--rc-select-chip-padding-inline, 0.3em);\n border: var(\n --rc-select-chip-border,\n var(--rc-border, 1px solid var(--rc-border-color, ButtonBorder))\n );\n border-radius: var(--rc-select-chip-radius, var(--rc-radius-md, 0.25em));\n background: var(--rc-button-bg, ButtonFace);\n color: var(--rc-button-text, ButtonText);\n font: inherit;\n font-size: 0.875em;\n cursor: pointer;\n\n &:hover {\n background: var(--rc-highlight, Highlight);\n color: var(--rc-highlight-text, HighlightText);\n }\n\n &:focus-visible {\n outline: var(--rc-focus-ring, auto);\n outline-offset: var(--rc-focus-ring-offset, 0);\n }\n }\n\n /* Decorative × icon inside the chip — no interaction, aria-hidden */\n [part='chip-remove'] {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 1em;\n font-size: 0.85em;\n pointer-events: none;\n }\n\n /* Hide the default slot — visually suppresses the slotted native <select> */\n slot:not([name]) {\n display: none;\n }\n\n /* Listbox popup — positioned by AnchorController via adoptedStyleSheets */\n rc-listbox {\n max-height: var(--rc-select-max-height, 20em);\n overflow-y: auto;\n background: var(--rc-surface, Canvas);\n border: var(\n --rc-select-listbox-border,\n var(--rc-border, 1px solid var(--rc-border-color, ButtonBorder))\n );\n border-radius: var(--rc-select-listbox-radius, var(--rc-control-radius, 0));\n box-shadow: var(\n --rc-select-shadow,\n var(--rc-shadow, 0 2px 8px color-mix(in srgb, CanvasText 15%, transparent))\n );\n color: var(--rc-field-text, FieldText);\n padding-block: var(--rc-select-listbox-padding-block, var(--rc-control-padding-block, 0.25em));\n --rc-listbox-option-gap: var(--rc-item-gap, 0.4em);\n --rc-listbox-option-padding-block: var(--rc-item-padding-block, 0.3em);\n --rc-listbox-option-padding-inline: var(--rc-item-padding-inline, 0.75em);\n --rc-listbox-hover-bg: var(--rc-highlight, Highlight);\n --rc-listbox-hover-color: var(--rc-highlight-text, HighlightText);\n --rc-listbox-active-bg: var(--rc-highlight, Highlight);\n --rc-listbox-active-color: var(--rc-highlight-text, HighlightText);\n --rc-listbox-selected-bg: var(--rc-highlight, Highlight);\n --rc-listbox-selected-color: var(--rc-highlight-text, HighlightText);\n --rc-listbox-disabled-opacity: var(--rc-disabled-opacity, 0.5);\n\n &:not(:popover-open) {\n display: none;\n }\n }\n\n rc-listbox [part~='option'][hidden] {\n display: none;\n }\n\n rc-listbox [part~='option'][data-active]:not([aria-disabled='true']) {\n outline: var(--rc-focus-ring, 2px solid var(--rc-accent, Highlight));\n outline-offset: -2px;\n }\n\n rc-listbox [part~='option'][aria-disabled='true'] {\n cursor: not-allowed;\n }\n\n /* Selection checkmark — reserves space whether visible or not */\n rc-listbox [part~='option-checkmark'] {\n flex-shrink: 0;\n width: 1em;\n text-align: center;\n font-size: 0.85em;\n visibility: hidden;\n }\n\n rc-listbox [part~='option'][aria-selected='true'] [part~='option-checkmark'] {\n visibility: visible;\n }\n\n rc-listbox [part~='create-option'] {\n font-style: italic;\n border-top: 1px solid var(--rc-border-color, ButtonBorder);\n margin-top: 0.25em;\n padding-top: 0.3em;\n }\n`;\n\nexport default selectStyles;\n","import { LitElement, html, nothing, type PropertyValues } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport {\n ActiveDescendantController,\n AnchorController,\n NativeChildController,\n warnMissingDirectChild,\n} from '@rcarls/rc-common';\nimport type {\n RCListbox,\n RCListboxChangeEvent,\n ListboxOption,\n ListboxSelectableOption,\n} from '@rcarls/rc-listbox';\n\nimport { selectStyles } from './rc-select.styles.js';\n\nexport type RCSelectValue = string | string[];\n\nexport interface RCSelectChangeEvent {\n /** Updated value after the change. */\n value: RCSelectValue;\n\n /** All selected option values after the change. */\n selectedValues: string[];\n\n /** All selected option objects after the change. */\n selectedOptions: ListboxSelectableOption[];\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'rc-select': RCSelect;\n }\n}\n\n/**\n * Select-only combobox backed by a native <select>, following the WAI-ARIA Combobox\n * pattern.\n *\n * Wraps a native `<select>` (default slot) as the form value reflector while\n * rendering a custom button trigger and popup listbox. Popup placement\n * and `aria-activedescendant` virtual keyboard navigation are supported.\n *\n * @see {@link https://richardcarls.github.io/rc-webcomponents/components/rc-select rc-select docs}\n * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/combobox/ WAI-ARIA Combobox pattern}\n *\n * @slot - Required. A native `<select>` element used for form submission\n * and as the source of truth for options, multiple, and disabled state.\n * @slot display - Optional. Replaces the default value label in the trigger.\n * @slot toggle-indicator - Optional. Replaces the default chevron indicator. Accepts any\n * element(s); the container shifts to inline-start in RTL via flex direction.\n *\n * @fires rc-select-change - When user interaction changes selection.\n * `detail: { value, selectedValues, selectedOptions }`\n * @fires rc-select-open - When the popup opens.\n * @fires rc-select-close - When the popup closes.\n *\n * @csspart anchor - The flex container wrapping chips and trigger.\n * @csspart trigger - The combobox trigger element (div).\n * @csspart chips - The chips group container (when multiple).\n * @csspart chip - Individual chip (when multiple).\n * @csspart chip-label - Text label inside a chip.\n * @csspart chip-remove - Remove button inside a chip.\n * @csspart value-display - The text label showing selected value(s).\n * @csspart toggle-indicator - The open/close indicator container.\n *\n * @attr [has-value] - Present when one or more options are selected. Use with CSS\n * selectors (e.g. `rc-select[has-value]`) for floating-label wrappers.\n *\n * @cssprop [--rc-select-max-height=20em] - Maximum popup height.\n * @cssprop [--rc-select-control-block-size=var(--rc-control-block-size)] - Trigger block size.\n * @cssprop [--rc-select-padding-block=var(--rc-control-padding-block)] - Trigger block-axis padding.\n * @cssprop [--rc-select-padding-inline=var(--rc-control-padding-inline)] - Trigger inline-axis padding.\n * @cssprop [--rc-select-gap=var(--rc-control-gap)] - Gap between trigger content, chips, and icon.\n * @cssprop [--rc-select-radius=var(--rc-control-radius)] - Trigger border radius.\n * @cssprop [--rc-select-border=var(--rc-border)] - Trigger border.\n * @cssprop [--rc-select-listbox-radius=var(--rc-control-radius)] - Popup listbox border radius.\n * @cssprop [--rc-select-listbox-padding-block=var(--rc-control-padding-block)] - Popup listbox block padding.\n * @cssprop [--rc-select-chip-radius=var(--rc-radius-md)] - Multi-select chip border radius.\n * @cssprop [--rc-select-chip-padding-block=0.1em] - Multi-select chip block-axis padding.\n * @cssprop [--rc-select-chip-padding-inline=0.3em] - Multi-select chip inline-axis padding.\n * @cssprop [--rc-select-toggle-indicator-size=1.1em] - Inline size of the toggle indicator container.\n */\nexport class RCSelect extends LitElement {\n static override styles = selectStyles;\n\n /** Reflects whether the popup listbox is open. */\n @property({ type: Boolean, reflect: true })\n open = false;\n\n /** Enables selection of multiple options simultaneously. */\n @property({ type: Boolean, reflect: true })\n multiple = false;\n\n /** Disables the trigger and prevents the popup from opening. */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /** Text shown in the trigger when no value is selected. */\n @property()\n placeholder = '';\n\n /**\n * Controls how selected values appear in the trigger.\n *\n * - `'chips'` — each selected value renders as a removable chip.\n * - `'compact'` — selected values are summarized as \"First, +N more\".\n * - `'auto'` — uses `'chips'` on pointer devices and `'compact'` on touch.\n */\n @property()\n display: 'auto' | 'chips' | 'compact' = 'auto';\n\n /** Flex container used by `_anchorCtrl` as the positioning reference for the popup. */\n @query('#anchor')\n protected _$anchor!: HTMLElement;\n\n /**\n * The combobox trigger div.\n *\n * Owns `role=\"combobox\"`, `aria-activedescendant`,\n * `aria-expanded`, and receives focus during keyboard navigation.\n */\n @query('#trigger')\n protected _$trigger!: HTMLElement;\n\n /** The `<rc-listbox>` popup. Receives option lists and selected-value updates from the host. */\n @query('#listbox')\n protected _$listbox!: RCListbox;\n\n /**\n * Reactive set of currently selected option values.\n *\n * Drive changes through `_applySelection` rather than mutating this directly\n * so the listbox and native `<select>` stay in sync.\n */\n @state()\n protected _selectedValues: Set<string> = new Set();\n\n /**\n * Index into the chip button array for roving-tabindex chip navigation.\n *\n * `-1` means focus is on the trigger.\n */\n @state()\n protected _chipNavIndex = -1;\n\n /**\n * The resolved option list, as rendered in the listbox.\n *\n * `_options` is sourced from the `options` property or the slotted `<select>`.\n */\n @state()\n protected _options: ListboxOption[] = [];\n\n /** WeakRef to the slotted `<select>`. Refreshed on every `slotchange`; `null` when absent. */\n protected _selectRef: WeakRef<HTMLSelectElement> | null = null;\n\n protected readonly _selectController = new NativeChildController<HTMLSelectElement>(this, {\n selector: ':scope > select',\n observe: true,\n onChange: ($select) => this._setupSelect($select),\n onMissing: () => {\n if (import.meta.env.DEV) {\n warnMissingDirectChild(this, {\n selector: ':scope > select',\n message:\n '[rc-select] No direct child <select> found. Place a native <select> inside <rc-select>.',\n });\n }\n },\n });\n\n /**\n * Watches the slotted `<select>` for `childList`, `subtree`, and `attributes` changes\n * so the option list and disabled/multiple state stay in sync with author mutations.\n */\n protected _mutationObserver: MutationObserver | null = null;\n\n private _defaultValue: RCSelectValue | undefined;\n\n private _propertyOptions: ListboxOption[] | undefined;\n\n private _value: RCSelectValue | undefined;\n\n private _selectionInitialized = false;\n\n /** Accumulated printable characters for type-ahead matching; cleared after 500 ms idle. */\n protected _typeAheadBuffer = '';\n\n /** `window.setTimeout` handle for resetting `_typeAheadBuffer`; cancel before modifying. */\n protected _typeAheadTimer = 0;\n\n /**\n * Manages `aria-activedescendant` on `_$trigger` and keyboard cursor position\n * within `_$listbox.navigableItems`.\n */\n protected _activeDescendantCtrl = new ActiveDescendantController(this, {\n host: () => this._$trigger ?? null,\n items: () => this._$listbox?.navigableItems ?? [],\n });\n\n /** Manages CSS-anchored (or JS-fallback) placement of `_$listbox` relative to `_$anchor`. */\n protected _anchorCtrl = new AnchorController(this, {\n anchor: () => this._$anchor ?? null,\n floating: () => this._$listbox ?? null,\n shadowHost: () => this,\n placement: 'bottom-start',\n offset: 2,\n });\n\n override connectedCallback() {\n super.connectedCallback();\n\n document.addEventListener('click', this._onDocClick, { capture: true });\n document.addEventListener('keydown', this._onDocKeyDown, { capture: true });\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n\n document.removeEventListener('click', this._onDocClick, { capture: true });\n document.removeEventListener('keydown', this._onDocKeyDown, {\n capture: true,\n });\n\n this._mutationObserver?.disconnect();\n }\n\n override updated(changed: PropertyValues) {\n super.updated(changed);\n this.toggleAttribute('has-value', this._selectedValues.size > 0);\n }\n\n /** Opens the popup listbox if not already open or disabled. */\n openPopup() {\n if (this.open || this.disabled) {\n return;\n }\n\n this.open = true;\n this._$listbox.showPopover();\n this._anchorCtrl.update();\n\n this.dispatchEvent(new CustomEvent('rc-select-open', { bubbles: true, composed: true }));\n this.requestUpdate();\n }\n\n /**\n * Closes the popup listbox.\n *\n * @param returnFocus - When `true` (default), returns focus to the trigger.\n */\n closePopup(returnFocus = true) {\n if (!this.open) {\n return;\n }\n\n this.open = false;\n this._$listbox.hidePopover();\n this._activeDescendantCtrl.clear();\n\n if (returnFocus) {\n this._$trigger?.focus();\n }\n\n this.dispatchEvent(new CustomEvent('rc-select-close', { bubbles: true, composed: true }));\n }\n\n /**\n * Current selection. Host writes update selection silently; user interaction\n * emits `rc-select-change`.\n */\n get value(): RCSelectValue {\n return this.multiple ? this.selectedValues : (this.selectedValues[0] ?? '');\n }\n\n set value(value: RCSelectValue | undefined) {\n const oldValue = this._value;\n\n this._value = value;\n\n if (value === undefined) {\n this.requestUpdate('value', oldValue);\n\n return;\n }\n\n this._selectionInitialized = true;\n this._applySelection(this._normalizeValue(value));\n this.requestUpdate('value', oldValue);\n }\n\n /** Initial uncontrolled selection, applied before user or native state owns the value. */\n get defaultValue(): RCSelectValue | undefined {\n return this._defaultValue;\n }\n\n set defaultValue(value: RCSelectValue | undefined) {\n const oldValue = this._defaultValue;\n\n this._defaultValue = value;\n\n if (!this._selectionInitialized && this._value === undefined && value !== undefined) {\n this._applySelection(this._normalizeValue(value));\n }\n\n this.requestUpdate('defaultValue', oldValue);\n }\n\n /** Programmatic option source. Omit to derive options from the slotted `<select>`. */\n get options(): ListboxOption[] | undefined {\n return this._propertyOptions ? [...this._propertyOptions] : undefined;\n }\n\n set options(options: ListboxOption[] | undefined) {\n const oldValue = this._propertyOptions;\n\n this._propertyOptions = options ? [...options] : undefined;\n this._syncOptions(this._currentOptions());\n this._mirrorOptionsToNativeSelect();\n this.requestUpdate('options', oldValue);\n }\n\n /** Selected values as a consistently-array-shaped convenience getter. */\n get selectedValues(): string[] {\n return [...this._selectedValues];\n }\n\n /** `ListboxOption` objects for the current selection; falls back to label-only stubs for unknown values. */\n protected get selectedOptions(): ListboxSelectableOption[] {\n return this._selectedOptionsFor(this.selectedValues);\n }\n\n /**\n * Applies an already-normalized array of values as the current selection.\n *\n * In single-select mode only the first value is kept. Syncs `_$listbox` and the\n * native `<select>` but does NOT dispatch `rc-select-change`.\n */\n protected _applySelection(values: string[]): void {\n const selectedValues = this.multiple ? values : values.slice(0, 1);\n\n this._selectedValues = new Set(selectedValues);\n this._$listbox?.setSelectedValues(selectedValues);\n this._syncNativeSelect();\n this.requestUpdate();\n }\n\n /** Document-capture click handler that closes the popup when a click lands outside `this`. */\n protected _onDocClick = (e: MouseEvent) => {\n if (!this.open) {\n return;\n }\n\n if (!e.composedPath().includes(this)) {\n this.closePopup(false);\n }\n };\n\n /** Document-capture keydown handler; closes the popup on `Escape`. */\n protected _onDocKeyDown = (e: KeyboardEvent) => {\n if (!this.open) {\n return;\n }\n\n if (e.key === 'Escape') {\n e.preventDefault();\n\n this.closePopup();\n }\n };\n\n /**\n * Resolves the slotted `<select>` on every `slotchange`, wires `_mutationObserver`,\n * and seeds initial state via `queueMicrotask` to stay safe inside framework reactive passes.\n */\n protected _handleSelectSlotChange() {\n this._selectController.sync();\n }\n\n protected _setupSelect($select: HTMLSelectElement | null) {\n // Disconnect synchronously so the old observer stops immediately.\n this._mutationObserver?.disconnect();\n this._mutationObserver = null;\n this._selectRef = $select ? new WeakRef($select) : null;\n\n if (!$select) {\n return;\n }\n\n // Defer all DOM reads/mutations so this handler is instantaneous when\n // slotchange fires synchronously inside a framework reactive update pass\n // (e.g. SolidJS runUpdates on second+ mount, when shadow DOM already exists).\n queueMicrotask(() => {\n if (!$select.isConnected) {\n return;\n }\n\n this.multiple = $select.multiple;\n this.disabled = $select.disabled;\n this._syncOptionsFromSelect($select);\n\n this._mutationObserver = new MutationObserver(() => {\n const $current = this._selectRef?.deref();\n\n if (!$current) {\n return;\n }\n\n this.multiple = $current.multiple;\n this.disabled = $current.disabled;\n\n if (this._propertyOptions !== undefined) {\n this._applySelectionFromCurrentSource();\n\n return;\n }\n\n this._syncOptionsFromSelect($current);\n });\n this._mutationObserver.observe($select, {\n childList: true,\n subtree: true,\n attributes: true,\n });\n\n this._syncAccessibleName($select);\n });\n }\n\n /**\n * Derives options from `$select` (or defers to `_propertyOptions` when set)\n * and re-applies selection from the current authoritative source.\n */\n protected _syncOptionsFromSelect($select: HTMLSelectElement) {\n if (this._propertyOptions !== undefined) {\n this._syncOptions(this._propertyOptions);\n this._mirrorOptionsToNativeSelect();\n this._applySelectionFromCurrentSource();\n\n return;\n }\n\n const options = this._optionsFromSelect($select);\n\n this._syncOptions(options);\n this._applySelectionFromCurrentSource();\n this._syncAccessibleName($select);\n }\n\n /**\n * Picks the correct selection source in priority order:\n * controlled `_value` → `_defaultValue` → native `<select>` default/current state.\n */\n protected _applySelectionFromCurrentSource(): void {\n if (this._value !== undefined) {\n this._applySelection(this._normalizeValue(this._value));\n\n return;\n }\n\n if (!this._selectionInitialized && this._defaultValue !== undefined) {\n this._selectionInitialized = true;\n this._applySelection(this._normalizeValue(this._defaultValue));\n\n return;\n }\n\n const selected = this._selectionInitialized\n ? this._selectedValuesFromNativeSelect()\n : this._defaultSelectedValuesFromNativeSelect();\n\n this._selectionInitialized = true;\n this._applySelection(selected);\n }\n\n /** Writes `_options` and pushes the list to `_$listbox` when it is mounted. */\n protected _syncOptions(options: ListboxOption[]): void {\n this._options = [...options];\n\n if (this._$listbox) {\n this._$listbox.options = this._options;\n }\n }\n\n /** Returns `_propertyOptions` when set; otherwise reads live from the slotted `<select>`. */\n protected _currentOptions(): ListboxOption[] {\n if (this._propertyOptions !== undefined) {\n return this._propertyOptions;\n }\n\n const $select = this._selectRef?.deref();\n\n return $select ? this._optionsFromSelect($select) : [];\n }\n\n /**\n * Maps non-empty native `<option>` nodes to `ListboxOption` objects.\n *\n * Options with empty `value` are skipped (placeholder guard).\n */\n protected _optionsFromSelect($select: HTMLSelectElement): ListboxOption[] {\n const options: ListboxOption[] = [];\n\n for (const $option of $select.options) {\n if (!$option.value) {\n continue;\n }\n\n options.push({\n value: $option.value,\n label: $option.text,\n disabled: $option.disabled,\n });\n }\n\n return options;\n }\n\n /** Returns values of currently selected `<option>` nodes; falls back to `selectedValues` when no native select is present. */\n protected _selectedValuesFromNativeSelect(): string[] {\n const $select = this._selectRef?.deref();\n\n if (!$select) {\n return this.selectedValues;\n }\n\n return Array.from($select.selectedOptions)\n .map(($opt) => $opt.value)\n .filter(Boolean);\n }\n\n /** Returns values of `defaultSelected` `<option>` nodes (author `selected` attribute); falls back to `selectedValues`. */\n protected _defaultSelectedValuesFromNativeSelect(): string[] {\n const $select = this._selectRef?.deref();\n\n if (!$select) {\n return this.selectedValues;\n }\n\n return Array.from($select.options)\n .filter(($option) => $option.defaultSelected)\n .map(($option) => $option.value)\n .filter(Boolean);\n }\n\n /**\n * Rebuilds native `<select>` options from `_propertyOptions`.\n *\n * Only runs when `_propertyOptions` is set; pauses then resumes `_mutationObserver`\n * while writing to avoid re-entrant sync.\n */\n protected _mirrorOptionsToNativeSelect(): void {\n const $select = this._selectRef?.deref();\n\n if (!$select || this._propertyOptions === undefined) {\n return;\n }\n\n this._mutationObserver?.disconnect();\n $select.replaceChildren();\n\n for (const opt of this._propertyOptions) {\n const $option = document.createElement('option');\n\n $option.value = opt.value;\n $option.text = opt.label;\n $option.disabled = opt.disabled ?? false;\n $option.selected = this._selectedValues.has(opt.value);\n\n $select.add($option);\n }\n\n this._mutationObserver?.observe($select, {\n childList: true,\n subtree: true,\n attributes: true,\n });\n }\n\n /**\n * Upserts a single option into `_options` (and `_propertyOptions` when set)\n * and adds the corresponding `<option>` to the native `<select>` if absent.\n */\n protected _addOption(option: ListboxOption): void {\n const options = this._options.some((opt) => opt.value === option.value)\n ? this._options.map((opt) => (opt.value === option.value ? option : opt))\n : [...this._options, option];\n\n if (this._propertyOptions !== undefined) {\n this._propertyOptions = options;\n }\n\n this._syncOptions(options);\n\n const $select = this._selectRef?.deref();\n\n if (!$select || Array.from($select.options).some(($opt) => $opt.value === option.value)) {\n return;\n }\n\n const $option = document.createElement('option');\n\n $option.value = option.value;\n $option.text = option.label;\n $option.disabled = option.disabled ?? false;\n $option.selected = this._selectedValues.has(option.value);\n\n $select.add($option);\n }\n\n /** Coerces `RCSelectValue` (string or string[]) to `string[]`; returns `[]` for empty-string singles. */\n protected _normalizeValue(value: RCSelectValue): string[] {\n return Array.isArray(value) ? value : value ? [value] : [];\n }\n\n /**\n * Copies `aria-label` or first-label text from the native `<select>` to `_$trigger`.\n *\n * No-op when the trigger already has an explicit `aria-label`.\n */\n protected _syncAccessibleName($sel: HTMLSelectElement): void {\n if (!this._$trigger) {\n return;\n }\n\n // Don't clobber an explicit aria-label.\n if (this._$trigger.hasAttribute('aria-label')) {\n return;\n }\n\n const name = $sel.getAttribute('aria-label') ?? $sel.labels?.[0]?.textContent?.trim() ?? null;\n\n if (name) {\n this._$trigger.setAttribute('aria-label', name);\n } else {\n this._$trigger.removeAttribute('aria-label');\n }\n }\n\n /**\n * Handles `rc-listbox-change` from the popup.\n *\n * Stops propagation, mutates `_selectedValues`, syncs state, and fires\n * `rc-select-change`.\n */\n protected _handleListboxChange(e: CustomEvent) {\n const detail = e.detail as RCListboxChangeEvent;\n\n if (detail.reason === 'action') {\n e.stopPropagation();\n return;\n }\n\n const { optionValue, value, selected } = detail;\n const activatedValue = optionValue ?? (Array.isArray(value) ? value.at(-1) : value);\n\n if (!activatedValue) {\n return;\n }\n\n e.stopPropagation();\n\n if (this.multiple) {\n const next = new Set(this._selectedValues);\n\n if (selected) {\n next.add(activatedValue);\n } else {\n next.delete(activatedValue);\n }\n\n this._selectedValues = next;\n } else {\n this._selectedValues = selected ? new Set([activatedValue]) : new Set();\n\n if (selected) {\n this.closePopup();\n }\n }\n\n this._selectionInitialized = true;\n this._syncNativeSelect();\n this._$listbox.setSelectedValues(this.selectedValues);\n this._dispatchChange();\n }\n\n /** Removes a single value from `_selectedValues`, syncs the listbox and native select, and dispatches `rc-select-change`. */\n protected _removeValue(value: string) {\n const next = new Set(this._selectedValues);\n\n next.delete(value);\n\n this._selectedValues = next;\n this._$listbox.setSelectedValues([...next]);\n this._selectionInitialized = true;\n\n this._syncNativeSelect();\n this._dispatchChange();\n }\n\n /** Flips `selected` on each `<option>` in the native `<select>` to match `_selectedValues`; no-op when no native select is present. */\n protected _syncNativeSelect() {\n const $select = this._selectRef?.deref();\n\n if (!$select) {\n return;\n }\n\n for (const $option of $select.options) {\n $option.selected = this._selectedValues.has($option.value);\n }\n }\n\n /** Constructs and dispatches `rc-select-change` with current `value`, `selectedValues`, and `selectedOptions`. */\n protected _dispatchChange(): void {\n this.dispatchEvent(\n new CustomEvent<RCSelectChangeEvent>('rc-select-change', {\n bubbles: true,\n composed: true,\n detail: {\n value: this.value,\n selectedValues: this.selectedValues,\n selectedOptions: this.selectedOptions,\n },\n }),\n );\n }\n\n /** Maps value strings to `ListboxOption` objects from `_options`; creates label-only fallback stubs for unknown values. */\n protected _selectedOptionsFor(values: string[]): ListboxSelectableOption[] {\n return values.map((value) => {\n return (\n this._options.find(\n (opt): opt is ListboxSelectableOption => opt.kind !== 'action' && opt.value === value,\n ) ?? {\n value,\n label: value,\n }\n );\n });\n }\n\n /** Resolved display mode after `auto` pointer-detection: `'chips'` on fine-pointer devices, `'compact'` on coarse. */\n protected get _effectiveDisplay(): 'chips' | 'compact' {\n if (this.display === 'chips') {\n return 'chips';\n }\n\n if (this.display === 'compact') {\n return 'compact';\n }\n\n return window.matchMedia('(pointer: coarse)').matches ? 'compact' : 'chips';\n }\n\n /** Looks up the display label for `value` from native `<select>` option text; returns `value` itself as a fallback. */\n protected _labelFor(value: string): string {\n const $select = this._selectRef?.deref();\n\n if ($select) {\n for (const $option of $select.options) {\n if ($option.value === value) {\n return $option.text;\n }\n }\n }\n\n return value;\n }\n\n /** Text shown in the trigger's value-display area; returns placeholder when chips are active or nothing is selected. */\n protected get _displayLabel(): string {\n if (this._selectedValues.size === 0) {\n return this.placeholder;\n }\n\n if (this._effectiveDisplay === 'chips' && this.multiple) {\n return this.placeholder;\n }\n\n if (this._selectedValues.size === 1) {\n return this._labelFor([...this._selectedValues][0]);\n }\n\n // Compact multi: \"First, +N more\"\n const values = [...this._selectedValues];\n const first = this._labelFor(values[0]);\n\n return `${first}, +${values.length - 1} more`;\n }\n\n /**\n * APG Combobox keyboard handler on the trigger.\n *\n * Arrow keys navigate/open, Space/Enter activate, Tab closes without focus return,\n * ArrowLeft enters chip navigation, and printable chars forward to type-ahead.\n */\n protected _handleTriggerKeyDown(e: KeyboardEvent) {\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n if (!this.open) {\n this.openPopup();\n this._activeDescendantCtrl.navigateToFirst();\n } else {\n this._activeDescendantCtrl.navigate(1);\n }\n break;\n\n case 'ArrowUp':\n e.preventDefault();\n if (!this.open) {\n this.openPopup();\n this._activeDescendantCtrl.navigateToLast();\n } else {\n this._activeDescendantCtrl.navigate(-1);\n }\n break;\n\n case 'Home':\n if (this.open) {\n e.preventDefault();\n this._activeDescendantCtrl.navigateToFirst();\n }\n break;\n\n case 'End':\n if (this.open) {\n e.preventDefault();\n this._activeDescendantCtrl.navigateToLast();\n }\n break;\n\n case ' ':\n case 'Enter':\n e.preventDefault();\n if (!this.open) {\n this.openPopup();\n this._activeDescendantCtrl.navigateToFirst();\n } else {\n this._activateActive();\n }\n break;\n\n case 'Tab':\n if (this.open) {\n this.closePopup(false);\n }\n break;\n\n case 'ArrowLeft':\n if (!this.open && this.multiple && this._selectedValues.size > 0) {\n e.preventDefault();\n this._enterChipNav();\n }\n break;\n\n default:\n if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {\n this._handleTypeAhead(e.key);\n }\n }\n }\n\n /**\n * Dispatches a synthetic `pointerdown` on the active listbox item to activate it.\n *\n * Prefers `pointerdown` over a direct call so listbox item click logic\n * (which is bound to `pointerdown`) fires through its normal path.\n */\n protected _activateActive() {\n const $item = this._activeDescendantCtrl.activeItem;\n\n if ($item) {\n $item.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, cancelable: true }));\n }\n }\n\n /**\n * Accumulates characters in `_typeAheadBuffer` and either immediately selects\n * the first match (closed single-select) or moves the virtual cursor (open popup).\n */\n protected _handleTypeAhead(char: string) {\n clearTimeout(this._typeAheadTimer);\n\n this._typeAheadBuffer += char.toLowerCase();\n\n this._typeAheadTimer = window.setTimeout(() => {\n this._typeAheadBuffer = '';\n }, 500);\n\n const options = this._$listbox?.allOptions ?? [];\n const match = options.find(\n (option) => !option.disabled && option.label.toLowerCase().startsWith(this._typeAheadBuffer),\n );\n\n if (!match) {\n return;\n }\n\n if (!this.open) {\n // Select-only type-ahead: immediately select the match\n if (!this.multiple) {\n this._selectionInitialized = true;\n this._applySelection([match.value]);\n this._dispatchChange();\n }\n } else {\n // Open popup: move virtual cursor to match\n const $items = this._$listbox.navigableItems;\n const $item = $items.find(($el) => $el.getAttribute('data-value') === match.value);\n\n if ($item) {\n this._activeDescendantCtrl.navigateToItem($item);\n }\n }\n }\n\n /** Focuses the last chip button and sets `_chipNavIndex` to begin roving-tabindex navigation within the chip group. */\n protected _enterChipNav() {\n const $buttons = this._$chipButtons();\n\n if ($buttons.length === 0) {\n return;\n }\n\n this._chipNavIndex = $buttons.length - 1;\n $buttons[this._chipNavIndex].focus();\n }\n\n /** Queries all `button[part~=\"chip\"]` elements in `renderRoot`; order matches DOM order. */\n protected _$chipButtons(): HTMLButtonElement[] {\n return Array.from(this.renderRoot.querySelectorAll<HTMLButtonElement>('button[part~=\"chip\"]'));\n }\n\n /**\n * Keyboard handler for chip buttons.\n *\n * ArrowLeft/Right rove chip focus, Escape returns to trigger,\n * Delete/Backspace/Enter/Space remove the chip's value\n * and return focus to the trigger.\n */\n protected _handleChipKeyDown(e: KeyboardEvent, value: string) {\n const $buttons = this._$chipButtons();\n\n switch (e.key) {\n case 'ArrowLeft':\n e.preventDefault();\n if (this._chipNavIndex > 0) {\n this._chipNavIndex--;\n $buttons[this._chipNavIndex]?.focus();\n }\n break;\n\n case 'ArrowRight':\n e.preventDefault();\n if (this._chipNavIndex < $buttons.length - 1) {\n this._chipNavIndex++;\n $buttons[this._chipNavIndex]?.focus();\n } else {\n this._chipNavIndex = -1;\n this._$trigger?.focus();\n }\n break;\n\n case 'Escape':\n e.preventDefault();\n this._chipNavIndex = -1;\n this._$trigger?.focus();\n break;\n\n case 'Delete':\n case 'Backspace':\n case 'Enter':\n case ' ':\n e.preventDefault();\n this._removeValue(value);\n this._chipNavIndex = -1;\n this._$trigger?.focus();\n break;\n }\n }\n\n /** Toggles the popup open or closed on trigger click. */\n protected _handleTriggerClick() {\n if (this.open) {\n this.closePopup();\n } else {\n this.openPopup();\n }\n }\n\n protected override render() {\n const showChips =\n this.multiple && this._effectiveDisplay === 'chips' && this._selectedValues.size > 0;\n\n return html`\n <div id=\"anchor\" part=\"anchor\">\n <div\n id=\"trigger\"\n part=\"trigger\"\n role=\"combobox\"\n tabindex=${this.disabled ? '-1' : '0'}\n aria-haspopup=\"listbox\"\n aria-expanded=${this.open ? 'true' : 'false'}\n aria-controls=\"listbox\"\n aria-disabled=${this.disabled ? 'true' : 'false'}\n aria-label=${this.placeholder || nothing}\n @click=${this._handleTriggerClick}\n @keydown=${this._handleTriggerKeyDown}\n >\n ${showChips ? this._renderChips() : nothing}\n\n <span part=\"value-display\">${this._displayLabel}</span>\n\n <span part=\"toggle-indicator\" aria-hidden=\"true\">\n <slot name=\"toggle-indicator\">\n <svg\n width=\"10\"\n height=\"6\"\n viewBox=\"0 0 10 6\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <polyline points=\"1,1 5,5 9,1\" />\n </svg>\n </slot>\n </span>\n </div>\n </div>\n\n <rc-listbox\n id=\"listbox\"\n part=\"listbox\"\n popover=\"manual\"\n ?multiple=${this.multiple}\n checkmark\n @rc-listbox-change=${this._handleListboxChange}\n ></rc-listbox>\n\n <slot @slotchange=${this._handleSelectSlotChange}></slot>\n `;\n }\n\n /** Renders the chip group `<span>` with one `<button>` per selected value for multi-select chip display mode. */\n protected _renderChips() {\n return html`\n <span part=\"chips\" role=\"group\" aria-label=\"Selected items\">\n ${[...this._selectedValues].map((value) => {\n const label = this._labelFor(value);\n return html`\n <button\n type=\"button\"\n part=\"chip\"\n data-value=${value}\n tabindex=\"-1\"\n aria-label=${`Remove ${label}`}\n @click=${(e: MouseEvent) => {\n e.stopPropagation();\n this._removeValue(value);\n }}\n @keydown=${(e: KeyboardEvent) => this._handleChipKeyDown(e, value)}\n >\n <span part=\"chip-label\">${label}</span\n ><span part=\"chip-remove\" aria-hidden=\"true\">×</span>\n </button>\n `;\n })}\n </span>\n `;\n }\n}\n\nexport default RCSelect;\n"],"names":["selectStyles","css","_RCSelect","LitElement","NativeChildController","$select","ActiveDescendantController","AnchorController","changed","returnFocus","value","oldValue","options","values","selectedValues","$current","selected","$option","$opt","opt","option","$sel","name","detail","optionValue","activatedValue","next","$item","char","match","$el","$buttons","showChips","html","nothing","label","e","RCSelect","__decorateClass","property","query","state"],"mappings":";;;AAEO,MAAMA,IAAeC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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