UNPKG

@spectrum-web-components/picker

Version:

An `<sp-picker>` is an alternative to HTML's `<select>` element. Use [`<sp-menu-item>`](../menu-item) elements to outline the options that will be made available to the user when interacting with the `<sp-picker>` element.

3 lines (2 loc) 1.01 kB
"use strict";import{InteractionController as r,InteractionTypes as s,SAFARI_FOCUS_RING_CLASS as e}from"./InteractionController.js";import{isWebKit as o}from"@spectrum-web-components/shared";export class MobileController extends r{constructor(){super(...arguments);this.type=s.mobile}handleClick(){this.host.disabled||(this.preventNextToggle=="no"&&this.host.toggle(),this.preventNextToggle="no")}handlePointerdown(){this.preventNextToggle=this.open?"yes":"no",o()&&this.target.classList.add(e)}handleFocusOut(){this.host.open||o()&&this.target.classList.contains(e)&&this.target.classList.remove(e)}init(){var i;(i=this.abortController)==null||i.abort(),this.abortController=new AbortController;const{signal:t}=this.abortController;this.target.addEventListener("click",()=>this.handleClick(),{signal:t}),this.target.addEventListener("pointerdown",()=>this.handlePointerdown(),{signal:t}),this.target.addEventListener("focusout",()=>this.handleFocusOut(),{signal:t})}} //# sourceMappingURL=MobileController.js.map