@popovandrii/ui-elements 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +255 -210
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var M=Object.defineProperty;var U=d=>{throw TypeError(d)};var z=(d,t,s)=>t in d?M(d,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):d[t]=s;var v=(d,t,s)=>z(d,typeof t!="symbol"?t+"":t,s),F=(d,t,s)=>t.has(d)||U("Cannot "+s);var p=(d,t,s)=>(F(d,t,"read from private field"),s?s.call(d):t.get(d)),x=(d,t,s)=>t.has(d)?U("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(d):t.set(d,s);var g=(d,t,s)=>(F(d,t,"access private method"),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var A,w,B;class T{constructor(t={}){x(this,w);v(this,"selectors");v(this,"spinBoxes");x(this,A,(t,s,r,l=0,e=0)=>{t==l||t<l?(s.classList.add(this.selectors.disabledBtn),s.disabled=!0):(s.classList.remove(this.selectors.disabledBtn),s.disabled=!1),e!==0&&(t==e||t>e?(r.classList.add(this.selectors.disabledBtn),r.disabled=!0):(r.classList.remove(this.selectors.disabledBtn),r.disabled=!1))});v(this,"getValidDataNumber",(t,s)=>{const r=t.getAttribute(`data-${s}`);return r===null||r.trim()===""||isNaN(Number(r))?0:Number(r)});const s={main:"UIsp",btn:"UIsp__btn",input:"UIsp__input",disabledBtn:"disabled"};this.selectors={...s,...t},this.spinBoxes=document.querySelectorAll(`.${this.selectors.main}`),g(this,w,B).call(this)}}A=new WeakMap,w=new WeakSet,B=function(){this.spinBoxes.forEach(t=>{const s=t.querySelectorAll(`.${this.selectors.btn}`),r=s[0],l=s[1],e=t.querySelector(`.${this.selectors.input}`),o=this.getValidDataNumber(t,"step"),i=this.getValidDataNumber(t,"min"),a=this.getValidDataNumber(t,"max"),h=u=>{t.setAttribute("aria-valuenow",String(u)),t.setAttribute("aria-valuetext",`${u} items`)};Number(e.value)<=i&&(e.value=i.toFixed(o)),a!==0?(Number(e.value)>=a&&(e.value=a.toFixed(o)),a&&t.setAttribute("aria-valuemax",a.toFixed(o))):e.value=Number(e.value).toFixed(o),i&&t.setAttribute("aria-valuemin",i.toFixed(o)),p(this,A).call(this,Number(e.value),r,l,i,a),h(e.value);let c=null;const m=(u=1)=>{e.value=String(Math.abs(Number(e.value)));let n=parseFloat(e.value)||0;n=n+1*u/Math.pow(10,o),n>a&&a!==0&&(n=a),e.value=n.toFixed(o),p(this,A).call(this,Number(e.value),r,l,i,a),h(e.value)},b=(u=1)=>{e.value=String(Math.abs(Number(e.value)));let n=parseFloat(e.value)||0;n=n-1*u/Math.pow(10,o),n<i&&(n=i),e.value=n.toFixed(o),p(this,A).call(this,Number(e.value),r,l,i,a),h(e.value)},f=(u,n=150)=>{c===null&&(c=window.setInterval(u,n))},L=()=>{c!==null&&(clearInterval(c),c=null)};l.addEventListener("mousedown",u=>{const n=u.shiftKey?3:1;f(()=>m(n))}),l.addEventListener("touchstart",()=>f(m)),["mouseup","mouseleave","mouseout","touchend","touchcancel"].forEach(u=>{l.addEventListener(u,L)}),l.addEventListener("click",u=>{const n=u.shiftKey?3:1;c===null&&m(n)}),r.addEventListener("click",u=>{const n=u.shiftKey?3:1;c===null&&b(n)}),r.addEventListener("mousedown",u=>{const n=u.shiftKey?3:1;f(()=>b(n),100)}),r.addEventListener("touchstart",()=>f(b,100)),["mouseup","mouseleave","mouseout","touchend","touchcancel"].forEach(u=>{r.addEventListener(u,L)}),e.addEventListener("keydown",u=>{const n=u.key,y=u.shiftKey?3:1;if(["Backspace","Delete","ArrowLeft","ArrowRight","Tab","Enter","Home","End"].includes(n)||(u.ctrlKey||u.metaKey)&&["a","c","v","x"].includes(n.toLowerCase()))return;if(["e","+","-"].includes(n)){u.preventDefault();return}if(n==="ArrowUp"||n==="ArrowDown"){u.preventDefault();const N=parseFloat(e.value)||0,D=1*y/Math.pow(10,o);let $=n==="ArrowUp"?N+D:N-D;$<i&&($=i),e.value=$.toFixed(o),Number(e.value)<i&&(e.value=i.toFixed(o)),Number(e.value)>a&&a!==0&&(e.value=a.toFixed(o)),p(this,A).call(this,Number(e.value),r,l,i,a),h(e.value);return}const I=n===","?".":n,C=/^[0-9]$/.test(I),q=I===".",P=e.value.includes(".");(o===0&&!C||o>0&&!(C||q)||q&&P)&&u.preventDefault()}),e.addEventListener("change",()=>{Number(e.value)<i&&(e.value=i.toFixed(o)),Number(e.value)>a&&a!==0?e.value=a.toFixed(o):e.value=Number(e.value).toFixed(o),p(this,A).call(this,Number(e.value),r,l,i,a)})})};var k,K;class _{constructor(t={}){x(this,k);v(this,"selectors");v(this,"main");const s={main:"UIsw",label:"UIsw-label"};this.selectors={...s,...t},this.main=document.querySelectorAll(`.${this.selectors.main}`),g(this,k,K).call(this)}}k=new WeakSet,K=function(){this.main.forEach(t=>{const s=t.querySelector(`.${this.selectors.label}`),r=t.querySelector("input");s&&s.id&&t.setAttribute("aria-labelledby",s.id),r&&(r.checked?t.setAttribute("aria-checked","true"):t.setAttribute("aria-checked","false"),t.addEventListener("click",()=>{r.checked=!r.checked,t.setAttribute("aria-checked",String(r.checked))}),t.addEventListener("keydown",e=>{e.key==="ArrowRight"?(r.checked=!0,l(String(r.checked)),e.preventDefault()):e.key==="ArrowLeft"&&(r.checked=!1,l(String(r.checked)),e.preventDefault())}));const l=e=>{t.setAttribute("aria-checked",String(e))}})};class E{constructor(t={}){v(this,"selectors");v(this,"main",null);v(this,"itemArrowInitialized",new WeakSet);v(this,"abortController",new AbortController);const s={idPrefix:"UI-option-",main:"UIselect",selected:"UIselect-selected",arrow:"UIselect-arrow",optionsList:"UIselect-options",search:"UIselect-options__search",items:"UIselect-options__items",excludedItems:["divider","test"]};this.selectors={...s,...t},this.main=document.querySelectorAll(`.${this.selectors.main}`),this.event(),this.initGlobalListener(this.selectors)}filterExcluded(t,s){return Array.from(t).filter(r=>!s.some(l=>typeof l=="string"?r.classList.contains(l)||r.id===l:r===l))}filterSearch(t,s){const r=s.trim().toLowerCase();return t.filter(l=>{var i,a;const e=((i=l.dataset.value)==null?void 0:i.toLowerCase())||"",o=((a=l.textContent)==null?void 0:a.toLowerCase())||"";return e.includes(r)||o.includes(r)})}destroy(){E.closeAll(this.selectors),this.abortController&&this.abortController.abort(),this.main=null}event(){var s;this.abortController=new AbortController;const t=this.abortController.signal;(s=this.main)==null||s.forEach(r=>{const l=r.querySelector(`.${this.selectors.main} input[type='hidden']`);try{if(!l)throw new Error('<input type="hidden" name="YouUniqueId">')}catch(f){return console.warn("Not found:",f.message)}const e=r.querySelector(`.${this.selectors.selected}`),o=r.querySelector(`.${this.selectors.arrow}`),i=r.querySelector(`.${this.selectors.optionsList}`),a=r.querySelector(`.${this.selectors.search} input`);o&&o.addEventListener("click",()=>{this.toggle(r,i)},{signal:t}),e.addEventListener("click",()=>{this.toggle(r,i)},{signal:t}),r.addEventListener("click",()=>{this.itemsPosition(i)},{signal:t});const h=i.querySelectorAll(`.${this.selectors.items} ul li`),c=this.filterExcluded(h,this.selectors.excludedItems),m=r.querySelector("[aria-selected='true']");m&&this.defaultSelect(r,m,e,l);var b=[];a&&a.addEventListener("input",f=>{const u=f.target.value.trim();e&&(b=this.filterSearch(c,u),u?(h.forEach(n=>n.remove()),b.forEach(n=>{var y;(y=i.querySelector(`.${this.selectors.optionsList} ul`))==null||y.appendChild(n)})):h.forEach(n=>{var y;(y=i.querySelector(`.${this.selectors.optionsList} ul`))==null||y.appendChild(n)}),this.itemArrow(r,i,e,l))}),this.itemArrow(r,i,e,l),this.items(r,i,c,e,l)},{signal:t})}itemArrow(t,s,r,l){if(this.itemArrowInitialized.has(t))return;this.itemArrowInitialized.add(t);let e=-1;const o=r.textContent?r.textContent:"",i=t.querySelector(`.${this.selectors.search} input`);t.addEventListener("keydown",a=>{i&&i.focus();const h=Array.from(s.querySelectorAll(`.${this.selectors.optionsList} ul li`)),c=this.filterExcluded(h,this.selectors.excludedItems),m=c.length;if(m!==0)if(a.key==="ArrowDown"){a.preventDefault(),t.getAttribute("aria-expanded")==="false"&&this.toggle(t,s),e=(e+1)%m,r.textContent=c[e].textContent,c.forEach(f=>f.removeAttribute("aria-selected")),c[e].setAttribute("aria-selected","true");const b=c[e].id||`${this.selectors.idPrefix}${e}`;t.setAttribute("aria-activedescendant",b),c[e].scrollIntoView({block:"nearest"})}else if(a.key==="ArrowUp"){a.preventDefault(),e=(e-1+m)%m,r.textContent=c[e].textContent,c.forEach(f=>f.removeAttribute("aria-selected")),c[e].setAttribute("aria-selected","true");const b=c[e].id||`${this.selectors.idPrefix}${e}`;t.setAttribute("aria-activedescendant",b),c[e].scrollIntoView({block:"nearest"})}else if(a.key==="Enter")if(a.preventDefault(),e>=0){r.textContent=c[e].textContent,c.forEach(f=>f.removeAttribute("aria-selected")),c[e].setAttribute("aria-selected","true");const b=c[e].id||`${this.selectors.idPrefix}${e}`;t.setAttribute("aria-activedescendant",b),l.value=String(c[e].dataset.value),this.costomEvent(t,l.value),this.close(t,s)}else this.toggle(t,s);else a.key==="Escape"&&(t.getAttribute("aria-activedescendant")||(r.textContent=o),this.close(t,s))})}itemsPosition(t){const s=t.querySelector('[aria-selected="true"]');s&&s.scrollIntoView({block:"nearest"})}items(t,s,r,l,e){r.forEach((o,i)=>{o.addEventListener("click",()=>{const a=r[i];if(a){l.textContent=a.textContent,r.forEach(c=>c.removeAttribute("aria-selected")),a.setAttribute("aria-selected","true");const h=a.id||`${this.selectors.idPrefix}${i}`;t.setAttribute("aria-expanded","false"),t.setAttribute("aria-activedescendant",h),e.value=String(r[i].dataset.value),this.costomEvent(t,e.value),this.close(t,s)}})})}defaultSelect(t,s,r,l){s&&(l.setAttribute("value",s.dataset.value??""),r.textContent=s.textContent??"",t.setAttribute("aria-activedescendant",s.id||""))}costomEvent(t,s){t.dispatchEvent(new CustomEvent("change",{detail:{val:s},bubbles:!0}))}toggle(t,s){E.closeAll(this.selectors),s.hidden?(s.hidden=!1,t.setAttribute("aria-expanded","true")):this.close(t,s)}close(t,s){s.hidden=!0,t.setAttribute("aria-expanded","false")}static closeAll(t){document.querySelectorAll(`.${t.main}`).forEach(s=>{const r=s.querySelector(`.${t.optionsList}`);r.hidden=!0,s.setAttribute("aria-expanded","false")})}initGlobalListener(t){document.addEventListener("click",s=>{const r=s.target;[...document.querySelectorAll(`.${t.main}`)].some(e=>e.contains(r))||E.closeAll(t)},{signal:this.abortController.signal})}}var S,V;class G{constructor(t={}){x(this,S);v(this,"selectors");v(this,"groups");const s={main:"UIbg",btn:"UIbg-btn",input:"UIbg-input"};this.selectors={...s,...t},this.groups=document.querySelectorAll(`.${this.selectors.main}`),g(this,S,V).call(this)}}S=new WeakSet,V=function(){this.groups.forEach(t=>{const s=t.querySelectorAll(`.${this.selectors.btn}`);s.forEach(e=>{e.addEventListener("click",()=>{s.forEach(o=>{o.setAttribute("aria-checked","false"),o.setAttribute("tabindex","-1")}),e.setAttribute("aria-checked","true"),e.setAttribute("tabindex","0"),e.focus()}),e.addEventListener("keydown",o=>{let i=Array.from(s).indexOf(e);if(o.key==="ArrowRight"&&i++,o.key==="ArrowLeft"&&i--,i<0&&(i=s.length-1),i>=s.length&&(i=0),o.key==="Enter"){const h=r[i];h&&!h.disabled&&(r.forEach(c=>{c.checked=!1,c.removeAttribute("checked")}),h.checked=!0,h.setAttribute("checked",""),h.dispatchEvent(new CustomEvent("ui-button-group-change",{detail:{id:h.id,value:h.value},bubbles:!0}))),o.preventDefault();return}const a=s[i];a&&(s.forEach(h=>h.setAttribute("tabindex","-1")),a.setAttribute("tabindex","0"),a.focus())})});const r=t.querySelectorAll(`.${this.selectors.input}`);r.forEach((e,o)=>{const i=s[o];i&&(e.tabIndex=-1,i.setAttribute("role","radio"),i.setAttribute("aria-checked",String(e.checked)),i.setAttribute("tabindex",e.checked?"0":"-1"),e.disabled?i.setAttribute("aria-disabled","true"):i.removeAttribute("aria-disabled"),e.addEventListener("click",()=>{r.forEach(a=>{a.checked=!1,a.removeAttribute("checked")}),r[o].checked=!0,r[o].setAttribute("checked",""),e.dispatchEvent(new CustomEvent("ui-button-group-change",{detail:{id:e.id,value:e.value},bubbles:!0}))}),e.addEventListener("ui-button-group-change",a=>{console.log("detail:",a.detail)}))});const l=Array.from(r).find(e=>!e.checked&&!e.disabled);if(l){const e=t.querySelector(`label[for="${l.id}"]`);e&&e.setAttribute("tabindex","0")}})};exports.ButtonGroup=G;exports.Select=E;exports.SpinBox=T;exports.Switch=_;
|
|
1
|
+
"use strict";var T=Object.defineProperty;var B=d=>{throw TypeError(d)};var _=(d,e,s)=>e in d?T(d,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):d[e]=s;var f=(d,e,s)=>_(d,typeof e!="symbol"?e+"":e,s),F=(d,e,s)=>e.has(d)||B("Cannot "+s);var E=(d,e,s)=>(F(d,e,"read from private field"),s?s.call(d):e.get(d)),p=(d,e,s)=>e.has(d)?B("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(d):e.set(d,s);var g=(d,e,s)=>(F(d,e,"access private method"),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var A,w,K;class G{constructor(e={}){p(this,w);f(this,"selectors");f(this,"spinBoxes");p(this,A,(e,s,r,a=0,t=0)=>{e==a||e<a?(s.classList.add(this.selectors.disabledBtn),s.disabled=!0):(s.classList.remove(this.selectors.disabledBtn),s.disabled=!1),t!==0&&(e==t||e>t?(r.classList.add(this.selectors.disabledBtn),r.disabled=!0):(r.classList.remove(this.selectors.disabledBtn),r.disabled=!1))});f(this,"getValidDataNumber",(e,s)=>{const r=e.getAttribute(`data-${s}`);return r===null||r.trim()===""||isNaN(Number(r))?0:Number(r)});const s={main:"UIsp",btn:"UIsp__btn",input:"UIsp__input",disabledBtn:"disabled"};this.selectors={...s,...e},this.spinBoxes=document.querySelectorAll(`.${this.selectors.main}`),g(this,w,K).call(this)}}A=new WeakMap,w=new WeakSet,K=function(){this.spinBoxes.forEach(e=>{const s=e.querySelectorAll(`.${this.selectors.btn}`),r=s[0],a=s[1],t=e.querySelector(`.${this.selectors.input}`),l=this.getValidDataNumber(e,"step"),i=this.getValidDataNumber(e,"min"),o=this.getValidDataNumber(e,"max"),h=u=>{e.setAttribute("aria-valuenow",String(u)),e.setAttribute("aria-valuetext",`${u} items`)};Number(t.value)<=i&&(t.value=i.toFixed(l)),o!==0?(Number(t.value)>=o&&(t.value=o.toFixed(l)),o&&e.setAttribute("aria-valuemax",o.toFixed(l))):t.value=Number(t.value).toFixed(l),i&&e.setAttribute("aria-valuemin",i.toFixed(l)),E(this,A).call(this,Number(t.value),r,a,i,o),h(t.value);let c=null;const m=(u=1)=>{t.value=String(Math.abs(Number(t.value)));let n=parseFloat(t.value)||0;n=n+1*u/Math.pow(10,l),n>o&&o!==0&&(n=o),t.value=n.toFixed(l),E(this,A).call(this,Number(t.value),r,a,i,o),h(t.value)},v=(u=1)=>{t.value=String(Math.abs(Number(t.value)));let n=parseFloat(t.value)||0;n=n-1*u/Math.pow(10,l),n<i&&(n=i),t.value=n.toFixed(l),E(this,A).call(this,Number(t.value),r,a,i,o),h(t.value)},b=(u,n=150)=>{c===null&&(c=window.setInterval(u,n))},L=()=>{c!==null&&(clearInterval(c),c=null)};a.addEventListener("mousedown",u=>{const n=u.shiftKey?3:1;b(()=>m(n))}),a.addEventListener("touchstart",()=>b(m)),["mouseup","mouseleave","mouseout","touchend","touchcancel"].forEach(u=>{a.addEventListener(u,L)}),a.addEventListener("click",u=>{const n=u.shiftKey?3:1;c===null&&m(n)}),r.addEventListener("click",u=>{const n=u.shiftKey?3:1;c===null&&v(n)}),r.addEventListener("mousedown",u=>{const n=u.shiftKey?3:1;b(()=>v(n),100)}),r.addEventListener("touchstart",()=>b(v,100)),["mouseup","mouseleave","mouseout","touchend","touchcancel"].forEach(u=>{r.addEventListener(u,L)}),t.addEventListener("keydown",u=>{const n=u.key,y=u.shiftKey?3:1;if(["Backspace","Delete","ArrowLeft","ArrowRight","Tab","Enter","Home","End"].includes(n)||(u.ctrlKey||u.metaKey)&&["a","c","v","x"].includes(n.toLowerCase()))return;if(["e","+","-"].includes(n)){u.preventDefault();return}if(n==="ArrowUp"||n==="ArrowDown"){u.preventDefault();const U=parseFloat(t.value)||0,D=1*y/Math.pow(10,l);let $=n==="ArrowUp"?U+D:U-D;$<i&&($=i),t.value=$.toFixed(l),Number(t.value)<i&&(t.value=i.toFixed(l)),Number(t.value)>o&&o!==0&&(t.value=o.toFixed(l)),E(this,A).call(this,Number(t.value),r,a,i,o),h(t.value);return}const I=n===","?".":n,q=/^[0-9]$/.test(I),N=I===".",z=t.value.includes(".");(l===0&&!q||l>0&&!(q||N)||N&&z)&&u.preventDefault()}),t.addEventListener("change",()=>{Number(t.value)<i&&(t.value=i.toFixed(l)),Number(t.value)>o&&o!==0?t.value=o.toFixed(l):t.value=Number(t.value).toFixed(l),E(this,A).call(this,Number(t.value),r,a,i,o)})})};var k,V;class R{constructor(e={}){p(this,k);f(this,"selectors");f(this,"main");const s={main:"UIsw",label:"UIsw-label"};this.selectors={...s,...e},this.main=document.querySelectorAll(`.${this.selectors.main}`),g(this,k,V).call(this)}}k=new WeakSet,V=function(){this.main.forEach(e=>{const s=e.querySelector(`.${this.selectors.label}`),r=e.querySelector("input");s&&s.id&&e.setAttribute("aria-labelledby",s.id),r&&(r.checked?e.setAttribute("aria-checked","true"):e.setAttribute("aria-checked","false"),e.addEventListener("click",()=>{r.checked=!r.checked,e.setAttribute("aria-checked",String(r.checked))}),e.addEventListener("keydown",t=>{t.key==="ArrowRight"?(r.checked=!0,a(String(r.checked)),t.preventDefault()):t.key==="ArrowLeft"&&(r.checked=!1,a(String(r.checked)),t.preventDefault())}));const a=t=>{e.setAttribute("aria-checked",String(t))}})};class x{constructor(e={}){f(this,"selectors");f(this,"main",null);f(this,"itemArrowInitialized",new WeakSet);f(this,"abortController",new AbortController);const s={idPrefix:"UI-option-",main:"UIselect",selected:"UIselect-selected",arrow:"UIselect-arrow",optionsList:"UIselect-options",search:"UIselect-options__search",items:"UIselect-options__items",excludedItems:["divider","test"]};this.selectors={...s,...e},this.main=document.querySelectorAll(`.${this.selectors.main}`),this.event(),this.initGlobalListener(this.selectors)}filterExcluded(e,s){return Array.from(e).filter(r=>!s.some(a=>typeof a=="string"?r.classList.contains(a)||r.id===a:r===a))}filterSearch(e,s){const r=s.trim().toLowerCase();return e.filter(a=>{var i,o;const t=((i=a.dataset.value)==null?void 0:i.toLowerCase())||"",l=((o=a.textContent)==null?void 0:o.toLowerCase())||"";return t.includes(r)||l.includes(r)})}destroy(){x.closeAll(this.selectors),this.abortController&&this.abortController.abort(),this.main=null}event(){var s;this.abortController=new AbortController;const e=this.abortController.signal;(s=this.main)==null||s.forEach(r=>{const a=r.querySelector(`.${this.selectors.main} input[type='hidden']`);try{if(!a)throw new Error('<input type="hidden" name="YouUniqueId">')}catch(b){return console.warn("Not found:",b.message)}const t=r.querySelector(`.${this.selectors.selected}`),l=r.querySelector(`.${this.selectors.arrow}`),i=r.querySelector(`.${this.selectors.optionsList}`),o=r.querySelector(`.${this.selectors.search} input`);l&&l.addEventListener("click",()=>{this.toggle(r,i)},{signal:e}),t.addEventListener("click",()=>{this.toggle(r,i)},{signal:e}),r.addEventListener("click",()=>{this.itemsPosition(i)},{signal:e});const h=i.querySelectorAll(`.${this.selectors.items} ul li`),c=this.filterExcluded(h,this.selectors.excludedItems),m=r.querySelector("[aria-selected='true']");m&&this.defaultSelect(r,m,t,a);var v=[];o&&o.addEventListener("input",b=>{const u=b.target.value.trim();t&&(v=this.filterSearch(c,u),u?(h.forEach(n=>n.remove()),v.forEach(n=>{var y;(y=i.querySelector(`.${this.selectors.optionsList} ul`))==null||y.appendChild(n)})):h.forEach(n=>{var y;(y=i.querySelector(`.${this.selectors.optionsList} ul`))==null||y.appendChild(n)}),this.itemArrow(r,i,t,a))}),this.itemArrow(r,i,t,a),this.items(r,i,c,t,a)},{signal:e})}itemArrow(e,s,r,a){if(this.itemArrowInitialized.has(e))return;this.itemArrowInitialized.add(e);let t=-1;const l=r.textContent?r.textContent:"",i=e.querySelector(`.${this.selectors.search} input`);e.addEventListener("keydown",o=>{i&&i.focus();const h=Array.from(s.querySelectorAll(`.${this.selectors.optionsList} ul li`)),c=this.filterExcluded(h,this.selectors.excludedItems),m=c.length;if(m!==0)if(o.key==="ArrowDown"){o.preventDefault(),e.getAttribute("aria-expanded")==="false"&&this.toggle(e,s),t=(t+1)%m,r.textContent=c[t].textContent,c.forEach(b=>b.removeAttribute("aria-selected")),c[t].setAttribute("aria-selected","true");const v=c[t].id||`${this.selectors.idPrefix}${t}`;e.setAttribute("aria-activedescendant",v),c[t].scrollIntoView({block:"nearest"})}else if(o.key==="ArrowUp"){o.preventDefault(),t=(t-1+m)%m,r.textContent=c[t].textContent,c.forEach(b=>b.removeAttribute("aria-selected")),c[t].setAttribute("aria-selected","true");const v=c[t].id||`${this.selectors.idPrefix}${t}`;e.setAttribute("aria-activedescendant",v),c[t].scrollIntoView({block:"nearest"})}else if(o.key==="Enter")if(o.preventDefault(),t>=0){r.textContent=c[t].textContent,c.forEach(b=>b.removeAttribute("aria-selected")),c[t].setAttribute("aria-selected","true");const v=c[t].id||`${this.selectors.idPrefix}${t}`;e.setAttribute("aria-activedescendant",v),a.value=String(c[t].dataset.value),this.costomEvent(e,a.value),this.close(e,s)}else this.toggle(e,s);else o.key==="Escape"&&(e.getAttribute("aria-activedescendant")||(r.textContent=l),this.close(e,s))})}itemsPosition(e){const s=e.querySelector('[aria-selected="true"]');s&&s.scrollIntoView({block:"nearest"})}items(e,s,r,a,t){r.forEach((l,i)=>{l.addEventListener("click",()=>{const o=r[i];if(o){a.textContent=o.textContent,r.forEach(c=>c.removeAttribute("aria-selected")),o.setAttribute("aria-selected","true");const h=o.id||`${this.selectors.idPrefix}${i}`;e.setAttribute("aria-expanded","false"),e.setAttribute("aria-activedescendant",h),t.value=String(r[i].dataset.value),this.costomEvent(e,t.value),this.close(e,s)}})})}defaultSelect(e,s,r,a){s&&(a.setAttribute("value",s.dataset.value??""),r.textContent=s.textContent??"",e.setAttribute("aria-activedescendant",s.id||""))}costomEvent(e,s){e.dispatchEvent(new CustomEvent("change",{detail:{val:s},bubbles:!0}))}toggle(e,s){x.closeAll(this.selectors),s.hidden?(s.hidden=!1,e.setAttribute("aria-expanded","true")):this.close(e,s)}close(e,s){s.hidden=!0,e.setAttribute("aria-expanded","false")}static closeAll(e){document.querySelectorAll(`.${e.main}`).forEach(s=>{const r=s.querySelector(`.${e.optionsList}`);r.hidden=!0,s.setAttribute("aria-expanded","false")})}initGlobalListener(e){document.addEventListener("click",s=>{const r=s.target;[...document.querySelectorAll(`.${e.main}`)].some(t=>t.contains(r))||x.closeAll(e)},{signal:this.abortController.signal})}}var S,P;class H{constructor(e={}){p(this,S);f(this,"selectors");f(this,"groups");const s={main:"UIbg",btn:"UIbg-btn",input:"UIbg-input"};this.selectors={...s,...e},this.groups=document.querySelectorAll(`.${this.selectors.main}`),g(this,S,P).call(this)}}S=new WeakSet,P=function(){this.groups.forEach(e=>{const s=e.querySelectorAll(`.${this.selectors.btn}`);s.forEach(t=>{t.addEventListener("click",()=>{s.forEach(l=>{l.setAttribute("aria-checked","false"),l.setAttribute("tabindex","-1")}),t.setAttribute("aria-checked","true"),t.setAttribute("tabindex","0"),t.focus()}),t.addEventListener("keydown",l=>{let i=Array.from(s).indexOf(t);if(l.key==="ArrowRight"&&i++,l.key==="ArrowLeft"&&i--,i<0&&(i=s.length-1),i>=s.length&&(i=0),l.key==="Enter"){const h=r[i];h&&!h.disabled&&(r.forEach(c=>{c.checked=!1,c.removeAttribute("checked")}),h.checked=!0,h.setAttribute("checked",""),h.dispatchEvent(new CustomEvent("ui-button-group-change",{detail:{id:h.id,value:h.value},bubbles:!0}))),l.preventDefault();return}const o=s[i];o&&(s.forEach(h=>h.setAttribute("tabindex","-1")),o.setAttribute("tabindex","0"),o.focus())})});const r=e.querySelectorAll(`.${this.selectors.input}`);r.forEach((t,l)=>{const i=s[l];i&&(t.tabIndex=-1,i.setAttribute("role","radio"),i.setAttribute("aria-checked",String(t.checked)),i.setAttribute("tabindex",t.checked?"0":"-1"),t.disabled?i.setAttribute("aria-disabled","true"):i.removeAttribute("aria-disabled"),t.addEventListener("click",()=>{r.forEach(o=>{o.checked=!1,o.removeAttribute("checked")}),r[l].checked=!0,r[l].setAttribute("checked",""),t.dispatchEvent(new CustomEvent("ui-button-group-change",{detail:{id:t.id,value:t.value},bubbles:!0}))}),t.addEventListener("ui-button-group-change",o=>{console.log("detail:",o.detail)}))});const a=Array.from(r).find(t=>!t.checked&&!t.disabled);if(a){const t=e.querySelector(`label[for="${a.id}"]`);t&&t.setAttribute("tabindex","0")}})};var C,M;class O{constructor(e={}){p(this,C);f(this,"selectors");f(this,"buttons",null);f(this,"abortController",new AbortController);const s={main:"UIb"};this.selectors={...s,...e},this.buttons=document.querySelectorAll(`.${this.selectors.main}`),g(this,C,M).call(this)}destroy(){this.abortController&&this.abortController.abort(),this.buttons=null}costomEvent(e,s){if(!s||s==="undefined"||s.trim()===""){console.log('Button data-value="" Not set!');return}console.log("dis"),e.dispatchEvent(new CustomEvent("ui-button-change",{detail:{val:s},bubbles:!0}))}}C=new WeakSet,M=function(){var s;this.abortController=new AbortController;const e=this.abortController.signal;(s=this.buttons)==null||s.forEach(r=>{r.addEventListener("click",()=>{this.costomEvent(r,String(r.dataset.value))},{signal:e})})};exports.Button=O;exports.ButtonGroup=H;exports.Select=x;exports.SpinBox=G;exports.Switch=R;
|
package/dist/index.d.ts
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var _ = Object.defineProperty;
|
|
2
|
+
var F = (d) => {
|
|
3
|
+
throw TypeError(d);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var A,
|
|
10
|
-
class
|
|
11
|
-
constructor(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
var T = (d, e, s) => e in d ? _(d, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : d[e] = s;
|
|
6
|
+
var f = (d, e, s) => T(d, typeof e != "symbol" ? e + "" : e, s), B = (d, e, s) => e.has(d) || F("Cannot " + s);
|
|
7
|
+
var y = (d, e, s) => (B(d, e, "read from private field"), s ? s.call(d) : e.get(d)), p = (d, e, s) => e.has(d) ? F("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(d) : e.set(d, s);
|
|
8
|
+
var g = (d, e, s) => (B(d, e, "access private method"), s);
|
|
9
|
+
var A, w, K;
|
|
10
|
+
class H {
|
|
11
|
+
constructor(e = {}) {
|
|
12
|
+
p(this, w);
|
|
13
|
+
f(this, "selectors");
|
|
14
|
+
f(this, "spinBoxes");
|
|
15
|
+
p(this, A, (e, s, r, a = 0, t = 0) => {
|
|
16
|
+
e == a || e < a ? (s.classList.add(this.selectors.disabledBtn), s.disabled = !0) : (s.classList.remove(this.selectors.disabledBtn), s.disabled = !1), t !== 0 && (e == t || e > t ? (r.classList.add(this.selectors.disabledBtn), r.disabled = !0) : (r.classList.remove(this.selectors.disabledBtn), r.disabled = !1));
|
|
17
17
|
});
|
|
18
|
-
|
|
19
|
-
const r =
|
|
18
|
+
f(this, "getValidDataNumber", (e, s) => {
|
|
19
|
+
const r = e.getAttribute(`data-${s}`);
|
|
20
20
|
return r === null || r.trim() === "" || isNaN(Number(r)) ? 0 : Number(r);
|
|
21
21
|
});
|
|
22
22
|
const s = {
|
|
@@ -25,57 +25,57 @@ class G {
|
|
|
25
25
|
input: "UIsp__input",
|
|
26
26
|
disabledBtn: "disabled"
|
|
27
27
|
};
|
|
28
|
-
this.selectors = { ...s, ...
|
|
28
|
+
this.selectors = { ...s, ...e }, this.spinBoxes = document.querySelectorAll(
|
|
29
29
|
`.${this.selectors.main}`
|
|
30
|
-
),
|
|
30
|
+
), g(this, w, K).call(this);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
A = new WeakMap(),
|
|
34
|
-
this.spinBoxes.forEach((
|
|
35
|
-
const s =
|
|
33
|
+
A = new WeakMap(), w = new WeakSet(), K = function() {
|
|
34
|
+
this.spinBoxes.forEach((e) => {
|
|
35
|
+
const s = e.querySelectorAll(
|
|
36
36
|
`.${this.selectors.btn}`
|
|
37
|
-
), r = s[0],
|
|
37
|
+
), r = s[0], a = s[1], t = e.querySelector(
|
|
38
38
|
`.${this.selectors.input}`
|
|
39
|
-
),
|
|
40
|
-
|
|
39
|
+
), l = this.getValidDataNumber(e, "step"), i = this.getValidDataNumber(e, "min"), o = this.getValidDataNumber(e, "max"), h = (u) => {
|
|
40
|
+
e.setAttribute("aria-valuenow", String(u)), e.setAttribute("aria-valuetext", `${u} items`);
|
|
41
41
|
};
|
|
42
|
-
Number(
|
|
42
|
+
Number(t.value) <= i && (t.value = i.toFixed(l)), o !== 0 ? (Number(t.value) >= o && (t.value = o.toFixed(l)), o && e.setAttribute("aria-valuemax", o.toFixed(l))) : t.value = Number(t.value).toFixed(l), i && e.setAttribute("aria-valuemin", i.toFixed(l)), y(this, A).call(this, Number(t.value), r, a, i, o), h(t.value);
|
|
43
43
|
let c = null;
|
|
44
|
-
const m = (
|
|
45
|
-
|
|
46
|
-
let n = parseFloat(
|
|
47
|
-
n = n + 1 *
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
let n = parseFloat(
|
|
51
|
-
n = n - 1 *
|
|
52
|
-
},
|
|
53
|
-
c === null && (c = window.setInterval(
|
|
44
|
+
const m = (u = 1) => {
|
|
45
|
+
t.value = String(Math.abs(Number(t.value)));
|
|
46
|
+
let n = parseFloat(t.value) || 0;
|
|
47
|
+
n = n + 1 * u / Math.pow(10, l), n > o && o !== 0 && (n = o), t.value = n.toFixed(l), y(this, A).call(this, Number(t.value), r, a, i, o), h(t.value);
|
|
48
|
+
}, v = (u = 1) => {
|
|
49
|
+
t.value = String(Math.abs(Number(t.value)));
|
|
50
|
+
let n = parseFloat(t.value) || 0;
|
|
51
|
+
n = n - 1 * u / Math.pow(10, l), n < i && (n = i), t.value = n.toFixed(l), y(this, A).call(this, Number(t.value), r, a, i, o), h(t.value);
|
|
52
|
+
}, b = (u, n = 150) => {
|
|
53
|
+
c === null && (c = window.setInterval(u, n));
|
|
54
54
|
}, L = () => {
|
|
55
55
|
c !== null && (clearInterval(c), c = null);
|
|
56
56
|
};
|
|
57
|
-
|
|
58
|
-
const n =
|
|
59
|
-
|
|
60
|
-
}),
|
|
61
|
-
(
|
|
62
|
-
|
|
57
|
+
a.addEventListener("mousedown", (u) => {
|
|
58
|
+
const n = u.shiftKey ? 3 : 1;
|
|
59
|
+
b(() => m(n));
|
|
60
|
+
}), a.addEventListener("touchstart", () => b(m)), ["mouseup", "mouseleave", "mouseout", "touchend", "touchcancel"].forEach(
|
|
61
|
+
(u) => {
|
|
62
|
+
a.addEventListener(u, L);
|
|
63
63
|
}
|
|
64
|
-
),
|
|
65
|
-
const n =
|
|
64
|
+
), a.addEventListener("click", (u) => {
|
|
65
|
+
const n = u.shiftKey ? 3 : 1;
|
|
66
66
|
c === null && m(n);
|
|
67
|
-
}), r.addEventListener("click", (
|
|
68
|
-
const n =
|
|
69
|
-
c === null &&
|
|
70
|
-
}), r.addEventListener("mousedown", (
|
|
71
|
-
const n =
|
|
72
|
-
|
|
73
|
-
}), r.addEventListener("touchstart", () =>
|
|
74
|
-
(
|
|
75
|
-
r.addEventListener(
|
|
67
|
+
}), r.addEventListener("click", (u) => {
|
|
68
|
+
const n = u.shiftKey ? 3 : 1;
|
|
69
|
+
c === null && v(n);
|
|
70
|
+
}), r.addEventListener("mousedown", (u) => {
|
|
71
|
+
const n = u.shiftKey ? 3 : 1;
|
|
72
|
+
b(() => v(n), 100);
|
|
73
|
+
}), r.addEventListener("touchstart", () => b(v, 100)), ["mouseup", "mouseleave", "mouseout", "touchend", "touchcancel"].forEach(
|
|
74
|
+
(u) => {
|
|
75
|
+
r.addEventListener(u, L);
|
|
76
76
|
}
|
|
77
|
-
),
|
|
78
|
-
const n =
|
|
77
|
+
), t.addEventListener("keydown", (u) => {
|
|
78
|
+
const n = u.key, E = u.shiftKey ? 3 : 1;
|
|
79
79
|
if ([
|
|
80
80
|
"Backspace",
|
|
81
81
|
"Delete",
|
|
@@ -85,60 +85,60 @@ A = new WeakMap(), k = new WeakSet(), B = function() {
|
|
|
85
85
|
"Enter",
|
|
86
86
|
"Home",
|
|
87
87
|
"End"
|
|
88
|
-
].includes(n) || (
|
|
88
|
+
].includes(n) || (u.ctrlKey || u.metaKey) && ["a", "c", "v", "x"].includes(n.toLowerCase()))
|
|
89
89
|
return;
|
|
90
90
|
if (["e", "+", "-"].includes(n)) {
|
|
91
|
-
|
|
91
|
+
u.preventDefault();
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
if (n === "ArrowUp" || n === "ArrowDown") {
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
let $ = n === "ArrowUp" ?
|
|
98
|
-
$ < i && ($ = i),
|
|
95
|
+
u.preventDefault();
|
|
96
|
+
const U = parseFloat(t.value) || 0, D = 1 * E / Math.pow(10, l);
|
|
97
|
+
let $ = n === "ArrowUp" ? U + D : U - D;
|
|
98
|
+
$ < i && ($ = i), t.value = $.toFixed(l), Number(t.value) < i && (t.value = i.toFixed(l)), Number(t.value) > o && o !== 0 && (t.value = o.toFixed(l)), y(this, A).call(this, Number(t.value), r, a, i, o), h(t.value);
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
-
const I = n === "," ? "." : n,
|
|
102
|
-
(
|
|
103
|
-
}),
|
|
104
|
-
Number(
|
|
101
|
+
const I = n === "," ? "." : n, q = /^[0-9]$/.test(I), N = I === ".", M = t.value.includes(".");
|
|
102
|
+
(l === 0 && !q || l > 0 && !(q || N) || N && M) && u.preventDefault();
|
|
103
|
+
}), t.addEventListener("change", () => {
|
|
104
|
+
Number(t.value) < i && (t.value = i.toFixed(l)), Number(t.value) > o && o !== 0 ? t.value = o.toFixed(l) : t.value = Number(t.value).toFixed(l), y(this, A).call(this, Number(t.value), r, a, i, o);
|
|
105
105
|
});
|
|
106
106
|
});
|
|
107
107
|
};
|
|
108
|
-
var
|
|
109
|
-
class
|
|
110
|
-
constructor(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
var k, V;
|
|
109
|
+
class O {
|
|
110
|
+
constructor(e = {}) {
|
|
111
|
+
p(this, k);
|
|
112
|
+
f(this, "selectors");
|
|
113
|
+
f(this, "main");
|
|
114
114
|
const s = {
|
|
115
115
|
main: "UIsw",
|
|
116
116
|
label: "UIsw-label"
|
|
117
117
|
};
|
|
118
|
-
this.selectors = { ...s, ...
|
|
118
|
+
this.selectors = { ...s, ...e }, this.main = document.querySelectorAll(
|
|
119
119
|
`.${this.selectors.main}`
|
|
120
|
-
),
|
|
120
|
+
), g(this, k, V).call(this);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
|
|
124
|
-
this.main.forEach((
|
|
125
|
-
const s =
|
|
126
|
-
s && s.id &&
|
|
127
|
-
r.checked = !r.checked,
|
|
128
|
-
}),
|
|
129
|
-
|
|
123
|
+
k = new WeakSet(), V = function() {
|
|
124
|
+
this.main.forEach((e) => {
|
|
125
|
+
const s = e.querySelector(`.${this.selectors.label}`), r = e.querySelector("input");
|
|
126
|
+
s && s.id && e.setAttribute("aria-labelledby", s.id), r && (r.checked ? e.setAttribute("aria-checked", "true") : e.setAttribute("aria-checked", "false"), e.addEventListener("click", () => {
|
|
127
|
+
r.checked = !r.checked, e.setAttribute("aria-checked", String(r.checked));
|
|
128
|
+
}), e.addEventListener("keydown", (t) => {
|
|
129
|
+
t.key === "ArrowRight" ? (r.checked = !0, a(String(r.checked)), t.preventDefault()) : t.key === "ArrowLeft" && (r.checked = !1, a(String(r.checked)), t.preventDefault());
|
|
130
130
|
}));
|
|
131
|
-
const
|
|
132
|
-
|
|
131
|
+
const a = (t) => {
|
|
132
|
+
e.setAttribute("aria-checked", String(t));
|
|
133
133
|
};
|
|
134
134
|
});
|
|
135
135
|
};
|
|
136
|
-
class
|
|
137
|
-
constructor(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
136
|
+
class x {
|
|
137
|
+
constructor(e = {}) {
|
|
138
|
+
f(this, "selectors");
|
|
139
|
+
f(this, "main", null);
|
|
140
|
+
f(this, "itemArrowInitialized", /* @__PURE__ */ new WeakSet());
|
|
141
|
+
f(this, "abortController", new AbortController());
|
|
142
142
|
const s = {
|
|
143
143
|
idPrefix: "UI-option-",
|
|
144
144
|
main: "UIselect",
|
|
@@ -150,66 +150,66 @@ class g {
|
|
|
150
150
|
excludedItems: ["divider", "test"]
|
|
151
151
|
// class=""
|
|
152
152
|
};
|
|
153
|
-
this.selectors = { ...s, ...
|
|
153
|
+
this.selectors = { ...s, ...e }, this.main = document.querySelectorAll(
|
|
154
154
|
`.${this.selectors.main}`
|
|
155
155
|
), this.event(), this.initGlobalListener(this.selectors);
|
|
156
156
|
}
|
|
157
|
-
filterExcluded(
|
|
158
|
-
return Array.from(
|
|
157
|
+
filterExcluded(e, s) {
|
|
158
|
+
return Array.from(e).filter((r) => !s.some((a) => typeof a == "string" ? r.classList.contains(a) || r.id === a : r === a));
|
|
159
159
|
}
|
|
160
|
-
filterSearch(
|
|
160
|
+
filterSearch(e, s) {
|
|
161
161
|
const r = s.trim().toLowerCase();
|
|
162
|
-
return
|
|
163
|
-
var i,
|
|
164
|
-
const
|
|
165
|
-
return
|
|
162
|
+
return e.filter((a) => {
|
|
163
|
+
var i, o;
|
|
164
|
+
const t = ((i = a.dataset.value) == null ? void 0 : i.toLowerCase()) || "", l = ((o = a.textContent) == null ? void 0 : o.toLowerCase()) || "";
|
|
165
|
+
return t.includes(r) || l.includes(r);
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
destroy() {
|
|
169
|
-
|
|
169
|
+
x.closeAll(this.selectors), this.abortController && this.abortController.abort(), this.main = null;
|
|
170
170
|
}
|
|
171
171
|
event() {
|
|
172
172
|
var s;
|
|
173
173
|
this.abortController = new AbortController();
|
|
174
|
-
const
|
|
174
|
+
const e = this.abortController.signal;
|
|
175
175
|
(s = this.main) == null || s.forEach(
|
|
176
176
|
(r) => {
|
|
177
|
-
const
|
|
177
|
+
const a = r.querySelector(
|
|
178
178
|
`.${this.selectors.main} input[type='hidden']`
|
|
179
179
|
);
|
|
180
180
|
try {
|
|
181
|
-
if (!
|
|
181
|
+
if (!a)
|
|
182
182
|
throw new Error('<input type="hidden" name="YouUniqueId">');
|
|
183
|
-
} catch (
|
|
184
|
-
return console.warn("Not found:",
|
|
183
|
+
} catch (b) {
|
|
184
|
+
return console.warn("Not found:", b.message);
|
|
185
185
|
}
|
|
186
|
-
const
|
|
186
|
+
const t = r.querySelector(
|
|
187
187
|
`.${this.selectors.selected}`
|
|
188
|
-
),
|
|
188
|
+
), l = r.querySelector(
|
|
189
189
|
`.${this.selectors.arrow}`
|
|
190
190
|
), i = r.querySelector(
|
|
191
191
|
`.${this.selectors.optionsList}`
|
|
192
|
-
),
|
|
192
|
+
), o = r.querySelector(
|
|
193
193
|
`.${this.selectors.search} input`
|
|
194
194
|
);
|
|
195
|
-
|
|
195
|
+
l && l.addEventListener(
|
|
196
196
|
"click",
|
|
197
197
|
() => {
|
|
198
198
|
this.toggle(r, i);
|
|
199
199
|
},
|
|
200
|
-
{ signal:
|
|
201
|
-
),
|
|
200
|
+
{ signal: e }
|
|
201
|
+
), t.addEventListener(
|
|
202
202
|
"click",
|
|
203
203
|
() => {
|
|
204
204
|
this.toggle(r, i);
|
|
205
205
|
},
|
|
206
|
-
{ signal:
|
|
206
|
+
{ signal: e }
|
|
207
207
|
), r.addEventListener(
|
|
208
208
|
"click",
|
|
209
209
|
() => {
|
|
210
210
|
this.itemsPosition(i);
|
|
211
211
|
},
|
|
212
|
-
{ signal:
|
|
212
|
+
{ signal: e }
|
|
213
213
|
);
|
|
214
214
|
const h = i.querySelectorAll(
|
|
215
215
|
`.${this.selectors.items} ul li`
|
|
@@ -219,30 +219,30 @@ class g {
|
|
|
219
219
|
), m = r.querySelector(
|
|
220
220
|
"[aria-selected='true']"
|
|
221
221
|
);
|
|
222
|
-
m && this.defaultSelect(r, m,
|
|
223
|
-
var
|
|
224
|
-
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
var
|
|
228
|
-
(
|
|
222
|
+
m && this.defaultSelect(r, m, t, a);
|
|
223
|
+
var v = [];
|
|
224
|
+
o && o.addEventListener("input", (b) => {
|
|
225
|
+
const u = b.target.value.trim();
|
|
226
|
+
t && (v = this.filterSearch(c, u), u ? (h.forEach((n) => n.remove()), v.forEach((n) => {
|
|
227
|
+
var E;
|
|
228
|
+
(E = i.querySelector(`.${this.selectors.optionsList} ul`)) == null || E.appendChild(n);
|
|
229
229
|
})) : h.forEach((n) => {
|
|
230
|
-
var
|
|
231
|
-
(
|
|
232
|
-
}), this.itemArrow(r, i,
|
|
233
|
-
}), this.itemArrow(r, i,
|
|
230
|
+
var E;
|
|
231
|
+
(E = i.querySelector(`.${this.selectors.optionsList} ul`)) == null || E.appendChild(n);
|
|
232
|
+
}), this.itemArrow(r, i, t, a));
|
|
233
|
+
}), this.itemArrow(r, i, t, a), this.items(r, i, c, t, a);
|
|
234
234
|
},
|
|
235
|
-
{ signal:
|
|
235
|
+
{ signal: e }
|
|
236
236
|
);
|
|
237
237
|
}
|
|
238
|
-
itemArrow(
|
|
239
|
-
if (this.itemArrowInitialized.has(
|
|
240
|
-
this.itemArrowInitialized.add(
|
|
241
|
-
let
|
|
242
|
-
const
|
|
238
|
+
itemArrow(e, s, r, a) {
|
|
239
|
+
if (this.itemArrowInitialized.has(e)) return;
|
|
240
|
+
this.itemArrowInitialized.add(e);
|
|
241
|
+
let t = -1;
|
|
242
|
+
const l = r.textContent ? r.textContent : "", i = e.querySelector(
|
|
243
243
|
`.${this.selectors.search} input`
|
|
244
244
|
);
|
|
245
|
-
|
|
245
|
+
e.addEventListener("keydown", (o) => {
|
|
246
246
|
i && i.focus();
|
|
247
247
|
const h = Array.from(
|
|
248
248
|
s.querySelectorAll(`.${this.selectors.optionsList} ul li`)
|
|
@@ -251,107 +251,107 @@ class g {
|
|
|
251
251
|
this.selectors.excludedItems
|
|
252
252
|
), m = c.length;
|
|
253
253
|
if (m !== 0)
|
|
254
|
-
if (
|
|
255
|
-
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
} else if (
|
|
259
|
-
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
} else if (
|
|
263
|
-
if (
|
|
264
|
-
r.textContent = c[
|
|
265
|
-
const
|
|
266
|
-
|
|
254
|
+
if (o.key === "ArrowDown") {
|
|
255
|
+
o.preventDefault(), e.getAttribute("aria-expanded") === "false" && this.toggle(e, s), t = (t + 1) % m, r.textContent = c[t].textContent, c.forEach((b) => b.removeAttribute("aria-selected")), c[t].setAttribute("aria-selected", "true");
|
|
256
|
+
const v = c[t].id || `${this.selectors.idPrefix}${t}`;
|
|
257
|
+
e.setAttribute("aria-activedescendant", v), c[t].scrollIntoView({ block: "nearest" });
|
|
258
|
+
} else if (o.key === "ArrowUp") {
|
|
259
|
+
o.preventDefault(), t = (t - 1 + m) % m, r.textContent = c[t].textContent, c.forEach((b) => b.removeAttribute("aria-selected")), c[t].setAttribute("aria-selected", "true");
|
|
260
|
+
const v = c[t].id || `${this.selectors.idPrefix}${t}`;
|
|
261
|
+
e.setAttribute("aria-activedescendant", v), c[t].scrollIntoView({ block: "nearest" });
|
|
262
|
+
} else if (o.key === "Enter")
|
|
263
|
+
if (o.preventDefault(), t >= 0) {
|
|
264
|
+
r.textContent = c[t].textContent, c.forEach((b) => b.removeAttribute("aria-selected")), c[t].setAttribute("aria-selected", "true");
|
|
265
|
+
const v = c[t].id || `${this.selectors.idPrefix}${t}`;
|
|
266
|
+
e.setAttribute("aria-activedescendant", v), a.value = String(c[t].dataset.value), this.costomEvent(e, a.value), this.close(e, s);
|
|
267
267
|
} else
|
|
268
|
-
this.toggle(
|
|
269
|
-
else
|
|
268
|
+
this.toggle(e, s);
|
|
269
|
+
else o.key === "Escape" && (e.getAttribute("aria-activedescendant") || (r.textContent = l), this.close(e, s));
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
|
-
itemsPosition(
|
|
273
|
-
const s =
|
|
272
|
+
itemsPosition(e) {
|
|
273
|
+
const s = e.querySelector(
|
|
274
274
|
'[aria-selected="true"]'
|
|
275
275
|
);
|
|
276
276
|
s && s.scrollIntoView({ block: "nearest" });
|
|
277
277
|
}
|
|
278
|
-
items(
|
|
279
|
-
r.forEach((
|
|
280
|
-
|
|
281
|
-
const
|
|
282
|
-
if (
|
|
283
|
-
|
|
284
|
-
const h =
|
|
285
|
-
|
|
278
|
+
items(e, s, r, a, t) {
|
|
279
|
+
r.forEach((l, i) => {
|
|
280
|
+
l.addEventListener("click", () => {
|
|
281
|
+
const o = r[i];
|
|
282
|
+
if (o) {
|
|
283
|
+
a.textContent = o.textContent, r.forEach((c) => c.removeAttribute("aria-selected")), o.setAttribute("aria-selected", "true");
|
|
284
|
+
const h = o.id || `${this.selectors.idPrefix}${i}`;
|
|
285
|
+
e.setAttribute("aria-expanded", "false"), e.setAttribute("aria-activedescendant", h), t.value = String(r[i].dataset.value), this.costomEvent(e, t.value), this.close(e, s);
|
|
286
286
|
}
|
|
287
287
|
});
|
|
288
288
|
});
|
|
289
289
|
}
|
|
290
|
-
defaultSelect(
|
|
291
|
-
s && (
|
|
290
|
+
defaultSelect(e, s, r, a) {
|
|
291
|
+
s && (a.setAttribute("value", s.dataset.value ?? ""), r.textContent = s.textContent ?? "", e.setAttribute("aria-activedescendant", s.id || ""));
|
|
292
292
|
}
|
|
293
|
-
costomEvent(
|
|
294
|
-
|
|
293
|
+
costomEvent(e, s) {
|
|
294
|
+
e.dispatchEvent(
|
|
295
295
|
new CustomEvent("change", {
|
|
296
296
|
detail: { val: s },
|
|
297
297
|
bubbles: !0
|
|
298
298
|
})
|
|
299
299
|
);
|
|
300
300
|
}
|
|
301
|
-
toggle(
|
|
302
|
-
|
|
301
|
+
toggle(e, s) {
|
|
302
|
+
x.closeAll(this.selectors), s.hidden ? (s.hidden = !1, e.setAttribute("aria-expanded", "true")) : this.close(e, s);
|
|
303
303
|
}
|
|
304
|
-
close(
|
|
305
|
-
s.hidden = !0,
|
|
304
|
+
close(e, s) {
|
|
305
|
+
s.hidden = !0, e.setAttribute("aria-expanded", "false");
|
|
306
306
|
}
|
|
307
|
-
static closeAll(
|
|
308
|
-
document.querySelectorAll(`.${
|
|
309
|
-
const r = s.querySelector(`.${
|
|
307
|
+
static closeAll(e) {
|
|
308
|
+
document.querySelectorAll(`.${e.main}`).forEach((s) => {
|
|
309
|
+
const r = s.querySelector(`.${e.optionsList}`);
|
|
310
310
|
r.hidden = !0, s.setAttribute("aria-expanded", "false");
|
|
311
311
|
});
|
|
312
312
|
}
|
|
313
|
-
initGlobalListener(
|
|
313
|
+
initGlobalListener(e) {
|
|
314
314
|
document.addEventListener(
|
|
315
315
|
"click",
|
|
316
316
|
(s) => {
|
|
317
317
|
const r = s.target;
|
|
318
|
-
[...document.querySelectorAll(`.${
|
|
319
|
-
(
|
|
320
|
-
) ||
|
|
318
|
+
[...document.querySelectorAll(`.${e.main}`)].some(
|
|
319
|
+
(t) => t.contains(r)
|
|
320
|
+
) || x.closeAll(e);
|
|
321
321
|
},
|
|
322
322
|
{ signal: this.abortController.signal }
|
|
323
323
|
);
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
-
var S,
|
|
327
|
-
class
|
|
328
|
-
constructor(
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
326
|
+
var S, P;
|
|
327
|
+
class Q {
|
|
328
|
+
constructor(e = {}) {
|
|
329
|
+
p(this, S);
|
|
330
|
+
f(this, "selectors");
|
|
331
|
+
f(this, "groups");
|
|
332
332
|
const s = {
|
|
333
333
|
main: "UIbg",
|
|
334
334
|
btn: "UIbg-btn",
|
|
335
335
|
input: "UIbg-input"
|
|
336
336
|
};
|
|
337
|
-
this.selectors = { ...s, ...
|
|
337
|
+
this.selectors = { ...s, ...e }, this.groups = document.querySelectorAll(
|
|
338
338
|
`.${this.selectors.main}`
|
|
339
|
-
),
|
|
339
|
+
), g(this, S, P).call(this);
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
|
-
S = new WeakSet(),
|
|
343
|
-
this.groups.forEach((
|
|
344
|
-
const s =
|
|
342
|
+
S = new WeakSet(), P = function() {
|
|
343
|
+
this.groups.forEach((e) => {
|
|
344
|
+
const s = e.querySelectorAll(
|
|
345
345
|
`.${this.selectors.btn}`
|
|
346
346
|
);
|
|
347
|
-
s.forEach((
|
|
348
|
-
|
|
349
|
-
s.forEach((
|
|
350
|
-
|
|
351
|
-
}),
|
|
352
|
-
}),
|
|
353
|
-
let i = Array.from(s).indexOf(
|
|
354
|
-
if (
|
|
347
|
+
s.forEach((t) => {
|
|
348
|
+
t.addEventListener("click", () => {
|
|
349
|
+
s.forEach((l) => {
|
|
350
|
+
l.setAttribute("aria-checked", "false"), l.setAttribute("tabindex", "-1");
|
|
351
|
+
}), t.setAttribute("aria-checked", "true"), t.setAttribute("tabindex", "0"), t.focus();
|
|
352
|
+
}), t.addEventListener("keydown", (l) => {
|
|
353
|
+
let i = Array.from(s).indexOf(t);
|
|
354
|
+
if (l.key === "ArrowRight" && i++, l.key === "ArrowLeft" && i--, i < 0 && (i = s.length - 1), i >= s.length && (i = 0), l.key === "Enter") {
|
|
355
355
|
const h = r[i];
|
|
356
356
|
h && !h.disabled && (r.forEach((c) => {
|
|
357
357
|
c.checked = !1, c.removeAttribute("checked");
|
|
@@ -360,45 +360,90 @@ S = new WeakSet(), V = function() {
|
|
|
360
360
|
detail: { id: h.id, value: h.value },
|
|
361
361
|
bubbles: !0
|
|
362
362
|
})
|
|
363
|
-
)),
|
|
363
|
+
)), l.preventDefault();
|
|
364
364
|
return;
|
|
365
365
|
}
|
|
366
|
-
const
|
|
367
|
-
|
|
366
|
+
const o = s[i];
|
|
367
|
+
o && (s.forEach((h) => h.setAttribute("tabindex", "-1")), o.setAttribute("tabindex", "0"), o.focus());
|
|
368
368
|
});
|
|
369
369
|
});
|
|
370
|
-
const r =
|
|
370
|
+
const r = e.querySelectorAll(
|
|
371
371
|
`.${this.selectors.input}`
|
|
372
372
|
);
|
|
373
|
-
r.forEach((
|
|
374
|
-
const i = s[
|
|
375
|
-
i && (
|
|
376
|
-
r.forEach((
|
|
377
|
-
|
|
378
|
-
}), r[
|
|
373
|
+
r.forEach((t, l) => {
|
|
374
|
+
const i = s[l];
|
|
375
|
+
i && (t.tabIndex = -1, i.setAttribute("role", "radio"), i.setAttribute("aria-checked", String(t.checked)), i.setAttribute("tabindex", t.checked ? "0" : "-1"), t.disabled ? i.setAttribute("aria-disabled", "true") : i.removeAttribute("aria-disabled"), t.addEventListener("click", () => {
|
|
376
|
+
r.forEach((o) => {
|
|
377
|
+
o.checked = !1, o.removeAttribute("checked");
|
|
378
|
+
}), r[l].checked = !0, r[l].setAttribute("checked", ""), t.dispatchEvent(
|
|
379
379
|
new CustomEvent("ui-button-group-change", {
|
|
380
|
-
detail: { id:
|
|
380
|
+
detail: { id: t.id, value: t.value },
|
|
381
381
|
bubbles: !0
|
|
382
382
|
})
|
|
383
383
|
);
|
|
384
|
-
}),
|
|
385
|
-
console.log("detail:",
|
|
384
|
+
}), t.addEventListener("ui-button-group-change", (o) => {
|
|
385
|
+
console.log("detail:", o.detail);
|
|
386
386
|
}));
|
|
387
387
|
});
|
|
388
|
-
const
|
|
389
|
-
(
|
|
388
|
+
const a = Array.from(r).find(
|
|
389
|
+
(t) => !t.checked && !t.disabled
|
|
390
390
|
);
|
|
391
|
-
if (
|
|
392
|
-
const
|
|
393
|
-
`label[for="${
|
|
391
|
+
if (a) {
|
|
392
|
+
const t = e.querySelector(
|
|
393
|
+
`label[for="${a.id}"]`
|
|
394
394
|
);
|
|
395
|
-
|
|
395
|
+
t && t.setAttribute("tabindex", "0");
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
};
|
|
399
|
+
var C, z;
|
|
400
|
+
class W {
|
|
401
|
+
constructor(e = {}) {
|
|
402
|
+
p(this, C);
|
|
403
|
+
f(this, "selectors");
|
|
404
|
+
f(this, "buttons", null);
|
|
405
|
+
f(this, "abortController", new AbortController());
|
|
406
|
+
const s = {
|
|
407
|
+
main: "UIb"
|
|
408
|
+
};
|
|
409
|
+
this.selectors = { ...s, ...e }, this.buttons = document.querySelectorAll(
|
|
410
|
+
`.${this.selectors.main}`
|
|
411
|
+
), g(this, C, z).call(this);
|
|
412
|
+
}
|
|
413
|
+
destroy() {
|
|
414
|
+
this.abortController && this.abortController.abort(), this.buttons = null;
|
|
415
|
+
}
|
|
416
|
+
costomEvent(e, s) {
|
|
417
|
+
if (!s || s === "undefined" || s.trim() === "") {
|
|
418
|
+
console.log('Button data-value="" Not set!');
|
|
419
|
+
return;
|
|
396
420
|
}
|
|
421
|
+
console.log("dis"), e.dispatchEvent(
|
|
422
|
+
new CustomEvent("ui-button-change", {
|
|
423
|
+
detail: { val: s },
|
|
424
|
+
bubbles: !0
|
|
425
|
+
})
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
C = new WeakSet(), z = function() {
|
|
430
|
+
var s;
|
|
431
|
+
this.abortController = new AbortController();
|
|
432
|
+
const e = this.abortController.signal;
|
|
433
|
+
(s = this.buttons) == null || s.forEach((r) => {
|
|
434
|
+
r.addEventListener(
|
|
435
|
+
"click",
|
|
436
|
+
() => {
|
|
437
|
+
this.costomEvent(r, String(r.dataset.value));
|
|
438
|
+
},
|
|
439
|
+
{ signal: e }
|
|
440
|
+
);
|
|
397
441
|
});
|
|
398
442
|
};
|
|
399
443
|
export {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
444
|
+
W as Button,
|
|
445
|
+
Q as ButtonGroup,
|
|
446
|
+
x as Select,
|
|
447
|
+
H as SpinBox,
|
|
448
|
+
O as Switch
|
|
404
449
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(u,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(u=typeof globalThis<"u"?globalThis:u||self,h(u.UiElements={}))})(this,function(u){"use strict";var G=Object.defineProperty;var K=u=>{throw TypeError(u)};var R=(u,h,b)=>h in u?G(u,h,{enumerable:!0,configurable:!0,writable:!0,value:b}):u[h]=b;var A=(u,h,b)=>R(u,typeof h!="symbol"?h+"":h,b),V=(u,h,b)=>h.has(u)||K("Cannot "+b);var x=(u,h,b)=>(V(u,h,"read from private field"),b?b.call(u):h.get(u)),w=(u,h,b)=>h.has(u)?K("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(u):h.set(u,b);var $=(u,h,b)=>(V(u,h,"access private method"),b);var p,k,P,S,T,L,M;class h{constructor(t={}){w(this,k);A(this,"selectors");A(this,"spinBoxes");w(this,p,(t,i,s,l=0,e=0)=>{t==l||t<l?(i.classList.add(this.selectors.disabledBtn),i.disabled=!0):(i.classList.remove(this.selectors.disabledBtn),i.disabled=!1),e!==0&&(t==e||t>e?(s.classList.add(this.selectors.disabledBtn),s.disabled=!0):(s.classList.remove(this.selectors.disabledBtn),s.disabled=!1))});A(this,"getValidDataNumber",(t,i)=>{const s=t.getAttribute(`data-${i}`);return s===null||s.trim()===""||isNaN(Number(s))?0:Number(s)});const i={main:"UIsp",btn:"UIsp__btn",input:"UIsp__input",disabledBtn:"disabled"};this.selectors={...i,...t},this.spinBoxes=document.querySelectorAll(`.${this.selectors.main}`),$(this,k,P).call(this)}}p=new WeakMap,k=new WeakSet,P=function(){this.spinBoxes.forEach(t=>{const i=t.querySelectorAll(`.${this.selectors.btn}`),s=i[0],l=i[1],e=t.querySelector(`.${this.selectors.input}`),o=this.getValidDataNumber(t,"step"),r=this.getValidDataNumber(t,"min"),a=this.getValidDataNumber(t,"max"),f=d=>{t.setAttribute("aria-valuenow",String(d)),t.setAttribute("aria-valuetext",`${d} items`)};Number(e.value)<=r&&(e.value=r.toFixed(o)),a!==0?(Number(e.value)>=a&&(e.value=a.toFixed(o)),a&&t.setAttribute("aria-valuemax",a.toFixed(o))):e.value=Number(e.value).toFixed(o),r&&t.setAttribute("aria-valuemin",r.toFixed(o)),x(this,p).call(this,Number(e.value),s,l,r,a),f(e.value);let c=null;const y=(d=1)=>{e.value=String(Math.abs(Number(e.value)));let n=parseFloat(e.value)||0;n=n+1*d/Math.pow(10,o),n>a&&a!==0&&(n=a),e.value=n.toFixed(o),x(this,p).call(this,Number(e.value),s,l,r,a),f(e.value)},m=(d=1)=>{e.value=String(Math.abs(Number(e.value)));let n=parseFloat(e.value)||0;n=n-1*d/Math.pow(10,o),n<r&&(n=r),e.value=n.toFixed(o),x(this,p).call(this,Number(e.value),s,l,r,a),f(e.value)},v=(d,n=150)=>{c===null&&(c=window.setInterval(d,n))},I=()=>{c!==null&&(clearInterval(c),c=null)};l.addEventListener("mousedown",d=>{const n=d.shiftKey?3:1;v(()=>y(n))}),l.addEventListener("touchstart",()=>v(y)),["mouseup","mouseleave","mouseout","touchend","touchcancel"].forEach(d=>{l.addEventListener(d,I)}),l.addEventListener("click",d=>{const n=d.shiftKey?3:1;c===null&&y(n)}),s.addEventListener("click",d=>{const n=d.shiftKey?3:1;c===null&&m(n)}),s.addEventListener("mousedown",d=>{const n=d.shiftKey?3:1;v(()=>m(n),100)}),s.addEventListener("touchstart",()=>v(m,100)),["mouseup","mouseleave","mouseout","touchend","touchcancel"].forEach(d=>{s.addEventListener(d,I)}),e.addEventListener("keydown",d=>{const n=d.key,E=d.shiftKey?3:1;if(["Backspace","Delete","ArrowLeft","ArrowRight","Tab","Enter","Home","End"].includes(n)||(d.ctrlKey||d.metaKey)&&["a","c","v","x"].includes(n.toLowerCase()))return;if(["e","+","-"].includes(n)){d.preventDefault();return}if(n==="ArrowUp"||n==="ArrowDown"){d.preventDefault();const F=parseFloat(e.value)||0,B=1*E/Math.pow(10,o);let C=n==="ArrowUp"?F+B:F-B;C<r&&(C=r),e.value=C.toFixed(o),Number(e.value)<r&&(e.value=r.toFixed(o)),Number(e.value)>a&&a!==0&&(e.value=a.toFixed(o)),x(this,p).call(this,Number(e.value),s,l,r,a),f(e.value);return}const N=n===","?".":n,U=/^[0-9]$/.test(N),D=N===".",_=e.value.includes(".");(o===0&&!U||o>0&&!(U||D)||D&&_)&&d.preventDefault()}),e.addEventListener("change",()=>{Number(e.value)<r&&(e.value=r.toFixed(o)),Number(e.value)>a&&a!==0?e.value=a.toFixed(o):e.value=Number(e.value).toFixed(o),x(this,p).call(this,Number(e.value),s,l,r,a)})})};class b{constructor(t={}){w(this,S);A(this,"selectors");A(this,"main");const i={main:"UIsw",label:"UIsw-label"};this.selectors={...i,...t},this.main=document.querySelectorAll(`.${this.selectors.main}`),$(this,S,T).call(this)}}S=new WeakSet,T=function(){this.main.forEach(t=>{const i=t.querySelector(`.${this.selectors.label}`),s=t.querySelector("input");i&&i.id&&t.setAttribute("aria-labelledby",i.id),s&&(s.checked?t.setAttribute("aria-checked","true"):t.setAttribute("aria-checked","false"),t.addEventListener("click",()=>{s.checked=!s.checked,t.setAttribute("aria-checked",String(s.checked))}),t.addEventListener("keydown",e=>{e.key==="ArrowRight"?(s.checked=!0,l(String(s.checked)),e.preventDefault()):e.key==="ArrowLeft"&&(s.checked=!1,l(String(s.checked)),e.preventDefault())}));const l=e=>{t.setAttribute("aria-checked",String(e))}})};class g{constructor(t={}){A(this,"selectors");A(this,"main",null);A(this,"itemArrowInitialized",new WeakSet);A(this,"abortController",new AbortController);const i={idPrefix:"UI-option-",main:"UIselect",selected:"UIselect-selected",arrow:"UIselect-arrow",optionsList:"UIselect-options",search:"UIselect-options__search",items:"UIselect-options__items",excludedItems:["divider","test"]};this.selectors={...i,...t},this.main=document.querySelectorAll(`.${this.selectors.main}`),this.event(),this.initGlobalListener(this.selectors)}filterExcluded(t,i){return Array.from(t).filter(s=>!i.some(l=>typeof l=="string"?s.classList.contains(l)||s.id===l:s===l))}filterSearch(t,i){const s=i.trim().toLowerCase();return t.filter(l=>{var r,a;const e=((r=l.dataset.value)==null?void 0:r.toLowerCase())||"",o=((a=l.textContent)==null?void 0:a.toLowerCase())||"";return e.includes(s)||o.includes(s)})}destroy(){g.closeAll(this.selectors),this.abortController&&this.abortController.abort(),this.main=null}event(){var i;this.abortController=new AbortController;const t=this.abortController.signal;(i=this.main)==null||i.forEach(s=>{const l=s.querySelector(`.${this.selectors.main} input[type='hidden']`);try{if(!l)throw new Error('<input type="hidden" name="YouUniqueId">')}catch(v){return console.warn("Not found:",v.message)}const e=s.querySelector(`.${this.selectors.selected}`),o=s.querySelector(`.${this.selectors.arrow}`),r=s.querySelector(`.${this.selectors.optionsList}`),a=s.querySelector(`.${this.selectors.search} input`);o&&o.addEventListener("click",()=>{this.toggle(s,r)},{signal:t}),e.addEventListener("click",()=>{this.toggle(s,r)},{signal:t}),s.addEventListener("click",()=>{this.itemsPosition(r)},{signal:t});const f=r.querySelectorAll(`.${this.selectors.items} ul li`),c=this.filterExcluded(f,this.selectors.excludedItems),y=s.querySelector("[aria-selected='true']");y&&this.defaultSelect(s,y,e,l);var m=[];a&&a.addEventListener("input",v=>{const d=v.target.value.trim();e&&(m=this.filterSearch(c,d),d?(f.forEach(n=>n.remove()),m.forEach(n=>{var E;(E=r.querySelector(`.${this.selectors.optionsList} ul`))==null||E.appendChild(n)})):f.forEach(n=>{var E;(E=r.querySelector(`.${this.selectors.optionsList} ul`))==null||E.appendChild(n)}),this.itemArrow(s,r,e,l))}),this.itemArrow(s,r,e,l),this.items(s,r,c,e,l)},{signal:t})}itemArrow(t,i,s,l){if(this.itemArrowInitialized.has(t))return;this.itemArrowInitialized.add(t);let e=-1;const o=s.textContent?s.textContent:"",r=t.querySelector(`.${this.selectors.search} input`);t.addEventListener("keydown",a=>{r&&r.focus();const f=Array.from(i.querySelectorAll(`.${this.selectors.optionsList} ul li`)),c=this.filterExcluded(f,this.selectors.excludedItems),y=c.length;if(y!==0)if(a.key==="ArrowDown"){a.preventDefault(),t.getAttribute("aria-expanded")==="false"&&this.toggle(t,i),e=(e+1)%y,s.textContent=c[e].textContent,c.forEach(v=>v.removeAttribute("aria-selected")),c[e].setAttribute("aria-selected","true");const m=c[e].id||`${this.selectors.idPrefix}${e}`;t.setAttribute("aria-activedescendant",m),c[e].scrollIntoView({block:"nearest"})}else if(a.key==="ArrowUp"){a.preventDefault(),e=(e-1+y)%y,s.textContent=c[e].textContent,c.forEach(v=>v.removeAttribute("aria-selected")),c[e].setAttribute("aria-selected","true");const m=c[e].id||`${this.selectors.idPrefix}${e}`;t.setAttribute("aria-activedescendant",m),c[e].scrollIntoView({block:"nearest"})}else if(a.key==="Enter")if(a.preventDefault(),e>=0){s.textContent=c[e].textContent,c.forEach(v=>v.removeAttribute("aria-selected")),c[e].setAttribute("aria-selected","true");const m=c[e].id||`${this.selectors.idPrefix}${e}`;t.setAttribute("aria-activedescendant",m),l.value=String(c[e].dataset.value),this.costomEvent(t,l.value),this.close(t,i)}else this.toggle(t,i);else a.key==="Escape"&&(t.getAttribute("aria-activedescendant")||(s.textContent=o),this.close(t,i))})}itemsPosition(t){const i=t.querySelector('[aria-selected="true"]');i&&i.scrollIntoView({block:"nearest"})}items(t,i,s,l,e){s.forEach((o,r)=>{o.addEventListener("click",()=>{const a=s[r];if(a){l.textContent=a.textContent,s.forEach(c=>c.removeAttribute("aria-selected")),a.setAttribute("aria-selected","true");const f=a.id||`${this.selectors.idPrefix}${r}`;t.setAttribute("aria-expanded","false"),t.setAttribute("aria-activedescendant",f),e.value=String(s[r].dataset.value),this.costomEvent(t,e.value),this.close(t,i)}})})}defaultSelect(t,i,s,l){i&&(l.setAttribute("value",i.dataset.value??""),s.textContent=i.textContent??"",t.setAttribute("aria-activedescendant",i.id||""))}costomEvent(t,i){t.dispatchEvent(new CustomEvent("change",{detail:{val:i},bubbles:!0}))}toggle(t,i){g.closeAll(this.selectors),i.hidden?(i.hidden=!1,t.setAttribute("aria-expanded","true")):this.close(t,i)}close(t,i){i.hidden=!0,t.setAttribute("aria-expanded","false")}static closeAll(t){document.querySelectorAll(`.${t.main}`).forEach(i=>{const s=i.querySelector(`.${t.optionsList}`);s.hidden=!0,i.setAttribute("aria-expanded","false")})}initGlobalListener(t){document.addEventListener("click",i=>{const s=i.target;[...document.querySelectorAll(`.${t.main}`)].some(e=>e.contains(s))||g.closeAll(t)},{signal:this.abortController.signal})}}class z{constructor(t={}){w(this,L);A(this,"selectors");A(this,"groups");const i={main:"UIbg",btn:"UIbg-btn",input:"UIbg-input"};this.selectors={...i,...t},this.groups=document.querySelectorAll(`.${this.selectors.main}`),$(this,L,M).call(this)}}L=new WeakSet,M=function(){this.groups.forEach(t=>{const i=t.querySelectorAll(`.${this.selectors.btn}`);i.forEach(e=>{e.addEventListener("click",()=>{i.forEach(o=>{o.setAttribute("aria-checked","false"),o.setAttribute("tabindex","-1")}),e.setAttribute("aria-checked","true"),e.setAttribute("tabindex","0"),e.focus()}),e.addEventListener("keydown",o=>{let r=Array.from(i).indexOf(e);if(o.key==="ArrowRight"&&r++,o.key==="ArrowLeft"&&r--,r<0&&(r=i.length-1),r>=i.length&&(r=0),o.key==="Enter"){const f=s[r];f&&!f.disabled&&(s.forEach(c=>{c.checked=!1,c.removeAttribute("checked")}),f.checked=!0,f.setAttribute("checked",""),f.dispatchEvent(new CustomEvent("ui-button-group-change",{detail:{id:f.id,value:f.value},bubbles:!0}))),o.preventDefault();return}const a=i[r];a&&(i.forEach(f=>f.setAttribute("tabindex","-1")),a.setAttribute("tabindex","0"),a.focus())})});const s=t.querySelectorAll(`.${this.selectors.input}`);s.forEach((e,o)=>{const r=i[o];r&&(e.tabIndex=-1,r.setAttribute("role","radio"),r.setAttribute("aria-checked",String(e.checked)),r.setAttribute("tabindex",e.checked?"0":"-1"),e.disabled?r.setAttribute("aria-disabled","true"):r.removeAttribute("aria-disabled"),e.addEventListener("click",()=>{s.forEach(a=>{a.checked=!1,a.removeAttribute("checked")}),s[o].checked=!0,s[o].setAttribute("checked",""),e.dispatchEvent(new CustomEvent("ui-button-group-change",{detail:{id:e.id,value:e.value},bubbles:!0}))}),e.addEventListener("ui-button-group-change",a=>{console.log("detail:",a.detail)}))});const l=Array.from(s).find(e=>!e.checked&&!e.disabled);if(l){const e=t.querySelector(`label[for="${l.id}"]`);e&&e.setAttribute("tabindex","0")}})},u.ButtonGroup=z,u.Select=g,u.SpinBox=h,u.Switch=b,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(d,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(d=typeof globalThis<"u"?globalThis:d||self,h(d.UiElements={}))})(this,function(d){"use strict";var H=Object.defineProperty;var V=d=>{throw TypeError(d)};var O=(d,h,b)=>h in d?H(d,h,{enumerable:!0,configurable:!0,writable:!0,value:b}):d[h]=b;var v=(d,h,b)=>O(d,typeof h!="symbol"?h+"":h,b),P=(d,h,b)=>h.has(d)||V("Cannot "+b);var g=(d,h,b)=>(P(d,h,"read from private field"),b?b.call(d):h.get(d)),w=(d,h,b)=>h.has(d)?V("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(d):h.set(d,b);var k=(d,h,b)=>(P(d,h,"access private method"),b);var E,S,T,C,M,L,z,$,_;class h{constructor(t={}){w(this,S);v(this,"selectors");v(this,"spinBoxes");w(this,E,(t,r,s,n=0,e=0)=>{t==n||t<n?(r.classList.add(this.selectors.disabledBtn),r.disabled=!0):(r.classList.remove(this.selectors.disabledBtn),r.disabled=!1),e!==0&&(t==e||t>e?(s.classList.add(this.selectors.disabledBtn),s.disabled=!0):(s.classList.remove(this.selectors.disabledBtn),s.disabled=!1))});v(this,"getValidDataNumber",(t,r)=>{const s=t.getAttribute(`data-${r}`);return s===null||s.trim()===""||isNaN(Number(s))?0:Number(s)});const r={main:"UIsp",btn:"UIsp__btn",input:"UIsp__input",disabledBtn:"disabled"};this.selectors={...r,...t},this.spinBoxes=document.querySelectorAll(`.${this.selectors.main}`),k(this,S,T).call(this)}}E=new WeakMap,S=new WeakSet,T=function(){this.spinBoxes.forEach(t=>{const r=t.querySelectorAll(`.${this.selectors.btn}`),s=r[0],n=r[1],e=t.querySelector(`.${this.selectors.input}`),l=this.getValidDataNumber(t,"step"),i=this.getValidDataNumber(t,"min"),o=this.getValidDataNumber(t,"max"),f=u=>{t.setAttribute("aria-valuenow",String(u)),t.setAttribute("aria-valuetext",`${u} items`)};Number(e.value)<=i&&(e.value=i.toFixed(l)),o!==0?(Number(e.value)>=o&&(e.value=o.toFixed(l)),o&&t.setAttribute("aria-valuemax",o.toFixed(l))):e.value=Number(e.value).toFixed(l),i&&t.setAttribute("aria-valuemin",i.toFixed(l)),g(this,E).call(this,Number(e.value),s,n,i,o),f(e.value);let c=null;const y=(u=1)=>{e.value=String(Math.abs(Number(e.value)));let a=parseFloat(e.value)||0;a=a+1*u/Math.pow(10,l),a>o&&o!==0&&(a=o),e.value=a.toFixed(l),g(this,E).call(this,Number(e.value),s,n,i,o),f(e.value)},A=(u=1)=>{e.value=String(Math.abs(Number(e.value)));let a=parseFloat(e.value)||0;a=a-1*u/Math.pow(10,l),a<i&&(a=i),e.value=a.toFixed(l),g(this,E).call(this,Number(e.value),s,n,i,o),f(e.value)},m=(u,a=150)=>{c===null&&(c=window.setInterval(u,a))},q=()=>{c!==null&&(clearInterval(c),c=null)};n.addEventListener("mousedown",u=>{const a=u.shiftKey?3:1;m(()=>y(a))}),n.addEventListener("touchstart",()=>m(y)),["mouseup","mouseleave","mouseout","touchend","touchcancel"].forEach(u=>{n.addEventListener(u,q)}),n.addEventListener("click",u=>{const a=u.shiftKey?3:1;c===null&&y(a)}),s.addEventListener("click",u=>{const a=u.shiftKey?3:1;c===null&&A(a)}),s.addEventListener("mousedown",u=>{const a=u.shiftKey?3:1;m(()=>A(a),100)}),s.addEventListener("touchstart",()=>m(A,100)),["mouseup","mouseleave","mouseout","touchend","touchcancel"].forEach(u=>{s.addEventListener(u,q)}),e.addEventListener("keydown",u=>{const a=u.key,p=u.shiftKey?3:1;if(["Backspace","Delete","ArrowLeft","ArrowRight","Tab","Enter","Home","End"].includes(a)||(u.ctrlKey||u.metaKey)&&["a","c","v","x"].includes(a.toLowerCase()))return;if(["e","+","-"].includes(a)){u.preventDefault();return}if(a==="ArrowUp"||a==="ArrowDown"){u.preventDefault();const F=parseFloat(e.value)||0,K=1*p/Math.pow(10,l);let N=a==="ArrowUp"?F+K:F-K;N<i&&(N=i),e.value=N.toFixed(l),Number(e.value)<i&&(e.value=i.toFixed(l)),Number(e.value)>o&&o!==0&&(e.value=o.toFixed(l)),g(this,E).call(this,Number(e.value),s,n,i,o),f(e.value);return}const U=a===","?".":a,D=/^[0-9]$/.test(U),B=U===".",j=e.value.includes(".");(l===0&&!D||l>0&&!(D||B)||B&&j)&&u.preventDefault()}),e.addEventListener("change",()=>{Number(e.value)<i&&(e.value=i.toFixed(l)),Number(e.value)>o&&o!==0?e.value=o.toFixed(l):e.value=Number(e.value).toFixed(l),g(this,E).call(this,Number(e.value),s,n,i,o)})})};class b{constructor(t={}){w(this,C);v(this,"selectors");v(this,"main");const r={main:"UIsw",label:"UIsw-label"};this.selectors={...r,...t},this.main=document.querySelectorAll(`.${this.selectors.main}`),k(this,C,M).call(this)}}C=new WeakSet,M=function(){this.main.forEach(t=>{const r=t.querySelector(`.${this.selectors.label}`),s=t.querySelector("input");r&&r.id&&t.setAttribute("aria-labelledby",r.id),s&&(s.checked?t.setAttribute("aria-checked","true"):t.setAttribute("aria-checked","false"),t.addEventListener("click",()=>{s.checked=!s.checked,t.setAttribute("aria-checked",String(s.checked))}),t.addEventListener("keydown",e=>{e.key==="ArrowRight"?(s.checked=!0,n(String(s.checked)),e.preventDefault()):e.key==="ArrowLeft"&&(s.checked=!1,n(String(s.checked)),e.preventDefault())}));const n=e=>{t.setAttribute("aria-checked",String(e))}})};class x{constructor(t={}){v(this,"selectors");v(this,"main",null);v(this,"itemArrowInitialized",new WeakSet);v(this,"abortController",new AbortController);const r={idPrefix:"UI-option-",main:"UIselect",selected:"UIselect-selected",arrow:"UIselect-arrow",optionsList:"UIselect-options",search:"UIselect-options__search",items:"UIselect-options__items",excludedItems:["divider","test"]};this.selectors={...r,...t},this.main=document.querySelectorAll(`.${this.selectors.main}`),this.event(),this.initGlobalListener(this.selectors)}filterExcluded(t,r){return Array.from(t).filter(s=>!r.some(n=>typeof n=="string"?s.classList.contains(n)||s.id===n:s===n))}filterSearch(t,r){const s=r.trim().toLowerCase();return t.filter(n=>{var i,o;const e=((i=n.dataset.value)==null?void 0:i.toLowerCase())||"",l=((o=n.textContent)==null?void 0:o.toLowerCase())||"";return e.includes(s)||l.includes(s)})}destroy(){x.closeAll(this.selectors),this.abortController&&this.abortController.abort(),this.main=null}event(){var r;this.abortController=new AbortController;const t=this.abortController.signal;(r=this.main)==null||r.forEach(s=>{const n=s.querySelector(`.${this.selectors.main} input[type='hidden']`);try{if(!n)throw new Error('<input type="hidden" name="YouUniqueId">')}catch(m){return console.warn("Not found:",m.message)}const e=s.querySelector(`.${this.selectors.selected}`),l=s.querySelector(`.${this.selectors.arrow}`),i=s.querySelector(`.${this.selectors.optionsList}`),o=s.querySelector(`.${this.selectors.search} input`);l&&l.addEventListener("click",()=>{this.toggle(s,i)},{signal:t}),e.addEventListener("click",()=>{this.toggle(s,i)},{signal:t}),s.addEventListener("click",()=>{this.itemsPosition(i)},{signal:t});const f=i.querySelectorAll(`.${this.selectors.items} ul li`),c=this.filterExcluded(f,this.selectors.excludedItems),y=s.querySelector("[aria-selected='true']");y&&this.defaultSelect(s,y,e,n);var A=[];o&&o.addEventListener("input",m=>{const u=m.target.value.trim();e&&(A=this.filterSearch(c,u),u?(f.forEach(a=>a.remove()),A.forEach(a=>{var p;(p=i.querySelector(`.${this.selectors.optionsList} ul`))==null||p.appendChild(a)})):f.forEach(a=>{var p;(p=i.querySelector(`.${this.selectors.optionsList} ul`))==null||p.appendChild(a)}),this.itemArrow(s,i,e,n))}),this.itemArrow(s,i,e,n),this.items(s,i,c,e,n)},{signal:t})}itemArrow(t,r,s,n){if(this.itemArrowInitialized.has(t))return;this.itemArrowInitialized.add(t);let e=-1;const l=s.textContent?s.textContent:"",i=t.querySelector(`.${this.selectors.search} input`);t.addEventListener("keydown",o=>{i&&i.focus();const f=Array.from(r.querySelectorAll(`.${this.selectors.optionsList} ul li`)),c=this.filterExcluded(f,this.selectors.excludedItems),y=c.length;if(y!==0)if(o.key==="ArrowDown"){o.preventDefault(),t.getAttribute("aria-expanded")==="false"&&this.toggle(t,r),e=(e+1)%y,s.textContent=c[e].textContent,c.forEach(m=>m.removeAttribute("aria-selected")),c[e].setAttribute("aria-selected","true");const A=c[e].id||`${this.selectors.idPrefix}${e}`;t.setAttribute("aria-activedescendant",A),c[e].scrollIntoView({block:"nearest"})}else if(o.key==="ArrowUp"){o.preventDefault(),e=(e-1+y)%y,s.textContent=c[e].textContent,c.forEach(m=>m.removeAttribute("aria-selected")),c[e].setAttribute("aria-selected","true");const A=c[e].id||`${this.selectors.idPrefix}${e}`;t.setAttribute("aria-activedescendant",A),c[e].scrollIntoView({block:"nearest"})}else if(o.key==="Enter")if(o.preventDefault(),e>=0){s.textContent=c[e].textContent,c.forEach(m=>m.removeAttribute("aria-selected")),c[e].setAttribute("aria-selected","true");const A=c[e].id||`${this.selectors.idPrefix}${e}`;t.setAttribute("aria-activedescendant",A),n.value=String(c[e].dataset.value),this.costomEvent(t,n.value),this.close(t,r)}else this.toggle(t,r);else o.key==="Escape"&&(t.getAttribute("aria-activedescendant")||(s.textContent=l),this.close(t,r))})}itemsPosition(t){const r=t.querySelector('[aria-selected="true"]');r&&r.scrollIntoView({block:"nearest"})}items(t,r,s,n,e){s.forEach((l,i)=>{l.addEventListener("click",()=>{const o=s[i];if(o){n.textContent=o.textContent,s.forEach(c=>c.removeAttribute("aria-selected")),o.setAttribute("aria-selected","true");const f=o.id||`${this.selectors.idPrefix}${i}`;t.setAttribute("aria-expanded","false"),t.setAttribute("aria-activedescendant",f),e.value=String(s[i].dataset.value),this.costomEvent(t,e.value),this.close(t,r)}})})}defaultSelect(t,r,s,n){r&&(n.setAttribute("value",r.dataset.value??""),s.textContent=r.textContent??"",t.setAttribute("aria-activedescendant",r.id||""))}costomEvent(t,r){t.dispatchEvent(new CustomEvent("change",{detail:{val:r},bubbles:!0}))}toggle(t,r){x.closeAll(this.selectors),r.hidden?(r.hidden=!1,t.setAttribute("aria-expanded","true")):this.close(t,r)}close(t,r){r.hidden=!0,t.setAttribute("aria-expanded","false")}static closeAll(t){document.querySelectorAll(`.${t.main}`).forEach(r=>{const s=r.querySelector(`.${t.optionsList}`);s.hidden=!0,r.setAttribute("aria-expanded","false")})}initGlobalListener(t){document.addEventListener("click",r=>{const s=r.target;[...document.querySelectorAll(`.${t.main}`)].some(e=>e.contains(s))||x.closeAll(t)},{signal:this.abortController.signal})}}class G{constructor(t={}){w(this,L);v(this,"selectors");v(this,"groups");const r={main:"UIbg",btn:"UIbg-btn",input:"UIbg-input"};this.selectors={...r,...t},this.groups=document.querySelectorAll(`.${this.selectors.main}`),k(this,L,z).call(this)}}L=new WeakSet,z=function(){this.groups.forEach(t=>{const r=t.querySelectorAll(`.${this.selectors.btn}`);r.forEach(e=>{e.addEventListener("click",()=>{r.forEach(l=>{l.setAttribute("aria-checked","false"),l.setAttribute("tabindex","-1")}),e.setAttribute("aria-checked","true"),e.setAttribute("tabindex","0"),e.focus()}),e.addEventListener("keydown",l=>{let i=Array.from(r).indexOf(e);if(l.key==="ArrowRight"&&i++,l.key==="ArrowLeft"&&i--,i<0&&(i=r.length-1),i>=r.length&&(i=0),l.key==="Enter"){const f=s[i];f&&!f.disabled&&(s.forEach(c=>{c.checked=!1,c.removeAttribute("checked")}),f.checked=!0,f.setAttribute("checked",""),f.dispatchEvent(new CustomEvent("ui-button-group-change",{detail:{id:f.id,value:f.value},bubbles:!0}))),l.preventDefault();return}const o=r[i];o&&(r.forEach(f=>f.setAttribute("tabindex","-1")),o.setAttribute("tabindex","0"),o.focus())})});const s=t.querySelectorAll(`.${this.selectors.input}`);s.forEach((e,l)=>{const i=r[l];i&&(e.tabIndex=-1,i.setAttribute("role","radio"),i.setAttribute("aria-checked",String(e.checked)),i.setAttribute("tabindex",e.checked?"0":"-1"),e.disabled?i.setAttribute("aria-disabled","true"):i.removeAttribute("aria-disabled"),e.addEventListener("click",()=>{s.forEach(o=>{o.checked=!1,o.removeAttribute("checked")}),s[l].checked=!0,s[l].setAttribute("checked",""),e.dispatchEvent(new CustomEvent("ui-button-group-change",{detail:{id:e.id,value:e.value},bubbles:!0}))}),e.addEventListener("ui-button-group-change",o=>{console.log("detail:",o.detail)}))});const n=Array.from(s).find(e=>!e.checked&&!e.disabled);if(n){const e=t.querySelector(`label[for="${n.id}"]`);e&&e.setAttribute("tabindex","0")}})};class R{constructor(t={}){w(this,$);v(this,"selectors");v(this,"buttons",null);v(this,"abortController",new AbortController);const r={main:"UIb"};this.selectors={...r,...t},this.buttons=document.querySelectorAll(`.${this.selectors.main}`),k(this,$,_).call(this)}destroy(){this.abortController&&this.abortController.abort(),this.buttons=null}costomEvent(t,r){if(!r||r==="undefined"||r.trim()===""){console.log('Button data-value="" Not set!');return}console.log("dis"),t.dispatchEvent(new CustomEvent("ui-button-change",{detail:{val:r},bubbles:!0}))}}$=new WeakSet,_=function(){var r;this.abortController=new AbortController;const t=this.abortController.signal;(r=this.buttons)==null||r.forEach(s=>{s.addEventListener("click",()=>{this.costomEvent(s,String(s.dataset.value))},{signal:t})})},d.Button=R,d.ButtonGroup=G,d.Select=x,d.SpinBox=h,d.Switch=b,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "Andrii Popov",
|
|
3
3
|
"name": "@popovandrii/ui-elements",
|
|
4
4
|
"description": "UI elements. Color scheme. Elements with complex logic Java Script. SpinBox, Select+search, Switch, Button Group (radio)",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.22",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"spinbox",
|