finpro
Version:
14 lines (13 loc) • 2.99 kB
JavaScript
import{a}from"./chunk-23UFIOHV.js";import{a as c}from"./chunk-JA3VZI2D.js";import{a as r,b as i,g as s,h as l,i as p}from"./chunk-GBPY57YZ.js";import{a as t}from"./chunk-NZ3RGSR6.js";var h=r`:host{position:relative}.option-container{--option-font:var(--fp-font-title-3-regular);--option-padding:var(--fp-size-s) 0;--option-selected-color:var(--fp-color-primary);--option-hover-color:var(--fp-color-primary-hover);--option-color:var(--fp-color-secondary);--option-disabled-color:var(--fp-color-content-passive);--option-seperator:1px solid var(--fp-color-border);--option-gap:var(--fp-size-2xs);--option-transition:color 120ms ease-out}.option-container::after{position:absolute;content:'';width:100%;bottom:0;border-bottom:var(--option-seperator)}:host(:last-of-type) .option-container::after{border-bottom:0}.single-option{width:100%;display:block;cursor:pointer;color:var(--option-color);padding:var(--option-padding);transition:var(--option-transition);font:var(--option-font);user-select:none}:host(:hover) .single-option,:host(.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) .single-option{color:var(--option-hover-color)}:host([selected]) .single-option{color:var(--option-selected-color)}:host([disabled]){cursor:not-allowed}:host([disabled]) .single-option{color:var(--option-disabled-color);cursor:not-allowed;pointer-events:none}.checkbox-option{width:100%;display:block;color:var(--option-color);padding:var(--option-padding)}`,d=h;var e=class extends c{constructor(){super(...arguments);this.disabled=!1;this.selected=!1;this.multiple=!1}static get styles(){return[d]}singleOptionTemplate(){return i`<div class="single-option" ="${this._onClickOption}">
<slot></slot>
</div>`}checkboxOptionTemplate(){return i`<fp-checkbox
class="checkbox-option"
.checked="${this.selected}"
.disabled="${this.disabled}"
-checkbox-change="${this._onCheckboxChange}"
>
<slot></slot>
</fp-checkbox>`}render(){return i`<div class="option-container">
${this.multiple?this.checkboxOptionTemplate():this.singleOptionTemplate()}
</div>`}_handleEvent(){this._onSelect({value:this.value,text:this.textContent,selected:this.selected})}_onClickOption(){this.selected=!this.selected,this._handleEvent()}_onCheckboxChange(o){this.selected=o.detail,this._handleEvent()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var o,n;this.fpSelect=this.closest("fp-select"),this.multiple=((o=this.fpSelect)==null?void 0:o.multiple)||!1,(n=this.fpSelect)==null||n.registerOption(this)})}disconnectedCallback(){var o;super.disconnectedCallback(),(o=this.fpSelect)==null||o.unregisterOption(this)}};t([l({})],e.prototype,"value",2),t([l({type:Boolean,reflect:!0})],e.prototype,"disabled",2),t([l({type:Boolean,reflect:!0})],e.prototype,"selected",2),t([p()],e.prototype,"multiple",2),t([a("fp-select-option")],e.prototype,"_onSelect",2),e=t([s("fp-select-option")],e);export{e as a};
//# sourceMappingURL=chunk-VICGLDEZ.js.map