@webority/ui-elements 0.7.2 → 0.7.3
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/ui-elements.global.js +15 -15
- package/dist/ui-elements.js +130 -29
- package/package.json +1 -1
|
@@ -43,7 +43,7 @@ var WeborityUiElements=(function(e){Object.defineProperty(e,Symbol.toStringTag,{
|
|
|
43
43
|
<path d="M108.216 75.5971C107.507 74.8585 106.532 74.4448 105.527 74.4448H68.1816C67.177 74.4448 66.1725 74.8585 65.4929 75.5971C64.8134 76.3357 64.4293 77.3403 64.4884 78.3744L66.3202 108.688C66.6452 113.179 67.0588 118.793 77.3702 118.793H96.3384C106.65 118.793 107.063 113.208 107.388 108.688L109.22 78.4039C109.279 77.3403 108.895 76.3357 108.216 75.5971ZM91.7588 103.99H81.9202C80.7088 103.99 79.7043 102.986 79.7043 101.774C79.7043 100.563 80.7088 99.5585 81.9202 99.5585H91.7588C92.9702 99.5585 93.9747 100.563 93.9747 101.774C93.9747 102.986 92.9702 103.99 91.7588 103.99ZM94.2406 92.1721H79.4679C78.2566 92.1721 77.252 91.1676 77.252 89.9562C77.252 88.7448 78.2566 87.7403 79.4679 87.7403H94.2406C95.452 87.7403 96.4566 88.7448 96.4566 89.9562C96.4566 91.1676 95.452 92.1721 94.2406 92.1721Z" fill="white"/>
|
|
44
44
|
</g>
|
|
45
45
|
</g>
|
|
46
|
-
<defs><clipPath id="wui_delete_clip0"><rect x="32" y="32" width="110" height="110" rx="55" fill="white"/></clipPath><clipPath id="wui_delete_clip1"><rect width="65" height="65" fill="white" transform="translate(54.3535 54.502)"/></clipPath></defs>`},a=Object.keys(i),o=class extends HTMLElement{static get observedAttributes(){return[`tone`,`size`]}connectedCallback(){this.render()}attributeChangedCallback(){this.isConnected&&this.render()}render(){let e=this.getAttribute(`tone`),t=this.getAttribute(`size`)
|
|
46
|
+
<defs><clipPath id="wui_delete_clip0"><rect x="32" y="32" width="110" height="110" rx="55" fill="white"/></clipPath><clipPath id="wui_delete_clip1"><rect width="65" height="65" fill="white" transform="translate(54.3535 54.502)"/></clipPath></defs>`},a=Object.keys(i),o=class extends HTMLElement{static get observedAttributes(){return[`tone`,`size`]}connectedCallback(){this.render()}attributeChangedCallback(){this.isConnected&&this.render()}render(){let e=this.getAttribute(`tone`),t=Number.parseInt(this.getAttribute(`size`),10)||72,n=i[e]||i.info;this.innerHTML=`<svg width="${t}" height="${t}" viewBox="0 0 174 174" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">${n}</svg>`}},s=4;function c(e,t,n={}){if(!e||!t)return;let r=e.getBoundingClientRect(),i=t.offsetHeight,a=window.innerHeight-r.bottom,o=a<i+s&&r.top>a;t.classList.toggle(`drop-up`,o),t.style.position=`fixed`,t.style.top=o?`${Math.max(s,r.top-i-s)}px`:`${r.bottom+s}px`,n.matchWidth&&(t.style.width=`${r.width}px`);let c=t.offsetWidth,l=Math.min(r.left,window.innerWidth-c-s);t.style.left=`${Math.max(s,l)}px`}function l(e,t){u(e),e._reanchor=t,window.addEventListener(`resize`,e._reanchor),window.addEventListener(`scroll`,e._reanchor,!0)}function u(e){e?._reanchor&&(window.removeEventListener(`resize`,e._reanchor),window.removeEventListener(`scroll`,e._reanchor,!0),e._reanchor=null)}var d=`data-wui-mirror`;function f(e,t){let n=e.getAttribute(`name`),r=e.querySelector(`:scope > input[${d}]`);if(!n){r?.remove();return}r||(r=document.createElement(`input`),r.type=`hidden`,r.setAttribute(d,``),e.appendChild(r)),r.name=n,r.value=t==null?``:String(t);for(let t of e.attributes)t.name.startsWith(`data-val`)&&r.setAttribute(t.name,t.value);r.disabled=e.hasAttribute(`disabled`)}var p=Symbol(`wui.trustedHtml`),m=e=>String(e??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),h=e=>{if(!e)return``;let t=String(e).toLowerCase().replace(/[^a-z0-9-]/g,``);return t?`<i class="bi bi-${t}" aria-hidden="true"></i>`:``},g=e=>{if(e==null)return``;let t=e[p]?String(e.label??``):m(e.label),n=h(e.icon);return n?`<span class="wui-opt-label">${n}${t}</span>`:t},_=class extends HTMLElement{static formAssociated=!0;_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||`Select`}static get observedAttributes(){return[`value`,`placeholder`,`disabled`,`min-chars`,`debounce`,`remote`,`size`,`aria-label`,`allow-custom`]}constructor(){super(),this._value=``,this._label=``,this._optionsProp=null,this._loading=!1,this._active=-1,this._timer=null;try{this._internals=this.attachInternals()}catch{this._internals=null}}connectedCallback(){this._rendered||(this._defaultCaptured||=(this._defaultValue=this._value,!0),this.render())}formResetCallback(){this.value=this._defaultValue||``}attributeChangedCallback(e,t,n){if(e===`value`){this.value=n;return}this._rendered&&this.render()}get value(){return this._value}set value(e){this._value=e==null?``:String(e),f(this,this._value);let t=this._readOptions().find(e=>String(e.value)===this._value);this._label=t?y(t.label):``,this._syncInput(),this._renderOptions(``)}set options(e){this._optionsProp=Array.isArray(e)?e:[];let t=this._readOptions().find(e=>String(e.value)===this._value);t&&(this._label=y(t.label)),this._renderOptions(),this._syncInput()}get options(){return this._readOptions()}set loading(e){this._loading=!!e,this._renderLoading(),this._renderOptions()}get loading(){return this._loading}get _remote(){return this.hasAttribute(`remote`)}get _allowCustom(){return this.hasAttribute(`allow-custom`)}_matchesKnownOption(e){let t=e.toLowerCase();return this._readOptions().some(e=>y(e.label).toLowerCase()===t||String(e.value??``).toLowerCase()===t)}get _minChars(){return Math.max(0,Number(this.getAttribute(`min-chars`))||+!!this._remote)}get _debounceMs(){let e=this.getAttribute(`debounce`);if(e==null||e===``)return 250;let t=Number(e);return Number.isFinite(t)&&t>=0?t:250}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>({value:e.getAttribute(`value`)??e.textContent.trim(),label:e.innerHTML,icon:e.getAttribute(`icon`)||void 0,[p]:!0,selected:e.hasAttribute(`selected`)})))}_readOptions(){return this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}render(){this._snapshotDeclared();let e=this.getAttribute(`placeholder`)||`Search…`,t=this.getAttribute(`size`),n=t===`sm`?` search-select-sm`:t===`lg`?` search-select-lg`:``;this.innerHTML=`
|
|
47
47
|
<div class="search-select${n}">
|
|
48
48
|
<div class="input search-select-control search-select-ac" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-label="${v(this._accessibleName())}">
|
|
49
49
|
<input class="search-select-input search-select-ac-input" placeholder="${v(e)}" aria-autocomplete="list" autocomplete="off"${this.hasAttribute(`disabled`)?` disabled`:``} />
|
|
@@ -55,10 +55,10 @@ var WeborityUiElements=(function(e){Object.defineProperty(e,Symbol.toStringTag,{
|
|
|
55
55
|
<div class="search-select-empty" hidden>No matches</div>
|
|
56
56
|
<div class="search-select-hint" hidden>Type to search…</div>
|
|
57
57
|
</div>
|
|
58
|
-
</div>`,this._rendered=!0,f(this,this._value),this._wire(),this._syncInput(),this._renderOptions()}_refs(){return{control:this.querySelector(`.search-select-control`),input:this.querySelector(`.search-select-ac-input`),menu:this.querySelector(`.search-select-menu`),spinner:this.querySelector(`.search-select-spinner`),clear:this.querySelector(`.search-select-clear`),optionsWrap:this.querySelector(`.search-select-options`),empty:this.querySelector(`.search-select-empty`),hint:this.querySelector(`.search-select-hint`)}}_optionEls(){return[...this.querySelectorAll(`.search-select-option`)]}_syncInput(){let{input:e,clear:t}=this._refs();e&&document.activeElement!==e&&(e.value=this._label),t&&(t.hidden=!this._value&&!e?.value)}_renderLoading(){let{spinner:e}=this._refs();e&&(e.hidden=!this._loading)}_renderOptions(e){let t=this._refs();if(!t.optionsWrap)return;let n=e??(t.input?t.input.value:``),r=n.trim().toLowerCase(),i=this._readOptions();!this._remote&&r&&(i=i.filter(e=>y(e.label).toLowerCase().includes(r)));let a=n.trim(),o=this._allowCustom&&a&&!this._matchesKnownOption(a)?[...i,{value:a,custom:!0}]:i;t.optionsWrap.innerHTML=o.map(e=>{if(e.custom){let t=`Add “${m(e.value)}”`;return`<button type="button" role="option" class="search-select-option search-select-option-custom" data-value="${v(e.value)}" data-custom="true" aria-selected="false">${t}</button>`}let t=String(e.value)===String(this._value);return`<button type="button" role="option" class="search-select-option${t?` selected`:``}" data-value="${v(e.value)}" aria-selected="${t}">${g(e)}</button>`}).join(``),this._active=-1;let s=r.length<this._minChars;t.hint&&(t.hint.hidden=!(this._remote&&s&&!i.length)),t.empty&&(t.empty.hidden=this._loading||o.length>0||this._remote&&s)}_wire(){let e=this._refs();if(!e.control||!e.input)return;let t=()=>c(e.control,e.menu,{matchWidth:!0}),n=()=>this._optionEls().filter(e=>!e.hidden),r=e=>{let t=n();this._active=e;for(let e of this._optionEls())e.classList.remove(`is-active`);e>=0&&t[e]&&(t[e].classList.add(`is-active`),t[e].scrollIntoView({block:`nearest`}))},i=()=>!e.menu.hidden,a=()=>{e.menu.hidden=!1,e.control.setAttribute(`aria-expanded`,`true`),e.control.classList.add(`open`),t(),this._renderOptions()},o=()=>{e.menu.hidden=!0,e.control.setAttribute(`aria-expanded`,`false`),e.control.classList.remove(`open`),r(-1),this._syncInput()},s=t=>{let n=t.dataset.custom===`true`;this._value=t.dataset.value,this._label=n?t.dataset.value:y(t.innerHTML),f(this,this._value),e.input.value=this._label,this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{isCustom:n}})),o(),e.input.focus()},u=t=>{this._value=t,this._label=t,f(this,t),e.input.value=t,this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{isCustom:!0}})),o()};e.input.addEventListener(`focus`,()=>a()),e.input.addEventListener(`input`,()=>{let t=e.input.value;if(e.clear&&(e.clear.hidden=!t),i()||a(),this._remote){if(this._renderOptions(t),t.trim().length<this._minChars)return;clearTimeout(this._timer),this._timer=setTimeout(()=>{this.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:t}}))},this._debounceMs)}else this._renderOptions(t)}),e.input.addEventListener(`keydown`,t=>{let c=n();if(t.key===`ArrowDown`)t.preventDefault(),i()||a(),r(Math.min(this._active+1,c.length-1));else if(t.key===`ArrowUp`)t.preventDefault(),r(Math.max(this._active-1,0));else if(t.key===`Enter`){if(c[this._active])t.preventDefault(),s(c[this._active]);else if(this._allowCustom){let n=e.input.value.trim();n&&!this._matchesKnownOption(n)&&(t.preventDefault(),u(n))}}else t.key===`Escape`&&o()}),e.input.addEventListener(`blur`,t=>{if(!this._allowCustom||t.relatedTarget&&this.contains(t.relatedTarget))return;let n=e.input.value.trim();!n||n===this._label||this._matchesKnownOption(n)||u(n)}),e.optionsWrap.addEventListener(`click`,e=>{let t=e.target.closest(`.search-select-option`);t&&s(t)}),e.optionsWrap.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.search-select-option`);t&&r(this._optionEls().indexOf(t))}),e.optionsWrap.addEventListener(`mouseleave`,()=>r(-1)),e.clear?.addEventListener(`click`,()=>{this._value=``,this._label=``,f(this,``),e.input.value=``,e.clear.hidden=!0,this._renderOptions(``),this.dispatchEvent(new Event(`change`,{bubbles:!0})),e.input.focus()}),this._onDocClick=e=>{i()&&!this.contains(e.target)&&o()},document.addEventListener(`click`,this._onDocClick),l(this,()=>{i()&&t()})}disconnectedCallback(){this._onDocClick&&document.removeEventListener(`click`,this._onDocClick),u(this),clearTimeout(this._timer)}},v=e=>String(e??``).replace(/"/g,`"`).replace(/</g,`<`),y=e=>String(e??``).replace(/<[^>]*>/g,``),ee=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],te=[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],ne=e=>String(e).padStart(2,`0`),re=(e,t,n)=>`${e}-${ne(t+1)}-${ne(n)}`,b=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e||``);return t?{y:+t[1],m:t[2]-1,d:+t[3]}:null},ie=e=>{let t=b(e);return t?`${ne(t.d)} ${ee[t.m].slice(0,3)} ${t.y}`:``},ae=(e,t)=>new Date(e,t+1,0).getDate(),x=(e,t)=>{for(;t<0;)t+=12,--e;for(;t>11;)t-=12,e+=1;return{y:e,m:t}},oe=class extends HTMLElement{static get observedAttributes(){return[`value`,`min`,`max`,`placeholder`,`disabled`,`first-day`,`size`]}constructor(){super()
|
|
58
|
+
</div>`,this._rendered=!0,f(this,this._value),this._wire(),this._syncInput(),this._renderOptions()}_refs(){return{control:this.querySelector(`.search-select-control`),input:this.querySelector(`.search-select-ac-input`),menu:this.querySelector(`.search-select-menu`),spinner:this.querySelector(`.search-select-spinner`),clear:this.querySelector(`.search-select-clear`),optionsWrap:this.querySelector(`.search-select-options`),empty:this.querySelector(`.search-select-empty`),hint:this.querySelector(`.search-select-hint`)}}_optionEls(){return[...this.querySelectorAll(`.search-select-option`)]}_syncInput(){let{input:e,clear:t}=this._refs();e&&document.activeElement!==e&&(e.value=this._label),t&&(t.hidden=!this._value&&!e?.value)}_renderLoading(){let{spinner:e}=this._refs();e&&(e.hidden=!this._loading)}_renderOptions(e){let t=this._refs();if(!t.optionsWrap)return;let n=e??(t.input?t.input.value:``),r=n.trim().toLowerCase(),i=this._readOptions();!this._remote&&r&&(i=i.filter(e=>y(e.label).toLowerCase().includes(r)));let a=n.trim(),o=this._allowCustom&&a&&!this._matchesKnownOption(a)?[...i,{value:a,custom:!0}]:i;t.optionsWrap.innerHTML=o.map(e=>{if(e.custom){let t=`Add “${m(e.value)}”`;return`<button type="button" role="option" class="search-select-option search-select-option-custom" data-value="${v(e.value)}" data-custom="true" aria-selected="false">${t}</button>`}let t=String(e.value)===String(this._value);return`<button type="button" role="option" class="search-select-option${t?` selected`:``}" data-value="${v(e.value)}" aria-selected="${t}">${g(e)}</button>`}).join(``),this._active=-1;let s=r.length<this._minChars;t.hint&&(t.hint.hidden=!(this._remote&&s&&!i.length)),t.empty&&(t.empty.hidden=this._loading||o.length>0||this._remote&&s)}_wire(){let e=this._refs();if(!e.control||!e.input)return;let t=()=>c(e.control,e.menu,{matchWidth:!0}),n=()=>this._optionEls().filter(e=>!e.hidden),r=e=>{let t=n();this._active=e;for(let e of this._optionEls())e.classList.remove(`is-active`);e>=0&&t[e]&&(t[e].classList.add(`is-active`),t[e].scrollIntoView({block:`nearest`}))},i=()=>!e.menu.hidden,a=()=>{e.menu.hidden=!1,e.control.setAttribute(`aria-expanded`,`true`),e.control.classList.add(`open`),t(),this._renderOptions()},o=()=>{e.menu.hidden=!0,e.control.setAttribute(`aria-expanded`,`false`),e.control.classList.remove(`open`),r(-1),this._syncInput()},s=t=>{let n=t.dataset.custom===`true`;this._value=t.dataset.value,this._label=n?t.dataset.value:y(t.innerHTML),f(this,this._value),e.input.value=this._label,this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{isCustom:n}})),o(),e.input.focus()},u=t=>{this._value=t,this._label=t,f(this,t),e.input.value=t,this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{isCustom:!0}})),o()};e.input.addEventListener(`focus`,()=>a()),e.input.addEventListener(`input`,()=>{let t=e.input.value;if(e.clear&&(e.clear.hidden=!t),i()||a(),this._remote){if(this._renderOptions(t),t.trim().length<this._minChars)return;clearTimeout(this._timer),this._timer=setTimeout(()=>{this.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:t}}))},this._debounceMs)}else this._renderOptions(t)}),e.input.addEventListener(`keydown`,t=>{let c=n();if(t.key===`ArrowDown`)t.preventDefault(),i()||a(),r(Math.min(this._active+1,c.length-1));else if(t.key===`ArrowUp`)t.preventDefault(),r(Math.max(this._active-1,0));else if(t.key===`Enter`){if(c[this._active])t.preventDefault(),s(c[this._active]);else if(this._allowCustom){let n=e.input.value.trim();n&&!this._matchesKnownOption(n)&&(t.preventDefault(),u(n))}}else t.key===`Escape`&&o()}),e.input.addEventListener(`blur`,t=>{if(!this._allowCustom||t.relatedTarget&&this.contains(t.relatedTarget))return;let n=e.input.value.trim();!n||n===this._label||this._matchesKnownOption(n)||u(n)}),e.optionsWrap.addEventListener(`click`,e=>{let t=e.target.closest(`.search-select-option`);t&&s(t)}),e.optionsWrap.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.search-select-option`);t&&r(this._optionEls().indexOf(t))}),e.optionsWrap.addEventListener(`mouseleave`,()=>r(-1)),e.clear?.addEventListener(`click`,()=>{this._value=``,this._label=``,f(this,``),e.input.value=``,e.clear.hidden=!0,this._renderOptions(``),this.dispatchEvent(new Event(`change`,{bubbles:!0})),e.input.focus()}),this._onDocClick=e=>{i()&&!this.contains(e.target)&&o()},document.addEventListener(`click`,this._onDocClick),l(this,()=>{i()&&t()})}disconnectedCallback(){this._onDocClick&&document.removeEventListener(`click`,this._onDocClick),u(this),clearTimeout(this._timer)}},v=e=>String(e??``).replace(/"/g,`"`).replace(/</g,`<`),y=e=>String(e??``).replace(/<[^>]*>/g,``),ee=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],te=[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],ne=e=>String(e).padStart(2,`0`),re=(e,t,n)=>`${e}-${ne(t+1)}-${ne(n)}`,b=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e||``);return t?{y:+t[1],m:t[2]-1,d:+t[3]}:null},ie=e=>{let t=b(e);return t?`${ne(t.d)} ${ee[t.m].slice(0,3)} ${t.y}`:``},ae=(e,t)=>new Date(e,t+1,0).getDate(),x=(e,t)=>{for(;t<0;)t+=12,--e;for(;t>11;)t-=12,e+=1;return{y:e,m:t}},oe=class extends HTMLElement{static formAssociated=!0;static get observedAttributes(){return[`value`,`min`,`max`,`placeholder`,`disabled`,`first-day`,`size`,`aria-label`,`aria-describedby`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``;let e=new Date(2e3,0,1);this._viewY=e.getFullYear(),this._viewM=e.getMonth(),this._mode=`days`,this._focus=null,this._slide=``}connectedCallback(){this._rendered||this.render()}attributeChangedCallback(e,t,n){this._rendered&&(e===`value`?(this._value=n||``,this._syncTrigger()):e===`first-day`?this.querySelector(`.datepicker-pop`)?.hidden||this._renderView():this.render())}formResetCallback(){this.value=this._defaultValue||``}get value(){return this._value}set value(e){this._value=e||``,f(this,this._value),this._syncTrigger(),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}_firstDay(){let e=Number.parseInt(this.getAttribute(`first-day`)??``,10);return Number.isInteger(e)&&e>=0&&e<=6?e:0}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``),this._value=this.getAttribute(`value`)||this._value;let e=this.getAttribute(`placeholder`)||`Enter Date`,t=b(this._value);t&&(this._viewY=t.y,this._viewM=t.m);let n=this.getAttribute(`size`),r=n===`sm`?` input-sm`:n===`lg`?` input-lg`:``,i=this.getAttribute(`aria-label`),a=this.getAttribute(`aria-describedby`);this.innerHTML=`
|
|
59
59
|
<div class="datepicker">
|
|
60
|
-
<button type="button" class="input datepicker-trigger${r}${t?` has-value`:``}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute(`disabled`)?` disabled`:``}>
|
|
61
|
-
<span data-trigger-label class="${t?``:`search-select-placeholder`}">${t?ie(this._value):e}</span>
|
|
60
|
+
<button type="button" class="input datepicker-trigger${r}${t?` has-value`:``}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute(`disabled`)?` disabled`:``}${i?` aria-label="${m(i)}"`:``}${a?` aria-describedby="${m(a)}"`:``}>
|
|
61
|
+
<span data-trigger-label class="${t?``:`search-select-placeholder`}">${t?ie(this._value):m(e)}</span>
|
|
62
62
|
<i class="bi bi-calendar3" aria-hidden="true"></i>
|
|
63
63
|
</button>
|
|
64
64
|
<div class="datepicker-pop" role="dialog" aria-modal="false" hidden></div>
|
|
@@ -85,14 +85,14 @@ var WeborityUiElements=(function(e){Object.defineProperty(e,Symbol.toStringTag,{
|
|
|
85
85
|
<span class="datepicker-month">${r+1} – ${r+10}</span>
|
|
86
86
|
<button type="button" class="datepicker-nav-btn" data-nav-decade="1" aria-label="Next decade"><i class="bi bi-chevron-right" aria-hidden="true"></i></button>
|
|
87
87
|
</div>
|
|
88
|
-
<div class="datepicker-cells">${i}</div>`}_focusActive(){let e=this.querySelector(`.datepicker-pop`),t=e?.querySelector(`[tabindex="0"]`)||e?.querySelector(`.is-selected`)||e?.querySelector(`.datepicker-day:not(:disabled), .datepicker-cell:not(:disabled)`);t&&e.contains(document.activeElement)&&t.focus()}_position(e,t){c(e,t)}_setFocus(e,t,n,r){let{y:i,m:a}=x(e,t);this._focus={y:i,m:a,d:n};let o=i!==this._viewY||a!==this._viewM;this._viewY=i,this._viewM=a,this._slide=o&&r||``,this._renderView(),this._slide=``,this.querySelector(`.datepicker-day[data-iso="${re(i,a,n)}"]`)?.focus()}_onKey(e){if(this._mode!==`days`){e.key===`Escape`&&this._close();return}let t=this._focus||b(this._value)||{y:this._viewY,m:this._viewM,d:1},n=(n,r)=>{e.preventDefault();let i=new Date(t.y,t.m,t.d+n);this._setFocus(i.getFullYear(),i.getMonth(),i.getDate(),r)};switch(e.key){case`ArrowLeft`:return n(-1,`slide-prev`);case`ArrowRight`:return n(1,`slide-next`);case`ArrowUp`:return n(-7,`slide-prev`);case`ArrowDown`:return n(7,`slide-next`);case`Home`:return n(-((new Date(t.y,t.m,t.d).getDay()-this._firstDay()+7)%7),`slide-prev`);case`End`:return n(6-(new Date(t.y,t.m,t.d).getDay()-this._firstDay()+7)%7,`slide-next`);case`PageUp`:{e.preventDefault();let n=x(t.y,t.m-(e.shiftKey?12:1));return this._setFocus(n.y,n.m,Math.min(t.d,ae(n.y,n.m)),`slide-prev`)}case`PageDown`:{e.preventDefault();let n=x(t.y,t.m+(e.shiftKey?12:1));return this._setFocus(n.y,n.m,Math.min(t.d,ae(n.y,n.m)),`slide-next`)}case`Enter`:case` `:e.preventDefault(),this._limits().dayDisabled(t.y,t.m,t.d)||(this.value=re(t.y,t.m,t.d),this._close());return;case`Escape`:return this._close();default:}}_wire(){let e=this.querySelector(`.datepicker-trigger`),t=this.querySelector(`.datepicker-pop`),n=this.querySelector(`.datepicker`);if(!e||!t)return;let r=()=>!t.hidden;this._open=()=>{if(!b(this._value)&&!this._viewNavigated){let e=new Date;this._viewY=e.getFullYear(),this._viewM=e.getMonth()}let r=b(this._value),i=new Date;this._mode=`days`,this._focus=r||{y:this._viewY,m:this._viewM,d:i.getFullYear()===this._viewY&&i.getMonth()===this._viewM?i.getDate():1},this._renderView(),t.hidden=!1,n?.classList.add(`open`),this._position(e,t),e.setAttribute(`aria-expanded`,`true`),t.querySelector(`[tabindex="0"]`)?.focus()},this._close=()=>{t.hidden=!0,n?.classList.remove(`open`),e.setAttribute(`aria-expanded`,`false`),e.focus()},e.addEventListener(`click`,()=>r()?this._close():this._open()),t.addEventListener(`click`,e=>{this._popClick=!0;let t=e.target.closest(`[data-nav]`);if(t){this._viewNavigated=!0,this._slide=Number(t.dataset.nav)<0?`slide-prev`:`slide-next`;let e=x(this._viewY,this._viewM+Number(t.dataset.nav));this._viewY=e.y,this._viewM=e.m,this._focus={y:e.y,m:e.m,d:1},this._renderView(),this._slide=``;return}let n=e.target.closest(`[data-nav-year]`);if(n){this._viewY+=Number(n.dataset.navYear),this._renderView();return}let r=e.target.closest(`[data-nav-decade]`);if(r){this._viewY+=Number(r.dataset.navDecade)*10,this._renderView();return}let i=e.target.closest(`[data-view]`);if(i){this._mode=i.dataset.view,this._renderView();return}let a=e.target.closest(`[data-month]`);if(a&&!a.disabled){this._viewNavigated=!0,this._viewM=Number(a.dataset.month),this._mode=`days`,this._focus={y:this._viewY,m:this._viewM,d:1},this._renderView();return}let o=e.target.closest(`[data-year]`);if(o&&!o.disabled){this._viewNavigated=!0,this._viewY=Number(o.dataset.year),this._mode=`months`,this._renderView();return}if(e.target.closest(`[data-today]`)){let e=new Date;this.value=re(e.getFullYear(),e.getMonth(),e.getDate()),this._close();return}if(e.target.closest(`[data-clear]`)){this.value=``,this._close();return}let s=e.target.closest(`.datepicker-day[data-iso]`);s&&!s.disabled&&(this.value=s.dataset.iso,this._close())}),this._onKeyBound=e=>{r()&&this._onKey(e)},t.addEventListener(`keydown`,this._onKeyBound),this._onDocClick=e=>{let t=this._popClick;this._popClick=!1,r()&&!t&&!this.contains(e.target)&&this._close()},document.addEventListener(`click`,this._onDocClick),l(this,()=>{r()&&this._position(e,t)}),this._syncFormValue()}
|
|
88
|
+
<div class="datepicker-cells">${i}</div>`}_focusActive(){let e=this.querySelector(`.datepicker-pop`),t=e?.querySelector(`[tabindex="0"]`)||e?.querySelector(`.is-selected`)||e?.querySelector(`.datepicker-day:not(:disabled), .datepicker-cell:not(:disabled)`);t&&e.contains(document.activeElement)&&t.focus()}_position(e,t){c(e,t)}_setFocus(e,t,n,r){let{y:i,m:a}=x(e,t);this._focus={y:i,m:a,d:n};let o=i!==this._viewY||a!==this._viewM;this._viewY=i,this._viewM=a,this._slide=o&&r||``,this._renderView(),this._slide=``,this.querySelector(`.datepicker-day[data-iso="${re(i,a,n)}"]`)?.focus()}_onKey(e){if(this._mode!==`days`){e.key===`Escape`&&this._close();return}let t=this._focus||b(this._value)||{y:this._viewY,m:this._viewM,d:1},n=(n,r)=>{e.preventDefault();let i=new Date(t.y,t.m,t.d+n);this._setFocus(i.getFullYear(),i.getMonth(),i.getDate(),r)};switch(e.key){case`ArrowLeft`:return n(-1,`slide-prev`);case`ArrowRight`:return n(1,`slide-next`);case`ArrowUp`:return n(-7,`slide-prev`);case`ArrowDown`:return n(7,`slide-next`);case`Home`:return n(-((new Date(t.y,t.m,t.d).getDay()-this._firstDay()+7)%7),`slide-prev`);case`End`:return n(6-(new Date(t.y,t.m,t.d).getDay()-this._firstDay()+7)%7,`slide-next`);case`PageUp`:{e.preventDefault();let n=x(t.y,t.m-(e.shiftKey?12:1));return this._setFocus(n.y,n.m,Math.min(t.d,ae(n.y,n.m)),`slide-prev`)}case`PageDown`:{e.preventDefault();let n=x(t.y,t.m+(e.shiftKey?12:1));return this._setFocus(n.y,n.m,Math.min(t.d,ae(n.y,n.m)),`slide-next`)}case`Enter`:case` `:e.preventDefault(),this._limits().dayDisabled(t.y,t.m,t.d)||(this.value=re(t.y,t.m,t.d),this._close());return;case`Escape`:return this._close();default:}}_wire(){this._teardown();let e=this.querySelector(`.datepicker-trigger`),t=this.querySelector(`.datepicker-pop`),n=this.querySelector(`.datepicker`);if(!e||!t)return;let r=()=>!t.hidden;this._open=()=>{if(!b(this._value)&&!this._viewNavigated){let e=new Date;this._viewY=e.getFullYear(),this._viewM=e.getMonth()}let r=b(this._value),i=new Date;this._mode=`days`,this._focus=r||{y:this._viewY,m:this._viewM,d:i.getFullYear()===this._viewY&&i.getMonth()===this._viewM?i.getDate():1},this._renderView(),t.hidden=!1,n?.classList.add(`open`),this._position(e,t),e.setAttribute(`aria-expanded`,`true`),t.querySelector(`[tabindex="0"]`)?.focus()},this._close=()=>{t.hidden=!0,n?.classList.remove(`open`),e.setAttribute(`aria-expanded`,`false`),e.focus()},e.addEventListener(`click`,()=>r()?this._close():this._open()),t.addEventListener(`click`,e=>{this._popClick=!0;let t=e.target.closest(`[data-nav]`);if(t){this._viewNavigated=!0,this._slide=Number(t.dataset.nav)<0?`slide-prev`:`slide-next`;let e=x(this._viewY,this._viewM+Number(t.dataset.nav));this._viewY=e.y,this._viewM=e.m,this._focus={y:e.y,m:e.m,d:1},this._renderView(),this._slide=``;return}let n=e.target.closest(`[data-nav-year]`);if(n){this._viewY+=Number(n.dataset.navYear),this._renderView();return}let r=e.target.closest(`[data-nav-decade]`);if(r){this._viewY+=Number(r.dataset.navDecade)*10,this._renderView();return}let i=e.target.closest(`[data-view]`);if(i){this._mode=i.dataset.view,this._renderView();return}let a=e.target.closest(`[data-month]`);if(a&&!a.disabled){this._viewNavigated=!0,this._viewM=Number(a.dataset.month),this._mode=`days`,this._focus={y:this._viewY,m:this._viewM,d:1},this._renderView();return}let o=e.target.closest(`[data-year]`);if(o&&!o.disabled){this._viewNavigated=!0,this._viewY=Number(o.dataset.year),this._mode=`months`,this._renderView();return}if(e.target.closest(`[data-today]`)){let e=new Date;this.value=re(e.getFullYear(),e.getMonth(),e.getDate()),this._close();return}if(e.target.closest(`[data-clear]`)){this.value=``,this._close();return}let s=e.target.closest(`.datepicker-day[data-iso]`);s&&!s.disabled&&(this.value=s.dataset.iso,this._close())}),this._onKeyBound=e=>{r()&&this._onKey(e)},t.addEventListener(`keydown`,this._onKeyBound),this._onDocClick=e=>{let t=this._popClick;this._popClick=!1,r()&&!t&&!this.contains(e.target)&&this._close()},document.addEventListener(`click`,this._onDocClick),l(this,()=>{r()&&this._position(e,t)}),this._syncFormValue()}_teardown(){this._onDocClick&&document.removeEventListener(`click`,this._onDocClick),u(this)}disconnectedCallback(){this._teardown()}},se=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],ce=[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],le=e=>String(e).padStart(2,`0`),ue=(e,t,n)=>`${e}-${le(t+1)}-${le(n)}`,de=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e||``);return t?{y:+t[1],m:t[2]-1,d:+t[3]}:null},fe=e=>{let t=de(e);return t?`${le(t.d)} ${se[t.m].slice(0,3)} ${t.y}`:``},pe=(e,t)=>new Date(e,t+1,0).getDate(),me=(e,t)=>{for(;t<0;)t+=12,--e;for(;t>11;)t-=12,e+=1;return{y:e,m:t}},he=class extends HTMLElement{static formAssociated=!0;static get observedAttributes(){return[`start`,`end`,`min`,`max`,`placeholder`,`disabled`,`first-day`,`size`,`aria-label`,`aria-describedby`,`name`,`start-name`,`end-name`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._start=``,this._end=``,this._hover=``;let e=new Date(2e3,0,1);this._viewY=e.getFullYear(),this._viewM=e.getMonth()}connectedCallback(){this._rendered||this.render()}attributeChangedCallback(e,t,n){this._rendered&&(e===`start`||e===`end`?(this._start=this.getAttribute(`start`)||``,this._end=this.getAttribute(`end`)||``,this._syncTrigger(),this._syncMirrors()):this.render())}get value(){return{start:this._start,end:this._end}}set value(e){this._start=e?.start||``,this._end=e?.end||``,this._syncTrigger(),this._syncMirrors(),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}_firstDay(){let e=Number.parseInt(this.getAttribute(`first-day`)??``,10);return Number.isInteger(e)&&e>=0&&e<=6?e:0}_label(){let e=this.getAttribute(`placeholder`)||`Start – End`;return!this._start&&!this._end?{text:e,empty:!0}:{text:`${fe(this._start)||`Start`} – ${fe(this._end)||`End`}`,empty:!1}}render(){this._defaultStart===void 0&&(this._defaultStart=this.getAttribute(`start`)||``,this._defaultEnd=this.getAttribute(`end`)||``),this._start=this.getAttribute(`start`)||this._start,this._end=this.getAttribute(`end`)||this._end;let e=de(this._start);e&&(this._viewY=e.y,this._viewM=e.m);let t=this.getAttribute(`size`),n=t===`sm`?` input-sm`:t===`lg`?` input-lg`:``,{text:r,empty:i}=this._label(),a=this.getAttribute(`aria-label`),o=this.getAttribute(`aria-describedby`);this.innerHTML=`
|
|
89
89
|
<div class="daterange">
|
|
90
|
-
<button type="button" class="input daterange-trigger${n}${i?``:` has-value`}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute(`disabled`)?` disabled`:``}>
|
|
91
|
-
<span data-range-label class="${i?`search-select-placeholder`:``}">${r}</span>
|
|
90
|
+
<button type="button" class="input daterange-trigger${n}${i?``:` has-value`}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute(`disabled`)?` disabled`:``}${a?` aria-label="${m(a)}"`:``}${o?` aria-describedby="${m(o)}"`:``}>
|
|
91
|
+
<span data-range-label class="${i?`search-select-placeholder`:``}">${m(r)}</span>
|
|
92
92
|
<i class="bi bi-calendar-range" aria-hidden="true"></i>
|
|
93
93
|
</button>
|
|
94
94
|
<div class="daterange-pop" role="dialog" aria-modal="false" hidden></div>
|
|
95
|
-
</div>`,this._rendered=!0,this._syncMirrors(),this._wire()}_syncTrigger(){let e=this.querySelector(`.daterange-trigger`),t=this.querySelector(`[data-range-label]`);if(!t)return;let{text:n,empty:r}=this._label();t.textContent=n,t.classList.toggle(`search-select-placeholder`,r),e?.classList.toggle(`has-value`,!r)}_syncMirrors(){let e=this.getAttribute(`start-name`)||this.getAttribute(`name`),t=this.getAttribute(`end-name`);this._mirror(`start`,e,this._start),this._mirror(`end`,t,this._end)}_mirror(e,t,n){if(!t)return;let r=this.querySelector(`input[type="hidden"][data-range-mirror="${e}"]`);r||(r=document.createElement(`input`),r.type=`hidden`,r.setAttribute(`data-range-mirror`,e),this.appendChild(r)),r.name=t,r.value=n
|
|
95
|
+
</div>`,this._rendered=!0,this._syncMirrors(),this._wire()}formResetCallback(){this.value={start:this._defaultStart||``,end:this._defaultEnd||``}}_syncTrigger(){let e=this.querySelector(`.daterange-trigger`),t=this.querySelector(`[data-range-label]`);if(!t)return;let{text:n,empty:r}=this._label();t.textContent=n,t.classList.toggle(`search-select-placeholder`,r),e?.classList.toggle(`has-value`,!r)}_syncMirrors(){let e=this.getAttribute(`start-name`)||this.getAttribute(`name`),t=this.getAttribute(`end-name`);this._mirror(`start`,e,this._start),this._mirror(`end`,t,this._end)}_mirror(e,t,n){if(!t)return;let r=this.querySelector(`input[type="hidden"][data-range-mirror="${e}"]`);r||(r=document.createElement(`input`),r.type=`hidden`,r.setAttribute(`data-range-mirror`,e),this.appendChild(r)),r.name=t,r.value=n||``,r.disabled=this.hasAttribute(`disabled`)}_limits(){let e=de(this.getAttribute(`min`)),t=de(this.getAttribute(`max`)),n=e?new Date(e.y,e.m,e.d).getTime():-1/0,r=t?new Date(t.y,t.m,t.d).getTime():1/0;return(e,t,i)=>{let a=new Date(e,t,i).getTime();return a<n||a>r}}_monthHtml(e,t){let n=this._firstDay(),r=(new Date(e,t,1).getDay()-n+7)%7,i=pe(e,t),a=this._limits(),o=ce.map((e,t)=>ce[(t+n)%7]).map(e=>`<span>${e}</span>`).join(``),s=(e,t,n,r)=>{let i=ue(e,t,n),o=a(e,t,n);return`<button type="button" class="${[`datepicker-day`,r?`is-outside`:``].filter(Boolean).join(` `)}" data-iso="${i}"${o?` disabled`:``}>${n}</button>`},c=``,l=me(e,t-1),u=pe(l.y,l.m);for(let e=r-1;e>=0;e--)c+=s(l.y,l.m,u-e,!0);for(let n=1;n<=i;n++)c+=s(e,t,n,!1);let d=me(e,t+1),f=(7-(r+i)%7)%7;for(let e=1;e<=f;e++)c+=s(d.y,d.m,e,!0);return`
|
|
96
96
|
<div class="daterange-cal">
|
|
97
97
|
<div class="datepicker-month-label">${se[t]} ${e}</div>
|
|
98
98
|
<div class="datepicker-weekdays">${o}</div>
|
|
@@ -109,9 +109,9 @@ var WeborityUiElements=(function(e){Object.defineProperty(e,Symbol.toStringTag,{
|
|
|
109
109
|
<div class="datepicker-foot">
|
|
110
110
|
<span class="daterange-hint" data-range-hint></span>
|
|
111
111
|
<button type="button" class="datepicker-link" data-clear>Clear</button>
|
|
112
|
-
</div>`,this._paint()}_paint(){let e=this.querySelector(`.daterange-pop`);if(!e)return;let t=this._start?new Date(this._start).getTime():null,n=this._end;t&&!this._end&&this._hover&&new Date(this._hover).getTime()>=t&&(n=this._hover);let r=n?new Date(n).getTime():null;for(let n of e.querySelectorAll(`.datepicker-day[data-iso]`)){let e=new Date(n.dataset.iso).getTime(),i=t!=null&&e===t,a=r!=null&&e===r,o=t!=null&&r!=null&&e>t&&e<r;n.classList.toggle(`is-range-start`,i),n.classList.toggle(`is-range-end`,a),n.classList.toggle(`in-range`,o)}let i=e.querySelector(`[data-range-hint]`);i&&(i.textContent=this._start?this._end?`${fe(this._start)} – ${fe(this._end)}`:`Pick an end date`:`Pick a start date`)}_position(e,t){c(e,t)}_pick(e){if(!this._start||this._start&&this._end){this._start=e,this._end=``,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._paint();return}if(new Date(e).getTime()<new Date(this._start).getTime()){this._start=e,this._paint();return}this._end=e,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close()}_wire(){let e=this.querySelector(`.daterange-trigger`),t=this.querySelector(`.daterange-pop`),n=this.querySelector(`.daterange`);if(!e||!t)return;let r=()=>!t.hidden;this._open=()=>{let r=de(this._start);if(r)this._viewY=r.y,this._viewM=r.m;else{let e=new Date;this._viewY=e.getFullYear(),this._viewM=e.getMonth()}this._renderView(),t.hidden=!1,n?.classList.add(`open`),this._position(e,t),e.setAttribute(`aria-expanded`,`true`)},this._close=()=>{t.hidden=!0,this._hover=``,n?.classList.remove(`open`),e.setAttribute(`aria-expanded`,`false`)},e.addEventListener(`click`,()=>r()?this._close():this._open()),t.addEventListener(`click`,e=>{this._popClick=!0;let t=e.target.closest(`[data-nav]`);if(t){let e=me(this._viewY,this._viewM+Number(t.dataset.nav));this._viewY=e.y,this._viewM=e.m,this._renderView();return}if(e.target.closest(`[data-clear]`)){this._start=``,this._end=``,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._renderView(),this.dispatchEvent(new Event(`change`,{bubbles:!0}));return}let n=e.target.closest(`.datepicker-day[data-iso]`);n&&!n.disabled&&this._pick(n.dataset.iso)}),t.addEventListener(`mouseover`,e=>{let t=e.target.closest(`.datepicker-day[data-iso]`);t&&this._start&&!this._end&&(this._hover=t.dataset.iso,this._paint())}),this._onDocClick=e=>{let t=this._popClick;this._popClick=!1,r()&&!t&&!this.contains(e.target)&&this._close()},document.addEventListener(`click`,this._onDocClick),this._onDocKey=e=>{r()&&e.key===`Escape`&&this._close()},document.addEventListener(`keydown`,this._onDocKey),l(this,()=>{r()&&this._position(e,t)}),this._syncMirrors()}
|
|
112
|
+
</div>`,this._paint()}_paint(){let e=this.querySelector(`.daterange-pop`);if(!e)return;let t=this._start?new Date(this._start).getTime():null,n=this._end;t&&!this._end&&this._hover&&new Date(this._hover).getTime()>=t&&(n=this._hover);let r=n?new Date(n).getTime():null;for(let n of e.querySelectorAll(`.datepicker-day[data-iso]`)){let e=new Date(n.dataset.iso).getTime(),i=t!=null&&e===t,a=r!=null&&e===r,o=t!=null&&r!=null&&e>t&&e<r;n.classList.toggle(`is-range-start`,i),n.classList.toggle(`is-range-end`,a),n.classList.toggle(`in-range`,o)}let i=e.querySelector(`[data-range-hint]`);i&&(i.textContent=this._start?this._end?`${fe(this._start)} – ${fe(this._end)}`:`Pick an end date`:`Pick a start date`)}_position(e,t){c(e,t)}_pick(e){if(!this._start||this._start&&this._end){this._start=e,this._end=``,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._paint();return}if(new Date(e).getTime()<new Date(this._start).getTime()){this._start=e,this._syncTrigger(),this._syncMirrors(),this._paint();return}this._end=e,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close()}_wire(){this._teardown();let e=this.querySelector(`.daterange-trigger`),t=this.querySelector(`.daterange-pop`),n=this.querySelector(`.daterange`);if(!e||!t)return;let r=()=>!t.hidden;this._open=()=>{let r=de(this._start);if(r)this._viewY=r.y,this._viewM=r.m;else{let e=new Date;this._viewY=e.getFullYear(),this._viewM=e.getMonth()}this._renderView(),t.hidden=!1,n?.classList.add(`open`),this._position(e,t),e.setAttribute(`aria-expanded`,`true`)},this._close=()=>{t.hidden=!0,this._hover=``,n?.classList.remove(`open`),e.setAttribute(`aria-expanded`,`false`)},e.addEventListener(`click`,()=>r()?this._close():this._open()),t.addEventListener(`click`,e=>{this._popClick=!0;let t=e.target.closest(`[data-nav]`);if(t){let e=me(this._viewY,this._viewM+Number(t.dataset.nav));this._viewY=e.y,this._viewM=e.m,this._renderView();return}if(e.target.closest(`[data-clear]`)){this._start=``,this._end=``,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._renderView(),this.dispatchEvent(new Event(`change`,{bubbles:!0}));return}let n=e.target.closest(`.datepicker-day[data-iso]`);n&&!n.disabled&&this._pick(n.dataset.iso)}),t.addEventListener(`mouseover`,e=>{let t=e.target.closest(`.datepicker-day[data-iso]`);t&&this._start&&!this._end&&(this._hover=t.dataset.iso,this._paint())}),this._onDocClick=e=>{let t=this._popClick;this._popClick=!1,r()&&!t&&!this.contains(e.target)&&this._close()},document.addEventListener(`click`,this._onDocClick),this._onDocKey=e=>{r()&&e.key===`Escape`&&this._close()},document.addEventListener(`keydown`,this._onDocKey),l(this,()=>{r()&&this._position(e,t)}),this._syncMirrors()}_teardown(){this._onDocClick&&document.removeEventListener(`click`,this._onDocClick),this._onDocKey&&document.removeEventListener(`keydown`,this._onDocKey),u(this)}disconnectedCallback(){this._teardown()}},ge=class extends HTMLElement{static formAssociated=!0;_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||`Select`}static get observedAttributes(){return[`placeholder`,`search-placeholder`,`searchable`,`disabled`,`icon`,`size`,`collapse-chips`,`aria-label`]}constructor(){super(),this._values=[],this._optionsProp=null,this._active=-1;try{this._internals=this.attachInternals()}catch{this._internals=null}}connectedCallback(){if(!this._rendered){if(!this._valuesInit&&!this._optionsProp&&!this._values.length){let e=[...this.querySelectorAll(`:scope > wui-option[selected]`)].map(e=>e.getAttribute(`value`)??e.textContent.trim());e.length&&(this._values=e.map(String))}this._valuesInit=!0,this._defaultCaptured||=(this._defaultValues=this._values.slice(),!0),this.render()}}formResetCallback(){this.values=(this._defaultValues||[]).slice()}attributeChangedCallback(){this._rendered&&this.render()}get values(){return this._values.slice()}set values(e){this._values=Array.isArray(e)?e.map(String):[],f(this,this._values.join(`,`)),this._rendered&&this._renderControl()}set options(e){this._optionsProp=Array.isArray(e)?e:null,this.isConnected&&this.render()}get options(){return this._readOptions()}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>({value:e.getAttribute(`value`)??e.textContent.trim(),label:e.innerHTML,icon:e.getAttribute(`icon`)||void 0,[p]:!0,selected:e.hasAttribute(`selected`)})))}_readOptions(){return this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}_labelFor(e){let t=this._readOptions().find(t=>String(t.value)===String(e));return t?t.label:e}_labelHtmlFor(e){let t=this._readOptions().find(t=>String(t.value)===String(e));return t?g(t):m(e)}render(){this._snapshotDeclared();let e=this.hasAttribute(`searchable`),t=this.getAttribute(`search-placeholder`)||`Search…`,n=this.getAttribute(`icon`),r=this.getAttribute(`size`),i=r===`sm`?` search-select-sm`:r===`lg`?` search-select-lg`:``;f(this,this._values.join(`,`)),this.innerHTML=`
|
|
113
113
|
<div class="search-select${i}">
|
|
114
|
-
<div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-label="${_e(this._accessibleName())}"${this.hasAttribute(`disabled`)?` aria-disabled="true"
|
|
114
|
+
<div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-label="${_e(this._accessibleName())}"${this.hasAttribute(`disabled`)?` aria-disabled="true"`:` tabindex="0"`}>
|
|
115
115
|
${n?`<i class="bi bi-${_e(n)} search-select-icon" aria-hidden="true"></i>`:``}
|
|
116
116
|
<div class="ms-chips" data-chips></div>
|
|
117
117
|
<i class="bi bi-chevron-down search-select-caret" aria-hidden="true"></i>
|
|
@@ -121,7 +121,7 @@ var WeborityUiElements=(function(e){Object.defineProperty(e,Symbol.toStringTag,{
|
|
|
121
121
|
<div class="search-select-options"></div>
|
|
122
122
|
<div class="search-select-empty" hidden>No matches</div>
|
|
123
123
|
</div>
|
|
124
|
-
</div>`,this._rendered=!0,f(this,this._values.join(`,`)),this._renderControl(),this._renderOptions(),this._wire()}_renderControl(){let e=this.querySelector(`[data-chips]`);if(!e)return;let t=this.getAttribute(`placeholder`)||`Select…`;if(!this._values.length){e.innerHTML=`<span class="search-select-placeholder">${m(t)}</span>`;return}e.innerHTML=this._values.map(e=>`<span class="chip chip-sm"><span class="chip-label">${this._labelHtmlFor(e)}</span><button type="button" class="chip-remove" data-remove="${_e(e)}" aria-label="Remove"><i class="bi bi-x" aria-hidden="true"></i></button></span>`).join(``),this._collapseChips()}_collapseChips(){let e=this.querySelector(`[data-chips]`);if(!e||!this.hasAttribute(`collapse-chips`)||!this._values.length)return;e.querySelector(`.chip-more`)?.remove();let t=[...e.querySelectorAll(`:scope > .chip:not(.chip-more)`)];for(let e of t)e.style.display=``;if(!t.length)return;let n=e.clientWidth,r=e=>e.offsetLeft+e.offsetWidth;if(r(t[t.length-1])<=n)return;let i=document.createElement(`span`);i.className=`chip chip-sm chip-more`,i.textContent=`+${t.length}`,e.appendChild(i);let a=i.offsetWidth+6,o=0;for(let e of t)if(r(e)<=n-a)o+=1;else break;o<1&&(o=1);for(let e=o;e<t.length;e+=1)t[e].style.display=`none`;i.textContent=`+${t.length-o}`}_renderOptions(e){let t=this.querySelector(`.search-select-options`),n=this.querySelector(`.search-select-empty`);if(!t)return;let r=(e||``).trim().toLowerCase(),i=this._readOptions();r&&(i=i.filter(e=>ve(e.label).toLowerCase().includes(r))),t.innerHTML=i.map(e=>{let t=this._values.includes(String(e.value));return`<button type="button" role="option" class="search-select-option${t?` selected`:``}" data-value="${_e(e.value)}" aria-selected="${t}"><span class="ms-opt-label">${g(e)}</span><span class="ms-check"><i class="bi bi-check" aria-hidden="true"></i></span></button>`}).join(``),n&&(n.hidden=i.length>0),this._active=-1}_wire(){let e=this.querySelector(`.search-select-control`),t=this.querySelector(`.search-select-menu`),n=this.querySelector(`.search-select-input`),r=this.querySelector(`.search-select-clear`),i=this.querySelector(`.search-select-options`);if(!e||!t)return;let a=()=>this.hasAttribute(`disabled`);!this._ro&&typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this._collapseChips()),this._ro.observe(this));let o=()=>c(e,t,{matchWidth:!0}),s=()=>[...this.querySelectorAll(`.search-select-option`)],u=()=>s().filter(e=>!e.hidden),d=e=>{let t=u();this._active=e;for(let e of s())e.classList.remove(`is-active`);e>=0&&t[e]&&(t[e].classList.add(`is-active`),t[e].scrollIntoView({block:`nearest`}))},p=()=>!t.hidden,m=()=>{a()||(t.hidden=!1,e.setAttribute(`aria-expanded`,`true`),e.classList.add(`open`),o(),n&&(n.value=``,this._renderOptions(``),n.focus()))},h=()=>{t.hidden=!0,e.setAttribute(`aria-expanded`,`false`),e.classList.remove(`open`),d(-1)},g=()=>{f(this,this._values.join(`,`)),this.dispatchEvent(new Event(`change`,{bubbles:!0}))},_=e=>{let t=String(e);this._values.includes(t)?this._values=this._values.filter(e=>e!==t):this._values=[...this._values,t],this._renderControl(),this._renderOptions(n?n.value:``),g()},v=e=>{this._values=this._values.filter(t=>t!==String(e)),this._renderControl(),this._renderOptions(n?n.value:``),g()};e.addEventListener(`click`,e=>{let t=e.target.closest(`[data-remove]`);if(t){e.stopPropagation(),v(t.dataset.remove);return}p()?h():m()}),i.addEventListener(`click`,e=>{let t=e.target.closest(`.search-select-option`);t&&(_(t.dataset.value),n?.focus())}),i.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.search-select-option`);t&&d(u().indexOf(t))}),i.addEventListener(`mouseleave`,()=>d(-1)),n?.addEventListener(`input`,()=>{this._renderOptions(n.value),r&&(r.hidden=!n.value),d(-1)});let y=t=>{let r=u();t.key===`ArrowDown`?(t.preventDefault(),d(Math.min(this._active+1,r.length-1))):t.key===`ArrowUp`?(t.preventDefault(),d(Math.max(this._active-1,0))):t.key===`Enter`?(t.preventDefault(),r[this._active]&&_(r[this._active].dataset.value)):t.key===`Escape`?(h(),e.focus()):t.key===`Backspace`&&!n.value&&this._values.length&&v(this._values[this._values.length-1])};n?.addEventListener(`keydown`,y),r?.addEventListener(`click`,()=>{n.value=``,this._renderOptions(``),r.hidden=!0,n.focus()}),e.addEventListener(`keydown`,e=>{if(p()){y(e);return}(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),m())}),this._onDocClick=e=>{p()&&!this.contains(e.target)&&h()},document.addEventListener(`click`,this._onDocClick),l(this,()=>{p()&&o()})}
|
|
124
|
+
</div>`,this._rendered=!0,f(this,this._values.join(`,`)),this._renderControl(),this._renderOptions(),this._wire()}_renderControl(){let e=this.querySelector(`[data-chips]`);if(!e)return;let t=this.getAttribute(`placeholder`)||`Select…`;if(!this._values.length){e.innerHTML=`<span class="search-select-placeholder">${m(t)}</span>`;return}e.innerHTML=this._values.map(e=>`<span class="chip chip-sm"><span class="chip-label">${this._labelHtmlFor(e)}</span><button type="button" class="chip-remove" data-remove="${_e(e)}" aria-label="Remove"><i class="bi bi-x" aria-hidden="true"></i></button></span>`).join(``),this._collapseChips()}_collapseChips(){let e=this.querySelector(`[data-chips]`);if(!e||!this.hasAttribute(`collapse-chips`)||!this._values.length)return;e.querySelector(`.chip-more`)?.remove();let t=[...e.querySelectorAll(`:scope > .chip:not(.chip-more)`)];for(let e of t)e.style.display=``;if(!t.length)return;let n=e.clientWidth,r=e=>e.offsetLeft+e.offsetWidth;if(r(t[t.length-1])<=n)return;let i=document.createElement(`span`);i.className=`chip chip-sm chip-more`,i.textContent=`+${t.length}`,e.appendChild(i);let a=i.offsetWidth+6,o=0;for(let e of t)if(r(e)<=n-a)o+=1;else break;o<1&&(o=1);for(let e=o;e<t.length;e+=1)t[e].style.display=`none`;i.textContent=`+${t.length-o}`}_renderOptions(e){let t=this.querySelector(`.search-select-options`),n=this.querySelector(`.search-select-empty`);if(!t)return;let r=(e||``).trim().toLowerCase(),i=this._readOptions();r&&(i=i.filter(e=>ve(e.label).toLowerCase().includes(r))),t.innerHTML=i.map(e=>{let t=this._values.includes(String(e.value));return`<button type="button" role="option" class="search-select-option${t?` selected`:``}" data-value="${_e(e.value)}" aria-selected="${t}"><span class="ms-opt-label">${g(e)}</span><span class="ms-check"><i class="bi bi-check" aria-hidden="true"></i></span></button>`}).join(``),n&&(n.hidden=i.length>0),this._active=-1}_wire(){this._teardown();let e=this.querySelector(`.search-select-control`),t=this.querySelector(`.search-select-menu`),n=this.querySelector(`.search-select-input`),r=this.querySelector(`.search-select-clear`),i=this.querySelector(`.search-select-options`);if(!e||!t)return;let a=()=>this.hasAttribute(`disabled`);!this._ro&&typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this._collapseChips()),this._ro.observe(this));let o=()=>c(e,t,{matchWidth:!0}),s=()=>[...this.querySelectorAll(`.search-select-option`)],u=()=>s().filter(e=>!e.hidden),d=e=>{let t=u();this._active=e;for(let e of s())e.classList.remove(`is-active`);e>=0&&t[e]&&(t[e].classList.add(`is-active`),t[e].scrollIntoView({block:`nearest`}))},p=()=>!t.hidden,m=()=>{a()||(t.hidden=!1,e.setAttribute(`aria-expanded`,`true`),e.classList.add(`open`),o(),n&&(n.value=``,this._renderOptions(``),n.focus()))},h=()=>{t.hidden=!0,e.setAttribute(`aria-expanded`,`false`),e.classList.remove(`open`),d(-1)},g=()=>{f(this,this._values.join(`,`)),this.dispatchEvent(new Event(`change`,{bubbles:!0}))},_=e=>{let t=String(e);this._values.includes(t)?this._values=this._values.filter(e=>e!==t):this._values=[...this._values,t],this._renderControl(),this._renderOptions(n?n.value:``),g()},v=e=>{this._values=this._values.filter(t=>t!==String(e)),this._renderControl(),this._renderOptions(n?n.value:``),g()};e.addEventListener(`click`,e=>{if(a())return;let t=e.target.closest(`[data-remove]`);if(t){e.stopPropagation(),v(t.dataset.remove);return}p()?h():m()}),i.addEventListener(`click`,e=>{let t=e.target.closest(`.search-select-option`);t&&(_(t.dataset.value),n?.focus())}),i.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.search-select-option`);t&&d(u().indexOf(t))}),i.addEventListener(`mouseleave`,()=>d(-1)),n?.addEventListener(`input`,()=>{this._renderOptions(n.value),r&&(r.hidden=!n.value),d(-1)});let y=t=>{let r=u();t.key===`ArrowDown`?(t.preventDefault(),d(Math.min(this._active+1,r.length-1))):t.key===`ArrowUp`?(t.preventDefault(),d(Math.max(this._active-1,0))):t.key===`Enter`?(t.preventDefault(),r[this._active]&&_(r[this._active].dataset.value)):t.key===`Escape`?(h(),e.focus()):t.key===`Backspace`&&!n.value&&this._values.length&&v(this._values[this._values.length-1])};n?.addEventListener(`keydown`,y),r?.addEventListener(`click`,()=>{n.value=``,this._renderOptions(``),r.hidden=!0,n.focus()}),e.addEventListener(`keydown`,e=>{if(p()){y(e);return}(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),m())}),this._onDocClick=e=>{p()&&!this.contains(e.target)&&h()},document.addEventListener(`click`,this._onDocClick),l(this,()=>{p()&&o()})}_teardown(){this._onDocClick&&document.removeEventListener(`click`,this._onDocClick),u(this)}disconnectedCallback(){this._teardown(),this._ro?.disconnect(),this._ro=null}},_e=e=>String(e??``).replace(/"/g,`"`).replace(/</g,`<`),ve=e=>String(e??``).replace(/<[^>]*>/g,``),ye=/[^0-9]/g,be=/[^0-9a-zA-Z]/g,xe=class extends HTMLElement{static get observedAttributes(){return[`value`,`length`,`mode`,`disabled`,`aria-label`]}get length(){let e=Number.parseInt(this.getAttribute(`length`)??`6`,10);return Number.isFinite(e)&&e>0?e:6}set length(e){this.setAttribute(`length`,String(e))}get mode(){return this.getAttribute(`mode`)===`alphanumeric`?`alphanumeric`:`numeric`}set mode(e){this.setAttribute(`mode`,String(e??`numeric`))}get value(){return this._value??``}set value(e){this._value=this._clean(e),f(this,this._value),this._paint()}_clean(e){return(e==null?``:String(e)).replace(this.mode===`alphanumeric`?be:ye,``).slice(0,this.length)}connectedCallback(){this._rendered||this.render()}attributeChangedCallback(e,t,n){this._rendered&&(e===`value`?(this._value=this._clean(n),f(this,this._value),this._paint()):this.render())}render(){this._value=this._clean(this.getAttribute(`value`)??this._value);let e=this.length,t=this.mode===`numeric`,n=this.hasAttribute(`disabled`),r=Array.from({length:e},()=>`<span class="otp-slot" aria-hidden="true"></span>`).join(``),i=this.getAttribute(`aria-label`),a=i?` aria-label="${i.replace(/"/g,`"`)}"`:``;this.innerHTML=`
|
|
125
125
|
<div class="otp">
|
|
126
126
|
<input
|
|
127
127
|
class="otp-field"
|
|
@@ -150,7 +150,7 @@ ${JSON.stringify(s,null,2)}`);a++}return n?{overflow:!0}:{match:!0,matchedChars:
|
|
|
150
150
|
${JSON.stringify(f,null,2)}`)}}return c?{partialMatch:!0}:void 0;case`[]`:for(var p=Ns(t.args),m;!(m=p()).done;){var h=m.value;if(e[0]===h)return e.length===1?{match:!0,matchedChars:e}:n?{overflow:!0}:{match:!0,matchedChars:[h]}}return;default:throw Error(`Unsupported instruction tree: ${t}`)}}var Us,Ws=n((()=>{Ms(),Us=function(){function e(t){Ls(this,e),this.matchTree=new ks().parse(t)}return zs(e,[{key:`match`,value:function(e){var t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).allowOverflow;if(!e)throw Error(`String is required`);var n=Hs(e.split(``),this.matchTree,!0);if(n&&n.match&&delete n.matchedChars,!(n&&n.overflow&&!t))return n}}])}()}));function Gs(e){"@babel/helpers - typeof";return Gs=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Gs(e)}function Ks(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=qs(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
151
151
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qs(e,t){if(e){if(typeof e==`string`)return Js(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Js(e,t):void 0}}function Js(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ys(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Xs(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,Qs(r.key),r)}}function Zs(e,t,n){return t&&Xs(e.prototype,t),n&&Xs(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Qs(e){var t=$s(e,`string`);return Gs(t)==`symbol`?t:t+``}function $s(e,t){if(Gs(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Gs(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var ec,tc,nc,rc,ic,ac,oc,sc,cc,lc=n((()=>{ms(),bs(),Ws(),U(),tn(),L(),Qt(),ec=`9`,tc=ls(ec,15),nc=/[- ]/,rc=!0,ic=rc&&function(){return/\[([^\[\]])*\]/g},ac=rc&&function(){return/\d(?=[^,}][^,}])/g},oc=RegExp(`[`+F+`]*\\$1[`+F+`]*(\\$\\d[`+F+`]*)*$`),sc=3,cc=function(){function e(t){t.state;var n=t.metadata;Ys(this,e),this.metadata=n,this.resetFormat()}return Zs(e,[{key:`resetFormat`,value:function(){this.chosenFormat=void 0,this.template=void 0,this.nationalNumberTemplate=void 0,this.populatedNationalNumberTemplate=void 0,this.populatedNationalNumberTemplatePosition=-1}},{key:`reset`,value:function(e,t){this.resetFormat(),e?(this.isNANP=e.callingCode()===`1`,this.matchingFormats=e.formats(),t.nationalSignificantNumber&&this.narrowDownMatchingFormats(t)):(this.isNANP=void 0,this.matchingFormats=[])}},{key:`format`,value:function(e,t){var n=this;if(gs(t.nationalSignificantNumber,this.metadata))for(var r=Ks(this.matchingFormats),i;!(i=r()).done;){var a=i.value,o=hs(t,a,{metadata:this.metadata,shouldTryNationalPrefixFormattingRule:function(e){return n.shouldTryNationalPrefixFormattingRule(e,{international:t.international,nationalPrefix:t.nationalPrefix})},getSeparatorAfterNationalPrefix:function(e){return n.getSeparatorAfterNationalPrefix(e)}});if(o)return this.resetFormat(),this.chosenFormat=a,this.setNationalNumberTemplate(o.replace(/\d/g,`x`),t),this.populatedNationalNumberTemplate=o,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(`x`),o}return this.formatNationalNumberWithNextDigits(e,t)}},{key:`formatNationalNumberWithNextDigits`,value:function(e,t){var n=this.chosenFormat,r=this.chooseFormat(t);if(r)return r===n?this.formatNextNationalNumberDigits(e):this.formatNextNationalNumberDigits(t.getNationalDigits())}},{key:`narrowDownMatchingFormats`,value:function(e){var t=this,n=e.nationalSignificantNumber,r=e.nationalPrefix,i=e.international,a=n,o=a.length-sc;o<0&&(o=0),this.matchingFormats=this.matchingFormats.filter(function(e){return t.formatSuits(e,i,r)&&t.formatMatches(e,a,o)}),this.chosenFormat&&this.matchingFormats.indexOf(this.chosenFormat)===-1&&this.resetFormat()}},{key:`formatSuits`,value:function(e,t,n){return!(n&&!e.usesNationalPrefix()&&!e.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!t&&!n&&e.nationalPrefixIsMandatoryWhenFormattingInNationalFormat())}},{key:`formatMatches`,value:function(e,t,n){var r=e.leadingDigitsPatterns().length;if(r===0)return!0;n=Math.min(n,r-1);var i=e.leadingDigitsPatterns()[n];if(t.length<sc)try{return new Us(i).match(t,{allowOverflow:!0})!==void 0}catch(e){return console.error(e),!0}return RegExp(`^(${i})`).test(t)}},{key:`getFormatFormat`,value:function(e,t){return t?e.internationalFormat():e.format()}},{key:`chooseFormat`,value:function(e){for(var t=this,n=function(){var n=a.value;return t.chosenFormat===n?0:oc.test(t.getFormatFormat(n,e.international))?t.createTemplateForFormat(n,e)?(t.chosenFormat=n,0):(t.matchingFormats=t.matchingFormats.filter(function(e){return e!==n}),1):1},r,i=Ks(this.matchingFormats.slice()),a;!(a=i()).done&&(r=n(),r!==0););return this.chosenFormat||this.resetFormat(),this.chosenFormat}},{key:`createTemplateForFormat`,value:function(e,t){if(!(rc&&e.pattern().indexOf(`|`)>=0)){var n=this.getTemplateForFormat(e,t);if(n)return this.setNationalNumberTemplate(n,t),!0}}},{key:`getSeparatorAfterNationalPrefix`,value:function(e){return this.isNANP||e&&e.nationalPrefixFormattingRule()&&nc.test(e.nationalPrefixFormattingRule())?` `:``}},{key:`getInternationalPrefixBeforeCountryCallingCode`,value:function(e,t){var n=e.IDDPrefix,r=e.missingPlus;return n?t&&t.spacing===!1?n:n+` `:r?``:`+`}},{key:`getTemplate`,value:function(e){if(this.template){for(var t=-1,n=0,r=e.international?this.getInternationalPrefixBeforeCountryCallingCode(e,{spacing:!1}):``;n<r.length+e.getDigitsWithoutInternationalPrefix().length;)t=this.template.indexOf(`x`,t+1),n++;return us(this.template,t+1)}}},{key:`setNationalNumberTemplate`,value:function(e,t){this.nationalNumberTemplate=e,this.populatedNationalNumberTemplate=e,this.populatedNationalNumberTemplatePosition=-1,t.international?this.template=this.getInternationalPrefixBeforeCountryCallingCode(t).replace(/[\d\+]/g,`x`)+ls(`x`,t.callingCode.length)+` `+e:this.template=e}},{key:`getTemplateForFormat`,value:function(e,t){var n=t.nationalSignificantNumber,r=t.international,i=t.nationalPrefix,a=t.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix,o=e.pattern();rc&&(o=o.replace(ic(),`\\d`).replace(ac(),`\\d`));var s=tc.match(o)[0];if(!(n.length>s.length)){var c=RegExp(`^`+o+`$`),l=n.replace(/\d/g,ec);c.test(l)&&(s=l);var u=this.getFormatFormat(e,r),d;if(this.shouldTryNationalPrefixFormattingRule(e,{international:r,nationalPrefix:i})){var f=u.replace(en,e.nationalPrefixFormattingRule());if(H(e.nationalPrefixFormattingRule())===(i||``)+H(`$1`)&&(u=f,d=!0,i))for(var p=i.length;p>0;)u=u.replace(/\d/,`x`),p--}var m=s.replace(new RegExp(o),u).replace(new RegExp(ec,`g`),`x`);return d||(a?m=ls(`x`,a.length)+` `+m:i&&(m=ls(`x`,i.length)+this.getSeparatorAfterNationalPrefix(e)+m)),r&&(m=Zt(m)),m}}},{key:`formatNextNationalNumberDigits`,value:function(e){var t=fs(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(!t){this.resetFormat();return}return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],us(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1)}},{key:`shouldTryNationalPrefixFormattingRule`,value:function(e,t){var n=t.international,r=t.nationalPrefix;if(e.nationalPrefixFormattingRule()){var i=e.usesNationalPrefix();if(i&&r||!i&&!n)return!0}}}])}()}));function uc(e){"@babel/helpers - typeof";return uc=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},uc(e)}function dc(e,t){return gc(e)||hc(e,t)||pc(e,t)||fc()}function fc(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
152
152
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pc(e,t){if(e){if(typeof e==`string`)return mc(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mc(e,t):void 0}}function mc(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function hc(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function gc(e){if(Array.isArray(e))return e}function _c(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function vc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,bc(r.key),r)}}function yc(e,t,n){return t&&vc(e.prototype,t),n&&vc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function bc(e){var t=xc(e,`string`);return uc(t)==`symbol`?t:t+``}function xc(e,t){if(uc(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(uc(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Sc(e){var t=e.search(Dc);if(!(t<0)){e=e.slice(t);var n;return e[0]===`+`&&(n=!0,e=e.slice(1)),e=e.replace(Oc,``),n&&(e=`+`+e),e}}function Cc(e){var t=Sc(e)||``;return t[0]===`+`?[t.slice(1),!0]:[t]}function wc(e){var t=dc(Cc(e),2),n=t[0],r=t[1];return Ec.test(n)||(n=``),[n,r]}var Tc,Ec,Dc,Oc,kc,Ac,jc=n((()=>{Xt(),Jt(),Nt(),jt(),U(),L(),Tc=`[`+F+P+`]+`,Ec=RegExp(`^`+Tc+`$`,`i`),Dc=`(?:[`+I+`][`+F+P+`]*|[`+F+P+`]+)`,Oc=RegExp(`[^`+F+P+`]+.*$`),kc=/[^\d\[\]]/,Ac=function(){function e(t){var n=t.defaultCountry,r=t.defaultCallingCode,i=t.metadata,a=t.onNationalSignificantNumberChange;_c(this,e),this.defaultCountry=n,this.defaultCallingCode=r,this.metadata=i,this.onNationalSignificantNumberChange=a}return yc(e,[{key:`input`,value:function(e,t){var n=dc(wc(e),2),r=n[0],i=n[1],a=H(r),o;return i&&(t.digits||(t.startInternationalNumber(void 0,void 0),a||(o=!0))),a&&this.inputDigits(a,t),{digits:a,justLeadingPlus:o}}},{key:`inputDigits`,value:function(e,t){var n=t.digits,r=n.length<3&&n.length+e.length>=3;if(t.appendDigits(e),r&&this.extractIddPrefix(t),this.isWaitingForCountryCallingCode(t)){if(!this.extractCountryCallingCode(t))return}else t.appendNationalSignificantNumberDigits(e);t.international||this.hasExtractedNationalSignificantNumber||this.extractNationalSignificantNumber(t.getNationalDigits(),function(e){return t.update(e)})}},{key:`isWaitingForCountryCallingCode`,value:function(e){var t=e.international,n=e.callingCode;return t&&!n}},{key:`extractCountryCallingCode`,value:function(e){var t=Yt(`+`+e.getDigitsWithoutInternationalPrefix(),e.country,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),n=t.countryCallingCode,r=t.number;if(n)return e.setCallingCode(n),e.update({nationalSignificantNumber:r}),!0}},{key:`reset`,value:function(e){if(e){this.hasSelectedNumberingPlan=!0;var t=e._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=t&&kc.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:`extractNationalSignificantNumber`,value:function(e,t){if(this.hasSelectedNumberingPlan){var n=Mt(e,this.metadata),r=n.nationalPrefix,i=n.nationalNumber,a=n.carrierCode;if(i!==e)return this.onExtractedNationalNumber(r,a,i,e,t),!0}}},{key:`extractAnotherNationalSignificantNumber`,value:function(e,t,n){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(e,n);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var r=Mt(e,this.metadata),i=r.nationalPrefix,a=r.nationalNumber,o=r.carrierCode;if(a!==t)return this.onExtractedNationalNumber(i,o,a,e,n),!0}}},{key:`onExtractedNationalNumber`,value:function(e,t,n,r,i){var a=!1,o,s=r.lastIndexOf(n);if(s<0||s!==r.length-n.length)a=!0;else{var c=r.slice(0,s);c&&c!==e&&(o=c)}i({nationalPrefix:e,carrierCode:t,nationalSignificantNumber:n,nationalSignificantNumberIsModified:a,prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix:o}),this.hasExtractedNationalSignificantNumber=!0,this.onNationalSignificantNumberChange()}},{key:`reExtractNationalSignificantNumber`,value:function(e){if(this.extractAnotherNationalSignificantNumber(e.getNationalDigits(),e.nationalSignificantNumber,function(t){return e.update(t)}))return!0;if(this.extractIddPrefix(e)||this.fixMissingPlus(e))return this.extractCallingCodeAndNationalSignificantNumber(e),!0}},{key:`extractIddPrefix`,value:function(e){var t=e.international,n=e.IDDPrefix,r=e.digits;if(e.nationalSignificantNumber,!(t||n)){var i=kt(r,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);if(i!==void 0&&i!==r)return e.update({IDDPrefix:r.slice(0,r.length-i.length)}),this.startInternationalNumber(e,{country:void 0,callingCode:void 0}),!0}}},{key:`fixMissingPlus`,value:function(e){if(!e.international){var t=qt(e.digits,e.country,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata).countryCallingCode;if(t)return e.update({missingPlus:!0}),this.startInternationalNumber(e,{country:e.country,callingCode:t}),!0}}},{key:`startInternationalNumber`,value:function(e,t){var n=t.country,r=t.callingCode;e.startInternationalNumber(n,r),e.nationalSignificantNumber&&(e.resetNationalSignificantNumber(),this.onNationalSignificantNumberChange(),this.hasExtractedNationalSignificantNumber=void 0)}},{key:`extractCallingCodeAndNationalSignificantNumber`,value:function(e){this.extractCountryCallingCode(e)&&this.extractNationalSignificantNumber(e.getNationalDigits(),function(t){return e.update(t)})}}])}()}));function Mc(e){"@babel/helpers - typeof";return Mc=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Mc(e)}function Nc(e,t){return Rc(e)||Lc(e,t)||Fc(e,t)||Pc()}function Pc(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
153
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fc(e,t){if(e){if(typeof e==`string`)return Ic(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ic(e,t):void 0}}function Ic(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Lc(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Rc(e){if(Array.isArray(e))return e}function zc(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Bc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,Hc(r.key),r)}}function Vc(e,t,n){return t&&Bc(e.prototype,t),n&&Bc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Hc(e){var t=Uc(e,`string`);return Mc(t)==`symbol`?t:t+``}function Uc(e,t){if(Mc(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Mc(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Wc(e,t,n){var r=n.getCountryCodesForCallingCode(e);if(r.length>1)return Lt(t,r,n.metadata)}var Gc,Kc,qc=n((()=>{A(),Kn(),M(),as(),lc(),jc(),Vt(),Rt(),D(),Gc=!1,Kc=function(){function e(t,n){zc(this,e),this.metadata=new k(n);var r=Nc(this.getCountryAndCallingCode(t),2),i=r[0],a=r[1];this.defaultCountry=i,this.defaultCallingCode=a,this.reset()}return Vc(e,[{key:`getCountryAndCallingCode`,value:function(e){var t,n;return e&&(E(e)?(t=e.defaultCountry,n=e.defaultCallingCode):t=e),t&&!this.metadata.hasCountry(t)&&(t=void 0),n&&Gc&&this.metadata.isNonGeographicCallingCode(n)&&(t=`001`),[t,n]}},{key:`input`,value:function(e){var t=this.parser.input(e,this.state),n=t.digits;if(t.justLeadingPlus)this.formattedOutput=`+`;else if(n){this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state);var r;if(this.metadata.hasSelectedNumberingPlan()&&(r=this.formatter.format(n,this.state)),r===void 0&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var i=this.state.getNationalDigits();i&&(r=this.formatter.format(i,this.state))}this.formattedOutput=r?this.getFullNumber(r):this.getNonFormattedNumber()}return this.formattedOutput}},{key:`reset`,value:function(){var e=this;return this.state=new is({onCountryChange:function(t){e.country=t},onCallingCodeChange:function(t,n){e.metadata.selectNumberingPlan(n||t),e.formatter.reset(e.metadata.numberingPlan,e.state),e.parser.reset(e.metadata.numberingPlan)}}),this.formatter=new cc({state:this.state,metadata:this.metadata}),this.parser=new Ac({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){e.determineTheCountryIfNeeded(),e.formatter.reset(e.metadata.numberingPlan,e.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput=``,this}},{key:`isInternational`,value:function(){return this.state.international}},{key:`getCallingCode`,value:function(){if(this.isInternational())return this.state.callingCode}},{key:`getCountryCallingCode`,value:function(){return this.getCallingCode()}},{key:`getCountry`,value:function(){if(this.state.digits)return this._getCountry()}},{key:`_getCountry`,value:function(){var e=this.state.country;if(!(Gc&&e===`001`))return e}},{key:`determineTheCountryIfNeeded`,value:function(){(!this.state.country||this.isCountryCallingCodeAmbiguous())&&this.determineTheCountry()}},{key:`getFullNumber`,value:function(e){var t=this;if(this.isInternational()){var n=function(e){return t.formatter.getInternationalPrefixBeforeCountryCallingCode(t.state,{spacing:!!e})+e},r=this.state.callingCode;return n(r?e?`${r} ${e}`:r:`${this.state.getDigitsWithoutInternationalPrefix()}`)}return e}},{key:`getNonFormattedNationalNumberWithPrefix`,value:function(){var e=this.state,t=e.nationalSignificantNumber,n=e.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix,r=e.nationalPrefix,i=t,a=n||r;return a&&(i=a+i),i}},{key:`getNonFormattedNumber`,value:function(){var e=this.state.nationalSignificantNumberIsModified;return this.getFullNumber(e?this.state.getNationalDigits():this.getNonFormattedNationalNumberWithPrefix())}},{key:`getNonFormattedTemplate`,value:function(){var e=this.getNonFormattedNumber();if(e)return e.replace(/[\+\d]/g,`x`)}},{key:`isCountryCallingCodeAmbiguous`,value:function(){var e=this.state.callingCode,t=this.metadata.getCountryCodesForCallingCode(e);return t&&t.length>1}},{key:`determineTheCountry`,value:function(){var e=zt(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,metadata:this.metadata});e!==this.state.country&&(this.state.setCountry(e),e&&this.metadata.selectNumberingPlan(e))}},{key:`getNumberValue`,value:function(){var e=this.state,t=e.digits,n=e.callingCode,r=e.country,i=e.nationalSignificantNumber;if(t){if(this.isInternational())return n?`+`+n+i:`+`+t;if(r||n)return`+`+(r?this.metadata.countryCallingCode():n)+i}}},{key:`getNumber`,value:function(){var e=this.state,t=e.nationalSignificantNumber,n=e.carrierCode,r=e.callingCode;if(t){var i=this._getCountry();if(!(!i&&!r)){if(i&&i===this.defaultCountry){var a=Wc(this.metadata.numberingPlan.callingCode(),t,this.metadata);a&&(i=a)}var o=new z(i||r,t,this.metadata.metadata);return n&&(o.carrierCode=n),o}}}},{key:`isPossible`,value:function(){var e=this.getNumber();return e?e.isPossible():!1}},{key:`isValid`,value:function(){var e=this.getNumber();return e?e.isValid():!1}},{key:`validateLength`,value:function(){var e=this.state,t=e.digits,n=e.nationalSignificantNumber;if(!t)return`NOT_A_NUMBER`;if(!this.metadata.numberingPlan)return`INVALID_COUNTRY`;if(!n)return`TOO_SHORT`;var r=j(n,void 0,this.metadata);if(r!==`IS_POSSIBLE`)return r}},{key:`getNationalNumber`,value:function(){return this.state.nationalSignificantNumber}},{key:`getChars`,value:function(){return(this.state.international?`+`:``)+this.state.digits}},{key:`getTemplate`,value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||``}}])}()}));function Jc(e){return new k(e).getCountries()}var Yc=n((()=>{A()}));function Xc(e,t,n){if(t[e])return new z(e,t[e],n)}var Zc=n((()=>{Kn()}));function Qc(e,t,n){return n||(n=t,t=void 0),new Kc(t,n).input(e)}var $c=n((()=>{qc()})),X=n((()=>{Kn(),cr(),mi(),wi(),Mi(),Bi(),Ji(),ko(),Fo(),Uo(),Zo(),Do(),qc(),lc(),Yc(),A(),Zc(),$c(),Sr(),U(),En()}));function el(){return w(pi,arguments)}var tl=n((()=>{T(),X()}));function nl(){return w(Ci,arguments)}var rl=n((()=>{T(),X()}));function il(){return w(ji,arguments)}var al=n((()=>{T(),X()}));function ol(){return w(zi,arguments)}var sl=n((()=>{T(),X()}));function cl(){return w(qi,arguments)}var ll=n((()=>{T(),X()}));function ul(){return w(Oo,arguments)}var dl=n((()=>{T(),X()}));function fl(){return w(Po,arguments)}var pl=n((()=>{T(),X()}));function ml(){return w(Ho,arguments)}var hl=n((()=>{T(),X()}));function gl(){return w(Xo,arguments)}var _l=n((()=>{T(),X()}));function vl(e,t){return Y.call(this,e,t,S)}var yl=n((()=>{C(),X(),vl.prototype=Object.create(Y.prototype,{}),vl.prototype.constructor=vl}));function bl(e){return Kc.call(this,e,S)}var xl=n((()=>{C(),X(),bl.prototype=Object.create(Kc.prototype,{}),bl.prototype.constructor=bl}));function Sl(){return w(ze,arguments)}var Cl=n((()=>{T(),X()}));function wl(){return w(Jc,arguments)}var Tl=n((()=>{T(),X()}));function El(){return w(Re,arguments)}var Dl=n((()=>{T(),X()}));function Ol(){return w(Le,arguments)}var kl=n((()=>{T(),X()}));function Al(){return k.call(this,S)}var jl=n((()=>{C(),X(),Al.prototype=Object.create(k.prototype,{}),Al.prototype.constructor=Al}));function Ml(){return w(Xc,arguments)}var Nl=n((()=>{T(),X()}));function Pl(){return w(Qc,arguments)}var Fl=n((()=>{T(),X()}));function Il(e){return z.call(this,e,S)}var Ll=n((()=>{C(),X(),Il.prototype=z.prototype,Il.prototype.constructor=Il}));function Rl(){var e=K(arguments),t=e.text,n=e.options,r=e.metadata;return W(t,n,r)}var zl=n((()=>{G(),q()}));function Bl(){return w(Rl,arguments)}var Vl=n((()=>{T(),zl()}));function Hl(){var e=Ul(arguments),t=e.input,n=e.format,r=e.options,i=e.metadata;return Dn(t,n,r,i)}function Ul(e){var t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o,s,c,l;if(typeof t==`string`)if(typeof r==`string`)s=r,a?(c=i,l=a):l=i,o=W(t,{defaultCountry:n,extended:!0},l);else{if(typeof n!=`string`)throw Error("`format` argument not passed to `formatNumber(number, format)`");s=n,i?(c=r,l=i):l=r,o=W(t,{extended:!0},l)}else if(E(t))o=t,s=n,i?(c=r,l=i):l=r;else throw TypeError(`A phone number must either be a string or an object of shape { phone, [country] }.`);return s===`International`?s=`INTERNATIONAL`:s===`National`&&(s=`NATIONAL`),{input:o,format:s,options:c,metadata:l}}var Wl=n((()=>{Fn(),G(),D()}));function Gl(){return w(Hl,arguments)}var Kl=n((()=>{T(),Wl()}));function ql(){var e=Jl(arguments),t=e.input,n=e.options,r=e.metadata;if(t.phone)return ct(t,n,r)}function Jl(e){var t=e[0],n=e[1],r=e[2],i=e[3],a,o={},s;if(typeof t==`string`)E(n)?(r?(o=n,s=r):s=n,a=ln(t)?W(t,void 0,s):{}):(i?(o=r,s=i):s=r,a=ln(t)?W(t,{defaultCountry:n},s):{});else if(E(t))a=t,r?(o=n,s=r):s=n;else throw TypeError(`A phone number must either be a string or an object of shape { phone, [country] }.`);return{input:a,options:o,metadata:s}}var Yl=n((()=>{gn(),dt(),D(),G()}));function Xl(){return w(ql,arguments)}var Zl=n((()=>{T(),Yl()}));function Ql(){var e=Jl(arguments),t=e.input,n=e.options,r=e.metadata;return!t.phone&&!(n&&n.v2)?!1:tt(t,n,r)}var $l=n((()=>{Yl(),rt()}));function eu(){return w(Ql,arguments)}var tu=n((()=>{T(),$l()}));function nu(){var e=Jl(arguments),t=e.input,n=e.options,r=e.metadata;return t.phone?ft(t,n,r):!1}var ru=n((()=>{pt(),Yl()}));function iu(){return w(nu,arguments)}var au=n((()=>{T(),ru()}));function ou(e,t,n,r){return n||={},e.country===t&&ft(e,n,r)}var su=n((()=>{pt()}));function cu(e,t,n){if(typeof e!=`string`)throw TypeError(`number must be a string`);if(typeof t!=`string`)throw TypeError(`country must be a string`);return ou(ln(e)?W(e,{defaultCountry:t},n):{},t,void 0,n)}var lu=n((()=>{gn(),G(),su()}));function uu(){return w(cu,arguments)}var du=n((()=>{T(),lu()}));function fu(e){"@babel/helpers - typeof";return fu=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},fu(e)}function pu(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function mu(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,gu(r.key),r)}}function hu(e,t,n){return t&&mu(e.prototype,t),n&&mu(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function gu(e){var t=_u(e,`string`);return fu(t)==`symbol`?t:t+``}function _u(e,t){if(fu(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(fu(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var vu,yu,Z,bu=n((()=>{G(),gn(),Ua(),Ja(),io(),L(),vu=RegExp(`^[`+Et+`]+`),yu=RegExp(`[`+F+`]+$`),Z=function(){function e(t,n,r){pu(this,e),this.text=t,this.options=n||{},this.metadata=r,this.state=`NOT_READY`,this.regexp=new RegExp(mn,`ig`)}return hu(e,[{key:`find`,value:function(){var e=this.regexp.exec(this.text);if(e){var t=e[0],n=e.index;return t=t.replace(vu,``),n+=e[0].length-t.length,t=t.replace(yu,``),t=Va(t),this.parseCandidate(t,n)||this.find()}}},{key:`parseCandidate`,value:function(e,t){if(Wa(e,t,this.text)&&Ya(e,t,this.text,this.options.extended?`POSSIBLE`:`VALID`)){var n=W(e,this.options,this.metadata);if(n.phone)return n.startsAt=t,n.endsAt=t+e.length,n}}},{key:`hasNext`,value:function(){return this.state===`NOT_READY`&&(this.last_match=this.find(),this.last_match?this.state=`READY`:this.state=`DONE`),this.state===`READY`}},{key:`next`,value:function(){if(!this.hasNext())throw Error(`No next element`);var e=this.last_match;return this.last_match=null,this.state=`NOT_READY`,e}}])}()}));function xu(e,t,n){t===void 0&&(t={});for(var r=new Z(e,t,n),i=[];r.hasNext();)i.push(r.next());return i}function Su(e,t,n){t===void 0&&(t={});var r=new Z(e,t,n),i=function(){return{next:function(){return r.hasNext()?{done:!1,value:r.next()}:{done:!0}}}},a={};return a[Symbol.iterator]=i,a}var Cu=n((()=>{cn(),bu(),on(`parsing`)}));function wu(){var e=K(arguments),t=e.text,n=e.options,r=e.metadata;return xu(t,n,r)}function Tu(){var e=K(arguments),t=e.text,n=e.options,r=e.metadata;return Su(t,n,r)}var Eu=n((()=>{Cu(),q()}));function Du(){return w(wu,arguments)}var Ou=n((()=>{T(),Eu()}));function ku(){return w(Tu,arguments)}var Au=n((()=>{T(),Eu()}));function ju(e,t){Z.call(this,e,t,S)}var Mu=n((()=>{C(),bu(),ju.prototype=Object.create(Z.prototype,{}),ju.prototype.constructor=ju})),Nu=r({AsYouType:()=>bl,AsYouTypeCustom:()=>Kc,DIGITS:()=>gr,DIGIT_PLACEHOLDER:()=>`x`,Metadata:()=>Al,ParseError:()=>V,PhoneNumber:()=>Il,PhoneNumberMatcher:()=>vl,PhoneNumberSearch:()=>ju,PhoneNumberSearchCustom:()=>Z,default:()=>nl,findNumbers:()=>ul,findPhoneNumbers:()=>Du,findPhoneNumbersCustom:()=>wu,findPhoneNumbersInText:()=>ml,format:()=>Gl,formatCustom:()=>Hl,formatIncompletePhoneNumber:()=>Pl,formatNumber:()=>Gl,formatRFC3966:()=>Tn,getCountries:()=>wl,getCountryCallingCode:()=>El,getCountryCallingCodeCustom:()=>Re,getExampleNumber:()=>Ml,getExtPrefix:()=>Ol,getNumberType:()=>Xl,getNumberTypeCustom:()=>ql,getPhoneCode:()=>El,getPhoneCodeCustom:()=>Re,isPossibleNumber:()=>eu,isPossiblePhoneNumber:()=>ol,isSupportedCountry:()=>Sl,isValidNumber:()=>iu,isValidNumberCustom:()=>nu,isValidNumberForRegion:()=>uu,isValidPhoneNumber:()=>il,parse:()=>Bl,parseCustom:()=>Rl,parseDigits:()=>H,parseIncompletePhoneNumber:()=>br,parseNumber:()=>Bl,parsePhoneNumber:()=>el,parsePhoneNumberCharacter:()=>xr,parsePhoneNumberFromString:()=>nl,parsePhoneNumberWithError:()=>el,parseRFC3966:()=>wn,searchNumbers:()=>fl,searchPhoneNumbers:()=>ku,searchPhoneNumbersCustom:()=>Tu,searchPhoneNumbersInText:()=>gl,validatePhoneNumberLength:()=>cl}),Pu=n((()=>{tl(),rl(),al(),sl(),ll(),dl(),pl(),hl(),_l(),yl(),xl(),lc(),Cl(),Tl(),Dl(),kl(),jl(),Nl(),Fl(),Ll(),X(),Vl(),Kl(),Zl(),tu(),au(),du(),Ou(),Au(),Mu(),U(),zl(),Wl(),ru(),Eu(),bu(),Yl(),Kt(),qc()})),Fu=r({default:()=>Iu}),Iu,Lu=n((()=>{Iu={AC:`40123`,AD:`312345`,AE:`501234567`,AF:`701234567`,AG:`2684641234`,AI:`2642351234`,AL:`672123456`,AM:`77123456`,AO:`923123456`,AR:`91123456789`,AS:`6847331234`,AT:`664123456`,AU:`412345678`,AW:`5601234`,AX:`412345678`,AZ:`401234567`,BA:`61123456`,BB:`2462501234`,BD:`1812345678`,BE:`450001234`,BF:`70123456`,BG:`43012345`,BH:`36001234`,BI:`79561234`,BJ:`0195123456`,BL:`690001234`,BM:`4413701234`,BN:`7123456`,BO:`71234567`,BQ:`3181234`,BR:`11961234567`,BS:`2423591234`,BT:`17123456`,BW:`71123456`,BY:`294911911`,BZ:`6221234`,CA:`5062345678`,CC:`412345678`,CD:`991234567`,CF:`70012345`,CG:`061234567`,CH:`781234567`,CI:`0123456789`,CK:`71234`,CL:`221234567`,CM:`671234567`,CN:`13123456789`,CO:`3211234567`,CR:`83123456`,CU:`51234567`,CV:`9911234`,CW:`95181234`,CX:`412345678`,CY:`96123456`,CZ:`601123456`,DE:`15123456789`,DJ:`77831001`,DK:`34412345`,DM:`7672251234`,DO:`8092345678`,DZ:`551234567`,EC:`991234567`,EE:`51234567`,EG:`1001234567`,EH:`650123456`,ER:`7123456`,ES:`612345678`,ET:`911234567`,FI:`412345678`,FJ:`7012345`,FK:`51234`,FM:`3501234`,FO:`211234`,FR:`612345678`,GA:`06031234`,GB:`7400123456`,GD:`4734031234`,GE:`555123456`,GF:`694201234`,GG:`7781123456`,GH:`231234567`,GI:`57123456`,GL:`221234`,GM:`3012345`,GN:`601123456`,GP:`690001234`,GQ:`222123456`,GR:`6912345678`,GT:`51234567`,GU:`6713001234`,GW:`955012345`,GY:`6091234`,HK:`51234567`,HN:`91234567`,HR:`921234567`,HT:`34101234`,HU:`201234567`,ID:`812345678`,IE:`850123456`,IL:`502345678`,IM:`7924123456`,IN:`8123456789`,IO:`3801234`,IQ:`7912345678`,IR:`9123456789`,IS:`6111234`,IT:`3123456789`,JE:`7797712345`,JM:`8762101234`,JO:`790123456`,JP:`9012345678`,KE:`712123456`,KG:`700123456`,KH:`91234567`,KI:`72001234`,KM:`3212345`,KN:`8697652917`,KP:`1921234567`,KR:`1020000000`,KW:`50012345`,KY:`3453231234`,KZ:`7710009998`,LA:`2023123456`,LB:`71123456`,LC:`7582845678`,LI:`660234567`,LK:`712345678`,LR:`770123456`,LS:`50123456`,LT:`61234567`,LU:`628123456`,LV:`21234567`,LY:`912345678`,MA:`650123456`,MC:`612345678`,MD:`62112345`,ME:`60123456`,MF:`690001234`,MG:`321234567`,MH:`2351234`,MK:`72345678`,ML:`65012345`,MM:`92123456`,MN:`88123456`,MO:`66123456`,MP:`6702345678`,MQ:`696201234`,MR:`22123456`,MS:`6644923456`,MT:`96961234`,MU:`52512345`,MV:`7712345`,MW:`991234567`,MX:`2221234567`,MY:`123456789`,MZ:`821234567`,NA:`811234567`,NC:`751234`,NE:`93123456`,NF:`381234`,NG:`8021234567`,NI:`81234567`,NL:`612345678`,NO:`40612345`,NP:`9841234567`,NR:`5551234`,NU:`8884012`,NZ:`211234567`,OM:`92123456`,PA:`61234567`,PE:`912345678`,PF:`87123456`,PG:`70123456`,PH:`9051234567`,PK:`3012345678`,PL:`512345678`,PM:`551234`,PR:`7872345678`,PS:`599123456`,PT:`912345678`,PW:`6201234`,PY:`961456789`,QA:`33123456`,RE:`692123456`,RO:`712034567`,RS:`601234567`,RU:`9123456789`,RW:`720123456`,SA:`512345678`,SB:`7421234`,SC:`2510123`,SD:`911231234`,SE:`701234567`,SG:`81234567`,SH:`51234`,SI:`31234567`,SJ:`41234567`,SK:`912123456`,SL:`25123456`,SM:`66661212`,SN:`701234567`,SO:`71123456`,SR:`7412345`,SS:`977123456`,ST:`9812345`,SV:`70123456`,SX:`7215205678`,SY:`944567890`,SZ:`76123456`,TA:`8999`,TC:`6492311234`,TD:`63012345`,TG:`90112345`,TH:`812345678`,TJ:`917123456`,TK:`7290`,TL:`77212345`,TM:`66123456`,TN:`20123456`,TO:`7715123`,TR:`5012345678`,TT:`8682911234`,TV:`901234`,TW:`912345678`,TZ:`621234567`,UA:`501234567`,UG:`712345678`,US:`2015550123`,UY:`94231234`,UZ:`912345678`,VA:`3123456789`,VC:`7844301234`,VE:`4121234567`,VG:`2843001234`,VI:`3406421234`,VN:`912345678`,VU:`5912345`,WF:`821234`,WS:`7212345`,XK:`43201234`,YE:`712345678`,YT:`639012345`,ZA:`711234567`,ZM:`955123456`,ZW:`712345678`}})),Ru=e=>`wui-flag wui-flag-${String(e).toLowerCase()}`,Q=null,zu=null;function Bu(){return Q?Promise.resolve(Q):(zu||=Promise.all([Promise.resolve().then(()=>(Pu(),Nu)),Promise.resolve().then(()=>(Lu(),Fu))]).then(([e,t])=>(Q={AsYouType:e.AsYouType,getExampleNumber:e.getExampleNumber,isValidPhoneNumber:e.isValidPhoneNumber,examples:t.default||t},Q)).catch(()=>null),zu)}function Vu(e,t){if(!Q||!t)return t;try{return new Q.AsYouType(e).input(t)}catch{return t}}function Hu(e){if(!Q)return null;try{return Q.getExampleNumber(e,Q.examples)?.formatNational()||null}catch{return null}}function Uu(e){if(!Q||!e)return null;try{return Q.isValidPhoneNumber(e)}catch{return null}}function Wu(e){if(!Q)return null;try{let t=Q.getExampleNumber(e,Q.examples);return t?.nationalNumber?t.nationalNumber.length:null}catch{return null}}function Gu(e){if(!Q||!e?.trim().startsWith(`+`))return null;try{let t=new Q.AsYouType;t.input(e.trim());let n=t.getCountry();return n?{country:n,national:t.getNationalNumber()||``}:null}catch{return null}}var Ku=class extends HTMLElement{static get observedAttributes(){return[`value`,`country`,`placeholder`,`disabled`]}constructor(){super(),this._country=`IN`,this._national=``}connectedCallback(){this._rendered||this.render()}attributeChangedCallback(e,t,n){this._rendered&&(e===`country`&&(this._country=n||`IN`),this.render())}get value(){return`+${Ce(this._country)}${this._national}`}set value(e){let t=String(e??``).trim(),n=Gu(t);if(n)this._country=n.country,this._national=n.national.replace(/[^0-9]/g,``);else if(t.startsWith(`+`)){let e=t.replace(/[^0-9]/g,``),n=String(Ce(this._country));n&&e.startsWith(n)&&(e=e.slice(n.length)),this._national=e}else this._national=t.replace(/[^0-9]/g,``);n&&this.getAttribute(`country`)!==this._country?this.setAttribute(`country`,this._country):this._rendered&&this.render(),this._commit()}_commit(){f(this,this.value),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}render(){let e=this.getAttribute(`placeholder`)||Hu(this._country)||`Enter phone number`;this._country=this.getAttribute(`country`)||this._country;let t=Se.map(([e,t,n])=>`<button type="button" role="option" class="country-dropdown-item${e===this._country?` selected`:``}" data-iso="${e}"><span class="${Ru(e)}" aria-hidden="true"></span><span class="country-name-text">${t}<span class="country-code-text">+${n}</span></span></button>`).join(``);this.innerHTML=`
|
|
153
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fc(e,t){if(e){if(typeof e==`string`)return Ic(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ic(e,t):void 0}}function Ic(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Lc(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Rc(e){if(Array.isArray(e))return e}function zc(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Bc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,Hc(r.key),r)}}function Vc(e,t,n){return t&&Bc(e.prototype,t),n&&Bc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Hc(e){var t=Uc(e,`string`);return Mc(t)==`symbol`?t:t+``}function Uc(e,t){if(Mc(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Mc(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Wc(e,t,n){var r=n.getCountryCodesForCallingCode(e);if(r.length>1)return Lt(t,r,n.metadata)}var Gc,Kc,qc=n((()=>{A(),Kn(),M(),as(),lc(),jc(),Vt(),Rt(),D(),Gc=!1,Kc=function(){function e(t,n){zc(this,e),this.metadata=new k(n);var r=Nc(this.getCountryAndCallingCode(t),2),i=r[0],a=r[1];this.defaultCountry=i,this.defaultCallingCode=a,this.reset()}return Vc(e,[{key:`getCountryAndCallingCode`,value:function(e){var t,n;return e&&(E(e)?(t=e.defaultCountry,n=e.defaultCallingCode):t=e),t&&!this.metadata.hasCountry(t)&&(t=void 0),n&&Gc&&this.metadata.isNonGeographicCallingCode(n)&&(t=`001`),[t,n]}},{key:`input`,value:function(e){var t=this.parser.input(e,this.state),n=t.digits;if(t.justLeadingPlus)this.formattedOutput=`+`;else if(n){this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state);var r;if(this.metadata.hasSelectedNumberingPlan()&&(r=this.formatter.format(n,this.state)),r===void 0&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var i=this.state.getNationalDigits();i&&(r=this.formatter.format(i,this.state))}this.formattedOutput=r?this.getFullNumber(r):this.getNonFormattedNumber()}return this.formattedOutput}},{key:`reset`,value:function(){var e=this;return this.state=new is({onCountryChange:function(t){e.country=t},onCallingCodeChange:function(t,n){e.metadata.selectNumberingPlan(n||t),e.formatter.reset(e.metadata.numberingPlan,e.state),e.parser.reset(e.metadata.numberingPlan)}}),this.formatter=new cc({state:this.state,metadata:this.metadata}),this.parser=new Ac({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){e.determineTheCountryIfNeeded(),e.formatter.reset(e.metadata.numberingPlan,e.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput=``,this}},{key:`isInternational`,value:function(){return this.state.international}},{key:`getCallingCode`,value:function(){if(this.isInternational())return this.state.callingCode}},{key:`getCountryCallingCode`,value:function(){return this.getCallingCode()}},{key:`getCountry`,value:function(){if(this.state.digits)return this._getCountry()}},{key:`_getCountry`,value:function(){var e=this.state.country;if(!(Gc&&e===`001`))return e}},{key:`determineTheCountryIfNeeded`,value:function(){(!this.state.country||this.isCountryCallingCodeAmbiguous())&&this.determineTheCountry()}},{key:`getFullNumber`,value:function(e){var t=this;if(this.isInternational()){var n=function(e){return t.formatter.getInternationalPrefixBeforeCountryCallingCode(t.state,{spacing:!!e})+e},r=this.state.callingCode;return n(r?e?`${r} ${e}`:r:`${this.state.getDigitsWithoutInternationalPrefix()}`)}return e}},{key:`getNonFormattedNationalNumberWithPrefix`,value:function(){var e=this.state,t=e.nationalSignificantNumber,n=e.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix,r=e.nationalPrefix,i=t,a=n||r;return a&&(i=a+i),i}},{key:`getNonFormattedNumber`,value:function(){var e=this.state.nationalSignificantNumberIsModified;return this.getFullNumber(e?this.state.getNationalDigits():this.getNonFormattedNationalNumberWithPrefix())}},{key:`getNonFormattedTemplate`,value:function(){var e=this.getNonFormattedNumber();if(e)return e.replace(/[\+\d]/g,`x`)}},{key:`isCountryCallingCodeAmbiguous`,value:function(){var e=this.state.callingCode,t=this.metadata.getCountryCodesForCallingCode(e);return t&&t.length>1}},{key:`determineTheCountry`,value:function(){var e=zt(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,metadata:this.metadata});e!==this.state.country&&(this.state.setCountry(e),e&&this.metadata.selectNumberingPlan(e))}},{key:`getNumberValue`,value:function(){var e=this.state,t=e.digits,n=e.callingCode,r=e.country,i=e.nationalSignificantNumber;if(t){if(this.isInternational())return n?`+`+n+i:`+`+t;if(r||n)return`+`+(r?this.metadata.countryCallingCode():n)+i}}},{key:`getNumber`,value:function(){var e=this.state,t=e.nationalSignificantNumber,n=e.carrierCode,r=e.callingCode;if(t){var i=this._getCountry();if(!(!i&&!r)){if(i&&i===this.defaultCountry){var a=Wc(this.metadata.numberingPlan.callingCode(),t,this.metadata);a&&(i=a)}var o=new z(i||r,t,this.metadata.metadata);return n&&(o.carrierCode=n),o}}}},{key:`isPossible`,value:function(){var e=this.getNumber();return e?e.isPossible():!1}},{key:`isValid`,value:function(){var e=this.getNumber();return e?e.isValid():!1}},{key:`validateLength`,value:function(){var e=this.state,t=e.digits,n=e.nationalSignificantNumber;if(!t)return`NOT_A_NUMBER`;if(!this.metadata.numberingPlan)return`INVALID_COUNTRY`;if(!n)return`TOO_SHORT`;var r=j(n,void 0,this.metadata);if(r!==`IS_POSSIBLE`)return r}},{key:`getNationalNumber`,value:function(){return this.state.nationalSignificantNumber}},{key:`getChars`,value:function(){return(this.state.international?`+`:``)+this.state.digits}},{key:`getTemplate`,value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||``}}])}()}));function Jc(e){return new k(e).getCountries()}var Yc=n((()=>{A()}));function Xc(e,t,n){if(t[e])return new z(e,t[e],n)}var Zc=n((()=>{Kn()}));function Qc(e,t,n){return n||(n=t,t=void 0),new Kc(t,n).input(e)}var $c=n((()=>{qc()})),X=n((()=>{Kn(),cr(),mi(),wi(),Mi(),Bi(),Ji(),ko(),Fo(),Uo(),Zo(),Do(),qc(),lc(),Yc(),A(),Zc(),$c(),Sr(),U(),En()}));function el(){return w(pi,arguments)}var tl=n((()=>{T(),X()}));function nl(){return w(Ci,arguments)}var rl=n((()=>{T(),X()}));function il(){return w(ji,arguments)}var al=n((()=>{T(),X()}));function ol(){return w(zi,arguments)}var sl=n((()=>{T(),X()}));function cl(){return w(qi,arguments)}var ll=n((()=>{T(),X()}));function ul(){return w(Oo,arguments)}var dl=n((()=>{T(),X()}));function fl(){return w(Po,arguments)}var pl=n((()=>{T(),X()}));function ml(){return w(Ho,arguments)}var hl=n((()=>{T(),X()}));function gl(){return w(Xo,arguments)}var _l=n((()=>{T(),X()}));function vl(e,t){return Y.call(this,e,t,S)}var yl=n((()=>{C(),X(),vl.prototype=Object.create(Y.prototype,{}),vl.prototype.constructor=vl}));function bl(e){return Kc.call(this,e,S)}var xl=n((()=>{C(),X(),bl.prototype=Object.create(Kc.prototype,{}),bl.prototype.constructor=bl}));function Sl(){return w(ze,arguments)}var Cl=n((()=>{T(),X()}));function wl(){return w(Jc,arguments)}var Tl=n((()=>{T(),X()}));function El(){return w(Re,arguments)}var Dl=n((()=>{T(),X()}));function Ol(){return w(Le,arguments)}var kl=n((()=>{T(),X()}));function Al(){return k.call(this,S)}var jl=n((()=>{C(),X(),Al.prototype=Object.create(k.prototype,{}),Al.prototype.constructor=Al}));function Ml(){return w(Xc,arguments)}var Nl=n((()=>{T(),X()}));function Pl(){return w(Qc,arguments)}var Fl=n((()=>{T(),X()}));function Il(e){return z.call(this,e,S)}var Ll=n((()=>{C(),X(),Il.prototype=z.prototype,Il.prototype.constructor=Il}));function Rl(){var e=K(arguments),t=e.text,n=e.options,r=e.metadata;return W(t,n,r)}var zl=n((()=>{G(),q()}));function Bl(){return w(Rl,arguments)}var Vl=n((()=>{T(),zl()}));function Hl(){var e=Ul(arguments),t=e.input,n=e.format,r=e.options,i=e.metadata;return Dn(t,n,r,i)}function Ul(e){var t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o,s,c,l;if(typeof t==`string`)if(typeof r==`string`)s=r,a?(c=i,l=a):l=i,o=W(t,{defaultCountry:n,extended:!0},l);else{if(typeof n!=`string`)throw Error("`format` argument not passed to `formatNumber(number, format)`");s=n,i?(c=r,l=i):l=r,o=W(t,{extended:!0},l)}else if(E(t))o=t,s=n,i?(c=r,l=i):l=r;else throw TypeError(`A phone number must either be a string or an object of shape { phone, [country] }.`);return s===`International`?s=`INTERNATIONAL`:s===`National`&&(s=`NATIONAL`),{input:o,format:s,options:c,metadata:l}}var Wl=n((()=>{Fn(),G(),D()}));function Gl(){return w(Hl,arguments)}var Kl=n((()=>{T(),Wl()}));function ql(){var e=Jl(arguments),t=e.input,n=e.options,r=e.metadata;if(t.phone)return ct(t,n,r)}function Jl(e){var t=e[0],n=e[1],r=e[2],i=e[3],a,o={},s;if(typeof t==`string`)E(n)?(r?(o=n,s=r):s=n,a=ln(t)?W(t,void 0,s):{}):(i?(o=r,s=i):s=r,a=ln(t)?W(t,{defaultCountry:n},s):{});else if(E(t))a=t,r?(o=n,s=r):s=n;else throw TypeError(`A phone number must either be a string or an object of shape { phone, [country] }.`);return{input:a,options:o,metadata:s}}var Yl=n((()=>{gn(),dt(),D(),G()}));function Xl(){return w(ql,arguments)}var Zl=n((()=>{T(),Yl()}));function Ql(){var e=Jl(arguments),t=e.input,n=e.options,r=e.metadata;return!t.phone&&!(n&&n.v2)?!1:tt(t,n,r)}var $l=n((()=>{Yl(),rt()}));function eu(){return w(Ql,arguments)}var tu=n((()=>{T(),$l()}));function nu(){var e=Jl(arguments),t=e.input,n=e.options,r=e.metadata;return t.phone?ft(t,n,r):!1}var ru=n((()=>{pt(),Yl()}));function iu(){return w(nu,arguments)}var au=n((()=>{T(),ru()}));function ou(e,t,n,r){return n||={},e.country===t&&ft(e,n,r)}var su=n((()=>{pt()}));function cu(e,t,n){if(typeof e!=`string`)throw TypeError(`number must be a string`);if(typeof t!=`string`)throw TypeError(`country must be a string`);return ou(ln(e)?W(e,{defaultCountry:t},n):{},t,void 0,n)}var lu=n((()=>{gn(),G(),su()}));function uu(){return w(cu,arguments)}var du=n((()=>{T(),lu()}));function fu(e){"@babel/helpers - typeof";return fu=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},fu(e)}function pu(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function mu(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,gu(r.key),r)}}function hu(e,t,n){return t&&mu(e.prototype,t),n&&mu(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function gu(e){var t=_u(e,`string`);return fu(t)==`symbol`?t:t+``}function _u(e,t){if(fu(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(fu(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var vu,yu,Z,bu=n((()=>{G(),gn(),Ua(),Ja(),io(),L(),vu=RegExp(`^[`+Et+`]+`),yu=RegExp(`[`+F+`]+$`),Z=function(){function e(t,n,r){pu(this,e),this.text=t,this.options=n||{},this.metadata=r,this.state=`NOT_READY`,this.regexp=new RegExp(mn,`ig`)}return hu(e,[{key:`find`,value:function(){var e=this.regexp.exec(this.text);if(e){var t=e[0],n=e.index;return t=t.replace(vu,``),n+=e[0].length-t.length,t=t.replace(yu,``),t=Va(t),this.parseCandidate(t,n)||this.find()}}},{key:`parseCandidate`,value:function(e,t){if(Wa(e,t,this.text)&&Ya(e,t,this.text,this.options.extended?`POSSIBLE`:`VALID`)){var n=W(e,this.options,this.metadata);if(n.phone)return n.startsAt=t,n.endsAt=t+e.length,n}}},{key:`hasNext`,value:function(){return this.state===`NOT_READY`&&(this.last_match=this.find(),this.last_match?this.state=`READY`:this.state=`DONE`),this.state===`READY`}},{key:`next`,value:function(){if(!this.hasNext())throw Error(`No next element`);var e=this.last_match;return this.last_match=null,this.state=`NOT_READY`,e}}])}()}));function xu(e,t,n){t===void 0&&(t={});for(var r=new Z(e,t,n),i=[];r.hasNext();)i.push(r.next());return i}function Su(e,t,n){t===void 0&&(t={});var r=new Z(e,t,n),i=function(){return{next:function(){return r.hasNext()?{done:!1,value:r.next()}:{done:!0}}}},a={};return a[Symbol.iterator]=i,a}var Cu=n((()=>{cn(),bu(),on(`parsing`)}));function wu(){var e=K(arguments),t=e.text,n=e.options,r=e.metadata;return xu(t,n,r)}function Tu(){var e=K(arguments),t=e.text,n=e.options,r=e.metadata;return Su(t,n,r)}var Eu=n((()=>{Cu(),q()}));function Du(){return w(wu,arguments)}var Ou=n((()=>{T(),Eu()}));function ku(){return w(Tu,arguments)}var Au=n((()=>{T(),Eu()}));function ju(e,t){Z.call(this,e,t,S)}var Mu=n((()=>{C(),bu(),ju.prototype=Object.create(Z.prototype,{}),ju.prototype.constructor=ju})),Nu=r({AsYouType:()=>bl,AsYouTypeCustom:()=>Kc,DIGITS:()=>gr,DIGIT_PLACEHOLDER:()=>`x`,Metadata:()=>Al,ParseError:()=>V,PhoneNumber:()=>Il,PhoneNumberMatcher:()=>vl,PhoneNumberSearch:()=>ju,PhoneNumberSearchCustom:()=>Z,default:()=>nl,findNumbers:()=>ul,findPhoneNumbers:()=>Du,findPhoneNumbersCustom:()=>wu,findPhoneNumbersInText:()=>ml,format:()=>Gl,formatCustom:()=>Hl,formatIncompletePhoneNumber:()=>Pl,formatNumber:()=>Gl,formatRFC3966:()=>Tn,getCountries:()=>wl,getCountryCallingCode:()=>El,getCountryCallingCodeCustom:()=>Re,getExampleNumber:()=>Ml,getExtPrefix:()=>Ol,getNumberType:()=>Xl,getNumberTypeCustom:()=>ql,getPhoneCode:()=>El,getPhoneCodeCustom:()=>Re,isPossibleNumber:()=>eu,isPossiblePhoneNumber:()=>ol,isSupportedCountry:()=>Sl,isValidNumber:()=>iu,isValidNumberCustom:()=>nu,isValidNumberForRegion:()=>uu,isValidPhoneNumber:()=>il,parse:()=>Bl,parseCustom:()=>Rl,parseDigits:()=>H,parseIncompletePhoneNumber:()=>br,parseNumber:()=>Bl,parsePhoneNumber:()=>el,parsePhoneNumberCharacter:()=>xr,parsePhoneNumberFromString:()=>nl,parsePhoneNumberWithError:()=>el,parseRFC3966:()=>wn,searchNumbers:()=>fl,searchPhoneNumbers:()=>ku,searchPhoneNumbersCustom:()=>Tu,searchPhoneNumbersInText:()=>gl,validatePhoneNumberLength:()=>cl}),Pu=n((()=>{tl(),rl(),al(),sl(),ll(),dl(),pl(),hl(),_l(),yl(),xl(),lc(),Cl(),Tl(),Dl(),kl(),jl(),Nl(),Fl(),Ll(),X(),Vl(),Kl(),Zl(),tu(),au(),du(),Ou(),Au(),Mu(),U(),zl(),Wl(),ru(),Eu(),bu(),Yl(),Kt(),qc()})),Fu=r({default:()=>Iu}),Iu,Lu=n((()=>{Iu={AC:`40123`,AD:`312345`,AE:`501234567`,AF:`701234567`,AG:`2684641234`,AI:`2642351234`,AL:`672123456`,AM:`77123456`,AO:`923123456`,AR:`91123456789`,AS:`6847331234`,AT:`664123456`,AU:`412345678`,AW:`5601234`,AX:`412345678`,AZ:`401234567`,BA:`61123456`,BB:`2462501234`,BD:`1812345678`,BE:`450001234`,BF:`70123456`,BG:`43012345`,BH:`36001234`,BI:`79561234`,BJ:`0195123456`,BL:`690001234`,BM:`4413701234`,BN:`7123456`,BO:`71234567`,BQ:`3181234`,BR:`11961234567`,BS:`2423591234`,BT:`17123456`,BW:`71123456`,BY:`294911911`,BZ:`6221234`,CA:`5062345678`,CC:`412345678`,CD:`991234567`,CF:`70012345`,CG:`061234567`,CH:`781234567`,CI:`0123456789`,CK:`71234`,CL:`221234567`,CM:`671234567`,CN:`13123456789`,CO:`3211234567`,CR:`83123456`,CU:`51234567`,CV:`9911234`,CW:`95181234`,CX:`412345678`,CY:`96123456`,CZ:`601123456`,DE:`15123456789`,DJ:`77831001`,DK:`34412345`,DM:`7672251234`,DO:`8092345678`,DZ:`551234567`,EC:`991234567`,EE:`51234567`,EG:`1001234567`,EH:`650123456`,ER:`7123456`,ES:`612345678`,ET:`911234567`,FI:`412345678`,FJ:`7012345`,FK:`51234`,FM:`3501234`,FO:`211234`,FR:`612345678`,GA:`06031234`,GB:`7400123456`,GD:`4734031234`,GE:`555123456`,GF:`694201234`,GG:`7781123456`,GH:`231234567`,GI:`57123456`,GL:`221234`,GM:`3012345`,GN:`601123456`,GP:`690001234`,GQ:`222123456`,GR:`6912345678`,GT:`51234567`,GU:`6713001234`,GW:`955012345`,GY:`6091234`,HK:`51234567`,HN:`91234567`,HR:`921234567`,HT:`34101234`,HU:`201234567`,ID:`812345678`,IE:`850123456`,IL:`502345678`,IM:`7924123456`,IN:`8123456789`,IO:`3801234`,IQ:`7912345678`,IR:`9123456789`,IS:`6111234`,IT:`3123456789`,JE:`7797712345`,JM:`8762101234`,JO:`790123456`,JP:`9012345678`,KE:`712123456`,KG:`700123456`,KH:`91234567`,KI:`72001234`,KM:`3212345`,KN:`8697652917`,KP:`1921234567`,KR:`1020000000`,KW:`50012345`,KY:`3453231234`,KZ:`7710009998`,LA:`2023123456`,LB:`71123456`,LC:`7582845678`,LI:`660234567`,LK:`712345678`,LR:`770123456`,LS:`50123456`,LT:`61234567`,LU:`628123456`,LV:`21234567`,LY:`912345678`,MA:`650123456`,MC:`612345678`,MD:`62112345`,ME:`60123456`,MF:`690001234`,MG:`321234567`,MH:`2351234`,MK:`72345678`,ML:`65012345`,MM:`92123456`,MN:`88123456`,MO:`66123456`,MP:`6702345678`,MQ:`696201234`,MR:`22123456`,MS:`6644923456`,MT:`96961234`,MU:`52512345`,MV:`7712345`,MW:`991234567`,MX:`2221234567`,MY:`123456789`,MZ:`821234567`,NA:`811234567`,NC:`751234`,NE:`93123456`,NF:`381234`,NG:`8021234567`,NI:`81234567`,NL:`612345678`,NO:`40612345`,NP:`9841234567`,NR:`5551234`,NU:`8884012`,NZ:`211234567`,OM:`92123456`,PA:`61234567`,PE:`912345678`,PF:`87123456`,PG:`70123456`,PH:`9051234567`,PK:`3012345678`,PL:`512345678`,PM:`551234`,PR:`7872345678`,PS:`599123456`,PT:`912345678`,PW:`6201234`,PY:`961456789`,QA:`33123456`,RE:`692123456`,RO:`712034567`,RS:`601234567`,RU:`9123456789`,RW:`720123456`,SA:`512345678`,SB:`7421234`,SC:`2510123`,SD:`911231234`,SE:`701234567`,SG:`81234567`,SH:`51234`,SI:`31234567`,SJ:`41234567`,SK:`912123456`,SL:`25123456`,SM:`66661212`,SN:`701234567`,SO:`71123456`,SR:`7412345`,SS:`977123456`,ST:`9812345`,SV:`70123456`,SX:`7215205678`,SY:`944567890`,SZ:`76123456`,TA:`8999`,TC:`6492311234`,TD:`63012345`,TG:`90112345`,TH:`812345678`,TJ:`917123456`,TK:`7290`,TL:`77212345`,TM:`66123456`,TN:`20123456`,TO:`7715123`,TR:`5012345678`,TT:`8682911234`,TV:`901234`,TW:`912345678`,TZ:`621234567`,UA:`501234567`,UG:`712345678`,US:`2015550123`,UY:`94231234`,UZ:`912345678`,VA:`3123456789`,VC:`7844301234`,VE:`4121234567`,VG:`2843001234`,VI:`3406421234`,VN:`912345678`,VU:`5912345`,WF:`821234`,WS:`7212345`,XK:`43201234`,YE:`712345678`,YT:`639012345`,ZA:`711234567`,ZM:`955123456`,ZW:`712345678`}})),Ru=e=>`wui-flag wui-flag-${String(e).toLowerCase()}`,Q=null,zu=null;function Bu(){return Q?Promise.resolve(Q):(zu||=Promise.all([Promise.resolve().then(()=>(Pu(),Nu)),Promise.resolve().then(()=>(Lu(),Fu))]).then(([e,t])=>(Q={AsYouType:e.AsYouType,getExampleNumber:e.getExampleNumber,isValidPhoneNumber:e.isValidPhoneNumber,examples:t.default||t},Q)).catch(()=>null),zu)}function Vu(e,t){if(!Q||!t)return t;try{return new Q.AsYouType(e).input(t)}catch{return t}}function Hu(e){if(!Q)return null;try{return Q.getExampleNumber(e,Q.examples)?.formatNational()||null}catch{return null}}function Uu(e){if(!Q||!e)return null;try{return Q.isValidPhoneNumber(e)}catch{return null}}function Wu(e){if(!Q)return null;try{let t=Q.getExampleNumber(e,Q.examples);return t?.nationalNumber?t.nationalNumber.length:null}catch{return null}}function Gu(e){if(!Q||!e?.trim().startsWith(`+`))return null;try{let t=new Q.AsYouType;t.input(e.trim());let n=t.getCountry();return n?{country:n,national:t.getNationalNumber()||``}:null}catch{return null}}var Ku=class extends HTMLElement{static formAssociated=!0;static get observedAttributes(){return[`value`,`country`,`placeholder`,`disabled`,`required`,`aria-label`,`aria-describedby`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._country=`IN`,this._national=``}connectedCallback(){this._rendered||this.render()}attributeChangedCallback(e,t,n){if(e===`value`){this.value=n;return}this._rendered&&(e===`country`&&(this._country=n||`IN`),this.render())}formResetCallback(){this.value=this._defaultValue||``}get value(){return`+${Ce(this._country)}${this._national}`}set value(e){let t=String(e??``).trim(),n=Gu(t);if(n)this._country=n.country,this._national=n.national.replace(/[^0-9]/g,``);else if(t.startsWith(`+`)){let e=t.replace(/[^0-9]/g,``),n=String(Ce(this._country));n&&e.startsWith(n)&&(e=e.slice(n.length)),this._national=e}else this._national=t.replace(/[^0-9]/g,``);n&&this.getAttribute(`country`)!==this._country?this.setAttribute(`country`,this._country):this._rendered&&this.render(),this._commit()}_commit(){f(this,this.value),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``);let e=this.getAttribute(`placeholder`)||Hu(this._country)||`Enter phone number`;this._country=this.getAttribute(`country`)||this._country;let t=Se.map(([e,t,n])=>`<button type="button" role="option" class="country-dropdown-item${e===this._country?` selected`:``}" data-iso="${e}"><span class="${Ru(e)}" aria-hidden="true"></span><span class="country-name-text">${t}<span class="country-code-text">+${n}</span></span></button>`).join(``);this.innerHTML=`
|
|
154
154
|
<div class="phone-input-wrap">
|
|
155
155
|
<div class="phone-country-adornment">
|
|
156
156
|
<button type="button" class="country-toggle" aria-haspopup="listbox" aria-expanded="false"${this.hasAttribute(`disabled`)?` disabled`:``}>
|
|
@@ -163,9 +163,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
163
163
|
<div class="country-list-scroll">${t}<div class="country-empty" hidden>No countries found</div></div>
|
|
164
164
|
</div>
|
|
165
165
|
</div>
|
|
166
|
-
<input type="tel" class="input" placeholder="${qu(e)}" value="${qu(Vu(this._country,this._national))}"${this.hasAttribute(`disabled`)?` disabled`:``} />
|
|
166
|
+
<input type="tel" class="input" placeholder="${qu(e)}" value="${qu(Vu(this._country,this._national))}"${this.getAttribute(`aria-label`)?` aria-label="${qu(this.getAttribute(`aria-label`))}"`:``}${this.getAttribute(`aria-describedby`)?` aria-describedby="${qu(this.getAttribute(`aria-describedby`))}"`:``}${this.hasAttribute(`required`)?` required aria-required="true"`:``}${this.hasAttribute(`disabled`)?` disabled`:``} />
|
|
167
167
|
</div>
|
|
168
|
-
<div class="field-error" data-phone-error hidden></div>`,this._rendered=!0,f(this,this.value),this._wire()}_wire(){let e=this.querySelector(`.country-toggle`),t=this.querySelector(`.phone-input-wrap`),n=this.querySelector(`.country-dropdown-menu`),r=this.querySelector(`.dropdown-search-input`),i=this.querySelector(`.country-list-scroll`),a=this.querySelector(`.country-empty`),o=this.querySelector(`input[type=tel]`),s=this.querySelector(`[data-flag]`),c=this.querySelector(`[data-dial]`);if(!e||!n)return;let l=()=>!n.hidden,u=()=>{let r=(t||e).getBoundingClientRect(),i=n.offsetWidth||320,a=n.offsetHeight||320,o=window.innerHeight-r.bottom,s=o<a+6&&r.top>o?r.top-a-6:r.bottom+6,c=Math.min(Math.max(8,r.left),Math.max(8,window.innerWidth-i-8));n.style.top=`${Math.max(8,s)}px`,n.style.left=`${c}px`},d=()=>{n.hidden=!1,e.setAttribute(`aria-expanded`,`true`),r.value=``,m(``),u(),r.focus()},p=()=>{n.hidden=!0,e.setAttribute(`aria-expanded`,`false`)};this._reposition=()=>{l()&&u()},window.addEventListener(`scroll`,this._reposition,!0),window.addEventListener(`resize`,this._reposition);let m=e=>{let t=e.trim().toLowerCase(),n=0;for(let e of i.querySelectorAll(`.country-dropdown-item`)){let r=!t||e.textContent.toLowerCase().includes(t);e.hidden=!r,r&&(n+=1)}a&&(a.hidden=n>0)},h=e=>{this._country=e,this.setAttribute(`country`,e),s&&(s.className=Ru(e)),c&&(c.textContent=`+${Ce(e)}`);for(let t of i.querySelectorAll(`.country-dropdown-item`))t.classList.toggle(`selected`,t.dataset.iso===e);p(),this._commit()};e.addEventListener(`click`,()=>l()?p():d()),r.addEventListener(`input`,()=>m(r.value)),i.addEventListener(`click`,e=>{let t=e.target.closest(`.country-dropdown-item`);t&&h(t.dataset.iso)});let g=this.querySelector(`[data-phone-error]`),_=e=>{if(o.classList.toggle(`is-invalid`,e),e?o.setAttribute(`aria-invalid`,`true`):o.removeAttribute(`aria-invalid`),g){if(e){let e=Hu(this._country);g.textContent=e?`Enter a valid phone number, e.g. ${e}`:`Enter a valid phone number`}g.hidden=!e}};o.addEventListener(`input`,()=>{let e=o.value.replace(/[^0-9]/g,``),t=Wu(this._country);t&&e.length>t&&(e=e.slice(0,t)),this._national=e;let n=Vu(this._country,this._national);o.value!==n&&(o.value=n),this._commit(),o.classList.contains(`is-invalid`)&&(!this._national||Uu(this.value)===!0)&&_(!1)}),o.addEventListener(`blur`,()=>{_(this._national.length>0&&Uu(this.value)===!1)}),o.addEventListener(`paste`,e=>{let t=Gu(e.clipboardData?.getData(`text`));t&&(e.preventDefault(),this._national=t.national.replace(/[^0-9]/g,``),t.country===this._country?o.value=Vu(this._country,this._national):this.setAttribute(`country`,t.country),this._commit(),this.querySelector(`input[type=tel]`)?.focus())}),this._onDocClick=e=>{l()&&!this.contains(e.target)&&p()},document.addEventListener(`click`,this._onDocClick),Bu().then(e=>{if(!(!e||!o)&&(this._national&&(o.value=Vu(this._country,this._national)),!this.getAttribute(`placeholder`))){let e=Hu(this._country);e&&(o.placeholder=e)}}),f(this,this.value)}
|
|
168
|
+
<div class="field-error" data-phone-error hidden></div>`,this._rendered=!0,f(this,this.value),this._wire()}_wire(){this._teardown();let e=this.querySelector(`.country-toggle`),t=this.querySelector(`.phone-input-wrap`),n=this.querySelector(`.country-dropdown-menu`),r=this.querySelector(`.dropdown-search-input`),i=this.querySelector(`.country-list-scroll`),a=this.querySelector(`.country-empty`),o=this.querySelector(`input[type=tel]`),s=this.querySelector(`[data-flag]`),c=this.querySelector(`[data-dial]`);if(!e||!n)return;let l=()=>!n.hidden,u=()=>{let r=(t||e).getBoundingClientRect(),i=n.offsetWidth||320,a=n.offsetHeight||320,o=window.innerHeight-r.bottom,s=o<a+6&&r.top>o?r.top-a-6:r.bottom+6,c=Math.min(Math.max(8,r.left),Math.max(8,window.innerWidth-i-8));n.style.top=`${Math.max(8,s)}px`,n.style.left=`${c}px`},d=()=>{n.hidden=!1,e.setAttribute(`aria-expanded`,`true`),r.value=``,m(``),u(),r.focus()},p=()=>{n.hidden=!0,e.setAttribute(`aria-expanded`,`false`)};this._reposition=()=>{l()&&u()},window.addEventListener(`scroll`,this._reposition,!0),window.addEventListener(`resize`,this._reposition);let m=e=>{let t=e.trim().toLowerCase(),n=0;for(let e of i.querySelectorAll(`.country-dropdown-item`)){let r=!t||e.textContent.toLowerCase().includes(t);e.hidden=!r,r&&(n+=1)}a&&(a.hidden=n>0)},h=e=>{this._country=e,this.setAttribute(`country`,e),s&&(s.className=Ru(e)),c&&(c.textContent=`+${Ce(e)}`);for(let t of i.querySelectorAll(`.country-dropdown-item`))t.classList.toggle(`selected`,t.dataset.iso===e);p(),this._commit()};e.addEventListener(`click`,()=>l()?p():d()),r.addEventListener(`input`,()=>m(r.value)),i.addEventListener(`click`,e=>{let t=e.target.closest(`.country-dropdown-item`);t&&h(t.dataset.iso)});let g=this.querySelector(`[data-phone-error]`),_=e=>{if(o.classList.toggle(`is-invalid`,e),e?o.setAttribute(`aria-invalid`,`true`):o.removeAttribute(`aria-invalid`),g){if(e){let e=Hu(this._country);g.textContent=e?`Enter a valid phone number, e.g. ${e}`:`Enter a valid phone number`}g.hidden=!e}};o.addEventListener(`input`,()=>{let e=o.value.replace(/[^0-9]/g,``),t=Wu(this._country);t&&e.length>t&&(e=e.slice(0,t)),this._national=e;let n=Vu(this._country,this._national);o.value!==n&&(o.value=n),this._commit(),o.classList.contains(`is-invalid`)&&(!this._national||Uu(this.value)===!0)&&_(!1)}),o.addEventListener(`blur`,()=>{_(this._national.length>0&&Uu(this.value)===!1)}),o.addEventListener(`paste`,e=>{let t=Gu(e.clipboardData?.getData(`text`));t&&(e.preventDefault(),this._national=t.national.replace(/[^0-9]/g,``),t.country===this._country?o.value=Vu(this._country,this._national):this.setAttribute(`country`,t.country),this._commit(),this.querySelector(`input[type=tel]`)?.focus())}),this._onDocClick=e=>{l()&&!this.contains(e.target)&&p()},document.addEventListener(`click`,this._onDocClick),Bu().then(e=>{if(!(!e||!o)&&(this._national&&(o.value=Vu(this._country,this._national)),!this.getAttribute(`placeholder`))){let e=Hu(this._country);e&&(o.placeholder=e)}}),f(this,this.value)}_teardown(){this._reposition&&(window.removeEventListener(`scroll`,this._reposition,!0),window.removeEventListener(`resize`,this._reposition)),this._onDocClick&&document.removeEventListener(`click`,this._onDocClick)}disconnectedCallback(){this._teardown()}},qu=e=>String(e??``).replace(/"/g,`"`).replace(/</g,`<`),Ju=class extends HTMLElement{static formAssociated=!0;static get observedAttributes(){return[`value`,`placeholder`,`search-placeholder`,`searchable`,`disabled`,`compact`,`size`,`clearable`,`icon`,`prefix`,`aria-label`]}_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||`Select`}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``,this._optionsProp=null,this._active=-1}connectedCallback(){this._rendered||this.render()}attributeChangedCallback(e,t,n){if(e===`value`){this.value=n;return}this._rendered&&this.render()}formResetCallback(){this.value=this._defaultValue||``}get value(){return this._value}set value(e){this._value=e==null?``:String(e),f(this,this._value),this._syncSelected(),this._syncReset()}set options(e){this._optionsProp=Array.isArray(e)?e:null,this.isConnected&&this.render()}get options(){return this._readOptions()}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>({value:e.getAttribute(`value`)??e.textContent.trim(),label:e.innerHTML,icon:e.getAttribute(`icon`)||void 0,[p]:!0,selected:e.hasAttribute(`selected`)})))}_readOptions(){return this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``),this._snapshotDeclared();let e=this._readOptions(),t=this.hasAttribute(`searchable`),n=this.hasAttribute(`clearable`),r=this.getAttribute(`size`),i=r===`sm`?` search-select-sm`:r===`lg`?` search-select-lg`:``,a=this.getAttribute(`icon`),o=this.getAttribute(`prefix`),s=this.getAttribute(`placeholder`)||`Select...`,c=this.getAttribute(`search-placeholder`)||`Search...`,l=e.find(e=>String(e.value)===String(this._value))||e.find(e=>e.selected);l&&(this._value=String(l.value)),f(this,this._value);let u=e.map(e=>{let t=String(e.value)===String(this._value);return`<button type="button" role="option" class="search-select-option${t?` selected`:``}" data-value="${Yu(e.value)}" aria-selected="${t}">${g(e)}</button>`}).join(``);this.innerHTML=`
|
|
169
169
|
<div class="search-select${this.hasAttribute(`compact`)?` search-select-compact`:``}${i}">
|
|
170
170
|
<button type="button" role="combobox" class="input search-select-control" aria-haspopup="listbox" aria-expanded="false" aria-label="${Yu(this._accessibleName())}"${this.hasAttribute(`disabled`)?` disabled`:``}>
|
|
171
171
|
${a?`<i class="bi bi-${Yu(a)} search-select-icon" aria-hidden="true"></i>`:``}
|
|
@@ -178,4 +178,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
178
178
|
${t?`<div class="search-select-search"><i class="bi bi-search" aria-hidden="true"></i><input class="search-select-input" placeholder="${Yu(c)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden><i class="bi bi-x" aria-hidden="true"></i></button></div>`:``}
|
|
179
179
|
<div class="search-select-options">${u}<div class="search-select-empty" hidden>No matches</div></div>
|
|
180
180
|
</div>
|
|
181
|
-
</div>`,this._rendered=!0,f(this,this._value),this._wire(),this._syncReset()}_refs(){return{control:this.querySelector(`.search-select-control`),menu:this.querySelector(`.search-select-menu`),label:this.querySelector(`[data-label]`),reset:this.querySelector(`.search-select-reset`),search:this.querySelector(`.search-select-input`),clear:this.querySelector(`.search-select-clear`),empty:this.querySelector(`.search-select-empty`),optionsWrap:this.querySelector(`.search-select-options`)}}_optionEls(){return[...this.querySelectorAll(`.search-select-option`)]}_visible(){return this._optionEls().filter(e=>!e.hidden)}_syncSelected(){let{label:e}=this._refs(),t=this._readOptions().find(e=>String(e.value)===String(this._value));for(let e of this._optionEls()){let t=e.dataset.value===String(this._value);e.classList.toggle(`selected`,t),e.setAttribute(`aria-selected`,String(t))}e&&(e.innerHTML=t?g(t):e.innerHTML,e.classList.toggle(`search-select-placeholder`,!t))}_syncReset(){let{reset:e}=this._refs();e&&(e.hidden=!(this.hasAttribute(`clearable`)&&this._value!==``&&!this.hasAttribute(`disabled`)))}_wire(){let e=this._refs();if(!e.control||!e.menu)return;let t=()=>{if(this.hasAttribute(`compact`)){let t=e.control.getBoundingClientRect();e.menu.style.width=`max-content`,e.menu.style.minWidth=`${t.width}px`,e.menu.style.maxWidth=`280px`,c(e.control,e.menu)}else c(e.control,e.menu,{matchWidth:!0})},n=e=>{let t=this._visible();this._active=e;for(let e of this._optionEls())e.classList.remove(`is-active`);e>=0&&t[e]&&(t[e].classList.add(`is-active`),t[e].scrollIntoView({block:`nearest`}))},r=t=>{let n=t.trim().toLowerCase(),r=0;for(let e of this._optionEls()){let t=!n||e.textContent.toLowerCase().includes(n);e.hidden=!t,t&&(r+=1)}e.empty&&(e.empty.hidden=r>0),e.clear&&(e.clear.hidden=!n)},i=()=>!e.menu.hidden,a=()=>{e.menu.hidden=!1,e.control.setAttribute(`aria-expanded`,`true`),e.control.classList.add(`open`),t(),e.search&&(e.search.value=``,r(``),e.search.focus()),n(this._optionEls().findIndex(e=>e.classList.contains(`selected`)))},o=()=>{e.menu.hidden=!0,e.control.setAttribute(`aria-expanded`,`false`),e.control.classList.remove(`open`),n(-1)},s=t=>{this.value=t.dataset.value,this.dispatchEvent(new Event(`change`,{bubbles:!0})),o(),e.control.focus()},u=t=>{let r=this._visible();t.key===`ArrowDown`?(t.preventDefault(),n(Math.min(this._active+1,r.length-1))):t.key===`ArrowUp`?(t.preventDefault(),n(Math.max(this._active-1,0))):t.key===`Enter`?(t.preventDefault(),r[this._active]&&s(r[this._active])):t.key===`Escape`&&(o(),e.control.focus())};e.reset?.addEventListener(`click`,t=>{t.stopPropagation(),this.value=``,this.dispatchEvent(new Event(`change`,{bubbles:!0})),e.control.focus()}),e.control.addEventListener(`click`,()=>i()?o():a()),e.control.addEventListener(`keydown`,e=>{if(i()){u(e);return}(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a())}),e.optionsWrap.addEventListener(`click`,e=>{let t=e.target.closest(`.search-select-option`);t&&s(t)}),e.optionsWrap.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.search-select-option`);t&&n(this._visible().indexOf(t))}),e.optionsWrap.addEventListener(`mouseleave`,()=>n(-1)),e.search?.addEventListener(`input`,()=>{r(e.search.value),n(-1)}),e.clear?.addEventListener(`click`,()=>{e.search.value=``,r(``),e.search.focus()}),e.menu.addEventListener(`keydown`,u),this._onDocClick=e=>{i()&&!this.contains(e.target)&&o()},document.addEventListener(`click`,this._onDocClick),l(this,()=>{i()&&t()})}
|
|
181
|
+
</div>`,this._rendered=!0,f(this,this._value),this._wire(),this._syncReset()}_refs(){return{control:this.querySelector(`.search-select-control`),menu:this.querySelector(`.search-select-menu`),label:this.querySelector(`[data-label]`),reset:this.querySelector(`.search-select-reset`),search:this.querySelector(`.search-select-input`),clear:this.querySelector(`.search-select-clear`),empty:this.querySelector(`.search-select-empty`),optionsWrap:this.querySelector(`.search-select-options`)}}_optionEls(){return[...this.querySelectorAll(`.search-select-option`)]}_visible(){return this._optionEls().filter(e=>!e.hidden)}_syncSelected(){let{label:e}=this._refs(),t=this._readOptions().find(e=>String(e.value)===String(this._value));for(let e of this._optionEls()){let t=e.dataset.value===String(this._value);e.classList.toggle(`selected`,t),e.setAttribute(`aria-selected`,String(t))}e&&(e.innerHTML=t?g(t):e.innerHTML,e.classList.toggle(`search-select-placeholder`,!t))}_syncReset(){let{reset:e}=this._refs();e&&(e.hidden=!(this.hasAttribute(`clearable`)&&this._value!==``&&!this.hasAttribute(`disabled`)))}_wire(){this._teardown();let e=this._refs();if(!e.control||!e.menu)return;let t=()=>{if(this.hasAttribute(`compact`)){let t=e.control.getBoundingClientRect();e.menu.style.width=`max-content`,e.menu.style.minWidth=`${t.width}px`,e.menu.style.maxWidth=`280px`,c(e.control,e.menu)}else c(e.control,e.menu,{matchWidth:!0})},n=e=>{let t=this._visible();this._active=e;for(let e of this._optionEls())e.classList.remove(`is-active`);e>=0&&t[e]&&(t[e].classList.add(`is-active`),t[e].scrollIntoView({block:`nearest`}))},r=t=>{let n=t.trim().toLowerCase(),r=0;for(let e of this._optionEls()){let t=!n||e.textContent.toLowerCase().includes(n);e.hidden=!t,t&&(r+=1)}e.empty&&(e.empty.hidden=r>0),e.clear&&(e.clear.hidden=!n)},i=()=>!e.menu.hidden,a=()=>{e.menu.hidden=!1,e.control.setAttribute(`aria-expanded`,`true`),e.control.classList.add(`open`),t(),e.search&&(e.search.value=``,r(``),e.search.focus()),n(this._optionEls().findIndex(e=>e.classList.contains(`selected`)))},o=()=>{e.menu.hidden=!0,e.control.setAttribute(`aria-expanded`,`false`),e.control.classList.remove(`open`),n(-1)},s=t=>{this.value=t.dataset.value,this.dispatchEvent(new Event(`change`,{bubbles:!0})),o(),e.control.focus()},u=t=>{let r=this._visible();t.key===`ArrowDown`?(t.preventDefault(),n(Math.min(this._active+1,r.length-1))):t.key===`ArrowUp`?(t.preventDefault(),n(Math.max(this._active-1,0))):t.key===`Enter`?(t.preventDefault(),r[this._active]&&s(r[this._active])):t.key===`Escape`&&(o(),e.control.focus())};e.reset?.addEventListener(`click`,t=>{t.stopPropagation(),this.value=``,this.dispatchEvent(new Event(`change`,{bubbles:!0})),e.control.focus()}),e.control.addEventListener(`click`,()=>i()?o():a()),e.control.addEventListener(`keydown`,e=>{if(i()){u(e);return}(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a())}),e.optionsWrap.addEventListener(`click`,e=>{let t=e.target.closest(`.search-select-option`);t&&s(t)}),e.optionsWrap.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.search-select-option`);t&&n(this._visible().indexOf(t))}),e.optionsWrap.addEventListener(`mouseleave`,()=>n(-1)),e.search?.addEventListener(`input`,()=>{r(e.search.value),n(-1)}),e.clear?.addEventListener(`click`,()=>{e.search.value=``,r(``),e.search.focus()}),e.menu.addEventListener(`keydown`,u),this._onDocClick=e=>{i()&&!this.contains(e.target)&&o()},document.addEventListener(`click`,this._onDocClick),l(this,()=>{i()&&t()})}_teardown(){this._onDocClick&&document.removeEventListener(`click`,this._onDocClick),u(this)}disconnectedCallback(){this._teardown()}},Yu=e=>String(e??``).replace(/"/g,`"`).replace(/</g,`<`),Xu=`image/png,image/jpeg,image/webp`,Zu=5,Qu={"image/png":[`.png`],"image/jpeg":[`.jpg`,`.jpeg`],"image/webp":[`.webp`],"image/gif":[`.gif`],"image/svg+xml":[`.svg`],"application/pdf":[`.pdf`]},$u={"image/png":`PNG`,"image/jpeg":`JPG`,"image/webp":`WEBP`,"image/gif":`GIF`,"image/svg+xml":`SVG`,"application/pdf":`PDF`,".png":`PNG`,".jpg":`JPG`,".jpeg":`JPG`,".webp":`WEBP`,".gif":`GIF`,".svg":`SVG`,".pdf":`PDF`},ed=e=>String(e||``).split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean),td=[`.png`,`.jpg`,`.jpeg`,`.webp`,`.gif`,`.svg`,`.bmp`,`.avif`,`.heic`];function nd(e){if(!e)return!1;let t=typeof e==`object`&&e.type?String(e.type).toLowerCase():``;if(t)return t.startsWith(`image/`);let n=typeof e==`string`?e:e.name||e.url||``,r=String(n).toLowerCase();return td.some(e=>r.endsWith(e))}function rd(e){let t=ed(e);return t.length?t.every(e=>e.startsWith(`.`)?td.includes(e):e===`image/*`||e.startsWith(`image/`)):!1}function id(e){let t=[];for(let n of ed(e)){let e=$u[n]||(n.startsWith(`.`)?n.slice(1).toUpperCase():n.toUpperCase());t.includes(e)||t.push(e)}return t.length<=1?t[0]||`supported`:`${t.slice(0,-1).join(`, `)} or ${t[t.length-1]}`}function ad(e,t){let n=ed(t);if(!n.length)return!0;let r=(e.type||``).toLowerCase(),i=(e.name||``).toLowerCase();return n.some(e=>e.startsWith(`.`)?i.endsWith(e):e.endsWith(`/*`)?r.startsWith(e.slice(0,-1)):r&&r===e?!0:!r&&(Qu[e]||[]).some(e=>i.endsWith(e)))}function od(e,t={}){if(!e)return null;let n=t.accept===void 0?Xu:t.accept,r=t.maxSizeMb||5;return ad(e,n)?e.size>r*1024*1024?`Keep the file under ${r} MB.`:null:`Choose a ${id(n)} file.`}var $=(e,t)=>{typeof customElements<`u`&&!customElements.get(e)&&customElements.define(e,t)};function sd(){$(`wui-select`,Ju),$(`wui-phone`,Ku),$(`wui-datepicker`,oe),$(`wui-date-range`,he),$(`wui-autocomplete`,_),$(`wui-multiselect`,ge),$(`wui-otp`,xe),$(`wui-status-icon`,o)}return sd(),e.DEFAULT_IMAGE_ACCEPT=Xu,e.DEFAULT_MAX_SIZE_MB=Zu,e.STATUS_TONES=a,e.WuiAutocomplete=_,e.WuiDatePicker=oe,e.WuiDateRange=he,e.WuiMultiSelect=ge,e.WuiOtp=xe,e.WuiPhone=Ku,e.WuiSelect=Ju,e.WuiStatusIcon=o,e.acceptLabel=id,e.defineWeborityElements=sd,e.isImageFile=nd,e.isImageOnlyAccept=rd,e.matchesAccept=ad,e.validateFile=od,e})({});
|
package/dist/ui-elements.js
CHANGED
|
@@ -16,7 +16,7 @@ var e = {
|
|
|
16
16
|
this.isConnected && this.render();
|
|
17
17
|
}
|
|
18
18
|
render() {
|
|
19
|
-
let t = this.getAttribute("tone"), n = this.getAttribute("size") ||
|
|
19
|
+
let t = this.getAttribute("tone"), n = Number.parseInt(this.getAttribute("size"), 10) || 72, r = e[t] || e.info;
|
|
20
20
|
this.innerHTML = `<svg width="${n}" height="${n}" viewBox="0 0 174 174" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">${r}</svg>`;
|
|
21
21
|
}
|
|
22
22
|
}, r = 4;
|
|
@@ -57,6 +57,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
57
57
|
let t = e[l] ? String(e.label ?? "") : u(e.label), n = d(e.icon);
|
|
58
58
|
return n ? `<span class="wui-opt-label">${n}${t}</span>` : t;
|
|
59
59
|
}, p = class extends HTMLElement {
|
|
60
|
+
static formAssociated = !0;
|
|
60
61
|
_accessibleName() {
|
|
61
62
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Select";
|
|
62
63
|
}
|
|
@@ -75,12 +76,24 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
75
76
|
}
|
|
76
77
|
constructor() {
|
|
77
78
|
super(), this._value = "", this._label = "", this._optionsProp = null, this._loading = !1, this._active = -1, this._timer = null;
|
|
79
|
+
try {
|
|
80
|
+
this._internals = this.attachInternals();
|
|
81
|
+
} catch {
|
|
82
|
+
this._internals = null;
|
|
83
|
+
}
|
|
78
84
|
}
|
|
79
85
|
connectedCallback() {
|
|
80
|
-
this._rendered || this.render();
|
|
86
|
+
this._rendered || (this._defaultCaptured ||= (this._defaultValue = this._value, !0), this.render());
|
|
87
|
+
}
|
|
88
|
+
formResetCallback() {
|
|
89
|
+
this.value = this._defaultValue || "";
|
|
81
90
|
}
|
|
82
91
|
attributeChangedCallback(e, t, n) {
|
|
83
|
-
|
|
92
|
+
if (e === "value") {
|
|
93
|
+
this.value = n;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
this._rendered && this.render();
|
|
84
97
|
}
|
|
85
98
|
get value() {
|
|
86
99
|
return this._value;
|
|
@@ -303,6 +316,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
303
316
|
m: t
|
|
304
317
|
};
|
|
305
318
|
}, w = class extends HTMLElement {
|
|
319
|
+
static formAssociated = !0;
|
|
306
320
|
static get observedAttributes() {
|
|
307
321
|
return [
|
|
308
322
|
"value",
|
|
@@ -311,11 +325,19 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
311
325
|
"placeholder",
|
|
312
326
|
"disabled",
|
|
313
327
|
"first-day",
|
|
314
|
-
"size"
|
|
328
|
+
"size",
|
|
329
|
+
"aria-label",
|
|
330
|
+
"aria-describedby"
|
|
315
331
|
];
|
|
316
332
|
}
|
|
317
333
|
constructor() {
|
|
318
|
-
super()
|
|
334
|
+
super();
|
|
335
|
+
try {
|
|
336
|
+
this._internals = this.attachInternals();
|
|
337
|
+
} catch {
|
|
338
|
+
this._internals = null;
|
|
339
|
+
}
|
|
340
|
+
this._value = "";
|
|
319
341
|
let e = new Date(2e3, 0, 1);
|
|
320
342
|
this._viewY = e.getFullYear(), this._viewM = e.getMonth(), this._mode = "days", this._focus = null, this._slide = "";
|
|
321
343
|
}
|
|
@@ -325,6 +347,9 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
325
347
|
attributeChangedCallback(e, t, n) {
|
|
326
348
|
this._rendered && (e === "value" ? (this._value = n || "", this._syncTrigger()) : e === "first-day" ? this.querySelector(".datepicker-pop")?.hidden || this._renderView() : this.render());
|
|
327
349
|
}
|
|
350
|
+
formResetCallback() {
|
|
351
|
+
this.value = this._defaultValue || "";
|
|
352
|
+
}
|
|
328
353
|
get value() {
|
|
329
354
|
return this._value;
|
|
330
355
|
}
|
|
@@ -336,14 +361,14 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
336
361
|
return Number.isInteger(e) && e >= 0 && e <= 6 ? e : 0;
|
|
337
362
|
}
|
|
338
363
|
render() {
|
|
339
|
-
this._value = this.getAttribute("value") || this._value;
|
|
364
|
+
this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || ""), this._value = this.getAttribute("value") || this._value;
|
|
340
365
|
let e = this.getAttribute("placeholder") || "Enter Date", t = b(this._value);
|
|
341
366
|
t && (this._viewY = t.y, this._viewM = t.m);
|
|
342
|
-
let n = this.getAttribute("size"), r = n === "sm" ? " input-sm" : n === "lg" ? " input-lg" : "";
|
|
367
|
+
let n = this.getAttribute("size"), r = n === "sm" ? " input-sm" : n === "lg" ? " input-lg" : "", i = this.getAttribute("aria-label"), a = this.getAttribute("aria-describedby");
|
|
343
368
|
this.innerHTML = `
|
|
344
369
|
<div class="datepicker">
|
|
345
|
-
<button type="button" class="input datepicker-trigger${r}${t ? " has-value" : ""}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}>
|
|
346
|
-
<span data-trigger-label class="${t ? "" : "search-select-placeholder"}">${t ? x(this._value) : e}</span>
|
|
370
|
+
<button type="button" class="input datepicker-trigger${r}${t ? " has-value" : ""}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}${i ? ` aria-label="${u(i)}"` : ""}${a ? ` aria-describedby="${u(a)}"` : ""}>
|
|
371
|
+
<span data-trigger-label class="${t ? "" : "search-select-placeholder"}">${t ? x(this._value) : u(e)}</span>
|
|
347
372
|
<i class="bi bi-calendar3" aria-hidden="true"></i>
|
|
348
373
|
</button>
|
|
349
374
|
<div class="datepicker-pop" role="dialog" aria-modal="false" hidden></div>
|
|
@@ -504,6 +529,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
504
529
|
}
|
|
505
530
|
}
|
|
506
531
|
_wire() {
|
|
532
|
+
this._teardown();
|
|
507
533
|
let e = this.querySelector(".datepicker-trigger"), t = this.querySelector(".datepicker-pop"), n = this.querySelector(".datepicker");
|
|
508
534
|
if (!e || !t) return;
|
|
509
535
|
let r = () => !t.hidden;
|
|
@@ -582,9 +608,12 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
582
608
|
r() && this._position(e, t);
|
|
583
609
|
}), this._syncFormValue();
|
|
584
610
|
}
|
|
585
|
-
|
|
611
|
+
_teardown() {
|
|
586
612
|
this._onDocClick && document.removeEventListener("click", this._onDocClick), o(this);
|
|
587
613
|
}
|
|
614
|
+
disconnectedCallback() {
|
|
615
|
+
this._teardown();
|
|
616
|
+
}
|
|
588
617
|
}, T = [
|
|
589
618
|
"January",
|
|
590
619
|
"February",
|
|
@@ -624,6 +653,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
624
653
|
m: t
|
|
625
654
|
};
|
|
626
655
|
}, M = class extends HTMLElement {
|
|
656
|
+
static formAssociated = !0;
|
|
627
657
|
static get observedAttributes() {
|
|
628
658
|
return [
|
|
629
659
|
"start",
|
|
@@ -633,11 +663,22 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
633
663
|
"placeholder",
|
|
634
664
|
"disabled",
|
|
635
665
|
"first-day",
|
|
636
|
-
"size"
|
|
666
|
+
"size",
|
|
667
|
+
"aria-label",
|
|
668
|
+
"aria-describedby",
|
|
669
|
+
"name",
|
|
670
|
+
"start-name",
|
|
671
|
+
"end-name"
|
|
637
672
|
];
|
|
638
673
|
}
|
|
639
674
|
constructor() {
|
|
640
|
-
super()
|
|
675
|
+
super();
|
|
676
|
+
try {
|
|
677
|
+
this._internals = this.attachInternals();
|
|
678
|
+
} catch {
|
|
679
|
+
this._internals = null;
|
|
680
|
+
}
|
|
681
|
+
this._start = "", this._end = "", this._hover = "";
|
|
641
682
|
let e = new Date(2e3, 0, 1);
|
|
642
683
|
this._viewY = e.getFullYear(), this._viewM = e.getMonth();
|
|
643
684
|
}
|
|
@@ -671,19 +712,25 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
671
712
|
};
|
|
672
713
|
}
|
|
673
714
|
render() {
|
|
674
|
-
this._start = this.getAttribute("start") || this._start, this._end = this.getAttribute("end") || this._end;
|
|
715
|
+
this._defaultStart === void 0 && (this._defaultStart = this.getAttribute("start") || "", this._defaultEnd = this.getAttribute("end") || ""), this._start = this.getAttribute("start") || this._start, this._end = this.getAttribute("end") || this._end;
|
|
675
716
|
let e = O(this._start);
|
|
676
717
|
e && (this._viewY = e.y, this._viewM = e.m);
|
|
677
|
-
let t = this.getAttribute("size"), n = t === "sm" ? " input-sm" : t === "lg" ? " input-lg" : "", { text: r, empty: i } = this._label();
|
|
718
|
+
let t = this.getAttribute("size"), n = t === "sm" ? " input-sm" : t === "lg" ? " input-lg" : "", { text: r, empty: i } = this._label(), a = this.getAttribute("aria-label"), o = this.getAttribute("aria-describedby");
|
|
678
719
|
this.innerHTML = `
|
|
679
720
|
<div class="daterange">
|
|
680
|
-
<button type="button" class="input daterange-trigger${n}${i ? "" : " has-value"}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}>
|
|
681
|
-
<span data-range-label class="${i ? "search-select-placeholder" : ""}">${r}</span>
|
|
721
|
+
<button type="button" class="input daterange-trigger${n}${i ? "" : " has-value"}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}${a ? ` aria-label="${u(a)}"` : ""}${o ? ` aria-describedby="${u(o)}"` : ""}>
|
|
722
|
+
<span data-range-label class="${i ? "search-select-placeholder" : ""}">${u(r)}</span>
|
|
682
723
|
<i class="bi bi-calendar-range" aria-hidden="true"></i>
|
|
683
724
|
</button>
|
|
684
725
|
<div class="daterange-pop" role="dialog" aria-modal="false" hidden></div>
|
|
685
726
|
</div>`, this._rendered = !0, this._syncMirrors(), this._wire();
|
|
686
727
|
}
|
|
728
|
+
formResetCallback() {
|
|
729
|
+
this.value = {
|
|
730
|
+
start: this._defaultStart || "",
|
|
731
|
+
end: this._defaultEnd || ""
|
|
732
|
+
};
|
|
733
|
+
}
|
|
687
734
|
_syncTrigger() {
|
|
688
735
|
let e = this.querySelector(".daterange-trigger"), t = this.querySelector("[data-range-label]");
|
|
689
736
|
if (!t) return;
|
|
@@ -697,7 +744,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
697
744
|
_mirror(e, t, n) {
|
|
698
745
|
if (!t) return;
|
|
699
746
|
let r = this.querySelector(`input[type="hidden"][data-range-mirror="${e}"]`);
|
|
700
|
-
r || (r = document.createElement("input"), r.type = "hidden", r.setAttribute("data-range-mirror", e), this.appendChild(r)), r.name = t, r.value = n || "";
|
|
747
|
+
r || (r = document.createElement("input"), r.type = "hidden", r.setAttribute("data-range-mirror", e), this.appendChild(r)), r.name = t, r.value = n || "", r.disabled = this.hasAttribute("disabled");
|
|
701
748
|
}
|
|
702
749
|
_limits() {
|
|
703
750
|
let e = O(this.getAttribute("min")), t = O(this.getAttribute("max")), n = e ? new Date(e.y, e.m, e.d).getTime() : -Infinity, r = t ? new Date(t.y, t.m, t.d).getTime() : Infinity;
|
|
@@ -762,12 +809,13 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
762
809
|
return;
|
|
763
810
|
}
|
|
764
811
|
if (new Date(e).getTime() < new Date(this._start).getTime()) {
|
|
765
|
-
this._start = e, this._paint();
|
|
812
|
+
this._start = e, this._syncTrigger(), this._syncMirrors(), this._paint();
|
|
766
813
|
return;
|
|
767
814
|
}
|
|
768
815
|
this._end = e, this._syncTrigger(), this._syncMirrors(), this._paint(), this.dispatchEvent(new Event("change", { bubbles: !0 })), this._close();
|
|
769
816
|
}
|
|
770
817
|
_wire() {
|
|
818
|
+
this._teardown();
|
|
771
819
|
let e = this.querySelector(".daterange-trigger"), t = this.querySelector(".daterange-pop"), n = this.querySelector(".daterange");
|
|
772
820
|
if (!e || !t) return;
|
|
773
821
|
let r = () => !t.hidden;
|
|
@@ -807,10 +855,14 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
807
855
|
r() && this._position(e, t);
|
|
808
856
|
}), this._syncMirrors();
|
|
809
857
|
}
|
|
810
|
-
|
|
858
|
+
_teardown() {
|
|
811
859
|
this._onDocClick && document.removeEventListener("click", this._onDocClick), this._onDocKey && document.removeEventListener("keydown", this._onDocKey), o(this);
|
|
812
860
|
}
|
|
861
|
+
disconnectedCallback() {
|
|
862
|
+
this._teardown();
|
|
863
|
+
}
|
|
813
864
|
}, N = class extends HTMLElement {
|
|
865
|
+
static formAssociated = !0;
|
|
814
866
|
_accessibleName() {
|
|
815
867
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Select";
|
|
816
868
|
}
|
|
@@ -828,6 +880,11 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
828
880
|
}
|
|
829
881
|
constructor() {
|
|
830
882
|
super(), this._values = [], this._optionsProp = null, this._active = -1;
|
|
883
|
+
try {
|
|
884
|
+
this._internals = this.attachInternals();
|
|
885
|
+
} catch {
|
|
886
|
+
this._internals = null;
|
|
887
|
+
}
|
|
831
888
|
}
|
|
832
889
|
connectedCallback() {
|
|
833
890
|
if (!this._rendered) {
|
|
@@ -835,9 +892,12 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
835
892
|
let e = [...this.querySelectorAll(":scope > wui-option[selected]")].map((e) => e.getAttribute("value") ?? e.textContent.trim());
|
|
836
893
|
e.length && (this._values = e.map(String));
|
|
837
894
|
}
|
|
838
|
-
this._valuesInit = !0, this.render();
|
|
895
|
+
this._valuesInit = !0, this._defaultCaptured ||= (this._defaultValues = this._values.slice(), !0), this.render();
|
|
839
896
|
}
|
|
840
897
|
}
|
|
898
|
+
formResetCallback() {
|
|
899
|
+
this.values = (this._defaultValues || []).slice();
|
|
900
|
+
}
|
|
841
901
|
attributeChangedCallback() {
|
|
842
902
|
this._rendered && this.render();
|
|
843
903
|
}
|
|
@@ -880,7 +940,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
880
940
|
let e = this.hasAttribute("searchable"), t = this.getAttribute("search-placeholder") || "Search…", n = this.getAttribute("icon"), r = this.getAttribute("size"), i = r === "sm" ? " search-select-sm" : r === "lg" ? " search-select-lg" : "";
|
|
881
941
|
c(this, this._values.join(",")), this.innerHTML = `
|
|
882
942
|
<div class="search-select${i}">
|
|
883
|
-
<div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-label="${P(this._accessibleName())}"${this.hasAttribute("disabled") ? " aria-disabled=\"true\"" : ""}>
|
|
943
|
+
<div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-label="${P(this._accessibleName())}"${this.hasAttribute("disabled") ? " aria-disabled=\"true\"" : " tabindex=\"0\""}>
|
|
884
944
|
${n ? `<i class="bi bi-${P(n)} search-select-icon" aria-hidden="true"></i>` : ""}
|
|
885
945
|
<div class="ms-chips" data-chips></div>
|
|
886
946
|
<i class="bi bi-chevron-down search-select-caret" aria-hidden="true"></i>
|
|
@@ -930,6 +990,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
930
990
|
}).join(""), n && (n.hidden = i.length > 0), this._active = -1;
|
|
931
991
|
}
|
|
932
992
|
_wire() {
|
|
993
|
+
this._teardown();
|
|
933
994
|
let e = this.querySelector(".search-select-control"), t = this.querySelector(".search-select-menu"), n = this.querySelector(".search-select-input"), r = this.querySelector(".search-select-clear"), o = this.querySelector(".search-select-options");
|
|
934
995
|
if (!e || !t) return;
|
|
935
996
|
let s = () => this.hasAttribute("disabled");
|
|
@@ -952,6 +1013,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
952
1013
|
this._values = this._values.filter((t) => t !== String(e)), this._renderControl(), this._renderOptions(n ? n.value : ""), g();
|
|
953
1014
|
};
|
|
954
1015
|
e.addEventListener("click", (e) => {
|
|
1016
|
+
if (s()) return;
|
|
955
1017
|
let t = e.target.closest("[data-remove]");
|
|
956
1018
|
if (t) {
|
|
957
1019
|
e.stopPropagation(), v(t.dataset.remove);
|
|
@@ -985,8 +1047,11 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
985
1047
|
p() && l();
|
|
986
1048
|
});
|
|
987
1049
|
}
|
|
1050
|
+
_teardown() {
|
|
1051
|
+
this._onDocClick && document.removeEventListener("click", this._onDocClick), o(this);
|
|
1052
|
+
}
|
|
988
1053
|
disconnectedCallback() {
|
|
989
|
-
this.
|
|
1054
|
+
this._teardown(), this._ro?.disconnect(), this._ro = null;
|
|
990
1055
|
}
|
|
991
1056
|
}, P = (e) => String(e ?? "").replace(/"/g, """).replace(/</g, "<"), te = (e) => String(e ?? "").replace(/<[^>]*>/g, ""), ne = /[^0-9]/g, re = /[^0-9a-zA-Z]/g, F = class extends HTMLElement {
|
|
992
1057
|
static get observedAttributes() {
|
|
@@ -2371,23 +2436,40 @@ function W(e) {
|
|
|
2371
2436
|
}
|
|
2372
2437
|
}
|
|
2373
2438
|
var G = class extends HTMLElement {
|
|
2439
|
+
static formAssociated = !0;
|
|
2374
2440
|
static get observedAttributes() {
|
|
2375
2441
|
return [
|
|
2376
2442
|
"value",
|
|
2377
2443
|
"country",
|
|
2378
2444
|
"placeholder",
|
|
2379
|
-
"disabled"
|
|
2445
|
+
"disabled",
|
|
2446
|
+
"required",
|
|
2447
|
+
"aria-label",
|
|
2448
|
+
"aria-describedby"
|
|
2380
2449
|
];
|
|
2381
2450
|
}
|
|
2382
2451
|
constructor() {
|
|
2383
|
-
super()
|
|
2452
|
+
super();
|
|
2453
|
+
try {
|
|
2454
|
+
this._internals = this.attachInternals();
|
|
2455
|
+
} catch {
|
|
2456
|
+
this._internals = null;
|
|
2457
|
+
}
|
|
2458
|
+
this._country = "IN", this._national = "";
|
|
2384
2459
|
}
|
|
2385
2460
|
connectedCallback() {
|
|
2386
2461
|
this._rendered || this.render();
|
|
2387
2462
|
}
|
|
2388
2463
|
attributeChangedCallback(e, t, n) {
|
|
2464
|
+
if (e === "value") {
|
|
2465
|
+
this.value = n;
|
|
2466
|
+
return;
|
|
2467
|
+
}
|
|
2389
2468
|
this._rendered && (e === "country" && (this._country = n || "IN"), this.render());
|
|
2390
2469
|
}
|
|
2470
|
+
formResetCallback() {
|
|
2471
|
+
this.value = this._defaultValue || "";
|
|
2472
|
+
}
|
|
2391
2473
|
get value() {
|
|
2392
2474
|
return `+${L(this._country)}${this._national}`;
|
|
2393
2475
|
}
|
|
@@ -2404,6 +2486,7 @@ var G = class extends HTMLElement {
|
|
|
2404
2486
|
c(this, this.value), this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2405
2487
|
}
|
|
2406
2488
|
render() {
|
|
2489
|
+
this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || "");
|
|
2407
2490
|
let e = this.getAttribute("placeholder") || H(this._country) || "Enter phone number";
|
|
2408
2491
|
this._country = this.getAttribute("country") || this._country;
|
|
2409
2492
|
let t = I.map(([e, t, n]) => `<button type="button" role="option" class="country-dropdown-item${e === this._country ? " selected" : ""}" data-iso="${e}"><span class="${R(e)}" aria-hidden="true"></span><span class="country-name-text">${t}<span class="country-code-text">+${n}</span></span></button>`).join("");
|
|
@@ -2420,11 +2503,12 @@ var G = class extends HTMLElement {
|
|
|
2420
2503
|
<div class="country-list-scroll">${t}<div class="country-empty" hidden>No countries found</div></div>
|
|
2421
2504
|
</div>
|
|
2422
2505
|
</div>
|
|
2423
|
-
<input type="tel" class="input" placeholder="${K(e)}" value="${K(V(this._country, this._national))}"${this.hasAttribute("disabled") ? " disabled" : ""} />
|
|
2506
|
+
<input type="tel" class="input" placeholder="${K(e)}" value="${K(V(this._country, this._national))}"${this.getAttribute("aria-label") ? ` aria-label="${K(this.getAttribute("aria-label"))}"` : ""}${this.getAttribute("aria-describedby") ? ` aria-describedby="${K(this.getAttribute("aria-describedby"))}"` : ""}${this.hasAttribute("required") ? " required aria-required=\"true\"" : ""}${this.hasAttribute("disabled") ? " disabled" : ""} />
|
|
2424
2507
|
</div>
|
|
2425
2508
|
<div class="field-error" data-phone-error hidden></div>`, this._rendered = !0, c(this, this.value), this._wire();
|
|
2426
2509
|
}
|
|
2427
2510
|
_wire() {
|
|
2511
|
+
this._teardown();
|
|
2428
2512
|
let e = this.querySelector(".country-toggle"), t = this.querySelector(".phone-input-wrap"), n = this.querySelector(".country-dropdown-menu"), r = this.querySelector(".dropdown-search-input"), i = this.querySelector(".country-list-scroll"), a = this.querySelector(".country-empty"), o = this.querySelector("input[type=tel]"), s = this.querySelector("[data-flag]"), l = this.querySelector("[data-dial]");
|
|
2429
2513
|
if (!e || !n) return;
|
|
2430
2514
|
let u = () => !n.hidden, d = () => {
|
|
@@ -2482,10 +2566,14 @@ var G = class extends HTMLElement {
|
|
|
2482
2566
|
}
|
|
2483
2567
|
}), c(this, this.value);
|
|
2484
2568
|
}
|
|
2485
|
-
|
|
2569
|
+
_teardown() {
|
|
2486
2570
|
this._reposition && (window.removeEventListener("scroll", this._reposition, !0), window.removeEventListener("resize", this._reposition)), this._onDocClick && document.removeEventListener("click", this._onDocClick);
|
|
2487
2571
|
}
|
|
2572
|
+
disconnectedCallback() {
|
|
2573
|
+
this._teardown();
|
|
2574
|
+
}
|
|
2488
2575
|
}, K = (e) => String(e ?? "").replace(/"/g, """).replace(/</g, "<"), q = class extends HTMLElement {
|
|
2576
|
+
static formAssociated = !0;
|
|
2489
2577
|
static get observedAttributes() {
|
|
2490
2578
|
return [
|
|
2491
2579
|
"value",
|
|
@@ -2505,7 +2593,13 @@ var G = class extends HTMLElement {
|
|
|
2505
2593
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Select";
|
|
2506
2594
|
}
|
|
2507
2595
|
constructor() {
|
|
2508
|
-
super()
|
|
2596
|
+
super();
|
|
2597
|
+
try {
|
|
2598
|
+
this._internals = this.attachInternals();
|
|
2599
|
+
} catch {
|
|
2600
|
+
this._internals = null;
|
|
2601
|
+
}
|
|
2602
|
+
this._value = "", this._optionsProp = null, this._active = -1;
|
|
2509
2603
|
}
|
|
2510
2604
|
connectedCallback() {
|
|
2511
2605
|
this._rendered || this.render();
|
|
@@ -2517,6 +2611,9 @@ var G = class extends HTMLElement {
|
|
|
2517
2611
|
}
|
|
2518
2612
|
this._rendered && this.render();
|
|
2519
2613
|
}
|
|
2614
|
+
formResetCallback() {
|
|
2615
|
+
this.value = this._defaultValue || "";
|
|
2616
|
+
}
|
|
2520
2617
|
get value() {
|
|
2521
2618
|
return this._value;
|
|
2522
2619
|
}
|
|
@@ -2544,7 +2641,7 @@ var G = class extends HTMLElement {
|
|
|
2544
2641
|
return this._optionsProp ? this._optionsProp : (this._snapshotDeclared(), this._declared || []);
|
|
2545
2642
|
}
|
|
2546
2643
|
render() {
|
|
2547
|
-
this._snapshotDeclared();
|
|
2644
|
+
this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || ""), this._snapshotDeclared();
|
|
2548
2645
|
let e = this._readOptions(), t = this.hasAttribute("searchable"), n = this.hasAttribute("clearable"), r = this.getAttribute("size"), i = r === "sm" ? " search-select-sm" : r === "lg" ? " search-select-lg" : "", a = this.getAttribute("icon"), o = this.getAttribute("prefix"), s = this.getAttribute("placeholder") || "Select...", l = this.getAttribute("search-placeholder") || "Search...", d = e.find((e) => String(e.value) === String(this._value)) || e.find((e) => e.selected);
|
|
2549
2646
|
d && (this._value = String(d.value)), c(this, this._value);
|
|
2550
2647
|
let p = e.map((e) => {
|
|
@@ -2597,6 +2694,7 @@ var G = class extends HTMLElement {
|
|
|
2597
2694
|
e && (e.hidden = !(this.hasAttribute("clearable") && this._value !== "" && !this.hasAttribute("disabled")));
|
|
2598
2695
|
}
|
|
2599
2696
|
_wire() {
|
|
2697
|
+
this._teardown();
|
|
2600
2698
|
let e = this._refs();
|
|
2601
2699
|
if (!e.control || !e.menu) return;
|
|
2602
2700
|
let t = () => {
|
|
@@ -2650,9 +2748,12 @@ var G = class extends HTMLElement {
|
|
|
2650
2748
|
o() && t();
|
|
2651
2749
|
});
|
|
2652
2750
|
}
|
|
2653
|
-
|
|
2751
|
+
_teardown() {
|
|
2654
2752
|
this._onDocClick && document.removeEventListener("click", this._onDocClick), o(this);
|
|
2655
2753
|
}
|
|
2754
|
+
disconnectedCallback() {
|
|
2755
|
+
this._teardown();
|
|
2756
|
+
}
|
|
2656
2757
|
}, J = (e) => String(e ?? "").replace(/"/g, """).replace(/</g, "<"), Y = "image/png,image/jpeg,image/webp", oe = 5, se = {
|
|
2657
2758
|
"image/png": [".png"],
|
|
2658
2759
|
"image/jpeg": [".jpg", ".jpeg"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/ui-elements",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Webority framework-agnostic UI custom elements (<wui-*>) — the single implementation of the interactive components, styled by @webority/theme. Used natively in Razor and wrapped by @webority/ui-react.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|