@fluid-topics/ft-reader-search-in-document 1.3.14 → 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.
@@ -2777,7 +2777,7 @@ Also for action icons.`,c.colorGray200),contentGlobalSubtle:o.extend("--ft-conte
2777
2777
  <ft-ripple ?primary=${r} ?activated=${r}></ft-ripple>
2778
2778
  <span>${e.label}</span>
2779
2779
  </div>
2780
- `}update(e){super.update(e),e.has("options")&&(this.selectedOption=this.options.filter(r=>r.selected)[0]),e.has("selectedOption")&&(this.optionsDisplayed=!1)}contentAvailableCallback(e){var r,i;if(super.contentAvailableCallback(e),e.has("focusOptions")&&this.focusOptions&&((i=(r=this.selectedOptionElement)!==null&&r!==void 0?r:this.firstOption)===null||i===void 0||i.focus(),this.focusOptions=!1),e.has("optionsDisplayed")&&this.hasOptionsMenuOpen){this.optionsMenu.style.width=this.mainPanel.getBoundingClientRect().width+"px";let n=["bottom","top"];(0,ri.computeOffsetAutoPosition)(this.mainPanel,this.optionsMenu,"bottom",n,"fixed",Q.optionsHeight.name,0).then(({x:a,y:s})=>{this.optionsMenu.style.left=`${a}px`,this.optionsMenu.style.top=`${s}px`})}}get hasOptionsMenuOpen(){return!this.disabled&&this.optionsDisplayed&&this.hasOptions}get hasOptions(){return this.options.length>0}updateOptionsFromSlot(e){var r;e.stopPropagation();let i=(r=this.optionsSlot)===null||r===void 0?void 0:r.assignedElements().map(n=>n);i&&i.length>0&&(this.options=i)}onMainPanelKeyDown(e){switch(e.key){case" ":e.preventDefault(),e.stopPropagation();case"Enter":this.optionsDisplayed=!this.optionsDisplayed,this.focusOptions=!0;break;case"ArrowUp":case"ArrowDown":e.preventDefault(),e.stopPropagation(),this.optionsDisplayed=!0,this.focusOptions=!0;break}}onOptionsKeyDown(e){var r,i,n,a,s;let l;switch(e.key){case"Escape":this.optionsDisplayed=!1,(r=this.mainPanel)===null||r===void 0||r.focus();break;case"Tab":this.optionsDisplayed=!1;break;case"ArrowUp":e.preventDefault(),e.stopPropagation(),l=(n=(i=this.focusedOption)===null||i===void 0?void 0:i.previousElementSibling)!==null&&n!==void 0?n:this.lastOption;break;case"ArrowDown":e.preventDefault(),e.stopPropagation(),l=(s=(a=this.focusedOption)===null||a===void 0?void 0:a.nextElementSibling)!==null&&s!==void 0?s:this.firstOption;break;default:if(e.key.length!=1)break;this.isKeyAlphanumeric(e.key)&&(l=this.handleAlphanumericPress(e.key));break}l?.focus()}isKeyAlphanumeric(e){let r=e.charCodeAt(0);return r>47&&r<58||r>64&&r<91||r>96&&r<123}handleAlphanumericPress(e){var r,i;let n=new Date;n.getTime()-this.lastSearchInputDate.getTime()>t.searchTimeoutMilliseconds&&(this.currentSearch=""),this.currentSearch+=e.toLowerCase();let a=this.options.find(l=>{var u;return((u=l.label)===null||u===void 0?void 0:u.toLowerCase().substring(0,this.currentSearch.length))===this.currentSearch});if(a===void 0){this.lastSearchInputDate=n;return}let s=(i=(r=this.optionsMenu)===null||r===void 0?void 0:r.querySelector(`[data-value="${a.value}"]`))!==null&&i!==void 0?i:void 0;return this.lastSearchInputDate=n,s}onOptionKeyDown(e,r){var i;(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation(),this.selectOption(r),this.optionsDisplayed=!1,(i=this.mainPanel)===null||i===void 0||i.focus())}selectOption(e){var r,i;if(!(0,ri.deepEqual)((r=this.selectedOption)===null||r===void 0?void 0:r.value,e.value)){this.selectedOption=e;for(let n of this.options)n.selected=n===e;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)}};ce.elementDefinitions={"ft-input-label":cr,"ft-typography":q,"ft-ripple":j,"ft-icon":fe};ce.searchTimeoutMilliseconds=2e3;ce.styles=[eo,yr,wb];Re([(0,ye.property)({type:String})],ce.prototype,"label",void 0);Re([(0,ye.property)({type:String})],ce.prototype,"ariaLabel",void 0);Re([(0,ye.property)({type:String})],ce.prototype,"helper",void 0);Re([(0,ye.property)({type:Boolean})],ce.prototype,"outlined",void 0);Re([(0,ye.property)({type:Boolean})],ce.prototype,"disabled",void 0);Re([(0,ye.property)({type:Boolean})],ce.prototype,"error",void 0);Re([(0,ye.property)({type:Boolean})],ce.prototype,"fixedMenuPosition",void 0);Re([(0,ye.property)({type:Array})],ce.prototype,"options",void 0);Re([(0,ye.state)()],ce.prototype,"selectedOption",void 0);Re([(0,ye.state)()],ce.prototype,"optionsDisplayed",void 0);Re([(0,ye.state)()],ce.prototype,"focusOptions",void 0);Re([(0,ye.state)()],ce.prototype,"currentSearch",void 0);Re([(0,ye.state)()],ce.prototype,"lastSearchInputDate",void 0);Re([(0,ye.query)(".ft-select")],ce.prototype,"container",void 0);Re([(0,ye.query)(".ft-select--options")],ce.prototype,"optionsMenu",void 0);Re([(0,ye.query)(".ft-select--input-panel")],ce.prototype,"mainPanel",void 0);Re([(0,ye.query)(".ft-select--option:first-child")],ce.prototype,"firstOption",void 0);Re([(0,ye.query)(".ft-select--option:focus")],ce.prototype,"focusedOption",void 0);Re([(0,ye.query)(".ft-select--option.ft-select--option-selected")],ce.prototype,"selectedOptionElement",void 0);Re([(0,ye.query)(".ft-select--option:last-child")],ce.prototype,"lastOption",void 0);Re([(0,ye.query)("slot:not([name])")],ce.prototype,"optionsSlot",void 0)});var Ab=p(()=>{"use strict"});var dd,Rb=p(()=>{"use strict";dd=f(x());cd();cd();cs();Ab();(0,dd.customElement)("ft-select")(ce);(0,dd.customElement)("ft-select-option")(kr)});var Ib,dr,et,kb,ds=p(()=>{"use strict";Ib=f(R()),dr=f(x()),et={display:dr.FtCssVariableFactory.create("--ft-skeleton--display","","DISPLAY","block"),width:dr.FtCssVariableFactory.create("--ft-skeleton--width","","SIZE","100%"),height:dr.FtCssVariableFactory.create("--ft-skeleton--height","","SIZE","20px"),backgroundColor:dr.FtCssVariableFactory.create("--ft-skeleton--background-color","","COLOR","#f1f1f1"),glareWidth:dr.FtCssVariableFactory.create("--ft-skeleton--glare-width","","SIZE","200px"),glareColor:dr.FtCssVariableFactory.create("--ft-skeleton--glare-color","","COLOR","rgba(255, 255, 255, .6)"),animationDuration:dr.FtCssVariableFactory.create("--ft-skeleton--animation-duration","","UNKNOWN","2s"),borderRadiusM:dr.FtCssVariableFactory.external(dr.designSystemVariables.borderRadiusM,"Design system")},kb=Ib.css`
2780
+ `}update(e){super.update(e),e.has("options")&&(this.selectedOption=this.options.filter(r=>r.selected)[0]),e.has("selectedOption")&&(this.optionsDisplayed=!1)}contentAvailableCallback(e){var r,i;if(super.contentAvailableCallback(e),e.has("focusOptions")&&this.focusOptions&&((i=(r=this.selectedOptionElement)!==null&&r!==void 0?r:this.firstOption)===null||i===void 0||i.focus(),this.focusOptions=!1),e.has("optionsDisplayed")&&this.hasOptionsMenuOpen){this.optionsMenu.style.width=this.mainPanel.getBoundingClientRect().width+"px";let n=["bottom","top"];(0,ri.computeOffsetAutoPosition)(this.mainPanel,this.optionsMenu,"bottom",n,"fixed",Q.optionsHeight,0).then(({x:a,y:s})=>{this.optionsMenu.style.left=`${a}px`,this.optionsMenu.style.top=`${s}px`})}}get hasOptionsMenuOpen(){return!this.disabled&&this.optionsDisplayed&&this.hasOptions}get hasOptions(){return this.options.length>0}updateOptionsFromSlot(e){var r;e.stopPropagation();let i=(r=this.optionsSlot)===null||r===void 0?void 0:r.assignedElements().map(n=>n);i&&i.length>0&&(this.options=i)}onMainPanelKeyDown(e){switch(e.key){case" ":e.preventDefault(),e.stopPropagation();case"Enter":this.optionsDisplayed=!this.optionsDisplayed,this.focusOptions=!0;break;case"ArrowUp":case"ArrowDown":e.preventDefault(),e.stopPropagation(),this.optionsDisplayed=!0,this.focusOptions=!0;break}}onOptionsKeyDown(e){var r,i,n,a,s;let l;switch(e.key){case"Escape":this.optionsDisplayed=!1,(r=this.mainPanel)===null||r===void 0||r.focus();break;case"Tab":this.optionsDisplayed=!1;break;case"ArrowUp":e.preventDefault(),e.stopPropagation(),l=(n=(i=this.focusedOption)===null||i===void 0?void 0:i.previousElementSibling)!==null&&n!==void 0?n:this.lastOption;break;case"ArrowDown":e.preventDefault(),e.stopPropagation(),l=(s=(a=this.focusedOption)===null||a===void 0?void 0:a.nextElementSibling)!==null&&s!==void 0?s:this.firstOption;break;default:if(e.key.length!=1)break;this.isKeyAlphanumeric(e.key)&&(l=this.handleAlphanumericPress(e.key));break}l?.focus()}isKeyAlphanumeric(e){let r=e.charCodeAt(0);return r>47&&r<58||r>64&&r<91||r>96&&r<123}handleAlphanumericPress(e){var r,i;let n=new Date;n.getTime()-this.lastSearchInputDate.getTime()>t.searchTimeoutMilliseconds&&(this.currentSearch=""),this.currentSearch+=e.toLowerCase();let a=this.options.find(l=>{var u;return((u=l.label)===null||u===void 0?void 0:u.toLowerCase().substring(0,this.currentSearch.length))===this.currentSearch});if(a===void 0){this.lastSearchInputDate=n;return}let s=(i=(r=this.optionsMenu)===null||r===void 0?void 0:r.querySelector(`[data-value="${a.value}"]`))!==null&&i!==void 0?i:void 0;return this.lastSearchInputDate=n,s}onOptionKeyDown(e,r){var i;(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation(),this.selectOption(r),this.optionsDisplayed=!1,(i=this.mainPanel)===null||i===void 0||i.focus())}selectOption(e){var r,i;if(!(0,ri.deepEqual)((r=this.selectedOption)===null||r===void 0?void 0:r.value,e.value)){this.selectedOption=e;for(let n of this.options)n.selected=n===e;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)}};ce.elementDefinitions={"ft-input-label":cr,"ft-typography":q,"ft-ripple":j,"ft-icon":fe};ce.searchTimeoutMilliseconds=2e3;ce.styles=[eo,yr,wb];Re([(0,ye.property)({type:String})],ce.prototype,"label",void 0);Re([(0,ye.property)({type:String})],ce.prototype,"ariaLabel",void 0);Re([(0,ye.property)({type:String})],ce.prototype,"helper",void 0);Re([(0,ye.property)({type:Boolean})],ce.prototype,"outlined",void 0);Re([(0,ye.property)({type:Boolean})],ce.prototype,"disabled",void 0);Re([(0,ye.property)({type:Boolean})],ce.prototype,"error",void 0);Re([(0,ye.property)({type:Boolean})],ce.prototype,"fixedMenuPosition",void 0);Re([(0,ye.property)({type:Array})],ce.prototype,"options",void 0);Re([(0,ye.state)()],ce.prototype,"selectedOption",void 0);Re([(0,ye.state)()],ce.prototype,"optionsDisplayed",void 0);Re([(0,ye.state)()],ce.prototype,"focusOptions",void 0);Re([(0,ye.state)()],ce.prototype,"currentSearch",void 0);Re([(0,ye.state)()],ce.prototype,"lastSearchInputDate",void 0);Re([(0,ye.query)(".ft-select")],ce.prototype,"container",void 0);Re([(0,ye.query)(".ft-select--options")],ce.prototype,"optionsMenu",void 0);Re([(0,ye.query)(".ft-select--input-panel")],ce.prototype,"mainPanel",void 0);Re([(0,ye.query)(".ft-select--option:first-child")],ce.prototype,"firstOption",void 0);Re([(0,ye.query)(".ft-select--option:focus")],ce.prototype,"focusedOption",void 0);Re([(0,ye.query)(".ft-select--option.ft-select--option-selected")],ce.prototype,"selectedOptionElement",void 0);Re([(0,ye.query)(".ft-select--option:last-child")],ce.prototype,"lastOption",void 0);Re([(0,ye.query)("slot:not([name])")],ce.prototype,"optionsSlot",void 0)});var Ab=p(()=>{"use strict"});var dd,Rb=p(()=>{"use strict";dd=f(x());cd();cd();cs();Ab();(0,dd.customElement)("ft-select")(ce);(0,dd.customElement)("ft-select-option")(kr)});var Ib,dr,et,kb,ds=p(()=>{"use strict";Ib=f(R()),dr=f(x()),et={display:dr.FtCssVariableFactory.create("--ft-skeleton--display","","DISPLAY","block"),width:dr.FtCssVariableFactory.create("--ft-skeleton--width","","SIZE","100%"),height:dr.FtCssVariableFactory.create("--ft-skeleton--height","","SIZE","20px"),backgroundColor:dr.FtCssVariableFactory.create("--ft-skeleton--background-color","","COLOR","#f1f1f1"),glareWidth:dr.FtCssVariableFactory.create("--ft-skeleton--glare-width","","SIZE","200px"),glareColor:dr.FtCssVariableFactory.create("--ft-skeleton--glare-color","","COLOR","rgba(255, 255, 255, .6)"),animationDuration:dr.FtCssVariableFactory.create("--ft-skeleton--animation-duration","","UNKNOWN","2s"),borderRadiusM:dr.FtCssVariableFactory.external(dr.designSystemVariables.borderRadiusM,"Design system")},kb=Ib.css`
2781
2781
  :host {
2782
2782
  width: ${et.width};
2783
2783
  height: ${et.height};