@fluid-topics/ft-select 1.3.13 → 1.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ft-select.js +1 -1
- package/build/ft-select.light.js +1 -1
- package/build/ft-select.min.js +62 -62
- package/package.json +7 -7
package/build/ft-select.js
CHANGED
|
@@ -157,7 +157,7 @@ class FtSelect extends FtLitElement {
|
|
|
157
157
|
if (props.has("optionsDisplayed") && this.hasOptionsMenuOpen) {
|
|
158
158
|
this.optionsMenu.style.width = this.mainPanel.getBoundingClientRect().width + "px";
|
|
159
159
|
const fallbackPlacements = ["bottom", "top"];
|
|
160
|
-
computeOffsetAutoPosition(this.mainPanel, this.optionsMenu, "bottom", fallbackPlacements, "fixed", FtSelectCssVariables.optionsHeight
|
|
160
|
+
computeOffsetAutoPosition(this.mainPanel, this.optionsMenu, "bottom", fallbackPlacements, "fixed", FtSelectCssVariables.optionsHeight, 0)
|
|
161
161
|
.then(({ x, y }) => {
|
|
162
162
|
this.optionsMenu.style.left = `${x}px`;
|
|
163
163
|
this.optionsMenu.style.top = `${y}px`;
|
package/build/ft-select.light.js
CHANGED
|
@@ -699,7 +699,7 @@ Also for action icons.`,t.colorGray200),contentGlobalSubtle:e.extend("--ft-conte
|
|
|
699
699
|
<ft-ripple ?primary=${n} ?activated=${n}></ft-ripple>
|
|
700
700
|
<span>${r.label}</span>
|
|
701
701
|
</div>
|
|
702
|
-
`}update(r){super.update(r),r.has("options")&&(this.selectedOption=this.options.filter(n=>n.selected)[0]),r.has("selectedOption")&&(this.optionsDisplayed=!1)}contentAvailableCallback(r){var n,i;if(super.contentAvailableCallback(r),r.has("focusOptions")&&this.focusOptions&&((i=(n=this.selectedOptionElement)!==null&&n!==void 0?n:this.firstOption)===null||i===void 0||i.focus(),this.focusOptions=!1),r.has("optionsDisplayed")&&this.hasOptionsMenuOpen){this.optionsMenu.style.width=this.mainPanel.getBoundingClientRect().width+"px";let l=["bottom","top"];(0,le.computeOffsetAutoPosition)(this.mainPanel,this.optionsMenu,"bottom",l,"fixed",m.optionsHeight
|
|
702
|
+
`}update(r){super.update(r),r.has("options")&&(this.selectedOption=this.options.filter(n=>n.selected)[0]),r.has("selectedOption")&&(this.optionsDisplayed=!1)}contentAvailableCallback(r){var n,i;if(super.contentAvailableCallback(r),r.has("focusOptions")&&this.focusOptions&&((i=(n=this.selectedOptionElement)!==null&&n!==void 0?n:this.firstOption)===null||i===void 0||i.focus(),this.focusOptions=!1),r.has("optionsDisplayed")&&this.hasOptionsMenuOpen){this.optionsMenu.style.width=this.mainPanel.getBoundingClientRect().width+"px";let l=["bottom","top"];(0,le.computeOffsetAutoPosition)(this.mainPanel,this.optionsMenu,"bottom",l,"fixed",m.optionsHeight,0).then(({x:d,y:c})=>{this.optionsMenu.style.left=`${d}px`,this.optionsMenu.style.top=`${c}px`})}}get hasOptionsMenuOpen(){return!this.disabled&&this.optionsDisplayed&&this.hasOptions}get hasOptions(){return this.options.length>0}updateOptionsFromSlot(r){var n;r.stopPropagation();let i=(n=this.optionsSlot)===null||n===void 0?void 0:n.assignedElements().map(l=>l);i&&i.length>0&&(this.options=i)}onMainPanelKeyDown(r){switch(r.key){case" ":r.preventDefault(),r.stopPropagation();case"Enter":this.optionsDisplayed=!this.optionsDisplayed,this.focusOptions=!0;break;case"ArrowUp":case"ArrowDown":r.preventDefault(),r.stopPropagation(),this.optionsDisplayed=!0,this.focusOptions=!0;break}}onOptionsKeyDown(r){var n,i,l,d,c;let p;switch(r.key){case"Escape":this.optionsDisplayed=!1,(n=this.mainPanel)===null||n===void 0||n.focus();break;case"Tab":this.optionsDisplayed=!1;break;case"ArrowUp":r.preventDefault(),r.stopPropagation(),p=(l=(i=this.focusedOption)===null||i===void 0?void 0:i.previousElementSibling)!==null&&l!==void 0?l:this.lastOption;break;case"ArrowDown":r.preventDefault(),r.stopPropagation(),p=(c=(d=this.focusedOption)===null||d===void 0?void 0:d.nextElementSibling)!==null&&c!==void 0?c:this.firstOption;break;default:if(r.key.length!=1)break;this.isKeyAlphanumeric(r.key)&&(p=this.handleAlphanumericPress(r.key));break}p?.focus()}isKeyAlphanumeric(r){let n=r.charCodeAt(0);return n>47&&n<58||n>64&&n<91||n>96&&n<123}handleAlphanumericPress(r){var n,i;let l=new Date;l.getTime()-this.lastSearchInputDate.getTime()>o.searchTimeoutMilliseconds&&(this.currentSearch=""),this.currentSearch+=r.toLowerCase();let d=this.options.find(p=>{var y;return((y=p.label)===null||y===void 0?void 0:y.toLowerCase().substring(0,this.currentSearch.length))===this.currentSearch});if(d===void 0){this.lastSearchInputDate=l;return}let c=(i=(n=this.optionsMenu)===null||n===void 0?void 0:n.querySelector(`[data-value="${d.value}"]`))!==null&&i!==void 0?i:void 0;return this.lastSearchInputDate=l,c}onOptionKeyDown(r,n){var i;(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),r.stopPropagation(),this.selectOption(n),this.optionsDisplayed=!1,(i=this.mainPanel)===null||i===void 0||i.focus())}selectOption(r){var n,i;if(!(0,le.deepEqual)((n=this.selectedOption)===null||n===void 0?void 0:n.value,r.value)){this.selectedOption=r;for(let l of this.options)l.selected=l===r;this.dispatchEvent(new CustomEvent("change",{detail:(i=this.selectedOption)===null||i===void 0?void 0:i.value}))}this.optionsDisplayed=!1}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.hideOptions)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.hideOptions)}};S.elementDefinitions={"ft-input-label":_,"ft-typography":F,"ft-ripple":R,"ft-icon":$};S.searchTimeoutMilliseconds=2e3;S.styles=[$e,q,Uo];N([(0,C.property)({type:String})],S.prototype,"label",void 0);N([(0,C.property)({type:String})],S.prototype,"ariaLabel",void 0);N([(0,C.property)({type:String})],S.prototype,"helper",void 0);N([(0,C.property)({type:Boolean})],S.prototype,"outlined",void 0);N([(0,C.property)({type:Boolean})],S.prototype,"disabled",void 0);N([(0,C.property)({type:Boolean})],S.prototype,"error",void 0);N([(0,C.property)({type:Boolean})],S.prototype,"fixedMenuPosition",void 0);N([(0,C.property)({type:Array})],S.prototype,"options",void 0);N([(0,C.state)()],S.prototype,"selectedOption",void 0);N([(0,C.state)()],S.prototype,"optionsDisplayed",void 0);N([(0,C.state)()],S.prototype,"focusOptions",void 0);N([(0,C.state)()],S.prototype,"currentSearch",void 0);N([(0,C.state)()],S.prototype,"lastSearchInputDate",void 0);N([(0,C.query)(".ft-select")],S.prototype,"container",void 0);N([(0,C.query)(".ft-select--options")],S.prototype,"optionsMenu",void 0);N([(0,C.query)(".ft-select--input-panel")],S.prototype,"mainPanel",void 0);N([(0,C.query)(".ft-select--option:first-child")],S.prototype,"firstOption",void 0);N([(0,C.query)(".ft-select--option:focus")],S.prototype,"focusedOption",void 0);N([(0,C.query)(".ft-select--option.ft-select--option-selected")],S.prototype,"selectedOptionElement",void 0);N([(0,C.query)(".ft-select--option:last-child")],S.prototype,"lastOption",void 0);N([(0,C.query)("slot:not([name])")],S.prototype,"optionsSlot",void 0);(0,rt.customElement)("ft-select")(S);(0,rt.customElement)("ft-select-option")(ee);})();
|
|
703
703
|
/*! Bundled license information:
|
|
704
704
|
|
|
705
705
|
lit-html/lit-html.js:
|