jb-select 6.0.3 → 6.0.4

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/dist/index.cjs.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("jb-validation");function t(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)}function n(e,t,n,s,i){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?i.call(e,n):i?i.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;var s,i,o,l,a,r,c,d,h,p,b,m,u,f;class v extends HTMLElement{get value(){return t(this,l,"f")}set value(e){n(this,l,e,"f")}set selected(e){n(this,a,e,"f"),e?t(this,i,"f").componentWrapper.classList.add("--selected"):t(this,i,"f").componentWrapper.classList.remove("--selected")}get selected(){return t(this,a,"f")}get optionContent(){return t(this,i,"f").contentWrapper.querySelector("slot").assignedNodes()}get hidden(){return t(this,r,"f")}set hidden(e){n(this,r,e,"f"),e?t(this,i,"f").componentWrapper.classList.add("--hidden"):t(this,i,"f").componentWrapper.classList.remove("--hidden")}get optionContentText(){return this.optionContent.reduce(((e,t)=>e+=t.textContent),"")}constructor(){super(),s.add(this),i.set(this,void 0),o.set(this,void 0),l.set(this,void 0),a.set(this,!1),r.set(this,!1),t(this,s,"m",d).call(this),t(this,s,"m",b).call(this)}connectedCallback(){t(this,s,"m",p).call(this)}setSelectElement(e){e&&(n(this,o,e,"f"),t(this,o,"f").addEventListener("filter-change",t(this,s,"m",c).bind(this)))}disconnectedCallback(){t(this,o,"f")?.removeEventListener("filter-change",t(this,s,"m",c).bind(this));const e=new CustomEvent("jb-option-disconnected",{bubbles:!0,composed:!0,cancelable:!1});this.dispatchEvent(e)}static get observedAttributes(){return["value"]}attributeChangedCallback(e,n,i){t(this,s,"m",m).call(this,e,i)}}i=new WeakMap,o=new WeakMap,l=new WeakMap,a=new WeakMap,r=new WeakMap,s=new WeakSet,c=function(e){const{filterText:t}=e.detail;this.optionContentText.includes(t)?this.hidden=!1:this.hidden=!0},d=function(){const e=this.attachShadow({mode:"open"}),o=document.createElement("template");o.innerHTML='<style>.jb-options-web-component .option-content-wrapper {\n min-height: 36px;\n padding: 4px 16px;\n display: flex;\n align-items: center;\n font-size: 0.9em;\n color: var(--jb-select-option-color, inherit);\n background-color: var(--jb-select-option-background-color, transparent);\n}\n.jb-options-web-component .option-content-wrapper:hover {\n background-color: var(--jb-select-option-background-color-hover, #1073db);\n color: var(--jb-select-option-color-hover, #fff);\n cursor: pointer;\n}\n.jb-options-web-component.--selected {\n font-weight: 900;\n}\n.jb-options-web-component.--hidden {\n display: none;\n}</style>\n\n <div class="jb-options-web-component">\n <div class="option-content-wrapper">\n <slot></slot>\n </div>\n </div>\n ',e.appendChild(o.content.cloneNode(!0)),n(this,i,{componentWrapper:e.querySelector(".jb-options-web-component"),contentWrapper:e.querySelector(".option-content-wrapper")},"f"),t(this,s,"m",h).call(this)},h=function(){t(this,i,"f").componentWrapper.addEventListener("click",t(this,s,"m",u).bind(this))},p=function(){const e=new CustomEvent("jb-option-connected",{bubbles:!0,composed:!0});this.dispatchEvent(e)},b=function(){this.value=this.getAttribute("value")||null},m=function(e,t){if("value"===e)n(this,l,t,"f")},u=function(){t(this,a,"f")||t(this,s,"m",f).call(this)},f=function(){const e=new CustomEvent("select",{bubbles:!0,cancelable:!1,composed:!0});this.dispatchEvent(e)};var w,g,x,j,y,k,E,L,C,V,M,W;!customElements.get("jb-option")&&window.customElements.define("jb-option",v);class T extends HTMLElement{get callbacks(){return t(this,g,"f")}get optionList(){return t(this,x,"f")||[]}set optionList(e){Array.isArray(e)?(n(this,x,e,"f"),t(this,w,"m",L).call(this,e)):console.error("your provided option list to jb-option-list is not a array. you must provide array value",{value:e})}constructor(){super(),w.add(this),g.set(this,{}),x.set(this,[]),j.set(this,new Map),t(this,w,"m",E).call(this)}connectedCallback(){}setCallback(e,n){switch(t(this,g,"f")[e]=n,e){case"getContentDOM":case"getTitle":t(this,w,"m",y).call(this);break;case"getValue":t(this,w,"m",k).call(this)}}}g=new WeakMap,x=new WeakMap,j=new WeakMap,w=new WeakSet,y=function(){t(this,j,"f").forEach(((e,n)=>{t(this,w,"m",M).call(this,n,e)}))},k=function(){t(this,j,"f").forEach(((e,n)=>{e.value=t(this,w,"m",C).call(this,n)}))},E=function(){const e=this.attachShadow({mode:"open"}),t=document.createElement("template");e.appendChild(t.content.cloneNode(!0))},L=function(e){this.shadowRoot.innerHTML="",e.forEach((e=>{const n=t(this,w,"m",W).call(this,e);this.shadowRoot.appendChild(n),t(this,j,"f").set(e,n)}))},C=function(e){this.callbacks.getValue&&"function"!=typeof this.callbacks.getValue&&console.error("getOptionValue callback is not a function");try{return"function"==typeof t(this,g,"f").getValue?t(this,g,"f").getValue(e):e}catch(t){console.error("Invalid getOptionValue callback Result, must be a function that returns the value of an option",e)}},V=function(e){if("function"!=typeof t(this,g,"f").getTitle)return String(e);try{return t(this,g,"f").getTitle(e)}catch(t){console.error("Invalid getOptionTitle callback Result, must be a function that returns the value of an option",e)}return""},M=function(e,n){n.innerHTML="","function"==typeof t(this,g,"f").getContentDOM?n.appendChild(t(this,g,"f").getContentDOM(e)):n.innerHTML=t(this,w,"m",V).call(this,e)},W=function(e){const n=new v;return t(this,w,"m",M).call(this,e,n),n.value=t(this,w,"m",C).call(this,e),n};!customElements.get("jb-option-list")&&window.customElements.define("jb-option-list",T);var S,z,q,A,K,H,O,D,P,B,I,R,N,J,Z,F,$,_,G,Q,U,X,Y,ee,te,ne,se,ie,oe,le,ae,re,ce,de,he,pe,be,me,ue,fe,ve,we,ge,xe,je,ye,ke,Ee,Le,Ce;class Ve extends HTMLElement{static get formAssociated(){return!0}get value(){return t(this,z,"f")?t(this,z,"f"):null}set value(e){t(this,S,"m",Y).call(this,e)}get textValue(){return t(this,q,"f")}set textValue(e){n(this,q,e,"f"),this.elements.input.value=e,t(this,S,"m",ue).call(this,e)}get selectedOptionTitle(){return this.value?t(this,H,"f").optionContentText:""}get placeholder(){return t(this,O,"f")}set placeholder(e){n(this,O,e,"f"),null!==this.value&&void 0!==this.value?this.elements.input.placeholder="":this.elements.input.placeholder=e}get searchPlaceholder(){return t(this,D,"f")}set searchPlaceholder(e){n(this,D,e,"f")}get isMobileDevice(){return/Mobi/i.test(window.navigator.userAgent)}get isOpen(){return this.elements.componentWrapper.classList.contains("--focused")}get validation(){return t(this,B,"f")}get disabled(){return t(this,I,"f")}set disabled(e){n(this,I,e,"f"),this.elements.input.disabled=e,e?t(this,N,"f").states?.add("disabled"):t(this,N,"f").states?.delete("disabled")}set required(e){n(this,R,e,"f"),t(this,B,"f").checkValiditySync({showError:!1})}get required(){return t(this,R,"f")}get isAutoValidationDisabled(){return""===this.getAttribute("disable-auto-validation")||"true"===this.getAttribute("disable-auto-validation")}get name(){return this.getAttribute("name")||""}get isDirty(){return this.value!==this.initialValue}constructor(){super(),S.add(this),z.set(this,void 0),q.set(this,""),A.set(this,null),K.set(this,new Set),H.set(this,null),this.callbacks={},O.set(this,""),D.set(this,"search"),B.set(this,new e.ValidationHelper({clearValidationError:this.clearValidationError.bind(this),showValidationError:this.showValidationError.bind(this),getValue:()=>t(this,S,"a",P),getValidations:t(this,S,"m",Ee).bind(this),getValueString:()=>t(this,q,"f"),setValidationResult:t(this,S,"m",Ce).bind(this)})),I.set(this,!1),R.set(this,!1),N.set(this,void 0),this.initialValue=null,"function"==typeof this.attachInternals&&n(this,N,this.attachInternals(),"f"),t(this,S,"m",F).call(this),t(this,S,"m",_).call(this)}connectedCallback(){t(this,S,"m",Z).call(this),t(this,S,"m",J).call(this)}static get observedAttributes(){return["label","message","value","required","placeholder","search-placeholder"]}attributeChangedCallback(e,n,s){t(this,S,"m",G).call(this,e,s)}focus(){this.elements.input.focus(),t(this,S,"m",be).call(this),this.elements.componentWrapper.classList.add("--focused"),this.isMobileDevice&&(this.elements.input.placeholder=t(this,D,"f"))}blur(){this.elements.componentWrapper.classList.remove("--focused"),this.textValue="",t(this,S,"m",re).call(this,""),t(this,S,"m",me).call(this),t(this,B,"f").checkValidity({showError:!0}),this.isMobileDevice&&(this.value?this.elements.input.placeholder="":this.elements.input.placeholder=this.placeholder),this.elements.input.blur()}showValidationError(e){const t="string"==typeof e?e:e.message;this.elements.messageBox.innerHTML=t,this.elements.messageBox.classList.add("--error")}clearValidationError(){this.elements.messageBox.innerHTML=this.getAttribute("message")||"",this.elements.messageBox.classList.remove("--error")}checkValidity(){const e=t(this,B,"f").checkValiditySync({showError:!1});if(!e.isAllValid){const e=new CustomEvent("invalid");this.dispatchEvent(e)}return e.isAllValid}reportValidity(){const e=t(this,B,"f").checkValiditySync({showError:!0});if(!e.isAllValid){const e=new CustomEvent("invalid");this.dispatchEvent(e)}return e.isAllValid}get validationMessage(){return t(this,N,"f")?.validationMessage||t(this,B,"f").resultSummary.message}}z=new WeakMap,q=new WeakMap,A=new WeakMap,K=new WeakMap,H=new WeakMap,O=new WeakMap,D=new WeakMap,B=new WeakMap,I=new WeakMap,R=new WeakMap,N=new WeakMap,S=new WeakSet,P=function(){return{inputtedText:t(this,q,"f"),selectedOption:t(this,H,"f"),value:this.value}},J=function(){const e=new CustomEvent("init",{bubbles:!0,composed:!0});this.dispatchEvent(e)},Z=function(){const e=new CustomEvent("load",{bubbles:!0,composed:!0});this.dispatchEvent(e)},F=function(){const e=this.attachShadow({mode:"open",delegatesFocus:!0}),n=document.createElement("template");n.innerHTML='<style>:host {\n --p-middle-div-height: var(--jb-select-middle-div-height, 0px);\n --p-p-color: #1e2832;\n --p-border-bottom-width: var(--jb-select-border-bottom-width, var(--jb-select-border-width, 3px));\n --p-base-z-index: 1;\n --p-mobile-modal-z-index: 900;\n --p-mobile-modal-height: var(--jb-select-mobile-modal-height, 100vh);\n}\n\n.jb-select-web-component {\n width: var(--jb-select-width, 100%);\n margin: var(--jb-select-margin, 0 0);\n position: relative;\n box-sizing: border-box;\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--focused {\n position: fixed;\n bottom: 0;\n top: initial;\n left: 0;\n background-color: var(--jb-select-overlay-bgcolor, rgba(0, 0, 0, 0.5333333333));\n width: 100vw;\n height: var(--p-mobile-modal-height);\n border-radius: var(--jb-select-mobile-modal-border-radius, 0) var(--jb-select-mobile-modal-border-radius, 0) 0 0;\n margin: 0;\n padding: 16px 8px;\n z-index: var(--p-mobile-modal-z-index);\n }\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--focused .select-box {\n height: var(--jb-select-mobile-search-input-height, var(--jb-select-height, 40px));\n background-color: var(--jb-select-mobile-input-bgcolor, #f7f6f6);\n border-width: var(--jb-select-mobile-search-border-width, var(--jb-select-border-width, 1px));\n border-color: var(--jb-select-mobile-search-border-color, var(--jb-select-border-color, #f7f6f6));\n border-bottom-width: var(--jb-select-mobile-search-border-bottom-width, var(--p-border-bottom-width));\n border-bottom-color: var(--jb-select-mobile-search-border-bottom-color, var(--jb-select-border-bottom-color, var(--jb-select-border-color, #f7f6f6)));\n border-radius: var(--jb-select-mobile-search-border-radius, var(--jb-select-border-radius, 16px));\n }\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--focused .select-box .front-box .arrow-icon {\n display: none;\n }\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--focused .select-box .selected-value-wrapper {\n opacity: 0;\n transition: none;\n }\n}\n.jb-select-web-component.--focused .middle-divider {\n display: block;\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--focused .middle-divider {\n margin: var(--jb-select-middle-div-mobile-margin, 16px 0 0 0);\n }\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--focused .select-list-wrapper {\n position: initial;\n margin: var(--jb-select-mobile-item-list-margin, 16px 0);\n border-radius: var(--jb-select-mobile-item-list-border-radius, var(--jb-select-border-radius, 16px));\n }\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--focused .label-wrapper {\n display: flex;\n }\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--focused .label-wrapper label {\n color: #fff;\n font-size: 1.5em;\n display: flex;\n align-items: center;\n }\n}\n.jb-select-web-component.--focused .label-wrapper .close-button {\n display: none;\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--focused .label-wrapper .close-button {\n display: flex;\n width: 48px;\n height: 48px;\n justify-content: center;\n align-items: center;\n color: #fff;\n }\n .jb-select-web-component.--focused .label-wrapper .close-button .close-btn-svg-bg {\n opacity: var(--jb-select-close-bg-opacity, 0.4);\n fill: var(--jb-select-close-bg-color, #1f1735);\n }\n .jb-select-web-component.--focused .label-wrapper .close-button .close-btn-svg-path {\n fill: var(--jb-select-close-x-color, #fff);\n }\n}\n.jb-select-web-component.--has-value .select-box {\n border-color: var(--jb-select-border-color-selected, #c3ff14);\n background-color: var(--jb-select-bgcolor-selected, #f7f6f6);\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--has-value .select-box:focus-within {\n background-color: var(--jb-select-mobile-input-bgcolor, #f7f6f6);\n }\n}\n.jb-select-web-component .label-wrapper label {\n width: 100%;\n margin: 4px 0px;\n display: block;\n font-size: var(--jb-select-label-font-size, 0.8em);\n font-weight: var(--jb-select-label-font-weight, normal);\n color: var(--jb-select-label-color, #1f1735);\n}\n.jb-select-web-component .label-wrapper label.--hide {\n display: none;\n}\n.jb-select-web-component .label-wrapper .close-button {\n display: none;\n}\n.jb-select-web-component .select-box {\n width: 100%;\n box-sizing: border-box;\n height: var(--jb-select-height, 2.5rem);\n border: solid var(--jb-select-border-width, 1px) var(--jb-select-border-color, #f7f6f6);\n border-bottom: solid var(--p-border-bottom-width) var(--jb-select-border-color, #f7f6f6);\n border-radius: var(--jb-select-border-radius, 1rem);\n background-color: var(--jb-select-bgcolor, #f7f6f6);\n margin: var(--jb-select-select-box-margin, 4px 0px 0px 0px);\n overflow: hidden;\n display: flex;\n padding-inline-end: var(--jb-select-box-padding-end, 1rem);\n gap: 0.5rem;\n align-items: center;\n}\n.jb-select-web-component .select-box:focus-within {\n border-color: var(--jb-select-border-color, var(--p-p-color));\n border-bottom-color: var(--jb-select-border-color, var(--p-p-color));\n border-radius: var(--jb-select-border-radius, 1rem) var(--jb-select-border-radius, 1rem) 0 0;\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component .select-box:focus-within {\n border-radius: var(--jb-select-mobile-search-border-radius, var(--jb-select-border-radius, 1rem));\n }\n}\n.jb-select-web-component .select-box .start-section {\n height: 100%;\n width: auto;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.jb-select-web-component .select-box .middle-section {\n position: relative;\n width: 100%;\n height: 100%;\n flex: 1;\n}\n.jb-select-web-component .select-box .middle-section .selected-value-wrapper {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border-radius: inherit;\n overflow: hidden;\n z-index: 1;\n}\n.jb-select-web-component .select-box .middle-section .selected-value-wrapper.--search-typed {\n opacity: 0;\n}\n.jb-select-web-component .select-box .middle-section .selected-value-wrapper .selected-value {\n width: 100%;\n box-sizing: border-box;\n height: 100%;\n background-color: transparent;\n padding: 2px 12px 0 12px;\n display: block;\n font-family: inherit;\n font-size: var(--jb-select-selected-value-font-size, 1.1em);\n color: var(--jb-select-selected-value-color, #1f1735);\n margin: 0;\n border-radius: 0;\n display: flex;\n align-items: center;\n}\n.jb-select-web-component .select-box .middle-section .front-box {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border-radius: inherit;\n overflow: hidden;\n z-index: 2;\n}\n.jb-select-web-component .select-box .middle-section .front-box input {\n border: none;\n width: 100%;\n box-sizing: border-box;\n height: 100%;\n background-color: transparent;\n padding: 2px 12px 0 12px;\n display: block;\n font-family: inherit;\n font-size: var(--jb-select-value-font-size, 1.1rem);\n color: var(--jb-select-input-color, #1f1735);\n margin: 0;\n border-radius: 0;\n}\n.jb-select-web-component .select-box .middle-section .front-box input:focus {\n outline: none;\n}\n.jb-select-web-component .select-box .middle-section .front-box input::placeholder {\n color: var(--jb-select-placeholder-color, initial);\n font-size: var(--jb-select-placeholder-font-size, 1.1em);\n}\n.jb-select-web-component .select-box .end-section .arrow-icon {\n margin: var(--jb-select-arrow-icon-margin, 0 0 0 0);\n}\n.jb-select-web-component .select-box:focus-within .selected-value {\n opacity: 0.7;\n transition: all 0.3s ease;\n}\n.jb-select-web-component .middle-divider {\n display: none;\n position: relative;\n z-index: calc(var(--p-base-z-index) + 3);\n width: 100%;\n height: var(--p-middle-div-height);\n background-color: var(--jb-select-middle-div-color, var(--p-p-color));\n margin: var(--jb-select-middle-div-margin, calc(-1 * var(--p-border-bottom-width)) 0);\n border-radius: var(--jb-select-middle-div-radius, 0px);\n}\n.jb-select-web-component .message-box {\n font-size: var(--jb-select-message-font-size, 0.7em);\n font-weight: var(--jb-select-message-font-weight, normal);\n padding: 4px 8px;\n color: var(--jb-select-message-color, #929292);\n}\n.jb-select-web-component .message-box:empty {\n padding: 0;\n}\n.jb-select-web-component .message-box.--error {\n color: red;\n}\n.jb-select-web-component .select-list-wrapper {\n display: none;\n position: absolute;\n margin: calc(-1 * var(--p-border-bottom-width)) 0;\n height: auto;\n overflow: hidden;\n width: 100%;\n background-color: var(--jb-select-bgcolor, #f7f6f6);\n border-radius: 0 0 var(--jb-select-border-radius, 16px) var(--jb-select-border-radius, 16px);\n border: solid var(--jb-select-list-border-width, 1px) var(--jb-select-border-color, var(--p-p-color));\n border-top: none;\n border-bottom: solid var(--p-border-bottom-width) var(--jb-select-border-color, var(--p-p-color));\n box-shadow: var(--jb-select-list-box-shadow);\n box-sizing: border-box;\n z-index: calc(var(--p-base-z-index) + 2);\n}\n.jb-select-web-component .select-list-wrapper.--show {\n display: block;\n}\n.jb-select-web-component .select-list-wrapper .select-list {\n width: 100%;\n max-height: var(--jb-select-list-max-height, 400px);\n overflow-y: auto;\n /* option style places */\n}\n.jb-select-web-component .select-list-wrapper .select-list slot {\n padding: var(--jb-select-list-padding, 16px 0);\n}\n.jb-select-web-component .select-list-wrapper .select-list slot:empty {\n padding: 0;\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component .select-list-wrapper .select-list {\n max-height: calc(var(--p-mobile-modal-height) - 240px);\n }\n}\n.jb-select-web-component .select-list-wrapper .select-list::-webkit-scrollbar {\n width: 9px;\n background-color: transparent;\n}\n.jb-select-web-component .select-list-wrapper .select-list::-webkit-scrollbar-thumb {\n background-color: var(--jb-select-list-scroll-color, #c3c3c3);\n border-radius: var(--jb-select-list-scroll-border-radius, 4px);\n}\n.jb-select-web-component .select-list-wrapper .empty-list-placeholder {\n display: none;\n text-align: center;\n color: #838383;\n font-style: italic;\n padding: 8px 0;\n}\n.jb-select-web-component .select-list-wrapper .empty-list-placeholder.--show {\n display: block;\n}</style>\n<div class="jb-select-web-component">\r\n <div class="label-wrapper">\r\n <label class="--hide"><span class="label-value"></span></label>\r\n \x3c!-- close button will be visible on mobile modal --\x3e\r\n <div class="close-button">\r\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">\r\n <path class="close-btn-svg-bg" opacity="0.4" d="M16.3399 1.9998H7.66988C4.27988 1.9998 1.99988 4.3798 1.99988 7.9198V16.0898C1.99988 19.6198 4.27988 21.9998 7.66988 21.9998H16.3399C19.7299 21.9998 21.9999 19.6198 21.9999 16.0898V7.9198C21.9999 4.3798 19.7299 1.9998 16.3399 1.9998Z"/>\r\n <path class="close-btn-svg-path" d="M15.0156 13.7703L13.2366 11.9923L15.0146 10.2143C15.3566 9.8733 15.3566 9.3183 15.0146 8.9773C14.6726 8.6333 14.1196 8.6343 13.7776 8.9763L11.9986 10.7543L10.2196 8.9743C9.87758 8.6323 9.32358 8.6343 8.98158 8.9743C8.64058 9.3163 8.64058 9.8713 8.98158 10.2123L10.7616 11.9923L8.98558 13.7673C8.64358 14.1093 8.64358 14.6643 8.98558 15.0043C9.15658 15.1763 9.37958 15.2613 9.60358 15.2613C9.82858 15.2613 10.0516 15.1763 10.2226 15.0053L11.9986 13.2293L13.7786 15.0083C13.9496 15.1793 14.1726 15.2643 14.3966 15.2643C14.6206 15.2643 14.8446 15.1783 15.0156 15.0083C15.3576 14.6663 15.3576 14.1123 15.0156 13.7703Z" fill="#200E32"/>\r\n </svg>\r\n </div>\r\n </div>\r\n <div class="select-box">\r\n <div class="start-section">\r\n <slot name="start-section"></slot>\r\n </div>\r\n <div class="middle-section">\r\n <div class="selected-value-wrapper"></div>\r\n <div class="front-box">\r\n <input class="input">\r\n\r\n </div>\r\n </div>\r\n <div class="end-section">\r\n <div class="arrow-icon" tabindex="-1">\r\n <slot name="select-arrow-icon">\r\n <svg width="8" height="8" id="Layer_1" x="0px" y="0px" viewBox="0 0 494.1 371.1" style="enable-background:new 0 0 494.1 371.1;" xml:space="preserve">\r\n <path d="M293,343.8L480.9,69.3c8.7-12.7,13.3-25.4,13.3-36.1c0-20.5-16.5-33.2-44-33.2H44C16.4,0,0,12.7,0,33.2 c0,10.6,4.6,23.2,13.3,35.9l187.9,274.6c12.1,17.7,28.4,27.4,45.9,27.4C264.6,371.1,280.9,361.4,293,343.8z"/>\r\n </svg>\r\n </slot>\r\n </div>\r\n </div>\r\n </div>\r\n <div class="middle-divider">\r\n \x3c!-- middle line between input box and list (hidden by default but user may need it sometimes) --\x3e\r\n </div>\r\n <div class="select-list-wrapper">\r\n <div class="select-list" tabindex="-1">\r\n <slot></slot>\r\n </div>\r\n <div class="empty-list-placeholder">\r\n <slot name="empty-list-message">no item available</slot>\r\n </div>\r\n </div>\r\n <div class="message-box"></div>\r\n</div>',e.appendChild(n.content.cloneNode(!0)),this.elements={input:e.querySelector(".select-box input"),componentWrapper:e.querySelector(".jb-select-web-component"),selectedValueWrapper:e.querySelector(".selected-value-wrapper"),messageBox:e.querySelector(".message-box"),optionList:e.querySelector(".select-list"),optionListWrapper:e.querySelector(".select-list-wrapper"),optionListSlot:e.querySelector(".select-list-wrapper .select-list slot"),arrowIcon:e.querySelector(".arrow-icon"),label:{wrapper:e.querySelector("label"),text:e.querySelector("label .label-value")},emptyListPlaceholder:e.querySelector(".empty-list-placeholder")},t(this,S,"m",$).call(this)},$=function(){this.elements.input.addEventListener("change",(e=>{t(this,S,"m",de).call(this,e)})),this.elements.input.addEventListener("keypress",t(this,S,"m",se).bind(this)),this.elements.input.addEventListener("keyup",t(this,S,"m",ae).bind(this)),this.elements.input.addEventListener("beforeinput",t(this,S,"m",ie).bind(this)),this.elements.input.addEventListener("input",(e=>{t(this,S,"m",oe).call(this,e)})),this.elements.input.addEventListener("focus",t(this,S,"m",he).bind(this)),this.elements.input.addEventListener("blur",t(this,S,"m",pe).bind(this)),this.elements.arrowIcon.addEventListener("click",t(this,S,"m",ne).bind(this)),this.addEventListener("select",t(this,S,"m",fe).bind(this)),this.addEventListener("jb-option-connected",t(this,S,"m",ve).bind(this)),this.elements.optionListSlot.addEventListener("slotchange",t(this,S,"m",U).bind(this))},_=function(){this.textValue="",this.value=this.getAttribute("value")||null},G=function(e,n){switch(e){case"label":this.elements.label.text.innerHTML=n,null==n||null==n||""==n?this.elements.label.wrapper.classList.add("--hide"):this.elements.label.wrapper.classList.remove("--hide");break;case"message":this.elements.messageBox.innerHTML=n;break;case"value":t(this,S,"m",Y).call(this,n);break;case"required":this.required=""===n||"true"==n||"True"==n;break;case"placeholder":this.placeholder=n;break;case"search-placeholder":this.searchPlaceholder=n}},Q=function(){Array.from(t(this,K,"f")).some((e=>0==e.hidden))?this.elements.emptyListPlaceholder.classList.remove("--show"):this.elements.emptyListPlaceholder.classList.add("--show")},U=function(e){t(this,S,"m",X).call(this),t(this,S,"m",Q).call(this)},X=function(){if(t(this,A,"f")){t(this,S,"m",Y).call(this,t(this,A,"f"))&&n(this,A,null,"f")}else this.value&&t(this,S,"m",Y).call(this,this.value)},Y=function(e){if(null==e)return t(this,S,"m",te).call(this,null,null),!0;let s=null;return t(this,K,"f").forEach((t=>{t.value==e&&(s=t)})),s?(t(this,S,"m",te).call(this,s.value,s),!0):(n(this,A,e,"f"),!1)},ee=function(e){t(this,K,"f").forEach((e=>e.selected=!1)),e&&(e.selected=!0,n(this,H,e,"f"))},te=function(e,s){n(this,A,null,"f"),n(this,z,e,"f"),null==e?(this.textValue="",t(this,S,"m",je).call(this,null),t(this,S,"m",ee).call(this,null),this.elements.componentWrapper.classList.remove("--has-value"),this.isMobileDevice&&this.isOpen||(this.elements.input.placeholder=this.placeholder)):(this.textValue="",t(this,S,"m",ee).call(this,s),t(this,S,"m",je).call(this,e),this.elements.componentWrapper.classList.add("--has-value"),this.isMobileDevice&&this.isOpen||(this.elements.input.placeholder="")),t(this,S,"m",ue).call(this,"")},ne=function(){this.isOpen?this.blur():this.focus()},se=function(e){const t={altKey:e.altKey,bubbles:e.bubbles,cancelable:e.cancelable,code:e.code,composed:e.composed,ctrlKey:e.ctrlKey,detail:e.detail,isComposing:e.isComposing,key:e.key,location:e.location,metaKey:e.metaKey,view:e.view,repeat:e.repeat,shiftKey:e.shiftKey},n=new KeyboardEvent("keypress",t);this.dispatchEvent(n)},ie=function(e){},oe=function(e){const n=e.target.value;this.textValue=n,t(this,S,"m",re).call(this,n),t(this,B,"f").checkValidity({showError:!1}),t(this,S,"m",le).call(this,e),t(this,S,"m",Q).call(this)},le=function(e){const t=new InputEvent("input",{bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed,data:e.data,dataTransfer:e.dataTransfer,detail:e.detail,inputType:e.inputType,isComposing:e.isComposing,targetRanges:e.getTargetRanges(),view:e.view});this.dispatchEvent(t)},ae=function(e){const n=e.target.value;"Backspace"!==e.key&&"Delete"!==e.key||t(this,S,"m",re).call(this,n),t(this,S,"m",ce).call(this,e)},re=function(e){""!==e?this.elements.selectedValueWrapper.classList.add("--search-typed"):this.elements.selectedValueWrapper.classList.remove("--search-typed")},ce=function(e){const t=new KeyboardEvent("keyup",{altKey:e.altKey,bubbles:e.bubbles,cancelable:e.cancelable,code:e.code,ctrlKey:e.ctrlKey,detail:e.detail,key:e.key,shiftKey:e.shiftKey,charCode:e.charCode,location:e.location,composed:e.composed,isComposing:e.isComposing,metaKey:e.metaKey,repeat:e.repeat,keyCode:e.keyCode,view:e.view});this.dispatchEvent(t)},de=function(e){const t=e.target.value;n(this,q,t,"f")},he=function(){this.focus()},pe=function(e){const t=e.relatedTarget;this.elements.optionListWrapper.contains(t)||this.elements.arrowIcon.contains(t)||this.blur()},be=function(){this.elements.optionListWrapper.classList.add("--show")},me=function(){this.elements.optionListWrapper.classList.remove("--show")},ue=function(e){const t=new CustomEvent("filter-change",{detail:{filterText:e},bubbles:!1,cancelable:!1,composed:!1});this.dispatchEvent(t)},fe=function(e){const n=t(this,z,"f"),s=t(this,H,"f"),i=e.composedPath()[0];if(i instanceof v){const o=i.value;t(this,S,"m",ge).call(this,o,i),this.blur();t(this,S,"m",xe).call(this).defaultPrevented&&(e.preventDefault(),t(this,S,"m",ge).call(this,n,s))}},ve=function(e){e.stopPropagation();const n=e.composedPath()[0];n.addEventListener("jb-option-disconnected",t(this,S,"m",we).bind(this),{once:!0,passive:!0}),n.setSelectElement(this),t(this,K,"f").add(n),t(this,A,"f")&&t(this,S,"m",X).call(this),t(this,S,"m",Q).call(this)},we=function(e){e.stopPropagation();const n=e.target;t(this,K,"f").delete(n),t(this,S,"m",Q).call(this),n.value==t(this,z,"f")&&t(this,S,"m",X).call(this)},ge=function(e,n){t(this,S,"m",te).call(this,e,n),t(this,S,"m",Le).call(this,!0)},xe=function(){const e=new Event("change",{bubbles:!0,cancelable:!0});return this.dispatchEvent(e),e},je=function(e){if(this.elements.selectedValueWrapper.innerHTML="",null!=e){const n=t(this,S,"m",ye).call(this,e);this.elements.selectedValueWrapper.appendChild(n)}},ye=function(e){return"function"==typeof this.callbacks.getSelectedValueDOM?this.callbacks.getSelectedValueDOM(e,t(this,H,"f")):t(this,S,"m",ke).call(this)},ke=function(){let e=[];t(this,H,"f")&&(e=t(this,H,"f").optionContent);const n=document.createElement("div");return n.classList.add("selected-value"),n.append(...e.map((e=>e.cloneNode()))),n},Ee=function(){const e=[];if(this.required){const t=`${this.getAttribute("label")||""} حتما باید انتخاب شود`;e.push({validator:({value:e})=>null!=e,message:t,stateType:"valueMissing"})}return e},Le=function(e){if(!this.isAutoValidationDisabled)return t(this,B,"f").checkValidity({showError:e})},Ce=function(e){if(e.isAllValid)t(this,N,"f")?.setValidity({},"");else{const n={};let s="";e.validationList.forEach((e=>{e.isValid||(e.validation.stateType?n[e.validation.stateType]=!0:n.customError=!0,""==s&&(s=e.message))})),t(this,N,"f")?.setValidity(n,s)}};!customElements.get("jb-select")&&window.customElements.define("jb-select",Ve),exports.JBOptionListWebComponent=T,exports.JBOptionWebComponent=v,exports.JBSelectWebComponent=Ve;
1
+ "use strict";var e=require("jb-validation");function t(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)}function n(e,t,n,s,i){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?i.call(e,n):i?i.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;var s,i,o,l,a,r,c,d,h,p,b,m,u,f;class v extends HTMLElement{get value(){return t(this,l,"f")}set value(e){n(this,l,e,"f")}set selected(e){n(this,a,e,"f"),e?t(this,i,"f").componentWrapper.classList.add("--selected"):t(this,i,"f").componentWrapper.classList.remove("--selected")}get selected(){return t(this,a,"f")}get optionContent(){return t(this,i,"f").contentWrapper.querySelector("slot").assignedNodes()}get hidden(){return t(this,r,"f")}set hidden(e){n(this,r,e,"f"),e?t(this,i,"f").componentWrapper.classList.add("--hidden"):t(this,i,"f").componentWrapper.classList.remove("--hidden")}get optionContentText(){return this.optionContent.reduce(((e,t)=>e+=t.textContent),"")}constructor(){super(),s.add(this),i.set(this,void 0),o.set(this,void 0),l.set(this,void 0),a.set(this,!1),r.set(this,!1),t(this,s,"m",d).call(this),t(this,s,"m",b).call(this)}connectedCallback(){t(this,s,"m",p).call(this)}setSelectElement(e){e&&(n(this,o,e,"f"),t(this,o,"f").addEventListener("filter-change",t(this,s,"m",c).bind(this)))}disconnectedCallback(){t(this,o,"f")?.removeEventListener("filter-change",t(this,s,"m",c).bind(this));const e=new CustomEvent("jb-option-disconnected",{bubbles:!0,composed:!0,cancelable:!1});this.dispatchEvent(e)}static get observedAttributes(){return["value"]}attributeChangedCallback(e,n,i){t(this,s,"m",m).call(this,e,i)}}i=new WeakMap,o=new WeakMap,l=new WeakMap,a=new WeakMap,r=new WeakMap,s=new WeakSet,c=function(e){const{filterText:t}=e.detail;this.optionContentText.includes(t)?this.hidden=!1:this.hidden=!0},d=function(){const e=this.attachShadow({mode:"open"}),o=document.createElement("template");o.innerHTML='<style>.jb-options-web-component .option-content-wrapper {\n min-height: 36px;\n padding: 4px 16px;\n display: flex;\n align-items: center;\n font-size: 0.9em;\n color: var(--jb-select-option-color, inherit);\n background-color: var(--jb-select-option-background-color, transparent);\n}\n.jb-options-web-component .option-content-wrapper:hover {\n background-color: var(--jb-select-option-background-color-hover, #1073db);\n color: var(--jb-select-option-color-hover, #fff);\n cursor: pointer;\n}\n.jb-options-web-component.--selected {\n font-weight: 900;\n}\n.jb-options-web-component.--hidden {\n display: none;\n}</style>\n\n <div class="jb-options-web-component">\n <div class="option-content-wrapper">\n <slot></slot>\n </div>\n </div>\n ',e.appendChild(o.content.cloneNode(!0)),n(this,i,{componentWrapper:e.querySelector(".jb-options-web-component"),contentWrapper:e.querySelector(".option-content-wrapper")},"f"),t(this,s,"m",h).call(this)},h=function(){t(this,i,"f").componentWrapper.addEventListener("click",t(this,s,"m",u).bind(this))},p=function(){const e=new CustomEvent("jb-option-connected",{bubbles:!0,composed:!0});this.dispatchEvent(e)},b=function(){this.value=this.getAttribute("value")||null},m=function(e,t){if("value"===e)n(this,l,t,"f")},u=function(){t(this,a,"f")||t(this,s,"m",f).call(this)},f=function(){const e=new CustomEvent("select",{bubbles:!0,cancelable:!1,composed:!0});this.dispatchEvent(e)};var w,g,x,j,y,k,E,L,C,V,M,W;!customElements.get("jb-option")&&window.customElements.define("jb-option",v);class T extends HTMLElement{get callbacks(){return t(this,g,"f")}get optionList(){return t(this,x,"f")||[]}set optionList(e){Array.isArray(e)?(n(this,x,e,"f"),t(this,w,"m",L).call(this,e)):console.error("your provided option list to jb-option-list is not a array. you must provide array value",{value:e})}constructor(){super(),w.add(this),g.set(this,{}),x.set(this,[]),j.set(this,new Map),t(this,w,"m",E).call(this)}connectedCallback(){}setCallback(e,n){switch(t(this,g,"f")[e]=n,e){case"getContentDOM":case"getTitle":t(this,w,"m",y).call(this);break;case"getValue":t(this,w,"m",k).call(this)}}}g=new WeakMap,x=new WeakMap,j=new WeakMap,w=new WeakSet,y=function(){t(this,j,"f").forEach(((e,n)=>{t(this,w,"m",M).call(this,n,e)}))},k=function(){t(this,j,"f").forEach(((e,n)=>{e.value=t(this,w,"m",C).call(this,n)}))},E=function(){const e=this.attachShadow({mode:"open"}),t=document.createElement("template");e.appendChild(t.content.cloneNode(!0))},L=function(e){this.shadowRoot.innerHTML="",e.forEach((e=>{const n=t(this,w,"m",W).call(this,e);this.shadowRoot.appendChild(n),t(this,j,"f").set(e,n)}))},C=function(e){this.callbacks.getValue&&"function"!=typeof this.callbacks.getValue&&console.error("getOptionValue callback is not a function");try{return"function"==typeof t(this,g,"f").getValue?t(this,g,"f").getValue(e):e}catch(t){console.error("Invalid getOptionValue callback Result, must be a function that returns the value of an option",e)}},V=function(e){if("function"!=typeof t(this,g,"f").getTitle)return String(e);try{return t(this,g,"f").getTitle(e)}catch(t){console.error("Invalid getOptionTitle callback Result, must be a function that returns the value of an option",e)}return""},M=function(e,n){n.innerHTML="","function"==typeof t(this,g,"f").getContentDOM?n.appendChild(t(this,g,"f").getContentDOM(e)):n.innerHTML=t(this,w,"m",V).call(this,e)},W=function(e){const n=new v;return t(this,w,"m",M).call(this,e,n),n.value=t(this,w,"m",C).call(this,e),n};!customElements.get("jb-option-list")&&window.customElements.define("jb-option-list",T);var S,z,q,A,K,H,O,D,P,B,I,R,N,J,Z,F,$,_,G,Q,U,X,Y,ee,te,ne,se,ie,oe,le,ae,re,ce,de,he,pe,be,me,ue,fe,ve,we,ge,xe,je,ye,ke,Ee,Le,Ce;class Ve extends HTMLElement{static get formAssociated(){return!0}get value(){return t(this,z,"f")?t(this,z,"f"):null}set value(e){t(this,S,"m",Y).call(this,e)}get textValue(){return t(this,q,"f")}set textValue(e){n(this,q,e,"f"),this.elements.input.value=e,t(this,S,"m",ue).call(this,e)}get selectedOptionTitle(){return this.value?t(this,H,"f").optionContentText:""}get placeholder(){return t(this,O,"f")}set placeholder(e){n(this,O,e,"f"),null!==this.value&&void 0!==this.value?this.elements.input.placeholder="":this.elements.input.placeholder=e}get searchPlaceholder(){return t(this,D,"f")}set searchPlaceholder(e){n(this,D,e,"f")}get isMobileDevice(){return/Mobi/i.test(window.navigator.userAgent)}get isOpen(){return this.elements.componentWrapper.classList.contains("--focused")}get validation(){return t(this,B,"f")}get disabled(){return t(this,I,"f")}set disabled(e){n(this,I,e,"f"),this.elements.input.disabled=e,e?t(this,N,"f").states?.add("disabled"):t(this,N,"f").states?.delete("disabled")}set required(e){n(this,R,e,"f"),t(this,B,"f").checkValiditySync({showError:!1})}get required(){return t(this,R,"f")}get isAutoValidationDisabled(){return""===this.getAttribute("disable-auto-validation")||"true"===this.getAttribute("disable-auto-validation")}get name(){return this.getAttribute("name")||""}get isDirty(){return this.value!==this.initialValue}constructor(){super(),S.add(this),z.set(this,void 0),q.set(this,""),A.set(this,null),K.set(this,new Set),H.set(this,null),this.callbacks={},O.set(this,""),D.set(this,"search"),B.set(this,new e.ValidationHelper({clearValidationError:this.clearValidationError.bind(this),showValidationError:this.showValidationError.bind(this),getValue:()=>t(this,S,"a",P),getValidations:t(this,S,"m",Ee).bind(this),getValueString:()=>t(this,q,"f"),setValidationResult:t(this,S,"m",Ce).bind(this)})),I.set(this,!1),R.set(this,!1),N.set(this,void 0),this.initialValue=null,"function"==typeof this.attachInternals&&n(this,N,this.attachInternals(),"f"),t(this,S,"m",F).call(this),t(this,S,"m",_).call(this)}connectedCallback(){t(this,S,"m",Z).call(this),t(this,S,"m",J).call(this)}static get observedAttributes(){return["label","message","value","required","placeholder","search-placeholder"]}attributeChangedCallback(e,n,s){t(this,S,"m",G).call(this,e,s)}focus(){this.elements.input.focus(),t(this,S,"m",be).call(this),this.elements.componentWrapper.classList.add("--focused"),this.isMobileDevice&&(this.elements.input.placeholder=t(this,D,"f"))}blur(){this.elements.componentWrapper.classList.remove("--focused"),this.textValue="",t(this,S,"m",re).call(this,""),t(this,S,"m",me).call(this),t(this,B,"f").checkValidity({showError:!0}),this.isMobileDevice&&(this.value?this.elements.input.placeholder="":this.elements.input.placeholder=this.placeholder),this.elements.input.blur()}showValidationError(e){const t="string"==typeof e?e:e.message;this.elements.messageBox.innerHTML=t,this.elements.messageBox.classList.add("--error")}clearValidationError(){this.elements.messageBox.innerHTML=this.getAttribute("message")||"",this.elements.messageBox.classList.remove("--error")}checkValidity(){const e=t(this,B,"f").checkValiditySync({showError:!1});if(!e.isAllValid){const e=new CustomEvent("invalid");this.dispatchEvent(e)}return e.isAllValid}reportValidity(){const e=t(this,B,"f").checkValiditySync({showError:!0});if(!e.isAllValid){const e=new CustomEvent("invalid");this.dispatchEvent(e)}return e.isAllValid}get validationMessage(){return t(this,N,"f")?.validationMessage||t(this,B,"f").resultSummary.message}}z=new WeakMap,q=new WeakMap,A=new WeakMap,K=new WeakMap,H=new WeakMap,O=new WeakMap,D=new WeakMap,B=new WeakMap,I=new WeakMap,R=new WeakMap,N=new WeakMap,S=new WeakSet,P=function(){return{inputtedText:t(this,q,"f"),selectedOption:t(this,H,"f"),value:this.value}},J=function(){const e=new CustomEvent("init",{bubbles:!0,composed:!0});this.dispatchEvent(e)},Z=function(){const e=new CustomEvent("load",{bubbles:!0,composed:!0});this.dispatchEvent(e)},F=function(){const e=this.attachShadow({mode:"open",delegatesFocus:!0}),n=document.createElement("template");n.innerHTML='<style>:host {\n --p-middle-div-height: var(--jb-select-middle-div-height, 0px);\n --p-p-color: #1e2832;\n --p-border-bottom-width: var(--jb-select-border-bottom-width, var(--jb-select-border-width, 3px));\n --p-base-z-index: 1;\n --p-mobile-modal-z-index: 900;\n --p-mobile-modal-height: var(--jb-select-mobile-modal-height, 100vh);\n}\n\n.jb-select-web-component {\n width: var(--jb-select-width, 100%);\n margin: var(--jb-select-margin, 0 0);\n position: relative;\n box-sizing: border-box;\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--focused {\n position: fixed;\n bottom: 0;\n top: initial;\n left: 0;\n background-color: var(--jb-select-overlay-bgcolor, rgba(0, 0, 0, 0.5333333333));\n width: 100vw;\n height: var(--p-mobile-modal-height);\n border-radius: var(--jb-select-mobile-modal-border-radius, 0) var(--jb-select-mobile-modal-border-radius, 0) 0 0;\n margin: 0;\n padding: 16px 8px;\n z-index: var(--p-mobile-modal-z-index);\n }\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--focused .select-box {\n height: var(--jb-select-mobile-search-input-height, var(--jb-select-height, 40px));\n background-color: var(--jb-select-mobile-input-bgcolor, #f7f6f6);\n border-width: var(--jb-select-mobile-search-border-width, var(--jb-select-border-width, 1px));\n border-color: var(--jb-select-mobile-search-border-color, var(--jb-select-border-color, #f7f6f6));\n border-bottom-width: var(--jb-select-mobile-search-border-bottom-width, var(--p-border-bottom-width));\n border-bottom-color: var(--jb-select-mobile-search-border-bottom-color, var(--jb-select-border-bottom-color, var(--jb-select-border-color, #f7f6f6)));\n border-radius: var(--jb-select-mobile-search-border-radius, var(--jb-select-border-radius, 16px));\n }\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--focused .select-box .front-box .arrow-icon {\n display: none;\n }\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--focused .select-box .selected-value-wrapper {\n opacity: 0;\n transition: none;\n }\n}\n.jb-select-web-component.--focused .middle-divider {\n display: block;\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--focused .middle-divider {\n margin: var(--jb-select-middle-div-mobile-margin, 16px 0 0 0);\n }\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--focused .select-list-wrapper {\n position: initial;\n margin: var(--jb-select-mobile-item-list-margin, 16px 0);\n border-radius: var(--jb-select-mobile-item-list-border-radius, var(--jb-select-border-radius, 16px));\n }\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--focused .label-wrapper {\n display: flex;\n }\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--focused .label-wrapper label {\n color: #fff;\n font-size: 1.5em;\n display: flex;\n align-items: center;\n }\n}\n.jb-select-web-component.--focused .label-wrapper .close-button {\n display: none;\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--focused .label-wrapper .close-button {\n display: flex;\n width: 48px;\n height: 48px;\n justify-content: center;\n align-items: center;\n color: #fff;\n }\n .jb-select-web-component.--focused .label-wrapper .close-button .close-btn-svg-bg {\n opacity: var(--jb-select-close-bg-opacity, 0.4);\n fill: var(--jb-select-close-bg-color, #1f1735);\n }\n .jb-select-web-component.--focused .label-wrapper .close-button .close-btn-svg-path {\n fill: var(--jb-select-close-x-color, #fff);\n }\n}\n.jb-select-web-component.--has-value .select-box {\n border-color: var(--jb-select-border-color-selected, #c3ff14);\n background-color: var(--jb-select-bgcolor-selected, #f7f6f6);\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component.--has-value .select-box:focus-within {\n background-color: var(--jb-select-mobile-input-bgcolor, #f7f6f6);\n }\n}\n.jb-select-web-component .label-wrapper label {\n width: 100%;\n margin: 4px 0px;\n display: block;\n font-size: var(--jb-select-label-font-size, 0.8em);\n font-weight: var(--jb-select-label-font-weight, normal);\n color: var(--jb-select-label-color, #1f1735);\n}\n.jb-select-web-component .label-wrapper label.--hide {\n display: none;\n}\n.jb-select-web-component .label-wrapper .close-button {\n display: none;\n}\n.jb-select-web-component .select-box {\n width: 100%;\n box-sizing: border-box;\n height: var(--jb-select-height, 2.5rem);\n border: solid var(--jb-select-border-width, 1px) var(--jb-select-border-color, #f7f6f6);\n border-bottom: solid var(--p-border-bottom-width) var(--jb-select-border-color, #f7f6f6);\n border-radius: var(--jb-select-border-radius, 1rem);\n background-color: var(--jb-select-bgcolor, #f7f6f6);\n margin: var(--jb-select-select-box-margin, 4px 0px 0px 0px);\n overflow: hidden;\n display: flex;\n padding-inline-end: var(--jb-select-box-padding-end, 1rem);\n gap: 0.5rem;\n align-items: center;\n}\n.jb-select-web-component .select-box:focus-within {\n border-color: var(--jb-select-border-color, var(--p-p-color));\n border-bottom-color: var(--jb-select-border-color, var(--p-p-color));\n border-radius: var(--jb-select-border-radius, 1rem) var(--jb-select-border-radius, 1rem) 0 0;\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component .select-box:focus-within {\n border-radius: var(--jb-select-mobile-search-border-radius, var(--jb-select-border-radius, 1rem));\n }\n}\n.jb-select-web-component .select-box .start-section {\n height: 100%;\n width: auto;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.jb-select-web-component .select-box .middle-section {\n position: relative;\n width: 100%;\n height: 100%;\n flex: 1;\n}\n.jb-select-web-component .select-box .middle-section .selected-value-wrapper {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border-radius: inherit;\n overflow: hidden;\n z-index: 1;\n}\n.jb-select-web-component .select-box .middle-section .selected-value-wrapper.--search-typed {\n opacity: 0;\n}\n.jb-select-web-component .select-box .middle-section .selected-value-wrapper .selected-value {\n width: 100%;\n box-sizing: border-box;\n height: 100%;\n background-color: transparent;\n padding: 2px 12px 0 12px;\n display: block;\n font-family: inherit;\n font-size: var(--jb-select-selected-value-font-size, 1.1em);\n color: var(--jb-select-selected-value-color, #1f1735);\n margin: 0;\n border-radius: 0;\n display: flex;\n align-items: center;\n}\n.jb-select-web-component .select-box .middle-section .front-box {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border-radius: inherit;\n overflow: hidden;\n z-index: 2;\n}\n.jb-select-web-component .select-box .middle-section .front-box input {\n border: none;\n width: 100%;\n box-sizing: border-box;\n height: 100%;\n background-color: transparent;\n padding: 2px 12px 0 12px;\n display: block;\n font-family: inherit;\n font-size: var(--jb-select-value-font-size, 1.1rem);\n color: var(--jb-select-input-color, #1f1735);\n margin: 0;\n border-radius: 0;\n}\n.jb-select-web-component .select-box .middle-section .front-box input:focus {\n outline: none;\n}\n.jb-select-web-component .select-box .middle-section .front-box input::placeholder {\n color: var(--jb-select-placeholder-color, initial);\n font-size: var(--jb-select-placeholder-font-size, 1.1em);\n}\n.jb-select-web-component .select-box .end-section .arrow-icon {\n margin: var(--jb-select-arrow-icon-margin, 0 0 0 0);\n}\n.jb-select-web-component .select-box:focus-within .selected-value {\n opacity: 0.7;\n transition: all 0.3s ease;\n}\n.jb-select-web-component .middle-divider {\n display: none;\n position: relative;\n z-index: calc(var(--p-base-z-index) + 3);\n width: 100%;\n height: var(--p-middle-div-height);\n background-color: var(--jb-select-middle-div-color, var(--p-p-color));\n margin: var(--jb-select-middle-div-margin, calc(-1 * var(--p-border-bottom-width)) 0);\n border-radius: var(--jb-select-middle-div-radius, 0px);\n}\n.jb-select-web-component .message-box {\n font-size: var(--jb-select-message-font-size, 0.7em);\n font-weight: var(--jb-select-message-font-weight, normal);\n padding: 4px 8px;\n color: var(--jb-select-message-color, #929292);\n}\n.jb-select-web-component .message-box:empty {\n padding: 0;\n}\n.jb-select-web-component .message-box.--error {\n color: red;\n}\n.jb-select-web-component .select-list-wrapper {\n display: none;\n position: absolute;\n margin: calc(-1 * var(--p-border-bottom-width)) 0;\n height: auto;\n overflow: hidden;\n width: 100%;\n background-color: var(--jb-select-bgcolor, #f7f6f6);\n border-radius: 0 0 var(--jb-select-border-radius, 16px) var(--jb-select-border-radius, 16px);\n border: solid var(--jb-select-list-border-width, 1px) var(--jb-select-border-color, var(--p-p-color));\n border-top: none;\n border-bottom: solid var(--p-border-bottom-width) var(--jb-select-border-color, var(--p-p-color));\n box-shadow: var(--jb-select-list-box-shadow);\n box-sizing: border-box;\n z-index: calc(var(--p-base-z-index) + 2);\n}\n.jb-select-web-component .select-list-wrapper.--show {\n display: block;\n}\n.jb-select-web-component .select-list-wrapper .select-list {\n width: 100%;\n max-height: var(--jb-select-list-max-height, 400px);\n overflow-y: auto;\n /* option style places */\n}\n.jb-select-web-component .select-list-wrapper .select-list slot {\n padding: var(--jb-select-list-padding, 16px 0);\n}\n.jb-select-web-component .select-list-wrapper .select-list slot:empty {\n padding: 0;\n}\n@media (min-width: 320px) and (max-width: 767px) {\n .jb-select-web-component .select-list-wrapper .select-list {\n max-height: calc(var(--p-mobile-modal-height) - 240px);\n }\n}\n.jb-select-web-component .select-list-wrapper .select-list::-webkit-scrollbar {\n width: 9px;\n background-color: transparent;\n}\n.jb-select-web-component .select-list-wrapper .select-list::-webkit-scrollbar-thumb {\n background-color: var(--jb-select-list-scroll-color, #c3c3c3);\n border-radius: var(--jb-select-list-scroll-border-radius, 4px);\n}\n.jb-select-web-component .select-list-wrapper .empty-list-placeholder {\n display: none;\n text-align: center;\n color: #838383;\n font-style: italic;\n padding: 8px 0;\n}\n.jb-select-web-component .select-list-wrapper .empty-list-placeholder.--show {\n display: block;\n}</style>\n<div class="jb-select-web-component">\r\n <div class="label-wrapper">\r\n <label class="--hide"><span class="label-value"></span></label>\r\n \x3c!-- close button will be visible on mobile modal --\x3e\r\n <div class="close-button">\r\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">\r\n <path class="close-btn-svg-bg" opacity="0.4" d="M16.3399 1.9998H7.66988C4.27988 1.9998 1.99988 4.3798 1.99988 7.9198V16.0898C1.99988 19.6198 4.27988 21.9998 7.66988 21.9998H16.3399C19.7299 21.9998 21.9999 19.6198 21.9999 16.0898V7.9198C21.9999 4.3798 19.7299 1.9998 16.3399 1.9998Z"/>\r\n <path class="close-btn-svg-path" d="M15.0156 13.7703L13.2366 11.9923L15.0146 10.2143C15.3566 9.8733 15.3566 9.3183 15.0146 8.9773C14.6726 8.6333 14.1196 8.6343 13.7776 8.9763L11.9986 10.7543L10.2196 8.9743C9.87758 8.6323 9.32358 8.6343 8.98158 8.9743C8.64058 9.3163 8.64058 9.8713 8.98158 10.2123L10.7616 11.9923L8.98558 13.7673C8.64358 14.1093 8.64358 14.6643 8.98558 15.0043C9.15658 15.1763 9.37958 15.2613 9.60358 15.2613C9.82858 15.2613 10.0516 15.1763 10.2226 15.0053L11.9986 13.2293L13.7786 15.0083C13.9496 15.1793 14.1726 15.2643 14.3966 15.2643C14.6206 15.2643 14.8446 15.1783 15.0156 15.0083C15.3576 14.6663 15.3576 14.1123 15.0156 13.7703Z" fill="#200E32"/>\r\n </svg>\r\n </div>\r\n </div>\r\n <div class="select-box">\r\n <div class="start-section">\r\n <slot name="start-section"></slot>\r\n </div>\r\n <div class="middle-section">\r\n <div class="selected-value-wrapper"></div>\r\n <div class="front-box">\r\n <input class="input">\r\n\r\n </div>\r\n </div>\r\n <div class="end-section">\r\n <div class="arrow-icon" tabindex="-1">\r\n <slot name="select-arrow-icon">\r\n <svg width="8" height="8" id="Layer_1" x="0px" y="0px" viewBox="0 0 494.1 371.1" style="enable-background:new 0 0 494.1 371.1;" xml:space="preserve">\r\n <path d="M293,343.8L480.9,69.3c8.7-12.7,13.3-25.4,13.3-36.1c0-20.5-16.5-33.2-44-33.2H44C16.4,0,0,12.7,0,33.2 c0,10.6,4.6,23.2,13.3,35.9l187.9,274.6c12.1,17.7,28.4,27.4,45.9,27.4C264.6,371.1,280.9,361.4,293,343.8z"/>\r\n </svg>\r\n </slot>\r\n </div>\r\n </div>\r\n </div>\r\n <div class="middle-divider">\r\n \x3c!-- middle line between input box and list (hidden by default but user may need it sometimes) --\x3e\r\n </div>\r\n <div class="select-list-wrapper">\r\n <div class="select-list" tabindex="-1">\r\n <slot></slot>\r\n </div>\r\n <div class="empty-list-placeholder">\r\n <slot name="empty-list-message">no item available</slot>\r\n </div>\r\n </div>\r\n <div class="message-box"></div>\r\n</div>',e.appendChild(n.content.cloneNode(!0)),this.elements={input:e.querySelector(".select-box input"),componentWrapper:e.querySelector(".jb-select-web-component"),selectedValueWrapper:e.querySelector(".selected-value-wrapper"),messageBox:e.querySelector(".message-box"),optionList:e.querySelector(".select-list"),optionListWrapper:e.querySelector(".select-list-wrapper"),optionListSlot:e.querySelector(".select-list-wrapper .select-list slot"),arrowIcon:e.querySelector(".arrow-icon"),label:{wrapper:e.querySelector("label"),text:e.querySelector("label .label-value")},emptyListPlaceholder:e.querySelector(".empty-list-placeholder")},t(this,S,"m",$).call(this),t(this,S,"m",Q).call(this)},$=function(){this.elements.input.addEventListener("change",(e=>{t(this,S,"m",de).call(this,e)})),this.elements.input.addEventListener("keypress",t(this,S,"m",se).bind(this)),this.elements.input.addEventListener("keyup",t(this,S,"m",ae).bind(this)),this.elements.input.addEventListener("beforeinput",t(this,S,"m",ie).bind(this)),this.elements.input.addEventListener("input",(e=>{t(this,S,"m",oe).call(this,e)})),this.elements.input.addEventListener("focus",t(this,S,"m",he).bind(this)),this.elements.input.addEventListener("blur",t(this,S,"m",pe).bind(this)),this.elements.arrowIcon.addEventListener("click",t(this,S,"m",ne).bind(this)),this.addEventListener("select",t(this,S,"m",fe).bind(this)),this.addEventListener("jb-option-connected",t(this,S,"m",ve).bind(this)),this.elements.optionListSlot.addEventListener("slotchange",t(this,S,"m",U).bind(this))},_=function(){this.textValue="",this.value=this.getAttribute("value")||null},G=function(e,n){switch(e){case"label":this.elements.label.text.innerHTML=n,null==n||null==n||""==n?this.elements.label.wrapper.classList.add("--hide"):this.elements.label.wrapper.classList.remove("--hide");break;case"message":this.elements.messageBox.innerHTML=n;break;case"value":t(this,S,"m",Y).call(this,n);break;case"required":this.required=""===n||"true"==n||"True"==n;break;case"placeholder":this.placeholder=n;break;case"search-placeholder":this.searchPlaceholder=n}},Q=function(){Array.from(t(this,K,"f")).some((e=>0==e.hidden))?this.elements.emptyListPlaceholder.classList.remove("--show"):this.elements.emptyListPlaceholder.classList.add("--show")},U=function(e){t(this,S,"m",X).call(this),t(this,S,"m",Q).call(this)},X=function(){if(t(this,A,"f")){t(this,S,"m",Y).call(this,t(this,A,"f"))&&n(this,A,null,"f")}else this.value&&t(this,S,"m",Y).call(this,this.value)},Y=function(e){if(null==e)return t(this,S,"m",te).call(this,null,null),!0;let s=null;return t(this,K,"f").forEach((t=>{t.value==e&&(s=t)})),s?(t(this,S,"m",te).call(this,s.value,s),!0):(n(this,A,e,"f"),!1)},ee=function(e){t(this,K,"f").forEach((e=>e.selected=!1)),e&&(e.selected=!0,n(this,H,e,"f"))},te=function(e,s){n(this,A,null,"f"),n(this,z,e,"f"),null==e?(this.textValue="",t(this,S,"m",je).call(this,null),t(this,S,"m",ee).call(this,null),this.elements.componentWrapper.classList.remove("--has-value"),this.isMobileDevice&&this.isOpen||(this.elements.input.placeholder=this.placeholder)):(this.textValue="",t(this,S,"m",ee).call(this,s),t(this,S,"m",je).call(this,e),this.elements.componentWrapper.classList.add("--has-value"),this.isMobileDevice&&this.isOpen||(this.elements.input.placeholder="")),t(this,S,"m",ue).call(this,"")},ne=function(){this.isOpen?this.blur():this.focus()},se=function(e){const t={altKey:e.altKey,bubbles:e.bubbles,cancelable:e.cancelable,code:e.code,composed:e.composed,ctrlKey:e.ctrlKey,detail:e.detail,isComposing:e.isComposing,key:e.key,location:e.location,metaKey:e.metaKey,view:e.view,repeat:e.repeat,shiftKey:e.shiftKey},n=new KeyboardEvent("keypress",t);this.dispatchEvent(n)},ie=function(e){},oe=function(e){const n=e.target.value;this.textValue=n,t(this,S,"m",re).call(this,n),t(this,B,"f").checkValidity({showError:!1}),t(this,S,"m",le).call(this,e),t(this,S,"m",Q).call(this)},le=function(e){const t=new InputEvent("input",{bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed,data:e.data,dataTransfer:e.dataTransfer,detail:e.detail,inputType:e.inputType,isComposing:e.isComposing,targetRanges:e.getTargetRanges(),view:e.view});this.dispatchEvent(t)},ae=function(e){const n=e.target.value;"Backspace"!==e.key&&"Delete"!==e.key||t(this,S,"m",re).call(this,n),t(this,S,"m",ce).call(this,e)},re=function(e){""!==e?this.elements.selectedValueWrapper.classList.add("--search-typed"):this.elements.selectedValueWrapper.classList.remove("--search-typed")},ce=function(e){const t=new KeyboardEvent("keyup",{altKey:e.altKey,bubbles:e.bubbles,cancelable:e.cancelable,code:e.code,ctrlKey:e.ctrlKey,detail:e.detail,key:e.key,shiftKey:e.shiftKey,charCode:e.charCode,location:e.location,composed:e.composed,isComposing:e.isComposing,metaKey:e.metaKey,repeat:e.repeat,keyCode:e.keyCode,view:e.view});this.dispatchEvent(t)},de=function(e){const t=e.target.value;n(this,q,t,"f")},he=function(){this.focus()},pe=function(e){const t=e.relatedTarget;this.elements.optionListWrapper.contains(t)||this.elements.arrowIcon.contains(t)||this.blur()},be=function(){this.elements.optionListWrapper.classList.add("--show")},me=function(){this.elements.optionListWrapper.classList.remove("--show")},ue=function(e){const t=new CustomEvent("filter-change",{detail:{filterText:e},bubbles:!1,cancelable:!1,composed:!1});this.dispatchEvent(t)},fe=function(e){const n=t(this,z,"f"),s=t(this,H,"f"),i=e.composedPath()[0];if(i instanceof v){const o=i.value;t(this,S,"m",ge).call(this,o,i),this.blur();t(this,S,"m",xe).call(this).defaultPrevented&&(e.preventDefault(),t(this,S,"m",ge).call(this,n,s))}},ve=function(e){e.stopPropagation();const n=e.composedPath()[0];n.addEventListener("jb-option-disconnected",t(this,S,"m",we).bind(this),{once:!0,passive:!0}),n.setSelectElement(this),t(this,K,"f").add(n),t(this,A,"f")&&t(this,S,"m",X).call(this),t(this,S,"m",Q).call(this)},we=function(e){e.stopPropagation();const n=e.target;t(this,K,"f").delete(n),t(this,S,"m",Q).call(this),n.value==t(this,z,"f")&&t(this,S,"m",X).call(this)},ge=function(e,n){t(this,S,"m",te).call(this,e,n),t(this,S,"m",Le).call(this,!0)},xe=function(){const e=new Event("change",{bubbles:!0,cancelable:!0});return this.dispatchEvent(e),e},je=function(e){if(this.elements.selectedValueWrapper.innerHTML="",null!=e){const n=t(this,S,"m",ye).call(this,e);this.elements.selectedValueWrapper.appendChild(n)}},ye=function(e){return"function"==typeof this.callbacks.getSelectedValueDOM?this.callbacks.getSelectedValueDOM(e,t(this,H,"f")):t(this,S,"m",ke).call(this)},ke=function(){let e=[];t(this,H,"f")&&(e=t(this,H,"f").optionContent);const n=document.createElement("div");return n.classList.add("selected-value"),n.append(...e.map((e=>e.cloneNode()))),n},Ee=function(){const e=[];if(this.required){const t=`${this.getAttribute("label")||""} حتما باید انتخاب شود`;e.push({validator:({value:e})=>null!=e,message:t,stateType:"valueMissing"})}return e},Le=function(e){if(!this.isAutoValidationDisabled)return t(this,B,"f").checkValidity({showError:e})},Ce=function(e){if(e.isAllValid)t(this,N,"f")?.setValidity({},"");else{const n={};let s="";e.validationList.forEach((e=>{e.isValid||(e.validation.stateType?n[e.validation.stateType]=!0:n.customError=!0,""==s&&(s=e.message))})),t(this,N,"f")?.setValidity(n,s)}};!customElements.get("jb-select")&&window.customElements.define("jb-select",Ve),exports.JBOptionListWebComponent=T,exports.JBOptionWebComponent=v,exports.JBSelectWebComponent=Ve;
2
2
  //# sourceMappingURL=index.cjs.js.map
Binary file
Binary file
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../lib/jb-option/jb-option.ts","../lib/jb-option-list/jb-option-list.ts","../lib/jb-select.ts","../../../common/scripts/device-detection.ts"],"sourcesContent":["import { type JBSelectWebComponent } from '../jb-select';\r\nimport CSS from './jb-option.scss';\r\nimport { renderHTML } from \"./render\";\r\nimport { JBOptionElements } from \"./types\";\r\n\r\n//TODO: check for filter text to set visibility on mount\r\nexport class JBOptionWebComponent<TValue> extends HTMLElement {\r\n\r\n #elements: JBOptionElements;\r\n // it may be empty\r\n #SelectElement?: JBSelectWebComponent\r\n #value: TValue;\r\n get value(): TValue {\r\n return this.#value;\r\n }\r\n set value(value: TValue) {\r\n this.#value = value;\r\n }\r\n #selected = false;\r\n set selected(value: boolean) {\r\n this.#selected = value;\r\n if(value){\r\n this.#elements.componentWrapper.classList.add(\"--selected\");\r\n }else{\r\n this.#elements.componentWrapper.classList.remove(\"--selected\");\r\n }\r\n }\r\n get selected() {\r\n return this.#selected;\r\n }\r\n get optionContent():Node[]{\r\n const optionNodes = this.#elements.contentWrapper.querySelector(\"slot\").assignedNodes();\r\n return optionNodes;\r\n }\r\n //TODO: add search hidden property for more accurate hidden and more personalized logic\r\n #hidden = false;\r\n get hidden(){\r\n return this.#hidden;\r\n }\r\n set hidden(value:boolean){\r\n this.#hidden = value;\r\n if(value){\r\n this.#elements.componentWrapper.classList.add('--hidden');\r\n }else{\r\n this.#elements.componentWrapper.classList.remove('--hidden');\r\n }\r\n }\r\n /**\r\n * return text content of option (it used in search by default to filter option)\r\n */\r\n get optionContentText(){\r\n const optionTextContent = this.optionContent.reduce((acc,item)=>{\r\n acc += item.textContent;\r\n return acc;\r\n },\"\");\r\n return optionTextContent;\r\n }\r\n constructor() {\r\n super();\r\n this.#initWebComponent();\r\n this.#initProp();\r\n }\r\n connectedCallback() {\r\n // standard web component event that called when all of dom is bounded\r\n this.#dispatchPlaceEvent();\r\n\r\n }\r\n setSelectElement(element: JBSelectWebComponent) {\r\n if (element) {\r\n this.#SelectElement = element;\r\n this.#SelectElement.addEventListener(\"filter-change\", this.#onFilterChange.bind(this));\r\n }\r\n }\r\n #onFilterChange(e: CustomEvent){\r\n const {filterText} = e.detail;\r\n const optionTextContent = this.optionContentText;\r\n if(optionTextContent.includes(filterText)){\r\n this.hidden = false;\r\n }else{\r\n this.hidden = true;\r\n }\r\n }\r\n disconnectedCallback() {\r\n this.#SelectElement?.removeEventListener(\"filter-change\", this.#onFilterChange.bind(this));\r\n const event = new CustomEvent(\"jb-option-disconnected\",{bubbles:true,composed:true,cancelable:false});\r\n this.dispatchEvent(event);\r\n }\r\n #initWebComponent() {\r\n const shadowRoot = this.attachShadow({\r\n mode: \"open\",\r\n });\r\n const html = `<style>${CSS}</style>` + \"\\n\" + renderHTML();\r\n const element = document.createElement(\"template\");\r\n element.innerHTML = html;\r\n shadowRoot.appendChild(element.content.cloneNode(true));\r\n this.#elements = {\r\n componentWrapper: shadowRoot.querySelector(\".jb-options-web-component\")!,\r\n contentWrapper: shadowRoot.querySelector(\".option-content-wrapper\")!,\r\n };\r\n this.#registerEventListener();\r\n }\r\n #registerEventListener() {\r\n this.#elements.componentWrapper.addEventListener(\"click\", this.#onOptionClick.bind(this));\r\n }\r\n //this event called on each connectedCallback so select could find it's option\r\n #dispatchPlaceEvent() {\r\n const event = new CustomEvent(\"jb-option-connected\", { bubbles: true, composed: true });\r\n this.dispatchEvent(event);\r\n }\r\n #initProp() {\r\n this.value = this.getAttribute(\"value\") as TValue || null;\r\n }\r\n static get observedAttributes() {\r\n return [\"value\"];\r\n }\r\n attributeChangedCallback(name: string, oldValue: string, newValue: string) {\r\n // do something when an attribute has changed\r\n this.#onAttributeChange(name, newValue);\r\n }\r\n #onAttributeChange(name: string, value: string) {\r\n switch (name) {\r\n case 'value':\r\n this.#value = value as TValue;\r\n }\r\n }\r\n #onOptionClick() {\r\n if (!this.#selected) {\r\n this.#dispatchSelectEvent();\r\n }\r\n }\r\n #dispatchSelectEvent() {\r\n const event = new CustomEvent(\"select\", { bubbles: true, cancelable: false, composed: true });\r\n this.dispatchEvent(event);\r\n }\r\n}\r\nconst myElementNotExists = !customElements.get(\"jb-option\");\r\nif (myElementNotExists) {\r\n //prevent duplicate registering\r\n window.customElements.define(\"jb-option\", JBOptionWebComponent);\r\n}\r\n","import { JBOptionWebComponent } from \"../jb-option/jb-option\";\r\nimport { type OptionListCallbacks } from \"./types\";\r\n\r\n//TOption is the type of option, TValue is the type of value we extract from option\r\nexport class JBOptionListWebComponent<TOption, TValue> extends HTMLElement {\r\n #callbacks: OptionListCallbacks<TOption, TValue> = {};\r\n get callbacks() {\r\n return this.#callbacks;\r\n }\r\n #optionList: TOption[] = [];\r\n #optionPairMap: Map<TOption, JBOptionWebComponent<TValue>> = new Map();\r\n get optionList() {\r\n return this.#optionList || [];\r\n }\r\n set optionList(value) {\r\n if (!Array.isArray(value)) {\r\n console.error(\r\n \"your provided option list to jb-option-list is not a array. you must provide array value\",\r\n { value }\r\n );\r\n return;\r\n }\r\n this.#optionList = value;\r\n this.#initOptionList(value);\r\n }\r\n constructor() {\r\n super();\r\n this.#initWebComponent();\r\n }\r\n connectedCallback() {\r\n // standard web component event that called when all of dom is bounded\r\n }\r\n setCallback<T extends keyof OptionListCallbacks<TOption, TValue>>(key: T, callbackFn: OptionListCallbacks<TOption, TValue>[T]) {\r\n this.#callbacks[key] = callbackFn;\r\n switch (key) {\r\n case 'getContentDOM':\r\n case 'getTitle':\r\n this.#updateOptionsContent();\r\n break;\r\n case 'getValue':\r\n this.#updateOptionsValue();\r\n }\r\n }\r\n #updateOptionsContent() {\r\n this.#optionPairMap.forEach((dom, option) => {\r\n this.#fillOptionContent(option, dom);\r\n });\r\n }\r\n #updateOptionsValue() {\r\n this.#optionPairMap.forEach((dom, option) => {\r\n dom.value = this.#getOptionValue(option);\r\n });\r\n }\r\n #initWebComponent() {\r\n const shadowRoot = this.attachShadow({\r\n mode: \"open\",\r\n });\r\n const element = document.createElement(\"template\");\r\n\r\n shadowRoot.appendChild(element.content.cloneNode(true));\r\n }\r\n //\r\n #initOptionList(optionList: TOption[]) {\r\n this.shadowRoot.innerHTML = \"\";\r\n optionList.forEach((option) => {\r\n const dom = this.#createOptionDOM(option);\r\n this.shadowRoot.appendChild(dom);\r\n this.#optionPairMap.set(option, dom);\r\n });\r\n }\r\n #getOptionValue(option: TOption): TValue {\r\n if (this.callbacks.getValue && typeof this.callbacks.getValue !== \"function\") {\r\n console.error(\"getOptionValue callback is not a function\");\r\n }\r\n try {\r\n if (typeof this.#callbacks.getValue == \"function\") {\r\n return this.#callbacks.getValue(option);\r\n } else {\r\n return option as unknown as TValue;\r\n }\r\n } catch (e) {\r\n console.error(\r\n `Invalid getOptionValue callback Result, must be a function that returns the value of an option`,\r\n option\r\n );\r\n }\r\n }\r\n #getOptionTitle(option: TOption): string {\r\n if (typeof this.#callbacks.getTitle == \"function\") {\r\n try {\r\n return this.#callbacks.getTitle(option);\r\n } catch (e) {\r\n console.error(\r\n `Invalid getOptionTitle callback Result, must be a function that returns the value of an option`,\r\n option\r\n );\r\n }\r\n } else {\r\n return String(option);\r\n }\r\n return \"\";\r\n }\r\n #fillOptionContent(option: TOption, element: JBOptionWebComponent<TValue>) {\r\n element.innerHTML = \"\";\r\n if (typeof this.#callbacks.getContentDOM == \"function\") {\r\n element.appendChild(this.#callbacks.getContentDOM(option));\r\n } else {\r\n element.innerHTML = this.#getOptionTitle(option);\r\n }\r\n }\r\n #createOptionDOM(item: TOption): JBOptionWebComponent<TValue> {\r\n // const optionElement = document.createElement(\"jb-option\") as JBOptionWebComponent<TValue>;\r\n const optionElement = new JBOptionWebComponent<TValue>();\r\n //it has default function who return exact same input\r\n this.#fillOptionContent(item, optionElement);\r\n optionElement.value = this.#getOptionValue(item);\r\n return optionElement;\r\n }\r\n\r\n}\r\nconst myElementNotExists = !customElements.get(\"jb-option-list\");\r\nif (myElementNotExists) {\r\n //prevent duplicate registering\r\n window.customElements.define(\"jb-option-list\", JBOptionListWebComponent);\r\n}\r\n","import HTML from \"./jb-select.html\";\r\nimport CSS from \"./jb-select.scss\";\r\nimport {\r\n JBSelectCallbacks,\r\n JBSelectElements,\r\n ValidationValue,\r\n} from \"./types\";\r\nimport { ShowValidationErrorInput, ValidationHelper, type ValidationItem, type ValidationResult, type WithValidation } from \"jb-validation\";\r\nimport { isMobile } from \"../../../common/scripts/device-detection\";\r\nimport { JBFormInputStandards } from 'jb-form';\r\n// eslint-disable-next-line no-duplicate-imports\r\nimport { JBOptionWebComponent } from \"./jb-option/jb-option\";\r\n// eslint-disable-next-line no-duplicate-imports\r\n//TOption is the type of option, TValue is the type of value we extract from option\r\nexport class JBSelectWebComponent<TValue = any> extends HTMLElement implements WithValidation<ValidationValue<TValue>>, JBFormInputStandards<TValue> {\r\n static get formAssociated() {\r\n return true;\r\n }\r\n // we keep selected option here by option but we return TValue when user demand\r\n #value: TValue;\r\n #textValue = \"\";\r\n // if user set value and current option list is not contain the option.\r\n // we hold it in _notFoundedValue and select value when option value get updated\r\n #notFoundedValue: TValue = null;\r\n #optionList = new Set<JBOptionWebComponent<TValue>>()\r\n //keep selected option dom\r\n #selectedOption: JBOptionWebComponent<TValue> | null = null;\r\n callbacks: JBSelectCallbacks<TValue> = {}\r\n elements!: JBSelectElements;\r\n get value(): TValue {\r\n if (this.#value) {\r\n return this.#value;\r\n } else {\r\n return null;\r\n }\r\n }\r\n set value(value: TValue) {\r\n this.#setValueFromOutside(value);\r\n }\r\n get textValue() {\r\n return this.#textValue;\r\n }\r\n set textValue(value) {\r\n this.#textValue = value;\r\n this.elements.input.value = value;\r\n this.#updateOptionList(value);\r\n }\r\n get selectedOptionTitle() {\r\n if (this.value) {\r\n return this.#selectedOption.optionContentText;\r\n } else {\r\n return \"\";\r\n }\r\n }\r\n #placeholder = \"\";\r\n get placeholder() {\r\n return this.#placeholder;\r\n }\r\n set placeholder(value: string) {\r\n this.#placeholder = value;\r\n if (this.value !== null && this.value !== undefined) {\r\n this.elements.input.placeholder = \"\";\r\n } else {\r\n this.elements.input.placeholder = value;\r\n }\r\n }\r\n //on mobile device when search modal open this will appear on search box\r\n #searchPlaceholder = \"search\";\r\n get searchPlaceholder() {\r\n return this.#searchPlaceholder;\r\n }\r\n set searchPlaceholder(value) {\r\n this.#searchPlaceholder = value;\r\n }\r\n get isMobileDevice() {\r\n return isMobile();\r\n }\r\n get isOpen() {\r\n return this.elements.componentWrapper.classList.contains(\"--focused\");\r\n }\r\n // this value used by validation module to send to validation callbacks\r\n get #ValidationValue(): ValidationValue<TValue> {\r\n return {\r\n inputtedText: this.#textValue,\r\n selectedOption: this.#selectedOption,\r\n value: this.value\r\n };\r\n }\r\n #validation = new ValidationHelper<ValidationValue<TValue>>({\r\n clearValidationError: this.clearValidationError.bind(this),\r\n showValidationError: this.showValidationError.bind(this),\r\n getValue: () => this.#ValidationValue,\r\n getValidations: this.#getInsideValidation.bind(this),\r\n getValueString: () => this.#textValue,\r\n setValidationResult: this.#setValidationResult.bind(this)\r\n });\r\n get validation() {\r\n return this.#validation;\r\n }\r\n #disabled = false;\r\n get disabled() {\r\n return this.#disabled;\r\n }\r\n set disabled(value: boolean) {\r\n this.#disabled = value;\r\n this.elements.input.disabled = value;\r\n if (value) {\r\n (this.#internals as any).states?.add(\"disabled\");\r\n } else {\r\n (this.#internals as any).states?.delete(\"disabled\");\r\n }\r\n }\r\n #required = false;\r\n set required(value: boolean) {\r\n this.#required = value;\r\n this.#validation.checkValiditySync({ showError: false });\r\n }\r\n get required() {\r\n return this.#required;\r\n }\r\n #internals?: ElementInternals;\r\n /**\r\n * @description will determine if component trigger jb-validation mechanism automatically on user event or it just let user-developer handle validation mechanism by himself\r\n */\r\n get isAutoValidationDisabled(): boolean {\r\n //currently we only support disable-validation in attribute and only in initiate time but later we can add support for change of this \r\n return this.getAttribute('disable-auto-validation') === '' || this.getAttribute('disable-auto-validation') === 'true' ? true : false;\r\n }\r\n get name() {\r\n return this.getAttribute('name') || '';\r\n }\r\n initialValue: TValue | null = null;\r\n get isDirty(): boolean {\r\n return this.value !== this.initialValue;\r\n }\r\n constructor() {\r\n super();\r\n if (typeof this.attachInternals == \"function\") {\r\n //some browser dont support attachInternals\r\n this.#internals = this.attachInternals();\r\n }\r\n this.#initWebComponent();\r\n this.#initProp();\r\n }\r\n connectedCallback() {\r\n // standard web component event that called when all of dom is binded\r\n this.#callOnLoadEvent();\r\n this.#callOnInitEvent();\r\n }\r\n #callOnInitEvent() {\r\n const event = new CustomEvent(\"init\", { bubbles: true, composed: true });\r\n this.dispatchEvent(event);\r\n }\r\n #callOnLoadEvent() {\r\n const event = new CustomEvent(\"load\", { bubbles: true, composed: true });\r\n this.dispatchEvent(event);\r\n }\r\n #initWebComponent() {\r\n const shadowRoot = this.attachShadow({\r\n mode: \"open\",\r\n delegatesFocus: true,\r\n });\r\n const html = `<style>${CSS}</style>` + \"\\n\" + HTML;\r\n const element = document.createElement(\"template\");\r\n element.innerHTML = html;\r\n shadowRoot.appendChild(element.content.cloneNode(true));\r\n this.elements = {\r\n input: shadowRoot.querySelector(\".select-box input\")!,\r\n componentWrapper: shadowRoot.querySelector(\".jb-select-web-component\")!,\r\n selectedValueWrapper: shadowRoot.querySelector(\r\n \".selected-value-wrapper\"\r\n )!,\r\n messageBox: shadowRoot.querySelector(\".message-box\")!,\r\n optionList: shadowRoot.querySelector(\".select-list\")!,\r\n optionListWrapper: shadowRoot.querySelector(\".select-list-wrapper\")!,\r\n optionListSlot: shadowRoot.querySelector(\".select-list-wrapper .select-list slot\")!,\r\n arrowIcon: shadowRoot.querySelector(\".arrow-icon\")!,\r\n label: {\r\n wrapper: shadowRoot.querySelector(\"label\")!,\r\n text: shadowRoot.querySelector(\"label .label-value\")!,\r\n },\r\n emptyListPlaceholder: shadowRoot.querySelector(\".empty-list-placeholder\")!,\r\n };\r\n this.#registerEventListener();\r\n }\r\n #registerEventListener() {\r\n this.elements.input.addEventListener(\"change\", (e: Event) => {\r\n this.#onInputChange(e);\r\n });\r\n this.elements.input.addEventListener(\"keypress\", this.#onInputKeyPress.bind(this));\r\n this.elements.input.addEventListener(\"keyup\", this.#onInputKeyup.bind(this));\r\n this.elements.input.addEventListener(\"beforeinput\", this.#onInputBeforeInput.bind(this));\r\n this.elements.input.addEventListener(\"input\", (e) => { this.#onInputInput(e as unknown as InputEvent); });\r\n this.elements.input.addEventListener(\"focus\", this.#onInputFocus.bind(this));\r\n this.elements.input.addEventListener(\"blur\", this.#onInputBlur.bind(this));\r\n this.elements.arrowIcon.addEventListener(\"click\", this.#onArrowKeyClick.bind(this));\r\n //events to work with options\r\n this.addEventListener(\"select\", this.#onOptionSelect.bind(this));\r\n this.addEventListener(\"jb-option-connected\", this.#onOptionConnected.bind(this));\r\n this.elements.optionListSlot.addEventListener(\"slotchange\",this.#onOptionSlotChange.bind(this));\r\n\r\n }\r\n\r\n #initProp() {\r\n this.textValue = \"\";\r\n this.value = this.getAttribute(\"value\") as TValue || null;\r\n }\r\n static get observedAttributes() {\r\n return [\r\n \"label\",\r\n \"message\",\r\n \"value\",\r\n \"required\",\r\n \"placeholder\",\r\n \"search-placeholder\",\r\n ];\r\n }\r\n attributeChangedCallback(name: string, oldValue: string, newValue: string) {\r\n // do something when an attribute has changed\r\n this.#onAttributeChange(name, newValue);\r\n }\r\n #onAttributeChange(name: string, value: string) {\r\n switch (name) {\r\n case \"label\":\r\n this.elements.label.text.innerHTML = value;\r\n if (value == null || value == undefined || value == \"\") {\r\n this.elements.label.wrapper.classList.add(\"--hide\");\r\n } else {\r\n this.elements.label.wrapper.classList.remove(\"--hide\");\r\n }\r\n break;\r\n case \"message\":\r\n this.elements.messageBox.innerHTML = value;\r\n break;\r\n case \"value\":\r\n this.#setValueFromOutside(value as TValue);\r\n break;\r\n case \"required\":\r\n if (value === \"\" || value == \"true\" || value == \"True\") {\r\n this.required = true;\r\n } else {\r\n this.required = false;\r\n }\r\n break;\r\n case \"placeholder\":\r\n this.placeholder = value;\r\n break;\r\n case \"search-placeholder\":\r\n this.searchPlaceholder = value;\r\n break;\r\n }\r\n }\r\n /**\r\n * will check option list and if select has no option it will show empty list placeholder\r\n */\r\n #updateListEmptyPlaceholder(){\r\n const isAnyOptionVisible = Array.from(this.#optionList).some(x=>x.hidden==false);\r\n if(isAnyOptionVisible){\r\n this.elements.emptyListPlaceholder.classList.remove(\"--show\");\r\n }else{\r\n this.elements.emptyListPlaceholder.classList.add(\"--show\");\r\n }\r\n }\r\n #onOptionSlotChange(e:Event){\r\n this.#setValueOnOptionListChanged();\r\n this.#updateListEmptyPlaceholder();\r\n }\r\n #setValueOnOptionListChanged() {\r\n //when option list changed we see if current value is valid for new optionlist we set it if not we reset value to null.\r\n //in some scenario value is setted before optionList attached so we store it on this.#notFoundedValue and after option list setted we set value from this.#notFoundedValue\r\n if (this.#notFoundedValue) {\r\n //if select has no prev value or pending not found value we don't set it because user may input some search terms in input box and developer-user update list base on that value\r\n //if we set it to null the search term and this.textValue will become null and empty too and it make impossible for user to search in dynamic back-end provided searchable list so we put this condition to prevent it\r\n const isSetted = this.#setValueFromOutside(this.#notFoundedValue);\r\n if (isSetted) {\r\n //after list update and when not founded value is found in new option list we clear old not founded value\r\n this.#notFoundedValue = null;\r\n }\r\n } else if (this.value) {\r\n this.#setValueFromOutside(this.value);\r\n }\r\n }\r\n //when user set value by attribute or value prop directly we call this function\r\n #setValueFromOutside(value: TValue): boolean {\r\n if(value === null || value === undefined){\r\n this.#setValue(null,null);\r\n return true;\r\n }\r\n let matchedOption:JBOptionWebComponent<TValue>| null = null; \r\n this.#optionList.forEach((option) => {\r\n // if we have value mapper we set selected value by object that match mapper\r\n if (option.value == value) {\r\n matchedOption = option;\r\n }\r\n });\r\n if (matchedOption) {\r\n this.#setValue(matchedOption.value,matchedOption);\r\n return true;\r\n } else {\r\n this.#notFoundedValue = value;\r\n return false;\r\n }\r\n }\r\n //null option mean deselect all\r\n #changeSelectedOption(option:JBOptionWebComponent<TValue>|null){\r\n this.#optionList.forEach((x)=>x.selected = false);\r\n if(option){\r\n option.selected = true;\r\n this.#selectedOption = option;\r\n }\r\n }\r\n #setValue(value: TValue,option:JBOptionWebComponent<TValue>|null) {\r\n this.#notFoundedValue = null;\r\n this.#value = value;\r\n if (value === null || value === undefined) {\r\n this.textValue = \"\";\r\n this.#setSelectedOptionDom(null);\r\n //will deselect all option\r\n this.#changeSelectedOption(null);\r\n this.elements.componentWrapper.classList.remove(\"--has-value\");\r\n //show placeholder when user empty data\r\n if (!(this.isMobileDevice && this.isOpen)) {\r\n this.elements.input.placeholder = this.placeholder;\r\n }\r\n } else {\r\n this.textValue = \"\";\r\n this.#changeSelectedOption(option);\r\n this.#setSelectedOptionDom(value);\r\n this.elements.componentWrapper.classList.add(\"--has-value\");\r\n //hide placeholder when user select data\r\n if (!(this.isMobileDevice && this.isOpen)) {\r\n this.elements.input.placeholder = \"\";\r\n }\r\n }\r\n //if user select an option we rest filter so user see all option again when open a select\r\n this.#updateOptionList(\"\");\r\n }\r\n #onArrowKeyClick() {\r\n if (this.isOpen) {\r\n this.blur();\r\n } else {\r\n this.focus();\r\n }\r\n }\r\n #onInputKeyPress(e: KeyboardEvent) {\r\n const eventOptions: KeyboardEventInit = {\r\n altKey: e.altKey,\r\n bubbles: e.bubbles,\r\n cancelable: e.cancelable,\r\n code: e.code,\r\n composed: e.composed,\r\n ctrlKey: e.ctrlKey,\r\n detail: e.detail,\r\n isComposing: e.isComposing,\r\n key: e.key,\r\n location: e.location,\r\n metaKey: e.metaKey,\r\n view: e.view,\r\n repeat: e.repeat,\r\n shiftKey: e.shiftKey\r\n };\r\n const event = new KeyboardEvent(\"keypress\", eventOptions);\r\n this.dispatchEvent(event);\r\n }\r\n #onInputBeforeInput(e: InputEvent) {\r\n // const inputtedText = e.data || \"\";\r\n //TODO: add cancelable event dispatch here\r\n }\r\n #onInputInput(e: InputEvent) {\r\n const inputtedText = (e.target as HTMLInputElement).value;\r\n this.textValue = inputtedText;\r\n this.#handleSelectedValueDisplay(inputtedText);\r\n this.#validation.checkValidity({ showError: false });\r\n this.#dispatchInputEvent(e);\r\n this.#updateListEmptyPlaceholder();\r\n }\r\n #dispatchInputEvent(e: InputEvent) {\r\n const event = new InputEvent(\"input\", {\r\n bubbles: e.bubbles,\r\n cancelable: e.cancelable,\r\n composed: e.composed,\r\n data: e.data,\r\n dataTransfer: e.dataTransfer,\r\n detail: e.detail,\r\n inputType: e.inputType,\r\n isComposing: e.isComposing,\r\n targetRanges: e.getTargetRanges(),\r\n view: e.view,\r\n });\r\n this.dispatchEvent(event);\r\n }\r\n #onInputKeyup(e: KeyboardEvent) {\r\n const inputText = (e.target as HTMLInputElement).value;\r\n //here is the rare time we update #value directly because we want trigger event that may read value directly from dom\r\n if (e.key === \"Backspace\" || e.key === \"Delete\") {\r\n //because on keypress dont receive backspace key press\r\n this.#handleSelectedValueDisplay(inputText);\r\n }\r\n\r\n this.#triggerOnInputKeyup(e);\r\n }\r\n #handleSelectedValueDisplay(inputValue: string) {\r\n if (inputValue !== \"\") {\r\n this.elements.selectedValueWrapper.classList.add(\"--search-typed\");\r\n } else {\r\n this.elements.selectedValueWrapper.classList.remove(\"--search-typed\");\r\n }\r\n }\r\n #triggerOnInputKeyup(e: KeyboardEvent) {\r\n const event = new KeyboardEvent(\"keyup\", {\r\n altKey: e.altKey,\r\n bubbles: e.bubbles,\r\n cancelable: e.cancelable,\r\n code: e.code,\r\n ctrlKey: e.ctrlKey,\r\n detail: e.detail,\r\n key: e.key,\r\n shiftKey: e.shiftKey,\r\n charCode: e.charCode,\r\n location: e.location,\r\n composed: e.composed,\r\n isComposing: e.isComposing,\r\n metaKey: e.metaKey,\r\n repeat: e.repeat,\r\n keyCode: e.keyCode,\r\n view: e.view,\r\n });\r\n this.dispatchEvent(event);\r\n }\r\n #onInputChange(e: Event) {\r\n const inputText = (e.target as HTMLInputElement).value;\r\n //here is the rare time we update _text_value directly because we want trigger event that may read value directly from dom\r\n this.#textValue = inputText;\r\n }\r\n #onInputFocus() {\r\n this.focus();\r\n }\r\n #onInputBlur(e: FocusEvent) {\r\n const focusedElement = <Node>e.relatedTarget;\r\n if (\r\n this.elements.optionListWrapper.contains(focusedElement) ||\r\n this.elements.arrowIcon.contains(focusedElement)\r\n ) {\r\n //user click on a menu item\r\n } else {\r\n this.blur();\r\n }\r\n }\r\n focus() {\r\n this.elements.input.focus();\r\n this.#showOptionList();\r\n this.elements.componentWrapper.classList.add(\"--focused\");\r\n if (this.isMobileDevice) {\r\n this.elements.input.placeholder = this.#searchPlaceholder;\r\n }\r\n }\r\n blur() {\r\n this.elements.componentWrapper.classList.remove(\"--focused\");\r\n this.textValue = \"\";\r\n this.#handleSelectedValueDisplay(\"\");\r\n this.#hideOptionList();\r\n this.#validation.checkValidity({ showError: true });\r\n if (this.isMobileDevice) {\r\n if (this.value) {\r\n this.elements.input.placeholder = \"\";\r\n } else {\r\n this.elements.input.placeholder = this.placeholder;\r\n }\r\n }\r\n this.elements.input.blur();\r\n }\r\n #showOptionList() {\r\n this.elements.optionListWrapper.classList.add(\"--show\");\r\n }\r\n #hideOptionList() {\r\n this.elements.optionListWrapper.classList.remove(\"--show\");\r\n }\r\n #updateOptionList(filterText: string) {\r\n const event = new CustomEvent(\"filter-change\", { detail: { filterText }, bubbles: false, cancelable: false, composed: false });\r\n this.dispatchEvent(event);\r\n }\r\n #onOptionSelect(e: CustomEvent) {\r\n const prevValue = this.#value;\r\n const prevOption = this.#selectedOption;\r\n //because jb-option may be in another shadow dom like jb-option-list we have to get first composed element as a target\r\n const target = (e.composedPath()[0] as JBOptionWebComponent<TValue>);\r\n if (target instanceof JBOptionWebComponent) {\r\n const value = target.value;\r\n this.#selectOption(value,target);\r\n this.blur();\r\n const dispatchedEvent = this.#dispatchOnChangeEvent();\r\n if (dispatchedEvent.defaultPrevented) {\r\n e.preventDefault();\r\n this.#selectOption(prevValue,prevOption);\r\n }\r\n }\r\n\r\n }\r\n //called when an jb-Option connected to the dom\r\n #onOptionConnected(e: CustomEvent) {\r\n e.stopPropagation();\r\n const target = (e.composedPath()[0] as JBOptionWebComponent<TValue>);\r\n target.addEventListener(\"jb-option-disconnected\",this.#onOptionDisconnected.bind(this),{once:true,passive:true});\r\n target.setSelectElement(this);\r\n this.#optionList.add(target);\r\n if(this.#notFoundedValue){\r\n this.#setValueOnOptionListChanged();\r\n }\r\n this.#updateListEmptyPlaceholder();\r\n }\r\n #onOptionDisconnected(e:CustomEvent){\r\n e.stopPropagation();\r\n const target = e.target as JBOptionWebComponent<TValue>;\r\n this.#optionList.delete(target);\r\n this.#updateListEmptyPlaceholder();\r\n if(target.value == this.#value){\r\n this.#setValueOnOptionListChanged();\r\n }\r\n }\r\n\r\n #selectOption(value: TValue, optionDom:JBOptionWebComponent<TValue>) {\r\n this.#setValue(value,optionDom);\r\n this.#checkValidity(true);\r\n }\r\n /**\r\n * @description show given string as a error in message place\r\n * @public\r\n */\r\n showValidationError(error: ShowValidationErrorInput | string) {\r\n const message = typeof error == \"string\" ? error : error.message;\r\n this.elements.messageBox.innerHTML = message;\r\n this.elements.messageBox.classList.add(\"--error\");\r\n }\r\n clearValidationError() {\r\n this.elements.messageBox.innerHTML = this.getAttribute(\"message\") || \"\";\r\n this.elements.messageBox.classList.remove(\"--error\");\r\n }\r\n #dispatchOnChangeEvent() {\r\n const event = new Event(\"change\", { bubbles: true, cancelable: true });\r\n this.dispatchEvent(event);\r\n return event;\r\n }\r\n #setSelectedOptionDom(value: TValue) {\r\n //when user select option or value changed in any condition we set selected option DOM\r\n this.elements.selectedValueWrapper.innerHTML = \"\";\r\n //if value was null or undefined it remain empty\r\n if (value !== null && value !== undefined) {\r\n const selectedOptionDom = this.#createSelectedValueDom(value);\r\n this.elements.selectedValueWrapper.appendChild(selectedOptionDom);\r\n }\r\n }\r\n #createSelectedValueDom(value: TValue) {\r\n if (typeof this.callbacks.getSelectedValueDOM == \"function\") {\r\n return this.callbacks.getSelectedValueDOM(value,this.#selectedOption);\r\n } else {\r\n return this.#createDefaultSelectedValueDom();\r\n }\r\n }\r\n #createDefaultSelectedValueDom() {\r\n //TODO: put some backup way for when we have value but no option provided\r\n let contentNodes:Node[] = [];\r\n if(this.#selectedOption){\r\n contentNodes = this.#selectedOption.optionContent;\r\n }\r\n const selectedOptionDom = document.createElement(\"div\");\r\n selectedOptionDom.classList.add(\"selected-value\");\r\n selectedOptionDom.append(...contentNodes.map(n=>n.cloneNode()));\r\n return selectedOptionDom;\r\n }\r\n #getInsideValidation() {\r\n const ValidationList: ValidationItem<ValidationValue<TValue>>[] = [];\r\n if (this.required) {\r\n const label = this.getAttribute(\"label\") || \"\";\r\n const message = `${label} حتما باید انتخاب شود`;\r\n ValidationList.push({\r\n validator: ({ value }) => {\r\n return value !== null && value !== undefined;\r\n },\r\n message: message,\r\n stateType: \"valueMissing\"\r\n });\r\n }\r\n return ValidationList;\r\n }\r\n //\r\n #checkValidity(showError: boolean) {\r\n if (!this.isAutoValidationDisabled) {\r\n return this.#validation.checkValidity({ showError });\r\n }\r\n }\r\n /**\r\n * @public\r\n * @description this method used to check for validity but doesn't show error to user and just return the result\r\n * this method used by #internal of component\r\n */\r\n checkValidity(): boolean {\r\n const validationResult = this.#validation.checkValiditySync({ showError: false });\r\n if (!validationResult.isAllValid) {\r\n const event = new CustomEvent('invalid');\r\n this.dispatchEvent(event);\r\n }\r\n return validationResult.isAllValid;\r\n }\r\n /**\r\n * @public\r\n * @description this method used to check for validity and show error to user\r\n */\r\n reportValidity(): boolean {\r\n const validationResult = this.#validation.checkValiditySync({ showError: true });\r\n if (!validationResult.isAllValid) {\r\n const event = new CustomEvent('invalid');\r\n this.dispatchEvent(event);\r\n }\r\n return validationResult.isAllValid;\r\n }\r\n /**\r\n * @description this method called on every checkValidity calls and update validation result of #internal\r\n */\r\n #setValidationResult(result: ValidationResult<ValidationValue<TValue>>) {\r\n if (result.isAllValid) {\r\n this.#internals?.setValidity({}, '');\r\n } else {\r\n const states: ValidityStateFlags = {};\r\n let message = \"\";\r\n result.validationList.forEach((res) => {\r\n if (!res.isValid) {\r\n if (res.validation.stateType) {\r\n states[res.validation.stateType] = true;\r\n } else {\r\n states[\"customError\"] = true;\r\n }\r\n if (message == '') { message = res.message; }\r\n\r\n }\r\n });\r\n this.#internals?.setValidity(states, message);\r\n }\r\n }\r\n get validationMessage() {\r\n return this.#internals?.validationMessage || this.#validation.resultSummary.message;\r\n }\r\n\r\n}\r\nconst myElementNotExists = !customElements.get(\"jb-select\");\r\nif (myElementNotExists) {\r\n //prevent duplicate registering\r\n window.customElements.define(\"jb-select\", JBSelectWebComponent);\r\n}\r\n","export const isMobile = ()=>{\r\n return /Mobi/i.test(window.navigator.userAgent);\r\n};"],"names":["JBOptionWebComponent","HTMLElement","value","__classPrivateFieldGet","this","_JBOptionWebComponent_value","__classPrivateFieldSet","selected","_JBOptionWebComponent_selected","_JBOptionWebComponent_elements","componentWrapper","classList","add","remove","optionContent","contentWrapper","querySelector","assignedNodes","hidden","_JBOptionWebComponent_hidden","optionContentText","reduce","acc","item","textContent","constructor","super","set","_JBOptionWebComponent_SelectElement","_JBOptionWebComponent_instances","_JBOptionWebComponent_initWebComponent","call","_JBOptionWebComponent_initProp","connectedCallback","_JBOptionWebComponent_dispatchPlaceEvent","setSelectElement","element","addEventListener","_JBOptionWebComponent_onFilterChange","bind","disconnectedCallback","removeEventListener","event","CustomEvent","bubbles","composed","cancelable","dispatchEvent","observedAttributes","attributeChangedCallback","name","oldValue","newValue","e","filterText","detail","includes","shadowRoot","attachShadow","mode","document","createElement","innerHTML","appendChild","content","cloneNode","_JBOptionWebComponent_registerEventListener","getAttribute","_JBOptionWebComponent_onAttributeChange","_JBOptionWebComponent_onOptionClick","_JBOptionWebComponent_dispatchSelectEvent","customElements","get","window","define","JBOptionListWebComponent","callbacks","_JBOptionListWebComponent_callbacks","optionList","_JBOptionListWebComponent_optionList","Array","isArray","_JBOptionListWebComponent_instances","_JBOptionListWebComponent_initOptionList","console","error","_JBOptionListWebComponent_optionPairMap","Map","_JBOptionListWebComponent_initWebComponent","setCallback","key","callbackFn","_JBOptionListWebComponent_updateOptionsContent","_JBOptionListWebComponent_updateOptionsValue","forEach","dom","option","_JBOptionListWebComponent_getOptionValue","_JBOptionListWebComponent_createOptionDOM","getValue","getTitle","String","_JBOptionListWebComponent_fillOptionContent","getContentDOM","_JBOptionListWebComponent_getOptionTitle","optionElement","JBSelectWebComponent","formAssociated","_JBSelectWebComponent_value","_JBSelectWebComponent_instances","_JBSelectWebComponent_setValueFromOutside","textValue","_JBSelectWebComponent_textValue","elements","input","_JBSelectWebComponent_updateOptionList","selectedOptionTitle","_JBSelectWebComponent_selectedOption","placeholder","_JBSelectWebComponent_placeholder","undefined","searchPlaceholder","_JBSelectWebComponent_searchPlaceholder","isMobileDevice","test","navigator","userAgent","isOpen","contains","validation","_JBSelectWebComponent_validation","disabled","_JBSelectWebComponent_disabled","states","delete","required","_JBSelectWebComponent_required","checkValiditySync","showError","isAutoValidationDisabled","isDirty","initialValue","_JBSelectWebComponent_notFoundedValue","_JBSelectWebComponent_optionList","Set","ValidationHelper","clearValidationError","showValidationError","_JBSelectWebComponent_ValidationValue_get","getValidations","_JBSelectWebComponent_getInsideValidation","getValueString","setValidationResult","_JBSelectWebComponent_setValidationResult","_JBSelectWebComponent_internals","attachInternals","_JBSelectWebComponent_initWebComponent","_JBSelectWebComponent_initProp","_JBSelectWebComponent_callOnLoadEvent","_JBSelectWebComponent_callOnInitEvent","focus","_JBSelectWebComponent_showOptionList","blur","_JBSelectWebComponent_handleSelectedValueDisplay","_JBSelectWebComponent_hideOptionList","checkValidity","message","messageBox","validationResult","isAllValid","reportValidity","validationMessage","resultSummary","inputtedText","selectedOption","delegatesFocus","selectedValueWrapper","optionListWrapper","optionListSlot","arrowIcon","label","wrapper","text","emptyListPlaceholder","_JBSelectWebComponent_registerEventListener","_JBSelectWebComponent_onInputChange","_JBSelectWebComponent_onInputInput","_JBSelectWebComponent_onOptionSelect","_JBSelectWebComponent_onOptionConnected","_JBSelectWebComponent_onAttributeChange","_JBSelectWebComponent_updateListEmptyPlaceholder","from","some","x","_JBSelectWebComponent_setValueOnOptionListChanged","matchedOption","_JBSelectWebComponent_setValue","_JBSelectWebComponent_setSelectedOptionDom","_JBSelectWebComponent_changeSelectedOption","_JBSelectWebComponent_onArrowKeyClick","eventOptions","altKey","code","ctrlKey","isComposing","location","metaKey","view","repeat","shiftKey","KeyboardEvent","target","_JBSelectWebComponent_dispatchInputEvent","InputEvent","data","dataTransfer","inputType","targetRanges","getTargetRanges","inputText","_JBSelectWebComponent_triggerOnInputKeyup","inputValue","charCode","keyCode","_JBSelectWebComponent_onInputFocus","focusedElement","relatedTarget","prevValue","prevOption","composedPath","defaultPrevented","preventDefault","stopPropagation","_JBSelectWebComponent_onOptionDisconnected","once","passive","_JBSelectWebComponent_selectOption","optionDom","_JBSelectWebComponent_checkValidity","_JBSelectWebComponent_dispatchOnChangeEvent","Event","selectedOptionDom","_JBSelectWebComponent_createSelectedValueDom","getSelectedValueDOM","_JBSelectWebComponent_createDefaultSelectedValueDom","contentNodes","append","map","n","ValidationList","push","validator","stateType","result","setValidity","validationList","res","isValid"],"mappings":"kxBAMM,MAAOA,UAAqCC,YAMhD,SAAIC,GACF,OAAOC,EAAAC,KAAIC,EAAA,IACZ,CACD,SAAIH,CAAMA,GACRI,EAAAF,KAAIC,EAAUH,EAAK,IACpB,CAED,YAAIK,CAASL,GACXI,EAAAF,KAAII,EAAaN,EAAK,KACnBA,EACDC,EAAAC,KAAcK,EAAA,KAACC,iBAAiBC,UAAUC,IAAI,cAE9CT,EAAAC,KAAcK,EAAA,KAACC,iBAAiBC,UAAUE,OAAO,aAEpD,CACD,YAAIN,GACF,OAAOJ,EAAAC,KAAII,EAAA,IACZ,CACD,iBAAIM,GAEF,OADoBX,EAAAC,YAAeW,eAAeC,cAAc,QAAQC,eAEzE,CAGD,UAAIC,GACF,OAAOf,EAAAC,KAAIe,EAAA,IACZ,CACD,UAAID,CAAOhB,GACTI,EAAAF,KAAIe,EAAWjB,EAAK,KACjBA,EACDC,EAAAC,KAAcK,EAAA,KAACC,iBAAiBC,UAAUC,IAAI,YAE9CT,EAAAC,KAAcK,EAAA,KAACC,iBAAiBC,UAAUE,OAAO,WAEpD,CA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,oBACjB/O,KAAKwE,UAAUuK,oBAAoBjP,EAAMC,EAAAC,KAAoBiH,EAAA,MAE7DlH,EAAAC,KAAIyG,EAAA,IAAAuI,IAAJrN,KAAA3B,KAEX,EAACgP,GAAA,WAGC,IAAIC,EAAsB,GACvBlP,EAAAC,KAAIiH,EAAA,OACLgI,EAAelP,EAAAC,KAAoBiH,EAAA,KAACvG,eAEtC,MAAMmO,EAAoBrL,SAASC,cAAc,OAGjD,OAFAoL,EAAkBtO,UAAUC,IAAI,kBAChCqO,EAAkBK,UAAUD,EAAaE,KAAIC,GAAGA,EAAEvL,eAC3CgL,CACT,EAAC3F,GAAA,WAEC,MAAMmG,EAA4D,GAClE,GAAIrP,KAAKmI,SAAU,CACjB,MACM+B,EAAU,GADFlK,KAAK+D,aAAa,UAAY,0BAE5CsL,EAAeC,KAAK,CAClBC,UAAW,EAAGzP,WACLA,QAEToK,QAASA,EACTsF,UAAW,gBAEd,CACD,OAAOH,CACT,cAEe/G,GACb,IAAKtI,KAAKuI,yBACR,OAAOxI,EAAAC,KAAI8H,EAAA,KAAamC,cAAc,CAAE3B,aAE5C,cA6BqBmH,GACnB,GAAIA,EAAOpF,WACTtK,EAAAC,aAAiB0P,YAAY,CAAA,EAAI,QAC5B,CACL,MAAMzH,EAA6B,CAAA,EACnC,IAAIiC,EAAU,GACduF,EAAOE,eAAejK,SAASkK,IACxBA,EAAIC,UACHD,EAAI/H,WAAW2H,UACjBvH,EAAO2H,EAAI/H,WAAW2H,YAAa,EAEnCvH,EAAoB,aAAI,EAEX,IAAXiC,IAAiBA,EAAU0F,EAAI1F,SAEpC,IAEHnK,EAAAC,aAAiB0P,YAAYzH,EAAQiC,EACtC,CACH,GAM0B/F,eAAeC,IAAI,cAG7CC,OAAOF,eAAeG,OAAO,YAAagC"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../lib/jb-option/jb-option.ts","../lib/jb-option-list/jb-option-list.ts","../lib/jb-select.ts","../../../common/scripts/device-detection.ts"],"sourcesContent":["import { type JBSelectWebComponent } from '../jb-select';\r\nimport CSS from './jb-option.scss';\r\nimport { renderHTML } from \"./render\";\r\nimport { JBOptionElements } from \"./types\";\r\n\r\n//TODO: check for filter text to set visibility on mount\r\nexport class JBOptionWebComponent<TValue> extends HTMLElement {\r\n\r\n #elements: JBOptionElements;\r\n // it may be empty\r\n #SelectElement?: JBSelectWebComponent\r\n #value: TValue;\r\n get value(): TValue {\r\n return this.#value;\r\n }\r\n set value(value: TValue) {\r\n this.#value = value;\r\n }\r\n #selected = false;\r\n set selected(value: boolean) {\r\n this.#selected = value;\r\n if(value){\r\n this.#elements.componentWrapper.classList.add(\"--selected\");\r\n }else{\r\n this.#elements.componentWrapper.classList.remove(\"--selected\");\r\n }\r\n }\r\n get selected() {\r\n return this.#selected;\r\n }\r\n get optionContent():Node[]{\r\n const optionNodes = this.#elements.contentWrapper.querySelector(\"slot\").assignedNodes();\r\n return optionNodes;\r\n }\r\n //TODO: add search hidden property for more accurate hidden and more personalized logic\r\n #hidden = false;\r\n get hidden(){\r\n return this.#hidden;\r\n }\r\n set hidden(value:boolean){\r\n this.#hidden = value;\r\n if(value){\r\n this.#elements.componentWrapper.classList.add('--hidden');\r\n }else{\r\n this.#elements.componentWrapper.classList.remove('--hidden');\r\n }\r\n }\r\n /**\r\n * return text content of option (it used in search by default to filter option)\r\n */\r\n get optionContentText(){\r\n const optionTextContent = this.optionContent.reduce((acc,item)=>{\r\n acc += item.textContent;\r\n return acc;\r\n },\"\");\r\n return optionTextContent;\r\n }\r\n constructor() {\r\n super();\r\n this.#initWebComponent();\r\n this.#initProp();\r\n }\r\n connectedCallback() {\r\n // standard web component event that called when all of dom is bounded\r\n this.#dispatchPlaceEvent();\r\n\r\n }\r\n setSelectElement(element: JBSelectWebComponent) {\r\n if (element) {\r\n this.#SelectElement = element;\r\n this.#SelectElement.addEventListener(\"filter-change\", this.#onFilterChange.bind(this));\r\n }\r\n }\r\n #onFilterChange(e: CustomEvent){\r\n const {filterText} = e.detail;\r\n const optionTextContent = this.optionContentText;\r\n if(optionTextContent.includes(filterText)){\r\n this.hidden = false;\r\n }else{\r\n this.hidden = true;\r\n }\r\n }\r\n disconnectedCallback() {\r\n this.#SelectElement?.removeEventListener(\"filter-change\", this.#onFilterChange.bind(this));\r\n const event = new CustomEvent(\"jb-option-disconnected\",{bubbles:true,composed:true,cancelable:false});\r\n this.dispatchEvent(event);\r\n }\r\n #initWebComponent() {\r\n const shadowRoot = this.attachShadow({\r\n mode: \"open\",\r\n });\r\n const html = `<style>${CSS}</style>` + \"\\n\" + renderHTML();\r\n const element = document.createElement(\"template\");\r\n element.innerHTML = html;\r\n shadowRoot.appendChild(element.content.cloneNode(true));\r\n this.#elements = {\r\n componentWrapper: shadowRoot.querySelector(\".jb-options-web-component\")!,\r\n contentWrapper: shadowRoot.querySelector(\".option-content-wrapper\")!,\r\n };\r\n this.#registerEventListener();\r\n }\r\n #registerEventListener() {\r\n this.#elements.componentWrapper.addEventListener(\"click\", this.#onOptionClick.bind(this));\r\n }\r\n //this event called on each connectedCallback so select could find it's option\r\n #dispatchPlaceEvent() {\r\n const event = new CustomEvent(\"jb-option-connected\", { bubbles: true, composed: true });\r\n this.dispatchEvent(event);\r\n }\r\n #initProp() {\r\n this.value = this.getAttribute(\"value\") as TValue || null;\r\n }\r\n static get observedAttributes() {\r\n return [\"value\"];\r\n }\r\n attributeChangedCallback(name: string, oldValue: string, newValue: string) {\r\n // do something when an attribute has changed\r\n this.#onAttributeChange(name, newValue);\r\n }\r\n #onAttributeChange(name: string, value: string) {\r\n switch (name) {\r\n case 'value':\r\n this.#value = value as TValue;\r\n }\r\n }\r\n #onOptionClick() {\r\n if (!this.#selected) {\r\n this.#dispatchSelectEvent();\r\n }\r\n }\r\n #dispatchSelectEvent() {\r\n const event = new CustomEvent(\"select\", { bubbles: true, cancelable: false, composed: true });\r\n this.dispatchEvent(event);\r\n }\r\n}\r\nconst myElementNotExists = !customElements.get(\"jb-option\");\r\nif (myElementNotExists) {\r\n //prevent duplicate registering\r\n window.customElements.define(\"jb-option\", JBOptionWebComponent);\r\n}\r\n","import { JBOptionWebComponent } from \"../jb-option/jb-option\";\r\nimport { type OptionListCallbacks } from \"./types\";\r\n\r\n//TOption is the type of option, TValue is the type of value we extract from option\r\nexport class JBOptionListWebComponent<TOption, TValue> extends HTMLElement {\r\n #callbacks: OptionListCallbacks<TOption, TValue> = {};\r\n get callbacks() {\r\n return this.#callbacks;\r\n }\r\n #optionList: TOption[] = [];\r\n #optionPairMap: Map<TOption, JBOptionWebComponent<TValue>> = new Map();\r\n get optionList() {\r\n return this.#optionList || [];\r\n }\r\n set optionList(value) {\r\n if (!Array.isArray(value)) {\r\n console.error(\r\n \"your provided option list to jb-option-list is not a array. you must provide array value\",\r\n { value }\r\n );\r\n return;\r\n }\r\n this.#optionList = value;\r\n this.#initOptionList(value);\r\n }\r\n constructor() {\r\n super();\r\n this.#initWebComponent();\r\n }\r\n connectedCallback() {\r\n // standard web component event that called when all of dom is bounded\r\n }\r\n setCallback<T extends keyof OptionListCallbacks<TOption, TValue>>(key: T, callbackFn: OptionListCallbacks<TOption, TValue>[T]) {\r\n this.#callbacks[key] = callbackFn;\r\n switch (key) {\r\n case 'getContentDOM':\r\n case 'getTitle':\r\n this.#updateOptionsContent();\r\n break;\r\n case 'getValue':\r\n this.#updateOptionsValue();\r\n }\r\n }\r\n #updateOptionsContent() {\r\n this.#optionPairMap.forEach((dom, option) => {\r\n this.#fillOptionContent(option, dom);\r\n });\r\n }\r\n #updateOptionsValue() {\r\n this.#optionPairMap.forEach((dom, option) => {\r\n dom.value = this.#getOptionValue(option);\r\n });\r\n }\r\n #initWebComponent() {\r\n const shadowRoot = this.attachShadow({\r\n mode: \"open\",\r\n });\r\n const element = document.createElement(\"template\");\r\n\r\n shadowRoot.appendChild(element.content.cloneNode(true));\r\n }\r\n //\r\n #initOptionList(optionList: TOption[]) {\r\n this.shadowRoot.innerHTML = \"\";\r\n optionList.forEach((option) => {\r\n const dom = this.#createOptionDOM(option);\r\n this.shadowRoot.appendChild(dom);\r\n this.#optionPairMap.set(option, dom);\r\n });\r\n }\r\n #getOptionValue(option: TOption): TValue {\r\n if (this.callbacks.getValue && typeof this.callbacks.getValue !== \"function\") {\r\n console.error(\"getOptionValue callback is not a function\");\r\n }\r\n try {\r\n if (typeof this.#callbacks.getValue == \"function\") {\r\n return this.#callbacks.getValue(option);\r\n } else {\r\n return option as unknown as TValue;\r\n }\r\n } catch (e) {\r\n console.error(\r\n `Invalid getOptionValue callback Result, must be a function that returns the value of an option`,\r\n option\r\n );\r\n }\r\n }\r\n #getOptionTitle(option: TOption): string {\r\n if (typeof this.#callbacks.getTitle == \"function\") {\r\n try {\r\n return this.#callbacks.getTitle(option);\r\n } catch (e) {\r\n console.error(\r\n `Invalid getOptionTitle callback Result, must be a function that returns the value of an option`,\r\n option\r\n );\r\n }\r\n } else {\r\n return String(option);\r\n }\r\n return \"\";\r\n }\r\n #fillOptionContent(option: TOption, element: JBOptionWebComponent<TValue>) {\r\n element.innerHTML = \"\";\r\n if (typeof this.#callbacks.getContentDOM == \"function\") {\r\n element.appendChild(this.#callbacks.getContentDOM(option));\r\n } else {\r\n element.innerHTML = this.#getOptionTitle(option);\r\n }\r\n }\r\n #createOptionDOM(item: TOption): JBOptionWebComponent<TValue> {\r\n // const optionElement = document.createElement(\"jb-option\") as JBOptionWebComponent<TValue>;\r\n const optionElement = new JBOptionWebComponent<TValue>();\r\n //it has default function who return exact same input\r\n this.#fillOptionContent(item, optionElement);\r\n optionElement.value = this.#getOptionValue(item);\r\n return optionElement;\r\n }\r\n\r\n}\r\nconst myElementNotExists = !customElements.get(\"jb-option-list\");\r\nif (myElementNotExists) {\r\n //prevent duplicate registering\r\n window.customElements.define(\"jb-option-list\", JBOptionListWebComponent);\r\n}\r\n","import HTML from \"./jb-select.html\";\r\nimport CSS from \"./jb-select.scss\";\r\nimport {\r\n JBSelectCallbacks,\r\n JBSelectElements,\r\n ValidationValue,\r\n} from \"./types\";\r\nimport { ShowValidationErrorInput, ValidationHelper, type ValidationItem, type ValidationResult, type WithValidation } from \"jb-validation\";\r\nimport { isMobile } from \"../../../common/scripts/device-detection\";\r\nimport { JBFormInputStandards } from 'jb-form';\r\n// eslint-disable-next-line no-duplicate-imports\r\nimport { JBOptionWebComponent } from \"./jb-option/jb-option\";\r\n// eslint-disable-next-line no-duplicate-imports\r\n//TOption is the type of option, TValue is the type of value we extract from option\r\nexport class JBSelectWebComponent<TValue = any> extends HTMLElement implements WithValidation<ValidationValue<TValue>>, JBFormInputStandards<TValue> {\r\n static get formAssociated() {\r\n return true;\r\n }\r\n // we keep selected option here by option but we return TValue when user demand\r\n #value: TValue;\r\n #textValue = \"\";\r\n // if user set value and current option list is not contain the option.\r\n // we hold it in _notFoundedValue and select value when option value get updated\r\n #notFoundedValue: TValue = null;\r\n #optionList = new Set<JBOptionWebComponent<TValue>>()\r\n //keep selected option dom\r\n #selectedOption: JBOptionWebComponent<TValue> | null = null;\r\n callbacks: JBSelectCallbacks<TValue> = {}\r\n elements!: JBSelectElements;\r\n get value(): TValue {\r\n if (this.#value) {\r\n return this.#value;\r\n } else {\r\n return null;\r\n }\r\n }\r\n set value(value: TValue) {\r\n this.#setValueFromOutside(value);\r\n }\r\n get textValue() {\r\n return this.#textValue;\r\n }\r\n set textValue(value) {\r\n this.#textValue = value;\r\n this.elements.input.value = value;\r\n this.#updateOptionList(value);\r\n }\r\n get selectedOptionTitle() {\r\n if (this.value) {\r\n return this.#selectedOption.optionContentText;\r\n } else {\r\n return \"\";\r\n }\r\n }\r\n #placeholder = \"\";\r\n get placeholder() {\r\n return this.#placeholder;\r\n }\r\n set placeholder(value: string) {\r\n this.#placeholder = value;\r\n if (this.value !== null && this.value !== undefined) {\r\n this.elements.input.placeholder = \"\";\r\n } else {\r\n this.elements.input.placeholder = value;\r\n }\r\n }\r\n //on mobile device when search modal open this will appear on search box\r\n #searchPlaceholder = \"search\";\r\n get searchPlaceholder() {\r\n return this.#searchPlaceholder;\r\n }\r\n set searchPlaceholder(value) {\r\n this.#searchPlaceholder = value;\r\n }\r\n get isMobileDevice() {\r\n return isMobile();\r\n }\r\n get isOpen() {\r\n return this.elements.componentWrapper.classList.contains(\"--focused\");\r\n }\r\n // this value used by validation module to send to validation callbacks\r\n get #ValidationValue(): ValidationValue<TValue> {\r\n return {\r\n inputtedText: this.#textValue,\r\n selectedOption: this.#selectedOption,\r\n value: this.value\r\n };\r\n }\r\n #validation = new ValidationHelper<ValidationValue<TValue>>({\r\n clearValidationError: this.clearValidationError.bind(this),\r\n showValidationError: this.showValidationError.bind(this),\r\n getValue: () => this.#ValidationValue,\r\n getValidations: this.#getInsideValidation.bind(this),\r\n getValueString: () => this.#textValue,\r\n setValidationResult: this.#setValidationResult.bind(this)\r\n });\r\n get validation() {\r\n return this.#validation;\r\n }\r\n #disabled = false;\r\n get disabled() {\r\n return this.#disabled;\r\n }\r\n set disabled(value: boolean) {\r\n this.#disabled = value;\r\n this.elements.input.disabled = value;\r\n if (value) {\r\n (this.#internals as any).states?.add(\"disabled\");\r\n } else {\r\n (this.#internals as any).states?.delete(\"disabled\");\r\n }\r\n }\r\n #required = false;\r\n set required(value: boolean) {\r\n this.#required = value;\r\n this.#validation.checkValiditySync({ showError: false });\r\n }\r\n get required() {\r\n return this.#required;\r\n }\r\n #internals?: ElementInternals;\r\n /**\r\n * @description will determine if component trigger jb-validation mechanism automatically on user event or it just let user-developer handle validation mechanism by himself\r\n */\r\n get isAutoValidationDisabled(): boolean {\r\n //currently we only support disable-validation in attribute and only in initiate time but later we can add support for change of this \r\n return this.getAttribute('disable-auto-validation') === '' || this.getAttribute('disable-auto-validation') === 'true' ? true : false;\r\n }\r\n get name() {\r\n return this.getAttribute('name') || '';\r\n }\r\n initialValue: TValue | null = null;\r\n get isDirty(): boolean {\r\n return this.value !== this.initialValue;\r\n }\r\n constructor() {\r\n super();\r\n if (typeof this.attachInternals == \"function\") {\r\n //some browser dont support attachInternals\r\n this.#internals = this.attachInternals();\r\n }\r\n this.#initWebComponent();\r\n this.#initProp();\r\n }\r\n connectedCallback() {\r\n // standard web component event that called when all of dom is binded\r\n this.#callOnLoadEvent();\r\n this.#callOnInitEvent();\r\n }\r\n #callOnInitEvent() {\r\n const event = new CustomEvent(\"init\", { bubbles: true, composed: true });\r\n this.dispatchEvent(event);\r\n }\r\n #callOnLoadEvent() {\r\n const event = new CustomEvent(\"load\", { bubbles: true, composed: true });\r\n this.dispatchEvent(event);\r\n }\r\n #initWebComponent() {\r\n const shadowRoot = this.attachShadow({\r\n mode: \"open\",\r\n delegatesFocus: true,\r\n });\r\n const html = `<style>${CSS}</style>` + \"\\n\" + HTML;\r\n const element = document.createElement(\"template\");\r\n element.innerHTML = html;\r\n shadowRoot.appendChild(element.content.cloneNode(true));\r\n this.elements = {\r\n input: shadowRoot.querySelector(\".select-box input\")!,\r\n componentWrapper: shadowRoot.querySelector(\".jb-select-web-component\")!,\r\n selectedValueWrapper: shadowRoot.querySelector(\r\n \".selected-value-wrapper\"\r\n )!,\r\n messageBox: shadowRoot.querySelector(\".message-box\")!,\r\n optionList: shadowRoot.querySelector(\".select-list\")!,\r\n optionListWrapper: shadowRoot.querySelector(\".select-list-wrapper\")!,\r\n optionListSlot: shadowRoot.querySelector(\".select-list-wrapper .select-list slot\")!,\r\n arrowIcon: shadowRoot.querySelector(\".arrow-icon\")!,\r\n label: {\r\n wrapper: shadowRoot.querySelector(\"label\")!,\r\n text: shadowRoot.querySelector(\"label .label-value\")!,\r\n },\r\n emptyListPlaceholder: shadowRoot.querySelector(\".empty-list-placeholder\")!,\r\n };\r\n this.#registerEventListener();\r\n this.#updateListEmptyPlaceholder();\r\n }\r\n #registerEventListener() {\r\n this.elements.input.addEventListener(\"change\", (e: Event) => {\r\n this.#onInputChange(e);\r\n });\r\n this.elements.input.addEventListener(\"keypress\", this.#onInputKeyPress.bind(this));\r\n this.elements.input.addEventListener(\"keyup\", this.#onInputKeyup.bind(this));\r\n this.elements.input.addEventListener(\"beforeinput\", this.#onInputBeforeInput.bind(this));\r\n this.elements.input.addEventListener(\"input\", (e) => { this.#onInputInput(e as unknown as InputEvent); });\r\n this.elements.input.addEventListener(\"focus\", this.#onInputFocus.bind(this));\r\n this.elements.input.addEventListener(\"blur\", this.#onInputBlur.bind(this));\r\n this.elements.arrowIcon.addEventListener(\"click\", this.#onArrowKeyClick.bind(this));\r\n //events to work with options\r\n this.addEventListener(\"select\", this.#onOptionSelect.bind(this));\r\n this.addEventListener(\"jb-option-connected\", this.#onOptionConnected.bind(this));\r\n this.elements.optionListSlot.addEventListener(\"slotchange\",this.#onOptionSlotChange.bind(this));\r\n\r\n }\r\n\r\n #initProp() {\r\n this.textValue = \"\";\r\n this.value = this.getAttribute(\"value\") as TValue || null;\r\n }\r\n static get observedAttributes() {\r\n return [\r\n \"label\",\r\n \"message\",\r\n \"value\",\r\n \"required\",\r\n \"placeholder\",\r\n \"search-placeholder\",\r\n ];\r\n }\r\n attributeChangedCallback(name: string, oldValue: string, newValue: string) {\r\n // do something when an attribute has changed\r\n this.#onAttributeChange(name, newValue);\r\n }\r\n #onAttributeChange(name: string, value: string) {\r\n switch (name) {\r\n case \"label\":\r\n this.elements.label.text.innerHTML = value;\r\n if (value == null || value == undefined || value == \"\") {\r\n this.elements.label.wrapper.classList.add(\"--hide\");\r\n } else {\r\n this.elements.label.wrapper.classList.remove(\"--hide\");\r\n }\r\n break;\r\n case \"message\":\r\n this.elements.messageBox.innerHTML = value;\r\n break;\r\n case \"value\":\r\n this.#setValueFromOutside(value as TValue);\r\n break;\r\n case \"required\":\r\n if (value === \"\" || value == \"true\" || value == \"True\") {\r\n this.required = true;\r\n } else {\r\n this.required = false;\r\n }\r\n break;\r\n case \"placeholder\":\r\n this.placeholder = value;\r\n break;\r\n case \"search-placeholder\":\r\n this.searchPlaceholder = value;\r\n break;\r\n }\r\n }\r\n /**\r\n * will check option list and if select has no option it will show empty list placeholder\r\n */\r\n #updateListEmptyPlaceholder(){\r\n const isAnyOptionVisible = Array.from(this.#optionList).some(x=>x.hidden==false);\r\n if(isAnyOptionVisible){\r\n this.elements.emptyListPlaceholder.classList.remove(\"--show\");\r\n }else{\r\n this.elements.emptyListPlaceholder.classList.add(\"--show\");\r\n }\r\n }\r\n #onOptionSlotChange(e:Event){\r\n this.#setValueOnOptionListChanged();\r\n this.#updateListEmptyPlaceholder();\r\n }\r\n #setValueOnOptionListChanged() {\r\n //when option list changed we see if current value is valid for new optionlist we set it if not we reset value to null.\r\n //in some scenario value is setted before optionList attached so we store it on this.#notFoundedValue and after option list setted we set value from this.#notFoundedValue\r\n if (this.#notFoundedValue) {\r\n //if select has no prev value or pending not found value we don't set it because user may input some search terms in input box and developer-user update list base on that value\r\n //if we set it to null the search term and this.textValue will become null and empty too and it make impossible for user to search in dynamic back-end provided searchable list so we put this condition to prevent it\r\n const isSetted = this.#setValueFromOutside(this.#notFoundedValue);\r\n if (isSetted) {\r\n //after list update and when not founded value is found in new option list we clear old not founded value\r\n this.#notFoundedValue = null;\r\n }\r\n } else if (this.value) {\r\n this.#setValueFromOutside(this.value);\r\n }\r\n }\r\n //when user set value by attribute or value prop directly we call this function\r\n #setValueFromOutside(value: TValue): boolean {\r\n if(value === null || value === undefined){\r\n this.#setValue(null,null);\r\n return true;\r\n }\r\n let matchedOption:JBOptionWebComponent<TValue>| null = null; \r\n this.#optionList.forEach((option) => {\r\n // if we have value mapper we set selected value by object that match mapper\r\n if (option.value == value) {\r\n matchedOption = option;\r\n }\r\n });\r\n if (matchedOption) {\r\n this.#setValue(matchedOption.value,matchedOption);\r\n return true;\r\n } else {\r\n this.#notFoundedValue = value;\r\n return false;\r\n }\r\n }\r\n //null option mean deselect all\r\n #changeSelectedOption(option:JBOptionWebComponent<TValue>|null){\r\n this.#optionList.forEach((x)=>x.selected = false);\r\n if(option){\r\n option.selected = true;\r\n this.#selectedOption = option;\r\n }\r\n }\r\n #setValue(value: TValue,option:JBOptionWebComponent<TValue>|null) {\r\n this.#notFoundedValue = null;\r\n this.#value = value;\r\n if (value === null || value === undefined) {\r\n this.textValue = \"\";\r\n this.#setSelectedOptionDom(null);\r\n //will deselect all option\r\n this.#changeSelectedOption(null);\r\n this.elements.componentWrapper.classList.remove(\"--has-value\");\r\n //show placeholder when user empty data\r\n if (!(this.isMobileDevice && this.isOpen)) {\r\n this.elements.input.placeholder = this.placeholder;\r\n }\r\n } else {\r\n this.textValue = \"\";\r\n this.#changeSelectedOption(option);\r\n this.#setSelectedOptionDom(value);\r\n this.elements.componentWrapper.classList.add(\"--has-value\");\r\n //hide placeholder when user select data\r\n if (!(this.isMobileDevice && this.isOpen)) {\r\n this.elements.input.placeholder = \"\";\r\n }\r\n }\r\n //if user select an option we rest filter so user see all option again when open a select\r\n this.#updateOptionList(\"\");\r\n }\r\n #onArrowKeyClick() {\r\n if (this.isOpen) {\r\n this.blur();\r\n } else {\r\n this.focus();\r\n }\r\n }\r\n #onInputKeyPress(e: KeyboardEvent) {\r\n const eventOptions: KeyboardEventInit = {\r\n altKey: e.altKey,\r\n bubbles: e.bubbles,\r\n cancelable: e.cancelable,\r\n code: e.code,\r\n composed: e.composed,\r\n ctrlKey: e.ctrlKey,\r\n detail: e.detail,\r\n isComposing: e.isComposing,\r\n key: e.key,\r\n location: e.location,\r\n metaKey: e.metaKey,\r\n view: e.view,\r\n repeat: e.repeat,\r\n shiftKey: e.shiftKey\r\n };\r\n const event = new KeyboardEvent(\"keypress\", eventOptions);\r\n this.dispatchEvent(event);\r\n }\r\n #onInputBeforeInput(e: InputEvent) {\r\n // const inputtedText = e.data || \"\";\r\n //TODO: add cancelable event dispatch here\r\n }\r\n #onInputInput(e: InputEvent) {\r\n const inputtedText = (e.target as HTMLInputElement).value;\r\n this.textValue = inputtedText;\r\n this.#handleSelectedValueDisplay(inputtedText);\r\n this.#validation.checkValidity({ showError: false });\r\n this.#dispatchInputEvent(e);\r\n this.#updateListEmptyPlaceholder();\r\n }\r\n #dispatchInputEvent(e: InputEvent) {\r\n const event = new InputEvent(\"input\", {\r\n bubbles: e.bubbles,\r\n cancelable: e.cancelable,\r\n composed: e.composed,\r\n data: e.data,\r\n dataTransfer: e.dataTransfer,\r\n detail: e.detail,\r\n inputType: e.inputType,\r\n isComposing: e.isComposing,\r\n targetRanges: e.getTargetRanges(),\r\n view: e.view,\r\n });\r\n this.dispatchEvent(event);\r\n }\r\n #onInputKeyup(e: KeyboardEvent) {\r\n const inputText = (e.target as HTMLInputElement).value;\r\n //here is the rare time we update #value directly because we want trigger event that may read value directly from dom\r\n if (e.key === \"Backspace\" || e.key === \"Delete\") {\r\n //because on keypress dont receive backspace key press\r\n this.#handleSelectedValueDisplay(inputText);\r\n }\r\n\r\n this.#triggerOnInputKeyup(e);\r\n }\r\n #handleSelectedValueDisplay(inputValue: string) {\r\n if (inputValue !== \"\") {\r\n this.elements.selectedValueWrapper.classList.add(\"--search-typed\");\r\n } else {\r\n this.elements.selectedValueWrapper.classList.remove(\"--search-typed\");\r\n }\r\n }\r\n #triggerOnInputKeyup(e: KeyboardEvent) {\r\n const event = new KeyboardEvent(\"keyup\", {\r\n altKey: e.altKey,\r\n bubbles: e.bubbles,\r\n cancelable: e.cancelable,\r\n code: e.code,\r\n ctrlKey: e.ctrlKey,\r\n detail: e.detail,\r\n key: e.key,\r\n shiftKey: e.shiftKey,\r\n charCode: e.charCode,\r\n location: e.location,\r\n composed: e.composed,\r\n isComposing: e.isComposing,\r\n metaKey: e.metaKey,\r\n repeat: e.repeat,\r\n keyCode: e.keyCode,\r\n view: e.view,\r\n });\r\n this.dispatchEvent(event);\r\n }\r\n #onInputChange(e: Event) {\r\n const inputText = (e.target as HTMLInputElement).value;\r\n //here is the rare time we update _text_value directly because we want trigger event that may read value directly from dom\r\n this.#textValue = inputText;\r\n }\r\n #onInputFocus() {\r\n this.focus();\r\n }\r\n #onInputBlur(e: FocusEvent) {\r\n const focusedElement = <Node>e.relatedTarget;\r\n if (\r\n this.elements.optionListWrapper.contains(focusedElement) ||\r\n this.elements.arrowIcon.contains(focusedElement)\r\n ) {\r\n //user click on a menu item\r\n } else {\r\n this.blur();\r\n }\r\n }\r\n focus() {\r\n this.elements.input.focus();\r\n this.#showOptionList();\r\n this.elements.componentWrapper.classList.add(\"--focused\");\r\n if (this.isMobileDevice) {\r\n this.elements.input.placeholder = this.#searchPlaceholder;\r\n }\r\n }\r\n blur() {\r\n this.elements.componentWrapper.classList.remove(\"--focused\");\r\n this.textValue = \"\";\r\n this.#handleSelectedValueDisplay(\"\");\r\n this.#hideOptionList();\r\n this.#validation.checkValidity({ showError: true });\r\n if (this.isMobileDevice) {\r\n if (this.value) {\r\n this.elements.input.placeholder = \"\";\r\n } else {\r\n this.elements.input.placeholder = this.placeholder;\r\n }\r\n }\r\n this.elements.input.blur();\r\n }\r\n #showOptionList() {\r\n this.elements.optionListWrapper.classList.add(\"--show\");\r\n }\r\n #hideOptionList() {\r\n this.elements.optionListWrapper.classList.remove(\"--show\");\r\n }\r\n #updateOptionList(filterText: string) {\r\n const event = new CustomEvent(\"filter-change\", { detail: { filterText }, bubbles: false, cancelable: false, composed: false });\r\n this.dispatchEvent(event);\r\n }\r\n #onOptionSelect(e: CustomEvent) {\r\n const prevValue = this.#value;\r\n const prevOption = this.#selectedOption;\r\n //because jb-option may be in another shadow dom like jb-option-list we have to get first composed element as a target\r\n const target = (e.composedPath()[0] as JBOptionWebComponent<TValue>);\r\n if (target instanceof JBOptionWebComponent) {\r\n const value = target.value;\r\n this.#selectOption(value,target);\r\n this.blur();\r\n const dispatchedEvent = this.#dispatchOnChangeEvent();\r\n if (dispatchedEvent.defaultPrevented) {\r\n e.preventDefault();\r\n this.#selectOption(prevValue,prevOption);\r\n }\r\n }\r\n\r\n }\r\n //called when an jb-Option connected to the dom\r\n #onOptionConnected(e: CustomEvent) {\r\n e.stopPropagation();\r\n const target = (e.composedPath()[0] as JBOptionWebComponent<TValue>);\r\n target.addEventListener(\"jb-option-disconnected\",this.#onOptionDisconnected.bind(this),{once:true,passive:true});\r\n target.setSelectElement(this);\r\n this.#optionList.add(target);\r\n if(this.#notFoundedValue){\r\n this.#setValueOnOptionListChanged();\r\n }\r\n this.#updateListEmptyPlaceholder();\r\n }\r\n #onOptionDisconnected(e:CustomEvent){\r\n e.stopPropagation();\r\n const target = e.target as JBOptionWebComponent<TValue>;\r\n this.#optionList.delete(target);\r\n this.#updateListEmptyPlaceholder();\r\n if(target.value == this.#value){\r\n this.#setValueOnOptionListChanged();\r\n }\r\n }\r\n\r\n #selectOption(value: TValue, optionDom:JBOptionWebComponent<TValue>) {\r\n this.#setValue(value,optionDom);\r\n this.#checkValidity(true);\r\n }\r\n /**\r\n * @description show given string as a error in message place\r\n * @public\r\n */\r\n showValidationError(error: ShowValidationErrorInput | string) {\r\n const message = typeof error == \"string\" ? error : error.message;\r\n this.elements.messageBox.innerHTML = message;\r\n this.elements.messageBox.classList.add(\"--error\");\r\n }\r\n clearValidationError() {\r\n this.elements.messageBox.innerHTML = this.getAttribute(\"message\") || \"\";\r\n this.elements.messageBox.classList.remove(\"--error\");\r\n }\r\n #dispatchOnChangeEvent() {\r\n const event = new Event(\"change\", { bubbles: true, cancelable: true });\r\n this.dispatchEvent(event);\r\n return event;\r\n }\r\n #setSelectedOptionDom(value: TValue) {\r\n //when user select option or value changed in any condition we set selected option DOM\r\n this.elements.selectedValueWrapper.innerHTML = \"\";\r\n //if value was null or undefined it remain empty\r\n if (value !== null && value !== undefined) {\r\n const selectedOptionDom = this.#createSelectedValueDom(value);\r\n this.elements.selectedValueWrapper.appendChild(selectedOptionDom);\r\n }\r\n }\r\n #createSelectedValueDom(value: TValue) {\r\n if (typeof this.callbacks.getSelectedValueDOM == \"function\") {\r\n return this.callbacks.getSelectedValueDOM(value,this.#selectedOption);\r\n } else {\r\n return this.#createDefaultSelectedValueDom();\r\n }\r\n }\r\n #createDefaultSelectedValueDom() {\r\n //TODO: put some backup way for when we have value but no option provided\r\n let contentNodes:Node[] = [];\r\n if(this.#selectedOption){\r\n contentNodes = this.#selectedOption.optionContent;\r\n }\r\n const selectedOptionDom = document.createElement(\"div\");\r\n selectedOptionDom.classList.add(\"selected-value\");\r\n selectedOptionDom.append(...contentNodes.map(n=>n.cloneNode()));\r\n return selectedOptionDom;\r\n }\r\n #getInsideValidation() {\r\n const ValidationList: ValidationItem<ValidationValue<TValue>>[] = [];\r\n if (this.required) {\r\n const label = this.getAttribute(\"label\") || \"\";\r\n const message = `${label} حتما باید انتخاب شود`;\r\n ValidationList.push({\r\n validator: ({ value }) => {\r\n return value !== null && value !== undefined;\r\n },\r\n message: message,\r\n stateType: \"valueMissing\"\r\n });\r\n }\r\n return ValidationList;\r\n }\r\n //\r\n #checkValidity(showError: boolean) {\r\n if (!this.isAutoValidationDisabled) {\r\n return this.#validation.checkValidity({ showError });\r\n }\r\n }\r\n /**\r\n * @public\r\n * @description this method used to check for validity but doesn't show error to user and just return the result\r\n * this method used by #internal of component\r\n */\r\n checkValidity(): boolean {\r\n const validationResult = this.#validation.checkValiditySync({ showError: false });\r\n if (!validationResult.isAllValid) {\r\n const event = new CustomEvent('invalid');\r\n this.dispatchEvent(event);\r\n }\r\n return validationResult.isAllValid;\r\n }\r\n /**\r\n * @public\r\n * @description this method used to check for validity and show error to user\r\n */\r\n reportValidity(): boolean {\r\n const validationResult = this.#validation.checkValiditySync({ showError: true });\r\n if (!validationResult.isAllValid) {\r\n const event = new CustomEvent('invalid');\r\n this.dispatchEvent(event);\r\n }\r\n return validationResult.isAllValid;\r\n }\r\n /**\r\n * @description this method called on every checkValidity calls and update validation result of #internal\r\n */\r\n #setValidationResult(result: ValidationResult<ValidationValue<TValue>>) {\r\n if (result.isAllValid) {\r\n this.#internals?.setValidity({}, '');\r\n } else {\r\n const states: ValidityStateFlags = {};\r\n let message = \"\";\r\n result.validationList.forEach((res) => {\r\n if (!res.isValid) {\r\n if (res.validation.stateType) {\r\n states[res.validation.stateType] = true;\r\n } else {\r\n states[\"customError\"] = true;\r\n }\r\n if (message == '') { message = res.message; }\r\n\r\n }\r\n });\r\n this.#internals?.setValidity(states, message);\r\n }\r\n }\r\n get validationMessage() {\r\n return this.#internals?.validationMessage || this.#validation.resultSummary.message;\r\n }\r\n\r\n}\r\nconst myElementNotExists = !customElements.get(\"jb-select\");\r\nif (myElementNotExists) {\r\n //prevent duplicate registering\r\n window.customElements.define(\"jb-select\", JBSelectWebComponent);\r\n}\r\n","export const isMobile = ()=>{\r\n return /Mobi/i.test(window.navigator.userAgent);\r\n};"],"names":["JBOptionWebComponent","HTMLElement","value","__classPrivateFieldGet","this","_JBOptionWebComponent_value","__classPrivateFieldSet","selected","_JBOptionWebComponent_selected","_JBOptionWebComponent_elements","componentWrapper","classList","add","remove","optionContent","contentWrapper","querySelector","assignedNodes","hidden","_JBOptionWebComponent_hidden","optionContentText","reduce","acc","item","textContent","constructor","super","set","_JBOptionWebComponent_SelectElement","_JBOptionWebComponent_instances","_JBOptionWebComponent_initWebComponent","call","_JBOptionWebComponent_initProp","connectedCallback","_JBOptionWebComponent_dispatchPlaceEvent","setSelectElement","element","addEventListener","_JBOptionWebComponent_onFilterChange","bind","disconnectedCallback","removeEventListener","event","CustomEvent","bubbles","composed","cancelable","dispatchEvent","observedAttributes","attributeChangedCallback","name","oldValue","newValue","e","filterText","detail","includes","shadowRoot","attachShadow","mode","document","createElement","innerHTML","appendChild","content","cloneNode","_JBOptionWebComponent_registerEventListener","getAttribute","_JBOptionWebComponent_onAttributeChange","_JBOptionWebComponent_onOptionClick","_JBOptionWebComponent_dispatchSelectEvent","customElements","get","window","define","JBOptionListWebComponent","callbacks","_JBOptionListWebComponent_callbacks","optionList","_JBOptionListWebComponent_optionList","Array","isArray","_JBOptionListWebComponent_instances","_JBOptionListWebComponent_initOptionList","console","error","_JBOptionListWebComponent_optionPairMap","Map","_JBOptionListWebComponent_initWebComponent","setCallback","key","callbackFn","_JBOptionListWebComponent_updateOptionsContent","_JBOptionListWebComponent_updateOptionsValue","forEach","dom","option","_JBOptionListWebComponent_getOptionValue","_JBOptionListWebComponent_createOptionDOM","getValue","getTitle","String","_JBOptionListWebComponent_fillOptionContent","getContentDOM","_JBOptionListWebComponent_getOptionTitle","optionElement","JBSelectWebComponent","formAssociated","_JBSelectWebComponent_value","_JBSelectWebComponent_instances","_JBSelectWebComponent_setValueFromOutside","textValue","_JBSelectWebComponent_textValue","elements","input","_JBSelectWebComponent_updateOptionList","selectedOptionTitle","_JBSelectWebComponent_selectedOption","placeholder","_JBSelectWebComponent_placeholder","undefined","searchPlaceholder","_JBSelectWebComponent_searchPlaceholder","isMobileDevice","test","navigator","userAgent","isOpen","contains","validation","_JBSelectWebComponent_validation","disabled","_JBSelectWebComponent_disabled","states","delete","required","_JBSelectWebComponent_required","checkValiditySync","showError","isAutoValidationDisabled","isDirty","initialValue","_JBSelectWebComponent_notFoundedValue","_JBSelectWebComponent_optionList","Set","ValidationHelper","clearValidationError","showValidationError","_JBSelectWebComponent_ValidationValue_get","getValidations","_JBSelectWebComponent_getInsideValidation","getValueString","setValidationResult","_JBSelectWebComponent_setValidationResult","_JBSelectWebComponent_internals","attachInternals","_JBSelectWebComponent_initWebComponent","_JBSelectWebComponent_initProp","_JBSelectWebComponent_callOnLoadEvent","_JBSelectWebComponent_callOnInitEvent","focus","_JBSelectWebComponent_showOptionList","blur","_JBSelectWebComponent_handleSelectedValueDisplay","_JBSelectWebComponent_hideOptionList","checkValidity","message","messageBox","validationResult","isAllValid","reportValidity","validationMessage","resultSummary","inputtedText","selectedOption","delegatesFocus","selectedValueWrapper","optionListWrapper","optionListSlot","arrowIcon","label","wrapper","text","emptyListPlaceholder","_JBSelectWebComponent_registerEventListener","_JBSelectWebComponent_updateListEmptyPlaceholder","_JBSelectWebComponent_onInputChange","_JBSelectWebComponent_onInputInput","_JBSelectWebComponent_onOptionSelect","_JBSelectWebComponent_onOptionConnected","_JBSelectWebComponent_onAttributeChange","from","some","x","_JBSelectWebComponent_setValueOnOptionListChanged","matchedOption","_JBSelectWebComponent_setValue","_JBSelectWebComponent_setSelectedOptionDom","_JBSelectWebComponent_changeSelectedOption","_JBSelectWebComponent_onArrowKeyClick","eventOptions","altKey","code","ctrlKey","isComposing","location","metaKey","view","repeat","shiftKey","KeyboardEvent","target","_JBSelectWebComponent_dispatchInputEvent","InputEvent","data","dataTransfer","inputType","targetRanges","getTargetRanges","inputText","_JBSelectWebComponent_triggerOnInputKeyup","inputValue","charCode","keyCode","_JBSelectWebComponent_onInputFocus","focusedElement","relatedTarget","prevValue","prevOption","composedPath","defaultPrevented","preventDefault","stopPropagation","_JBSelectWebComponent_onOptionDisconnected","once","passive","_JBSelectWebComponent_selectOption","optionDom","_JBSelectWebComponent_checkValidity","_JBSelectWebComponent_dispatchOnChangeEvent","Event","selectedOptionDom","_JBSelectWebComponent_createSelectedValueDom","getSelectedValueDOM","_JBSelectWebComponent_createDefaultSelectedValueDom","contentNodes","append","map","n","ValidationList","push","validator","stateType","result","setValidity","validationList","res","isValid"],"mappings":"kxBAMM,MAAOA,UAAqCC,YAMhD,SAAIC,GACF,OAAOC,EAAAC,KAAIC,EAAA,IACZ,CACD,SAAIH,CAAMA,GACRI,EAAAF,KAAIC,EAAUH,EAAK,IACpB,CAED,YAAIK,CAASL,GACXI,EAAAF,KAAII,EAAaN,EAAK,KACnBA,EACDC,EAAAC,KAAcK,EAAA,KAACC,iBAAiBC,UAAUC,IAAI,cAE9CT,EAAAC,KAAcK,EAAA,KAACC,iBAAiBC,UAAUE,OAAO,aAEpD,CACD,YAAIN,GACF,OAAOJ,EAAAC,KAAII,EAAA,IACZ,CACD,iBAAIM,GAEF,OADoBX,EAAAC,YAAeW,eAAeC,cAAc,QAAQC,eAEzE,CAGD,UAAIC,GACF,OAAOf,EAAAC,KAAIe,EAAA,IACZ,CACD,UAAID,CAAOhB,GACTI,EAAAF,KAAIe,EAAWjB,EAAK,KACjBA,EACDC,EAAAC,KAAcK,EAAA,KAACC,iBAAiBC,UAAUC,IAAI,YAE9CT,EAAAC,KAAcK,EAAA,KAACC,iBAAiBC,UAAUE,OAAO,WAEpD,CAID,qBAAIO,GAKF,OAJ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