@fluid-topics/ft-select 2.2.21 → 2.2.25
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-option.d.ts +1 -1
- package/build/ft-select.d.ts +1 -1
- package/build/ft-select.light.js +4 -4
- package/build/ft-select.min.js +104 -104
- package/build/ft-select.styles.d.ts +15 -15
- package/package.json +8 -7
|
@@ -18,7 +18,7 @@ export declare class FtSelectOption extends FtLitElement implements FtSelectOpti
|
|
|
18
18
|
slotElement: HTMLSlotElement;
|
|
19
19
|
private isSlotEmpty;
|
|
20
20
|
static styles: import("lit").CSSResult[];
|
|
21
|
-
protected render(): import("lit
|
|
21
|
+
protected render(): import("lit").TemplateResult<1>;
|
|
22
22
|
private onSlotChange;
|
|
23
23
|
protected onClick(): void;
|
|
24
24
|
protected update(changedProperties: PropertyValues): void;
|
package/build/ft-select.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export declare class FtSelect extends FtLitElement implements FtSelectProperties
|
|
|
30
30
|
get lastOption(): FtSelectOption | undefined;
|
|
31
31
|
private optionsSlot?;
|
|
32
32
|
private isSlotEmpty;
|
|
33
|
-
protected render(): import("lit
|
|
33
|
+
protected render(): import("lit").TemplateResult<1>;
|
|
34
34
|
private renderOption;
|
|
35
35
|
protected willUpdate(props: PropertyValues): void;
|
|
36
36
|
protected contentAvailableCallback(props: PropertyValues): void;
|
package/build/ft-select.light.js
CHANGED
|
@@ -626,28 +626,28 @@
|
|
|
626
626
|
`}willUpdate(e){super.willUpdate(e),e.has("options")&&(this.selectedOption=this.options.filter(i=>i.selected)[0]),e.has("selectedOption")&&(this.optionsDisplayed=!1)}contentAvailableCallback(e){var i,o;if(super.contentAvailableCallback(e),e.has("focusOptions")&&this.focusOptions&&((i=(o=this.selectedOptionElement)!==null&&o!==void 0?o:this.firstOption)===null||i===void 0||i.focus(),this.focusOptions=!1),e.has("optionsDisplayed")&&(this.optionsDisplayed?document.addEventListener("click",this.hideOptions):document.removeEventListener("click",this.hideOptions)),e.has("optionsDisplayed")&&this.hasOptionsMenuOpen){this.optionsMenu.style.minWidth=this.mainPanel.getBoundingClientRect().width+"px";let r=["bottom","top"];(0,w.computeOffsetAutoPosition)(this.mainPanel,this.optionsMenu,"bottom",r,"fixed",x.optionsHeight,0).then(({x:n,y:a})=>{this.optionsMenu.style.left=`${n}px`,this.optionsMenu.style.top=`${a}px`})}}get hasOptionsMenuOpen(){return!this.disabled&&this.optionsDisplayed&&this.hasOptions}get hasOptions(){return this.options.length>0}updateOptionsFromSlot(e){var i;e.stopPropagation(),this.isSlotEmpty=(0,w.isSlotEmptyOrWithoutContent)(this.optionsSlot);let o=(i=this.optionsSlot)===null||i===void 0?void 0:i.assignedElements().map(r=>r);o&&o.length>0&&(this.options=o)}onMainPanelKeyDown(e){switch(e.key===" "&&(e.preventDefault(),e.stopPropagation()),e.key){case" ":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 i,o;let r,n=this.focusedOption?this.optionsList.indexOf(this.focusedOption):0;switch(e.key){case" ":case"Enter":e.preventDefault(),e.stopPropagation(),this.onSelectOption(e),this.optionsDisplayed=!1,(i=this.mainPanel)===null||i===void 0||i.focus();break;case"Escape":this.optionsDisplayed=!1,(o=this.mainPanel)===null||o===void 0||o.focus();break;case"Tab":this.optionsDisplayed=!1;break;case"ArrowUp":e.preventDefault(),e.stopPropagation(),r=this.optionsList[(n-1+this.optionsList.length)%this.optionsList.length];break;case"ArrowDown":e.preventDefault(),e.stopPropagation(),r=this.optionsList[(n+1)%this.optionsList.length];break;default:if(e.key.length!=1)break;this.isKeyAlphanumeric(e.key)&&(r=this.handleAlphanumericPress(e.key));break}r?.focus()}isKeyAlphanumeric(e){let i=e.charCodeAt(0);return i>47&&i<58||i>64&&i<91||i>96&&i<123}handleAlphanumericPress(e){let i=new Date;i.getTime()-this.lastSearchInputDate.getTime()>t.searchTimeoutMilliseconds&&(this.currentSearch=""),this.currentSearch+=e.toLowerCase();let o=this.options.find(r=>{var n;return((n=r.label)===null||n===void 0?void 0:n.toLowerCase().substring(0,this.currentSearch.length))===this.currentSearch});return this.lastSearchInputDate=i,o&&this.optionsList.find(r=>r.value===o.value)}getOptionId(e){if(!e)return;let i=this.options.findIndex(o=>(0,w.deepEqual)(o.value,e.value));if(i!==-1)return`option-${i}`}onSelectOption(e){e.stopPropagation(),this.setValue(e.target.value)}setValue(e,i=!0){let o=this.options.find(r=>(0,w.deepEqual)(r.value,e));o&&this.selectOption(o,i)}selectOption(e,i=!0){var o,r;if(!(0,w.deepEqual)((o=this.selectedOption)===null||o===void 0?void 0:o.value,e?.value)){this.selectedOption=e;for(let n of this.options)n.selected=n===e;i&&this.dispatchEvent(new CustomEvent("change",{detail:(r=this.selectedOption)===null||r===void 0?void 0:r.value}))}this.optionsDisplayed=!1}};v.elementDefinitions={"ft-input-label":M,"ft-typography":k,"ft-ripple":b,"ft-icon":N,"ft-select-option":D};v.searchTimeoutMilliseconds=2e3;v.styles=[ht,ai];T([(0,E.property)({type:String})],v.prototype,"label",void 0);T([(0,E.property)({type:String})],v.prototype,"ariaLabel",void 0);T([(0,E.property)({type:String})],v.prototype,"helper",void 0);T([(0,E.property)({type:Boolean})],v.prototype,"outlined",void 0);T([(0,E.property)({type:Boolean})],v.prototype,"disabled",void 0);T([(0,E.property)({type:Boolean})],v.prototype,"error",void 0);T([(0,E.property)({type:Boolean})],v.prototype,"fixedMenuPosition",void 0);T([(0,E.property)({type:Array})],v.prototype,"options",void 0);T([(0,E.state)()],v.prototype,"selectedOption",void 0);T([(0,E.state)()],v.prototype,"optionsDisplayed",void 0);T([(0,E.state)()],v.prototype,"focusOptions",void 0);T([(0,E.state)()],v.prototype,"currentSearch",void 0);T([(0,E.state)()],v.prototype,"lastSearchInputDate",void 0);T([(0,E.query)(".ft-select")],v.prototype,"container",void 0);T([(0,E.query)(".ft-select--options")],v.prototype,"optionsMenu",void 0);T([(0,E.query)(".ft-select--input-panel")],v.prototype,"mainPanel",void 0);T([(0,E.query)("slot:not([name])")],v.prototype,"optionsSlot",void 0);var hi={"ft-select":v,"ft-select-option":D};(0,ci.customElements)(hi);})();
|
|
627
627
|
/*! Bundled license information:
|
|
628
628
|
|
|
629
|
-
lit-html/directives/when.js:
|
|
629
|
+
.store/lit-html-npm-3.3.3-0f054b825a/package/directives/when.js:
|
|
630
630
|
(**
|
|
631
631
|
* @license
|
|
632
632
|
* Copyright 2021 Google LLC
|
|
633
633
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
634
634
|
*)
|
|
635
635
|
|
|
636
|
-
lit-html/lit-html.js:
|
|
636
|
+
.store/lit-html-npm-3.3.3-0f054b825a/package/lit-html.js:
|
|
637
637
|
(**
|
|
638
638
|
* @license
|
|
639
639
|
* Copyright 2017 Google LLC
|
|
640
640
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
641
641
|
*)
|
|
642
642
|
|
|
643
|
-
lit-html/directives/if-defined.js:
|
|
643
|
+
.store/lit-html-npm-3.3.3-0f054b825a/package/directives/if-defined.js:
|
|
644
644
|
(**
|
|
645
645
|
* @license
|
|
646
646
|
* Copyright 2018 Google LLC
|
|
647
647
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
648
648
|
*)
|
|
649
649
|
|
|
650
|
-
lit-html/static.js:
|
|
650
|
+
.store/lit-html-npm-3.3.3-0f054b825a/package/static.js:
|
|
651
651
|
(**
|
|
652
652
|
* @license
|
|
653
653
|
* Copyright 2020 Google LLC
|