luxen-ui 0.24.0 → 0.25.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/cdn/custom-elements.json +359 -359
- package/cdn/elements/avatar/avatar.js +1 -1
- package/cdn/elements/avatar/avatar.js.map +1 -1
- package/cdn/elements/dropdown-item/dropdown-item.js +1 -1
- package/cdn/elements/dropdown-item/dropdown-item.js.map +1 -1
- package/cdn/elements/prose-editor/prose-editor.js +1 -1
- package/cdn/elements/prose-editor/prose-editor.js.map +1 -1
- package/cdn/elements/select/select.js +1 -1
- package/cdn/elements/select/select.js.map +1 -1
- package/cdn/elements/tag/tag.js +1 -1
- package/cdn/elements/tag/tag.js.map +1 -1
- package/cdn/elements/tree/tree.js +1 -1
- package/cdn/elements/tree/tree.js.map +1 -1
- package/cdn/elements/tree-item/tree-item.js +1 -1
- package/cdn/elements/tree-item/tree-item.js.map +1 -1
- package/cdn/shared/styles/button-core.styles.js +1 -1
- package/cdn/shared/styles/button-core.styles.js.map +1 -1
- package/cdn/shared/styles/checkbox-appearance.styles.js +1 -1
- package/cdn/shared/styles/checkbox-appearance.styles.js.map +1 -1
- package/cdn/shared/styles/picker-core.styles.js +1 -1
- package/cdn/shared/styles/picker-core.styles.js.map +1 -1
- package/cdn/standalone.css +153 -64
- package/cdn/standalone.js +10 -10
- package/cdn/standalone.js.map +1 -1
- package/cdn/styles/elements/breadcrumb.css +1 -1
- package/cdn/styles/elements/button.css +1 -1
- package/cdn/styles/elements/checkbox.css +1 -1
- package/cdn/styles/elements/close-button/circle.css +1 -1
- package/cdn/styles/elements/close-button/ring.css +1 -1
- package/cdn/styles/elements/close-button/square.css +1 -1
- package/cdn/styles/elements/disclosure.css +2 -2
- package/cdn/styles/elements/input-otp.css +2 -2
- package/cdn/styles/elements/input-stepper/default.css +2 -2
- package/cdn/styles/elements/input-stepper/pill.css +2 -2
- package/cdn/styles/elements/input-stepper/rounded.css +2 -2
- package/cdn/styles/elements/input.css +48 -15
- package/cdn/styles/elements/prose-editor.css +23 -8
- package/cdn/styles/elements/radio-group.css +1 -1
- package/cdn/styles/elements/radio.css +1 -1
- package/cdn/styles/elements/segmented-control.css +2 -2
- package/cdn/styles/elements/select.css +25 -4
- package/cdn/styles/elements/story.css +1 -1
- package/cdn/styles/elements/switch.css +1 -1
- package/cdn/styles/elements/tabs/enclosed.css +3 -3
- package/cdn/styles/elements/tabs/line.css +3 -3
- package/cdn/styles/elements/textarea.css +22 -8
- package/cdn/styles/preset.css +7 -1
- package/cdn/styles/tokens/aliases.css +3 -1
- package/cdn/styles/tokens/forms.css +4 -0
- package/cdn/styles/tokens.css +7 -1
- package/dist/css/elements/breadcrumb.css +1 -1
- package/dist/css/elements/button.css +1 -1
- package/dist/css/elements/checkbox.css +1 -1
- package/dist/css/elements/close-button/circle.css +1 -1
- package/dist/css/elements/close-button/ring.css +1 -1
- package/dist/css/elements/close-button/square.css +1 -1
- package/dist/css/elements/disclosure.css +2 -2
- package/dist/css/elements/input-otp.css +2 -2
- package/dist/css/elements/input-stepper/default.css +2 -2
- package/dist/css/elements/input-stepper/pill.css +2 -2
- package/dist/css/elements/input-stepper/rounded.css +2 -2
- package/dist/css/elements/input.css +48 -15
- package/dist/css/elements/prose-editor.css +23 -8
- package/dist/css/elements/radio-group.css +1 -1
- package/dist/css/elements/radio.css +1 -1
- package/dist/css/elements/segmented-control.css +2 -2
- package/dist/css/elements/select.css +25 -4
- package/dist/css/elements/story.css +1 -1
- package/dist/css/elements/switch.css +1 -1
- package/dist/css/elements/tabs/enclosed.css +3 -3
- package/dist/css/elements/tabs/line.css +3 -3
- package/dist/css/elements/textarea.css +22 -8
- package/dist/css/preset.css +7 -1
- package/dist/css/tokens/aliases.css +3 -1
- package/dist/css/tokens/forms.css +4 -0
- package/dist/css/tokens.css +7 -1
- package/dist/custom-elements.json +359 -359
- package/dist/elements/avatar/avatar.css +1 -1
- package/dist/elements/dropdown-item/dropdown-item.css +5 -4
- package/dist/elements/prose-editor/prose-editor.css +1 -1
- package/dist/elements/select/select.css +0 -4
- package/dist/elements/tag/tag.css +3 -3
- package/dist/elements/tree/tree.css +1 -1
- package/dist/elements/tree-item/tree-item.css +1 -1
- package/dist/metadata/index.json +1 -1
- package/dist/shared/styles/button-core.css +1 -1
- package/dist/shared/styles/checkbox-appearance.css +1 -1
- package/dist/shared/styles/picker-core.css +25 -4
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"../../chunks/lit.js";import{n as t,r as n}from"../../chunks/static-html.js";import{n as r,r as i,t as a}from"../../chunks/decorate.js";import{a as o,t as s}from"../../chunks/lit-html.js";import{t as c}from"../../chunks/unsafe-html.js";import{LuxenFormAssociatedElement as l}from"../../shared/luxen-form-associated-element.js";import{PopoverController as u}from"../../shared/controllers/popover.js";import{ListboxNavController as d}from"../../shared/controllers/listbox-nav.js";import{DatalistObserverController as f}from"../../shared/controllers/datalist-observer.js";import{LocalizeController as p}from"../../shared/localize.js";import{RichHighlighter as m,highlightText as h,normalize as g}from"../../shared/highlight.js";import{cls as _,tagName as v,uniqueId as y}from"../../registry.js";import{adoptRichContentStyles as b,richOptionLabel as x}from"../../shared/rich-option.js";import S from"../../shared/styles/host.styles.js";import C from"../../shared/styles/visually-hidden.styles.js";import w from"../../shared/styles/select-item-suffix.styles.js";import T from"../../shared/styles/picker-core.styles.js";import E from"../../shared/styles/select-item.styles.js";var D=e(`.trigger{inline-size:100%;min-block-size:var(--height);color:var(--l-form-control-value-color);font:inherit;text-align:start;cursor:pointer;gap:.5rem;padding-block:.25rem}:host([multiple]) .trigger{padding-inline-start:.375rem}.
|
|
1
|
+
import{i as e}from"../../chunks/lit.js";import{n as t,r as n}from"../../chunks/static-html.js";import{n as r,r as i,t as a}from"../../chunks/decorate.js";import{a as o,t as s}from"../../chunks/lit-html.js";import{t as c}from"../../chunks/unsafe-html.js";import{LuxenFormAssociatedElement as l}from"../../shared/luxen-form-associated-element.js";import{PopoverController as u}from"../../shared/controllers/popover.js";import{ListboxNavController as d}from"../../shared/controllers/listbox-nav.js";import{DatalistObserverController as f}from"../../shared/controllers/datalist-observer.js";import{LocalizeController as p}from"../../shared/localize.js";import{RichHighlighter as m,highlightText as h,normalize as g}from"../../shared/highlight.js";import{cls as _,tagName as v,uniqueId as y}from"../../registry.js";import{adoptRichContentStyles as b,richOptionLabel as x}from"../../shared/rich-option.js";import S from"../../shared/styles/host.styles.js";import C from"../../shared/styles/visually-hidden.styles.js";import w from"../../shared/styles/select-item-suffix.styles.js";import T from"../../shared/styles/picker-core.styles.js";import E from"../../shared/styles/select-item.styles.js";var D=e(`.trigger{inline-size:100%;min-block-size:var(--height);color:var(--l-form-control-value-color);font:inherit;text-align:start;cursor:pointer;gap:.5rem;padding-block:.25rem}:host([multiple]) .trigger{padding-inline-start:.375rem}.value{flex-wrap:wrap;flex:1;align-items:center;gap:.25rem;min-inline-size:0;display:flex;overflow:hidden}.value-text{text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;overflow:hidden}[part=tag]{--height:initial;--border-radius:initial}.placeholder{color:var(--l-form-control-placeholder-color)}.clear-button{margin-block:auto;position:absolute;inset-block:0;inset-inline-end:calc(var(--l-form-control-border-width) + var(--_action-size))}.base:has(>.clear-button) .chevron{margin-inline-start:var(--_action-size)}.value .l-select-item-title{font-weight:inherit}.value .l-select-item-description,.value .l-select-item-suffix{display:none}.search-row{border-block-end:1px solid var(--l-color-border-overlay);padding:.375rem}.search{inline-size:100%;block-size:var(--l-size-control-sm);border:var(--l-form-control-border-width) solid var(--l-form-control-border-color);border-radius:calc(var(--border-radius) - 2px);background-color:var(--l-form-control-background-color);color:var(--l-form-control-value-color);font:inherit;padding-inline:.5rem}.search:focus-visible{border-color:var(--l-focus-ring);outline:none}.search::placeholder{color:var(--l-form-control-placeholder-color)}.option[data-active]{background-color:var(--l-color-bg-state-hover)}.option[data-current]:after{content:"";inline-size:1rem;block-size:calc(var(--l-popover-font-size) * var(--l-popover-line-height));-webkit-mask:var(--_check-icon) center / 1rem no-repeat;mask:var(--_check-icon) center / 1rem no-repeat;background-color:currentColor;position:absolute;inset-block-start:var(--_row-padding-block);inset-inline-start:.5rem}.l-select-item-media{align-items:center;font-size:1.25em;display:inline-flex}`),O=(e,t)=>{if(!t)return!0;let n=g(e.label);return g(t).split(/\s+/).filter(Boolean).every(e=>n.includes(e))},k=class extends Event{constructor(e){super(`change`,{bubbles:!0,composed:!1,cancelable:!1}),this.value=e}},A=class extends Event{constructor(e){super(`input`,{bubbles:!0,composed:!1,cancelable:!1}),this.value=e}},j=class extends l{constructor(...e){super(...e),this._localize=new p(this),this._listId=y(`select-list`),this._richHighlighter=new m,this._floating=new u(this,{getTriggerElement:()=>this._triggerEl,getFloatingElement:()=>this._panelEl,getArrowElement:()=>null}),this._nav=new d(this,{listboxId:this._listId,getCount:()=>this._filtered.length,isDisabled:e=>this._filtered[e]?.disabled??!1,isOpen:()=>this._open,open:()=>this.show(),getOptionElements:()=>this.shadowRoot?.querySelectorAll(`.option`)}),this._options=new f(this,()=>this._syncItems()),this.#e=``,this.#t=``,this.#n=`md`,this.#r=!1,this.#i=!1,this.#a=`bottom-start`,this.#o=!1,this.filter=O,this.#s=[],this.#c=!1,this.#l=``,this.#u=[],this._defaultValues=[],this._onDocumentPointerDown=e=>{e.composedPath().includes(this)||(this.hasInteracted=!0,this._updateValidity(),this.hide({focusTrigger:!1}))},this._onTriggerKeyDown=e=>{this._open||(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this.show())},this._onPanelKeyDown=e=>{if(!this._nav.onKeyDown(e))switch(e.key){case`Enter`:{e.preventDefault();let t=this._filtered[this._nav.activeIndex];t&&this._select(t);break}case`Escape`:e.preventDefault(),this.hide();break;case`Tab`:this.hide({focusTrigger:!1})}},this._onSearchInput=e=>{this._query=e.target.value,this._nav.reset(),this.dispatchEvent(new A(this._query))}}static{this.styles=[S,C,w,E,T,D]}#e;get placeholder(){return this.#e}set placeholder(e){this.#e=e}#t;get label(){return this.#t}set label(e){this.#t=e}#n;get size(){return this.#n}set size(e){this.#n=e}#r;get searchable(){return this.#r}set searchable(e){this.#r=e}#i;get withClear(){return this.#i}set withClear(e){this.#i=e}#a;get placement(){return this.#a}set placement(e){this.#a=e}#o;get multiple(){return this.#o}set multiple(e){this.#o=e}#s;get _values(){return this.#s}set _values(e){this.#s=e}#c;get _open(){return this.#c}set _open(e){this.#c=e}#l;get _query(){return this.#l}set _query(e){this.#l=e}#u;get _items(){return this.#u}set _items(e){this.#u=e}get value(){return this.multiple?[...this._values]:this._values[0]??``}set value(e){this._values=Array.isArray(e)?[...e]:e?[e]:[]}get _triggerEl(){return this.shadowRoot?.querySelector(`.trigger`)??null}get _panelEl(){return this.shadowRoot?.querySelector(`.panel`)??null}get _searchEl(){return this.shadowRoot?.querySelector(`.search`)??null}get validationTarget(){return this._triggerEl??void 0}connectedCallback(){if(super.connectedCallback(),this._readItems(),this._values.length===0){let e=this.getAttribute(`value`);if(e)this._values=[e];else{let e=this._items.filter(e=>e.selected).map(e=>e.value);this._values=this.multiple?e:e.slice(0,1)}}this._defaultValues=[...this._values],this._syncForm()}updated(e){(e.has(`_values`)||e.has(`multiple`))&&(this._syncForm(),this._updateValidity())}formResetCallback(){this._values=[...this._defaultValues],this._query=``,this._nav.reset(),super.formResetCallback(),this._syncForm()}formStateRestoreCallback(e){this.value=e,this._syncForm()}_readItems(){let e=this.querySelector(`datalist`),t=e?Array.from(e.options):[];this._items=t.map(e=>{let t=e.childElementCount>0,n=x(e);return{value:e.value,label:n,disabled:e.disabled,selected:e.hasAttribute(`selected`),html:t?e.innerHTML:void 0}}),b(this.shadowRoot,this._items)}_syncItems(){let e=this._open?this._filtered[this._nav.activeIndex]:void 0;this._readItems(),this._open&&this._nav.setActive(e?this._filtered.findIndex(t=>t.value===e.value):-1)}_itemFor(e){return this._items.find(t=>t.value===e)}get _filtered(){return this._items.filter(e=>this.filter(e,this._query))}_syncForm(){if(this.multiple){let e=new FormData;for(let t of this._values)e.append(this.name,t);this._internals.setFormValue(e)}else this._internals.setFormValue(this._values[0]??``)}_updateValidity(){this.required&&this._values.length===0?this.setValidity({valueMissing:!0},this._localize.term(`selectOption`),this._triggerEl??void 0):this.setValidity({})}show(){this._open||this.disabled||(this._readItems(),this.dispatchEvent(new Event(`show`,{cancelable:!0}))&&(this._open=!0,this._query=``,this._values.length&&this._nav.setActive(this._filtered.findIndex(e=>e.value===this._values[0])),this.updateComplete.then(()=>{this._panelEl?.showPopover?.(),this._floating.startPositioning({placement:this.placement,distance:4,minWidth:`trigger`}),(this._searchEl??this._panelEl?.querySelector(`.listbox`))?.focus(),document.addEventListener(`pointerdown`,this._onDocumentPointerDown,!0)})))}hide({focusTrigger:e=!0}={}){if(!this._open||!this.dispatchEvent(new Event(`hide`,{cancelable:!0})))return;this._open=!1,this._query=``,this._nav.reset();let t=this._panelEl;t?.matches?.(`:popover-open`)&&t.hidePopover?.(),this._floating.stopPositioning(),document.removeEventListener(`pointerdown`,this._onDocumentPointerDown,!0),e&&this._triggerEl?.focus()}_select(e){e.disabled||(this.hasInteracted=!0,this.multiple?(this._values=this._values.includes(e.value)?this._values.filter(t=>t!==e.value):[...this._values,e.value],this.dispatchEvent(new k(this.value)),this._searchEl?.focus()):(this._values=[e.value],this.dispatchEvent(new k(this.value)),this.hide()))}_removeValue(e){this._values=this._values.filter(t=>t!==e),this.hasInteracted=!0,this.dispatchEvent(new k(this.value))}_clear(e){e?.stopPropagation(),this._values=[],this.hasInteracted=!0,this.dispatchEvent(new k(this.value)),this._triggerEl?.focus()}_renderSingleValue(){let e=this._itemFor(this._values[0]);return e?e.html?o`${c(e.html)}`:o`<span class="value-text">${e.label}</span>`:o`<span class="value-text placeholder">${this.placeholder}</span>`}_renderChips(){if(this._values.length===0)return o`<span class="value-text placeholder">${this.placeholder}</span>`;let e=t(v(`tag`));return this._values.map(t=>{let r=this._itemFor(t);return n`<${e}
|
|
2
2
|
size="sm"
|
|
3
3
|
removable
|
|
4
4
|
part="tag"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","names":["unsafeCSS","rawStyles","hostStyles","visuallyHiddenStyles","suffixStyles","selectItemStyles","pickerCoreStyles","unsafeHTML","unsafeStatic","nothing","_decorate","property","state","r","s","u","r$1","n","__decorate","b","A","o","host_styles_default","visually_hidden_styles_default","select_item_suffix_styles_default","picker_core_styles_default","select_item_styles_default","styles","defaultFilter","query","label","normalize","item","kw","SelectChangeEvent","value","SelectInputEvent","Select","LuxenFormAssociatedElement","_args","LocalizeController","uniqueId","RichHighlighter","PopoverController","ListboxNavController","i","DatalistObserverController","#_placeholder_accessor_storage","#_label_accessor_storage","#_size_accessor_storage","#_searchable_accessor_storage","#_withClear_accessor_storage","#_placement_accessor_storage","#_multiple_accessor_storage","#__values_accessor_storage","#__open_accessor_storage","#__query_accessor_storage","#__items_accessor_storage","active","v","attr","selected","changed","state","list","opts","rich","richOptionLabel","adoptRichContentStyles","data","panel","focusTrigger","chip","tagName","inner","onClick","invalid","filtered","activeId","activeIndex","hasValue","status","highlightText","cls"],"sources":["../../../src/html/elements/select/select.css?inline","../../../src/html/elements/select/select.ts"],"sourcesContent":["/* Knobs, size scale, field frame, chevron, clear, listbox popover and the\n shared option bits come from shared/styles/picker-core.css; the option row\n and rich-option content from shared/styles/select-item.css (also used by the\n native `.l-select` picker). This file holds what is specific to l-select. */\n\n/*\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n 🆃🆁🅸🅶🅶🅴🆁 (button, opens the listbox popover)\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n*/\n\n.trigger {\n gap: 0.5rem;\n inline-size: 100%;\n min-block-size: var(--height);\n padding-block: 0.25rem;\n color: var(--l-form-control-value-color);\n font: inherit;\n text-align: start;\n cursor: pointer;\n}\n\n/* The form-control inline padding is tuned for text; before a chip row it reads\n as too much, so tighten the start edge in multiple mode (the chips bring their\n own spacing). */\n:host([multiple]) .trigger {\n padding-inline-start: 0.375rem;\n}\n\n.trigger:focus-visible {\n outline: none;\n}\n\n/* Selection display fills the trigger; the chevron (and overlaid clear) sit at the end. */\n.value {\n flex: 1;\n min-inline-size: 0;\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 0.25rem;\n overflow: hidden;\n}\n\n.value-text {\n min-inline-size: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* This element's public knobs and the chip's share two names — `--height` and\n `--border-radius` — and custom properties inherit straight through a shadow\n boundary. Left alone, every chip in the trigger renders at the *select's*\n height and corner rather than its own: a 36px chip with a 6px corner, when\n `size=\"sm\"` asked for a 24px pill. `initial` is the guaranteed-invalid value,\n so each `var(--x, …)` inside the chip falls back to its own default. Matched\n on the part, not on the tag name, so a renamed `elementPrefix` can't miss it.\n\n The fill used to collide too, back when the chip read `--background`; it now\n reads `--background-color`, which this element does not expose. */\n[part='tag'] {\n --height: initial;\n --border-radius: initial;\n}\n\n.placeholder {\n color: var(--l-form-control-placeholder-color);\n}\n\n/* The clear button is a SIBLING of the trigger (not a child — no nested buttons),\n * overlaid on the trigger's end, square against the chevron's square — which\n * sits flush against the border (picker-core.css). */\n.clear-button {\n position: absolute;\n inset-block: 0;\n inset-inline-end: calc(var(--l-form-control-border-width) + var(--_action-size));\n margin-block: auto;\n}\n\n/* Keep the value (text or chips) clear of the overlaid button. */\n.base:has(> .clear-button) .chevron {\n margin-inline-start: var(--_action-size);\n}\n\n/* Rich content in the trigger takes the row styles (select-item.css), then\n mirrors the native trigger: only the media and title, at the value's weight —\n the secondary description and the trailing suffix are dropped so the selected\n value stays compact and consistent across options. */\n.value .l-select-item-title {\n font-weight: inherit;\n}\n.value .l-select-item-description,\n.value .l-select-item-suffix {\n display: none;\n}\n\n/*\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n 🅿🅰🅽🅴🅻 (popover: search + listbox)\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n*/\n\n.search-row {\n padding: 0.375rem;\n border-block-end: 1px solid var(--l-color-border-overlay);\n}\n\n.search {\n inline-size: 100%;\n block-size: var(--l-size-control-sm);\n padding-inline: 0.5rem;\n border: var(--l-form-control-border-width) solid var(--l-form-control-border-color);\n border-radius: calc(var(--border-radius) - 2px);\n background-color: var(--l-form-control-background-color);\n color: var(--l-form-control-value-color);\n font: inherit;\n}\n\n.search:focus-visible {\n outline: none;\n border-color: var(--l-focus-ring);\n}\n\n.search::placeholder {\n color: var(--l-form-control-placeholder-color);\n}\n\n/* Keyboard-active row (moves with Arrow keys) — same tint as hover. */\n.option[data-active] {\n background-color: var(--l-color-bg-state-hover);\n}\n\n/* Selected indicator in the reserved inline-start column, pinned to the first\n * line so a wrapping description never shifts it (matches the native\n * `::checkmark` in src/css/elements/select.css). */\n.option[data-current]::after {\n content: '';\n position: absolute;\n inset-inline-start: 0.5rem;\n inset-block-start: var(--_row-padding-block);\n inline-size: 1rem;\n block-size: calc(var(--l-popover-font-size) * var(--l-popover-line-height));\n background-color: currentColor;\n mask: var(--_check-icon) center / 1rem no-repeat;\n}\n\n/* Rich content, rows and trigger alike: the shared layout (select-item.css)\n plus what only this tier needs — media may be an emoji or icon rather than an\n image, so it is centred and sized by font. */\n.l-select-item-media {\n display: inline-flex;\n align-items: center;\n font-size: 1.25em;\n}\n","import { html, nothing, unsafeCSS } from 'lit';\nimport { html as staticHtml, unsafeStatic } from 'lit/static-html.js';\nimport { property, state } from 'lit/decorators.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport type { Placement } from '@floating-ui/dom';\nimport { LuxenFormAssociatedElement } from '../../shared/luxen-form-associated-element.js';\nimport { PopoverController } from '../../shared/controllers/popover.js';\nimport { ListboxNavController } from '../../shared/controllers/listbox-nav.js';\nimport { DatalistObserverController } from '../../shared/controllers/datalist-observer.js';\nimport { LocalizeController } from '../../shared/localize.js';\nimport { RichHighlighter, highlightText, normalize } from '../../shared/highlight.js';\nimport { cls, tagName, uniqueId } from '../../registry.js';\nimport { adoptRichContentStyles, richOptionLabel } from '../../shared/rich-option.js';\nimport hostStyles from '../../shared/styles/host.styles.js';\nimport visuallyHiddenStyles from '../../shared/styles/visually-hidden.styles.js';\nimport suffixStyles from '../../shared/styles/select-item-suffix.styles.js';\nimport pickerCoreStyles from '../../shared/styles/picker-core.styles.js';\nimport selectItemStyles from '../../shared/styles/select-item.styles.js';\nimport rawStyles from './select.css?inline';\n// Registers the chip element used to render selected values in multiple mode.\nimport '../tag/index.js';\n\nconst styles = unsafeCSS(rawStyles);\n\nexport type SelectSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\n/** A single option read from the `<datalist>`. */\nexport interface SelectItem {\n value: string;\n /** Plain text used for filtering and the trigger display. */\n label: string;\n disabled: boolean;\n /** Authored `selected` attribute — seeds the initial value. */\n selected: boolean;\n /** Rich inner markup (from a non-empty `<option>`), projected into the row. */\n html?: string;\n}\n\n/** Default filter: accent/case-insensitive, every space-separated keyword must match. */\nexport type SelectFilter = (item: SelectItem, query: string) => boolean;\n\nconst defaultFilter: SelectFilter = (item, query) => {\n if (!query) return true;\n const label = normalize(item.label);\n return normalize(query)\n .split(/\\s+/)\n .filter(Boolean)\n .every((kw) => label.includes(kw));\n};\n\n/** Fired when the selection changes. Bubbles; not composed. */\nexport class SelectChangeEvent extends Event {\n /** The selected value (single mode) or values (multiple mode). */\n readonly value: string | string[];\n constructor(value: string | string[]) {\n super('change', { bubbles: true, composed: false, cancelable: false });\n this.value = value;\n }\n}\n\n/** Fired as the user types in the search box. Bubbles; not composed. */\nexport class SelectInputEvent extends Event {\n /** The current query text. */\n readonly value: string;\n constructor(value: string) {\n super('input', { bubbles: true, composed: false, cancelable: false });\n this.value = value;\n }\n}\n\ninterface SelectEventMap {\n change: SelectChangeEvent;\n input: SelectInputEvent;\n}\n\n/**\n * A button-triggered, searchable select. A trigger shows the current selection,\n * opening a popover with a search box and a `role=\"listbox\"` of options authored\n * as a native `<datalist>` of `<option>` — the same authoring surface as\n * `l-combobox` and the native `.l-select`. Form-associated.\n *\n * @summary A searchable select with a button trigger and a popover listbox.\n *\n * @example\n * ```html\n * <l-select label=\"Country\" name=\"country\" placeholder=\"Select a country…\">\n * <datalist>\n * <option value=\"us\">United States</option>\n * <option value=\"fr\" selected>France</option>\n * </datalist>\n * </l-select>\n * ```\n *\n * @event change - Fired when the selection changes. Bubbles. Not cancelable. Properties: `value: string | string[]`.\n * @event input - Fired as the user types in the search box. Bubbles. Not cancelable. Properties: `value: string` (the query).\n * @event show - Fired before the listbox opens. Cancelable.\n * @event hide - Fired before the listbox closes. Cancelable.\n *\n * @csspart base - The host wrapper.\n * @csspart trigger - The button that opens the listbox.\n * @csspart value - The selection display inside the trigger.\n * @csspart chevron - The trigger chevron.\n * @csspart clear - The clear button.\n * @csspart panel - The floating popover panel.\n * @csspart search - The search input.\n * @csspart listbox - The options container.\n * @csspart option - Each option row.\n * @csspart empty - The \"no results\" message.\n *\n * @cssproperty [--height=var(--l-form-control-height)] - Control height. The clear button and the chevron\n * each take a square of this height (borders excluded), so their hit area and spacing follow it.\n * @cssproperty [--l-form-control-icon-size=1em] - Glyph size of the clear button and the chevron (global form-control\n * token; set it here or on any ancestor). Changes the glyph only — the hit area follows `--height`.\n * @cssproperty --chevron-icon - Chevron glyph as a `url()`. Masked, so its color comes from the control, not the image.\n * @cssproperty --clear-icon - Clear button glyph as a `url()`.\n * @cssproperty [--border-radius] - Trigger + panel radius.\n * @cssproperty [--background] - Panel background.\n *\n * @cssClass .l-select-item-media - Rich option: leading image or icon.\n * @cssClass .l-select-item-text - Rich option: column holding the title and the description.\n * @cssClass .l-select-item-title - Rich option: title, truncated with an ellipsis. Used as the label when the option has no `label`.\n * @cssClass .l-select-item-description - Rich option: secondary line, shown in the listbox only.\n * @cssClass .l-select-item-suffix - Rich option: trailing badge, count or status icon on the title's line. Kept out of the trigger, the chips and the search.\n *\n * @customElement l-select\n */\n// oxlint-disable-next-line typescript/no-unsafe-declaration-merging -- typed addEventListener overloads merged below; no uninitialized properties.\nexport class Select extends LuxenFormAssociatedElement {\n // Rich option markup is copied into the shadow root, out of reach of the\n // global stylesheets: suffixStyles lays out the `.l-select-item-suffix` zone,\n // and `_readItems` adopts the styles of the light-DOM elements (l-badge) the\n // options actually contain. selectItemStyles (row + rich content, shared with\n // the native picker) loads before pickerCoreStyles so the shared disabled-row\n // rule wins over the row's `cursor: pointer`.\n static override styles = [\n hostStyles,\n visuallyHiddenStyles,\n suffixStyles,\n selectItemStyles,\n pickerCoreStyles,\n styles,\n ];\n\n private _localize = new LocalizeController(this);\n private readonly _listId = uniqueId('select-list');\n private readonly _richHighlighter = new RichHighlighter();\n\n private _floating = new PopoverController(this, {\n getTriggerElement: () => this._triggerEl,\n getFloatingElement: () => this._panelEl,\n getArrowElement: () => null,\n });\n\n private _nav = new ListboxNavController(this, {\n listboxId: this._listId,\n getCount: () => this._filtered.length,\n isDisabled: (i) => this._filtered[i]?.disabled ?? false,\n isOpen: () => this._open,\n open: () => this.show(),\n getOptionElements: () => this.shadowRoot?.querySelectorAll<HTMLElement>('.option'),\n });\n\n // The `<datalist>` is light DOM the consumer owns and rewrites in place;\n // re-read it so the closed trigger tracks the options it was given.\n private _options = new DatalistObserverController(this, () => this._syncItems());\n\n /** Placeholder shown in the trigger when nothing is selected. */\n @property()\n accessor placeholder = '';\n\n /** Accessible label for the trigger. */\n @property()\n accessor label = '';\n\n /** Control size. */\n @property({ reflect: true })\n accessor size: SelectSize = 'md';\n\n /** Show a filter box inside the popover (opt-in, for long lists). */\n @property({ type: Boolean, reflect: true })\n accessor searchable = false;\n\n /** Show a button to clear the value. */\n @property({ type: Boolean, reflect: true, attribute: 'with-clear' })\n accessor withClear = false;\n\n /** Panel placement relative to the trigger. */\n @property()\n accessor placement: Placement = 'bottom-start';\n\n /** Allow selecting multiple values — renders chips and submits one entry per value. */\n @property({ type: Boolean, reflect: true })\n accessor multiple = false;\n\n /** Override the option filter. `(item, query) => boolean`. */\n filter: SelectFilter = defaultFilter;\n\n @state() private accessor _values: string[] = [];\n @state() private accessor _open = false;\n @state() private accessor _query = '';\n @state() private accessor _items: SelectItem[] = [];\n\n private _defaultValues: string[] = [];\n\n /** The selected value (single mode) or array of values (multiple mode). */\n get value(): string | string[] {\n return this.multiple ? [...this._values] : (this._values[0] ?? '');\n }\n set value(v: string | string[]) {\n this._values = Array.isArray(v) ? [...v] : v ? [v] : [];\n }\n\n private get _triggerEl() {\n return this.shadowRoot?.querySelector<HTMLElement>('.trigger') ?? null;\n }\n private get _panelEl() {\n return this.shadowRoot?.querySelector<HTMLElement>('.panel') ?? null;\n }\n private get _searchEl() {\n return this.shadowRoot?.querySelector<HTMLInputElement>('.search') ?? null;\n }\n\n override get validationTarget() {\n return this._triggerEl ?? undefined;\n }\n\n override connectedCallback() {\n super.connectedCallback();\n this._readItems();\n // Seed the initial selection: an explicit `value` attribute wins, else the\n // authored `<option selected>` (declarative pre-selection — markup-driven).\n if (this._values.length === 0) {\n const attr = this.getAttribute('value');\n if (attr) {\n this._values = [attr];\n } else {\n const selected = this._items.filter((i) => i.selected).map((i) => i.value);\n this._values = this.multiple ? selected : selected.slice(0, 1);\n }\n }\n this._defaultValues = [...this._values];\n this._syncForm();\n }\n\n override updated(changed: Map<string, unknown>) {\n if (changed.has('_values') || changed.has('multiple')) {\n this._syncForm();\n this._updateValidity();\n }\n }\n\n override formResetCallback() {\n this._values = [...this._defaultValues];\n this._query = '';\n this._nav.reset();\n super.formResetCallback();\n this._syncForm();\n }\n\n override formStateRestoreCallback(state: string) {\n this.value = state;\n this._syncForm();\n }\n\n // --- Items (read from the light-DOM <datalist>) ---\n\n private _readItems() {\n const list = this.querySelector('datalist');\n const opts = list ? Array.from(list.options) : [];\n this._items = opts.map((o) => {\n const rich = o.childElementCount > 0;\n const label = richOptionLabel(o);\n return {\n value: o.value,\n label,\n disabled: o.disabled,\n selected: o.hasAttribute('selected'),\n html: rich ? o.innerHTML : undefined,\n };\n });\n adoptRichContentStyles(this.shadowRoot, this._items);\n }\n\n /**\n * Re-read the options after the light DOM changed underneath us. The active\n * option is addressed by position in `_filtered`, so a list that grows or\n * shrinks while the listbox is open would silently move the keyboard\n * selection onto a different row (or off the end, leaving Enter dead).\n * Re-anchor it on the option the user had highlighted, and drop it when that\n * option is gone.\n */\n private _syncItems() {\n const active = this._open ? this._filtered[this._nav.activeIndex] : undefined;\n this._readItems();\n if (!this._open) return;\n this._nav.setActive(active ? this._filtered.findIndex((i) => i.value === active.value) : -1);\n }\n\n private _itemFor(value: string): SelectItem | undefined {\n return this._items.find((i) => i.value === value);\n }\n\n private get _filtered(): SelectItem[] {\n return this._items.filter((i) => this.filter(i, this._query));\n }\n\n // --- Validity ---\n\n /** Push the current selection to the form (single value, or one entry per value). */\n private _syncForm() {\n if (this.multiple) {\n const data = new FormData();\n for (const v of this._values) data.append(this.name, v);\n this._internals.setFormValue(data);\n } else {\n this._internals.setFormValue(this._values[0] ?? '');\n }\n }\n\n private _updateValidity() {\n if (this.required && this._values.length === 0) {\n this.setValidity(\n { valueMissing: true },\n this._localize.term('selectOption'),\n this._triggerEl ?? undefined,\n );\n } else {\n this.setValidity({});\n }\n }\n\n // --- Open / close ---\n\n show() {\n if (this._open || this.disabled) return;\n this._readItems();\n if (!this.dispatchEvent(new Event('show', { cancelable: true }))) return;\n this._open = true;\n this._query = '';\n // Pre-activate the (first) chosen option so a screen reader announces it on open.\n if (this._values.length) {\n this._nav.setActive(this._filtered.findIndex((i) => i.value === this._values[0]));\n }\n void this.updateComplete.then(() => {\n const panel = this._panelEl;\n panel?.showPopover?.();\n this._floating.startPositioning({\n placement: this.placement,\n distance: 4,\n minWidth: 'trigger',\n });\n // Move focus into the search box (or the listbox when not searchable).\n (this._searchEl ?? this._panelEl?.querySelector<HTMLElement>('.listbox'))?.focus();\n document.addEventListener('pointerdown', this._onDocumentPointerDown, true);\n });\n }\n\n hide({ focusTrigger = true } = {}) {\n if (!this._open) return;\n if (!this.dispatchEvent(new Event('hide', { cancelable: true }))) return;\n this._open = false;\n this._query = '';\n this._nav.reset();\n const panel = this._panelEl;\n if (panel?.matches?.(':popover-open')) panel.hidePopover?.();\n this._floating.stopPositioning();\n document.removeEventListener('pointerdown', this._onDocumentPointerDown, true);\n if (focusTrigger) this._triggerEl?.focus();\n }\n\n private _onDocumentPointerDown = (e: PointerEvent) => {\n // popover=\"manual\" does not light-dismiss; do it ourselves.\n const path = e.composedPath();\n if (path.includes(this)) return;\n this.hasInteracted = true;\n this._updateValidity();\n this.hide({ focusTrigger: false });\n };\n\n // --- Selection ---\n\n /** Single: set the value and close. Multiple: toggle the value and stay open. */\n private _select(item: SelectItem) {\n if (item.disabled) return;\n this.hasInteracted = true;\n if (this.multiple) {\n this._values = this._values.includes(item.value)\n ? this._values.filter((v) => v !== item.value)\n : [...this._values, item.value];\n this.dispatchEvent(new SelectChangeEvent(this.value));\n this._searchEl?.focus();\n } else {\n this._values = [item.value];\n this.dispatchEvent(new SelectChangeEvent(this.value));\n this.hide();\n }\n }\n\n /** Deselect a single value (chip remove, multiple mode). */\n private _removeValue(value: string) {\n this._values = this._values.filter((v) => v !== value);\n this.hasInteracted = true;\n this.dispatchEvent(new SelectChangeEvent(this.value));\n }\n\n private _clear(e?: Event) {\n e?.stopPropagation();\n this._values = [];\n this.hasInteracted = true;\n this.dispatchEvent(new SelectChangeEvent(this.value));\n this._triggerEl?.focus();\n }\n\n // --- Keyboard ---\n\n private _onTriggerKeyDown = (e: KeyboardEvent) => {\n if (this._open) return;\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.show();\n }\n };\n\n private _onPanelKeyDown = (e: KeyboardEvent) => {\n if (this._nav.onKeyDown(e)) return;\n switch (e.key) {\n case 'Enter': {\n e.preventDefault();\n const active = this._filtered[this._nav.activeIndex];\n if (active) this._select(active);\n break;\n }\n case 'Escape':\n e.preventDefault();\n this.hide();\n break;\n case 'Tab':\n this.hide({ focusTrigger: false });\n break;\n default:\n break;\n }\n };\n\n private _onSearchInput = (e: Event) => {\n this._query = (e.target as HTMLInputElement).value;\n this._nav.reset();\n this.dispatchEvent(new SelectInputEvent(this._query));\n };\n\n // --- Render ---\n\n private _renderSingleValue() {\n const selected = this._itemFor(this._values[0]);\n if (!selected) {\n return html`<span class=\"value-text placeholder\">${this.placeholder}</span>`;\n }\n return selected.html\n ? html`${unsafeHTML(selected.html)}`\n : html`<span class=\"value-text\">${selected.label}</span>`;\n }\n\n private _renderChips() {\n if (this._values.length === 0) {\n return html`<span class=\"value-text placeholder\">${this.placeholder}</span>`;\n }\n // The chip tag is the renameable `l-tag`; it's a Shadow-DOM element so its\n // remove button renders correctly inside this element's shadow root.\n const chip = unsafeStatic(tagName('tag'));\n return this._values.map((value) => {\n const item = this._itemFor(value);\n return staticHtml`<${chip}\n size=\"sm\"\n removable\n part=\"tag\"\n @remove=${(e: Event) => {\n e.preventDefault();\n this._removeValue(value);\n }}\n @click=${(e: Event) => e.stopPropagation()}\n >${item?.label ?? value}</${chip}\n >`;\n });\n }\n\n private _renderTrigger(invalid: boolean) {\n const inner = html`\n <span\n class=\"value\"\n part=\"value\"\n >${this.multiple ? this._renderChips() : this._renderSingleValue()}</span\n >\n <span\n class=\"chevron\"\n part=\"chevron\"\n aria-hidden=\"true\"\n ></span>\n `;\n const onClick = () => (this._open ? this.hide() : this.show());\n // Both modes expose role=\"combobox\" (APG select-only combobox). A combobox\n // doesn't take its name from its content, so `label` stays the accessible\n // name while the shown value is announced as the value. A plain button would\n // let `aria-label` hide the chosen value from screen readers (WCAG 2.5.3).\n // Multiple mode uses a focusable div so the chips' remove buttons are valid\n // interactive children — a <button> trigger can't nest them.\n return this.multiple\n ? html`<div\n class=\"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=${this._listId}\n aria-label=${this.label || nothing}\n aria-required=${this.required ? 'true' : nothing}\n aria-invalid=${invalid ? 'true' : nothing}\n @click=${onClick}\n @keydown=${this._onTriggerKeyDown}\n >\n ${inner}\n </div>`\n : html`<button\n class=\"trigger\"\n part=\"trigger\"\n type=\"button\"\n role=\"combobox\"\n ?disabled=${this.disabled}\n aria-haspopup=\"listbox\"\n aria-expanded=${this._open ? 'true' : 'false'}\n aria-controls=${this._listId}\n aria-label=${this.label || nothing}\n aria-required=${this.required ? 'true' : nothing}\n aria-invalid=${invalid ? 'true' : nothing}\n @click=${onClick}\n @keydown=${this._onTriggerKeyDown}\n >\n ${inner}\n </button>`;\n }\n\n override render() {\n const filtered = this._filtered;\n const activeId = this._nav.activeDescendant;\n const activeIndex = this._nav.activeIndex;\n const invalid = this.required && this._values.length === 0 && this.hasInteracted;\n const hasValue = this._values.length > 0;\n const status = !this._open\n ? ''\n : filtered.length === 0\n ? this._localize.term('noResults')\n : `${filtered.length} ${this._localize.term('suggestions')}`;\n\n return html`\n <div\n class=\"base\"\n part=\"base\"\n >\n ${this._renderTrigger(invalid)}\n ${\n this.withClear && hasValue\n ? html`<button\n class=\"clear-button\"\n part=\"clear\"\n type=\"button\"\n aria-label=${this._localize.term('clear')}\n @click=${this._clear}\n ></button>`\n : nothing\n }\n\n <div\n class=\"panel\"\n part=\"panel\"\n popover=\"manual\"\n @keydown=${this._onPanelKeyDown}\n >\n ${\n this.searchable\n ? html`<div class=\"search-row\">\n <input\n class=\"search\"\n part=\"search\"\n type=\"text\"\n role=\"searchbox\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n .placeholder=${this._localize.term('search') ?? ''}\n aria-controls=${this._listId}\n aria-activedescendant=${activeId ?? nothing}\n @input=${this._onSearchInput}\n />\n </div>`\n : nothing\n }\n\n <ul\n class=\"listbox\"\n part=\"listbox\"\n role=\"listbox\"\n id=${this._listId}\n tabindex=${this.searchable ? nothing : '0'}\n aria-label=${this.label || this._localize.term('suggestions')}\n aria-multiselectable=${this.multiple ? 'true' : nothing}\n aria-activedescendant=${!this.searchable ? (activeId ?? nothing) : nothing}\n @pointermove=${this._nav.onPointerMove}\n @pointerleave=${this._nav.onPointerLeave}\n >\n ${filtered.map(\n (item, i) =>\n html`<li\n class=\"option\"\n part=\"option\"\n id=${this._nav.optionId(i)}\n role=\"option\"\n aria-selected=${this._values.includes(item.value) ? 'true' : 'false'}\n aria-disabled=${item.disabled ? 'true' : nothing}\n data-active=${i === activeIndex ? '' : nothing}\n data-current=${this._values.includes(item.value) ? '' : nothing}\n @pointerdown=${(e: Event) => e.preventDefault()}\n @click=${() => this._select(item)}\n >\n ${\n item.html\n ? unsafeHTML(this._richHighlighter.highlight(item.html, this._query))\n : html`<span class=\"option-label\"\n >${highlightText(item.label, this._query)}</span\n >`\n }\n </li>`,\n )}\n </ul>\n ${\n filtered.length === 0\n ? html`<div\n class=\"empty\"\n part=\"empty\"\n >\n ${this._localize.term('noResults')}\n </div>`\n : nothing\n }\n </div>\n\n <div\n class=${cls('visually-hidden')}\n aria-live=\"polite\"\n >\n ${status}\n </div>\n </div>\n `;\n }\n}\n\n// Typed addEventListener for the colliding `change` / `input` names.\nexport interface Select {\n addEventListener<K extends keyof SelectEventMap>(\n type: K,\n listener: (this: Select, ev: SelectEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions,\n ): void;\n addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ): void;\n removeEventListener<K extends keyof SelectEventMap>(\n type: K,\n listener: (this: Select, ev: SelectEventMap[K]) => void,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n}\n"],"mappings":"A,qqCCsBA,IAAM2B,EAAS3B,EAAUC,+5DAAS,EAmB5B2B,GAA+B,EAAM,IAAU,CACnD,GAAI,CAACC,EAAO,MAAO,GACnB,IAAMC,EAAQC,EAAUC,EAAK,KAAK,EAClC,OAAOD,EAAUF,CAAK,CAAC,CACpB,MAAM,KAAK,CAAC,CACZ,OAAO,OAAO,CAAC,CACf,MAAO,GAAOC,EAAM,SAASG,CAAE,CAAC,CACrC,EAGaC,EAAb,cAAuC,KAAM,CAG3C,YAAY,EAA0B,CACpC,MAAM,SAAU,CAAE,QAAS,GAAM,SAAU,GAAO,WAAY,EAAM,CAAC,EACrE,KAAK,MAAQC,CACf,CACF,EAGaC,EAAb,cAAsC,KAAM,CAG1C,YAAY,EAAe,CACzB,MAAM,QAAS,CAAE,QAAS,GAAM,SAAU,GAAO,WAAY,EAAM,CAAC,EACpE,KAAK,MAAQD,CACf,CACF,EA2DaE,EAAb,cAA4BC,CAA2B,C,8BAgBjC,KAAA,UAAA,IAAIE,EAAmB,IAAI,EACpB,KAAA,QAAAC,EAAS,aAAa,EACb,KAAA,iBAAA,IAAIC,EAEpB,KAAA,UAAA,IAAIC,EAAkB,KAAM,CAC9C,sBAAyB,KAAK,WAC9B,uBAA0B,KAAK,SAC/B,oBAAuB,IACzB,CAAC,EAEc,KAAA,KAAA,IAAIC,EAAqB,KAAM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,EAAS,CAAA,EAAA0B,EAAA,UAAA,QAAA,IAAA,EAIT3B,EAAA,CAAAC,EAAS,CAAE,QAAS,EAAK,CAAC,CAAA,EAAA0B,EAAA,UAAA,OAAA,IAAA,EAI1B3B,EAAA,CAAAC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,CAAA,EAAA0B,EAAA,UAAA,aAAA,IAAA,EAIzC3B,EAAA,CAAAC,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,YAAa,CAAC,CAAA,EAAA0B,EAAA,UAAA,YAAA,IAAA,EAIlE3B,EAAA,CAAAC,EAAS,CAAA,EAAA0B,EAAA,UAAA,YAAA,IAAA,EAIT3B,EAAA,CAAAC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,CAAA,EAAA0B,EAAA,UAAA,WAAA,IAAA,EAMzC3B,EAAA,CAAAE,EAAM,CAAA,EAAAyB,EAAA,UAAA,UAAA,IAAA,EACN3B,EAAA,CAAAE,EAAM,CAAA,EAAAyB,EAAA,UAAA,QAAA,IAAA,EACN3B,EAAA,CAAAE,EAAM,CAAA,EAAAyB,EAAA,UAAA,SAAA,IAAA,EACN3B,EAAA,CAAAE,EAAM,CAAA,EAAAyB,EAAA,UAAA,SAAA,IAAA,E"}
|
|
1
|
+
{"version":3,"file":"select.js","names":["unsafeCSS","rawStyles","hostStyles","visuallyHiddenStyles","suffixStyles","selectItemStyles","pickerCoreStyles","unsafeHTML","unsafeStatic","nothing","_decorate","property","state","r","s","u","r$1","n","__decorate","b","A","o","host_styles_default","visually_hidden_styles_default","select_item_suffix_styles_default","picker_core_styles_default","select_item_styles_default","styles","defaultFilter","query","label","normalize","item","kw","SelectChangeEvent","value","SelectInputEvent","Select","LuxenFormAssociatedElement","_args","LocalizeController","uniqueId","RichHighlighter","PopoverController","ListboxNavController","i","DatalistObserverController","#_placeholder_accessor_storage","#_label_accessor_storage","#_size_accessor_storage","#_searchable_accessor_storage","#_withClear_accessor_storage","#_placement_accessor_storage","#_multiple_accessor_storage","#__values_accessor_storage","#__open_accessor_storage","#__query_accessor_storage","#__items_accessor_storage","active","v","attr","selected","changed","state","list","opts","rich","richOptionLabel","adoptRichContentStyles","data","panel","focusTrigger","chip","tagName","inner","onClick","invalid","filtered","activeId","activeIndex","hasValue","status","highlightText","cls"],"sources":["../../../src/html/elements/select/select.css?inline","../../../src/html/elements/select/select.ts"],"sourcesContent":["/* Knobs, size scale, field frame, chevron, clear, listbox popover and the\n shared option bits come from shared/styles/picker-core.css; the option row\n and rich-option content from shared/styles/select-item.css (also used by the\n native `.l-select` picker). This file holds what is specific to l-select. */\n\n/*\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n 🆃🆁🅸🅶🅶🅴🆁 (button, opens the listbox popover)\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n*/\n\n.trigger {\n gap: 0.5rem;\n inline-size: 100%;\n min-block-size: var(--height);\n padding-block: 0.25rem;\n color: var(--l-form-control-value-color);\n font: inherit;\n text-align: start;\n cursor: pointer;\n}\n\n/* The form-control inline padding is tuned for text; before a chip row it reads\n as too much, so tighten the start edge in multiple mode (the chips bring their\n own spacing). */\n:host([multiple]) .trigger {\n padding-inline-start: 0.375rem;\n}\n\n/* Selection display fills the trigger; the chevron (and overlaid clear) sit at the end. */\n.value {\n flex: 1;\n min-inline-size: 0;\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 0.25rem;\n overflow: hidden;\n}\n\n.value-text {\n min-inline-size: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* This element's public knobs and the chip's share two names — `--height` and\n `--border-radius` — and custom properties inherit straight through a shadow\n boundary. Left alone, every chip in the trigger renders at the *select's*\n height and corner rather than its own: a 36px chip with a 6px corner, when\n `size=\"sm\"` asked for a 24px pill. `initial` is the guaranteed-invalid value,\n so each `var(--x, …)` inside the chip falls back to its own default. Matched\n on the part, not on the tag name, so a renamed `elementPrefix` can't miss it.\n\n The fill used to collide too, back when the chip read `--background`; it now\n reads `--background-color`, which this element does not expose. */\n[part='tag'] {\n --height: initial;\n --border-radius: initial;\n}\n\n.placeholder {\n color: var(--l-form-control-placeholder-color);\n}\n\n/* The clear button is a SIBLING of the trigger (not a child — no nested buttons),\n * overlaid on the trigger's end, square against the chevron's square — which\n * sits flush against the border (picker-core.css). */\n.clear-button {\n position: absolute;\n inset-block: 0;\n inset-inline-end: calc(var(--l-form-control-border-width) + var(--_action-size));\n margin-block: auto;\n}\n\n/* Keep the value (text or chips) clear of the overlaid button. */\n.base:has(> .clear-button) .chevron {\n margin-inline-start: var(--_action-size);\n}\n\n/* Rich content in the trigger takes the row styles (select-item.css), then\n mirrors the native trigger: only the media and title, at the value's weight —\n the secondary description and the trailing suffix are dropped so the selected\n value stays compact and consistent across options. */\n.value .l-select-item-title {\n font-weight: inherit;\n}\n.value .l-select-item-description,\n.value .l-select-item-suffix {\n display: none;\n}\n\n/*\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n 🅿🅰🅽🅴🅻 (popover: search + listbox)\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n*/\n\n.search-row {\n padding: 0.375rem;\n border-block-end: 1px solid var(--l-color-border-overlay);\n}\n\n.search {\n inline-size: 100%;\n block-size: var(--l-size-control-sm);\n padding-inline: 0.5rem;\n border: var(--l-form-control-border-width) solid var(--l-form-control-border-color);\n border-radius: calc(var(--border-radius) - 2px);\n background-color: var(--l-form-control-background-color);\n color: var(--l-form-control-value-color);\n font: inherit;\n}\n\n.search:focus-visible {\n outline: none;\n border-color: var(--l-focus-ring);\n}\n\n.search::placeholder {\n color: var(--l-form-control-placeholder-color);\n}\n\n/* Keyboard-active row (moves with Arrow keys) — same tint as hover. */\n.option[data-active] {\n background-color: var(--l-color-bg-state-hover);\n}\n\n/* Selected indicator in the reserved inline-start column, pinned to the first\n * line so a wrapping description never shifts it (matches the native\n * `::checkmark` in src/css/elements/select.css). */\n.option[data-current]::after {\n content: '';\n position: absolute;\n inset-inline-start: 0.5rem;\n inset-block-start: var(--_row-padding-block);\n inline-size: 1rem;\n block-size: calc(var(--l-popover-font-size) * var(--l-popover-line-height));\n background-color: currentColor;\n mask: var(--_check-icon) center / 1rem no-repeat;\n}\n\n/* Rich content, rows and trigger alike: the shared layout (select-item.css)\n plus what only this tier needs — media may be an emoji or icon rather than an\n image, so it is centred and sized by font. */\n.l-select-item-media {\n display: inline-flex;\n align-items: center;\n font-size: 1.25em;\n}\n","import { html, nothing, unsafeCSS } from 'lit';\nimport { html as staticHtml, unsafeStatic } from 'lit/static-html.js';\nimport { property, state } from 'lit/decorators.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport type { Placement } from '@floating-ui/dom';\nimport { LuxenFormAssociatedElement } from '../../shared/luxen-form-associated-element.js';\nimport { PopoverController } from '../../shared/controllers/popover.js';\nimport { ListboxNavController } from '../../shared/controllers/listbox-nav.js';\nimport { DatalistObserverController } from '../../shared/controllers/datalist-observer.js';\nimport { LocalizeController } from '../../shared/localize.js';\nimport { RichHighlighter, highlightText, normalize } from '../../shared/highlight.js';\nimport { cls, tagName, uniqueId } from '../../registry.js';\nimport { adoptRichContentStyles, richOptionLabel } from '../../shared/rich-option.js';\nimport hostStyles from '../../shared/styles/host.styles.js';\nimport visuallyHiddenStyles from '../../shared/styles/visually-hidden.styles.js';\nimport suffixStyles from '../../shared/styles/select-item-suffix.styles.js';\nimport pickerCoreStyles from '../../shared/styles/picker-core.styles.js';\nimport selectItemStyles from '../../shared/styles/select-item.styles.js';\nimport rawStyles from './select.css?inline';\n// Registers the chip element used to render selected values in multiple mode.\nimport '../tag/index.js';\n\nconst styles = unsafeCSS(rawStyles);\n\nexport type SelectSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\n/** A single option read from the `<datalist>`. */\nexport interface SelectItem {\n value: string;\n /** Plain text used for filtering and the trigger display. */\n label: string;\n disabled: boolean;\n /** Authored `selected` attribute — seeds the initial value. */\n selected: boolean;\n /** Rich inner markup (from a non-empty `<option>`), projected into the row. */\n html?: string;\n}\n\n/** Default filter: accent/case-insensitive, every space-separated keyword must match. */\nexport type SelectFilter = (item: SelectItem, query: string) => boolean;\n\nconst defaultFilter: SelectFilter = (item, query) => {\n if (!query) return true;\n const label = normalize(item.label);\n return normalize(query)\n .split(/\\s+/)\n .filter(Boolean)\n .every((kw) => label.includes(kw));\n};\n\n/** Fired when the selection changes. Bubbles; not composed. */\nexport class SelectChangeEvent extends Event {\n /** The selected value (single mode) or values (multiple mode). */\n readonly value: string | string[];\n constructor(value: string | string[]) {\n super('change', { bubbles: true, composed: false, cancelable: false });\n this.value = value;\n }\n}\n\n/** Fired as the user types in the search box. Bubbles; not composed. */\nexport class SelectInputEvent extends Event {\n /** The current query text. */\n readonly value: string;\n constructor(value: string) {\n super('input', { bubbles: true, composed: false, cancelable: false });\n this.value = value;\n }\n}\n\ninterface SelectEventMap {\n change: SelectChangeEvent;\n input: SelectInputEvent;\n}\n\n/**\n * A button-triggered, searchable select. A trigger shows the current selection,\n * opening a popover with a search box and a `role=\"listbox\"` of options authored\n * as a native `<datalist>` of `<option>` — the same authoring surface as\n * `l-combobox` and the native `.l-select`. Form-associated.\n *\n * @summary A searchable select with a button trigger and a popover listbox.\n *\n * @example\n * ```html\n * <l-select label=\"Country\" name=\"country\" placeholder=\"Select a country…\">\n * <datalist>\n * <option value=\"us\">United States</option>\n * <option value=\"fr\" selected>France</option>\n * </datalist>\n * </l-select>\n * ```\n *\n * @event change - Fired when the selection changes. Bubbles. Not cancelable. Properties: `value: string | string[]`.\n * @event input - Fired as the user types in the search box. Bubbles. Not cancelable. Properties: `value: string` (the query).\n * @event show - Fired before the listbox opens. Cancelable.\n * @event hide - Fired before the listbox closes. Cancelable.\n *\n * @csspart base - The host wrapper.\n * @csspart trigger - The button that opens the listbox.\n * @csspart value - The selection display inside the trigger.\n * @csspart chevron - The trigger chevron.\n * @csspart clear - The clear button.\n * @csspart panel - The floating popover panel.\n * @csspart search - The search input.\n * @csspart listbox - The options container.\n * @csspart option - Each option row.\n * @csspart empty - The \"no results\" message.\n *\n * @cssproperty [--height=var(--l-form-control-height)] - Control height. The clear button and the chevron\n * each take a square of this height (borders excluded), so their hit area and spacing follow it.\n * @cssproperty [--l-form-control-icon-size=1em] - Glyph size of the clear button and the chevron (global form-control\n * token; set it here or on any ancestor). Changes the glyph only — the hit area follows `--height`.\n * @cssproperty --chevron-icon - Chevron glyph as a `url()`. Masked, so its color comes from the control, not the image.\n * @cssproperty --clear-icon - Clear button glyph as a `url()`.\n * @cssproperty [--border-radius] - Trigger + panel radius.\n * @cssproperty [--background] - Panel background.\n *\n * @cssClass .l-select-item-media - Rich option: leading image or icon.\n * @cssClass .l-select-item-text - Rich option: column holding the title and the description.\n * @cssClass .l-select-item-title - Rich option: title, truncated with an ellipsis. Used as the label when the option has no `label`.\n * @cssClass .l-select-item-description - Rich option: secondary line, shown in the listbox only.\n * @cssClass .l-select-item-suffix - Rich option: trailing badge, count or status icon on the title's line. Kept out of the trigger, the chips and the search.\n *\n * @customElement l-select\n */\n// oxlint-disable-next-line typescript/no-unsafe-declaration-merging -- typed addEventListener overloads merged below; no uninitialized properties.\nexport class Select extends LuxenFormAssociatedElement {\n // Rich option markup is copied into the shadow root, out of reach of the\n // global stylesheets: suffixStyles lays out the `.l-select-item-suffix` zone,\n // and `_readItems` adopts the styles of the light-DOM elements (l-badge) the\n // options actually contain. selectItemStyles (row + rich content, shared with\n // the native picker) loads before pickerCoreStyles so the shared disabled-row\n // rule wins over the row's `cursor: pointer`.\n static override styles = [\n hostStyles,\n visuallyHiddenStyles,\n suffixStyles,\n selectItemStyles,\n pickerCoreStyles,\n styles,\n ];\n\n private _localize = new LocalizeController(this);\n private readonly _listId = uniqueId('select-list');\n private readonly _richHighlighter = new RichHighlighter();\n\n private _floating = new PopoverController(this, {\n getTriggerElement: () => this._triggerEl,\n getFloatingElement: () => this._panelEl,\n getArrowElement: () => null,\n });\n\n private _nav = new ListboxNavController(this, {\n listboxId: this._listId,\n getCount: () => this._filtered.length,\n isDisabled: (i) => this._filtered[i]?.disabled ?? false,\n isOpen: () => this._open,\n open: () => this.show(),\n getOptionElements: () => this.shadowRoot?.querySelectorAll<HTMLElement>('.option'),\n });\n\n // The `<datalist>` is light DOM the consumer owns and rewrites in place;\n // re-read it so the closed trigger tracks the options it was given.\n private _options = new DatalistObserverController(this, () => this._syncItems());\n\n /** Placeholder shown in the trigger when nothing is selected. */\n @property()\n accessor placeholder = '';\n\n /** Accessible label for the trigger. */\n @property()\n accessor label = '';\n\n /** Control size. */\n @property({ reflect: true })\n accessor size: SelectSize = 'md';\n\n /** Show a filter box inside the popover (opt-in, for long lists). */\n @property({ type: Boolean, reflect: true })\n accessor searchable = false;\n\n /** Show a button to clear the value. */\n @property({ type: Boolean, reflect: true, attribute: 'with-clear' })\n accessor withClear = false;\n\n /** Panel placement relative to the trigger. */\n @property()\n accessor placement: Placement = 'bottom-start';\n\n /** Allow selecting multiple values — renders chips and submits one entry per value. */\n @property({ type: Boolean, reflect: true })\n accessor multiple = false;\n\n /** Override the option filter. `(item, query) => boolean`. */\n filter: SelectFilter = defaultFilter;\n\n @state() private accessor _values: string[] = [];\n @state() private accessor _open = false;\n @state() private accessor _query = '';\n @state() private accessor _items: SelectItem[] = [];\n\n private _defaultValues: string[] = [];\n\n /** The selected value (single mode) or array of values (multiple mode). */\n get value(): string | string[] {\n return this.multiple ? [...this._values] : (this._values[0] ?? '');\n }\n set value(v: string | string[]) {\n this._values = Array.isArray(v) ? [...v] : v ? [v] : [];\n }\n\n private get _triggerEl() {\n return this.shadowRoot?.querySelector<HTMLElement>('.trigger') ?? null;\n }\n private get _panelEl() {\n return this.shadowRoot?.querySelector<HTMLElement>('.panel') ?? null;\n }\n private get _searchEl() {\n return this.shadowRoot?.querySelector<HTMLInputElement>('.search') ?? null;\n }\n\n override get validationTarget() {\n return this._triggerEl ?? undefined;\n }\n\n override connectedCallback() {\n super.connectedCallback();\n this._readItems();\n // Seed the initial selection: an explicit `value` attribute wins, else the\n // authored `<option selected>` (declarative pre-selection — markup-driven).\n if (this._values.length === 0) {\n const attr = this.getAttribute('value');\n if (attr) {\n this._values = [attr];\n } else {\n const selected = this._items.filter((i) => i.selected).map((i) => i.value);\n this._values = this.multiple ? selected : selected.slice(0, 1);\n }\n }\n this._defaultValues = [...this._values];\n this._syncForm();\n }\n\n override updated(changed: Map<string, unknown>) {\n if (changed.has('_values') || changed.has('multiple')) {\n this._syncForm();\n this._updateValidity();\n }\n }\n\n override formResetCallback() {\n this._values = [...this._defaultValues];\n this._query = '';\n this._nav.reset();\n super.formResetCallback();\n this._syncForm();\n }\n\n override formStateRestoreCallback(state: string) {\n this.value = state;\n this._syncForm();\n }\n\n // --- Items (read from the light-DOM <datalist>) ---\n\n private _readItems() {\n const list = this.querySelector('datalist');\n const opts = list ? Array.from(list.options) : [];\n this._items = opts.map((o) => {\n const rich = o.childElementCount > 0;\n const label = richOptionLabel(o);\n return {\n value: o.value,\n label,\n disabled: o.disabled,\n selected: o.hasAttribute('selected'),\n html: rich ? o.innerHTML : undefined,\n };\n });\n adoptRichContentStyles(this.shadowRoot, this._items);\n }\n\n /**\n * Re-read the options after the light DOM changed underneath us. The active\n * option is addressed by position in `_filtered`, so a list that grows or\n * shrinks while the listbox is open would silently move the keyboard\n * selection onto a different row (or off the end, leaving Enter dead).\n * Re-anchor it on the option the user had highlighted, and drop it when that\n * option is gone.\n */\n private _syncItems() {\n const active = this._open ? this._filtered[this._nav.activeIndex] : undefined;\n this._readItems();\n if (!this._open) return;\n this._nav.setActive(active ? this._filtered.findIndex((i) => i.value === active.value) : -1);\n }\n\n private _itemFor(value: string): SelectItem | undefined {\n return this._items.find((i) => i.value === value);\n }\n\n private get _filtered(): SelectItem[] {\n return this._items.filter((i) => this.filter(i, this._query));\n }\n\n // --- Validity ---\n\n /** Push the current selection to the form (single value, or one entry per value). */\n private _syncForm() {\n if (this.multiple) {\n const data = new FormData();\n for (const v of this._values) data.append(this.name, v);\n this._internals.setFormValue(data);\n } else {\n this._internals.setFormValue(this._values[0] ?? '');\n }\n }\n\n private _updateValidity() {\n if (this.required && this._values.length === 0) {\n this.setValidity(\n { valueMissing: true },\n this._localize.term('selectOption'),\n this._triggerEl ?? undefined,\n );\n } else {\n this.setValidity({});\n }\n }\n\n // --- Open / close ---\n\n show() {\n if (this._open || this.disabled) return;\n this._readItems();\n if (!this.dispatchEvent(new Event('show', { cancelable: true }))) return;\n this._open = true;\n this._query = '';\n // Pre-activate the (first) chosen option so a screen reader announces it on open.\n if (this._values.length) {\n this._nav.setActive(this._filtered.findIndex((i) => i.value === this._values[0]));\n }\n void this.updateComplete.then(() => {\n const panel = this._panelEl;\n panel?.showPopover?.();\n this._floating.startPositioning({\n placement: this.placement,\n distance: 4,\n minWidth: 'trigger',\n });\n // Move focus into the search box (or the listbox when not searchable).\n (this._searchEl ?? this._panelEl?.querySelector<HTMLElement>('.listbox'))?.focus();\n document.addEventListener('pointerdown', this._onDocumentPointerDown, true);\n });\n }\n\n hide({ focusTrigger = true } = {}) {\n if (!this._open) return;\n if (!this.dispatchEvent(new Event('hide', { cancelable: true }))) return;\n this._open = false;\n this._query = '';\n this._nav.reset();\n const panel = this._panelEl;\n if (panel?.matches?.(':popover-open')) panel.hidePopover?.();\n this._floating.stopPositioning();\n document.removeEventListener('pointerdown', this._onDocumentPointerDown, true);\n if (focusTrigger) this._triggerEl?.focus();\n }\n\n private _onDocumentPointerDown = (e: PointerEvent) => {\n // popover=\"manual\" does not light-dismiss; do it ourselves.\n const path = e.composedPath();\n if (path.includes(this)) return;\n this.hasInteracted = true;\n this._updateValidity();\n this.hide({ focusTrigger: false });\n };\n\n // --- Selection ---\n\n /** Single: set the value and close. Multiple: toggle the value and stay open. */\n private _select(item: SelectItem) {\n if (item.disabled) return;\n this.hasInteracted = true;\n if (this.multiple) {\n this._values = this._values.includes(item.value)\n ? this._values.filter((v) => v !== item.value)\n : [...this._values, item.value];\n this.dispatchEvent(new SelectChangeEvent(this.value));\n this._searchEl?.focus();\n } else {\n this._values = [item.value];\n this.dispatchEvent(new SelectChangeEvent(this.value));\n this.hide();\n }\n }\n\n /** Deselect a single value (chip remove, multiple mode). */\n private _removeValue(value: string) {\n this._values = this._values.filter((v) => v !== value);\n this.hasInteracted = true;\n this.dispatchEvent(new SelectChangeEvent(this.value));\n }\n\n private _clear(e?: Event) {\n e?.stopPropagation();\n this._values = [];\n this.hasInteracted = true;\n this.dispatchEvent(new SelectChangeEvent(this.value));\n this._triggerEl?.focus();\n }\n\n // --- Keyboard ---\n\n private _onTriggerKeyDown = (e: KeyboardEvent) => {\n if (this._open) return;\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.show();\n }\n };\n\n private _onPanelKeyDown = (e: KeyboardEvent) => {\n if (this._nav.onKeyDown(e)) return;\n switch (e.key) {\n case 'Enter': {\n e.preventDefault();\n const active = this._filtered[this._nav.activeIndex];\n if (active) this._select(active);\n break;\n }\n case 'Escape':\n e.preventDefault();\n this.hide();\n break;\n case 'Tab':\n this.hide({ focusTrigger: false });\n break;\n default:\n break;\n }\n };\n\n private _onSearchInput = (e: Event) => {\n this._query = (e.target as HTMLInputElement).value;\n this._nav.reset();\n this.dispatchEvent(new SelectInputEvent(this._query));\n };\n\n // --- Render ---\n\n private _renderSingleValue() {\n const selected = this._itemFor(this._values[0]);\n if (!selected) {\n return html`<span class=\"value-text placeholder\">${this.placeholder}</span>`;\n }\n return selected.html\n ? html`${unsafeHTML(selected.html)}`\n : html`<span class=\"value-text\">${selected.label}</span>`;\n }\n\n private _renderChips() {\n if (this._values.length === 0) {\n return html`<span class=\"value-text placeholder\">${this.placeholder}</span>`;\n }\n // The chip tag is the renameable `l-tag`; it's a Shadow-DOM element so its\n // remove button renders correctly inside this element's shadow root.\n const chip = unsafeStatic(tagName('tag'));\n return this._values.map((value) => {\n const item = this._itemFor(value);\n return staticHtml`<${chip}\n size=\"sm\"\n removable\n part=\"tag\"\n @remove=${(e: Event) => {\n e.preventDefault();\n this._removeValue(value);\n }}\n @click=${(e: Event) => e.stopPropagation()}\n >${item?.label ?? value}</${chip}\n >`;\n });\n }\n\n private _renderTrigger(invalid: boolean) {\n const inner = html`\n <span\n class=\"value\"\n part=\"value\"\n >${this.multiple ? this._renderChips() : this._renderSingleValue()}</span\n >\n <span\n class=\"chevron\"\n part=\"chevron\"\n aria-hidden=\"true\"\n ></span>\n `;\n const onClick = () => (this._open ? this.hide() : this.show());\n // Both modes expose role=\"combobox\" (APG select-only combobox). A combobox\n // doesn't take its name from its content, so `label` stays the accessible\n // name while the shown value is announced as the value. A plain button would\n // let `aria-label` hide the chosen value from screen readers (WCAG 2.5.3).\n // Multiple mode uses a focusable div so the chips' remove buttons are valid\n // interactive children — a <button> trigger can't nest them.\n return this.multiple\n ? html`<div\n class=\"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=${this._listId}\n aria-label=${this.label || nothing}\n aria-required=${this.required ? 'true' : nothing}\n aria-invalid=${invalid ? 'true' : nothing}\n @click=${onClick}\n @keydown=${this._onTriggerKeyDown}\n >\n ${inner}\n </div>`\n : html`<button\n class=\"trigger\"\n part=\"trigger\"\n type=\"button\"\n role=\"combobox\"\n ?disabled=${this.disabled}\n aria-haspopup=\"listbox\"\n aria-expanded=${this._open ? 'true' : 'false'}\n aria-controls=${this._listId}\n aria-label=${this.label || nothing}\n aria-required=${this.required ? 'true' : nothing}\n aria-invalid=${invalid ? 'true' : nothing}\n @click=${onClick}\n @keydown=${this._onTriggerKeyDown}\n >\n ${inner}\n </button>`;\n }\n\n override render() {\n const filtered = this._filtered;\n const activeId = this._nav.activeDescendant;\n const activeIndex = this._nav.activeIndex;\n const invalid = this.required && this._values.length === 0 && this.hasInteracted;\n const hasValue = this._values.length > 0;\n const status = !this._open\n ? ''\n : filtered.length === 0\n ? this._localize.term('noResults')\n : `${filtered.length} ${this._localize.term('suggestions')}`;\n\n return html`\n <div\n class=\"base\"\n part=\"base\"\n >\n ${this._renderTrigger(invalid)}\n ${\n this.withClear && hasValue\n ? html`<button\n class=\"clear-button\"\n part=\"clear\"\n type=\"button\"\n aria-label=${this._localize.term('clear')}\n @click=${this._clear}\n ></button>`\n : nothing\n }\n\n <div\n class=\"panel\"\n part=\"panel\"\n popover=\"manual\"\n @keydown=${this._onPanelKeyDown}\n >\n ${\n this.searchable\n ? html`<div class=\"search-row\">\n <input\n class=\"search\"\n part=\"search\"\n type=\"text\"\n role=\"searchbox\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n .placeholder=${this._localize.term('search') ?? ''}\n aria-controls=${this._listId}\n aria-activedescendant=${activeId ?? nothing}\n @input=${this._onSearchInput}\n />\n </div>`\n : nothing\n }\n\n <ul\n class=\"listbox\"\n part=\"listbox\"\n role=\"listbox\"\n id=${this._listId}\n tabindex=${this.searchable ? nothing : '0'}\n aria-label=${this.label || this._localize.term('suggestions')}\n aria-multiselectable=${this.multiple ? 'true' : nothing}\n aria-activedescendant=${!this.searchable ? (activeId ?? nothing) : nothing}\n @pointermove=${this._nav.onPointerMove}\n @pointerleave=${this._nav.onPointerLeave}\n >\n ${filtered.map(\n (item, i) =>\n html`<li\n class=\"option\"\n part=\"option\"\n id=${this._nav.optionId(i)}\n role=\"option\"\n aria-selected=${this._values.includes(item.value) ? 'true' : 'false'}\n aria-disabled=${item.disabled ? 'true' : nothing}\n data-active=${i === activeIndex ? '' : nothing}\n data-current=${this._values.includes(item.value) ? '' : nothing}\n @pointerdown=${(e: Event) => e.preventDefault()}\n @click=${() => this._select(item)}\n >\n ${\n item.html\n ? unsafeHTML(this._richHighlighter.highlight(item.html, this._query))\n : html`<span class=\"option-label\"\n >${highlightText(item.label, this._query)}</span\n >`\n }\n </li>`,\n )}\n </ul>\n ${\n filtered.length === 0\n ? html`<div\n class=\"empty\"\n part=\"empty\"\n >\n ${this._localize.term('noResults')}\n </div>`\n : nothing\n }\n </div>\n\n <div\n class=${cls('visually-hidden')}\n aria-live=\"polite\"\n >\n ${status}\n </div>\n </div>\n `;\n }\n}\n\n// Typed addEventListener for the colliding `change` / `input` names.\nexport interface Select {\n addEventListener<K extends keyof SelectEventMap>(\n type: K,\n listener: (this: Select, ev: SelectEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions,\n ): void;\n addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ): void;\n removeEventListener<K extends keyof SelectEventMap>(\n type: K,\n listener: (this: Select, ev: SelectEventMap[K]) => void,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n}\n"],"mappings":"A,qqCCsBA,IAAM2B,EAAS3B,EAAUC,23DAAS,EAmB5B2B,GAA+B,EAAM,IAAU,CACnD,GAAI,CAACC,EAAO,MAAO,GACnB,IAAMC,EAA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IAAA,EAMzC3B,EAAA,CAAAE,EAAM,CAAA,EAAAyB,EAAA,UAAA,UAAA,IAAA,EACN3B,EAAA,CAAAE,EAAM,CAAA,EAAAyB,EAAA,UAAA,QAAA,IAAA,EACN3B,EAAA,CAAAE,EAAM,CAAA,EAAAyB,EAAA,UAAA,SAAA,IAAA,EACN3B,EAAA,CAAAE,EAAM,CAAA,EAAAyB,EAAA,UAAA,SAAA,IAAA,E"}
|
package/cdn/elements/tag/tag.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"../../chunks/lit.js";import{r as t,t as n}from"../../chunks/decorate.js";import{LuxenElement as r}from"../../shared/luxen-element.js";import{a as i,t as a}from"../../chunks/lit-html.js";import{LocalizeController as o}from"../../shared/localize.js";import{cls as s}from"../../registry.js";import c from"../../shared/styles/host.styles.js";import l from"../../shared/styles/checkbox-appearance.styles.js";var u=e(`@layer components{:host{--_height:var(--height,1.5rem);--_font-size:var(--font-size,var(--l-text-xs));--_padding-inline:var(--padding-inline,.5rem);--_gap:.25rem;--_background:var(--background-color,var(--l-color-bg-fill-neutral-subtle));--_color:var(--text-color,var(--l-color-text-neutral));--_border-strength:14%;--_border-color:var(--border-color,color-mix(in oklab, currentColor var(--_border-strength), transparent));--_border-color-hover:var(--border-color,color-mix(in oklab, currentColor calc(var(--_border-strength) + 12%), transparent));--_border-radius:var(--border-radius,var(--l-radius-full));--_remove-glyph:.75rem;vertical-align:middle;max-inline-size:100%;display:inline-flex}:host([size=sm]){--_padding-inline:var(--padding-inline,.375rem);--_gap:.125rem}:host([size=lg]){--_height:var(--height,1.75rem);--_font-size:var(--font-size,var(--l-text-sm));--_padding-inline:var(--padding-inline,.625rem);--_remove-glyph:.875rem}:host([disabled]) .base{cursor:not-allowed}.base{align-items:center;gap:var(--_gap);min-block-size:var(--_height);padding-inline:var(--_padding-inline);border:1px solid var(--_border-color);border-radius:var(--_border-radius);background-color:var(--_background);color:var(--_color);font-family:var(--l-font-neo-grotesque);font-size:var(--_font-size);font-weight:var(--l-font-weight-medium);min-inline-size:0;line-height:1;transition:background-color .12s,border-color .12s;display:inline-flex}:host([removable]) .base{min-block-size:max(1.5rem, var(--_height))}@media (hover:hover){:host([selectable]:hover:not([disabled])) .base{background-color:color-mix(in oklab, var(--_background), currentColor 7%);border-color:var(--_border-color-hover)}}.content{text-overflow:ellipsis;white-space:nowrap;align-items:center;min-inline-size:0;display:inline-flex;overflow:clip visible}::slotted([slot=prefix]){flex:none;display:inline-flex}::slotted([slot=suffix]){font-weight:var(--l-font-weight-normal);font-variant-numeric:tabular-nums;flex:none}:host([selectable]){--_height:var(--height,1.75rem);--_accent:var(--l-form-control-activated-color);--_selected-color:var(--selected-text-color,var(--lightningcss-light,color-mix(in oklab, var(--_accent), black 14%))var(--lightningcss-dark,color-mix(in oklab, var(--_accent), white 45%)));--_selected-background:var(--selected-background-color,color-mix(in oklab, var(--_selected-color) 10%, var(--l-color-surface)));--_selected-border-color:var(--selected-border-color,color-mix(in oklab, var(--_selected-color) 45%, transparent))}:host([selectable][size=lg]){--_height:var(--height,2rem)}:host([selectable][selected]){--_background:var(--_selected-background);--_color:var(--_selected-color);--_border-color:var(--_selected-border-color);--_border-color-hover:var(--selected-border-color,color-mix(in oklab, var(--_selected-color) 57%, transparent))}:host([selectable]) .base{cursor:pointer;-webkit-user-select:none;user-select:none}:host([selectable][disabled]) .base{cursor:not-allowed}.toggle{align-self:stretch;align-items:center;gap:var(--_gap);min-inline-size:0;margin-inline:calc(var(--_padding-inline) * -1);padding-inline:var(--_padding-inline);color:inherit;font:inherit;text-align:start;cursor:inherit;background:0 0;border:0;flex:auto;display:inline-flex}:host([removable]) .toggle{margin-inline-end:0;padding-inline-end:0}:host([selectable]) .toggle:focus-visible,:host([selectable]) .checkbox:focus-visible{outline:none}.base:has(:is(.toggle,.checkbox):focus-visible){outline:
|
|
1
|
+
import{i as e}from"../../chunks/lit.js";import{r as t,t as n}from"../../chunks/decorate.js";import{LuxenElement as r}from"../../shared/luxen-element.js";import{a as i,t as a}from"../../chunks/lit-html.js";import{LocalizeController as o}from"../../shared/localize.js";import{cls as s}from"../../registry.js";import c from"../../shared/styles/host.styles.js";import l from"../../shared/styles/checkbox-appearance.styles.js";var u=e(`@layer components{:host{--_height:var(--height,1.5rem);--_font-size:var(--font-size,var(--l-text-xs));--_padding-inline:var(--padding-inline,.5rem);--_gap:.25rem;--_background:var(--background-color,var(--l-color-bg-fill-neutral-subtle));--_color:var(--text-color,var(--l-color-text-neutral));--_border-strength:14%;--_border-color:var(--border-color,color-mix(in oklab, currentColor var(--_border-strength), transparent));--_border-color-hover:var(--border-color,color-mix(in oklab, currentColor calc(var(--_border-strength) + 12%), transparent));--_border-radius:var(--border-radius,var(--l-radius-full));--_remove-glyph:.75rem;vertical-align:middle;max-inline-size:100%;display:inline-flex}:host([size=sm]){--_padding-inline:var(--padding-inline,.375rem);--_gap:.125rem}:host([size=lg]){--_height:var(--height,1.75rem);--_font-size:var(--font-size,var(--l-text-sm));--_padding-inline:var(--padding-inline,.625rem);--_remove-glyph:.875rem}:host([disabled]) .base{cursor:not-allowed}.base{align-items:center;gap:var(--_gap);min-block-size:var(--_height);padding-inline:var(--_padding-inline);border:1px solid var(--_border-color);border-radius:var(--_border-radius);background-color:var(--_background);color:var(--_color);font-family:var(--l-font-neo-grotesque);font-size:var(--_font-size);font-weight:var(--l-font-weight-medium);min-inline-size:0;line-height:1;transition:background-color .12s,border-color .12s;display:inline-flex}:host([removable]) .base{min-block-size:max(1.5rem, var(--_height))}@media (hover:hover){:host([selectable]:hover:not([disabled])) .base{background-color:color-mix(in oklab, var(--_background), currentColor 7%);border-color:var(--_border-color-hover)}}.content{text-overflow:ellipsis;white-space:nowrap;align-items:center;min-inline-size:0;display:inline-flex;overflow:clip visible}::slotted([slot=prefix]){flex:none;display:inline-flex}::slotted([slot=suffix]){font-weight:var(--l-font-weight-normal);font-variant-numeric:tabular-nums;flex:none}:host([selectable]){--_height:var(--height,1.75rem);--_accent:var(--l-form-control-activated-color);--_selected-color:var(--selected-text-color,var(--lightningcss-light,color-mix(in oklab, var(--_accent), black 14%))var(--lightningcss-dark,color-mix(in oklab, var(--_accent), white 45%)));--_selected-background:var(--selected-background-color,color-mix(in oklab, var(--_selected-color) 10%, var(--l-color-surface)));--_selected-border-color:var(--selected-border-color,color-mix(in oklab, var(--_selected-color) 45%, transparent))}:host([selectable][size=lg]){--_height:var(--height,2rem)}:host([selectable][selected]){--_background:var(--_selected-background);--_color:var(--_selected-color);--_border-color:var(--_selected-border-color);--_border-color-hover:var(--selected-border-color,color-mix(in oklab, var(--_selected-color) 57%, transparent))}:host([selectable]) .base{cursor:pointer;-webkit-user-select:none;user-select:none}:host([selectable][disabled]) .base{cursor:not-allowed}.toggle{align-self:stretch;align-items:center;gap:var(--_gap);min-inline-size:0;margin-inline:calc(var(--_padding-inline) * -1);padding-inline:var(--_padding-inline);color:inherit;font:inherit;text-align:start;cursor:inherit;background:0 0;border:0;flex:auto;display:inline-flex}:host([removable]) .toggle{margin-inline-end:0;padding-inline-end:0}:host([selectable]) .toggle:focus-visible,:host([selectable]) .checkbox:focus-visible{outline:none}.base:has(:is(.toggle,.checkbox):focus-visible){outline:var(--l-focus-ring-width) solid var(--l-focus-ring);outline-offset:2px}.checkbox{--accent:var(--selected-text-color,var(--l-form-control-activated-color));--_halo:var(--l-form-control-border-color-hover);font:inherit;flex:none;transition-property:background-color,border-color,box-shadow}.checkbox:checked,.checkbox:indeterminate{--_halo:var(--accent)}@media (hover:hover){:host([selectable]:not([disabled])) .base:hover .checkbox:not(:disabled){box-shadow:0 0 0 calc(var(--size) * var(--l-form-control-toggle-halo-ratio)) color-mix(in oklab, var(--_halo), transparent 84%)}}@media (forced-colors:active){:host([selectable][selected]) .base{border-color:highlight}}.remove{inline-size:max(1.5rem, var(--_height));margin-block:-1px;margin-inline:calc(var(--_padding-inline) - var(--_gap)) calc(var(--_padding-inline) * -1 - 1px);border:1px solid #0000;border-inline-start-color:var(--_border-color);color:inherit;cursor:pointer;--_press-scale:.86;background-color:#0000;background-clip:padding-box;border-start-end-radius:var(--_border-radius);border-end-end-radius:var(--_border-radius);flex:none;align-self:stretch;place-items:center;padding:0;transition:background-color .12s;display:grid}.remove:after{content:"";inline-size:var(--_remove-glyph);block-size:var(--_remove-glyph);background-color:currentColor;transition:scale .12s;-webkit-mask:url("data:image/svg+xml;utf8,<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path d=\\"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z\\" /></svg>") 50%/contain no-repeat;mask:url("data:image/svg+xml;utf8,<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path d=\\"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z\\" /></svg>") 50%/contain no-repeat}@media (hover:hover){.remove:hover:not(:disabled){background-color:color-mix(in oklab, transparent, currentColor 12%)}}.remove:active:not(:disabled){background-color:color-mix(in oklab, transparent, currentColor 22%)}.remove:active:not(:disabled):after{scale:var(--_press-scale)}.remove:focus-visible{outline:var(--l-focus-ring-width) solid var(--l-focus-ring);outline-offset:calc(var(--l-focus-ring-width) * -1)}.remove:disabled{cursor:not-allowed;opacity:.4}@media (forced-colors:active){.remove:after{background-color:buttontext}}@media (prefers-reduced-motion:reduce){.base,.checkbox,.remove,.remove:after{transition-duration:0s}.remove{--_press-scale:1}}}`),d=class extends Event{constructor(){super(`remove`,{bubbles:!1,composed:!1,cancelable:!0})}},f=class extends Event{constructor(e){super(`change`,{bubbles:!0,composed:!1,cancelable:!1}),this.selected=e}},p=class extends r{static{this.styles=[c,l,u]}#e;get size(){return this.#e}set size(e){this.#e=e}#t;get removable(){return this.#t}set removable(e){this.#t=e}#n;get selectable(){return this.#n}set selectable(e){this.#n=e}#r;get selected(){return this.#r}set selected(e){this.#r=e}#i;get control(){return this.#i}set control(e){this.#i=e}#a;get disabled(){return this.#a}set disabled(e){this.#a=e}constructor(){super(),this._localize=new o(this),this.#e=`md`,this.#t=!1,this.#n=!1,this.#r=!1,this.#i=`none`,this.#a=!1,this._requestRemove=()=>{if(this.disabled)return;let e=new d;this.dispatchEvent(e),e.defaultPrevented||this.remove()},this._onKeyDown=e=>{this.removable&&!this.disabled&&(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),this._requestRemove())},this._toggle=()=>{this.disabled||(this.selected=!this.selected,this.dispatchEvent(new f(this.selected)))},this._onHostClick=e=>{this.selectable&&!this.disabled&&e.composedPath()[0]===this&&this._toggle()},this._onCheckboxChange=e=>{this.selected=e.target.checked,this.dispatchEvent(new f(this.selected))},this.addEventListener(`click`,this._onHostClick)}willUpdate(){this.control===`checkbox`&&(this.selectable=!0)}updated(){let e=this.renderRoot.querySelector(`.checkbox`);e&&(e.checked=this.selected)}_label(){return i`
|
|
2
2
|
<slot name="prefix"></slot>
|
|
3
3
|
<span
|
|
4
4
|
class="content"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.js","names":["unsafeCSS","rawStyles","hostStyles","checkboxAppearance","nothing","_decorate","property","r","n","__decorate","b","A","host_styles_default","checkbox_appearance_styles_default","styles","TagRemoveEvent","TagChangeEvent","selected","Tag","LuxenElement","#_size_accessor_storage","value","#_removable_accessor_storage","#_selectable_accessor_storage","#_selected_accessor_storage","#_control_accessor_storage","#_disabled_accessor_storage","LocalizeController","event","box","cls"],"sources":["../../../src/html/elements/tag/tag.css?inline","../../../src/html/elements/tag/tag.ts"],"sourcesContent":["@layer components {\n :host {\n /* Size defaults (md). A removable tag is always ≥24px tall (target-size).\n The three public knobs are folded into the private vars here rather than\n at each use site, so an override also carries to what derives from them —\n the toggle's negative inline margins and the × button's spacing math. The\n trio mirrors `.l-button` (`--height` / `--padding-inline` / `--font-size`)\n so a chip can be tuned to a dense filter panel without ::part(base). */\n --_height: var(--height, 1.5rem);\n --_font-size: var(--font-size, var(--l-text-xs));\n --_padding-inline: var(--padding-inline, 0.5rem);\n --_gap: 0.25rem;\n\n /* Skin, resolved once so `[selected]` can swap all three at the source\n instead of re-declaring the properties that consume them. */\n --_background: var(--background-color, var(--l-color-bg-fill-neutral-subtle));\n --_color: var(--text-color, var(--l-color-text-neutral));\n --_border-strength: 14%;\n /* By default the line is a tint of the ink, so a chip stays coherent under\n any `--text-color` with one declaration. `--border-color` replaces that\n derivation outright rather than shifting it: a consumer with a token\n system wants *its* line token, not a 14% mix of its text color — and\n wants it to hold in every state, which is why it is the fallback in both\n of the pair below rather than a value the hover rule mixes further.\n `--_border-strength` stays private. Selecting a chip swaps the pair\n wholesale, the same way it swaps the fill and the ink. */\n --_border-color: var(\n --border-color,\n color-mix(in oklab, currentColor var(--_border-strength), transparent)\n );\n --_border-color-hover: var(\n --border-color,\n color-mix(in oklab, currentColor calc(var(--_border-strength) + 12%), transparent)\n );\n /* Resolved here rather than at `.base`, because the × segment has to round\n its outer end to the same curve. */\n --_border-radius: var(--border-radius, var(--l-radius-full));\n --_remove-glyph: 0.75rem;\n\n display: inline-flex;\n vertical-align: middle;\n max-inline-size: 100%;\n }\n\n :host([size='sm']) {\n --_padding-inline: var(--padding-inline, 0.375rem);\n --_gap: 0.125rem;\n }\n\n :host([size='lg']) {\n --_height: var(--height, 1.75rem);\n --_font-size: var(--font-size, var(--l-text-sm));\n --_padding-inline: var(--padding-inline, 0.625rem);\n --_remove-glyph: 0.875rem;\n }\n\n /* Disabled is conveyed by the greyed × button + cursor, NOT by washing out\n * the label — dimming the whole chip with opacity composites the text below\n * the WCAG AA contrast floor (axe flags it; a disabled <button> is exempt but\n * the label span is not). */\n :host([disabled]) .base {\n cursor: not-allowed;\n }\n\n /*\n ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n 🅲🅷🅸🅿\n ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n */\n\n .base {\n display: inline-flex;\n align-items: center;\n gap: var(--_gap);\n min-block-size: var(--_height);\n padding-inline: var(--_padding-inline);\n border: 1px solid var(--_border-color);\n border-radius: var(--_border-radius);\n background-color: var(--_background);\n color: var(--_color);\n font-family: var(--l-font-neo-grotesque);\n font-size: var(--_font-size);\n font-weight: var(--l-font-weight-medium);\n line-height: 1;\n min-inline-size: 0;\n transition:\n background-color 120ms ease,\n border-color 120ms ease;\n }\n\n /* The remove segment is exactly as tall as the chip, so the chip is where the\n target floor has to live: `--height` still tunes a removable chip, but not\n under the 24px minimum (WCAG 2.5.8). Without this the promise held only for\n the default value. */\n :host([removable]) .base {\n min-block-size: max(1.5rem, var(--_height));\n }\n\n /* Whole-chip hover — only on a chip that is *wholly* a control. A display chip\n has no target at all, and a removable one has exactly its × segment: tinting\n the label under the pointer there promises a click that does nothing, and on\n a filter bar it fights the segment for the eye. `[selectable]` also covers\n `control=\"checkbox\"`, which derives the attribute. */\n @media (hover: hover) {\n :host([selectable]:hover:not([disabled])) .base {\n background-color: color-mix(in oklab, var(--_background), currentColor 7%);\n border-color: var(--_border-color-hover);\n }\n }\n\n .content {\n display: inline-flex;\n align-items: center;\n min-inline-size: 0;\n /* `.base` sets `line-height: 1` so the chip's height comes from its own size\n tokens rather than the document's leading. That makes the line box exactly\n one em tall, and a plain `overflow: hidden` then shears every descender\n (g, j, p, q, y) at all three sizes — measured 1px short.\n\n Fixed by clipping the inline axis only — the one the ellipsis needs — so\n nothing is ever cut vertically and the box keeps its exact geometry.\n Growing the line box instead (`line-height: normal`) moves the text half a\n pixel against the × and the prefix icon, since the font's ascent and\n descent are not symmetrical; widening the clip with\n `overflow-clip-margin` leaves Safari shearing the text (WebKit has no\n such property). `clip` — unlike `hidden` — lets the block axis stay\n `visible`. */\n overflow-x: clip;\n overflow-y: visible;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n ::slotted([slot='prefix']) {\n display: inline-flex;\n flex: none;\n }\n\n /* A count or trailing glyph. It sits in its own slot so `.base`'s gap gives it\n a gutter by construction — the label is a bare text node and can never be\n targeted from the outside. Lighter weight than the medium label, and\n tabular so a column of counts stays aligned. */\n ::slotted([slot='suffix']) {\n flex: none;\n font-weight: var(--l-font-weight-normal);\n font-variant-numeric: tabular-nums;\n }\n\n /*\n ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n 🆂🅴🅻🅴🅲🆃🅰🅱🅻🅴 (filter chip — toggle button, or a checkbox riding inside)\n ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n */\n\n :host([selectable]) {\n /* Taller than a display chip at the same `size`: a chip you click is a\n target (WCAG 2.5.8), and this is the dense step between `sm` and `lg` —\n more room, same 12px label, where `lg` would jump the label to body size.\n `--height` / `--font-size` tune it from there. */\n --_height: var(--height, 1.75rem);\n\n /* The selection accent is the same one the library's checkbox, radio and\n switch use, so a chip with a checkbox inside reads as a single control. */\n --_accent: var(--l-form-control-activated-color);\n /* The label is 12px, so it owes 4.5:1 over its own tint — and the raw accent\n misses it on the light one (4.35:1 measured). Darken it there, lighten it\n on the dark tint, and both modes clear 6:1. `color-mix()` resolves\n reliably inside `light-dark()` — `oklch(from …)` does not. */\n --_selected-color: var(\n --selected-text-color,\n light-dark(\n color-mix(in oklab, var(--_accent), black 14%),\n color-mix(in oklab, var(--_accent), white 45%)\n )\n );\n /* Derived from the text color, so overriding `--selected-text-color` alone\n repaints the whole chip coherently. Kept at 10%: a consumer accent skips\n the mode correction above, so the tint has to stay pale enough for a\n semantic token (`--l-color-text-success` and friends) to clear 4.5:1 on\n it unaided. The border carries the rest of the emphasis. */\n --_selected-background: var(\n --selected-background-color,\n color-mix(in oklab, var(--_selected-color) 10%, var(--l-color-surface))\n );\n /* The third member of the trio, beside `--selected-text-color` and\n `--selected-background-color`. Selection already replaces the fill and the ink\n outright, so the line has to be replaceable the same way — without this,\n a chip that sets `--border-color` keeps that exact line when picked and\n the emphasis step that says \"selected\" never happens. 45% by default, the\n strength the derived line has always used here. */\n --_selected-border-color: var(\n --selected-border-color,\n color-mix(in oklab, var(--_selected-color) 45%, transparent)\n );\n }\n\n :host([selectable][size='lg']) {\n --_height: var(--height, 2rem);\n }\n\n :host([selectable][selected]) {\n --_background: var(--_selected-background);\n --_color: var(--_selected-color);\n --_border-color: var(--_selected-border-color);\n /* Same +12 step the resting line takes on hover, and pinned in the same way\n when the consumer supplies the value. */\n --_border-color-hover: var(\n --selected-border-color,\n color-mix(in oklab, var(--_selected-color) 57%, transparent)\n );\n }\n\n :host([selectable]) .base {\n cursor: pointer;\n /* A chip is tapped, not read: never leave a text selection behind a\n double-click on a filter. */\n user-select: none;\n }\n\n :host([selectable][disabled]) .base {\n cursor: not-allowed;\n }\n\n /* The chip *is* the button. Negative inline margins let it cover `.base`'s\n padding so the whole pill is the target, while `.base` keeps owning the\n border, background, and the × button's spacing math. */\n .toggle {\n flex: 1 1 auto;\n display: inline-flex;\n align-items: center;\n align-self: stretch;\n gap: var(--_gap);\n min-inline-size: 0;\n margin-inline: calc(var(--_padding-inline) * -1);\n padding-inline: var(--_padding-inline);\n border: 0;\n background: none;\n color: inherit;\n font: inherit;\n text-align: start;\n cursor: inherit;\n }\n\n /* Stop before the × instead of running under it. */\n :host([removable]) .toggle {\n margin-inline-end: 0;\n padding-inline-end: 0;\n }\n\n /* One ring for the whole chip: the inner control is a detail of how the chip\n is operated, not a second thing to focus visually — and the ring drawn\n below fully encloses the box, so the indicator only grows (WCAG 2.4.7 /\n 2.4.13).\n\n Qualified by `:host(…)` on purpose. The shared appearance nests\n `&:focus-visible` under a selector list, so it lands as\n `:is(.l-checkbox, … input[type='checkbox']:not(…)):focus-visible` — 0,3,1,\n which outranks a bare `.checkbox:focus-visible` (0,2,0) and paints a second\n ring around the box. `:host([selectable])` brings this to 0,4,0. */\n :host([selectable]) .toggle:focus-visible,\n :host([selectable]) .checkbox:focus-visible {\n outline: none;\n }\n\n .base:has(:is(.toggle, .checkbox):focus-visible) {\n outline: 2px solid var(--l-focus-ring);\n outline-offset: 2px;\n }\n\n /* The skin comes from the shared `.l-checkbox` appearance, applied through\n `cls('checkbox')` rather than a static class literal: `dist` ships that CSS\n as a real file, so a consumer's PostCSS rewrites its selector under a\n renamed `cssPrefix` — a baked `l-checkbox` in the template would stop\n matching it. This rule only carries what is specific to a chip.\n\n The shared appearance sizes the box in `em`, and a UA gives `<input>` its\n own font — inheriting the chip's makes the box track the `size` step. The\n accent follows the selected color, so a themed chip keeps its checkbox in\n the same hue. */\n .checkbox {\n --accent: var(--selected-text-color, var(--l-form-control-activated-color));\n /* Hover halo — same ratio and same token flip as the light-DOM\n `.l-checkbox`, which keeps this rule out of the shared partial (see\n `css/elements/checkbox.css`). Repeated here rather than moved into the\n partial: `l-tree-item` shares that file and never opted into a glow. */\n --_halo: var(--l-form-control-border-color-hover);\n\n flex: none;\n font: inherit;\n transition-property: background-color, border-color, box-shadow;\n }\n\n .checkbox:checked,\n .checkbox:indeterminate {\n --_halo: var(--accent);\n }\n\n /* Driven by the chip, not by the box: the chip is the label and the whole\n click target, so a halo lighting up only over 15px of a 28px pill would\n read as a glitch. */\n @media (hover: hover) {\n :host([selectable]:not([disabled])) .base:hover .checkbox:not(:disabled) {\n box-shadow: 0 0 0 calc(var(--size) * var(--l-form-control-toggle-halo-ratio))\n color-mix(in oklab, var(--_halo), transparent 84%);\n }\n }\n\n /* Forced colors drop the tint (backgrounds are forced to Canvas), so pin the\n border to the system highlight — otherwise selection becomes invisible. */\n @media (forced-colors: active) {\n :host([selectable][selected]) .base {\n border-color: Highlight;\n }\n }\n\n /*\n ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n 🆁🅴🅼🅾🆅🅴 (≥24px target-size, mdi:close mask — mirrors l-close)\n ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n */\n\n .remove {\n flex: none;\n display: grid;\n place-items: center;\n /* Full height, and split off by a rule: the affordance is drawn *at rest*\n rather than conjured on hover. Keyboard and touch users never get a hover\n state, and a filter bar of chips whose delete zone only appears under the\n pointer is a row of faint marks until you go hunting. */\n align-self: stretch;\n /* Square, and never under the 24px hit target (WCAG 2.5.8) however a\n consumer tunes `--height`. */\n inline-size: max(1.5rem, var(--_height));\n /* The segment spans `.base`'s *border* box, not its content box: the −1px\n block margins cancel the border on each side (a stretched flex item is\n sized by the line minus its own margins), which both lands the target on\n a full 24px — 22px otherwise, one short — and runs the rule edge to edge\n so it meets the chip's own border instead of stopping just inside it. */\n margin-block: -1px;\n /* End: flush to the chip's inner edge. Start: pushed off the label so it\n gets the same air on both sides. `.base`'s `gap` spaces *slotted items*\n (icon ↔ label) and is deliberately tighter than the chip's padding, so\n letting it also front the rule left the label with 8px on its left and\n 4px on its right — visibly crammed against the divider. This tops the gap\n back up to a full `--_padding-inline`, at every size. */\n margin-inline: calc(var(--_padding-inline) - var(--_gap))\n calc(var(--_padding-inline) * -1 - 1px);\n padding: 0;\n /* Transparent on three sides, so `background-clip` below keeps the hover\n fill off the 1px the chip's own border occupies. */\n border: 1px solid transparent;\n border-inline-start-color: var(--_border-color);\n /* The chip's own curve — the padding box rounds to one pixel less on its\n own, so the fill stops on the arc rather than squaring off the pill. */\n border-start-end-radius: var(--_border-radius);\n border-end-end-radius: var(--_border-radius);\n background-color: transparent;\n background-clip: padding-box;\n color: inherit;\n cursor: pointer;\n transition: background-color 120ms ease;\n /* The press dip goes through a variable so the reduced-motion block can\n cancel it by re-declaring *this* one line. Pairing the two `:active`\n selectors instead is a trap: the override only wins on source order while\n the specificities tie, and adding the `:not(:disabled)` guard below was\n enough to silently break it. */\n --_press-scale: 0.86;\n\n &::after {\n content: '';\n inline-size: var(--_remove-glyph);\n block-size: var(--_remove-glyph);\n background-color: currentColor;\n transition: scale 120ms ease;\n /* https://pictogrammers.com/library/mdi/icon/close */\n mask: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z\" /></svg>')\n center / contain no-repeat;\n }\n\n /* The whole segment fills. The chip already tints under the pointer (7%),\n so this has to read as the stronger of the two — it is what will actually\n be clicked. */\n @media (hover: hover) {\n &:hover:not(:disabled) {\n background-color: color-mix(in oklab, transparent, currentColor 12%);\n }\n }\n\n &:active:not(:disabled) {\n background-color: color-mix(in oklab, transparent, currentColor 22%);\n }\n\n /* The glyph dips, not the segment: scaling the box would shrink the rule\n and pull it away from the chip's border. */\n &:active:not(:disabled)::after {\n scale: var(--_press-scale);\n }\n\n /* Inset, unlike the library's usual +2px: the segment is flush with the\n chip's border on three sides, so an outset ring would sit half outside\n the chip and clip against its neighbour in a wrapped filter bar. */\n &:focus-visible {\n outline: 2px solid var(--l-focus-ring);\n outline-offset: -2px;\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.4;\n }\n\n /* `background-color` is forced to Canvas in high contrast, which would erase\n a masked glyph entirely — repaint it in the system button color. */\n @media (forced-colors: active) {\n &::after {\n background-color: ButtonText;\n }\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .base,\n .checkbox,\n .remove,\n .remove::after {\n transition-duration: 0ms;\n }\n .remove {\n --_press-scale: 1;\n }\n }\n}\n","import { html, nothing, unsafeCSS } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { LuxenElement } from '../../shared/luxen-element.js';\nimport { LocalizeController } from '../../shared/localize.js';\nimport { cls } from '../../registry.js';\nimport hostStyles from '../../shared/styles/host.styles.js';\nimport checkboxAppearance from '../../shared/styles/checkbox-appearance.styles.js';\nimport rawStyles from './tag.css?inline';\n\nconst styles = unsafeCSS(rawStyles);\n\nexport type TagSize = 'sm' | 'md' | 'lg';\nexport type TagControl = 'none' | 'checkbox';\n\n/**\n * Fired when the user asks to remove the tag — clicking the × button, or\n * pressing Backspace/Delete while it is focused. Cancelable: call\n * `preventDefault()` to keep the tag (the controlling host then manages the\n * list itself); otherwise the tag removes itself from the DOM. Does not bubble.\n */\nexport class TagRemoveEvent extends Event {\n constructor() {\n super('remove', { bubbles: false, composed: false, cancelable: true });\n }\n}\n\n/** Fired when a `selectable` tag is toggled. Bubbles; not composed. */\nexport class TagChangeEvent extends Event {\n readonly selected: boolean;\n constructor(selected: boolean) {\n super('change', { bubbles: true, composed: false, cancelable: false });\n this.selected = selected;\n }\n}\n\ninterface TagEventMap {\n change: TagChangeEvent;\n}\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n remove: TagRemoveEvent;\n }\n}\n\n/**\n * A compact chip for tokens, filters, and multi-select values. Shadow DOM so its\n * styles are self-contained and it renders correctly **anywhere**, including\n * inside another element's shadow root (e.g. the `<l-select>` multi-select\n * trigger).\n *\n * Add `selectable` to turn the chip into a filter control: the tag itself\n * becomes a toggle button (`aria-pressed`), and re-activating a selected tag\n * deselects it — the affordance a radio group cannot offer, so a facet always\n * has a way back to \"all\". Add `control=\"checkbox\"` for a multi-select axis and\n * the library's own checkbox rides inside, with the chip as its label.\n *\n * @summary A compact, optionally removable or selectable chip.\n *\n * @example\n * ```html\n * <l-tag removable>Design</l-tag>\n * <l-tag selectable selected>A3</l-tag>\n * <l-tag selectable control=\"checkbox\">Color <span slot=\"suffix\">79</span></l-tag>\n * ```\n *\n * @event remove - Fired when the user removes the tag (× click or Backspace/Delete). Cancelable; if not prevented the tag removes itself. Not composed, does not bubble.\n * @event change - Fired when a `selectable` tag is toggled. Not cancelable — like the platform's own `change`, and like `l-segmented-control`. Bubbles. Properties: `selected: boolean`. The chip is uncontrolled: it applies the new state before dispatching, so a host that vetoes a toggle (a \"max 3 filters\" rule, an async guard) sets `selected` back in the listener — the revert lands in the same render and is never painted.\n *\n * @slot - The tag label.\n * @slot prefix - Leading content, e.g. an `<l-icon>` or `<l-avatar>`.\n * @slot suffix - Trailing content, e.g. a result count. Gets the chip's own gutter, so no margin is needed.\n *\n * @csspart base - The chip container.\n * @csspart content - The label wrapper.\n * @csspart toggle - The toggle button rendered by `selectable` (not with `control=\"checkbox\"`).\n * @csspart checkbox - The native checkbox rendered by `control=\"checkbox\"`.\n * @csspart remove - The remove button — a full-height segment at the end of the chip.\n *\n * @cssproperty [--text-color] - Label color.\n * @cssproperty [--background-color] - Chip fill.\n * @cssproperty [--border-color] - Chip border, and the rule that splits off the remove button. Defaults to a tint of `--text-color`; setting it pins the line in every state, so a token-based theme keeps its own value on hover.\n * @cssproperty [--selected-text-color] - Label, border, and checkbox accent when selected. Defaults to the library's form-control accent, lightened in dark mode.\n * @cssproperty [--selected-background-color] - Chip fill when selected. Defaults to a tint of `--selected-text-color`.\n * @cssproperty [--selected-border-color] - Chip border when selected. Defaults to a 45% tint of `--selected-text-color`. Selection replaces the line the same way it replaces the fill and the ink, so a chip themed with `--border-color` still gets its emphasis step; set this to theme that step too.\n * @cssproperty [--height] - Chip height. Defaults to the `size` step (a selectable chip is taller, to keep a comfortable target).\n * @cssproperty [--font-size] - Label size. Defaults to the `size` step — 12px, or 14px at `size=\"lg\"`. Set it with `--height` to land between the two steps in a dense filter panel.\n * @cssproperty [--padding-inline] - Horizontal padding. Defaults to the `size` step.\n * @cssproperty [--border-radius] - Corner radius. Defaults to a full pill.\n *\n * @customElement l-tag\n */\n// oxlint-disable-next-line typescript/no-unsafe-declaration-merging -- typed addEventListener overloads merged below; no uninitialized properties.\nexport class Tag extends LuxenElement {\n static override styles = [hostStyles, checkboxAppearance, styles];\n\n private _localize = new LocalizeController(this);\n\n /** Tag size: `sm`, `md` (default), or `lg`. */\n @property({ reflect: true })\n accessor size: TagSize = 'md';\n\n /** Show a remove button (and enable Backspace/Delete removal). */\n @property({ type: Boolean, reflect: true })\n accessor removable = false;\n\n /** Make the tag a filter control the user can toggle on and off. */\n @property({ type: Boolean, reflect: true })\n accessor selectable = false;\n\n /** Whether the tag is selected. Reflected, so `[selected]` is styleable. */\n @property({ type: Boolean, reflect: true })\n accessor selected = false;\n\n /**\n * What drives the selection: `none` (default) makes the chip itself a toggle\n * button; `checkbox` renders a checkbox inside and makes the chip its label —\n * the right choice for a multi-select facet. Implies `selectable`.\n */\n @property({ reflect: true })\n accessor control: TagControl = 'none';\n\n /** Disable the tag — dims it and blocks selection and removal. */\n @property({ type: Boolean, reflect: true })\n accessor disabled = false;\n\n constructor() {\n super();\n // The chip is operated from inside the shadow root, which a click\n // dispatched on the host never reaches — see `_onHostClick`.\n this.addEventListener('click', this._onHostClick);\n }\n\n override willUpdate() {\n // A checkbox is only ever rendered on a selectable chip, so the attribute\n // (which every selectable style rule keys off) is derived rather than\n // duplicated in every selector — and in the consumer's markup.\n if (this.control === 'checkbox') this.selectable = true;\n }\n\n override updated() {\n // Re-assert the box, don't rely on the `.checked` binding. Lit dirty-checks\n // a property part against the value it last wrote, and a click has the user\n // agent flip `checked` behind its back — so when a controlling host vetoes\n // the toggle by setting `selected` back to what it already was, Lit sees no\n // change, skips the write, and leaves a checked box on an unselected chip\n // (announced \"checked\" too). Cheap: the query is null on every other path.\n const box = this.renderRoot.querySelector<HTMLInputElement>('.checkbox');\n if (box) box.checked = this.selected;\n }\n\n private _requestRemove = () => {\n if (this.disabled) return;\n const event = new TagRemoveEvent();\n this.dispatchEvent(event);\n if (!event.defaultPrevented) this.remove();\n };\n\n private _onKeyDown = (e: KeyboardEvent) => {\n if (!this.removable || this.disabled) return;\n if (e.key === 'Backspace' || e.key === 'Delete') {\n e.preventDefault();\n this._requestRemove();\n }\n };\n\n private _toggle = () => {\n if (this.disabled) return;\n // Toggling, not setting: re-activating a selected tag releases it.\n this.selected = !this.selected;\n this.dispatchEvent(new TagChangeEvent(this.selected));\n };\n\n /**\n * Events do not propagate *down* into a shadow tree, so a click dispatched on\n * the host — `tag.click()`, a test runner resolving the chip by its test id,\n * a runner computing the chip's centre (`elementFromPoint()` retargets shadow\n * content back to the host) — never reaches the toggle button or the\n * checkbox, and silently does nothing. Delegate it.\n *\n * Only when the host *is* the target: a real gesture originates at the inner\n * button, at the checkbox, or at slotted content, and is already handled\n * where it lands — so this never double-toggles. `removable` stays out of it;\n * removing is the × button's own gesture.\n */\n private _onHostClick = (e: Event) => {\n if (!this.selectable || this.disabled) return;\n if (e.composedPath()[0] !== this) return;\n // Right for `control=\"checkbox\"` too: `_toggle()` flips `selected` and\n // fires `change`, and `updated()` re-asserts `box.checked` from it.\n this._toggle();\n };\n\n private _onCheckboxChange = (e: Event) => {\n this.selected = (e.target as HTMLInputElement).checked;\n this.dispatchEvent(new TagChangeEvent(this.selected));\n };\n\n private _label() {\n return html`\n <slot name=\"prefix\"></slot>\n <span\n class=\"content\"\n part=\"content\"\n >\n <slot></slot>\n </span>\n <slot name=\"suffix\"></slot>\n `;\n }\n\n private _removeButton() {\n return this.removable\n ? html`<button\n class=\"remove\"\n part=\"remove\"\n type=\"button\"\n ?disabled=${this.disabled}\n aria-label=${this._localize.term('remove')}\n @click=${this._requestRemove}\n ></button>`\n : nothing;\n }\n\n override render() {\n if (this.control === 'checkbox') {\n return html`\n <label\n class=\"base\"\n part=\"base\"\n @keydown=${this._onKeyDown}\n >\n <input\n class=\"checkbox ${cls('checkbox')}\"\n part=\"checkbox\"\n type=\"checkbox\"\n .checked=${this.selected}\n ?disabled=${this.disabled}\n @change=${this._onCheckboxChange}\n />\n ${this._label()}${this._removeButton()}\n </label>\n `;\n }\n\n if (this.selectable) {\n return html`\n <span\n class=\"base\"\n part=\"base\"\n @keydown=${this._onKeyDown}\n >\n <button\n class=\"toggle\"\n part=\"toggle\"\n type=\"button\"\n aria-pressed=${this.selected ? 'true' : 'false'}\n ?disabled=${this.disabled}\n @click=${this._toggle}\n >\n ${this._label()}\n </button>\n ${this._removeButton()}\n </span>\n `;\n }\n\n return html`\n <span\n class=\"base\"\n part=\"base\"\n @keydown=${this._onKeyDown}\n >\n ${this._label()}${this._removeButton()}\n </span>\n `;\n }\n}\n\n// Type `addEventListener('change', …)` so listeners receive a `TagChangeEvent`\n// (with `.selected`) instead of a bare `Event`. `change` collides with lib.dom's\n// `GlobalEventHandlersEventMap`, so it can't be augmented globally — the\n// overloads are declaration-merged onto this element's interface instead. The\n// interface MUST come after the class (the CEM analyzer dedups on the first\n// declaration of the name). See `tabs.ts` for the fully-annotated reference.\nexport interface Tag {\n addEventListener<K extends keyof TagEventMap>(\n type: K,\n listener: (this: Tag, ev: TagEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions,\n ): void;\n addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ): void;\n removeEventListener<K extends keyof TagEventMap>(\n type: K,\n listener: (this: Tag, ev: TagEventMap[K]) => void,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n}\n"],"mappings":"A,saCSA,IAAMc,EAASd,EAAUC,6xLAAS,EAWrBc,EAAb,cAAoC,KAAM,CACxC,aAAc,CACZ,MAAM,SAAU,CAAE,QAAS,GAAO,SAAU,GAAO,WAAY,EAAK,CAAC,CACvE,CACF,EAGaC,EAAb,cAAoC,KAAM,CAExC,YAAY,EAAmB,CAC7B,MAAM,SAAU,CAAE,QAAS,GAAM,SAAU,GAAO,WAAY,EAAM,CAAC,EACrE,KAAK,SAAWC,CAClB,CACF,EA4DaC,EAAb,cAAyBC,CAAa,C,OACX,KAAA,OAAA,CAACjB,EAAYC,EAAoBW,CAAM,C,IAMvD,IAAA,MAAA,C,wCAIA,IAAA,WAAA,C,6CAIA,IAAA,YAAA,C,8CAIA,IAAA,UAAA,C,4CAQA,IAAA,SAAA,C,2CAIA,IAAA,UAAA,C,yCAET,aAAc,CACZ,MAAM,EA/BY,KAAA,UAAA,IAAIa,EAAmB,IAAI,EAItB,KAAAP,GAAA,KAIJ,KAAAE,GAAA,GAIC,KAAAC,GAAA,GAIF,KAAAC,GAAA,GAQW,KAAAC,GAAA,OAIX,KAAAC,GAAA,GA2BW,KAAA,mBAAA,CAC7B,GAAI,KAAK,SAAU,OACnB,IAAME,EAAQ,IAAIb,EAClB,KAAK,cAAca,CAAK,EACnBA,EAAM,kBAAkB,KAAK,OAAO,CAC3C,EAEsB,KAAA,WAAA,GAAqB,CACpC,KAAK,WAAa,MAAK,WACxB,EAAE,MAAQ,aAAe,EAAE,MAAQ,YACrC,EAAE,eAAe,EACjB,KAAK,eAAe,EAExB,EAEwB,KAAA,YAAA,CAClB,KAAK,WAET,KAAK,SAAW,CAAC,KAAK,SACtB,KAAK,cAAc,IAAIZ,EAAe,KAAK,QAAQ,CAAC,EACtD,EAcwB,KAAA,aAAA,GAAa,CAC9B,KAAK,YAAc,M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AA,IAAA,EAIzCb,EAAA,CAAAC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,CAAA,EAAAY,EAAA,UAAA,aAAA,IAAA,EAIzCb,EAAA,CAAAC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,CAAA,EAAAY,EAAA,UAAA,WAAA,IAAA,EAQzCb,EAAA,CAAAC,EAAS,CAAE,QAAS,EAAK,CAAC,CAAA,EAAAY,EAAA,UAAA,UAAA,IAAA,EAI1Bb,EAAA,CAAAC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,CAAA,EAAAY,EAAA,UAAA,WAAA,IAAA,E"}
|
|
1
|
+
{"version":3,"file":"tag.js","names":["unsafeCSS","rawStyles","hostStyles","checkboxAppearance","nothing","_decorate","property","r","n","__decorate","b","A","host_styles_default","checkbox_appearance_styles_default","styles","TagRemoveEvent","TagChangeEvent","selected","Tag","LuxenElement","#_size_accessor_storage","value","#_removable_accessor_storage","#_selectable_accessor_storage","#_selected_accessor_storage","#_control_accessor_storage","#_disabled_accessor_storage","LocalizeController","event","box","cls"],"sources":["../../../src/html/elements/tag/tag.css?inline","../../../src/html/elements/tag/tag.ts"],"sourcesContent":["@layer components {\n :host {\n /* Size defaults (md). A removable tag is always ≥24px tall (target-size).\n The three public knobs are folded into the private vars here rather than\n at each use site, so an override also carries to what derives from them —\n the toggle's negative inline margins and the × button's spacing math. The\n trio mirrors `.l-button` (`--height` / `--padding-inline` / `--font-size`)\n so a chip can be tuned to a dense filter panel without ::part(base). */\n --_height: var(--height, 1.5rem);\n --_font-size: var(--font-size, var(--l-text-xs));\n --_padding-inline: var(--padding-inline, 0.5rem);\n --_gap: 0.25rem;\n\n /* Skin, resolved once so `[selected]` can swap all three at the source\n instead of re-declaring the properties that consume them. */\n --_background: var(--background-color, var(--l-color-bg-fill-neutral-subtle));\n --_color: var(--text-color, var(--l-color-text-neutral));\n --_border-strength: 14%;\n /* By default the line is a tint of the ink, so a chip stays coherent under\n any `--text-color` with one declaration. `--border-color` replaces that\n derivation outright rather than shifting it: a consumer with a token\n system wants *its* line token, not a 14% mix of its text color — and\n wants it to hold in every state, which is why it is the fallback in both\n of the pair below rather than a value the hover rule mixes further.\n `--_border-strength` stays private. Selecting a chip swaps the pair\n wholesale, the same way it swaps the fill and the ink. */\n --_border-color: var(\n --border-color,\n color-mix(in oklab, currentColor var(--_border-strength), transparent)\n );\n --_border-color-hover: var(\n --border-color,\n color-mix(in oklab, currentColor calc(var(--_border-strength) + 12%), transparent)\n );\n /* Resolved here rather than at `.base`, because the × segment has to round\n its outer end to the same curve. */\n --_border-radius: var(--border-radius, var(--l-radius-full));\n --_remove-glyph: 0.75rem;\n\n display: inline-flex;\n vertical-align: middle;\n max-inline-size: 100%;\n }\n\n :host([size='sm']) {\n --_padding-inline: var(--padding-inline, 0.375rem);\n --_gap: 0.125rem;\n }\n\n :host([size='lg']) {\n --_height: var(--height, 1.75rem);\n --_font-size: var(--font-size, var(--l-text-sm));\n --_padding-inline: var(--padding-inline, 0.625rem);\n --_remove-glyph: 0.875rem;\n }\n\n /* Disabled is conveyed by the greyed × button + cursor, NOT by washing out\n * the label — dimming the whole chip with opacity composites the text below\n * the WCAG AA contrast floor (axe flags it; a disabled <button> is exempt but\n * the label span is not). */\n :host([disabled]) .base {\n cursor: not-allowed;\n }\n\n /*\n ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n 🅲🅷🅸🅿\n ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n */\n\n .base {\n display: inline-flex;\n align-items: center;\n gap: var(--_gap);\n min-block-size: var(--_height);\n padding-inline: var(--_padding-inline);\n border: 1px solid var(--_border-color);\n border-radius: var(--_border-radius);\n background-color: var(--_background);\n color: var(--_color);\n font-family: var(--l-font-neo-grotesque);\n font-size: var(--_font-size);\n font-weight: var(--l-font-weight-medium);\n line-height: 1;\n min-inline-size: 0;\n transition:\n background-color 120ms ease,\n border-color 120ms ease;\n }\n\n /* The remove segment is exactly as tall as the chip, so the chip is where the\n target floor has to live: `--height` still tunes a removable chip, but not\n under the 24px minimum (WCAG 2.5.8). Without this the promise held only for\n the default value. */\n :host([removable]) .base {\n min-block-size: max(1.5rem, var(--_height));\n }\n\n /* Whole-chip hover — only on a chip that is *wholly* a control. A display chip\n has no target at all, and a removable one has exactly its × segment: tinting\n the label under the pointer there promises a click that does nothing, and on\n a filter bar it fights the segment for the eye. `[selectable]` also covers\n `control=\"checkbox\"`, which derives the attribute. */\n @media (hover: hover) {\n :host([selectable]:hover:not([disabled])) .base {\n background-color: color-mix(in oklab, var(--_background), currentColor 7%);\n border-color: var(--_border-color-hover);\n }\n }\n\n .content {\n display: inline-flex;\n align-items: center;\n min-inline-size: 0;\n /* `.base` sets `line-height: 1` so the chip's height comes from its own size\n tokens rather than the document's leading. That makes the line box exactly\n one em tall, and a plain `overflow: hidden` then shears every descender\n (g, j, p, q, y) at all three sizes — measured 1px short.\n\n Fixed by clipping the inline axis only — the one the ellipsis needs — so\n nothing is ever cut vertically and the box keeps its exact geometry.\n Growing the line box instead (`line-height: normal`) moves the text half a\n pixel against the × and the prefix icon, since the font's ascent and\n descent are not symmetrical; widening the clip with\n `overflow-clip-margin` leaves Safari shearing the text (WebKit has no\n such property). `clip` — unlike `hidden` — lets the block axis stay\n `visible`. */\n overflow-x: clip;\n overflow-y: visible;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n ::slotted([slot='prefix']) {\n display: inline-flex;\n flex: none;\n }\n\n /* A count or trailing glyph. It sits in its own slot so `.base`'s gap gives it\n a gutter by construction — the label is a bare text node and can never be\n targeted from the outside. Lighter weight than the medium label, and\n tabular so a column of counts stays aligned. */\n ::slotted([slot='suffix']) {\n flex: none;\n font-weight: var(--l-font-weight-normal);\n font-variant-numeric: tabular-nums;\n }\n\n /*\n ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n 🆂🅴🅻🅴🅲🆃🅰🅱🅻🅴 (filter chip — toggle button, or a checkbox riding inside)\n ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n */\n\n :host([selectable]) {\n /* Taller than a display chip at the same `size`: a chip you click is a\n target (WCAG 2.5.8), and this is the dense step between `sm` and `lg` —\n more room, same 12px label, where `lg` would jump the label to body size.\n `--height` / `--font-size` tune it from there. */\n --_height: var(--height, 1.75rem);\n\n /* The selection accent is the same one the library's checkbox, radio and\n switch use, so a chip with a checkbox inside reads as a single control. */\n --_accent: var(--l-form-control-activated-color);\n /* The label is 12px, so it owes 4.5:1 over its own tint — and the raw accent\n misses it on the light one (4.35:1 measured). Darken it there, lighten it\n on the dark tint, and both modes clear 6:1. `color-mix()` resolves\n reliably inside `light-dark()` — `oklch(from …)` does not. */\n --_selected-color: var(\n --selected-text-color,\n light-dark(\n color-mix(in oklab, var(--_accent), black 14%),\n color-mix(in oklab, var(--_accent), white 45%)\n )\n );\n /* Derived from the text color, so overriding `--selected-text-color` alone\n repaints the whole chip coherently. Kept at 10%: a consumer accent skips\n the mode correction above, so the tint has to stay pale enough for a\n semantic token (`--l-color-text-success` and friends) to clear 4.5:1 on\n it unaided. The border carries the rest of the emphasis. */\n --_selected-background: var(\n --selected-background-color,\n color-mix(in oklab, var(--_selected-color) 10%, var(--l-color-surface))\n );\n /* The third member of the trio, beside `--selected-text-color` and\n `--selected-background-color`. Selection already replaces the fill and the ink\n outright, so the line has to be replaceable the same way — without this,\n a chip that sets `--border-color` keeps that exact line when picked and\n the emphasis step that says \"selected\" never happens. 45% by default, the\n strength the derived line has always used here. */\n --_selected-border-color: var(\n --selected-border-color,\n color-mix(in oklab, var(--_selected-color) 45%, transparent)\n );\n }\n\n :host([selectable][size='lg']) {\n --_height: var(--height, 2rem);\n }\n\n :host([selectable][selected]) {\n --_background: var(--_selected-background);\n --_color: var(--_selected-color);\n --_border-color: var(--_selected-border-color);\n /* Same +12 step the resting line takes on hover, and pinned in the same way\n when the consumer supplies the value. */\n --_border-color-hover: var(\n --selected-border-color,\n color-mix(in oklab, var(--_selected-color) 57%, transparent)\n );\n }\n\n :host([selectable]) .base {\n cursor: pointer;\n /* A chip is tapped, not read: never leave a text selection behind a\n double-click on a filter. */\n user-select: none;\n }\n\n :host([selectable][disabled]) .base {\n cursor: not-allowed;\n }\n\n /* The chip *is* the button. Negative inline margins let it cover `.base`'s\n padding so the whole pill is the target, while `.base` keeps owning the\n border, background, and the × button's spacing math. */\n .toggle {\n flex: 1 1 auto;\n display: inline-flex;\n align-items: center;\n align-self: stretch;\n gap: var(--_gap);\n min-inline-size: 0;\n margin-inline: calc(var(--_padding-inline) * -1);\n padding-inline: var(--_padding-inline);\n border: 0;\n background: none;\n color: inherit;\n font: inherit;\n text-align: start;\n cursor: inherit;\n }\n\n /* Stop before the × instead of running under it. */\n :host([removable]) .toggle {\n margin-inline-end: 0;\n padding-inline-end: 0;\n }\n\n /* One ring for the whole chip: the inner control is a detail of how the chip\n is operated, not a second thing to focus visually — and the ring drawn\n below fully encloses the box, so the indicator only grows (WCAG 2.4.7 /\n 2.4.13).\n\n Qualified by `:host(…)` on purpose. The shared appearance nests\n `&:focus-visible` under a selector list, so it lands as\n `:is(.l-checkbox, … input[type='checkbox']:not(…)):focus-visible` — 0,3,1,\n which outranks a bare `.checkbox:focus-visible` (0,2,0) and paints a second\n ring around the box. `:host([selectable])` brings this to 0,4,0. */\n :host([selectable]) .toggle:focus-visible,\n :host([selectable]) .checkbox:focus-visible {\n outline: none;\n }\n\n .base:has(:is(.toggle, .checkbox):focus-visible) {\n outline: var(--l-focus-ring-width) solid var(--l-focus-ring);\n outline-offset: 2px;\n }\n\n /* The skin comes from the shared `.l-checkbox` appearance, applied through\n `cls('checkbox')` rather than a static class literal: `dist` ships that CSS\n as a real file, so a consumer's PostCSS rewrites its selector under a\n renamed `cssPrefix` — a baked `l-checkbox` in the template would stop\n matching it. This rule only carries what is specific to a chip.\n\n The shared appearance sizes the box in `em`, and a UA gives `<input>` its\n own font — inheriting the chip's makes the box track the `size` step. The\n accent follows the selected color, so a themed chip keeps its checkbox in\n the same hue. */\n .checkbox {\n --accent: var(--selected-text-color, var(--l-form-control-activated-color));\n /* Hover halo — same ratio and same token flip as the light-DOM\n `.l-checkbox`, which keeps this rule out of the shared partial (see\n `css/elements/checkbox.css`). Repeated here rather than moved into the\n partial: `l-tree-item` shares that file and never opted into a glow. */\n --_halo: var(--l-form-control-border-color-hover);\n\n flex: none;\n font: inherit;\n transition-property: background-color, border-color, box-shadow;\n }\n\n .checkbox:checked,\n .checkbox:indeterminate {\n --_halo: var(--accent);\n }\n\n /* Driven by the chip, not by the box: the chip is the label and the whole\n click target, so a halo lighting up only over 15px of a 28px pill would\n read as a glitch. */\n @media (hover: hover) {\n :host([selectable]:not([disabled])) .base:hover .checkbox:not(:disabled) {\n box-shadow: 0 0 0 calc(var(--size) * var(--l-form-control-toggle-halo-ratio))\n color-mix(in oklab, var(--_halo), transparent 84%);\n }\n }\n\n /* Forced colors drop the tint (backgrounds are forced to Canvas), so pin the\n border to the system highlight — otherwise selection becomes invisible. */\n @media (forced-colors: active) {\n :host([selectable][selected]) .base {\n border-color: Highlight;\n }\n }\n\n /*\n ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n 🆁🅴🅼🅾🆅🅴 (≥24px target-size, mdi:close mask — mirrors l-close)\n ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n */\n\n .remove {\n flex: none;\n display: grid;\n place-items: center;\n /* Full height, and split off by a rule: the affordance is drawn *at rest*\n rather than conjured on hover. Keyboard and touch users never get a hover\n state, and a filter bar of chips whose delete zone only appears under the\n pointer is a row of faint marks until you go hunting. */\n align-self: stretch;\n /* Square, and never under the 24px hit target (WCAG 2.5.8) however a\n consumer tunes `--height`. */\n inline-size: max(1.5rem, var(--_height));\n /* The segment spans `.base`'s *border* box, not its content box: the −1px\n block margins cancel the border on each side (a stretched flex item is\n sized by the line minus its own margins), which both lands the target on\n a full 24px — 22px otherwise, one short — and runs the rule edge to edge\n so it meets the chip's own border instead of stopping just inside it. */\n margin-block: -1px;\n /* End: flush to the chip's inner edge. Start: pushed off the label so it\n gets the same air on both sides. `.base`'s `gap` spaces *slotted items*\n (icon ↔ label) and is deliberately tighter than the chip's padding, so\n letting it also front the rule left the label with 8px on its left and\n 4px on its right — visibly crammed against the divider. This tops the gap\n back up to a full `--_padding-inline`, at every size. */\n margin-inline: calc(var(--_padding-inline) - var(--_gap))\n calc(var(--_padding-inline) * -1 - 1px);\n padding: 0;\n /* Transparent on three sides, so `background-clip` below keeps the hover\n fill off the 1px the chip's own border occupies. */\n border: 1px solid transparent;\n border-inline-start-color: var(--_border-color);\n /* The chip's own curve — the padding box rounds to one pixel less on its\n own, so the fill stops on the arc rather than squaring off the pill. */\n border-start-end-radius: var(--_border-radius);\n border-end-end-radius: var(--_border-radius);\n background-color: transparent;\n background-clip: padding-box;\n color: inherit;\n cursor: pointer;\n transition: background-color 120ms ease;\n /* The press dip goes through a variable so the reduced-motion block can\n cancel it by re-declaring *this* one line. Pairing the two `:active`\n selectors instead is a trap: the override only wins on source order while\n the specificities tie, and adding the `:not(:disabled)` guard below was\n enough to silently break it. */\n --_press-scale: 0.86;\n\n &::after {\n content: '';\n inline-size: var(--_remove-glyph);\n block-size: var(--_remove-glyph);\n background-color: currentColor;\n transition: scale 120ms ease;\n /* https://pictogrammers.com/library/mdi/icon/close */\n mask: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z\" /></svg>')\n center / contain no-repeat;\n }\n\n /* The whole segment fills. The chip already tints under the pointer (7%),\n so this has to read as the stronger of the two — it is what will actually\n be clicked. */\n @media (hover: hover) {\n &:hover:not(:disabled) {\n background-color: color-mix(in oklab, transparent, currentColor 12%);\n }\n }\n\n &:active:not(:disabled) {\n background-color: color-mix(in oklab, transparent, currentColor 22%);\n }\n\n /* The glyph dips, not the segment: scaling the box would shrink the rule\n and pull it away from the chip's border. */\n &:active:not(:disabled)::after {\n scale: var(--_press-scale);\n }\n\n /* Inset, unlike the library's usual +2px: the segment is flush with the\n chip's border on three sides, so an outset ring would sit half outside\n the chip and clip against its neighbour in a wrapped filter bar. */\n &:focus-visible {\n outline: var(--l-focus-ring-width) solid var(--l-focus-ring);\n outline-offset: calc(var(--l-focus-ring-width) * -1);\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.4;\n }\n\n /* `background-color` is forced to Canvas in high contrast, which would erase\n a masked glyph entirely — repaint it in the system button color. */\n @media (forced-colors: active) {\n &::after {\n background-color: ButtonText;\n }\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .base,\n .checkbox,\n .remove,\n .remove::after {\n transition-duration: 0ms;\n }\n .remove {\n --_press-scale: 1;\n }\n }\n}\n","import { html, nothing, unsafeCSS } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { LuxenElement } from '../../shared/luxen-element.js';\nimport { LocalizeController } from '../../shared/localize.js';\nimport { cls } from '../../registry.js';\nimport hostStyles from '../../shared/styles/host.styles.js';\nimport checkboxAppearance from '../../shared/styles/checkbox-appearance.styles.js';\nimport rawStyles from './tag.css?inline';\n\nconst styles = unsafeCSS(rawStyles);\n\nexport type TagSize = 'sm' | 'md' | 'lg';\nexport type TagControl = 'none' | 'checkbox';\n\n/**\n * Fired when the user asks to remove the tag — clicking the × button, or\n * pressing Backspace/Delete while it is focused. Cancelable: call\n * `preventDefault()` to keep the tag (the controlling host then manages the\n * list itself); otherwise the tag removes itself from the DOM. Does not bubble.\n */\nexport class TagRemoveEvent extends Event {\n constructor() {\n super('remove', { bubbles: false, composed: false, cancelable: true });\n }\n}\n\n/** Fired when a `selectable` tag is toggled. Bubbles; not composed. */\nexport class TagChangeEvent extends Event {\n readonly selected: boolean;\n constructor(selected: boolean) {\n super('change', { bubbles: true, composed: false, cancelable: false });\n this.selected = selected;\n }\n}\n\ninterface TagEventMap {\n change: TagChangeEvent;\n}\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n remove: TagRemoveEvent;\n }\n}\n\n/**\n * A compact chip for tokens, filters, and multi-select values. Shadow DOM so its\n * styles are self-contained and it renders correctly **anywhere**, including\n * inside another element's shadow root (e.g. the `<l-select>` multi-select\n * trigger).\n *\n * Add `selectable` to turn the chip into a filter control: the tag itself\n * becomes a toggle button (`aria-pressed`), and re-activating a selected tag\n * deselects it — the affordance a radio group cannot offer, so a facet always\n * has a way back to \"all\". Add `control=\"checkbox\"` for a multi-select axis and\n * the library's own checkbox rides inside, with the chip as its label.\n *\n * @summary A compact, optionally removable or selectable chip.\n *\n * @example\n * ```html\n * <l-tag removable>Design</l-tag>\n * <l-tag selectable selected>A3</l-tag>\n * <l-tag selectable control=\"checkbox\">Color <span slot=\"suffix\">79</span></l-tag>\n * ```\n *\n * @event remove - Fired when the user removes the tag (× click or Backspace/Delete). Cancelable; if not prevented the tag removes itself. Not composed, does not bubble.\n * @event change - Fired when a `selectable` tag is toggled. Not cancelable — like the platform's own `change`, and like `l-segmented-control`. Bubbles. Properties: `selected: boolean`. The chip is uncontrolled: it applies the new state before dispatching, so a host that vetoes a toggle (a \"max 3 filters\" rule, an async guard) sets `selected` back in the listener — the revert lands in the same render and is never painted.\n *\n * @slot - The tag label.\n * @slot prefix - Leading content, e.g. an `<l-icon>` or `<l-avatar>`.\n * @slot suffix - Trailing content, e.g. a result count. Gets the chip's own gutter, so no margin is needed.\n *\n * @csspart base - The chip container.\n * @csspart content - The label wrapper.\n * @csspart toggle - The toggle button rendered by `selectable` (not with `control=\"checkbox\"`).\n * @csspart checkbox - The native checkbox rendered by `control=\"checkbox\"`.\n * @csspart remove - The remove button — a full-height segment at the end of the chip.\n *\n * @cssproperty [--text-color] - Label color.\n * @cssproperty [--background-color] - Chip fill.\n * @cssproperty [--border-color] - Chip border, and the rule that splits off the remove button. Defaults to a tint of `--text-color`; setting it pins the line in every state, so a token-based theme keeps its own value on hover.\n * @cssproperty [--selected-text-color] - Label, border, and checkbox accent when selected. Defaults to the library's form-control accent, lightened in dark mode.\n * @cssproperty [--selected-background-color] - Chip fill when selected. Defaults to a tint of `--selected-text-color`.\n * @cssproperty [--selected-border-color] - Chip border when selected. Defaults to a 45% tint of `--selected-text-color`. Selection replaces the line the same way it replaces the fill and the ink, so a chip themed with `--border-color` still gets its emphasis step; set this to theme that step too.\n * @cssproperty [--height] - Chip height. Defaults to the `size` step (a selectable chip is taller, to keep a comfortable target).\n * @cssproperty [--font-size] - Label size. Defaults to the `size` step — 12px, or 14px at `size=\"lg\"`. Set it with `--height` to land between the two steps in a dense filter panel.\n * @cssproperty [--padding-inline] - Horizontal padding. Defaults to the `size` step.\n * @cssproperty [--border-radius] - Corner radius. Defaults to a full pill.\n *\n * @customElement l-tag\n */\n// oxlint-disable-next-line typescript/no-unsafe-declaration-merging -- typed addEventListener overloads merged below; no uninitialized properties.\nexport class Tag extends LuxenElement {\n static override styles = [hostStyles, checkboxAppearance, styles];\n\n private _localize = new LocalizeController(this);\n\n /** Tag size: `sm`, `md` (default), or `lg`. */\n @property({ reflect: true })\n accessor size: TagSize = 'md';\n\n /** Show a remove button (and enable Backspace/Delete removal). */\n @property({ type: Boolean, reflect: true })\n accessor removable = false;\n\n /** Make the tag a filter control the user can toggle on and off. */\n @property({ type: Boolean, reflect: true })\n accessor selectable = false;\n\n /** Whether the tag is selected. Reflected, so `[selected]` is styleable. */\n @property({ type: Boolean, reflect: true })\n accessor selected = false;\n\n /**\n * What drives the selection: `none` (default) makes the chip itself a toggle\n * button; `checkbox` renders a checkbox inside and makes the chip its label —\n * the right choice for a multi-select facet. Implies `selectable`.\n */\n @property({ reflect: true })\n accessor control: TagControl = 'none';\n\n /** Disable the tag — dims it and blocks selection and removal. */\n @property({ type: Boolean, reflect: true })\n accessor disabled = false;\n\n constructor() {\n super();\n // The chip is operated from inside the shadow root, which a click\n // dispatched on the host never reaches — see `_onHostClick`.\n this.addEventListener('click', this._onHostClick);\n }\n\n override willUpdate() {\n // A checkbox is only ever rendered on a selectable chip, so the attribute\n // (which every selectable style rule keys off) is derived rather than\n // duplicated in every selector — and in the consumer's markup.\n if (this.control === 'checkbox') this.selectable = true;\n }\n\n override updated() {\n // Re-assert the box, don't rely on the `.checked` binding. Lit dirty-checks\n // a property part against the value it last wrote, and a click has the user\n // agent flip `checked` behind its back — so when a controlling host vetoes\n // the toggle by setting `selected` back to what it already was, Lit sees no\n // change, skips the write, and leaves a checked box on an unselected chip\n // (announced \"checked\" too). Cheap: the query is null on every other path.\n const box = this.renderRoot.querySelector<HTMLInputElement>('.checkbox');\n if (box) box.checked = this.selected;\n }\n\n private _requestRemove = () => {\n if (this.disabled) return;\n const event = new TagRemoveEvent();\n this.dispatchEvent(event);\n if (!event.defaultPrevented) this.remove();\n };\n\n private _onKeyDown = (e: KeyboardEvent) => {\n if (!this.removable || this.disabled) return;\n if (e.key === 'Backspace' || e.key === 'Delete') {\n e.preventDefault();\n this._requestRemove();\n }\n };\n\n private _toggle = () => {\n if (this.disabled) return;\n // Toggling, not setting: re-activating a selected tag releases it.\n this.selected = !this.selected;\n this.dispatchEvent(new TagChangeEvent(this.selected));\n };\n\n /**\n * Events do not propagate *down* into a shadow tree, so a click dispatched on\n * the host — `tag.click()`, a test runner resolving the chip by its test id,\n * a runner computing the chip's centre (`elementFromPoint()` retargets shadow\n * content back to the host) — never reaches the toggle button or the\n * checkbox, and silently does nothing. Delegate it.\n *\n * Only when the host *is* the target: a real gesture originates at the inner\n * button, at the checkbox, or at slotted content, and is already handled\n * where it lands — so this never double-toggles. `removable` stays out of it;\n * removing is the × button's own gesture.\n */\n private _onHostClick = (e: Event) => {\n if (!this.selectable || this.disabled) return;\n if (e.composedPath()[0] !== this) return;\n // Right for `control=\"checkbox\"` too: `_toggle()` flips `selected` and\n // fires `change`, and `updated()` re-asserts `box.checked` from it.\n this._toggle();\n };\n\n private _onCheckboxChange = (e: Event) => {\n this.selected = (e.target as HTMLInputElement).checked;\n this.dispatchEvent(new TagChangeEvent(this.selected));\n };\n\n private _label() {\n return html`\n <slot name=\"prefix\"></slot>\n <span\n class=\"content\"\n part=\"content\"\n >\n <slot></slot>\n </span>\n <slot name=\"suffix\"></slot>\n `;\n }\n\n private _removeButton() {\n return this.removable\n ? html`<button\n class=\"remove\"\n part=\"remove\"\n type=\"button\"\n ?disabled=${this.disabled}\n aria-label=${this._localize.term('remove')}\n @click=${this._requestRemove}\n ></button>`\n : nothing;\n }\n\n override render() {\n if (this.control === 'checkbox') {\n return html`\n <label\n class=\"base\"\n part=\"base\"\n @keydown=${this._onKeyDown}\n >\n <input\n class=\"checkbox ${cls('checkbox')}\"\n part=\"checkbox\"\n type=\"checkbox\"\n .checked=${this.selected}\n ?disabled=${this.disabled}\n @change=${this._onCheckboxChange}\n />\n ${this._label()}${this._removeButton()}\n </label>\n `;\n }\n\n if (this.selectable) {\n return html`\n <span\n class=\"base\"\n part=\"base\"\n @keydown=${this._onKeyDown}\n >\n <button\n class=\"toggle\"\n part=\"toggle\"\n type=\"button\"\n aria-pressed=${this.selected ? 'true' : 'false'}\n ?disabled=${this.disabled}\n @click=${this._toggle}\n >\n ${this._label()}\n </button>\n ${this._removeButton()}\n </span>\n `;\n }\n\n return html`\n <span\n class=\"base\"\n part=\"base\"\n @keydown=${this._onKeyDown}\n >\n ${this._label()}${this._removeButton()}\n </span>\n `;\n }\n}\n\n// Type `addEventListener('change', …)` so listeners receive a `TagChangeEvent`\n// (with `.selected`) instead of a bare `Event`. `change` collides with lib.dom's\n// `GlobalEventHandlersEventMap`, so it can't be augmented globally — the\n// overloads are declaration-merged onto this element's interface instead. The\n// interface MUST come after the class (the CEM analyzer dedups on the first\n// declaration of the name). See `tabs.ts` for the fully-annotated reference.\nexport interface Tag {\n addEventListener<K extends keyof TagEventMap>(\n type: K,\n listener: (this: Tag, ev: TagEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions,\n ): void;\n addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ): void;\n removeEventListener<K extends keyof TagEventMap>(\n type: K,\n listener: (this: Tag, ev: TagEventMap[K]) => void,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n}\n"],"mappings":"A,saCSA,IAAMc,EAASd,EAAUC,y2LAAS,EAWrBc,EAAb,cAAoC,KAAM,CACxC,aAAc,CACZ,MAAM,SAAU,CAAE,QAAS,GAAO,SAAU,GAAO,WAAY,EAAK,CAAC,C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CAAC,CAAA,EAAAY,EAAA,UAAA,UAAA,IAAA,EAI1Bb,EAAA,CAAAC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,CAAA,EAAAY,EAAA,UAAA,WAAA,IAAA,E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"../../chunks/lit.js";import{r as t,t as n}from"../../chunks/decorate.js";import{LuxenElement as r}from"../../shared/luxen-element.js";import{a as i}from"../../chunks/lit-html.js";import{tagName as a}from"../../registry.js";import o from"../../shared/styles/host.styles.js";var s=e(`:host{--indent-size:1rem;--indent-guide-width:1px;--indent-guide-style:solid;--indent-guide-color:var(--l-color-border-interactive);--row-height:1.75rem;--row-padding-inline:.25rem;--chevron-size:1.125rem;--item-gap:.375rem;color:var(--l-color-text-primary);font-family:inherit;line-height:1.5;display:block}.tree{outline:none;display:block}.tree:focus-visible{outline:
|
|
1
|
+
import{i as e}from"../../chunks/lit.js";import{r as t,t as n}from"../../chunks/decorate.js";import{LuxenElement as r}from"../../shared/luxen-element.js";import{a as i}from"../../chunks/lit-html.js";import{tagName as a}from"../../registry.js";import o from"../../shared/styles/host.styles.js";var s=e(`:host{--indent-size:1rem;--indent-guide-width:1px;--indent-guide-style:solid;--indent-guide-color:var(--l-color-border-interactive);--row-height:1.75rem;--row-padding-inline:.25rem;--chevron-size:1.125rem;--item-gap:.375rem;color:var(--l-color-text-primary);font-family:inherit;line-height:1.5;display:block}.tree{outline:none;display:block}.tree:focus-visible{outline:var(--l-focus-ring-width) solid var(--l-focus-ring);outline-offset:2px;border-radius:.375rem}`),c=class extends Event{constructor(e){super(`selection-change`,{bubbles:!1,composed:!1,cancelable:!1}),this.selection=e}},l=class extends r{constructor(...e){super(...e),this._internals=this.attachInternals(),this._lastFocusedItem=null,this.#e=`single`,this.#t=!1,this._onItemToggle=e=>{this._selectItem(e.item,e.checked)},this._onClick=e=>{let t=this._itemFromEvent(e);if(!t||t.disabled)return;let n=e.composedPath();if(n.some(e=>e instanceof HTMLInputElement&&e.type===`checkbox`))return;let r=new Set([`BUTTON`,`A`,`INPUT`,`SELECT`,`TEXTAREA`]),i=new Set([`button`,`link`,`menuitem`,`menuitemcheckbox`]);if(n.some(e=>{if(!(e instanceof HTMLElement)||e===t||e.getAttribute?.(`part`)===`expand-button`||e instanceof HTMLInputElement&&e.type===`checkbox`)return!1;if(r.has(e.tagName))return!0;let n=e.getAttribute?.(`role`);return n!==null&&i.has(n)}))return;let a=n.some(e=>e instanceof HTMLElement&&e.getAttribute?.(`part`)===`expand-button`);if(this._focusItem(t),a)t.toggle();else switch(this.selection){case`single`:this._setSingleSelection(t),t.isLeaf()||t.toggle();break;case`leaf`:t.isLeaf()?this._setSingleSelection(t):t.toggle();break;case`multiple`:this._selectItem(t,!t.selected);break;case`none`:t.toggle()}},this._onFocusIn=e=>{let t=e.target;if(t instanceof HTMLElement){let e=t.closest(a(`tree-item`));e&&(this._lastFocusedItem=e)}},this._onKeyDown=e=>{let t=this._lastFocusedItem??this._visibleItems()[0];if(!t)return;let n=this._visibleItems(),r=n.indexOf(t);switch(e.key){case`ArrowDown`:{e.preventDefault();let t=n[Math.min(r+1,n.length-1)];t&&this._focusItem(t);break}case`ArrowUp`:{e.preventDefault();let t=n[Math.max(r-1,0)];t&&this._focusItem(t);break}case`ArrowRight`:if(e.preventDefault(),!t.isLeaf()&&!t.expanded)t.expanded=!0;else if(t.expanded){let e=t.getChildrenItems()[0];e&&this._focusItem(e)}break;case`ArrowLeft`:if(e.preventDefault(),t.expanded&&!t.isLeaf())t.expanded=!1;else{let e=t.parentElement?.closest(a(`tree-item`));e&&this._focusItem(e)}break;case`Home`:e.preventDefault(),n[0]&&this._focusItem(n[0]);break;case`End`:{e.preventDefault();let t=n[n.length-1];t&&this._focusItem(t);break}case`Enter`:case` `:e.preventDefault(),this._handleRowActivate(t);break;case`*`:{e.preventDefault();let n=(t.parentElement?Array.from(t.parentElement.children):[]).filter(e=>e.tagName===a(`tree-item`).toUpperCase());for(let e of n)e.isLeaf()||(e.expanded=!0);break}}}}static{this.styles=[o,s]}#e;get selection(){return this.#e}set selection(e){this.#e=e}#t;get independent(){return this.#t}set independent(e){this.#t=e}connectedCallback(){super.connectedCallback(),this._internals.role=`tree`,this.hasAttribute(`role`)||this.setAttribute(`role`,`tree`),this._mutationObserver=new MutationObserver(()=>this._syncAll()),this._mutationObserver.observe(this,{childList:!0,subtree:!0}),this.addEventListener(`selection-toggle`,this._onItemToggle),queueMicrotask(()=>this._syncAll())}disconnectedCallback(){super.disconnectedCallback(),this._mutationObserver?.disconnect(),this.removeEventListener(`selection-toggle`,this._onItemToggle)}updated(e){if(e.has(`selection`)){let e=this.selection===`multiple`?`true`:`false`;this._internals.ariaMultiSelectable=e,this.setAttribute(`aria-multiselectable`,e)}(e.has(`selection`)||e.has(`independent`))&&this._syncAll()}getAllItems({includeDisabled:e=!0}={}){let t=a(`tree-item`);return Array.from(this.querySelectorAll(t)).filter(t=>e||!t.disabled)}getSelection(){return this.getAllItems().filter(e=>e.selected)}expandAll(){for(let e of this.getAllItems())e.isLeaf()||(e.expanded=!0)}collapseAll(){for(let e of this.getAllItems())e.expanded=!1}_syncAll(){customElements.upgrade(this);let e=a(`tree-item`),t=this._rootItems();if(t.some(e=>typeof e.getChildrenItems!=`function`)){customElements.whenDefined(e).then(()=>this._syncAll());return}let n=this.selection===`multiple`;this._syncLevel(t,0,n),this._updateBranchStates(),this._ensureTabStop()}_syncLevel(e,t,n){let r=e.length;e.forEach((e,i)=>{e.depth=t,e.showCheckbox=n&&this._canShowCheckboxOn(e),e.setPosition(t+1,i+1,r),this._syncLevel(e.getChildrenItems(),t+1,n)})}_canShowCheckboxOn(e){return this.selection===`multiple`}_rootItems(){let e=a(`tree-item`).toUpperCase();return Array.from(this.children).filter(t=>t.tagName===e)}_ensureTabStop(){let e=this._visibleItems();if(e.length!==0&&!e.some(e=>e.tabIndex===0)){for(let t of e)t.tabIndex=-1;e[0].tabIndex=0}}_visibleItems(){let e=[],t=n=>{for(let r of n)e.push(r),r.expanded&&t(r.getChildrenItems())};return t(this._rootItems()),e}_handleRowActivate(e){if(!e.disabled)switch(this.selection){case`single`:this._setSingleSelection(e),e.isLeaf()||e.toggle();break;case`leaf`:e.isLeaf()?this._setSingleSelection(e):e.toggle();break;case`multiple`:this._selectItem(e,!e.selected);break;case`none`:e.toggle()}}_setSingleSelection(e){for(let t of this.getAllItems())t!==e&&t.selected&&(t.selected=!1);e.selected=!0,this._emitSelectionChange()}_selectItem(e,t){e.disabled||(e.selected=t,this._cascades&&(this._setSubtreeSelection(e,t),e._setCascadeIndeterminate(!1)),this._updateBranchStates(),this._emitSelectionChange())}_setSubtreeSelection(e,t){for(let n of e.getChildrenItems())n.disabled||(n.selected=t,n._setCascadeIndeterminate(!1),this._setSubtreeSelection(n,t))}get _cascades(){return this.selection===`multiple`&&!this.independent}_updateBranchStates(){if(!this._cascades){for(let e of this.getAllItems())e._cascadeIndeterminate&&e._setCascadeIndeterminate(!1);return}let e=t=>{let n=t.getChildrenItems({includeDisabled:!1});if(n.length===0)return t._setCascadeIndeterminate(!1),{all:t.selected,any:t.selected};let r=!0,i=!1;for(let t of n){let n=e(t);n.all||(r=!1),n.any&&(i=!0)}return t.selected=r,t._setCascadeIndeterminate(!r&&i),{all:r&&(t.getChildrenItems().length>0?r:t.selected),any:i}};for(let t of this._rootItems())e(t)}_emitSelectionChange(){this.dispatchEvent(new c(this.getSelection()))}_itemFromEvent(e){let t=a(`tree-item`),n=e.composedPath();for(let e of n)if(e instanceof HTMLElement&&e.matches?.(t))return e;return null}_focusItem(e){let t=this._visibleItems();for(let e of t)e.tabIndex=-1;e.tabIndex=0,e.focus(),this._lastFocusedItem=e}render(){return i`
|
|
2
2
|
<div
|
|
3
3
|
class="tree"
|
|
4
4
|
part="base"
|