@aceshooting/lyra-ui 30.4.0 → 30.7.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.
Files changed (203) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/README.md +2 -3
  3. package/dist/components/agent-tools/artifact-panel/artifact-panel.class.d.ts +7 -4
  4. package/dist/components/agent-tools/artifact-panel/artifact-panel.class.js +5 -5
  5. package/dist/components/conversation/code-block/onig.provenance.json +1 -1
  6. package/dist/components/conversation/markdown/markdown-base.class.d.ts +1 -1
  7. package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
  8. package/dist/components/conversation/markdown/markdown-core.class.d.ts +11 -1
  9. package/dist/components/conversation/markdown/markdown-core.class.js +1 -1
  10. package/dist/components/conversation/markdown/markdown-progressive.js +2 -2
  11. package/dist/components/conversation/markdown/markdown-shared.d.ts +7 -2
  12. package/dist/components/conversation/markdown/markdown-shared.js +3 -3
  13. package/dist/components/conversation/markdown/markdown.class.d.ts +11 -1
  14. package/dist/components/conversation/markdown/markdown.class.js +1 -1
  15. package/dist/components/conversation/message-parts/message-parts.class.d.ts +1 -1
  16. package/dist/components/conversation/message-parts/message-parts.class.js +1 -1
  17. package/dist/components/conversation/message-parts/message-parts.d.ts +1 -1
  18. package/dist/components/conversation/model-select/model-select.class.d.ts +8 -1
  19. package/dist/components/conversation/model-select/model-select.class.js +2 -2
  20. package/dist/components/conversation/streaming-text/streaming-text-base.class.d.ts +5 -0
  21. package/dist/components/conversation/streaming-text/streaming-text-base.class.js +2 -2
  22. package/dist/components/conversation/streaming-text/streaming-text-core.class.d.ts +1 -1
  23. package/dist/components/conversation/streaming-text/streaming-text-core.class.js +1 -0
  24. package/dist/components/conversation/streaming-text/streaming-text.class.d.ts +1 -1
  25. package/dist/components/conversation/streaming-text/streaming-text.class.js +1 -0
  26. package/dist/components/conversation/suggestion-chips/suggestion-chips.class.d.ts +6 -0
  27. package/dist/components/conversation/suggestion-chips/suggestion-chips.styles.js +1 -1
  28. package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +9 -2
  29. package/dist/components/conversation/voice-picker/voice-picker.class.js +2 -2
  30. package/dist/components/conversation/widget-renderer/default-registry.js +1 -1
  31. package/dist/components/conversation/widget-renderer/registry.d.ts +1 -27
  32. package/dist/components/conversation/widget-renderer/registry.js +1 -1
  33. package/dist/components/conversation/widget-renderer/resolve.d.ts +1 -29
  34. package/dist/components/conversation/widget-renderer/resolve.js +1 -1
  35. package/dist/components/conversation/widget-renderer/widget-renderer.class.d.ts +1 -1
  36. package/dist/components/conversation/widget-renderer/widget-renderer.class.js +1 -1
  37. package/dist/components/forms/catalog-picker-base.d.ts +3 -1
  38. package/dist/components/forms/catalog-picker-base.js +3 -3
  39. package/dist/components/forms/combobox/combobox.class.d.ts +9 -2
  40. package/dist/components/forms/combobox/combobox.class.js +2 -2
  41. package/dist/components/forms/date-picker/date-input.class.d.ts +9 -2
  42. package/dist/components/forms/date-picker/date-input.class.js +2 -2
  43. package/dist/components/forms/input/input-shared.d.ts +9 -2
  44. package/dist/components/forms/input/input-shared.js +2 -2
  45. package/dist/components/forms/input/time-input.class.d.ts +9 -2
  46. package/dist/components/forms/input/time-input.class.js +2 -2
  47. package/dist/components/forms/input/time-input.styles.js +1 -1
  48. package/dist/components/forms/locale-picker/locale-picker.class.d.ts +18 -3
  49. package/dist/components/forms/locale-picker/locale-picker.class.js +2 -2
  50. package/dist/components/forms/phone-input/phone-input.class.d.ts +9 -2
  51. package/dist/components/forms/phone-input/phone-input.class.js +2 -2
  52. package/dist/components/forms/phone-input/phone-input.styles.js +1 -1
  53. package/dist/components/forms/select/select.class.d.ts +9 -2
  54. package/dist/components/forms/select/select.class.js +2 -2
  55. package/dist/components/forms/textarea/textarea.class.d.ts +9 -2
  56. package/dist/components/forms/textarea/textarea.class.js +2 -2
  57. package/dist/components/forms/token-input/token-input.class.d.ts +9 -2
  58. package/dist/components/forms/token-input/token-input.class.js +2 -2
  59. package/dist/components/forms/token-input/token-input.styles.js +1 -1
  60. package/dist/components/layout/dock-panel/dock-panel.class.d.ts +5 -2
  61. package/dist/components/layout/dock-panel/dock-panel.styles.js +1 -1
  62. package/dist/components/layout/menu/menu-item.class.d.ts +7 -4
  63. package/dist/components/layout/menu/menu-item.class.js +3 -2
  64. package/dist/components/layout/multi-split/multi-split.class.d.ts +73 -6
  65. package/dist/components/layout/multi-split/multi-split.class.js +4 -4
  66. package/dist/components/layout/multi-split/multi-split.styles.js +1 -1
  67. package/dist/components/layout/page/page.class.d.ts +7 -0
  68. package/dist/components/layout/page/page.styles.js +1 -1
  69. package/dist/components/media/flag/language-map.js +1 -1
  70. package/dist/components/media/image-viewer/image-viewer-panorama.d.ts +1 -5
  71. package/dist/components/media/image-viewer/image-viewer-panorama.js +1 -8
  72. package/dist/components/media/image-viewer/image-viewer.class.d.ts +1 -1
  73. package/dist/components/media/image-viewer/image-viewer.class.js +1 -1
  74. package/dist/components/media/map/map-control-options.d.ts +19 -5
  75. package/dist/components/media/map/map-control-options.js +1 -1
  76. package/dist/components/media/map/map-controls-lifecycle.js +1 -1
  77. package/dist/components/media/map/map-feature-loader.js +1 -1
  78. package/dist/components/media/map/map-loader.d.ts +10 -4
  79. package/dist/components/media/map/map-loader.js +1 -1
  80. package/dist/components/media/map/map-scene-admission.js +1 -0
  81. package/dist/components/media/map/map-scene-completion-adapter.js +1 -0
  82. package/dist/components/media/map/map-scene-completion-camera.js +1 -0
  83. package/dist/components/media/map/map-scene-configuration-controller.js +1 -0
  84. package/dist/components/media/map/map-scene-configuration.d.ts +15 -0
  85. package/dist/components/media/map/map-scene-configuration.js +1 -0
  86. package/dist/components/media/map/map-scene-controls.js +1 -0
  87. package/dist/components/media/map/map-scene-errors.js +1 -0
  88. package/dist/components/media/map/map-scene-line-layer.js +1 -0
  89. package/dist/components/media/map/map-scene-lines.js +1 -0
  90. package/dist/components/media/map/map-scene-owner.js +1 -0
  91. package/dist/components/media/map/map-scene-position-registry.js +1 -0
  92. package/dist/components/media/map/map-scene-render-controller.js +1 -0
  93. package/dist/components/media/map/map-scene-render-input.js +1 -0
  94. package/dist/components/media/map/map-scene-source-snapshot.js +1 -0
  95. package/dist/components/media/map/map-scene-status.js +1 -0
  96. package/dist/components/media/map/map-scene-types.d.ts +55 -0
  97. package/dist/components/media/map/map.class.d.ts +105 -18
  98. package/dist/components/media/map/map.class.js +32 -15
  99. package/dist/components/media/map/map.styles.js +1 -1
  100. package/dist/components/media/sequence-playback/sequence-playback.class.d.ts +1 -1
  101. package/dist/components/media/sequence-playback/sequence-playback.class.js +1 -1
  102. package/dist/components/media/video/video.class.d.ts +1 -1
  103. package/dist/components/media/video/video.class.js +1 -1
  104. package/dist/components/retrieval/graph/graph-builtin-3d-engine.js +1 -1
  105. package/dist/components/retrieval/graph/graph-curvature.js +1 -0
  106. package/dist/components/retrieval/graph/graph-engine-columns.js +1 -1
  107. package/dist/components/retrieval/graph/graph-model.d.ts +4 -0
  108. package/dist/components/retrieval/graph/graph-node-renderer.d.ts +13 -0
  109. package/dist/components/retrieval/graph/graph-node-renderer.js +1 -0
  110. package/dist/components/retrieval/graph/graph-source-controller.js +1 -1
  111. package/dist/components/retrieval/graph/graph-spatial-controller.js +3 -1
  112. package/dist/components/retrieval/graph/graph-spatial.js +1 -1
  113. package/dist/components/retrieval/graph/graph-webgl-engine.js +1 -1
  114. package/dist/components/retrieval/graph/graph.class.d.ts +11 -3
  115. package/dist/components/retrieval/graph/graph.class.js +4 -4
  116. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +8 -2
  117. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +4 -2
  118. package/dist/events.d.ts +41 -1
  119. package/dist/framework-types.d.ts +1 -1
  120. package/dist/internal/collection-policy.js +1 -0
  121. package/dist/internal/collection-snapshot.js +1 -1
  122. package/dist/internal/default-strings/media.generated.js +1 -1
  123. package/dist/internal/default-strings/retrieval.generated.js +1 -1
  124. package/dist/internal/engine-3d-loader.d.ts +8 -2
  125. package/dist/internal/engine-3d-loader.js +1 -1
  126. package/dist/internal/form-control.styles.js +1 -1
  127. package/dist/internal/locale-loaders.generated.js +1 -1
  128. package/dist/internal/localization-runtime.js +1 -1
  129. package/dist/internal/localization-types.d.ts +1 -1
  130. package/dist/internal/localization.js +1 -1
  131. package/dist/internal/map-camera-follow-controller.d.ts +9 -0
  132. package/dist/internal/map-camera-follow-controller.js +1 -0
  133. package/dist/internal/map-camera-follow-data.js +1 -0
  134. package/dist/internal/map-camera-follow-scene.js +1 -0
  135. package/dist/internal/map-camera-session-controller.d.ts +59 -0
  136. package/dist/internal/map-camera-session-controller.js +1 -0
  137. package/dist/internal/map-camera-session-data.d.ts +16 -0
  138. package/dist/internal/map-camera-session-data.js +1 -0
  139. package/dist/internal/map-camera-session.js +1 -0
  140. package/dist/internal/map-scene-session.js +1 -0
  141. package/dist/internal/media-panorama.d.ts +5 -0
  142. package/dist/internal/media-panorama.js +8 -0
  143. package/dist/internal/package-metadata.js +1 -1
  144. package/dist/internal/sequence-playback-binding.js +1 -0
  145. package/dist/internal/typed-columns.d.ts +3 -1
  146. package/dist/internal/typed-columns.js +1 -1
  147. package/dist/internal/variants.d.ts +7 -0
  148. package/dist/internal/widget-default-registry.js +1 -0
  149. package/dist/internal/widget-document.d.ts +29 -0
  150. package/dist/internal/widget-document.js +1 -0
  151. package/dist/internal/widget-type-registry.d.ts +27 -0
  152. package/dist/internal/widget-type-registry.js +1 -0
  153. package/dist/lyra.d.ts +1 -1
  154. package/dist/lyra.js +1 -1
  155. package/dist/map-camera-session.d.ts +10 -0
  156. package/dist/map-camera-session.js +1 -0
  157. package/dist/sequence-time-binding.d.ts +3 -0
  158. package/dist/sequence-time-binding.js +1 -0
  159. package/dist/simulation-clock.d.ts +3 -0
  160. package/dist/simulation-clock.js +1 -0
  161. package/dist/time-index.d.ts +3 -0
  162. package/dist/time-index.js +1 -0
  163. package/llms/components/lr-artifact-panel.md +8 -3
  164. package/llms/components/lr-combobox.md +2 -0
  165. package/llms/components/lr-country-picker.md +2 -0
  166. package/llms/components/lr-currency-picker.md +2 -0
  167. package/llms/components/lr-date-picker.md +2 -0
  168. package/llms/components/lr-dock-panel.md +5 -2
  169. package/llms/components/lr-graph.md +121 -3
  170. package/llms/components/lr-input.md +2 -0
  171. package/llms/components/lr-knowledge-graph-explorer.md +6 -1
  172. package/llms/components/lr-locale-picker.md +8 -1
  173. package/llms/components/lr-map.md +365 -13
  174. package/llms/components/lr-markdown-core.md +2 -1
  175. package/llms/components/lr-markdown.md +12 -1
  176. package/llms/components/lr-menu.md +5 -2
  177. package/llms/components/lr-model-select.md +2 -0
  178. package/llms/components/lr-multi-split.md +53 -4
  179. package/llms/components/lr-native-time-input.md +2 -0
  180. package/llms/components/lr-number-input.md +2 -0
  181. package/llms/components/lr-page.md +9 -1
  182. package/llms/components/lr-phone-input.md +2 -0
  183. package/llms/components/lr-select.md +2 -0
  184. package/llms/components/lr-sequence-playback.md +44 -0
  185. package/llms/components/lr-streaming-text-core.md +3 -2
  186. package/llms/components/lr-streaming-text.md +4 -1
  187. package/llms/components/lr-suggestion-chips.md +6 -2
  188. package/llms/components/lr-textarea.md +2 -0
  189. package/llms/components/lr-time-input.md +2 -0
  190. package/llms/components/lr-time-zone-picker.md +2 -0
  191. package/llms/components/lr-token-input.md +2 -0
  192. package/llms/components/lr-unit-picker.md +2 -0
  193. package/llms/components/lr-voice-picker.md +2 -0
  194. package/llms/peers.md +7 -7
  195. package/llms/shared/imports-and-registration.md +1 -1
  196. package/llms/shared/localization-and-rtl.md +15 -1
  197. package/llms/shared/testing-and-utilities.md +184 -0
  198. package/llms/shared.md +200 -2
  199. package/locales.json +1 -1
  200. package/package.json +39 -23
  201. package/registrations.json +1 -1
  202. package/skills/lyra-ui/lyra-gen.md +18 -0
  203. /package/dist/{components/media/image-viewer/image-viewer-panorama.styles.js → internal/media-panorama.styles.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{nativeAutocorrectAttribute,setNativeRangeText}from"../../../internal/native-text-control.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{observeReactivePropertyWrites}from"../../../internal/reactive-property-writes.js";import{HostDescriptionController}from"../../../internal/aria-controls.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{nextId}from"../../../internal/a11y.js";import{chevronIcon}from"../../../internal/icons.js";import{SET_ANCHORED_VALIDITY,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{FormAssociated,isBarredFromValidation}from"../../../internal/form-associated.js";import{getDisplayNames}from"../../../internal/intl-cache.js";import{LyraElement}from"../../../internal/lyra-element.js";import{sizes}from"../../../internal/sizes.styles.js";import{styles}from"./phone-input.styles.js";import{digitsBefore,fallbackParse,indexAfterDigits,normalizeCountry,normalizeCountryCatalog,normalizeParseResult}from"./phone-number-adapter.js";import{loadLibphonenumberAdapter}from"./phone-number-adapter.js";import{submitOnEnter}from"../../../internal/submit-on-enter.js";import{dispatchNativeInputEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{declaredDefaultConverter,autocorrectConverter,normalizeAutocorrect,trueDefaultSpellcheckConverter as spellcheckConverter}from"../../../internal/converters.js";import{LYRA_DEFAULT_countryPickerLabel,LYRA_DEFAULT_phoneInputIncomplete,LYRA_DEFAULT_phoneInputLabel}from"../../../internal/default-strings/forms.generated.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings/shared.generated.js";class LyraPhoneInputBase extends LyraElement{}class LyraPhoneInput extends FormAssociated(LyraPhoneInputBase){static{this.defaultStrings={...super.defaultStrings,countryPickerLabel:LYRA_DEFAULT_countryPickerLabel,fieldRequired:LYRA_DEFAULT_fieldRequired,phoneInputIncomplete:LYRA_DEFAULT_phoneInputIncomplete,phoneInputLabel:LYRA_DEFAULT_phoneInputLabel,valueInvalid:LYRA_DEFAULT_valueInvalid}}static{this.styles=[LyraElement.styles,sizes,styles]}static{this.properties={country:{noAccessor:!0}}}get adapter(){return this._adapter}set adapter(next){const previous=this._adapter;this._adapter=next,this.adapterCountries=normalizeCountryCatalog(next?.countries),this.requestUpdate("adapter",previous)}get countries(){return this._countries}set countries(next){const previous=this._countries;this._countries=next===void 0?void 0:normalizeCountryCatalog(next),this.requestUpdate("countries",previous)}get inputmode(){return this.inputMode}set inputmode(next){this.inputMode=next??"tel"}get enterkeyhint(){return this.enterKeyHint}set enterkeyhint(next){this.enterKeyHint=next??""}get autocorrect(){return this.autocorrectValue}set autocorrect(next){this.autocorrectValue=normalizeAutocorrect(next),this.requestUpdate()}constructor(){super(),this.flags=!1,this.adapterCountries=Object.freeze([]),this.defaultCountry="",this.label="",this.hint="",this.errorText="",this.withLabel=!1,this.withHint=!1,this.placeholder="",this.size="m",this.pill=!1,this.appearance="outlined",this.accessibleLabel=null,this.countryLabel="Country",this.countryLabelAuthored=!1,this.phoneLabel="",this.incompleteText="This phone number is incomplete.",this.incompleteTextAuthored=!1,this.invalidText="The value is invalid.",this.invalidTextAuthored=!1,this.autocomplete="tel",this.inputMode="tel",this.enterKeyHint="",this.readonly=!1,this.autofocus=!1,this.spellcheck=!0,this.autocapitalize="",this.autocorrectValue=!0,this.editableValue="",this.status="empty",this.touched=!1,this.slotPresence=new SlotPresenceController(this),this.hasCountryPrefixSlot=!1,this.hasEndSlot=!1,this.inputId=nextId("phone-input"),this.hintId=nextId("phone-hint"),this.errorId=nextId("phone-error"),this.explicitCountry="",this.compositionPending=!1,this.compositionCommitted=!1,this.hostDescription=new HostDescriptionController(this,()=>this.inputElement??null),this.onInput=event=>{if(this.liveDisabled||this.readonly){event.stopPropagation();return}const input=event.currentTarget;if(event.isComposing){this.compositionPending=!0,relayNativeEvent(this,event);return}const alreadyCommitted=this.compositionCommitted&&input.value===this.editableValue;this.compositionCommitted=!1,this.compositionPending=!1,alreadyCommitted||this.commitTypedText(input),relayNativeEvent(this,event),alreadyCommitted||this.emit("lr-input",this.eventDetail)},this.onCompositionEnd=event=>{!this.compositionPending||this.liveDisabled||this.readonly||(this.compositionPending=!1,this.commitTypedText(event.currentTarget),this.compositionCommitted=!0,this.emit("lr-input",this.eventDetail))},this.onChange=event=>{if(this.liveDisabled||this.readonly){event.stopPropagation();return}this.touched=!0,relayNativeEvent(this,event),this.emit("lr-change",this.eventDetail)},this.onCountryChange=event=>{if(this.liveDisabled||this.readonly){event.stopPropagation();return}this.country=normalizeCountry(event.currentTarget.value),this.applyParsed(this.editableValue,this.parse(this.editableValue)),dispatchNativeInputEvent(this),this.emit("lr-input",this.eventDetail),relayNativeEvent(this,event),this.emit("lr-change",this.eventDetail)},this.onKeyDown=event=>{this.liveDisabled||submitOnEnter(this,event)},this.onFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.onBlur=event=>{this.liveDisabled||(this.touched=!0),relayNativeEvent(this,event)},this.onCountryPrefixSlotChange=()=>{this.hasCountryPrefixSlot=Array.from(this.children??[]).some(child=>child.getAttribute("slot")==="country-prefix"||child.getAttribute("slot")==="start")},this.onEndSlotChange=()=>{this.hasEndSlot=Array.from(this.children??[]).some(child=>child.getAttribute("slot")==="end")},this.addEventListener("invalid",()=>{this.touched=!0})}get hasLabelSlot(){return this.slotPresence.has("label")}get hasHintSlot(){return this.slotPresence.has("hint")}get hasErrorSlot(){return this.slotPresence.has("error")}get country(){return this.resolveCountry(this.availableCountries)}set country(next){const old=this.country;this.explicitCountry=normalizeCountry(next??""),this.requestUpdate("country",old)}get input(){return this.inputElement}get inputValue(){return this.editableValue}get phoneStatus(){return this.status}get selectionStart(){return this.inputElement?.selectionStart??null}set selectionStart(value){this.inputElement&&(this.inputElement.selectionStart=value??0)}get selectionEnd(){return this.inputElement?.selectionEnd??null}set selectionEnd(value){this.inputElement&&(this.inputElement.selectionEnd=value??0)}get selectionDirection(){return this.inputElement?.selectionDirection}set selectionDirection(value){this.inputElement&&(this.inputElement.selectionDirection=value??"none")}[VALIDITY_ANCHOR](){return this.inputElement??null}get value(){return super.value}set value(next){const raw=next??"",parsed=this.parse(raw);this.applyParsed(raw,parsed)}get availableCountries(){return this.countries??this.adapterCountries}resolveCountry(rows){this.countryCodes?.rows!==rows&&(this.countryCodes={rows,codes:new Set(rows.map(row=>row.code))});const{codes}=this.countryCodes,explicit=normalizeCountry(this.explicitCountry),preferred=normalizeCountry(this.defaultCountry??"");return codes.has(explicit)?explicit:codes.has(preferred)?preferred:rows[0]?.code??""}parse(input){if(!this.adapter)return fallbackParse(input);try{const parse=this.adapter.parse;return typeof parse!="function"?{status:"invalid",formatted:input}:normalizeParseResult(parse.call(this.adapter,input,this.country||void 0),input)}catch{return{status:"invalid",formatted:input}}}reconcileCountryCatalog(){this.explicitCountry=this.resolveCountry(this.availableCountries)}applyParsed(raw,parsed){this.editableValue=parsed.formatted??raw,this.status=parsed.status,parsed.country&&(this.country=normalizeCountry(parsed.country)),super.value=parsed.status==="valid"?parsed.e164:"",this.setAttribute("data-phone-status",parsed.status)}syncFormattedValue(input,digitsBeforeCaret){if(input.value!==this.editableValue&&(input.value=this.editableValue,digitsBeforeCaret!=null)){const position=indexAfterDigits(this.editableValue,digitsBeforeCaret);input.setSelectionRange(position,position)}}get eventDetail(){return{value:super.value,inputValue:this.editableValue,country:this.country,valid:this.internals.validity.valid,status:this.status}}static get observedAttributes(){const attributes=super.observedAttributes;return observeReactivePropertyWrites(this.prototype,["countryLabel","incompleteText","invalidText"],(instance,name,value)=>{const authored=value!=null;let ownershipChanged=!1;switch(name){case"countryLabel":if(instance.countryLabelAuthored===void 0)return;ownershipChanged=authored!==instance.countryLabelAuthored,instance.countryLabelAuthored=authored;break;case"incompleteText":if(instance.incompleteTextAuthored===void 0)return;ownershipChanged=authored!==instance.incompleteTextAuthored,instance.incompleteTextAuthored=authored;break;case"invalidText":if(instance.invalidTextAuthored===void 0)return;ownershipChanged=authored!==instance.invalidTextAuthored,instance.invalidTextAuthored=authored;break}ownershipChanged&&instance.requestUpdate(),name!=="countryLabel"&&instance.hasUpdated&&instance.updateValidity()}),attributes}attributeChangedCallback(name,oldValue,newValue){if(super.attributeChangedCallback(name,oldValue,newValue),newValue===null){if(name==="country-label")this.countryLabelAuthored=!1;else if(name==="incomplete-text")this.incompleteTextAuthored=!1;else if(name==="invalid-text")this.invalidTextAuthored=!1;else return;this.requestUpdate(),this.hasUpdated&&this.updateValidity()}}get effectiveCountryLabel(){return this.countryLabelAuthored?this.countryLabel:this.localize("countryPickerLabel")}effectivePhoneLabel(hasLabel){return this.accessibleLabel!==null?this.accessibleLabel:this.phoneLabel?this.phoneLabel:hasLabel?nothing:this.placeholder||this.localize("phoneInputLabel")}get incompleteMessage(){return(this.incompleteTextAuthored?this.incompleteText:"")||this.localize("phoneInputIncomplete")}get invalidMessage(){return(this.invalidTextAuthored?this.invalidText:"")||this.localize("valueInvalid")}countryName(row){if(row.label)return row.label;try{return getDisplayNames(this.effectiveLocale,{type:"region"}).of(row.code)??row.code}catch{return row.code}}updateValidity(){if(isBarredFromValidation(this,this.internals)){this[SET_ANCHORED_VALIDITY]({});return}const flags={};let message="";this.required&&this.status==="empty"?(flags.valueMissing=!0,message=this.localize("fieldRequired")):this.status==="incomplete"?(flags.badInput=!0,message=this.incompleteMessage):this.status==="invalid"&&(flags.typeMismatch=!0,message=this.invalidMessage),this[SET_ANCHORED_VALIDITY](flags,message)}adoptedCallback(){super.adoptedCallback(),this.hostDescription.adopted()}willUpdate(changed){super.willUpdate(changed),this.flags&&!LyraPhoneInput.flagRegistration&&(LyraPhoneInput.flagRegistration=import("../../media/flag/flag.js").catch(error=>{console.warn("<lr-phone-input> failed to register <lr-flag> for its flags option:",error)})),this.hasUpdated||this.seedFirstRenderState(()=>{this.hasCountryPrefixSlot=Array.from(this.children??[]).some(child=>child.getAttribute("slot")==="country-prefix"||child.getAttribute("slot")==="start"),this.hasEndSlot=Array.from(this.children??[]).some(child=>child.getAttribute("slot")==="end")}),(!this.hasUpdated||changed.has("countries")||changed.has("adapter")||changed.has("country")||changed.has("defaultCountry"))&&this.reconcileCountryCatalog(),(changed.has("adapter")||changed.has("countries")||changed.has("country")||changed.has("defaultCountry"))&&this.editableValue&&this.applyParsed(this.editableValue,this.parse(this.editableValue))}updated(changed){super.updated(changed),changed.has("strings")&&this.updateValidity(),(changed.has("touched")||changed.has("required")||changed.has("value")||changed.has("status"))&&this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid)}commitTypedText(input){const caret=input.selectionStart,digitsBeforeCaret=caret==null?null:digitsBefore(input.value,caret);this.applyParsed(input.value,this.parse(input.value)),this.syncFormattedValue(input,digitsBeforeCaret)}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}click(){this.liveDisabled||this.inputElement?.click()}focus(options){this.liveDisabled||this.inputElement?.focus(options)}blur(){this.inputElement?.blur()}select(){this.inputElement?.select()}setSelectionRange(start,end,direction){this.inputElement?.setSelectionRange(start,end,direction)}setRangeText(replacement,start,end,selectMode){const input=this.inputElement;if(!input)return;setNativeRangeText(input,replacement,start,end,selectMode);const caret=input.selectionStart,digitsBeforeCaret=caret==null?null:digitsBefore(input.value,caret);this.applyParsed(input.value,this.parse(input.value)),this.syncFormattedValue(input,digitsBeforeCaret)}formResetCallback(){this.explicitCountry="",this.reconcileCountryCatalog(),super.formResetCallback(),this.touched=!1}render(){const hasLabel=!!(this.label||this.hasLabelSlot||this.withLabel),hasHint=!!(this.hint||this.hasHintSlot||this.withHint),hasError=!!(this.errorText||this.hasErrorSlot),describedBy=[hasError?this.errorId:"",hasHint?this.hintId:""].filter(Boolean).join(" "),rows=this.availableCountries,country=this.country,current=rows.find(row=>row.code===country),locale=this.effectiveLocale;(this.countryNames?.rows!==rows||this.countryNames.locale!==locale)&&(this.countryNames={rows,locale,names:rows.map(row=>this.countryName(row))});const{names}=this.countryNames;return html`
1
+ import{__decorate}from"tslib";import{nativeAutocorrectAttribute,setNativeRangeText}from"../../../internal/native-text-control.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{observeReactivePropertyWrites}from"../../../internal/reactive-property-writes.js";import{HostDescriptionController}from"../../../internal/aria-controls.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{nextId}from"../../../internal/a11y.js";import{chevronIcon}from"../../../internal/icons.js";import{SET_ANCHORED_VALIDITY,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{FormAssociated,isBarredFromValidation}from"../../../internal/form-associated.js";import{getDisplayNames}from"../../../internal/intl-cache.js";import{LyraElement}from"../../../internal/lyra-element.js";import{sizes}from"../../../internal/sizes.styles.js";import{styles}from"./phone-input.styles.js";import{digitsBefore,fallbackParse,indexAfterDigits,normalizeCountry,normalizeCountryCatalog,normalizeParseResult}from"./phone-number-adapter.js";import{loadLibphonenumberAdapter}from"./phone-number-adapter.js";import{submitOnEnter}from"../../../internal/submit-on-enter.js";import{dispatchNativeInputEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{declaredDefaultConverter,autocorrectConverter,normalizeAutocorrect,trueDefaultSpellcheckConverter as spellcheckConverter}from"../../../internal/converters.js";import{LYRA_DEFAULT_countryPickerLabel,LYRA_DEFAULT_phoneInputIncomplete,LYRA_DEFAULT_phoneInputLabel}from"../../../internal/default-strings/forms.generated.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings/shared.generated.js";class LyraPhoneInputBase extends LyraElement{}class LyraPhoneInput extends FormAssociated(LyraPhoneInputBase){static{this.defaultStrings={...super.defaultStrings,countryPickerLabel:LYRA_DEFAULT_countryPickerLabel,fieldRequired:LYRA_DEFAULT_fieldRequired,phoneInputIncomplete:LYRA_DEFAULT_phoneInputIncomplete,phoneInputLabel:LYRA_DEFAULT_phoneInputLabel,valueInvalid:LYRA_DEFAULT_valueInvalid}}static{this.styles=[LyraElement.styles,sizes,styles]}static{this.properties={country:{noAccessor:!0}}}get adapter(){return this._adapter}set adapter(next){const previous=this._adapter;this._adapter=next,this.adapterCountries=normalizeCountryCatalog(next?.countries),this.requestUpdate("adapter",previous)}get countries(){return this._countries}set countries(next){const previous=this._countries;this._countries=next===void 0?void 0:normalizeCountryCatalog(next),this.requestUpdate("countries",previous)}get inputmode(){return this.inputMode}set inputmode(next){this.inputMode=next??"tel"}get enterkeyhint(){return this.enterKeyHint}set enterkeyhint(next){this.enterKeyHint=next??""}get autocorrect(){return this.autocorrectValue}set autocorrect(next){this.autocorrectValue=normalizeAutocorrect(next),this.requestUpdate()}constructor(){super(),this.flags=!1,this.adapterCountries=Object.freeze([]),this.defaultCountry="",this.label="",this.labelDisplay="visible",this.hint="",this.errorText="",this.withLabel=!1,this.withHint=!1,this.placeholder="",this.size="m",this.pill=!1,this.appearance="outlined",this.accessibleLabel=null,this.countryLabel="Country",this.countryLabelAuthored=!1,this.phoneLabel="",this.incompleteText="This phone number is incomplete.",this.incompleteTextAuthored=!1,this.invalidText="The value is invalid.",this.invalidTextAuthored=!1,this.autocomplete="tel",this.inputMode="tel",this.enterKeyHint="",this.readonly=!1,this.autofocus=!1,this.spellcheck=!0,this.autocapitalize="",this.autocorrectValue=!0,this.editableValue="",this.status="empty",this.touched=!1,this.slotPresence=new SlotPresenceController(this),this.hasCountryPrefixSlot=!1,this.hasEndSlot=!1,this.inputId=nextId("phone-input"),this.hintId=nextId("phone-hint"),this.errorId=nextId("phone-error"),this.explicitCountry="",this.compositionPending=!1,this.compositionCommitted=!1,this.hostDescription=new HostDescriptionController(this,()=>this.inputElement??null),this.onInput=event=>{if(this.liveDisabled||this.readonly){event.stopPropagation();return}const input=event.currentTarget;if(event.isComposing){this.compositionPending=!0,relayNativeEvent(this,event);return}const alreadyCommitted=this.compositionCommitted&&input.value===this.editableValue;this.compositionCommitted=!1,this.compositionPending=!1,alreadyCommitted||this.commitTypedText(input),relayNativeEvent(this,event),alreadyCommitted||this.emit("lr-input",this.eventDetail)},this.onCompositionEnd=event=>{!this.compositionPending||this.liveDisabled||this.readonly||(this.compositionPending=!1,this.commitTypedText(event.currentTarget),this.compositionCommitted=!0,this.emit("lr-input",this.eventDetail))},this.onChange=event=>{if(this.liveDisabled||this.readonly){event.stopPropagation();return}this.touched=!0,relayNativeEvent(this,event),this.emit("lr-change",this.eventDetail)},this.onCountryChange=event=>{if(this.liveDisabled||this.readonly){event.stopPropagation();return}this.country=normalizeCountry(event.currentTarget.value),this.applyParsed(this.editableValue,this.parse(this.editableValue)),dispatchNativeInputEvent(this),this.emit("lr-input",this.eventDetail),relayNativeEvent(this,event),this.emit("lr-change",this.eventDetail)},this.onKeyDown=event=>{this.liveDisabled||submitOnEnter(this,event)},this.onFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.onBlur=event=>{this.liveDisabled||(this.touched=!0),relayNativeEvent(this,event)},this.onCountryPrefixSlotChange=()=>{this.hasCountryPrefixSlot=Array.from(this.children??[]).some(child=>child.getAttribute("slot")==="country-prefix"||child.getAttribute("slot")==="start")},this.onEndSlotChange=()=>{this.hasEndSlot=Array.from(this.children??[]).some(child=>child.getAttribute("slot")==="end")},this.addEventListener("invalid",()=>{this.touched=!0})}get hasLabelSlot(){return this.slotPresence.has("label")}get hasHintSlot(){return this.slotPresence.has("hint")}get hasErrorSlot(){return this.slotPresence.has("error")}get country(){return this.resolveCountry(this.availableCountries)}set country(next){const old=this.country;this.explicitCountry=normalizeCountry(next??""),this.requestUpdate("country",old)}get input(){return this.inputElement}get inputValue(){return this.editableValue}get phoneStatus(){return this.status}get selectionStart(){return this.inputElement?.selectionStart??null}set selectionStart(value){this.inputElement&&(this.inputElement.selectionStart=value??0)}get selectionEnd(){return this.inputElement?.selectionEnd??null}set selectionEnd(value){this.inputElement&&(this.inputElement.selectionEnd=value??0)}get selectionDirection(){return this.inputElement?.selectionDirection}set selectionDirection(value){this.inputElement&&(this.inputElement.selectionDirection=value??"none")}[VALIDITY_ANCHOR](){return this.inputElement??null}get value(){return super.value}set value(next){const raw=next??"",parsed=this.parse(raw);this.applyParsed(raw,parsed)}get availableCountries(){return this.countries??this.adapterCountries}resolveCountry(rows){this.countryCodes?.rows!==rows&&(this.countryCodes={rows,codes:new Set(rows.map(row=>row.code))});const{codes}=this.countryCodes,explicit=normalizeCountry(this.explicitCountry),preferred=normalizeCountry(this.defaultCountry??"");return codes.has(explicit)?explicit:codes.has(preferred)?preferred:rows[0]?.code??""}parse(input){if(!this.adapter)return fallbackParse(input);try{const parse=this.adapter.parse;return typeof parse!="function"?{status:"invalid",formatted:input}:normalizeParseResult(parse.call(this.adapter,input,this.country||void 0),input)}catch{return{status:"invalid",formatted:input}}}reconcileCountryCatalog(){this.explicitCountry=this.resolveCountry(this.availableCountries)}applyParsed(raw,parsed){this.editableValue=parsed.formatted??raw,this.status=parsed.status,parsed.country&&(this.country=normalizeCountry(parsed.country)),super.value=parsed.status==="valid"?parsed.e164:"",this.setAttribute("data-phone-status",parsed.status)}syncFormattedValue(input,digitsBeforeCaret){if(input.value!==this.editableValue&&(input.value=this.editableValue,digitsBeforeCaret!=null)){const position=indexAfterDigits(this.editableValue,digitsBeforeCaret);input.setSelectionRange(position,position)}}get eventDetail(){return{value:super.value,inputValue:this.editableValue,country:this.country,valid:this.internals.validity.valid,status:this.status}}static get observedAttributes(){const attributes=super.observedAttributes;return observeReactivePropertyWrites(this.prototype,["countryLabel","incompleteText","invalidText"],(instance,name,value)=>{const authored=value!=null;let ownershipChanged=!1;switch(name){case"countryLabel":if(instance.countryLabelAuthored===void 0)return;ownershipChanged=authored!==instance.countryLabelAuthored,instance.countryLabelAuthored=authored;break;case"incompleteText":if(instance.incompleteTextAuthored===void 0)return;ownershipChanged=authored!==instance.incompleteTextAuthored,instance.incompleteTextAuthored=authored;break;case"invalidText":if(instance.invalidTextAuthored===void 0)return;ownershipChanged=authored!==instance.invalidTextAuthored,instance.invalidTextAuthored=authored;break}ownershipChanged&&instance.requestUpdate(),name!=="countryLabel"&&instance.hasUpdated&&instance.updateValidity()}),attributes}attributeChangedCallback(name,oldValue,newValue){if(super.attributeChangedCallback(name,oldValue,newValue),newValue===null){if(name==="country-label")this.countryLabelAuthored=!1;else if(name==="incomplete-text")this.incompleteTextAuthored=!1;else if(name==="invalid-text")this.invalidTextAuthored=!1;else return;this.requestUpdate(),this.hasUpdated&&this.updateValidity()}}get effectiveCountryLabel(){return this.countryLabelAuthored?this.countryLabel:this.localize("countryPickerLabel")}effectivePhoneLabel(hasLabel){return this.accessibleLabel!==null?this.accessibleLabel:this.phoneLabel?this.phoneLabel:hasLabel?nothing:this.placeholder||this.localize("phoneInputLabel")}get incompleteMessage(){return(this.incompleteTextAuthored?this.incompleteText:"")||this.localize("phoneInputIncomplete")}get invalidMessage(){return(this.invalidTextAuthored?this.invalidText:"")||this.localize("valueInvalid")}countryName(row){if(row.label)return row.label;try{return getDisplayNames(this.effectiveLocale,{type:"region"}).of(row.code)??row.code}catch{return row.code}}updateValidity(){if(isBarredFromValidation(this,this.internals)){this[SET_ANCHORED_VALIDITY]({});return}const flags={};let message="";this.required&&this.status==="empty"?(flags.valueMissing=!0,message=this.localize("fieldRequired")):this.status==="incomplete"?(flags.badInput=!0,message=this.incompleteMessage):this.status==="invalid"&&(flags.typeMismatch=!0,message=this.invalidMessage),this[SET_ANCHORED_VALIDITY](flags,message)}adoptedCallback(){super.adoptedCallback(),this.hostDescription.adopted()}willUpdate(changed){super.willUpdate(changed),this.flags&&!LyraPhoneInput.flagRegistration&&(LyraPhoneInput.flagRegistration=import("../../media/flag/flag.js").catch(error=>{console.warn("<lr-phone-input> failed to register <lr-flag> for its flags option:",error)})),this.hasUpdated||this.seedFirstRenderState(()=>{this.hasCountryPrefixSlot=Array.from(this.children??[]).some(child=>child.getAttribute("slot")==="country-prefix"||child.getAttribute("slot")==="start"),this.hasEndSlot=Array.from(this.children??[]).some(child=>child.getAttribute("slot")==="end")}),(!this.hasUpdated||changed.has("countries")||changed.has("adapter")||changed.has("country")||changed.has("defaultCountry"))&&this.reconcileCountryCatalog(),(changed.has("adapter")||changed.has("countries")||changed.has("country")||changed.has("defaultCountry"))&&this.editableValue&&this.applyParsed(this.editableValue,this.parse(this.editableValue))}updated(changed){super.updated(changed),changed.has("strings")&&this.updateValidity(),(changed.has("touched")||changed.has("required")||changed.has("value")||changed.has("status"))&&this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid)}commitTypedText(input){const caret=input.selectionStart,digitsBeforeCaret=caret==null?null:digitsBefore(input.value,caret);this.applyParsed(input.value,this.parse(input.value)),this.syncFormattedValue(input,digitsBeforeCaret)}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}click(){this.liveDisabled||this.inputElement?.click()}focus(options){this.liveDisabled||this.inputElement?.focus(options)}blur(){this.inputElement?.blur()}select(){this.inputElement?.select()}setSelectionRange(start,end,direction){this.inputElement?.setSelectionRange(start,end,direction)}setRangeText(replacement,start,end,selectMode){const input=this.inputElement;if(!input)return;setNativeRangeText(input,replacement,start,end,selectMode);const caret=input.selectionStart,digitsBeforeCaret=caret==null?null:digitsBefore(input.value,caret);this.applyParsed(input.value,this.parse(input.value)),this.syncFormattedValue(input,digitsBeforeCaret)}formResetCallback(){this.explicitCountry="",this.reconcileCountryCatalog(),super.formResetCallback(),this.touched=!1}render(){const hasLabel=!!(this.label||this.hasLabelSlot||this.withLabel),hasHint=!!(this.hint||this.hasHintSlot||this.withHint),hasError=!!(this.errorText||this.hasErrorSlot),describedBy=[hasError?this.errorId:"",hasHint?this.hintId:""].filter(Boolean).join(" "),rows=this.availableCountries,country=this.country,current=rows.find(row=>row.code===country),locale=this.effectiveLocale;(this.countryNames?.rows!==rows||this.countryNames.locale!==locale)&&(this.countryNames={rows,locale,names:rows.map(row=>this.countryName(row))});const{names}=this.countryNames;return html`
2
2
  <div part="form-control">
3
3
  <label part="form-control-label" for=${this.inputId} ?hidden=${!hasLabel}>
4
4
  ${this.label}<slot name="label"></slot>
@@ -68,4 +68,4 @@ import{__decorate}from"tslib";import{nativeAutocorrectAttribute,setNativeRangeTe
68
68
  ${this.errorText}<slot name="error"></slot>
69
69
  </div>
70
70
  </div>
71
- `}}__decorate([property({type:Boolean,reflect:!0})],LyraPhoneInput.prototype,"flags",void 0),__decorate([property({attribute:!1})],LyraPhoneInput.prototype,"adapter",null),__decorate([property({attribute:!1})],LyraPhoneInput.prototype,"countries",null),__decorate([property({attribute:"default-country"})],LyraPhoneInput.prototype,"defaultCountry",void 0),__decorate([property()],LyraPhoneInput.prototype,"label",void 0),__decorate([property()],LyraPhoneInput.prototype,"hint",void 0),__decorate([property({attribute:"error-text"})],LyraPhoneInput.prototype,"errorText",void 0),__decorate([property({type:Boolean,attribute:"with-label"})],LyraPhoneInput.prototype,"withLabel",void 0),__decorate([property({type:Boolean,attribute:"with-hint"})],LyraPhoneInput.prototype,"withHint",void 0),__decorate([property()],LyraPhoneInput.prototype,"placeholder",void 0),__decorate([property({reflect:!0,converter:declaredDefaultConverter("m")})],LyraPhoneInput.prototype,"size",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraPhoneInput.prototype,"pill",void 0),__decorate([property({reflect:!0})],LyraPhoneInput.prototype,"appearance",void 0),__decorate([property({attribute:"aria-label"})],LyraPhoneInput.prototype,"accessibleLabel",void 0),__decorate([property({attribute:"country-label",useDefault:!0})],LyraPhoneInput.prototype,"countryLabel",void 0),__decorate([property({attribute:"phone-label"})],LyraPhoneInput.prototype,"phoneLabel",void 0),__decorate([property({attribute:"incomplete-text",useDefault:!0})],LyraPhoneInput.prototype,"incompleteText",void 0),__decorate([property({attribute:"invalid-text",useDefault:!0})],LyraPhoneInput.prototype,"invalidText",void 0),__decorate([property({useDefault:!0})],LyraPhoneInput.prototype,"autocomplete",void 0),__decorate([property({attribute:"inputmode",useDefault:!0})],LyraPhoneInput.prototype,"inputMode",void 0),__decorate([property({attribute:"enterkeyhint"})],LyraPhoneInput.prototype,"enterKeyHint",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraPhoneInput.prototype,"readonly",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraPhoneInput.prototype,"autofocus",void 0),__decorate([property({converter:spellcheckConverter})],LyraPhoneInput.prototype,"spellcheck",void 0),__decorate([property()],LyraPhoneInput.prototype,"autocapitalize",void 0),__decorate([property({converter:autocorrectConverter})],LyraPhoneInput.prototype,"autocorrect",null),__decorate([query('input[part="input"]')],LyraPhoneInput.prototype,"inputElement",void 0),__decorate([state()],LyraPhoneInput.prototype,"editableValue",void 0),__decorate([state()],LyraPhoneInput.prototype,"status",void 0),__decorate([state()],LyraPhoneInput.prototype,"touched",void 0),__decorate([state()],LyraPhoneInput.prototype,"hasCountryPrefixSlot",void 0),__decorate([state()],LyraPhoneInput.prototype,"hasEndSlot",void 0);export{LyraPhoneInput,loadLibphonenumberAdapter};
71
+ `}}__decorate([property({type:Boolean,reflect:!0})],LyraPhoneInput.prototype,"flags",void 0),__decorate([property({attribute:!1})],LyraPhoneInput.prototype,"adapter",null),__decorate([property({attribute:!1})],LyraPhoneInput.prototype,"countries",null),__decorate([property({attribute:"default-country"})],LyraPhoneInput.prototype,"defaultCountry",void 0),__decorate([property()],LyraPhoneInput.prototype,"label",void 0),__decorate([property({attribute:"label-display",reflect:!0})],LyraPhoneInput.prototype,"labelDisplay",void 0),__decorate([property()],LyraPhoneInput.prototype,"hint",void 0),__decorate([property({attribute:"error-text"})],LyraPhoneInput.prototype,"errorText",void 0),__decorate([property({type:Boolean,attribute:"with-label"})],LyraPhoneInput.prototype,"withLabel",void 0),__decorate([property({type:Boolean,attribute:"with-hint"})],LyraPhoneInput.prototype,"withHint",void 0),__decorate([property()],LyraPhoneInput.prototype,"placeholder",void 0),__decorate([property({reflect:!0,converter:declaredDefaultConverter("m")})],LyraPhoneInput.prototype,"size",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraPhoneInput.prototype,"pill",void 0),__decorate([property({reflect:!0})],LyraPhoneInput.prototype,"appearance",void 0),__decorate([property({attribute:"aria-label"})],LyraPhoneInput.prototype,"accessibleLabel",void 0),__decorate([property({attribute:"country-label",useDefault:!0})],LyraPhoneInput.prototype,"countryLabel",void 0),__decorate([property({attribute:"phone-label"})],LyraPhoneInput.prototype,"phoneLabel",void 0),__decorate([property({attribute:"incomplete-text",useDefault:!0})],LyraPhoneInput.prototype,"incompleteText",void 0),__decorate([property({attribute:"invalid-text",useDefault:!0})],LyraPhoneInput.prototype,"invalidText",void 0),__decorate([property({useDefault:!0})],LyraPhoneInput.prototype,"autocomplete",void 0),__decorate([property({attribute:"inputmode",useDefault:!0})],LyraPhoneInput.prototype,"inputMode",void 0),__decorate([property({attribute:"enterkeyhint"})],LyraPhoneInput.prototype,"enterKeyHint",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraPhoneInput.prototype,"readonly",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraPhoneInput.prototype,"autofocus",void 0),__decorate([property({converter:spellcheckConverter})],LyraPhoneInput.prototype,"spellcheck",void 0),__decorate([property()],LyraPhoneInput.prototype,"autocapitalize",void 0),__decorate([property({converter:autocorrectConverter})],LyraPhoneInput.prototype,"autocorrect",null),__decorate([query('input[part="input"]')],LyraPhoneInput.prototype,"inputElement",void 0),__decorate([state()],LyraPhoneInput.prototype,"editableValue",void 0),__decorate([state()],LyraPhoneInput.prototype,"status",void 0),__decorate([state()],LyraPhoneInput.prototype,"touched",void 0),__decorate([state()],LyraPhoneInput.prototype,"hasCountryPrefixSlot",void 0),__decorate([state()],LyraPhoneInput.prototype,"hasEndSlot",void 0);export{LyraPhoneInput,loadLibphonenumberAdapter};
@@ -1 +1 @@
1
- import{css}from"lit";import{formControlTextWrap,formControlAppearance,formControlFocusHalo,formControlRequiredMarker}from"../../../internal/form-control.styles.js";const styles=css` :host { display: block; min-inline-size: 0; --_lr-phone-input-padding-block-default: var(--lr-form-control-padding-block); --_lr-phone-input-font-size-default: var(--lr-font-size-md-sm); --_lr-phone-input-flag-size-default: var(--lr-font-size-lg); --_lr-phone-input-glyph-size-default: var(--lr-font-size-md-sm); --_lr-phone-input-gap-default: var(--lr-space-xs); --_lr-phone-input-radius-default: var(--lr-radius); --_lr-phone-input-control-min-height-default: var(--lr-form-control-height); --_lr-form-control-focus-shadow: var(--lr-form-control-focus-shadow, none); --_lr-phone-input-fill-default: var(--_lr-form-control-fill); --_lr-phone-input-border-color-default: var(--_lr-form-control-border-color); } ${formControlAppearance} :host([pill]) { --_lr-phone-input-radius-default: var(--lr-radius-pill); } :host([size='2xs']) { --_lr-phone-input-font-size-default: var(--lr-font-size-2xs); --_lr-phone-input-flag-size-default: var(--lr-font-size-sm); --_lr-phone-input-glyph-size-default: var(--lr-font-size-2xs); } :host([size='xs']) { --_lr-phone-input-font-size-default: var(--lr-font-size-xs); --_lr-phone-input-flag-size-default: var(--lr-font-size-md-sm); --_lr-phone-input-glyph-size-default: var(--lr-font-size-xs); } :host([size='s']), :host([size='small']) { --_lr-phone-input-font-size-default: var(--lr-font-size-sm); --_lr-phone-input-flag-size-default: var(--lr-font-size-m); --_lr-phone-input-glyph-size-default: var(--lr-font-size-sm); } :host([size='l']), :host([size='large']) { --_lr-phone-input-font-size-default: var(--lr-font-size-lg); --_lr-phone-input-flag-size-default: var(--lr-font-size-xl); --_lr-phone-input-glyph-size-default: var(--lr-font-size-lg); } :host([size='xl']) { --_lr-phone-input-font-size-default: var(--lr-font-size-xl); --_lr-phone-input-flag-size-default: var(--lr-font-size-2xl); --_lr-phone-input-glyph-size-default: var(--lr-font-size-xl); } [part='form-control'] { min-inline-size: 0; } [part='form-control-label'] { display: block; margin-block-end: var(--lr-space-xs); color: var(--lr-color-text); font-size: var(--lr-font-size-md-sm); font-weight: var(--lr-font-weight-semibold); } [part='form-control-label'][hidden], [part='country-prefix'][hidden], [part='end'][hidden], [part='hint'][hidden], [part='error'][hidden] { display: none; } ${formControlRequiredMarker} [part='input-wrapper'] { display: flex; align-items: center; box-sizing: border-box; min-inline-size: 0; inline-size: 100%; min-block-size: var(--lr-phone-input-control-height, var(--lr-phone-input-control-min-height, var(--_lr-phone-input-control-min-height-default))); block-size: var(--lr-phone-input-control-height, auto); font-size: var(--lr-phone-input-font-size, var(--_lr-phone-input-font-size-default)); border: var(--lr-border-width-thin) solid var(--lr-phone-input-border-color, var(--_lr-phone-input-border-color-default)); border-radius: var(--lr-phone-input-radius, var(--_lr-phone-input-radius-default)); background: var(--lr-phone-input-fill, var(--_lr-phone-input-fill-default)); color: var(--lr-color-text); } [part='input-wrapper']:focus-within { border-color: var(--lr-phone-input-focus-border-color, var(--lr-color-brand)); ${formControlFocusHalo} } :host([data-invalid]) [part='input-wrapper'] { border-color: var( --lr-phone-input-invalid-border-color, var(--lr-phone-input-border-color, var(--_lr-phone-input-border-color-default)) ); } :host(:disabled) [part='input-wrapper'] { cursor: not-allowed; opacity: var(--lr-opacity-disabled); } [part='country-prefix'] { display: inline-flex; flex: 0 0 auto; align-items: center; padding-inline-start: var(--lr-space-s); } [part='country'] { position: relative; display: inline-flex; align-items: stretch; flex: 0 0 auto; align-self: stretch; min-block-size: var(--lr-icon-button-size); border-inline-end: var(--lr-border-width-thin) solid var(--lr-color-border); } [part='country-select'] { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; margin: 0; padding: 0; border: none; appearance: none; opacity: 0; color: inherit; font: inherit; cursor: pointer; } [part='country-select']:disabled { cursor: not-allowed; } [part='country-select'] option { background: var(--lr-color-surface); color: var(--lr-color-text); } [part='country-trigger'] { display: inline-flex; align-items: center; gap: var(--lr-phone-input-gap, var(--_lr-phone-input-gap-default)); padding-inline: var(--lr-space-s); border-start-start-radius: var(--lr-phone-input-radius, var(--_lr-phone-input-radius-default)); border-end-start-radius: var(--lr-phone-input-radius, var(--_lr-phone-input-radius-default)); transition: background-color var(--lr-transition-fast); } [part='country-select']:not(:disabled):hover + [part='country-trigger'] { background: var(--lr-phone-input-country-hover-bg, var(--lr-color-brand-quiet)); } [part='country-select']:not(:disabled):active + [part='country-trigger'] { background: color-mix( in oklab, var(--lr-phone-input-country-hover-bg, var(--lr-color-brand-quiet)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part='country-select']:focus-visible + [part='country-trigger'] { outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color); outline-offset: calc(-1 * var(--lr-focus-ring-width)); } [part='flag'] { font-size: var(--lr-phone-input-flag-size, var(--_lr-phone-input-flag-size-default)); } [part='country-code'] { font-size: var(--lr-phone-input-font-size, var(--_lr-phone-input-font-size-default)); font-weight: var(--lr-font-weight-semibold); } [part='country-code'][data-placeholder] { color: var(--lr-color-text-quiet); font-weight: var(--lr-font-weight-normal); } [part='expand-icon'] { display: inline-flex; align-items: center; justify-content: center; color: var(--lr-color-text-quiet); font-size: var(--lr-phone-input-glyph-size, var(--_lr-phone-input-glyph-size-default)); line-height: var(--lr-line-height-none); } [part='expand-icon'] svg { transform: rotate(90deg); } [part='input']:focus { outline: none; } [part='calling-code'] { flex: 0 0 auto; padding-inline-start: var(--lr-space-s); color: var(--lr-color-text-quiet); direction: ltr; font-size: var(--lr-phone-input-font-size, var(--_lr-phone-input-font-size-default)); unicode-bidi: isolate; } [part='input'] { flex: 1 1 auto; min-inline-size: 0; inline-size: 100%; padding-block: var(--lr-phone-input-padding-block, var(--_lr-phone-input-padding-block-default)); padding-inline: var(--lr-space-s); border: none; background: transparent; color: inherit; font: inherit; text-align: start; } [part='input']::placeholder { color: var(--lr-color-text-quiet); } [part='end'] { display: inline-flex; flex: 0 0 auto; align-items: center; padding-inline-end: var(--lr-space-s); } [part='hint'], [part='error'] { margin-block-start: var(--lr-space-xs); font-size: var(--lr-font-size-sm); } [part='hint'] { color: var(--lr-color-text-quiet); } [part='error'] { color: var(--lr-color-danger); } @media (forced-colors: active) { [part='country-select']:not(:disabled):hover + [part='country-trigger'] { outline-color: Highlight; outline-style: dashed; outline-width: var(--lr-border-width-thin); outline-offset: calc(-1 * var(--lr-border-width-thin)); } [part='country-select']:not(:disabled):active + [part='country-trigger'] { outline-color: Highlight; outline-style: solid; outline-width: var(--lr-border-width-thick); outline-offset: calc(-1 * var(--lr-border-width-thick)); } } [part='form-control'], [part='form-control-label'], [part='hint'], [part='error'] { ${formControlTextWrap} } `;export{styles};
1
+ import{css}from"lit";import{formControlTextWrap,formControlAppearance,formControlFocusHalo,formControlRequiredMarker,formControlLabelDisplay}from"../../../internal/form-control.styles.js";const styles=css` :host { display: block; min-inline-size: 0; --_lr-phone-input-padding-block-default: var(--lr-form-control-padding-block); --_lr-phone-input-font-size-default: var(--lr-font-size-md-sm); --_lr-phone-input-flag-size-default: var(--lr-font-size-lg); --_lr-phone-input-glyph-size-default: var(--lr-font-size-md-sm); --_lr-phone-input-gap-default: var(--lr-space-xs); --_lr-phone-input-radius-default: var(--lr-radius); --_lr-phone-input-control-min-height-default: var(--lr-form-control-height); --_lr-form-control-focus-shadow: var(--lr-form-control-focus-shadow, none); --_lr-phone-input-fill-default: var(--_lr-form-control-fill); --_lr-phone-input-border-color-default: var(--_lr-form-control-border-color); } ${formControlAppearance} :host([pill]) { --_lr-phone-input-radius-default: var(--lr-radius-pill); } :host([size='2xs']) { --_lr-phone-input-font-size-default: var(--lr-font-size-2xs); --_lr-phone-input-flag-size-default: var(--lr-font-size-sm); --_lr-phone-input-glyph-size-default: var(--lr-font-size-2xs); } :host([size='xs']) { --_lr-phone-input-font-size-default: var(--lr-font-size-xs); --_lr-phone-input-flag-size-default: var(--lr-font-size-md-sm); --_lr-phone-input-glyph-size-default: var(--lr-font-size-xs); } :host([size='s']), :host([size='small']) { --_lr-phone-input-font-size-default: var(--lr-font-size-sm); --_lr-phone-input-flag-size-default: var(--lr-font-size-m); --_lr-phone-input-glyph-size-default: var(--lr-font-size-sm); } :host([size='l']), :host([size='large']) { --_lr-phone-input-font-size-default: var(--lr-font-size-lg); --_lr-phone-input-flag-size-default: var(--lr-font-size-xl); --_lr-phone-input-glyph-size-default: var(--lr-font-size-lg); } :host([size='xl']) { --_lr-phone-input-font-size-default: var(--lr-font-size-xl); --_lr-phone-input-flag-size-default: var(--lr-font-size-2xl); --_lr-phone-input-glyph-size-default: var(--lr-font-size-xl); } [part='form-control'] { min-inline-size: 0; } [part='form-control-label'] { display: block; margin-block-end: var(--lr-space-xs); color: var(--lr-color-text); font-size: var(--lr-font-size-md-sm); font-weight: var(--lr-font-weight-semibold); } [part='form-control-label'][hidden], [part='country-prefix'][hidden], [part='end'][hidden], [part='hint'][hidden], [part='error'][hidden] { display: none; } ${formControlRequiredMarker} ${formControlLabelDisplay} [part='input-wrapper'] { display: flex; align-items: center; box-sizing: border-box; min-inline-size: 0; inline-size: 100%; min-block-size: var(--lr-phone-input-control-height, var(--lr-phone-input-control-min-height, var(--_lr-phone-input-control-min-height-default))); block-size: var(--lr-phone-input-control-height, auto); font-size: var(--lr-phone-input-font-size, var(--_lr-phone-input-font-size-default)); border: var(--lr-border-width-thin) solid var(--lr-phone-input-border-color, var(--_lr-phone-input-border-color-default)); border-radius: var(--lr-phone-input-radius, var(--_lr-phone-input-radius-default)); background: var(--lr-phone-input-fill, var(--_lr-phone-input-fill-default)); color: var(--lr-color-text); } [part='input-wrapper']:focus-within { border-color: var(--lr-phone-input-focus-border-color, var(--lr-color-brand)); ${formControlFocusHalo} } :host([data-invalid]) [part='input-wrapper'] { border-color: var( --lr-phone-input-invalid-border-color, var(--lr-phone-input-border-color, var(--_lr-phone-input-border-color-default)) ); } :host(:disabled) [part='input-wrapper'] { cursor: not-allowed; opacity: var(--lr-opacity-disabled); } [part='country-prefix'] { display: inline-flex; flex: 0 0 auto; align-items: center; padding-inline-start: var(--lr-space-s); } [part='country'] { position: relative; display: inline-flex; align-items: stretch; flex: 0 0 auto; align-self: stretch; min-block-size: var(--lr-icon-button-size); border-inline-end: var(--lr-border-width-thin) solid var(--lr-color-border); } [part='country-select'] { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; margin: 0; padding: 0; border: none; appearance: none; opacity: 0; color: inherit; font: inherit; cursor: pointer; } [part='country-select']:disabled { cursor: not-allowed; } [part='country-select'] option { background: var(--lr-color-surface); color: var(--lr-color-text); } [part='country-trigger'] { display: inline-flex; align-items: center; gap: var(--lr-phone-input-gap, var(--_lr-phone-input-gap-default)); padding-inline: var(--lr-space-s); border-start-start-radius: var(--lr-phone-input-radius, var(--_lr-phone-input-radius-default)); border-end-start-radius: var(--lr-phone-input-radius, var(--_lr-phone-input-radius-default)); transition: background-color var(--lr-transition-fast); } [part='country-select']:not(:disabled):hover + [part='country-trigger'] { background: var(--lr-phone-input-country-hover-bg, var(--lr-color-brand-quiet)); } [part='country-select']:not(:disabled):active + [part='country-trigger'] { background: color-mix( in oklab, var(--lr-phone-input-country-hover-bg, var(--lr-color-brand-quiet)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part='country-select']:focus-visible + [part='country-trigger'] { outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color); outline-offset: calc(-1 * var(--lr-focus-ring-width)); } [part='flag'] { font-size: var(--lr-phone-input-flag-size, var(--_lr-phone-input-flag-size-default)); } [part='country-code'] { font-size: var(--lr-phone-input-font-size, var(--_lr-phone-input-font-size-default)); font-weight: var(--lr-font-weight-semibold); } [part='country-code'][data-placeholder] { color: var(--lr-color-text-quiet); font-weight: var(--lr-font-weight-normal); } [part='expand-icon'] { display: inline-flex; align-items: center; justify-content: center; color: var(--lr-color-text-quiet); font-size: var(--lr-phone-input-glyph-size, var(--_lr-phone-input-glyph-size-default)); line-height: var(--lr-line-height-none); } [part='expand-icon'] svg { transform: rotate(90deg); } [part='input']:focus { outline: none; } [part='calling-code'] { flex: 0 0 auto; padding-inline-start: var(--lr-space-s); color: var(--lr-color-text-quiet); direction: ltr; font-size: var(--lr-phone-input-font-size, var(--_lr-phone-input-font-size-default)); unicode-bidi: isolate; } [part='input'] { flex: 1 1 auto; min-inline-size: 0; inline-size: 100%; padding-block: var(--lr-phone-input-padding-block, var(--_lr-phone-input-padding-block-default)); padding-inline: var(--lr-space-s); border: none; background: transparent; color: inherit; font: inherit; text-align: start; } [part='input']::placeholder { color: var(--lr-color-text-quiet); } [part='end'] { display: inline-flex; flex: 0 0 auto; align-items: center; padding-inline-end: var(--lr-space-s); } [part='hint'], [part='error'] { margin-block-start: var(--lr-space-xs); font-size: var(--lr-font-size-sm); } [part='hint'] { color: var(--lr-color-text-quiet); } [part='error'] { color: var(--lr-color-danger); } @media (forced-colors: active) { [part='country-select']:not(:disabled):hover + [part='country-trigger'] { outline-color: Highlight; outline-style: dashed; outline-width: var(--lr-border-width-thin); outline-offset: calc(-1 * var(--lr-border-width-thin)); } [part='country-select']:not(:disabled):active + [part='country-trigger'] { outline-color: Highlight; outline-style: solid; outline-width: var(--lr-border-width-thick); outline-offset: calc(-1 * var(--lr-border-width-thick)); } } [part='form-control'], [part='form-control-label'], [part='hint'], [part='error'] { ${formControlTextWrap} } `;export{styles};
@@ -1,4 +1,4 @@
1
- import{type TemplateResult,type PropertyValues}from'lit';import type{Placement}from'@floating-ui/dom';import{LyraElement,type LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{LyraFormControlElement}from'../../../internal/form-control-element.js';import type{PlaceStrategy,PlaceSync}from'../../../internal/positioner.js';import type{LyraPickerDetailValue,LyraPickerValue}from'../../../internal/picker-value.js';import type{LyraAppearance,LyraSize}from'../../../internal/variants.js';import type{LyraOption}from'../combobox/option.class.js';import'../combobox/option.class.js';import{type FormOwnerValue}from'../../../internal/form-associated.js';import{type LyraFormValidator}from'../form-validator.js';
1
+ import{type TemplateResult,type PropertyValues}from'lit';import type{Placement}from'@floating-ui/dom';import{LyraElement,type LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{LyraFormControlElement}from'../../../internal/form-control-element.js';import type{PlaceStrategy,PlaceSync}from'../../../internal/positioner.js';import type{LyraPickerDetailValue,LyraPickerValue}from'../../../internal/picker-value.js';import type{LyraAppearance,LyraSize,LyraLabelDisplay}from'../../../internal/variants.js';import type{LyraOption}from'../combobox/option.class.js';import'../combobox/option.class.js';import{type FormOwnerValue}from'../../../internal/form-associated.js';import{type LyraFormValidator}from'../form-validator.js';
2
2
  /** Re-exported so a consumer importing only the select subpath can still name the shared
3
3
  * positioning vocabulary `positioningStrategy` uses. */
4
4
  export type{LyraPickerDetailValue,LyraPickerValue,PlaceStrategy};
@@ -336,7 +336,14 @@ static get validators():LyraFormValidator<LyraSelect>[];static formAssociated:bo
336
336
  placeholder:string;
337
337
  /** Visible label. A host `aria-label` wins on the internal trigger by attribute presence,
338
338
  * including an explicitly empty value that suppresses this label's naming fallback. */
339
- label:string;hint:string;
339
+ label:string;
340
+ /**
341
+ * Whether the `label` renders on screen. `hidden` keeps the label as the accessible name but
342
+ * removes it visually (compact toolbars, table cells); hint, error and required semantics are
343
+ * unaffected. Reflected so styles and `[label-display]` selectors match.
344
+ * @attr label-display
345
+ */
346
+ labelDisplay:LyraLabelDisplay;hint:string;
340
347
  /** Shoelace alias for {@link hint}. `hint` wins when both are present.*/
341
348
  helpText:string;
342
349
  /** SSR slot-presence hints for pre-hydration form chrome.*/
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{capOptionRows}from"../../../internal/option-selection.js";import{requestThenCommit}from"../../../internal/request-commit.js";import{VetoWriteGuard,markVetoGuardWrite}from"../../../internal/veto-write-guard.js";import{renderFormControlHintError}from"../../../internal/form-control-template.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";import{FormControlController,reflectFormName}from"../../../internal/form-control-controller.js";import{GlassScrollLayer}from"../../../internal/glass-scroll-layer.js";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{acquireNativeControlDescription}from"../../../internal/native-control-description.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{LyraFormControlElement}from"../../../internal/form-control-element.js";import{deferredPlaceReady as place,syncTopLayerRelease,topLayerPlacement}from"../../../internal/anchored-overlay-runtime.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{nextId,srOnly}from"../../../internal/a11y.js";import{activateNonmodalOverlay}from"../../../internal/nonmodal-overlay-manager.js";import{chevronIcon,closeIcon}from"../../../internal/icons.js";import{VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{setCustomState,syncValidityStates}from"../../../internal/custom-states.js";import{PopupController,emitPopupEvent}from"../../../internal/popup-controller.js";import{revealRow}from"../../../internal/reveal-row.js";import{TypeAheadBuffer}from"../../../internal/type-ahead-buffer.js";import{resolveListMove}from"../../../internal/list-navigation.js";import{finiteCount}from"../../../internal/numbers.js";import{getNumberFormat,resolveIntlLocale}from"../../../internal/intl-cache.js";import{renderInertPresentation}from"../../../internal/inert-presentation.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{styles}from"./select.styles.js";import{sizes}from"../../../internal/sizes.styles.js";import"../combobox/option.class.js";import{sanitizeCssColor}from"../../../internal/safe-css.js";import{dispatchNativeEvent,dispatchNativeInputEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{omittedEmptyStringConverter,optionalLiteralSetConverter}from"../../../internal/converters.js";import{getFormOwner,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{isOptionSelectedDirty,isOptionSelectedWrite,wasOptionInitiallySelected,RESET_OPTION_SELECTED_FROM_OWNER,SET_OPTION_SELECTED_FROM_OWNER}from"../../../internal/option-selection.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{tag}from"../../../internal/prefix.js";import{currentValidityValidator}from"../form-validator.js";import{LYRA_DEFAULT_selectSelectedOverflow,LYRA_DEFAULT_selectValueMissing}from"../../../internal/default-strings/forms.generated.js";import{LYRA_DEFAULT_clear,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_loading,LYRA_DEFAULT_notInCatalog,LYRA_DEFAULT_removeWithContext,LYRA_DEFAULT_select}from"../../../internal/default-strings/shared.generated.js";installFormControlLabelSupport();function isLyraOptionElement(value){return isHtmlElement(value)&&value.localName===tag("option")}function normalizeSelectionValues(next){return Array.isArray(next)?next.filter(value=>typeof value=="string"):typeof next=="string"?[next]:[]}const POSITIONING_STRATEGY=optionalLiteralSetConverter(["absolute","fixed"]);class LyraSelect extends LyraFormControlElement{static{this.defaultStrings={...super.defaultStrings,clear:LYRA_DEFAULT_clear,fieldRequired:LYRA_DEFAULT_fieldRequired,loading:LYRA_DEFAULT_loading,notInCatalog:LYRA_DEFAULT_notInCatalog,removeWithContext:LYRA_DEFAULT_removeWithContext,select:LYRA_DEFAULT_select,selectSelectedOverflow:LYRA_DEFAULT_selectSelectedOverflow,selectValueMissing:LYRA_DEFAULT_selectValueMissing}}static{this.collectionSupport=collectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-input","lr-change","lr-change-request"])}static{this.identityEventDetailCollectionItems=Object.freeze({"lr-input":Object.freeze(["data"]),"lr-change":Object.freeze(["data"]),"lr-change-request":Object.freeze(["data"])})}static get validators(){return[currentValidityValidator("required","disabled","value","multiple")]}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,sizes,styles,srOnly]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},multiple:{type:Boolean,reflect:!0,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0},value:{noAccessor:!0},name:{reflect:!0,noAccessor:!0,converter:omittedEmptyStringConverter},maxOptionsVisible:{type:Number,attribute:"max-options-visible",noAccessor:!0},defaultValue:{attribute:"default-value",noAccessor:!0}}}get open(){return this._open}set open(next){const requested=!!next,normalized=requested&&!this.effectiveDisabled;if(normalized===this._open){requested!==normalized&&this.hasAttribute("open")&&this.removeAttribute("open");return}this.applyOpenState(normalized)}get positioningStrategy(){return this._positioningStrategy??"absolute"}set positioningStrategy(next){const normalized=POSITIONING_STRATEGY.normalize(next)??"absolute",old=this.positioningStrategy;this._positioningStrategy=normalized,normalized!==old&&(this.requestUpdate("positioningStrategy",old),old==="fixed"!=(normalized==="fixed")&&this.requestUpdate("hoist",old==="fixed"))}get hoist(){return this.positioningStrategy==="fixed"}set hoist(next){this.positioningStrategy=next?"fixed":"absolute"}requestUpdate(...args){args[0]===void 0&&(this.callbackRefreshEpoch=(this.callbackRefreshEpoch??0)+1),super.requestUpdate(...args)}memoOption(key,inputs,compute){const previous=this.optionMemo.get(key);if(previous&&previous.inputs.length===inputs.length&&previous.inputs.every((input,index)=>Object.is(input,inputs[index])))return previous.value;const value=compute();return this.optionMemo.set(key,{inputs,value}),value}get optionIndex(){return this.memoOption("index",[this.options],()=>{const values=new Map,positions=new Map;return this.options.forEach((option,index)=>{positions.set(option,index),values.has(option.value)||values.set(option.value,option)}),{values,positions,members:new Set(this.options)}})}get selectedIndex(){return this.memoOption("selectedIndex",[this._selectedOptions,this.options],()=>{const values=new Map;for(const option of this._selectedOptions)values.has(option.value)||values.set(option.value,option);return{values,members:new Set(this._selectedOptions)}})}focus(options){this.effectiveDisabled||this.triggerElement?.focus(options)}blur(){this.triggerElement?.blur()}click(){this.effectiveDisabled||this.triggerElement?.click()}constructor(){super(),this.placeholder="",this.label="",this.hint="",this.helpText="",this.withLabel=!1,this.withHint=!1,this.errorText="",this.autofocus=!1,this.title="",this._open=!1,this.size="m",this.appearance="outlined",this.pill=!1,this.placement="bottom",this.topLayer=!1,this.filled=!1,this.withClear=!1,this.clearable=!1,this.withUnknownOption=!1,this.loading=!1,this.autoCommitSingleOption=!1,this.activeIndex=-1,this.maxRender=200,this.options=[],this.callbackRefreshEpoch=0,this.optionMemo=new Map,this.optionsObserved=!1,this.touched=!1,this.hasInteracted=!1,this.slotPresence=new SlotPresenceController(this),this._fieldsetDisabled=!1,this.listId=nextId("select-list"),this.triggerId=nextId("select-trigger"),this.valueTextId=nextId("select-value"),this.positioningReady=Promise.resolve(!1),this.restoreFocusOnClose=!0,this.popupController=new PopupController({host:this,popup:()=>this.renderRoot.querySelector('[part="listbox"]'),emit:(name,cancelable)=>emitPopupEvent(this,name,cancelable),onPointer:event=>this.onDocPointer(event)}),this.listboxHidden=!0,this.listboxRendered=!1,this.listboxPositioned=!1,this._isFirstUpdate=!0,this.openVetoed=!1,this.previousValue="",this.openStateGeneration=0,this._selected=[],this._selectedOptions=[],this._selectedValuesByOption=new Map,this.adornmentClones=new WeakMap,this._multiple=!1,this._disabled=!1,this._required=!1,this._defaultSelected=[],this._defaultSelectedOptions=[],this._defaultCaptured=!1,this._valueDirty=!1,this._restoredStateActive=!1,this._resolvingPendingInitialSelection=!1,this._defaultValueDirty=!1,this.typeBuffer=new TypeAheadBuffer(this),this._name="",this._maxOptionsVisible=3,this.localDescriptionIds="",this.markInteracted=()=>{this.touched=!0,!this.hasInteracted&&(this.hasInteracted=!0,this.reflectValidityStates())},this.collectOptions=e=>{this.collectOptionsFromSlot(e.target)},this.unknownOptionCache=new Map,this.pendingSelectedWrites=new Map,this.selectedWritesQueued=!1,this.optionRefreshPending=!1,this.onOptionChange=e=>{e.stopPropagation();const option=e.composedPath().find(isLyraOptionElement);if(isOptionSelectedWrite(e)&&isLyraOptionElement(option)&&this.optionIndex.members.has(option)){markVetoGuardWrite(this.selectionWriteGuard),this._valueDirty=!0,this._restoredStateActive=!1,this.pendingSelectedWrites.delete(option),this.pendingSelectedWrites.set(option,{selected:option.selected,value:option.value}),this.selectedWritesQueued||(this.selectedWritesQueued=!0,queueMicrotask(()=>this.flushSelectedWrites()));return}if(isLyraOptionElement(option)){const cached=this.adornmentClones.get(option);cached&&cached.markup!==this.adornmentMarkup(option)&&this.adornmentClones.delete(option)}if(this.optionRefreshPending)return;this.optionRefreshPending=!0;const previousActive=this.activeOption,previousActiveRawIndex=previousActive?this.options.indexOf(previousActive):this.activeIndex;queueMicrotask(()=>{this.optionRefreshPending=!1,this.refreshOptionDefaults(),this.reflectSelected(),this.options=[...this.options],this.reconcileActiveOption(previousActive,previousActiveRawIndex)})},this.onDocPointer=e=>{if(!e.composedPath().includes(this)){if(this.overlayHandle?.isActive()){this.overlayHandle.dismissBackdrop();return}this.restoreFocusOnClose=!1,this.hide()}},this.selectionWriteGuard=new VetoWriteGuard,this.selectionRequestDispatching=!1,this.onTriggerClick=()=>{if(!this.effectiveDisabled){if(this.onlyOption)return this.selectOption(this.onlyOption);this.open?this.hide():this.show()}},this.onTriggerBlur=event=>{this.effectiveDisabled||(this.touched=!0,this.hasInteracted=!0,this.reflectValidityStates()),this.open&&(this.restoreFocusOnClose=!1),this.hide(),relayNativeEvent(this,event)},this.onTriggerFocus=event=>{relayNativeEvent(this,event)},this.onKeyDown=e=>{if(e.isComposing||e.keyCode===229)return;const navigable=this.navigableOptions(),move=()=>resolveListMove(e,{count:navigable.length,current:this.activeIndex,orientation:"vertical",wrap:!1,clamp:!0,backwardFromMissing:"first"});switch(e.key){case"ArrowDown":if(e.preventDefault(),this.onlyOption)return this.selectOption(this.onlyOption);if(!this.open){this.show();return}this.setActiveIndex(move()??-1,navigable);break;case"ArrowUp":if(e.preventDefault(),this.onlyOption)return this.selectOption(this.onlyOption);if(!this.open){this.show();return}this.setActiveIndex(move()??-1,navigable);break;case"Enter":case" ":if(this.open){e.preventDefault();const active=navigable[this.activeIndex];this.activeIndex>=0&&active?this.selectOption(active):this.hide()}break;case"Escape":this.open&&(!this.overlayHandle?.isActive()||this.overlayHandle.isTopmost())&&(e.preventDefault(),this.hide());break;case"Home":this.open&&(e.preventDefault(),this.setActiveIndex(move()??-1,navigable));break;case"End":this.open&&(e.preventDefault(),this.setActiveIndex(move()??-1,navigable));break;case"Backspace":case"Delete":this.multiple&&this._selected.length>0&&(e.preventDefault(),this.removeValueAt(this._selected.length-1));break;default:this.typeBuffer.accepts(e)&&this.typeAhead(e.key);break}},this.onListboxMouseDown=e=>{e.preventDefault()},this.onListboxClick=e=>{const optionEl=e.target.closest('[part="option"]'),index=Number(optionEl?.dataset.index);if(!Number.isInteger(index))return;const option=this.listboxOptions[index];option&&this.selectOption(option)},this.validityController=new FormControlController(this,{invalid:init=>this.emit("lr-invalid",null,init),interacted:this.markInteracted,customError:()=>this.validityController.customValidityMessage}),this.internals=this.validityController.formInternals,new GlassScrollLayer(this,'[part="listbox"]',()=>this.open),this.syncFormValue()}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}[VALIDITY_ANCHOR](){return this.renderRoot?.querySelector('[part="trigger"]')??null}syncExternalDescription(){if(!this.isConnected)return;const target=this.renderRoot.querySelector('[part="trigger"]');target&&(this.externalDescriptionLease?this.externalDescriptionLease.update(target):this.externalDescriptionLease=acquireNativeControlDescription(this,target,()=>this.localDescriptionIds))}releaseExternalDescription(){this.externalDescriptionLease?.release(),this.externalDescriptionLease=void 0}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.syncExternalDescription(),this.updateValidity(),this.hasUpdated&&this.open&&queueMicrotask(()=>this.reconnectOpenPopup())}willUpdate(changed){if(super.willUpdate(changed),this._isFirstUpdate=!this.hasUpdated,this._isFirstUpdate&&(this._pendingInitialDefaultValue!==void 0||this._pendingInitialValue!==void 0)){this._resolvingPendingInitialSelection=!0;try{if(this._pendingInitialDefaultValue!==void 0){const pending=this._pendingInitialDefaultValue;this._pendingInitialDefaultValue=void 0,this.assignDefaultValue(pending)}if(this._pendingInitialValue!==void 0){const pending=this._pendingInitialValue;this._pendingInitialValue=void 0,this.assignValue(pending)}}finally{this._resolvingPendingInitialSelection=!1}}if(this.announceOpenTransition(changed),changed.has("open")&&!this.openVetoed&&(this.listboxPositioned=!1),this.open&&(this.listboxHidden=!1,this.listboxRendered=!0),changed.has("open")&&!this.openVetoed){const navigable=this.navigableOptions();this.setActiveIndex(this.open?navigable.findIndex(option=>this.selectedIndex.members.has(option)):-1,navigable)}}firstUpdated(changed){super.firstUpdated(changed);const slot=this.optionsSlot;queueMicrotask(()=>{collectInitialSlotAssignment(slot,s=>{const assigned=s.assignedElements({flatten:!0});this.optionsObserved=!0,assigned.some(isLyraOptionElement)&&this.collectOptionsFromSlot(s)})})}applyOpenState(next){const old=this._open;this.pendingOpenTransitionStart===void 0&&(this.pendingOpenTransitionStart=old),this.openStateGeneration++,this._open=next,this.requestUpdate("open",old)}forceCloseOpenState(){this.listboxHidden=!0;const isClosing=this._open||this.pendingOpenTransitionStart===!0;if(this.popupController.cancel(),!this._open){isClosing&&(this.suppressedOpenLifecycleGeneration=this.openStateGeneration),this.hasAttribute("open")&&this.removeAttribute("open");return}this.applyOpenState(!1),this.suppressedOpenLifecycleGeneration=this.openStateGeneration}announceOpenTransition(changed){if(this.openVetoed=!1,!(!changed.has("open")||this._isFirstUpdate||this.suppressedOpenLifecycleGeneration===this.openStateGeneration)){if(!this.isConnected){emitPopupEvent(this,"lr-hide",!1);return}this.openVetoed=this.popupController.announce(this.open,()=>{this.open=!this.open})}}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",reflectFormName(this,this._name),this.syncFormValue(),this.requestUpdate("name",old)}get multiple(){return this._multiple}set multiple(next){markVetoGuardWrite(this.selectionWriteGuard);const old=this._multiple;this._multiple=!!next,this.toggleAttribute("multiple",this._multiple),!this._multiple&&this._selected.length>1?this.setSelection(this._selected.slice(0,1),this._selectedOptions.slice(0,1)):this.syncFormValue(),this.requestUpdate("multiple",old)}get maxOptionsVisible(){return this._maxOptionsVisible}set maxOptionsVisible(next){const old=this._maxOptionsVisible;this._maxOptionsVisible=finiteCount(next,3),this.requestUpdate("maxOptionsVisible",old)}get disabled(){return this._disabled}set disabled(next){markVetoGuardWrite(this.selectionWriteGuard);const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this._fieldsetDisabled=this.validityController?.fieldsetDisabled(this._fieldsetDisabled)??this._fieldsetDisabled,this._disabled&&this.forceCloseOpenState(),this.updateValidity(),this.requestUpdate("disabled",old)}get required(){return this._required}set required(next){const old=this._required;this._required=!!next,this.toggleAttribute("required",this._required),this.updateValidity(),this.requestUpdate("required",old)}get value(){return this.multiple?[...this._selected]:this._selected[0]??""}set value(next){this._resolvingPendingInitialSelection||(this._pendingInitialSelectedOptions=void 0,this.hasUpdated||(this._pendingInitialValue=next)),this._restoredStateActive=!1,this._valueDirty=!0;const values=normalizeSelectionValues(next);this.setSelection(values)}get defaultValue(){return this.multiple?[...this._defaultSelected]:this._defaultSelected[0]??""}set defaultValue(next){!this.hasUpdated&&!this._resolvingPendingInitialSelection&&(this._pendingInitialDefaultValue=next),this._defaultValueDirty=!0;const old=this.multiple?[...this._defaultSelected]:this._defaultSelected[0]??"",values=normalizeSelectionValues(next);this._defaultSelected=this.multiple?[...values]:values.slice(0,1),this._defaultSelectedOptions=this.resolveOccurrences(this._defaultSelected),!this._valueDirty&&!this._restoredStateActive&&this.setSelection([...this._defaultSelected],[...this._defaultSelectedOptions]),this.requestUpdate("defaultValue",old)}get selectedOptions(){return[...this._selectedOptions]}set selectedOptions(next){const candidates=Array.isArray(next)?next:[];this._resolvingPendingInitialSelection||(this._pendingInitialValue=void 0,this._pendingInitialSelectedOptions=this.hasUpdated?void 0:candidates.filter(option=>isLyraOptionElement(option)&&this.contains(option))),this._restoredStateActive=!1,this._valueDirty=!0;const catalog=candidates.length>1?new Set(this.options):void 0,seen=new Set,live=candidates.filter(option=>seen.has(option)?!1:(seen.add(option),isLyraOptionElement(option)&&this.contains(option)&&(catalog?catalog.has(option):this.options.includes(option)))),selected=this.multiple?live:live.slice(0,1);this.setSelection(selected.map(option=>option.value),selected)}get selectedData(){return this.resolveOccurrenceSlots(this._selected,this._selectedOptions).map(option=>option?.data)}setSelection(next,preferred=[]){this.pendingSelectedWrites.clear(),markVetoGuardWrite(this.selectionWriteGuard);const values=this.multiple?[...next]:next.slice(0,1),previousValues=this._selected,previousOptions=this._selectedOptions,old=this.multiple?[...previousValues]:previousValues[0]??"";this.previousValue=old,this._selected=values,this._selectedOptions=this.resolveOccurrences(values,preferred),this.syncFormValue(),this.reflectSelected(),this.updateValidity(),this.requestUpdate("value",old);const sameValues=previousValues.length===values.length&&previousValues.every((value,i)=>value===values[i]),sameOptions=previousOptions.length===this._selectedOptions.length&&previousOptions.every((option,i)=>option===this._selectedOptions[i]);sameValues&&!sameOptions&&this.requestUpdate()}resolveOccurrences(values,preferred=[]){return this.resolveOccurrenceSlots(values,preferred).filter(option=>option!==void 0)}resolveOccurrenceSlots(values,preferred=[]){if(values.length===0)return[];if(values.length===1){const value=values[0],hint=preferred.length===1?preferred[0]:preferred.find(option=>option?.value===value);return[hint&&hint.value===value&&this.options.includes(hint)?hint:this.options.find(option=>option.value===value)]}const requested=new Set(values),catalog=new Set(this.options),claimed=new Set,queuesFor=options=>{const queues=new Map;for(const option of options){if(!option)continue;const value=option.value;if(!requested.has(value))continue;let queue=queues.get(value);queue||queues.set(value,queue={options:[],next:0}),queue.options.push(option)}return queues},firstUnclaimed=(queues,value)=>{const queue=queues.get(value);if(queue){for(;queue.next<queue.options.length&&claimed.has(queue.options[queue.next]);)queue.next++;return queue.options[queue.next]}},preferredQueues=preferred.length===values.length?void 0:queuesFor(preferred);let fallbackQueues;return values.map((value,index)=>{const hint=preferredQueues?firstUnclaimed(preferredQueues,value):preferred[index],match=hint&&hint.value===value&&catalog.has(hint)&&!claimed.has(hint)?hint:firstUnclaimed(fallbackQueues??=queuesFor(this.options),value);if(match)return claimed.add(match),match})}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}updateValidity(){this.barredFromValidation?this.validityController.setValidity({}):this.required&&this._selected.length===0?this.validityController.setValidity({valueMissing:!0},this.localize("selectValueMissing")):this.validityController.setValidity({}),this.reflectValidityStates()}reflectValidityStates(){syncValidityStates(this.internals,{required:this.required,hasInteracted:this.hasInteracted,barred:this.barredFromValidation}),setCustomState(this.internals,"blank",this._selected.length===0)}syncFormValue(){if(!this.multiple){this.internals.setFormValue(this._selected[0]??"");return}const state2=JSON.stringify(this._selected);if(!this.name){this.internals.setFormValue(null,state2);return}const data=new FormData;for(const value of this._selected)data.append(this.name,value);this.internals.setFormValue(data,state2)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}formResetCallback(){this._pendingInitialValue=void 0,this._pendingInitialSelectedOptions=void 0,this.touched=!1,this.hasInteracted=!1,this._restoredStateActive=!1,this._valueDirty=!1;const resetOptions=this._defaultSelectedOptions.length>0?this._defaultSelectedOptions:this.options.filter(option=>wasOptionInitiallySelected(option));this._defaultSelectedOptions.length===0&&resetOptions.length>0&&(this._defaultSelectedOptions=[...resetOptions],this._defaultSelected=resetOptions.map(option=>option.value));const defaults=new Set(resetOptions);for(const option of this.options)option[RESET_OPTION_SELECTED_FROM_OWNER](defaults.has(option));this.setSelection([...this._defaultSelected],[...this._defaultSelectedOptions])}formStateRestoreCallback(state2,reason){if(!this.multiple)this.assignValue(typeof state2=="string"?state2:void 0);else{let restored=[];if(typeof state2=="string")try{const parsed=JSON.parse(state2);Array.isArray(parsed)&&parsed.every(entry=>typeof entry=="string")&&(restored=parsed)}catch{}this.assignValue(restored)}this._restoredStateActive=!0,this._valueDirty=!0}formDisabledCallback(disabled){if(this.validityController?.reflectingDisabled)return;markVetoGuardWrite(this.selectionWriteGuard);const wasDisabled=this.effectiveDisabled;this._fieldsetDisabled=disabled,wasDisabled!==this.effectiveDisabled&&(disabled&&this.forceCloseOpenState(),this.updateValidity(),this.requestUpdate())}checkValidity(){return this.validityController.checkValidity(()=>this.updateValidity())}reportValidity(){return this.validityController.syncConstraints(),this.updateValidity(),this.markInteracted(),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.reflectValidityStates()}resetValidity(){this.setCustomValidity("")}disconnectedCallback(){this.pendingSelectedWrites.clear(),markVetoGuardWrite(this.selectionWriteGuard),this.listboxHidden=!0,this.releaseExternalDescription(),this.popupController.cancel(),super.disconnectedCallback(),this.cleanup?.(),this.cleanup=void 0,this.positionedDirection=void 0,this.typeBuffer.clear(),this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.popupController.unbindPointer(),this.open=!1}adoptedCallback(){markVetoGuardWrite(this.selectionWriteGuard),super.adoptedCallback(),this.popupController.cancel(),this.releaseExternalDescription(),this.hasUpdated&&this.syncExternalDescription(),this.cleanup?.(),this.cleanup=void 0,this.positionedDirection=void 0,this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.popupController.unbindPointer(),this.typeBuffer.clear(),queueMicrotask(()=>this.reconnectOpenPopup())}collectOptionsFromSlot(slot){const previous=new Set(this.options),previousActive=this.activeOption,previousActiveRawIndex=previousActive?this.options.indexOf(previousActive):this.activeIndex;if(this.options=slot.assignedElements({flatten:!0}).filter(isLyraOptionElement),this.optionsObserved=!0,this.adornmentClones=new WeakMap,this.reconcileActiveOption(previousActive,previousActiveRawIndex),this._defaultCaptured){const newDefaults=this.options.filter(option=>!previous.has(option)&&option.defaultSelected),newLive=this.options.filter(option=>!previous.has(option)&&option.selected&&!option.defaultSelected);this.refreshOptionDefaults();const eligible=[...!this._restoredStateActive&&!this._valueDirty?newDefaults:[],...this._restoredStateActive?[]:newLive];if(eligible.length>0){const added=this.multiple?eligible:eligible.slice(-1),occurrences=this.multiple?[...new Set([...this._selectedOptions,...added])]:added;newLive.length>0&&(this._valueDirty=!0),this.setSelection(occurrences.map(option=>option.value),occurrences);return}}else{this._defaultCaptured=!0;const explicitDefault=this.hasAttribute("default-value")||this._defaultValueDirty,allDefaults=this.options.filter(option=>option.defaultSelected),defaults=this.multiple?allDefaults:allDefaults.slice(0,1),allLive=this.options.filter(option=>option.selected),live=this.multiple?allLive:allLive.slice(0,1),initialLive=this.options.filter(option=>wasOptionInitiallySelected(option)),optionDirty=this.options.some(option=>isOptionSelectedDirty(option)),dirtySelected=this.options.filter(option=>isOptionSelectedDirty(option)&&option.selected);if(explicitDefault)this._defaultSelectedOptions=this.resolveOccurrences(this._defaultSelected);else{const resetOptions=defaults.length>0?defaults:initialLive.length>0?initialLive:live;this._defaultSelected=resetOptions.map(option=>option.value),this._defaultSelectedOptions=[...resetOptions]}const fromDefaults=explicitDefault||defaults.length>0,initial=optionDirty?this.multiple?allLive:dirtySelected.slice(-1)[0]?dirtySelected.slice(-1):live:explicitDefault?this._defaultSelectedOptions:fromDefaults?defaults:live;if(initial.length>0&&!this._restoredStateActive&&!this._valueDirty){(!fromDefaults||optionDirty)&&(this._valueDirty=!0),this.setSelection(initial.map(option=>option.value),[...initial]);return}if(optionDirty&&(this._valueDirty=!0),explicitDefault&&!this._valueDirty&&!this._restoredStateActive){this.setSelection([...this._defaultSelected],[...this._defaultSelectedOptions]);return}}if(this._pendingInitialSelectedOptions!==void 0){const pending=this._pendingInitialSelectedOptions;this._pendingInitialSelectedOptions=void 0;const resolving=this._resolvingPendingInitialSelection;this._resolvingPendingInitialSelection=!0;try{this.selectedOptions=pending}finally{this._resolvingPendingInitialSelection=resolving}return}this.reflectSelected()}refreshOptionDefaults(){if(this.hasAttribute("default-value")||this._defaultValueDirty)return;const declared=this.options.filter(option=>option.defaultSelected),defaults=this.multiple?declared:declared.slice(0,1);this._defaultSelected=defaults.map(option=>option.value),this._defaultSelectedOptions=[...defaults],!this._valueDirty&&!this._restoredStateActive&&this.setSelection([...this._defaultSelected],[...this._defaultSelectedOptions])}reflectSelected(){this._selectedOptions=this.resolveOccurrences(this._selected,this._selectedOptions),this._selectedValuesByOption=new Map(this._selectedOptions.map(option=>[option,option.value]));const chosen=new Set(this._selectedOptions);for(const option of this.options)option[SET_OPTION_SELECTED_FROM_OWNER](chosen.has(option))}selectUnknownValue(value){if(!(this.selectionRequestDispatching||this.effectiveDisabled)){if(this.multiple){const index=this._selected.indexOf(value),values=index>=0?this._selected.filter((_,position)=>position!==index):[...this._selected,value];this.requestSelection(values,this.resolveOccurrenceSlots(values,this._selectedOptions),()=>{this.emitValueEvents(),this.emit("lr-activate",{value})});return}this.hide(),this.emit("lr-activate",{value})}}resolvedLabelFor(value,occurrenceIndex=0){const option=(this._selectedOptions[occurrenceIndex]?.value===value?this._selectedOptions[occurrenceIndex]:void 0)??this.selectedIndex.values.get(value)??this.optionIndex.values.get(value);return option&&(option.label||option.value)}labelFor(value,occurrenceIndex=0){const resolved=this.resolvedLabelFor(value,occurrenceIndex);if(resolved!==void 0)return resolved;if(this.loading)return this.localize("loading");const override=this.optionsObserved?this.getUnknownLabel?.(value):void 0;return override!==void 0&&override.trim().length>0?override:value}isUnknownValue(value,occurrenceIndex=0){return!this.optionsObserved||this.loading||value===""?!1:this.resolvedLabelFor(value,occurrenceIndex)===void 0}get onlyOption(){if(!this.autoCommitSingleOption)return;const navigable=this.navigableOptions(this.options);return navigable.length===1?navigable[0]:void 0}isOptionAvailable(option){return!option.disabled&&!option.inert&&!option.closest("[inert]")}navigableOptions(options=this.listboxOptions){return this.memoOption("navigable",[options],()=>options.filter(option=>this.isOptionAvailable(option)))}get unknownValues(){return this.withUnknownOption?this._selected.filter((value,index)=>this.isUnknownValue(value,index)):[]}get unknownOptions(){const values=this.unknownValues;if(values.length===0)return this.unknownOptionCache.clear(),[];for(const key of[...this.unknownOptionCache.keys()])values.includes(key)||this.unknownOptionCache.delete(key);return values.map(value=>{let option=this.unknownOptionCache.get(value);return option||(option=this.ownerDocument.createElement(tag("option")),this.unknownOptionCache.set(value,option)),option.value=value,option.label=this.labelFor(value),option})}get optionWindow(){return this.memoOption("window",[this.callbackRefreshEpoch,this.options,this._selected,this._selectedOptions,this.activeOption,this.maxRender,this.withUnknownOption,this.loading,this.optionsObserved,this.getUnknownLabel,this.effectiveLocale,this.strings],()=>{const unknown=this.unknownOptions,all=unknown.length?[...this.options,...unknown]:this.options;return capOptionRows(all,this.maxRender,[...this.activeOption?[this.activeOption]:[],...this._selectedOptions,...unknown])})}get listboxOptions(){return this.optionWindow.rows}setActiveIndex(next,navigable=this.navigableOptions()){if(next<0||navigable.length===0){this.activeIndex=-1,this.activeOption=void 0;return}const index=Math.min(next,navigable.length-1);this.activeIndex=index,this.activeOption=navigable[index]}reconcileActiveOption(previousActive,previousRawIndex){if(!previousActive&&this.activeIndex<0)return;const navigable=this.navigableOptions();if(previousActive){const preservedIndex=navigable.indexOf(previousActive);if(preservedIndex>=0){this.setActiveIndex(preservedIndex,navigable);return}}if(navigable.length===0){this.setActiveIndex(-1,navigable);return}const pivot=Math.max(0,previousRawIndex);let nearestIndex=0,nearestDistance=Number.POSITIVE_INFINITY,nearestRawIndex=-1;const rawPositions=new Map(this.listboxOptions.map((option,index)=>[option,index]));navigable.forEach((option,index)=>{const rawIndex=rawPositions.get(option),distance=Math.abs(rawIndex-pivot);(distance<nearestDistance||distance===nearestDistance&&rawIndex>=pivot&&nearestRawIndex<pivot)&&(nearestIndex=index,nearestDistance=distance,nearestRawIndex=rawIndex)}),this.setActiveIndex(nearestIndex,navigable)}flushSelectedWrites(){this.selectedWritesQueued=!1;const writes=[...this.pendingSelectedWrites];if(this.pendingSelectedWrites.clear(),!this.isConnected||writes.length===0)return;if(!this.multiple){let value=this._selected[0],option=this._selectedOptions[0];for(const[candidate,write]of writes)this.optionIndex.members.has(candidate)&&(write.selected?(value=write.value,option=candidate):candidate===option&&(value=void 0,option=void 0));this.setSelection(value===void 0?[]:[value],option?[option]:[]);return}const queues=new Map;for(const option of this._selectedOptions){const value=this._selectedValuesByOption.get(option)??option.value;let queue=queues.get(value);queue||queues.set(value,queue={options:[],next:0}),queue.options.push(option)}const entries=this._selected.map(value=>{const queue=queues.get(value);return{value,option:queue?.options[queue.next++]}}),byOption=new Map(entries.flatMap(entry=>entry.option?[[entry.option,entry]]:[]));for(const[option,write]of writes){if(!this.optionIndex.members.has(option))continue;const entry=byOption.get(option);if(!write.selected)entry&&(entry.removed=!0);else if(entry&&!entry.removed)entry.value=write.value;else{const added={value:write.value,option};entries.push(added),byOption.set(option,added)}}const retained=entries.filter(entry=>!entry.removed);this.setSelection(retained.map(entry=>entry.value),retained.map(entry=>entry.option))}show(){if(this.open||this.effectiveDisabled)return Promise.resolve();const settled=this.popupController.wait(!0);return this.open=!0,settled}hide(){if(!this.open)return Promise.resolve();const settled=this.popupController.wait(!1);return this.open=!1,settled}positionListbox(){this.cleanup?.(),this.cleanup=void 0,this.positionedDirection=this.effectiveDirection;const anchor=this.renderRoot.querySelector('[part="trigger"]'),listbox=this.renderRoot.querySelector('[part="listbox"]');if(!anchor||!listbox)return;this.placedTopLayer=syncTopLayerRelease(listbox,this.placedTopLayer,this.topLayer),this.cleanup=place(anchor,listbox,{placement:rtlAwarePlacement(this.placement,this),...topLayerPlacement(this.topLayer,resolveEffectivePositioningStrategy(this,this._positioningStrategy,"absolute")),sync:this.sync});const operation=this.cleanup;this.positioningReady=operation.ready.then(positioned=>(positioned&&this.cleanup===operation&&this.open&&this.isConnected&&(this.listboxPositioned=!0,this.revealActiveOption()),positioned))}revealActiveOption(){if(!this.isConnected||!this.open||!this.listboxPositioned||!this.cleanup)return;const listbox=this.renderRoot.querySelector('[part="listbox"]'),activeId=this.triggerElement?.getAttribute("aria-activedescendant"),row=listbox?.querySelector('[part="option"][data-active]');listbox&&row&&activeId&&row.id===activeId&&revealRow(listbox,row)}activateListboxOverlay(){this.cleanup?.(),this.cleanup=void 0,this.overlayHandle?.deactivate({restoreFocus:!1}),this.restoreFocusOnClose=!0,this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part="listbox"]'),onEscape:()=>{this.hide()},onBackdrop:()=>{this.restoreFocusOnClose=!1,this.hide()},restoreFocusTo:this.triggerElement??null}),this.popupController.bindPointer(),this.positionListbox()}teardownListboxOverlay(restoreFocus=this.restoreFocusOnClose){this.cleanup?.(),this.cleanup=void 0,this.positionedDirection=void 0,this.overlayHandle?.deactivate({restoreFocus}),this.overlayHandle=void 0,this.popupController.unbindPointer(),this.restoreFocusOnClose=!0}reconnectOpenPopup(){!this.isConnected||!this.open||this.activateListboxOverlay()}updated(changed){super.updated(changed),this.syncExternalDescription();const suppressOpenLifecycle=changed.has("open")&&this.suppressedOpenLifecycleGeneration===this.openStateGeneration,shouldRefreshPosition=this.open&&this.isConnected&&(changed.has("placement")||changed.has("positioningStrategy")||changed.has("topLayer")||changed.has("sync")||this.positionedDirection!==this.effectiveDirection);changed.has("open")&&!this.openVetoed?this.open&&this.isConnected?(this.activateListboxOverlay(),!this._isFirstUpdate&&!suppressOpenLifecycle&&this.settleTransition("lr-after-show")):this.open?this.teardownListboxOverlay(!1):(this.teardownListboxOverlay(),!this._isFirstUpdate&&!suppressOpenLifecycle&&this.settleTransition("lr-after-hide")):changed.has("open")&&this.openVetoed?(this.restoreFocusOnClose=!0,shouldRefreshPosition&&this.positionListbox()):shouldRefreshPosition&&this.positionListbox(),(changed.has("activeIndex")||changed.has("options")||changed.has("listboxPositioned"))&&this.revealActiveOption(),(changed.has("touched")||changed.has("required")||changed.has("value"))&&this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid),changed.has("open")&&(this.pendingOpenTransitionStart=void 0,this.suppressedOpenLifecycleGeneration=void 0)}settleTransition(event){return this.popupController.settle(event,{waitForPosition:async stale=>{for(;this.open;){const readiness=this.positioningReady,positioned=await readiness;if(stale())return!1;if(positioned)break;if(readiness===this.positioningReady)return this.forceCloseOpenState(),!1}return!0},conceal:()=>{this.listboxHidden=!0,this.listboxRendered=!1}})}emitValueEvents(){const self=this,data=this.selectedData,value=self.value,previousValue=this.previousValue;dispatchNativeInputEvent(this),self.emit("lr-input",{value,previousValue,data}),dispatchNativeEvent(this,"change"),self.emit("lr-change",{value,previousValue,data})}assignValue(next){this.value=next}assignDefaultValue(next){this.defaultValue=next}requestSelection(values,preferred,afterCommit,available=()=>!0){if(this.selectionRequestDispatching||this.effectiveDisabled)return!1;const multiple=this.multiple,document=this.ownerDocument,connected=this.isConnected,open=this.open,slots=this.resolveOccurrenceSlots(values,preferred),data=slots.map(option=>option?.data),value=multiple?[...values]:values[0]??"",previousValue=this.value,self=this;let committed=!1;this.selectionRequestDispatching=!0;try{requestThenCommit({requestDetail:{value,previousValue,data},guard:this.selectionWriteGuard,emitRequest:(detail,init)=>self.emit("lr-change-request",detail,init),commit:()=>{const liveOptions=new Set(this.renderRoot.querySelector("slot:not([name])")?.assignedElements({flatten:!0})??[]);this.effectiveDisabled||this.multiple!==multiple||this.ownerDocument!==document||this.isConnected!==connected||this.open!==open||!available(liveOptions)||slots.some((option,index)=>option&&(!liveOptions.has(option)||option.value!==values[index]||!Object.is(option.data,data[index])))||(this.hasInteracted=!0,this._restoredStateActive=!1,this._valueDirty=!0,this.setSelection(values,preferred),committed=!0,afterCommit())}})}finally{this.selectionRequestDispatching=!1}return committed}selectOption(option){if(this.selectionRequestDispatching||this.effectiveDisabled||!this.isOptionAvailable(option))return;if(this.unknownOptionCache.get(option.value)===option){this.selectUnknownValue(option.value);return}const value=option.value,available=liveOptions=>liveOptions.has(option)&&option.value===value&&this.isOptionAvailable(option);if(this.multiple){const currentSlots=this.resolveOccurrenceSlots(this._selected,this._selectedOptions),selectedIndex=currentSlots.indexOf(option),selected=selectedIndex>=0,occurrences=selected?currentSlots.filter((_,index)=>index!==selectedIndex):[...currentSlots,option],values=selected?this._selected.filter((_,index)=>index!==selectedIndex):[...this._selected,value];this.requestSelection(values,occurrences,()=>{this.emitValueEvents(),this.emit("lr-activate",{value})},available);return}if(!(option!==this._selectedOptions[0]||value!==this._selected[0])){this.hide(),this.emit("lr-activate",{value});return}this.requestSelection([value],[option],()=>{this.hide(),this.emitValueEvents(),this.emit("lr-activate",{value})},available)}removeValueAt(index){return this.effectiveDisabled||index<0||index>=this._selected.length?!1:this.requestSelection(this._selected.filter((_,candidateIndex)=>candidateIndex!==index),this.resolveOccurrenceSlots(this._selected,this._selectedOptions).filter((_,candidateIndex)=>candidateIndex!==index),()=>this.emitValueEvents())}clear(){this.effectiveDisabled||this._selected.length===0||this.requestSelection([],[],()=>{this.emitValueEvents(),this.emit("lr-clear")})}removeTag(value,index,event){event.stopPropagation(),this._selected[index]===value&&this.removeValueAt(index)&&this.updateComplete.then(()=>{const buttons=[...this.renderRoot.querySelectorAll('[part~="tag__remove-button"]')];(buttons[Math.min(index,buttons.length-1)]??this.triggerElement)?.focus()})}typeAhead(char){this.typeBuffer.add(char,this.effectiveLocale);const navigable=this.navigableOptions();if(!navigable.length)return;const currentOption=this.open?navigable[this.activeIndex]:this._selectedOptions[this._selectedOptions.length-1],currentIndex=navigable.indexOf(currentOption),labels=this.memoOption("typeAheadLabels",[navigable,this.effectiveLocale],()=>{const locale=resolveIntlLocale(this.effectiveLocale);return new Map(navigable.map(option=>[option,option.label.toLocaleLowerCase(locale)]))});let match=null;for(let step=1;step<=navigable.length;step++){const index=(currentIndex+step+navigable.length)%navigable.length,option=navigable[index];if((this.open||!this.multiple||!this.selectedIndex.members.has(option))&&labels.get(option)?.startsWith(this.typeBuffer.text)){match=index;break}}if(match===null)return;const candidate=navigable[match];this.open?this.setActiveIndex(match,navigable):this.selectOption(candidate)}adornmentMarkup(option){return Array.from(option.children).filter(child=>["start","end","prefix","suffix"].includes(child.getAttribute("slot")??"")).map(child=>child.outerHTML).join("")}adornmentsFor(option){const cached=this.adornmentClones.get(option);if(cached)return cached;const cloneSlot=selector=>{const nodes=Array.from(option.querySelectorAll(selector));if(nodes.length!==0)return nodes.map(node=>node.cloneNode(!0))},resolved={markup:this.adornmentMarkup(option),start:cloneSlot(':scope > [slot="start"], :scope > [slot="prefix"]'),end:cloneSlot(':scope > [slot="end"], :scope > [slot="suffix"]')};return this.adornmentClones.set(option,resolved),resolved}renderRows(options,activeId){const out=[],chosen=new Set(this._selectedOptions);let currentGroup,groupRows=[],groupIndex=0;const flushGroup=()=>{if(groupRows.length!==0){if(currentGroup){const labelId=`${this.listId}-group-${groupIndex++}`;out.push(html`<div role="group" aria-labelledby=${labelId}>
1
+ import{__decorate}from"tslib";import{capOptionRows}from"../../../internal/option-selection.js";import{requestThenCommit}from"../../../internal/request-commit.js";import{VetoWriteGuard,markVetoGuardWrite}from"../../../internal/veto-write-guard.js";import{renderFormControlHintError}from"../../../internal/form-control-template.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";import{FormControlController,reflectFormName}from"../../../internal/form-control-controller.js";import{GlassScrollLayer}from"../../../internal/glass-scroll-layer.js";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{acquireNativeControlDescription}from"../../../internal/native-control-description.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{LyraFormControlElement}from"../../../internal/form-control-element.js";import{deferredPlaceReady as place,syncTopLayerRelease,topLayerPlacement}from"../../../internal/anchored-overlay-runtime.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{nextId,srOnly}from"../../../internal/a11y.js";import{activateNonmodalOverlay}from"../../../internal/nonmodal-overlay-manager.js";import{chevronIcon,closeIcon}from"../../../internal/icons.js";import{VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{setCustomState,syncValidityStates}from"../../../internal/custom-states.js";import{PopupController,emitPopupEvent}from"../../../internal/popup-controller.js";import{revealRow}from"../../../internal/reveal-row.js";import{TypeAheadBuffer}from"../../../internal/type-ahead-buffer.js";import{resolveListMove}from"../../../internal/list-navigation.js";import{finiteCount}from"../../../internal/numbers.js";import{getNumberFormat,resolveIntlLocale}from"../../../internal/intl-cache.js";import{renderInertPresentation}from"../../../internal/inert-presentation.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{styles}from"./select.styles.js";import{sizes}from"../../../internal/sizes.styles.js";import"../combobox/option.class.js";import{sanitizeCssColor}from"../../../internal/safe-css.js";import{dispatchNativeEvent,dispatchNativeInputEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{omittedEmptyStringConverter,optionalLiteralSetConverter}from"../../../internal/converters.js";import{getFormOwner,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{isOptionSelectedDirty,isOptionSelectedWrite,wasOptionInitiallySelected,RESET_OPTION_SELECTED_FROM_OWNER,SET_OPTION_SELECTED_FROM_OWNER}from"../../../internal/option-selection.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{tag}from"../../../internal/prefix.js";import{currentValidityValidator}from"../form-validator.js";import{LYRA_DEFAULT_selectSelectedOverflow,LYRA_DEFAULT_selectValueMissing}from"../../../internal/default-strings/forms.generated.js";import{LYRA_DEFAULT_clear,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_loading,LYRA_DEFAULT_notInCatalog,LYRA_DEFAULT_removeWithContext,LYRA_DEFAULT_select}from"../../../internal/default-strings/shared.generated.js";installFormControlLabelSupport();function isLyraOptionElement(value){return isHtmlElement(value)&&value.localName===tag("option")}function normalizeSelectionValues(next){return Array.isArray(next)?next.filter(value=>typeof value=="string"):typeof next=="string"?[next]:[]}const POSITIONING_STRATEGY=optionalLiteralSetConverter(["absolute","fixed"]);class LyraSelect extends LyraFormControlElement{static{this.defaultStrings={...super.defaultStrings,clear:LYRA_DEFAULT_clear,fieldRequired:LYRA_DEFAULT_fieldRequired,loading:LYRA_DEFAULT_loading,notInCatalog:LYRA_DEFAULT_notInCatalog,removeWithContext:LYRA_DEFAULT_removeWithContext,select:LYRA_DEFAULT_select,selectSelectedOverflow:LYRA_DEFAULT_selectSelectedOverflow,selectValueMissing:LYRA_DEFAULT_selectValueMissing}}static{this.collectionSupport=collectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-input","lr-change","lr-change-request"])}static{this.identityEventDetailCollectionItems=Object.freeze({"lr-input":Object.freeze(["data"]),"lr-change":Object.freeze(["data"]),"lr-change-request":Object.freeze(["data"])})}static get validators(){return[currentValidityValidator("required","disabled","value","multiple")]}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,sizes,styles,srOnly]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},multiple:{type:Boolean,reflect:!0,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0},value:{noAccessor:!0},name:{reflect:!0,noAccessor:!0,converter:omittedEmptyStringConverter},maxOptionsVisible:{type:Number,attribute:"max-options-visible",noAccessor:!0},defaultValue:{attribute:"default-value",noAccessor:!0}}}get open(){return this._open}set open(next){const requested=!!next,normalized=requested&&!this.effectiveDisabled;if(normalized===this._open){requested!==normalized&&this.hasAttribute("open")&&this.removeAttribute("open");return}this.applyOpenState(normalized)}get positioningStrategy(){return this._positioningStrategy??"absolute"}set positioningStrategy(next){const normalized=POSITIONING_STRATEGY.normalize(next)??"absolute",old=this.positioningStrategy;this._positioningStrategy=normalized,normalized!==old&&(this.requestUpdate("positioningStrategy",old),old==="fixed"!=(normalized==="fixed")&&this.requestUpdate("hoist",old==="fixed"))}get hoist(){return this.positioningStrategy==="fixed"}set hoist(next){this.positioningStrategy=next?"fixed":"absolute"}requestUpdate(...args){args[0]===void 0&&(this.callbackRefreshEpoch=(this.callbackRefreshEpoch??0)+1),super.requestUpdate(...args)}memoOption(key,inputs,compute){const previous=this.optionMemo.get(key);if(previous&&previous.inputs.length===inputs.length&&previous.inputs.every((input,index)=>Object.is(input,inputs[index])))return previous.value;const value=compute();return this.optionMemo.set(key,{inputs,value}),value}get optionIndex(){return this.memoOption("index",[this.options],()=>{const values=new Map,positions=new Map;return this.options.forEach((option,index)=>{positions.set(option,index),values.has(option.value)||values.set(option.value,option)}),{values,positions,members:new Set(this.options)}})}get selectedIndex(){return this.memoOption("selectedIndex",[this._selectedOptions,this.options],()=>{const values=new Map;for(const option of this._selectedOptions)values.has(option.value)||values.set(option.value,option);return{values,members:new Set(this._selectedOptions)}})}focus(options){this.effectiveDisabled||this.triggerElement?.focus(options)}blur(){this.triggerElement?.blur()}click(){this.effectiveDisabled||this.triggerElement?.click()}constructor(){super(),this.placeholder="",this.label="",this.labelDisplay="visible",this.hint="",this.helpText="",this.withLabel=!1,this.withHint=!1,this.errorText="",this.autofocus=!1,this.title="",this._open=!1,this.size="m",this.appearance="outlined",this.pill=!1,this.placement="bottom",this.topLayer=!1,this.filled=!1,this.withClear=!1,this.clearable=!1,this.withUnknownOption=!1,this.loading=!1,this.autoCommitSingleOption=!1,this.activeIndex=-1,this.maxRender=200,this.options=[],this.callbackRefreshEpoch=0,this.optionMemo=new Map,this.optionsObserved=!1,this.touched=!1,this.hasInteracted=!1,this.slotPresence=new SlotPresenceController(this),this._fieldsetDisabled=!1,this.listId=nextId("select-list"),this.triggerId=nextId("select-trigger"),this.valueTextId=nextId("select-value"),this.positioningReady=Promise.resolve(!1),this.restoreFocusOnClose=!0,this.popupController=new PopupController({host:this,popup:()=>this.renderRoot.querySelector('[part="listbox"]'),emit:(name,cancelable)=>emitPopupEvent(this,name,cancelable),onPointer:event=>this.onDocPointer(event)}),this.listboxHidden=!0,this.listboxRendered=!1,this.listboxPositioned=!1,this._isFirstUpdate=!0,this.openVetoed=!1,this.previousValue="",this.openStateGeneration=0,this._selected=[],this._selectedOptions=[],this._selectedValuesByOption=new Map,this.adornmentClones=new WeakMap,this._multiple=!1,this._disabled=!1,this._required=!1,this._defaultSelected=[],this._defaultSelectedOptions=[],this._defaultCaptured=!1,this._valueDirty=!1,this._restoredStateActive=!1,this._resolvingPendingInitialSelection=!1,this._defaultValueDirty=!1,this.typeBuffer=new TypeAheadBuffer(this),this._name="",this._maxOptionsVisible=3,this.localDescriptionIds="",this.markInteracted=()=>{this.touched=!0,!this.hasInteracted&&(this.hasInteracted=!0,this.reflectValidityStates())},this.collectOptions=e=>{this.collectOptionsFromSlot(e.target)},this.unknownOptionCache=new Map,this.pendingSelectedWrites=new Map,this.selectedWritesQueued=!1,this.optionRefreshPending=!1,this.onOptionChange=e=>{e.stopPropagation();const option=e.composedPath().find(isLyraOptionElement);if(isOptionSelectedWrite(e)&&isLyraOptionElement(option)&&this.optionIndex.members.has(option)){markVetoGuardWrite(this.selectionWriteGuard),this._valueDirty=!0,this._restoredStateActive=!1,this.pendingSelectedWrites.delete(option),this.pendingSelectedWrites.set(option,{selected:option.selected,value:option.value}),this.selectedWritesQueued||(this.selectedWritesQueued=!0,queueMicrotask(()=>this.flushSelectedWrites()));return}if(isLyraOptionElement(option)){const cached=this.adornmentClones.get(option);cached&&cached.markup!==this.adornmentMarkup(option)&&this.adornmentClones.delete(option)}if(this.optionRefreshPending)return;this.optionRefreshPending=!0;const previousActive=this.activeOption,previousActiveRawIndex=previousActive?this.options.indexOf(previousActive):this.activeIndex;queueMicrotask(()=>{this.optionRefreshPending=!1,this.refreshOptionDefaults(),this.reflectSelected(),this.options=[...this.options],this.reconcileActiveOption(previousActive,previousActiveRawIndex)})},this.onDocPointer=e=>{if(!e.composedPath().includes(this)){if(this.overlayHandle?.isActive()){this.overlayHandle.dismissBackdrop();return}this.restoreFocusOnClose=!1,this.hide()}},this.selectionWriteGuard=new VetoWriteGuard,this.selectionRequestDispatching=!1,this.onTriggerClick=()=>{if(!this.effectiveDisabled){if(this.onlyOption)return this.selectOption(this.onlyOption);this.open?this.hide():this.show()}},this.onTriggerBlur=event=>{this.effectiveDisabled||(this.touched=!0,this.hasInteracted=!0,this.reflectValidityStates()),this.open&&(this.restoreFocusOnClose=!1),this.hide(),relayNativeEvent(this,event)},this.onTriggerFocus=event=>{relayNativeEvent(this,event)},this.onKeyDown=e=>{if(e.isComposing||e.keyCode===229)return;const navigable=this.navigableOptions(),move=()=>resolveListMove(e,{count:navigable.length,current:this.activeIndex,orientation:"vertical",wrap:!1,clamp:!0,backwardFromMissing:"first"});switch(e.key){case"ArrowDown":if(e.preventDefault(),this.onlyOption)return this.selectOption(this.onlyOption);if(!this.open){this.show();return}this.setActiveIndex(move()??-1,navigable);break;case"ArrowUp":if(e.preventDefault(),this.onlyOption)return this.selectOption(this.onlyOption);if(!this.open){this.show();return}this.setActiveIndex(move()??-1,navigable);break;case"Enter":case" ":if(this.open){e.preventDefault();const active=navigable[this.activeIndex];this.activeIndex>=0&&active?this.selectOption(active):this.hide()}break;case"Escape":this.open&&(!this.overlayHandle?.isActive()||this.overlayHandle.isTopmost())&&(e.preventDefault(),this.hide());break;case"Home":this.open&&(e.preventDefault(),this.setActiveIndex(move()??-1,navigable));break;case"End":this.open&&(e.preventDefault(),this.setActiveIndex(move()??-1,navigable));break;case"Backspace":case"Delete":this.multiple&&this._selected.length>0&&(e.preventDefault(),this.removeValueAt(this._selected.length-1));break;default:this.typeBuffer.accepts(e)&&this.typeAhead(e.key);break}},this.onListboxMouseDown=e=>{e.preventDefault()},this.onListboxClick=e=>{const optionEl=e.target.closest('[part="option"]'),index=Number(optionEl?.dataset.index);if(!Number.isInteger(index))return;const option=this.listboxOptions[index];option&&this.selectOption(option)},this.validityController=new FormControlController(this,{invalid:init=>this.emit("lr-invalid",null,init),interacted:this.markInteracted,customError:()=>this.validityController.customValidityMessage}),this.internals=this.validityController.formInternals,new GlassScrollLayer(this,'[part="listbox"]',()=>this.open),this.syncFormValue()}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}[VALIDITY_ANCHOR](){return this.renderRoot?.querySelector('[part="trigger"]')??null}syncExternalDescription(){if(!this.isConnected)return;const target=this.renderRoot.querySelector('[part="trigger"]');target&&(this.externalDescriptionLease?this.externalDescriptionLease.update(target):this.externalDescriptionLease=acquireNativeControlDescription(this,target,()=>this.localDescriptionIds))}releaseExternalDescription(){this.externalDescriptionLease?.release(),this.externalDescriptionLease=void 0}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.syncExternalDescription(),this.updateValidity(),this.hasUpdated&&this.open&&queueMicrotask(()=>this.reconnectOpenPopup())}willUpdate(changed){if(super.willUpdate(changed),this._isFirstUpdate=!this.hasUpdated,this._isFirstUpdate&&(this._pendingInitialDefaultValue!==void 0||this._pendingInitialValue!==void 0)){this._resolvingPendingInitialSelection=!0;try{if(this._pendingInitialDefaultValue!==void 0){const pending=this._pendingInitialDefaultValue;this._pendingInitialDefaultValue=void 0,this.assignDefaultValue(pending)}if(this._pendingInitialValue!==void 0){const pending=this._pendingInitialValue;this._pendingInitialValue=void 0,this.assignValue(pending)}}finally{this._resolvingPendingInitialSelection=!1}}if(this.announceOpenTransition(changed),changed.has("open")&&!this.openVetoed&&(this.listboxPositioned=!1),this.open&&(this.listboxHidden=!1,this.listboxRendered=!0),changed.has("open")&&!this.openVetoed){const navigable=this.navigableOptions();this.setActiveIndex(this.open?navigable.findIndex(option=>this.selectedIndex.members.has(option)):-1,navigable)}}firstUpdated(changed){super.firstUpdated(changed);const slot=this.optionsSlot;queueMicrotask(()=>{collectInitialSlotAssignment(slot,s=>{const assigned=s.assignedElements({flatten:!0});this.optionsObserved=!0,assigned.some(isLyraOptionElement)&&this.collectOptionsFromSlot(s)})})}applyOpenState(next){const old=this._open;this.pendingOpenTransitionStart===void 0&&(this.pendingOpenTransitionStart=old),this.openStateGeneration++,this._open=next,this.requestUpdate("open",old)}forceCloseOpenState(){this.listboxHidden=!0;const isClosing=this._open||this.pendingOpenTransitionStart===!0;if(this.popupController.cancel(),!this._open){isClosing&&(this.suppressedOpenLifecycleGeneration=this.openStateGeneration),this.hasAttribute("open")&&this.removeAttribute("open");return}this.applyOpenState(!1),this.suppressedOpenLifecycleGeneration=this.openStateGeneration}announceOpenTransition(changed){if(this.openVetoed=!1,!(!changed.has("open")||this._isFirstUpdate||this.suppressedOpenLifecycleGeneration===this.openStateGeneration)){if(!this.isConnected){emitPopupEvent(this,"lr-hide",!1);return}this.openVetoed=this.popupController.announce(this.open,()=>{this.open=!this.open})}}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",reflectFormName(this,this._name),this.syncFormValue(),this.requestUpdate("name",old)}get multiple(){return this._multiple}set multiple(next){markVetoGuardWrite(this.selectionWriteGuard);const old=this._multiple;this._multiple=!!next,this.toggleAttribute("multiple",this._multiple),!this._multiple&&this._selected.length>1?this.setSelection(this._selected.slice(0,1),this._selectedOptions.slice(0,1)):this.syncFormValue(),this.requestUpdate("multiple",old)}get maxOptionsVisible(){return this._maxOptionsVisible}set maxOptionsVisible(next){const old=this._maxOptionsVisible;this._maxOptionsVisible=finiteCount(next,3),this.requestUpdate("maxOptionsVisible",old)}get disabled(){return this._disabled}set disabled(next){markVetoGuardWrite(this.selectionWriteGuard);const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this._fieldsetDisabled=this.validityController?.fieldsetDisabled(this._fieldsetDisabled)??this._fieldsetDisabled,this._disabled&&this.forceCloseOpenState(),this.updateValidity(),this.requestUpdate("disabled",old)}get required(){return this._required}set required(next){const old=this._required;this._required=!!next,this.toggleAttribute("required",this._required),this.updateValidity(),this.requestUpdate("required",old)}get value(){return this.multiple?[...this._selected]:this._selected[0]??""}set value(next){this._resolvingPendingInitialSelection||(this._pendingInitialSelectedOptions=void 0,this.hasUpdated||(this._pendingInitialValue=next)),this._restoredStateActive=!1,this._valueDirty=!0;const values=normalizeSelectionValues(next);this.setSelection(values)}get defaultValue(){return this.multiple?[...this._defaultSelected]:this._defaultSelected[0]??""}set defaultValue(next){!this.hasUpdated&&!this._resolvingPendingInitialSelection&&(this._pendingInitialDefaultValue=next),this._defaultValueDirty=!0;const old=this.multiple?[...this._defaultSelected]:this._defaultSelected[0]??"",values=normalizeSelectionValues(next);this._defaultSelected=this.multiple?[...values]:values.slice(0,1),this._defaultSelectedOptions=this.resolveOccurrences(this._defaultSelected),!this._valueDirty&&!this._restoredStateActive&&this.setSelection([...this._defaultSelected],[...this._defaultSelectedOptions]),this.requestUpdate("defaultValue",old)}get selectedOptions(){return[...this._selectedOptions]}set selectedOptions(next){const candidates=Array.isArray(next)?next:[];this._resolvingPendingInitialSelection||(this._pendingInitialValue=void 0,this._pendingInitialSelectedOptions=this.hasUpdated?void 0:candidates.filter(option=>isLyraOptionElement(option)&&this.contains(option))),this._restoredStateActive=!1,this._valueDirty=!0;const catalog=candidates.length>1?new Set(this.options):void 0,seen=new Set,live=candidates.filter(option=>seen.has(option)?!1:(seen.add(option),isLyraOptionElement(option)&&this.contains(option)&&(catalog?catalog.has(option):this.options.includes(option)))),selected=this.multiple?live:live.slice(0,1);this.setSelection(selected.map(option=>option.value),selected)}get selectedData(){return this.resolveOccurrenceSlots(this._selected,this._selectedOptions).map(option=>option?.data)}setSelection(next,preferred=[]){this.pendingSelectedWrites.clear(),markVetoGuardWrite(this.selectionWriteGuard);const values=this.multiple?[...next]:next.slice(0,1),previousValues=this._selected,previousOptions=this._selectedOptions,old=this.multiple?[...previousValues]:previousValues[0]??"";this.previousValue=old,this._selected=values,this._selectedOptions=this.resolveOccurrences(values,preferred),this.syncFormValue(),this.reflectSelected(),this.updateValidity(),this.requestUpdate("value",old);const sameValues=previousValues.length===values.length&&previousValues.every((value,i)=>value===values[i]),sameOptions=previousOptions.length===this._selectedOptions.length&&previousOptions.every((option,i)=>option===this._selectedOptions[i]);sameValues&&!sameOptions&&this.requestUpdate()}resolveOccurrences(values,preferred=[]){return this.resolveOccurrenceSlots(values,preferred).filter(option=>option!==void 0)}resolveOccurrenceSlots(values,preferred=[]){if(values.length===0)return[];if(values.length===1){const value=values[0],hint=preferred.length===1?preferred[0]:preferred.find(option=>option?.value===value);return[hint&&hint.value===value&&this.options.includes(hint)?hint:this.options.find(option=>option.value===value)]}const requested=new Set(values),catalog=new Set(this.options),claimed=new Set,queuesFor=options=>{const queues=new Map;for(const option of options){if(!option)continue;const value=option.value;if(!requested.has(value))continue;let queue=queues.get(value);queue||queues.set(value,queue={options:[],next:0}),queue.options.push(option)}return queues},firstUnclaimed=(queues,value)=>{const queue=queues.get(value);if(queue){for(;queue.next<queue.options.length&&claimed.has(queue.options[queue.next]);)queue.next++;return queue.options[queue.next]}},preferredQueues=preferred.length===values.length?void 0:queuesFor(preferred);let fallbackQueues;return values.map((value,index)=>{const hint=preferredQueues?firstUnclaimed(preferredQueues,value):preferred[index],match=hint&&hint.value===value&&catalog.has(hint)&&!claimed.has(hint)?hint:firstUnclaimed(fallbackQueues??=queuesFor(this.options),value);if(match)return claimed.add(match),match})}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}updateValidity(){this.barredFromValidation?this.validityController.setValidity({}):this.required&&this._selected.length===0?this.validityController.setValidity({valueMissing:!0},this.localize("selectValueMissing")):this.validityController.setValidity({}),this.reflectValidityStates()}reflectValidityStates(){syncValidityStates(this.internals,{required:this.required,hasInteracted:this.hasInteracted,barred:this.barredFromValidation}),setCustomState(this.internals,"blank",this._selected.length===0)}syncFormValue(){if(!this.multiple){this.internals.setFormValue(this._selected[0]??"");return}const state2=JSON.stringify(this._selected);if(!this.name){this.internals.setFormValue(null,state2);return}const data=new FormData;for(const value of this._selected)data.append(this.name,value);this.internals.setFormValue(data,state2)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}formResetCallback(){this._pendingInitialValue=void 0,this._pendingInitialSelectedOptions=void 0,this.touched=!1,this.hasInteracted=!1,this._restoredStateActive=!1,this._valueDirty=!1;const resetOptions=this._defaultSelectedOptions.length>0?this._defaultSelectedOptions:this.options.filter(option=>wasOptionInitiallySelected(option));this._defaultSelectedOptions.length===0&&resetOptions.length>0&&(this._defaultSelectedOptions=[...resetOptions],this._defaultSelected=resetOptions.map(option=>option.value));const defaults=new Set(resetOptions);for(const option of this.options)option[RESET_OPTION_SELECTED_FROM_OWNER](defaults.has(option));this.setSelection([...this._defaultSelected],[...this._defaultSelectedOptions])}formStateRestoreCallback(state2,reason){if(!this.multiple)this.assignValue(typeof state2=="string"?state2:void 0);else{let restored=[];if(typeof state2=="string")try{const parsed=JSON.parse(state2);Array.isArray(parsed)&&parsed.every(entry=>typeof entry=="string")&&(restored=parsed)}catch{}this.assignValue(restored)}this._restoredStateActive=!0,this._valueDirty=!0}formDisabledCallback(disabled){if(this.validityController?.reflectingDisabled)return;markVetoGuardWrite(this.selectionWriteGuard);const wasDisabled=this.effectiveDisabled;this._fieldsetDisabled=disabled,wasDisabled!==this.effectiveDisabled&&(disabled&&this.forceCloseOpenState(),this.updateValidity(),this.requestUpdate())}checkValidity(){return this.validityController.checkValidity(()=>this.updateValidity())}reportValidity(){return this.validityController.syncConstraints(),this.updateValidity(),this.markInteracted(),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.reflectValidityStates()}resetValidity(){this.setCustomValidity("")}disconnectedCallback(){this.pendingSelectedWrites.clear(),markVetoGuardWrite(this.selectionWriteGuard),this.listboxHidden=!0,this.releaseExternalDescription(),this.popupController.cancel(),super.disconnectedCallback(),this.cleanup?.(),this.cleanup=void 0,this.positionedDirection=void 0,this.typeBuffer.clear(),this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.popupController.unbindPointer(),this.open=!1}adoptedCallback(){markVetoGuardWrite(this.selectionWriteGuard),super.adoptedCallback(),this.popupController.cancel(),this.releaseExternalDescription(),this.hasUpdated&&this.syncExternalDescription(),this.cleanup?.(),this.cleanup=void 0,this.positionedDirection=void 0,this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.popupController.unbindPointer(),this.typeBuffer.clear(),queueMicrotask(()=>this.reconnectOpenPopup())}collectOptionsFromSlot(slot){const previous=new Set(this.options),previousActive=this.activeOption,previousActiveRawIndex=previousActive?this.options.indexOf(previousActive):this.activeIndex;if(this.options=slot.assignedElements({flatten:!0}).filter(isLyraOptionElement),this.optionsObserved=!0,this.adornmentClones=new WeakMap,this.reconcileActiveOption(previousActive,previousActiveRawIndex),this._defaultCaptured){const newDefaults=this.options.filter(option=>!previous.has(option)&&option.defaultSelected),newLive=this.options.filter(option=>!previous.has(option)&&option.selected&&!option.defaultSelected);this.refreshOptionDefaults();const eligible=[...!this._restoredStateActive&&!this._valueDirty?newDefaults:[],...this._restoredStateActive?[]:newLive];if(eligible.length>0){const added=this.multiple?eligible:eligible.slice(-1),occurrences=this.multiple?[...new Set([...this._selectedOptions,...added])]:added;newLive.length>0&&(this._valueDirty=!0),this.setSelection(occurrences.map(option=>option.value),occurrences);return}}else{this._defaultCaptured=!0;const explicitDefault=this.hasAttribute("default-value")||this._defaultValueDirty,allDefaults=this.options.filter(option=>option.defaultSelected),defaults=this.multiple?allDefaults:allDefaults.slice(0,1),allLive=this.options.filter(option=>option.selected),live=this.multiple?allLive:allLive.slice(0,1),initialLive=this.options.filter(option=>wasOptionInitiallySelected(option)),optionDirty=this.options.some(option=>isOptionSelectedDirty(option)),dirtySelected=this.options.filter(option=>isOptionSelectedDirty(option)&&option.selected);if(explicitDefault)this._defaultSelectedOptions=this.resolveOccurrences(this._defaultSelected);else{const resetOptions=defaults.length>0?defaults:initialLive.length>0?initialLive:live;this._defaultSelected=resetOptions.map(option=>option.value),this._defaultSelectedOptions=[...resetOptions]}const fromDefaults=explicitDefault||defaults.length>0,initial=optionDirty?this.multiple?allLive:dirtySelected.slice(-1)[0]?dirtySelected.slice(-1):live:explicitDefault?this._defaultSelectedOptions:fromDefaults?defaults:live;if(initial.length>0&&!this._restoredStateActive&&!this._valueDirty){(!fromDefaults||optionDirty)&&(this._valueDirty=!0),this.setSelection(initial.map(option=>option.value),[...initial]);return}if(optionDirty&&(this._valueDirty=!0),explicitDefault&&!this._valueDirty&&!this._restoredStateActive){this.setSelection([...this._defaultSelected],[...this._defaultSelectedOptions]);return}}if(this._pendingInitialSelectedOptions!==void 0){const pending=this._pendingInitialSelectedOptions;this._pendingInitialSelectedOptions=void 0;const resolving=this._resolvingPendingInitialSelection;this._resolvingPendingInitialSelection=!0;try{this.selectedOptions=pending}finally{this._resolvingPendingInitialSelection=resolving}return}this.reflectSelected()}refreshOptionDefaults(){if(this.hasAttribute("default-value")||this._defaultValueDirty)return;const declared=this.options.filter(option=>option.defaultSelected),defaults=this.multiple?declared:declared.slice(0,1);this._defaultSelected=defaults.map(option=>option.value),this._defaultSelectedOptions=[...defaults],!this._valueDirty&&!this._restoredStateActive&&this.setSelection([...this._defaultSelected],[...this._defaultSelectedOptions])}reflectSelected(){this._selectedOptions=this.resolveOccurrences(this._selected,this._selectedOptions),this._selectedValuesByOption=new Map(this._selectedOptions.map(option=>[option,option.value]));const chosen=new Set(this._selectedOptions);for(const option of this.options)option[SET_OPTION_SELECTED_FROM_OWNER](chosen.has(option))}selectUnknownValue(value){if(!(this.selectionRequestDispatching||this.effectiveDisabled)){if(this.multiple){const index=this._selected.indexOf(value),values=index>=0?this._selected.filter((_,position)=>position!==index):[...this._selected,value];this.requestSelection(values,this.resolveOccurrenceSlots(values,this._selectedOptions),()=>{this.emitValueEvents(),this.emit("lr-activate",{value})});return}this.hide(),this.emit("lr-activate",{value})}}resolvedLabelFor(value,occurrenceIndex=0){const option=(this._selectedOptions[occurrenceIndex]?.value===value?this._selectedOptions[occurrenceIndex]:void 0)??this.selectedIndex.values.get(value)??this.optionIndex.values.get(value);return option&&(option.label||option.value)}labelFor(value,occurrenceIndex=0){const resolved=this.resolvedLabelFor(value,occurrenceIndex);if(resolved!==void 0)return resolved;if(this.loading)return this.localize("loading");const override=this.optionsObserved?this.getUnknownLabel?.(value):void 0;return override!==void 0&&override.trim().length>0?override:value}isUnknownValue(value,occurrenceIndex=0){return!this.optionsObserved||this.loading||value===""?!1:this.resolvedLabelFor(value,occurrenceIndex)===void 0}get onlyOption(){if(!this.autoCommitSingleOption)return;const navigable=this.navigableOptions(this.options);return navigable.length===1?navigable[0]:void 0}isOptionAvailable(option){return!option.disabled&&!option.inert&&!option.closest("[inert]")}navigableOptions(options=this.listboxOptions){return this.memoOption("navigable",[options],()=>options.filter(option=>this.isOptionAvailable(option)))}get unknownValues(){return this.withUnknownOption?this._selected.filter((value,index)=>this.isUnknownValue(value,index)):[]}get unknownOptions(){const values=this.unknownValues;if(values.length===0)return this.unknownOptionCache.clear(),[];for(const key of[...this.unknownOptionCache.keys()])values.includes(key)||this.unknownOptionCache.delete(key);return values.map(value=>{let option=this.unknownOptionCache.get(value);return option||(option=this.ownerDocument.createElement(tag("option")),this.unknownOptionCache.set(value,option)),option.value=value,option.label=this.labelFor(value),option})}get optionWindow(){return this.memoOption("window",[this.callbackRefreshEpoch,this.options,this._selected,this._selectedOptions,this.activeOption,this.maxRender,this.withUnknownOption,this.loading,this.optionsObserved,this.getUnknownLabel,this.effectiveLocale,this.strings],()=>{const unknown=this.unknownOptions,all=unknown.length?[...this.options,...unknown]:this.options;return capOptionRows(all,this.maxRender,[...this.activeOption?[this.activeOption]:[],...this._selectedOptions,...unknown])})}get listboxOptions(){return this.optionWindow.rows}setActiveIndex(next,navigable=this.navigableOptions()){if(next<0||navigable.length===0){this.activeIndex=-1,this.activeOption=void 0;return}const index=Math.min(next,navigable.length-1);this.activeIndex=index,this.activeOption=navigable[index]}reconcileActiveOption(previousActive,previousRawIndex){if(!previousActive&&this.activeIndex<0)return;const navigable=this.navigableOptions();if(previousActive){const preservedIndex=navigable.indexOf(previousActive);if(preservedIndex>=0){this.setActiveIndex(preservedIndex,navigable);return}}if(navigable.length===0){this.setActiveIndex(-1,navigable);return}const pivot=Math.max(0,previousRawIndex);let nearestIndex=0,nearestDistance=Number.POSITIVE_INFINITY,nearestRawIndex=-1;const rawPositions=new Map(this.listboxOptions.map((option,index)=>[option,index]));navigable.forEach((option,index)=>{const rawIndex=rawPositions.get(option),distance=Math.abs(rawIndex-pivot);(distance<nearestDistance||distance===nearestDistance&&rawIndex>=pivot&&nearestRawIndex<pivot)&&(nearestIndex=index,nearestDistance=distance,nearestRawIndex=rawIndex)}),this.setActiveIndex(nearestIndex,navigable)}flushSelectedWrites(){this.selectedWritesQueued=!1;const writes=[...this.pendingSelectedWrites];if(this.pendingSelectedWrites.clear(),!this.isConnected||writes.length===0)return;if(!this.multiple){let value=this._selected[0],option=this._selectedOptions[0];for(const[candidate,write]of writes)this.optionIndex.members.has(candidate)&&(write.selected?(value=write.value,option=candidate):candidate===option&&(value=void 0,option=void 0));this.setSelection(value===void 0?[]:[value],option?[option]:[]);return}const queues=new Map;for(const option of this._selectedOptions){const value=this._selectedValuesByOption.get(option)??option.value;let queue=queues.get(value);queue||queues.set(value,queue={options:[],next:0}),queue.options.push(option)}const entries=this._selected.map(value=>{const queue=queues.get(value);return{value,option:queue?.options[queue.next++]}}),byOption=new Map(entries.flatMap(entry=>entry.option?[[entry.option,entry]]:[]));for(const[option,write]of writes){if(!this.optionIndex.members.has(option))continue;const entry=byOption.get(option);if(!write.selected)entry&&(entry.removed=!0);else if(entry&&!entry.removed)entry.value=write.value;else{const added={value:write.value,option};entries.push(added),byOption.set(option,added)}}const retained=entries.filter(entry=>!entry.removed);this.setSelection(retained.map(entry=>entry.value),retained.map(entry=>entry.option))}show(){if(this.open||this.effectiveDisabled)return Promise.resolve();const settled=this.popupController.wait(!0);return this.open=!0,settled}hide(){if(!this.open)return Promise.resolve();const settled=this.popupController.wait(!1);return this.open=!1,settled}positionListbox(){this.cleanup?.(),this.cleanup=void 0,this.positionedDirection=this.effectiveDirection;const anchor=this.renderRoot.querySelector('[part="trigger"]'),listbox=this.renderRoot.querySelector('[part="listbox"]');if(!anchor||!listbox)return;this.placedTopLayer=syncTopLayerRelease(listbox,this.placedTopLayer,this.topLayer),this.cleanup=place(anchor,listbox,{placement:rtlAwarePlacement(this.placement,this),...topLayerPlacement(this.topLayer,resolveEffectivePositioningStrategy(this,this._positioningStrategy,"absolute")),sync:this.sync});const operation=this.cleanup;this.positioningReady=operation.ready.then(positioned=>(positioned&&this.cleanup===operation&&this.open&&this.isConnected&&(this.listboxPositioned=!0,this.revealActiveOption()),positioned))}revealActiveOption(){if(!this.isConnected||!this.open||!this.listboxPositioned||!this.cleanup)return;const listbox=this.renderRoot.querySelector('[part="listbox"]'),activeId=this.triggerElement?.getAttribute("aria-activedescendant"),row=listbox?.querySelector('[part="option"][data-active]');listbox&&row&&activeId&&row.id===activeId&&revealRow(listbox,row)}activateListboxOverlay(){this.cleanup?.(),this.cleanup=void 0,this.overlayHandle?.deactivate({restoreFocus:!1}),this.restoreFocusOnClose=!0,this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part="listbox"]'),onEscape:()=>{this.hide()},onBackdrop:()=>{this.restoreFocusOnClose=!1,this.hide()},restoreFocusTo:this.triggerElement??null}),this.popupController.bindPointer(),this.positionListbox()}teardownListboxOverlay(restoreFocus=this.restoreFocusOnClose){this.cleanup?.(),this.cleanup=void 0,this.positionedDirection=void 0,this.overlayHandle?.deactivate({restoreFocus}),this.overlayHandle=void 0,this.popupController.unbindPointer(),this.restoreFocusOnClose=!0}reconnectOpenPopup(){!this.isConnected||!this.open||this.activateListboxOverlay()}updated(changed){super.updated(changed),this.syncExternalDescription();const suppressOpenLifecycle=changed.has("open")&&this.suppressedOpenLifecycleGeneration===this.openStateGeneration,shouldRefreshPosition=this.open&&this.isConnected&&(changed.has("placement")||changed.has("positioningStrategy")||changed.has("topLayer")||changed.has("sync")||this.positionedDirection!==this.effectiveDirection);changed.has("open")&&!this.openVetoed?this.open&&this.isConnected?(this.activateListboxOverlay(),!this._isFirstUpdate&&!suppressOpenLifecycle&&this.settleTransition("lr-after-show")):this.open?this.teardownListboxOverlay(!1):(this.teardownListboxOverlay(),!this._isFirstUpdate&&!suppressOpenLifecycle&&this.settleTransition("lr-after-hide")):changed.has("open")&&this.openVetoed?(this.restoreFocusOnClose=!0,shouldRefreshPosition&&this.positionListbox()):shouldRefreshPosition&&this.positionListbox(),(changed.has("activeIndex")||changed.has("options")||changed.has("listboxPositioned"))&&this.revealActiveOption(),(changed.has("touched")||changed.has("required")||changed.has("value"))&&this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid),changed.has("open")&&(this.pendingOpenTransitionStart=void 0,this.suppressedOpenLifecycleGeneration=void 0)}settleTransition(event){return this.popupController.settle(event,{waitForPosition:async stale=>{for(;this.open;){const readiness=this.positioningReady,positioned=await readiness;if(stale())return!1;if(positioned)break;if(readiness===this.positioningReady)return this.forceCloseOpenState(),!1}return!0},conceal:()=>{this.listboxHidden=!0,this.listboxRendered=!1}})}emitValueEvents(){const self=this,data=this.selectedData,value=self.value,previousValue=this.previousValue;dispatchNativeInputEvent(this),self.emit("lr-input",{value,previousValue,data}),dispatchNativeEvent(this,"change"),self.emit("lr-change",{value,previousValue,data})}assignValue(next){this.value=next}assignDefaultValue(next){this.defaultValue=next}requestSelection(values,preferred,afterCommit,available=()=>!0){if(this.selectionRequestDispatching||this.effectiveDisabled)return!1;const multiple=this.multiple,document=this.ownerDocument,connected=this.isConnected,open=this.open,slots=this.resolveOccurrenceSlots(values,preferred),data=slots.map(option=>option?.data),value=multiple?[...values]:values[0]??"",previousValue=this.value,self=this;let committed=!1;this.selectionRequestDispatching=!0;try{requestThenCommit({requestDetail:{value,previousValue,data},guard:this.selectionWriteGuard,emitRequest:(detail,init)=>self.emit("lr-change-request",detail,init),commit:()=>{const liveOptions=new Set(this.renderRoot.querySelector("slot:not([name])")?.assignedElements({flatten:!0})??[]);this.effectiveDisabled||this.multiple!==multiple||this.ownerDocument!==document||this.isConnected!==connected||this.open!==open||!available(liveOptions)||slots.some((option,index)=>option&&(!liveOptions.has(option)||option.value!==values[index]||!Object.is(option.data,data[index])))||(this.hasInteracted=!0,this._restoredStateActive=!1,this._valueDirty=!0,this.setSelection(values,preferred),committed=!0,afterCommit())}})}finally{this.selectionRequestDispatching=!1}return committed}selectOption(option){if(this.selectionRequestDispatching||this.effectiveDisabled||!this.isOptionAvailable(option))return;if(this.unknownOptionCache.get(option.value)===option){this.selectUnknownValue(option.value);return}const value=option.value,available=liveOptions=>liveOptions.has(option)&&option.value===value&&this.isOptionAvailable(option);if(this.multiple){const currentSlots=this.resolveOccurrenceSlots(this._selected,this._selectedOptions),selectedIndex=currentSlots.indexOf(option),selected=selectedIndex>=0,occurrences=selected?currentSlots.filter((_,index)=>index!==selectedIndex):[...currentSlots,option],values=selected?this._selected.filter((_,index)=>index!==selectedIndex):[...this._selected,value];this.requestSelection(values,occurrences,()=>{this.emitValueEvents(),this.emit("lr-activate",{value})},available);return}if(!(option!==this._selectedOptions[0]||value!==this._selected[0])){this.hide(),this.emit("lr-activate",{value});return}this.requestSelection([value],[option],()=>{this.hide(),this.emitValueEvents(),this.emit("lr-activate",{value})},available)}removeValueAt(index){return this.effectiveDisabled||index<0||index>=this._selected.length?!1:this.requestSelection(this._selected.filter((_,candidateIndex)=>candidateIndex!==index),this.resolveOccurrenceSlots(this._selected,this._selectedOptions).filter((_,candidateIndex)=>candidateIndex!==index),()=>this.emitValueEvents())}clear(){this.effectiveDisabled||this._selected.length===0||this.requestSelection([],[],()=>{this.emitValueEvents(),this.emit("lr-clear")})}removeTag(value,index,event){event.stopPropagation(),this._selected[index]===value&&this.removeValueAt(index)&&this.updateComplete.then(()=>{const buttons=[...this.renderRoot.querySelectorAll('[part~="tag__remove-button"]')];(buttons[Math.min(index,buttons.length-1)]??this.triggerElement)?.focus()})}typeAhead(char){this.typeBuffer.add(char,this.effectiveLocale);const navigable=this.navigableOptions();if(!navigable.length)return;const currentOption=this.open?navigable[this.activeIndex]:this._selectedOptions[this._selectedOptions.length-1],currentIndex=navigable.indexOf(currentOption),labels=this.memoOption("typeAheadLabels",[navigable,this.effectiveLocale],()=>{const locale=resolveIntlLocale(this.effectiveLocale);return new Map(navigable.map(option=>[option,option.label.toLocaleLowerCase(locale)]))});let match=null;for(let step=1;step<=navigable.length;step++){const index=(currentIndex+step+navigable.length)%navigable.length,option=navigable[index];if((this.open||!this.multiple||!this.selectedIndex.members.has(option))&&labels.get(option)?.startsWith(this.typeBuffer.text)){match=index;break}}if(match===null)return;const candidate=navigable[match];this.open?this.setActiveIndex(match,navigable):this.selectOption(candidate)}adornmentMarkup(option){return Array.from(option.children).filter(child=>["start","end","prefix","suffix"].includes(child.getAttribute("slot")??"")).map(child=>child.outerHTML).join("")}adornmentsFor(option){const cached=this.adornmentClones.get(option);if(cached)return cached;const cloneSlot=selector=>{const nodes=Array.from(option.querySelectorAll(selector));if(nodes.length!==0)return nodes.map(node=>node.cloneNode(!0))},resolved={markup:this.adornmentMarkup(option),start:cloneSlot(':scope > [slot="start"], :scope > [slot="prefix"]'),end:cloneSlot(':scope > [slot="end"], :scope > [slot="suffix"]')};return this.adornmentClones.set(option,resolved),resolved}renderRows(options,activeId){const out=[],chosen=new Set(this._selectedOptions);let currentGroup,groupRows=[],groupIndex=0;const flushGroup=()=>{if(groupRows.length!==0){if(currentGroup){const labelId=`${this.listId}-group-${groupIndex++}`;out.push(html`<div role="group" aria-labelledby=${labelId}>
2
2
  <div id=${labelId} class="group-label" part="group-label">${currentGroup}</div>
3
3
  ${groupRows}
4
4
  </div>`)}else out.push(...groupRows);groupRows=[]}};return options.forEach((o,i)=>{o.group!==currentGroup&&(flushGroup(),currentGroup=o.group);const id=`${this.listId}-opt-${i}`,unknown=this.unknownOptionCache.get(o.value)===o,selected=unknown||chosen.has(o),adornments=this.adornmentsFor(o);groupRows.push(html`<div
@@ -147,4 +147,4 @@ import{__decorate}from"tslib";import{capOptionRows}from"../../../internal/option
147
147
  @lr-option-change=${this.onOptionChange}
148
148
  hidden
149
149
  ></slot>
150
- `}}__decorate([property()],LyraSelect.prototype,"placeholder",void 0),__decorate([property()],LyraSelect.prototype,"label",void 0),__decorate([property()],LyraSelect.prototype,"hint",void 0),__decorate([property({attribute:"help-text"})],LyraSelect.prototype,"helpText",void 0),__decorate([property({type:Boolean,attribute:"with-label"})],LyraSelect.prototype,"withLabel",void 0),__decorate([property({type:Boolean,attribute:"with-hint"})],LyraSelect.prototype,"withHint",void 0),__decorate([property({attribute:"error-text"})],LyraSelect.prototype,"errorText",void 0),__decorate([property({type:Boolean})],LyraSelect.prototype,"autofocus",void 0),__decorate([property()],LyraSelect.prototype,"title",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraSelect.prototype,"open",null),__decorate([property({reflect:!0})],LyraSelect.prototype,"size",void 0),__decorate([property({reflect:!0})],LyraSelect.prototype,"appearance",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraSelect.prototype,"pill",void 0),__decorate([property({reflect:!0})],LyraSelect.prototype,"placement",void 0),__decorate([property({reflect:!0})],LyraSelect.prototype,"sync",void 0),__decorate([property({attribute:"positioning-strategy",reflect:!0,converter:POSITIONING_STRATEGY})],LyraSelect.prototype,"positioningStrategy",null),__decorate([property({type:Boolean,reflect:!0})],LyraSelect.prototype,"hoist",null),__decorate([property({type:Boolean,attribute:"top-layer",reflect:!0})],LyraSelect.prototype,"topLayer",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraSelect.prototype,"filled",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"with-clear"})],LyraSelect.prototype,"withClear",void 0),__decorate([property({type:Boolean})],LyraSelect.prototype,"clearable",void 0),__decorate([property({attribute:!1})],LyraSelect.prototype,"getTag",void 0),__decorate([property({type:Boolean,attribute:"with-unknown-option",reflect:!0})],LyraSelect.prototype,"withUnknownOption",void 0),__decorate([property({attribute:!1})],LyraSelect.prototype,"getUnknownLabel",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraSelect.prototype,"loading",void 0),__decorate([property({type:Boolean,attribute:"auto-commit-single-option"})],LyraSelect.prototype,"autoCommitSingleOption",void 0),__decorate([state()],LyraSelect.prototype,"activeIndex",void 0),__decorate([property({type:Number,attribute:"max-render"})],LyraSelect.prototype,"maxRender",void 0),__decorate([state()],LyraSelect.prototype,"options",void 0),__decorate([state()],LyraSelect.prototype,"optionsObserved",void 0),__decorate([state()],LyraSelect.prototype,"touched",void 0),__decorate([query('[part="trigger"]')],LyraSelect.prototype,"triggerElement",void 0),__decorate([query("slot:not([name])")],LyraSelect.prototype,"optionsSlot",void 0),__decorate([state()],LyraSelect.prototype,"listboxHidden",void 0),__decorate([state()],LyraSelect.prototype,"listboxRendered",void 0),__decorate([state()],LyraSelect.prototype,"listboxPositioned",void 0);export{LyraSelect};
150
+ `}}__decorate([property()],LyraSelect.prototype,"placeholder",void 0),__decorate([property()],LyraSelect.prototype,"label",void 0),__decorate([property({attribute:"label-display",reflect:!0})],LyraSelect.prototype,"labelDisplay",void 0),__decorate([property()],LyraSelect.prototype,"hint",void 0),__decorate([property({attribute:"help-text"})],LyraSelect.prototype,"helpText",void 0),__decorate([property({type:Boolean,attribute:"with-label"})],LyraSelect.prototype,"withLabel",void 0),__decorate([property({type:Boolean,attribute:"with-hint"})],LyraSelect.prototype,"withHint",void 0),__decorate([property({attribute:"error-text"})],LyraSelect.prototype,"errorText",void 0),__decorate([property({type:Boolean})],LyraSelect.prototype,"autofocus",void 0),__decorate([property()],LyraSelect.prototype,"title",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraSelect.prototype,"open",null),__decorate([property({reflect:!0})],LyraSelect.prototype,"size",void 0),__decorate([property({reflect:!0})],LyraSelect.prototype,"appearance",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraSelect.prototype,"pill",void 0),__decorate([property({reflect:!0})],LyraSelect.prototype,"placement",void 0),__decorate([property({reflect:!0})],LyraSelect.prototype,"sync",void 0),__decorate([property({attribute:"positioning-strategy",reflect:!0,converter:POSITIONING_STRATEGY})],LyraSelect.prototype,"positioningStrategy",null),__decorate([property({type:Boolean,reflect:!0})],LyraSelect.prototype,"hoist",null),__decorate([property({type:Boolean,attribute:"top-layer",reflect:!0})],LyraSelect.prototype,"topLayer",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraSelect.prototype,"filled",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"with-clear"})],LyraSelect.prototype,"withClear",void 0),__decorate([property({type:Boolean})],LyraSelect.prototype,"clearable",void 0),__decorate([property({attribute:!1})],LyraSelect.prototype,"getTag",void 0),__decorate([property({type:Boolean,attribute:"with-unknown-option",reflect:!0})],LyraSelect.prototype,"withUnknownOption",void 0),__decorate([property({attribute:!1})],LyraSelect.prototype,"getUnknownLabel",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraSelect.prototype,"loading",void 0),__decorate([property({type:Boolean,attribute:"auto-commit-single-option"})],LyraSelect.prototype,"autoCommitSingleOption",void 0),__decorate([state()],LyraSelect.prototype,"activeIndex",void 0),__decorate([property({type:Number,attribute:"max-render"})],LyraSelect.prototype,"maxRender",void 0),__decorate([state()],LyraSelect.prototype,"options",void 0),__decorate([state()],LyraSelect.prototype,"optionsObserved",void 0),__decorate([state()],LyraSelect.prototype,"touched",void 0),__decorate([query('[part="trigger"]')],LyraSelect.prototype,"triggerElement",void 0),__decorate([query("slot:not([name])")],LyraSelect.prototype,"optionsSlot",void 0),__decorate([state()],LyraSelect.prototype,"listboxHidden",void 0),__decorate([state()],LyraSelect.prototype,"listboxRendered",void 0),__decorate([state()],LyraSelect.prototype,"listboxPositioned",void 0);export{LyraSelect};
@@ -1,4 +1,4 @@
1
- import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraAppearance,LyraSize}from'../../../internal/variants.js';import type{LyraSelectionDirection,LyraTextWrap}from'../../../internal/shared-unions.js';import{type LyraFormValidator}from'../form-validator.js';export type TextareaResize='none'|'vertical'|'horizontal'|'both'|'auto';export type TextareaWrap=LyraTextWrap;export type TextareaSelectionDirection=LyraSelectionDirection;
1
+ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraAppearance,LyraSize,LyraLabelDisplay}from'../../../internal/variants.js';import type{LyraSelectionDirection,LyraTextWrap}from'../../../internal/shared-unions.js';import{type LyraFormValidator}from'../form-validator.js';export type TextareaResize='none'|'vertical'|'horizontal'|'both'|'auto';export type TextareaWrap=LyraTextWrap;export type TextareaSelectionDirection=LyraSelectionDirection;
2
2
  /** Scroll offsets read from, or written to, the internal native `<textarea>`.*/
3
3
  export interface TextareaScrollPosition{top:number;left:number;}
4
4
  /** Enumerated (not boolean-presence) attribute parsing for `spellcheck`, matching the native HTML
@@ -145,7 +145,14 @@ withCount:boolean;placeholder:string;
145
145
  /** Forwards native read-only behavior to the internal textarea. The value remains focusable,
146
146
  * selectable, copyable, and form-submittable; constraint validation is suspended until the
147
147
  * property is unset. */
148
- readonly:boolean;label:string;hint:string;
148
+ readonly:boolean;label:string;
149
+ /**
150
+ * Whether the `label` renders on screen. `hidden` keeps the label as the accessible name but
151
+ * removes it visually (compact toolbars, table cells); hint, error and required semantics are
152
+ * unaffected. Reflected so styles and `[label-display]` selectors match.
153
+ * @attr label-display
154
+ */
155
+ labelDisplay:LyraLabelDisplay;hint:string;
149
156
  /** Shoelace alias for {@link hint}. `hint` wins when both are set.*/
150
157
  helpText:string;
151
158
  /** SSR slot-presence hints for declarative shadow DOM and hydration.*/
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{setNativeRangeText,nativeAutocorrectAttribute}from"../../../internal/native-text-control.js";import{renderFormControlHintError}from"../../../internal/form-control-template.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{HostDescriptionController}from"../../../internal/aria-controls.js";import{isAccessibilityVisible}from"../../../internal/accessibility-visibility.js";import{LyraElement}from"../../../internal/lyra-element.js";import{OwnedFrame,OwnedTimeout}from"../../../internal/owned-timer.js";import{FormAssociated,isBarredFromValidation}from"../../../internal/form-associated.js";import{SET_ANCHORED_VALIDITY}from"../../../internal/anchored-validity.js";import{setCustomState}from"../../../internal/custom-states.js";import{lengthLimitConverter,lengthViolations,normalizeLengthLimit}from"../../../internal/length-constraints.js";import{styles}from"./textarea.styles.js";import{sizes}from"../../../internal/sizes.styles.js";import{autocorrectConverter,normalizeAutocorrect,spellcheckConverter}from"../../../internal/converters.js";import{sanitizeCssResize}from"../../../internal/safe-css.js";import{finiteDuration,finiteNumber}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{DebounceController}from"../../../internal/debounce-controller.js";import{currentValidityValidator}from"../form-validator.js";import{LYRA_DEFAULT_textareaCharacterCount,LYRA_DEFAULT_textareaCharactersRemaining,LYRA_DEFAULT_textareaLabel}from"../../../internal/default-strings/forms.generated.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings/shared.generated.js";const COUNT_ANNOUNCE_DELAY_MS=1e3;class LyraTextareaBase extends LyraElement{}class LyraTextarea extends FormAssociated(LyraTextareaBase){static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,textareaCharacterCount:LYRA_DEFAULT_textareaCharacterCount,textareaCharactersRemaining:LYRA_DEFAULT_textareaCharactersRemaining,textareaLabel:LYRA_DEFAULT_textareaLabel,valueInvalid:LYRA_DEFAULT_valueInvalid}}static get validators(){return[currentValidityValidator("required","disabled","readonly","value","minlength","maxlength")]}static{this.styles=[LyraElement.styles,sizes,styles]}get value(){return super.value}set value(next){const normalized=next??"";super.value=normalized,this.settlingValueFromInput||this.settledDebounce.cancelIfChanged(normalized)}get autocorrect(){return this.autocorrectValue}set autocorrect(next){this.autocorrectValue=normalizeAutocorrect(next),this.requestUpdate()}get inputmode(){return this.inputMode}set inputmode(next){this.inputMode=next??""}get enterkeyhint(){return this.enterKeyHint}set enterkeyhint(next){this.enterKeyHint=next??""}get defaultValueAlias(){return this.defaultValue}set defaultValueAlias(next){this.defaultValue=next??""}constructor(){super(),this.rows=4,this.resize="vertical",this.size="m",this.appearance="outlined",this.filled=!1,this.pill=!1,this.withCount=!1,this.placeholder="",this.readonly=!1,this.label="",this.hint="",this.helpText="",this.withLabel=!1,this.withHint=!1,this.errorText="",this.accessibleLabel=null,this.spellcheck=!0,this.autofocus=!1,this.title="",this.autocapitalize="",this.autocorrectValue=!0,this.wrap="soft",this.autocomplete="",this.inputMode="",this.enterKeyHint="",this.touched=!1,this.countAnnounceDelay=COUNT_ANNOUNCE_DELAY_MS,this.announcedCountText="",this.slotPresence=new SlotPresenceController(this),this.settlingValueFromInput=!1,this.settledDebounce=new DebounceController(0,value=>{this.emit("lr-input-settled",{value})}),this.resizeRaf=new OwnedFrame(this),this.countAnnounceTimer=new OwnedTimeout(this),this.hostDescription=new HostDescriptionController(this,()=>this.textareaEl??null),this.onInput=event=>{if(this.liveDisabled){event.stopPropagation();return}this.textareaEl&&(this.settlingValueFromInput=!0,this.value=this.textareaEl.value,this.settlingValueFromInput=!1,this.resize==="auto"&&this.fitToContent(),this.scheduleCountAnnouncement(),relayNativeEvent(this,event),this.emit("lr-input",{value:this.value}),this.isDebounced()?(this.settledDebounce.delayMs=this.effectiveDebounceMs,this.settledDebounce.push(this.value)):this.settledDebounce.cancel())},this.onChange=event=>{if(this.liveDisabled){event.stopPropagation();return}this.textareaEl&&(this.settledDebounce.flush(),this.value=this.textareaEl.value,relayNativeEvent(this,event),this.emit("lr-change",{value:this.value}))},this.onFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.onBlur=event=>{this.liveDisabled||(this.touched=!0),this.settledDebounce.flush(),relayNativeEvent(this,event)},this.onKeyDown=event=>{if(this.liveDisabled){event.stopPropagation();return}event.key==="Enter"&&this.settledDebounce.flush()},this.addEventListener("invalid",()=>{this.touched=!0})}get input(){return this.textareaEl??null}get selectionStart(){return this.textareaEl?.selectionStart??null}set selectionStart(value){this.textareaEl&&(this.textareaEl.selectionStart=value??0)}get selectionEnd(){return this.textareaEl?.selectionEnd??null}set selectionEnd(value){this.textareaEl&&(this.textareaEl.selectionEnd=value??0)}get selectionDirection(){return this.textareaEl?.selectionDirection}set selectionDirection(value){this.textareaEl&&(this.textareaEl.selectionDirection=value??"none")}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}click(){this.liveDisabled||this.textareaEl?.click()}focus(options){this.liveDisabled||this.textareaEl?.focus(options)}blur(){this.textareaEl?.blur()}select(){this.textareaEl?.select()}setSelectionRange(selectionStart,selectionEnd,selectionDirection="none"){this.textareaEl?.setSelectionRange(selectionStart,selectionEnd,selectionDirection)}scrollPosition(position){const ta=this.textareaEl;if(ta){if(position){position.top!==void 0&&(ta.scrollTop=finiteNumber(position.top,ta.scrollTop)),position.left!==void 0&&(ta.scrollLeft=finiteNumber(position.left,ta.scrollLeft));return}return{top:ta.scrollTop,left:ta.scrollLeft}}}setRangeText(replacement,start,end,selectMode="preserve"){const ta=this.textareaEl;ta&&(setNativeRangeText(ta,replacement,start,end,selectMode),this.value=ta.value,this.fitToContent())}connectedCallback(){super.connectedCallback(),this.countAnnouncementSink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}),this.resize==="auto"&&this.hasUpdated&&(this.armResizeObserver(),this.fitToContent())}disconnectedCallback(){this.settledDebounce.cancel(),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.resizeRaf.cancel(),this.countAnnounceTimer.cancel(),this.countAnnouncementSink?.release(),this.countAnnouncementSink=void 0,super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.hostDescription.adopted()}countText(){const format=getNumberFormat(this.effectiveLocale),max=normalizeLengthLimit(this.maxlength);if(max!==void 0){const remaining=Math.max(0,max-this.value.length);return this.localize("textareaCharactersRemaining",void 0,{count:format.format(remaining),pluralCount:remaining})}const length=this.value.length;return this.localize("textareaCharacterCount",void 0,{count:format.format(length),pluralCount:length})}scheduleCountAnnouncement(){this.countAnnounceTimer.cancel(),this.withCount&&this.countAnnounceTimer.schedule(this.countAnnounceDelay,()=>{if(!this.withCount||!isAccessibilityVisible(this))return;const text=this.countText();this.announcedCountText=text,this.countAnnouncementSink?.announce(text)})}updateValidity(){if(isBarredFromValidation(this,this.internals)){this[SET_ANCHORED_VALIDITY]({});return}if(this.required&&this.value===""){this[SET_ANCHORED_VALIDITY]({valueMissing:!0},this.localize("fieldRequired"));return}const native=this.textareaEl;native&&native.value!==this.value&&(native.value=this.value);const own=lengthViolations(this.value,this.minlength,this.maxlength),tooShort=!!native?.validity.tooShort||own.tooShort,tooLong=!!native?.validity.tooLong||own.tooLong;if(!tooShort&&!tooLong){this[SET_ANCHORED_VALIDITY]({});return}this[SET_ANCHORED_VALIDITY]({tooShort,tooLong},native?.validationMessage||this.localize("valueInvalid"))}updated(changed){super.updated(changed),changed.has("value")&&setCustomState(this.internals,"blank",this.value===""),this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid),(changed.has("minlength")||changed.has("maxlength")||changed.has("readonly"))&&this.updateValidity(),changed.has("resize")&&(this.resize==="auto"?this.armResizeObserver():changed.get("resize")==="auto"&&(this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.resizeRaf.cancel(),this.textareaEl&&(this.textareaEl.style.blockSize="",this.textareaEl.style.overflowY=""))),this.resize==="auto"&&(this.armResizeObserver(),(changed.has("value")||changed.has("rows")||changed.has("resize"))&&this.fitToContent())}formResetCallback(){super.formResetCallback(),this.touched=!1}armResizeObserver(){if(!this.isConnected)return;const textarea=this.textareaEl;if(this.resizeObserver||!textarea)return;const view=this.ownerDocument.defaultView,ResizeObserverCtor=view?.ResizeObserver;if(!view||!ResizeObserverCtor)return;this.lastObservedWidth=textarea.getBoundingClientRect().width;const observer=new ResizeObserverCtor(entries=>{if(!this.isConnected||this.ownerDocument.defaultView!==view||this.resizeObserver!==observer)return;const width=entries[0]?.contentRect.width;width===void 0||this.lastObservedWidth!==void 0&&Math.abs(width-this.lastObservedWidth)<.5||(this.lastObservedWidth=width,this.resizeRaf.schedule(()=>{this.fitToContent()}))});this.resizeObserver=observer,observer.observe(textarea)}fitToContent(){const ta=this.textareaEl;if(!this.isConnected||!ta||this.resize!=="auto")return;ta.style.blockSize="auto";const computed=ta.ownerDocument.defaultView?.getComputedStyle(ta);if(!computed)return;const borderBlock=parseFloat(computed.borderBlockStartWidth)+parseFloat(computed.borderBlockEndWidth),parsedMax=parseFloat(computed.maxBlockSize),maxBlockSize=Number.isFinite(parsedMax)?parsedMax:Number.POSITIVE_INFINITY,contentBlockSize=ta.scrollHeight+borderBlock;ta.style.blockSize=`${Math.min(contentBlockSize,maxBlockSize)}px`,ta.style.overflowY="auto"}get effectiveDebounceMs(){return finiteDuration(this.debounce??0,0)}isDebounced(){return this.effectiveDebounceMs>0}render(){const hasHint=this.slotPresence.has("hint")||this.slotPresence.has("help-text")||(this.hint??"").length>0||(this.helpText??"").length>0||this.withHint,hasError=this.slotPresence.has("error")||(this.errorText??"").length>0,hasLabel=this.slotPresence.has("label")||(this.label??"").length>0||this.withLabel,describedBy=[hasError?"textarea-error":"",hasHint?"textarea-hint":""].filter(Boolean).join(" "),cssResize=this.resize==="auto"?"none":sanitizeCssResize(this.resize,"vertical");return html`
1
+ import{__decorate}from"tslib";import{setNativeRangeText,nativeAutocorrectAttribute}from"../../../internal/native-text-control.js";import{renderFormControlHintError}from"../../../internal/form-control-template.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{HostDescriptionController}from"../../../internal/aria-controls.js";import{isAccessibilityVisible}from"../../../internal/accessibility-visibility.js";import{LyraElement}from"../../../internal/lyra-element.js";import{OwnedFrame,OwnedTimeout}from"../../../internal/owned-timer.js";import{FormAssociated,isBarredFromValidation}from"../../../internal/form-associated.js";import{SET_ANCHORED_VALIDITY}from"../../../internal/anchored-validity.js";import{setCustomState}from"../../../internal/custom-states.js";import{lengthLimitConverter,lengthViolations,normalizeLengthLimit}from"../../../internal/length-constraints.js";import{styles}from"./textarea.styles.js";import{sizes}from"../../../internal/sizes.styles.js";import{autocorrectConverter,normalizeAutocorrect,spellcheckConverter}from"../../../internal/converters.js";import{sanitizeCssResize}from"../../../internal/safe-css.js";import{finiteDuration,finiteNumber}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{DebounceController}from"../../../internal/debounce-controller.js";import{currentValidityValidator}from"../form-validator.js";import{LYRA_DEFAULT_textareaCharacterCount,LYRA_DEFAULT_textareaCharactersRemaining,LYRA_DEFAULT_textareaLabel}from"../../../internal/default-strings/forms.generated.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings/shared.generated.js";const COUNT_ANNOUNCE_DELAY_MS=1e3;class LyraTextareaBase extends LyraElement{}class LyraTextarea extends FormAssociated(LyraTextareaBase){static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,textareaCharacterCount:LYRA_DEFAULT_textareaCharacterCount,textareaCharactersRemaining:LYRA_DEFAULT_textareaCharactersRemaining,textareaLabel:LYRA_DEFAULT_textareaLabel,valueInvalid:LYRA_DEFAULT_valueInvalid}}static get validators(){return[currentValidityValidator("required","disabled","readonly","value","minlength","maxlength")]}static{this.styles=[LyraElement.styles,sizes,styles]}get value(){return super.value}set value(next){const normalized=next??"";super.value=normalized,this.settlingValueFromInput||this.settledDebounce.cancelIfChanged(normalized)}get autocorrect(){return this.autocorrectValue}set autocorrect(next){this.autocorrectValue=normalizeAutocorrect(next),this.requestUpdate()}get inputmode(){return this.inputMode}set inputmode(next){this.inputMode=next??""}get enterkeyhint(){return this.enterKeyHint}set enterkeyhint(next){this.enterKeyHint=next??""}get defaultValueAlias(){return this.defaultValue}set defaultValueAlias(next){this.defaultValue=next??""}constructor(){super(),this.rows=4,this.resize="vertical",this.size="m",this.appearance="outlined",this.filled=!1,this.pill=!1,this.withCount=!1,this.placeholder="",this.readonly=!1,this.label="",this.labelDisplay="visible",this.hint="",this.helpText="",this.withLabel=!1,this.withHint=!1,this.errorText="",this.accessibleLabel=null,this.spellcheck=!0,this.autofocus=!1,this.title="",this.autocapitalize="",this.autocorrectValue=!0,this.wrap="soft",this.autocomplete="",this.inputMode="",this.enterKeyHint="",this.touched=!1,this.countAnnounceDelay=COUNT_ANNOUNCE_DELAY_MS,this.announcedCountText="",this.slotPresence=new SlotPresenceController(this),this.settlingValueFromInput=!1,this.settledDebounce=new DebounceController(0,value=>{this.emit("lr-input-settled",{value})}),this.resizeRaf=new OwnedFrame(this),this.countAnnounceTimer=new OwnedTimeout(this),this.hostDescription=new HostDescriptionController(this,()=>this.textareaEl??null),this.onInput=event=>{if(this.liveDisabled){event.stopPropagation();return}this.textareaEl&&(this.settlingValueFromInput=!0,this.value=this.textareaEl.value,this.settlingValueFromInput=!1,this.resize==="auto"&&this.fitToContent(),this.scheduleCountAnnouncement(),relayNativeEvent(this,event),this.emit("lr-input",{value:this.value}),this.isDebounced()?(this.settledDebounce.delayMs=this.effectiveDebounceMs,this.settledDebounce.push(this.value)):this.settledDebounce.cancel())},this.onChange=event=>{if(this.liveDisabled){event.stopPropagation();return}this.textareaEl&&(this.settledDebounce.flush(),this.value=this.textareaEl.value,relayNativeEvent(this,event),this.emit("lr-change",{value:this.value}))},this.onFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.onBlur=event=>{this.liveDisabled||(this.touched=!0),this.settledDebounce.flush(),relayNativeEvent(this,event)},this.onKeyDown=event=>{if(this.liveDisabled){event.stopPropagation();return}event.key==="Enter"&&this.settledDebounce.flush()},this.addEventListener("invalid",()=>{this.touched=!0})}get input(){return this.textareaEl??null}get selectionStart(){return this.textareaEl?.selectionStart??null}set selectionStart(value){this.textareaEl&&(this.textareaEl.selectionStart=value??0)}get selectionEnd(){return this.textareaEl?.selectionEnd??null}set selectionEnd(value){this.textareaEl&&(this.textareaEl.selectionEnd=value??0)}get selectionDirection(){return this.textareaEl?.selectionDirection}set selectionDirection(value){this.textareaEl&&(this.textareaEl.selectionDirection=value??"none")}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}click(){this.liveDisabled||this.textareaEl?.click()}focus(options){this.liveDisabled||this.textareaEl?.focus(options)}blur(){this.textareaEl?.blur()}select(){this.textareaEl?.select()}setSelectionRange(selectionStart,selectionEnd,selectionDirection="none"){this.textareaEl?.setSelectionRange(selectionStart,selectionEnd,selectionDirection)}scrollPosition(position){const ta=this.textareaEl;if(ta){if(position){position.top!==void 0&&(ta.scrollTop=finiteNumber(position.top,ta.scrollTop)),position.left!==void 0&&(ta.scrollLeft=finiteNumber(position.left,ta.scrollLeft));return}return{top:ta.scrollTop,left:ta.scrollLeft}}}setRangeText(replacement,start,end,selectMode="preserve"){const ta=this.textareaEl;ta&&(setNativeRangeText(ta,replacement,start,end,selectMode),this.value=ta.value,this.fitToContent())}connectedCallback(){super.connectedCallback(),this.countAnnouncementSink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}),this.resize==="auto"&&this.hasUpdated&&(this.armResizeObserver(),this.fitToContent())}disconnectedCallback(){this.settledDebounce.cancel(),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.resizeRaf.cancel(),this.countAnnounceTimer.cancel(),this.countAnnouncementSink?.release(),this.countAnnouncementSink=void 0,super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.hostDescription.adopted()}countText(){const format=getNumberFormat(this.effectiveLocale),max=normalizeLengthLimit(this.maxlength);if(max!==void 0){const remaining=Math.max(0,max-this.value.length);return this.localize("textareaCharactersRemaining",void 0,{count:format.format(remaining),pluralCount:remaining})}const length=this.value.length;return this.localize("textareaCharacterCount",void 0,{count:format.format(length),pluralCount:length})}scheduleCountAnnouncement(){this.countAnnounceTimer.cancel(),this.withCount&&this.countAnnounceTimer.schedule(this.countAnnounceDelay,()=>{if(!this.withCount||!isAccessibilityVisible(this))return;const text=this.countText();this.announcedCountText=text,this.countAnnouncementSink?.announce(text)})}updateValidity(){if(isBarredFromValidation(this,this.internals)){this[SET_ANCHORED_VALIDITY]({});return}if(this.required&&this.value===""){this[SET_ANCHORED_VALIDITY]({valueMissing:!0},this.localize("fieldRequired"));return}const native=this.textareaEl;native&&native.value!==this.value&&(native.value=this.value);const own=lengthViolations(this.value,this.minlength,this.maxlength),tooShort=!!native?.validity.tooShort||own.tooShort,tooLong=!!native?.validity.tooLong||own.tooLong;if(!tooShort&&!tooLong){this[SET_ANCHORED_VALIDITY]({});return}this[SET_ANCHORED_VALIDITY]({tooShort,tooLong},native?.validationMessage||this.localize("valueInvalid"))}updated(changed){super.updated(changed),changed.has("value")&&setCustomState(this.internals,"blank",this.value===""),this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid),(changed.has("minlength")||changed.has("maxlength")||changed.has("readonly"))&&this.updateValidity(),changed.has("resize")&&(this.resize==="auto"?this.armResizeObserver():changed.get("resize")==="auto"&&(this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.resizeRaf.cancel(),this.textareaEl&&(this.textareaEl.style.blockSize="",this.textareaEl.style.overflowY=""))),this.resize==="auto"&&(this.armResizeObserver(),(changed.has("value")||changed.has("rows")||changed.has("resize"))&&this.fitToContent())}formResetCallback(){super.formResetCallback(),this.touched=!1}armResizeObserver(){if(!this.isConnected)return;const textarea=this.textareaEl;if(this.resizeObserver||!textarea)return;const view=this.ownerDocument.defaultView,ResizeObserverCtor=view?.ResizeObserver;if(!view||!ResizeObserverCtor)return;this.lastObservedWidth=textarea.getBoundingClientRect().width;const observer=new ResizeObserverCtor(entries=>{if(!this.isConnected||this.ownerDocument.defaultView!==view||this.resizeObserver!==observer)return;const width=entries[0]?.contentRect.width;width===void 0||this.lastObservedWidth!==void 0&&Math.abs(width-this.lastObservedWidth)<.5||(this.lastObservedWidth=width,this.resizeRaf.schedule(()=>{this.fitToContent()}))});this.resizeObserver=observer,observer.observe(textarea)}fitToContent(){const ta=this.textareaEl;if(!this.isConnected||!ta||this.resize!=="auto")return;ta.style.blockSize="auto";const computed=ta.ownerDocument.defaultView?.getComputedStyle(ta);if(!computed)return;const borderBlock=parseFloat(computed.borderBlockStartWidth)+parseFloat(computed.borderBlockEndWidth),parsedMax=parseFloat(computed.maxBlockSize),maxBlockSize=Number.isFinite(parsedMax)?parsedMax:Number.POSITIVE_INFINITY,contentBlockSize=ta.scrollHeight+borderBlock;ta.style.blockSize=`${Math.min(contentBlockSize,maxBlockSize)}px`,ta.style.overflowY="auto"}get effectiveDebounceMs(){return finiteDuration(this.debounce??0,0)}isDebounced(){return this.effectiveDebounceMs>0}render(){const hasHint=this.slotPresence.has("hint")||this.slotPresence.has("help-text")||(this.hint??"").length>0||(this.helpText??"").length>0||this.withHint,hasError=this.slotPresence.has("error")||(this.errorText??"").length>0,hasLabel=this.slotPresence.has("label")||(this.label??"").length>0||this.withLabel,describedBy=[hasError?"textarea-error":"",hasHint?"textarea-hint":""].filter(Boolean).join(" "),cssResize=this.resize==="auto"?"none":sanitizeCssResize(this.resize,"vertical");return html`
2
2
  <div part="form-control">
3
3
  <label part="form-control-label" for="textarea" ?hidden=${!hasLabel}>
4
4
  <span part="label">${this.label}<slot name="label"></slot></span>
@@ -48,4 +48,4 @@ import{__decorate}from"tslib";import{setNativeRangeText,nativeAutocorrectAttribu
48
48
  </div>`:nothing}
49
49
  </div>
50
50
  </div>
51
- `}}__decorate([property({type:Number})],LyraTextarea.prototype,"rows",void 0),__decorate([property({reflect:!0})],LyraTextarea.prototype,"resize",void 0),__decorate([property({reflect:!0})],LyraTextarea.prototype,"size",void 0),__decorate([property({reflect:!0})],LyraTextarea.prototype,"appearance",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraTextarea.prototype,"filled",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraTextarea.prototype,"pill",void 0),__decorate([property({attribute:"with-count",type:Boolean,reflect:!0})],LyraTextarea.prototype,"withCount",void 0),__decorate([property()],LyraTextarea.prototype,"placeholder",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraTextarea.prototype,"readonly",void 0),__decorate([property()],LyraTextarea.prototype,"label",void 0),__decorate([property()],LyraTextarea.prototype,"hint",void 0),__decorate([property({attribute:"help-text"})],LyraTextarea.prototype,"helpText",void 0),__decorate([property({type:Boolean,attribute:"with-label"})],LyraTextarea.prototype,"withLabel",void 0),__decorate([property({type:Boolean,attribute:"with-hint"})],LyraTextarea.prototype,"withHint",void 0),__decorate([property({attribute:"error-text"})],LyraTextarea.prototype,"errorText",void 0),__decorate([property({attribute:"aria-label"})],LyraTextarea.prototype,"accessibleLabel",void 0),__decorate([property({converter:spellcheckConverter})],LyraTextarea.prototype,"spellcheck",void 0),__decorate([property({type:Boolean})],LyraTextarea.prototype,"autofocus",void 0),__decorate([property()],LyraTextarea.prototype,"title",void 0),__decorate([property()],LyraTextarea.prototype,"autocapitalize",void 0),__decorate([property()],LyraTextarea.prototype,"wrap",void 0),__decorate([property()],LyraTextarea.prototype,"autocomplete",void 0),__decorate([property({attribute:"inputmode"})],LyraTextarea.prototype,"inputMode",void 0),__decorate([property({attribute:"enterkeyhint"})],LyraTextarea.prototype,"enterKeyHint",void 0),__decorate([property({converter:autocorrectConverter})],LyraTextarea.prototype,"autocorrect",null),__decorate([property({attribute:"default-value"})],LyraTextarea.prototype,"defaultValueAlias",null),__decorate([property({converter:lengthLimitConverter})],LyraTextarea.prototype,"minlength",void 0),__decorate([property({converter:lengthLimitConverter})],LyraTextarea.prototype,"maxlength",void 0),__decorate([property({type:Number})],LyraTextarea.prototype,"debounce",void 0),__decorate([state()],LyraTextarea.prototype,"touched",void 0),__decorate([state()],LyraTextarea.prototype,"announcedCountText",void 0),__decorate([query("textarea")],LyraTextarea.prototype,"textareaEl",void 0);export{LyraTextarea};
51
+ `}}__decorate([property({type:Number})],LyraTextarea.prototype,"rows",void 0),__decorate([property({reflect:!0})],LyraTextarea.prototype,"resize",void 0),__decorate([property({reflect:!0})],LyraTextarea.prototype,"size",void 0),__decorate([property({reflect:!0})],LyraTextarea.prototype,"appearance",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraTextarea.prototype,"filled",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraTextarea.prototype,"pill",void 0),__decorate([property({attribute:"with-count",type:Boolean,reflect:!0})],LyraTextarea.prototype,"withCount",void 0),__decorate([property()],LyraTextarea.prototype,"placeholder",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraTextarea.prototype,"readonly",void 0),__decorate([property()],LyraTextarea.prototype,"label",void 0),__decorate([property({attribute:"label-display",reflect:!0})],LyraTextarea.prototype,"labelDisplay",void 0),__decorate([property()],LyraTextarea.prototype,"hint",void 0),__decorate([property({attribute:"help-text"})],LyraTextarea.prototype,"helpText",void 0),__decorate([property({type:Boolean,attribute:"with-label"})],LyraTextarea.prototype,"withLabel",void 0),__decorate([property({type:Boolean,attribute:"with-hint"})],LyraTextarea.prototype,"withHint",void 0),__decorate([property({attribute:"error-text"})],LyraTextarea.prototype,"errorText",void 0),__decorate([property({attribute:"aria-label"})],LyraTextarea.prototype,"accessibleLabel",void 0),__decorate([property({converter:spellcheckConverter})],LyraTextarea.prototype,"spellcheck",void 0),__decorate([property({type:Boolean})],LyraTextarea.prototype,"autofocus",void 0),__decorate([property()],LyraTextarea.prototype,"title",void 0),__decorate([property()],LyraTextarea.prototype,"autocapitalize",void 0),__decorate([property()],LyraTextarea.prototype,"wrap",void 0),__decorate([property()],LyraTextarea.prototype,"autocomplete",void 0),__decorate([property({attribute:"inputmode"})],LyraTextarea.prototype,"inputMode",void 0),__decorate([property({attribute:"enterkeyhint"})],LyraTextarea.prototype,"enterKeyHint",void 0),__decorate([property({converter:autocorrectConverter})],LyraTextarea.prototype,"autocorrect",null),__decorate([property({attribute:"default-value"})],LyraTextarea.prototype,"defaultValueAlias",null),__decorate([property({converter:lengthLimitConverter})],LyraTextarea.prototype,"minlength",void 0),__decorate([property({converter:lengthLimitConverter})],LyraTextarea.prototype,"maxlength",void 0),__decorate([property({type:Number})],LyraTextarea.prototype,"debounce",void 0),__decorate([state()],LyraTextarea.prototype,"touched",void 0),__decorate([state()],LyraTextarea.prototype,"announcedCountText",void 0),__decorate([query("textarea")],LyraTextarea.prototype,"textareaEl",void 0);export{LyraTextarea};
@@ -1,4 +1,4 @@
1
- import{type PropertyValues,type TemplateResult}from'lit';import{LyraFormControlElement}from'../../../internal/form-control-element.js';import type{LyraSize}from'../../../internal/variants.js';import{type FormOwnerValue}from'../../../internal/form-associated.js';export interface LyraTokenInputEventMap{'lr-invalid':CustomEvent<null>;input:InputEvent;change:Event;focus:FocusEvent;blur:FocusEvent;'lr-input':CustomEvent<Readonly<{value:readonly string[];previousValue:readonly string[];}>>;'lr-change':CustomEvent<Readonly<{value:readonly string[];previousValue:readonly string[];}>>;
1
+ import{type PropertyValues,type TemplateResult}from'lit';import{LyraFormControlElement}from'../../../internal/form-control-element.js';import type{LyraSize,LyraLabelDisplay}from'../../../internal/variants.js';import{type FormOwnerValue}from'../../../internal/form-associated.js';export interface LyraTokenInputEventMap{'lr-invalid':CustomEvent<null>;input:InputEvent;change:Event;focus:FocusEvent;blur:FocusEvent;'lr-input':CustomEvent<Readonly<{value:readonly string[];previousValue:readonly string[];}>>;'lr-change':CustomEvent<Readonly<{value:readonly string[];previousValue:readonly string[];}>>;
2
2
  /** Cancelable proposal to add one or more tokens in a single commit.*/
3
3
  'lr-token-add-request':CustomEvent<Readonly<{value:string;values:readonly string[];}>>;
4
4
  /** Cancelable proposal to remove one token.*/
@@ -134,7 +134,14 @@ import{type PropertyValues,type TemplateResult}from'lit';import{LyraFormControlE
134
134
  * @status stable
135
135
  * @since 4.0.0
136
136
  */
137
- export declare class LyraTokenInput extends LyraFormControlElement<LyraTokenInputEventMap>{static formAssociated:boolean;static styles:import("lit").CSSResultGroup[];static properties:{customError:{attribute:string;reflect:boolean;noAccessor:boolean;};name:{reflect:boolean;noAccessor:boolean;};required:{type:BooleanConstructor;reflect:boolean;noAccessor:boolean;};disabled:{type:BooleanConstructor;reflect:boolean;noAccessor:boolean;};readonly:{type:BooleanConstructor;reflect:boolean;noAccessor:boolean;};defaultValue:{attribute:string;reflect:boolean;useDefault:boolean;converter:{fromAttribute:(value:string|null)=>readonly string[]|null;toAttribute:(value:readonly string[]|null)=>string|null;};noAccessor:boolean;};};label:string;hint:string;errorText:string;placeholder:string;
137
+ export declare class LyraTokenInput extends LyraFormControlElement<LyraTokenInputEventMap>{static formAssociated:boolean;static styles:import("lit").CSSResultGroup[];static properties:{customError:{attribute:string;reflect:boolean;noAccessor:boolean;};name:{reflect:boolean;noAccessor:boolean;};required:{type:BooleanConstructor;reflect:boolean;noAccessor:boolean;};disabled:{type:BooleanConstructor;reflect:boolean;noAccessor:boolean;};readonly:{type:BooleanConstructor;reflect:boolean;noAccessor:boolean;};defaultValue:{attribute:string;reflect:boolean;useDefault:boolean;converter:{fromAttribute:(value:string|null)=>readonly string[]|null;toAttribute:(value:readonly string[]|null)=>string|null;};noAccessor:boolean;};};label:string;
138
+ /**
139
+ * Whether the `label` renders on screen. `hidden` keeps the label as the accessible name but
140
+ * removes it visually (compact toolbars, table cells); hint, error and required semantics are
141
+ * unaffected. Reflected so styles and `[label-display]` selectors match.
142
+ * @attr label-display
143
+ */
144
+ labelDisplay:LyraLabelDisplay;hint:string;errorText:string;placeholder:string;
138
145
  /** Forwarded to both native text inputs using the native explicit `"true"`/`"false"`
139
146
  * attribute vocabulary. */
140
147
  spellcheck:boolean;