Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

autocompleter

Package Overview
Dependencies
Maintainers
0
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autocompleter - npm Package Compare versions

Comparing version 9.2.1 to 9.3.0

2

autocomplete.d.ts
/**
* Copyright (c) 2016 Denys Krasnoshchok
* Copyright (c) 2016 Denis Taran
*

@@ -4,0 +4,0 @@ * Homepage: https://smartscheduling.com/en/documentation/autocomplete

/**
* Copyright (c) 2016 Denys Krasnoshchok
* Copyright (c) 2016 Denis Taran
*

@@ -36,3 +36,3 @@ * Homepage: https://smartscheduling.com/en/documentation/autocomplete

var input = settings.input;
container.className = 'autocomplete ' + (settings.className || '');
container.className = [container.className, 'autocomplete', settings.className || ''].join(' ').trim();
container.setAttribute('role', 'listbox');

@@ -39,0 +39,0 @@ input.setAttribute('role', 'combobox');

/**
* Copyright (c) 2016 Denys Krasnoshchok
* Copyright (c) 2016 Denis Taran
*

@@ -9,3 +9,3 @@ * Homepage: https://smartscheduling.com/en/documentation/autocomplete

*/
function e(e){var t=document,n=e.container||t.createElement("div"),i=e.preventSubmit||0;n.id=n.id||"autocomplete-"+h();var r,o,a=n.style,s=e.debounceWaitMs||0,u=e.disableAutoSelect||!1,c=n.parentElement,d=[],l="",f=2,v=e.showOnFocus,p=0,m=!1,b=!1;if(void 0!==e.minLength&&(f=e.minLength),!e.input)throw new Error("input undefined");var g=e.input;function h(){return Date.now().toString(36)+Math.random().toString(36).substring(2)}function E(){var e=n.parentNode;e&&e.removeChild(n)}function A(){o&&window.clearTimeout(o)}function w(){return!!n.parentNode}function L(){p++,d=[],l="",r=void 0,g.setAttribute("aria-activedescendant",""),g.setAttribute("aria-expanded","false"),E()}function x(){n.textContent="",g.setAttribute("aria-activedescendant","");var i=function(e,n,i){var r=t.createElement("div");return r.textContent=e.label||"",r};e.render&&(i=e.render);var o=function(e,n){var i=t.createElement("div");return i.textContent=e,i};e.renderGroup&&(o=e.renderGroup);var s=t.createDocumentFragment(),u=h();if(d.forEach((function(t,a){if(t.group&&t.group!==u){u=t.group;var c=o(t.group,l);c&&(c.className+=" group",s.appendChild(c))}var d=i(t,l,a);d&&(d.id=n.id+"_"+a,d.setAttribute("role","option"),d.addEventListener("click",(function(n){b=!0;try{e.onSelect(t,g)}finally{b=!1}L(),n.preventDefault(),n.stopPropagation()})),t===r&&(d.className+=" selected",d.setAttribute("aria-selected","true"),g.setAttribute("aria-activedescendant",d.id)),s.appendChild(d))})),n.appendChild(s),d.length<1){if(!e.emptyMsg)return void L();var f=t.createElement("div");f.id=n.id+"_"+h(),f.className="empty",f.textContent=e.emptyMsg,n.appendChild(f),g.setAttribute("aria-activedescendant",f.id)}n.parentNode||(c||t.body).appendChild(n),function(){if(w()){g.setAttribute("aria-expanded","true"),a.height="auto",a.width=g.offsetWidth+"px";var i,r=0;o(),o(),e.customize&&i&&e.customize(g,i,n,r)}function o(){var e=t.documentElement,n=e.clientTop||t.body.clientTop||0,o=e.clientLeft||t.body.clientLeft||0,s=window.pageYOffset||e.scrollTop,u=window.pageXOffset||e.scrollLeft,c=(i=g.getBoundingClientRect()).top+g.offsetHeight+s-n,d=i.left+u-o;a.top=c+"px",a.left=d+"px",(r=window.innerHeight-(i.top+g.offsetHeight))<0&&(r=0),a.top=c+"px",a.bottom="",a.left=d+"px",a.maxHeight=r+"px"}}(),D()}function y(){w()&&x()}function k(){y()}function T(e){e.target!==n?y():e.preventDefault()}function C(){b||z(0)}function D(){var e=n.getElementsByClassName("selected");if(e.length>0){var t=e[0],i=t.previousElementSibling;if(i&&-1!==i.className.indexOf("group")&&!i.previousElementSibling&&(t=i),t.offsetTop<n.scrollTop)n.scrollTop=t.offsetTop;else{var r=t.offsetTop+t.offsetHeight,o=n.scrollTop+n.offsetHeight;r>o&&(n.scrollTop+=r-o)}}}function N(e){d.length>0&&(!function(e){var i=t.getElementById(n.id+"_"+e);i&&(i.classList.remove("selected"),i.removeAttribute("aria-selected"),g.removeAttribute("aria-activedescendant"))}(e),function(e){var i=t.getElementById(n.id+"_"+e);i&&(i.classList.add("selected"),i.setAttribute("aria-selected","true"),g.setAttribute("aria-activedescendant",i.id))}(d.indexOf(r)),D())}function S(e,t){var n,i=w();if("Escape"===t)L();else{if(!i||d.length<1)return;"ArrowUp"===t?(n=d.indexOf(r),r=-1===n?void 0:d[(n+d.length-1)%d.length],N(n)):function(){var e=d.indexOf(r);r=d.length<1?void 0:-1===e?d[0]:d[(e+1)%d.length],N(e)}()}e.preventDefault(),i&&e.stopPropagation()}function O(t){var n=t.key;switch(n){case"ArrowUp":case"ArrowDown":case"Escape":S(t,n);break;case"Enter":!function(t){if(r){2===i&&t.preventDefault(),b=!0;try{e.onSelect(r,g)}finally{b=!1}L()}1===i&&t.preventDefault()}(t)}}function H(){v&&z(1)}function z(e){g.value.length>=f||1===e?(A(),o=window.setTimeout((function(){return B(g.value,e,g.selectionStart||0)}),0===e||2===e?s:0)):L()}function B(t,n,i){if(!m){var o=++p;e.fetch(t,(function(e){p===o&&e&&(l=t,r=(d=e).length<1||u?void 0:d[0],x())}),n,i)}}function M(t){e.keyup?e.keyup({event:t,fetch:function(){return z(0)}}):w()||"ArrowDown"!==t.key||z(0)}function _(t){e.click&&e.click({event:t,fetch:function(){return z(2)}})}function P(){setTimeout((function(){t.activeElement!==g&&L()}),200)}return n.className="autocomplete "+(e.className||""),n.setAttribute("role","listbox"),g.setAttribute("role","combobox"),g.setAttribute("aria-expanded","false"),g.setAttribute("aria-autocomplete","list"),g.setAttribute("aria-controls",n.id),g.setAttribute("aria-owns",n.id),g.setAttribute("aria-activedescendant",""),g.setAttribute("aria-haspopup","listbox"),a.position="absolute",n.addEventListener("mousedown",(function(e){e.stopPropagation(),e.preventDefault()})),n.addEventListener("focus",(function(){return g.focus()})),E(),g.addEventListener("keyup",M),g.addEventListener("click",_),g.addEventListener("keydown",O),g.addEventListener("input",C),g.addEventListener("blur",P),g.addEventListener("focus",H),window.addEventListener("resize",k),t.addEventListener("scroll",T,!0),{destroy:function(){g.removeEventListener("focus",H),g.removeEventListener("keyup",M),g.removeEventListener("click",_),g.removeEventListener("keydown",O),g.removeEventListener("input",C),g.removeEventListener("blur",P),window.removeEventListener("resize",k),t.removeEventListener("scroll",T,!0),g.removeAttribute("role"),g.removeAttribute("aria-expanded"),g.removeAttribute("aria-autocomplete"),g.removeAttribute("aria-controls"),g.removeAttribute("aria-activedescendant"),g.removeAttribute("aria-owns"),g.removeAttribute("aria-haspopup"),A(),L(),m=!0},fetch:function(){B(g.value,3,g.selectionStart||0)}}}export default e;
function e(e){var t=document,n=e.container||t.createElement("div"),i=e.preventSubmit||0;n.id=n.id||"autocomplete-"+h();var r,o,a=n.style,s=e.debounceWaitMs||0,u=e.disableAutoSelect||!1,c=n.parentElement,d=[],l="",f=2,v=e.showOnFocus,p=0,m=!1,b=!1;if(void 0!==e.minLength&&(f=e.minLength),!e.input)throw new Error("input undefined");var g=e.input;function h(){return Date.now().toString(36)+Math.random().toString(36).substring(2)}function E(){var e=n.parentNode;e&&e.removeChild(n)}function A(){o&&window.clearTimeout(o)}function w(){return!!n.parentNode}function L(){p++,d=[],l="",r=void 0,g.setAttribute("aria-activedescendant",""),g.setAttribute("aria-expanded","false"),E()}function x(){n.textContent="",g.setAttribute("aria-activedescendant","");var i=function(e,n,i){var r=t.createElement("div");return r.textContent=e.label||"",r};e.render&&(i=e.render);var o=function(e,n){var i=t.createElement("div");return i.textContent=e,i};e.renderGroup&&(o=e.renderGroup);var s=t.createDocumentFragment(),u=h();if(d.forEach((function(t,a){if(t.group&&t.group!==u){u=t.group;var c=o(t.group,l);c&&(c.className+=" group",s.appendChild(c))}var d=i(t,l,a);d&&(d.id=n.id+"_"+a,d.setAttribute("role","option"),d.addEventListener("click",(function(n){b=!0;try{e.onSelect(t,g)}finally{b=!1}L(),n.preventDefault(),n.stopPropagation()})),t===r&&(d.className+=" selected",d.setAttribute("aria-selected","true"),g.setAttribute("aria-activedescendant",d.id)),s.appendChild(d))})),n.appendChild(s),d.length<1){if(!e.emptyMsg)return void L();var f=t.createElement("div");f.id=n.id+"_"+h(),f.className="empty",f.textContent=e.emptyMsg,n.appendChild(f),g.setAttribute("aria-activedescendant",f.id)}n.parentNode||(c||t.body).appendChild(n),function(){if(w()){g.setAttribute("aria-expanded","true"),a.height="auto",a.width=g.offsetWidth+"px";var i,r=0;o(),o(),e.customize&&i&&e.customize(g,i,n,r)}function o(){var e=t.documentElement,n=e.clientTop||t.body.clientTop||0,o=e.clientLeft||t.body.clientLeft||0,s=window.pageYOffset||e.scrollTop,u=window.pageXOffset||e.scrollLeft,c=(i=g.getBoundingClientRect()).top+g.offsetHeight+s-n,d=i.left+u-o;a.top=c+"px",a.left=d+"px",(r=window.innerHeight-(i.top+g.offsetHeight))<0&&(r=0),a.top=c+"px",a.bottom="",a.left=d+"px",a.maxHeight=r+"px"}}(),N()}function y(){w()&&x()}function k(){y()}function T(e){e.target!==n?y():e.preventDefault()}function C(){b||z(0)}function N(){var e=n.getElementsByClassName("selected");if(e.length>0){var t=e[0],i=t.previousElementSibling;if(i&&-1!==i.className.indexOf("group")&&!i.previousElementSibling&&(t=i),t.offsetTop<n.scrollTop)n.scrollTop=t.offsetTop;else{var r=t.offsetTop+t.offsetHeight,o=n.scrollTop+n.offsetHeight;r>o&&(n.scrollTop+=r-o)}}}function D(e){d.length>0&&(!function(e){var i=t.getElementById(n.id+"_"+e);i&&(i.classList.remove("selected"),i.removeAttribute("aria-selected"),g.removeAttribute("aria-activedescendant"))}(e),function(e){var i=t.getElementById(n.id+"_"+e);i&&(i.classList.add("selected"),i.setAttribute("aria-selected","true"),g.setAttribute("aria-activedescendant",i.id))}(d.indexOf(r)),N())}function S(e,t){var n,i=w();if("Escape"===t)L();else{if(!i||d.length<1)return;"ArrowUp"===t?(n=d.indexOf(r),r=-1===n?void 0:d[(n+d.length-1)%d.length],D(n)):function(){var e=d.indexOf(r);r=d.length<1?void 0:-1===e?d[0]:d[(e+1)%d.length],D(e)}()}e.preventDefault(),i&&e.stopPropagation()}function O(t){var n=t.key;switch(n){case"ArrowUp":case"ArrowDown":case"Escape":S(t,n);break;case"Enter":!function(t){if(r){2===i&&t.preventDefault(),b=!0;try{e.onSelect(r,g)}finally{b=!1}L()}1===i&&t.preventDefault()}(t)}}function H(){v&&z(1)}function z(e){g.value.length>=f||1===e?(A(),o=window.setTimeout((function(){return B(g.value,e,g.selectionStart||0)}),0===e||2===e?s:0)):L()}function B(t,n,i){if(!m){var o=++p;e.fetch(t,(function(e){p===o&&e&&(l=t,r=(d=e).length<1||u?void 0:d[0],x())}),n,i)}}function M(t){e.keyup?e.keyup({event:t,fetch:function(){return z(0)}}):w()||"ArrowDown"!==t.key||z(0)}function _(t){e.click&&e.click({event:t,fetch:function(){return z(2)}})}function P(){setTimeout((function(){t.activeElement!==g&&L()}),200)}return n.className=[n.className,"autocomplete",e.className||""].join(" ").trim(),n.setAttribute("role","listbox"),g.setAttribute("role","combobox"),g.setAttribute("aria-expanded","false"),g.setAttribute("aria-autocomplete","list"),g.setAttribute("aria-controls",n.id),g.setAttribute("aria-owns",n.id),g.setAttribute("aria-activedescendant",""),g.setAttribute("aria-haspopup","listbox"),a.position="absolute",n.addEventListener("mousedown",(function(e){e.stopPropagation(),e.preventDefault()})),n.addEventListener("focus",(function(){return g.focus()})),E(),g.addEventListener("keyup",M),g.addEventListener("click",_),g.addEventListener("keydown",O),g.addEventListener("input",C),g.addEventListener("blur",P),g.addEventListener("focus",H),window.addEventListener("resize",k),t.addEventListener("scroll",T,!0),{destroy:function(){g.removeEventListener("focus",H),g.removeEventListener("keyup",M),g.removeEventListener("click",_),g.removeEventListener("keydown",O),g.removeEventListener("input",C),g.removeEventListener("blur",P),window.removeEventListener("resize",k),t.removeEventListener("scroll",T,!0),g.removeAttribute("role"),g.removeAttribute("aria-expanded"),g.removeAttribute("aria-autocomplete"),g.removeAttribute("aria-controls"),g.removeAttribute("aria-activedescendant"),g.removeAttribute("aria-owns"),g.removeAttribute("aria-haspopup"),A(),L(),m=!0},fetch:function(){B(g.value,3,g.selectionStart||0)}}}export default e;
//# sourceMappingURL=autocomplete.es.min.js.map

@@ -8,3 +8,3 @@ (function (global, factory) {

/**
* Copyright (c) 2016 Denys Krasnoshchok
* Copyright (c) 2016 Denis Taran
*

@@ -43,3 +43,3 @@ * Homepage: https://smartscheduling.com/en/documentation/autocomplete

var input = settings.input;
container.className = 'autocomplete ' + (settings.className || '');
container.className = [container.className, 'autocomplete', settings.className || ''].join(' ').trim();
container.setAttribute('role', 'listbox');

@@ -46,0 +46,0 @@ input.setAttribute('role', 'combobox');

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).autocomplete=t()}(this,(function(){"use strict";
/**
* Copyright (c) 2016 Denys Krasnoshchok
* Copyright (c) 2016 Denis Taran
*

@@ -9,3 +9,3 @@ * Homepage: https://smartscheduling.com/en/documentation/autocomplete

* MIT License
*/return function(e){var t=document,n=e.container||t.createElement("div"),i=e.preventSubmit||0;n.id=n.id||"autocomplete-"+h();var r,o,a=n.style,s=e.debounceWaitMs||0,u=e.disableAutoSelect||!1,c=n.parentElement,d=[],l="",f=2,p=e.showOnFocus,v=0,m=!1,b=!1;if(void 0!==e.minLength&&(f=e.minLength),!e.input)throw new Error("input undefined");var g=e.input;function h(){return Date.now().toString(36)+Math.random().toString(36).substring(2)}function E(){var e=n.parentNode;e&&e.removeChild(n)}function A(){o&&window.clearTimeout(o)}function w(){return!!n.parentNode}function y(){v++,d=[],l="",r=void 0,g.setAttribute("aria-activedescendant",""),g.setAttribute("aria-expanded","false"),E()}function L(){n.textContent="",g.setAttribute("aria-activedescendant","");var i=function(e,n,i){var r=t.createElement("div");return r.textContent=e.label||"",r};e.render&&(i=e.render);var o=function(e,n){var i=t.createElement("div");return i.textContent=e,i};e.renderGroup&&(o=e.renderGroup);var s=t.createDocumentFragment(),u=h();if(d.forEach((function(t,a){if(t.group&&t.group!==u){u=t.group;var c=o(t.group,l);c&&(c.className+=" group",s.appendChild(c))}var d=i(t,l,a);d&&(d.id=n.id+"_"+a,d.setAttribute("role","option"),d.addEventListener("click",(function(n){b=!0;try{e.onSelect(t,g)}finally{b=!1}y(),n.preventDefault(),n.stopPropagation()})),t===r&&(d.className+=" selected",d.setAttribute("aria-selected","true"),g.setAttribute("aria-activedescendant",d.id)),s.appendChild(d))})),n.appendChild(s),d.length<1){if(!e.emptyMsg)return void y();var f=t.createElement("div");f.id=n.id+"_"+h(),f.className="empty",f.textContent=e.emptyMsg,n.appendChild(f),g.setAttribute("aria-activedescendant",f.id)}n.parentNode||(c||t.body).appendChild(n),function(){if(w()){g.setAttribute("aria-expanded","true"),a.height="auto",a.width=g.offsetWidth+"px";var i,r=0;o(),o(),e.customize&&i&&e.customize(g,i,n,r)}function o(){var e=t.documentElement,n=e.clientTop||t.body.clientTop||0,o=e.clientLeft||t.body.clientLeft||0,s=window.pageYOffset||e.scrollTop,u=window.pageXOffset||e.scrollLeft,c=(i=g.getBoundingClientRect()).top+g.offsetHeight+s-n,d=i.left+u-o;a.top=c+"px",a.left=d+"px",(r=window.innerHeight-(i.top+g.offsetHeight))<0&&(r=0),a.top=c+"px",a.bottom="",a.left=d+"px",a.maxHeight=r+"px"}}(),D()}function x(){w()&&L()}function T(){x()}function k(e){e.target!==n?x():e.preventDefault()}function C(){b||z(0)}function D(){var e=n.getElementsByClassName("selected");if(e.length>0){var t=e[0],i=t.previousElementSibling;if(i&&-1!==i.className.indexOf("group")&&!i.previousElementSibling&&(t=i),t.offsetTop<n.scrollTop)n.scrollTop=t.offsetTop;else{var r=t.offsetTop+t.offsetHeight,o=n.scrollTop+n.offsetHeight;r>o&&(n.scrollTop+=r-o)}}}function N(e){d.length>0&&(!function(e){var i=t.getElementById(n.id+"_"+e);i&&(i.classList.remove("selected"),i.removeAttribute("aria-selected"),g.removeAttribute("aria-activedescendant"))}(e),function(e){var i=t.getElementById(n.id+"_"+e);i&&(i.classList.add("selected"),i.setAttribute("aria-selected","true"),g.setAttribute("aria-activedescendant",i.id))}(d.indexOf(r)),D())}function S(e,t){var n,i=w();if("Escape"===t)y();else{if(!i||d.length<1)return;"ArrowUp"===t?(n=d.indexOf(r),r=-1===n?void 0:d[(n+d.length-1)%d.length],N(n)):function(){var e=d.indexOf(r);r=d.length<1?void 0:-1===e?d[0]:d[(e+1)%d.length],N(e)}()}e.preventDefault(),i&&e.stopPropagation()}function O(t){var n=t.key;switch(n){case"ArrowUp":case"ArrowDown":case"Escape":S(t,n);break;case"Enter":!function(t){if(r){2===i&&t.preventDefault(),b=!0;try{e.onSelect(r,g)}finally{b=!1}y()}1===i&&t.preventDefault()}(t)}}function H(){p&&z(1)}function z(e){g.value.length>=f||1===e?(A(),o=window.setTimeout((function(){return B(g.value,e,g.selectionStart||0)}),0===e||2===e?s:0)):y()}function B(t,n,i){if(!m){var o=++v;e.fetch(t,(function(e){v===o&&e&&(l=t,r=(d=e).length<1||u?void 0:d[0],L())}),n,i)}}function M(t){e.keyup?e.keyup({event:t,fetch:function(){return z(0)}}):w()||"ArrowDown"!==t.key||z(0)}function _(t){e.click&&e.click({event:t,fetch:function(){return z(2)}})}function P(){setTimeout((function(){t.activeElement!==g&&y()}),200)}return n.className="autocomplete "+(e.className||""),n.setAttribute("role","listbox"),g.setAttribute("role","combobox"),g.setAttribute("aria-expanded","false"),g.setAttribute("aria-autocomplete","list"),g.setAttribute("aria-controls",n.id),g.setAttribute("aria-owns",n.id),g.setAttribute("aria-activedescendant",""),g.setAttribute("aria-haspopup","listbox"),a.position="absolute",n.addEventListener("mousedown",(function(e){e.stopPropagation(),e.preventDefault()})),n.addEventListener("focus",(function(){return g.focus()})),E(),g.addEventListener("keyup",M),g.addEventListener("click",_),g.addEventListener("keydown",O),g.addEventListener("input",C),g.addEventListener("blur",P),g.addEventListener("focus",H),window.addEventListener("resize",T),t.addEventListener("scroll",k,!0),{destroy:function(){g.removeEventListener("focus",H),g.removeEventListener("keyup",M),g.removeEventListener("click",_),g.removeEventListener("keydown",O),g.removeEventListener("input",C),g.removeEventListener("blur",P),window.removeEventListener("resize",T),t.removeEventListener("scroll",k,!0),g.removeAttribute("role"),g.removeAttribute("aria-expanded"),g.removeAttribute("aria-autocomplete"),g.removeAttribute("aria-controls"),g.removeAttribute("aria-activedescendant"),g.removeAttribute("aria-owns"),g.removeAttribute("aria-haspopup"),A(),y(),m=!0},fetch:function(){B(g.value,3,g.selectionStart||0)}}}}));
*/return function(e){var t=document,n=e.container||t.createElement("div"),i=e.preventSubmit||0;n.id=n.id||"autocomplete-"+h();var r,o,a=n.style,s=e.debounceWaitMs||0,u=e.disableAutoSelect||!1,c=n.parentElement,d=[],l="",f=2,p=e.showOnFocus,v=0,m=!1,b=!1;if(void 0!==e.minLength&&(f=e.minLength),!e.input)throw new Error("input undefined");var g=e.input;function h(){return Date.now().toString(36)+Math.random().toString(36).substring(2)}function E(){var e=n.parentNode;e&&e.removeChild(n)}function A(){o&&window.clearTimeout(o)}function w(){return!!n.parentNode}function y(){v++,d=[],l="",r=void 0,g.setAttribute("aria-activedescendant",""),g.setAttribute("aria-expanded","false"),E()}function L(){n.textContent="",g.setAttribute("aria-activedescendant","");var i=function(e,n,i){var r=t.createElement("div");return r.textContent=e.label||"",r};e.render&&(i=e.render);var o=function(e,n){var i=t.createElement("div");return i.textContent=e,i};e.renderGroup&&(o=e.renderGroup);var s=t.createDocumentFragment(),u=h();if(d.forEach((function(t,a){if(t.group&&t.group!==u){u=t.group;var c=o(t.group,l);c&&(c.className+=" group",s.appendChild(c))}var d=i(t,l,a);d&&(d.id=n.id+"_"+a,d.setAttribute("role","option"),d.addEventListener("click",(function(n){b=!0;try{e.onSelect(t,g)}finally{b=!1}y(),n.preventDefault(),n.stopPropagation()})),t===r&&(d.className+=" selected",d.setAttribute("aria-selected","true"),g.setAttribute("aria-activedescendant",d.id)),s.appendChild(d))})),n.appendChild(s),d.length<1){if(!e.emptyMsg)return void y();var f=t.createElement("div");f.id=n.id+"_"+h(),f.className="empty",f.textContent=e.emptyMsg,n.appendChild(f),g.setAttribute("aria-activedescendant",f.id)}n.parentNode||(c||t.body).appendChild(n),function(){if(w()){g.setAttribute("aria-expanded","true"),a.height="auto",a.width=g.offsetWidth+"px";var i,r=0;o(),o(),e.customize&&i&&e.customize(g,i,n,r)}function o(){var e=t.documentElement,n=e.clientTop||t.body.clientTop||0,o=e.clientLeft||t.body.clientLeft||0,s=window.pageYOffset||e.scrollTop,u=window.pageXOffset||e.scrollLeft,c=(i=g.getBoundingClientRect()).top+g.offsetHeight+s-n,d=i.left+u-o;a.top=c+"px",a.left=d+"px",(r=window.innerHeight-(i.top+g.offsetHeight))<0&&(r=0),a.top=c+"px",a.bottom="",a.left=d+"px",a.maxHeight=r+"px"}}(),N()}function x(){w()&&L()}function T(){x()}function k(e){e.target!==n?x():e.preventDefault()}function C(){b||z(0)}function N(){var e=n.getElementsByClassName("selected");if(e.length>0){var t=e[0],i=t.previousElementSibling;if(i&&-1!==i.className.indexOf("group")&&!i.previousElementSibling&&(t=i),t.offsetTop<n.scrollTop)n.scrollTop=t.offsetTop;else{var r=t.offsetTop+t.offsetHeight,o=n.scrollTop+n.offsetHeight;r>o&&(n.scrollTop+=r-o)}}}function D(e){d.length>0&&(!function(e){var i=t.getElementById(n.id+"_"+e);i&&(i.classList.remove("selected"),i.removeAttribute("aria-selected"),g.removeAttribute("aria-activedescendant"))}(e),function(e){var i=t.getElementById(n.id+"_"+e);i&&(i.classList.add("selected"),i.setAttribute("aria-selected","true"),g.setAttribute("aria-activedescendant",i.id))}(d.indexOf(r)),N())}function S(e,t){var n,i=w();if("Escape"===t)y();else{if(!i||d.length<1)return;"ArrowUp"===t?(n=d.indexOf(r),r=-1===n?void 0:d[(n+d.length-1)%d.length],D(n)):function(){var e=d.indexOf(r);r=d.length<1?void 0:-1===e?d[0]:d[(e+1)%d.length],D(e)}()}e.preventDefault(),i&&e.stopPropagation()}function O(t){var n=t.key;switch(n){case"ArrowUp":case"ArrowDown":case"Escape":S(t,n);break;case"Enter":!function(t){if(r){2===i&&t.preventDefault(),b=!0;try{e.onSelect(r,g)}finally{b=!1}y()}1===i&&t.preventDefault()}(t)}}function H(){p&&z(1)}function z(e){g.value.length>=f||1===e?(A(),o=window.setTimeout((function(){return B(g.value,e,g.selectionStart||0)}),0===e||2===e?s:0)):y()}function B(t,n,i){if(!m){var o=++v;e.fetch(t,(function(e){v===o&&e&&(l=t,r=(d=e).length<1||u?void 0:d[0],L())}),n,i)}}function M(t){e.keyup?e.keyup({event:t,fetch:function(){return z(0)}}):w()||"ArrowDown"!==t.key||z(0)}function _(t){e.click&&e.click({event:t,fetch:function(){return z(2)}})}function P(){setTimeout((function(){t.activeElement!==g&&y()}),200)}return n.className=[n.className,"autocomplete",e.className||""].join(" ").trim(),n.setAttribute("role","listbox"),g.setAttribute("role","combobox"),g.setAttribute("aria-expanded","false"),g.setAttribute("aria-autocomplete","list"),g.setAttribute("aria-controls",n.id),g.setAttribute("aria-owns",n.id),g.setAttribute("aria-activedescendant",""),g.setAttribute("aria-haspopup","listbox"),a.position="absolute",n.addEventListener("mousedown",(function(e){e.stopPropagation(),e.preventDefault()})),n.addEventListener("focus",(function(){return g.focus()})),E(),g.addEventListener("keyup",M),g.addEventListener("click",_),g.addEventListener("keydown",O),g.addEventListener("input",C),g.addEventListener("blur",P),g.addEventListener("focus",H),window.addEventListener("resize",T),t.addEventListener("scroll",k,!0),{destroy:function(){g.removeEventListener("focus",H),g.removeEventListener("keyup",M),g.removeEventListener("click",_),g.removeEventListener("keydown",O),g.removeEventListener("input",C),g.removeEventListener("blur",P),window.removeEventListener("resize",T),t.removeEventListener("scroll",k,!0),g.removeAttribute("role"),g.removeAttribute("aria-expanded"),g.removeAttribute("aria-autocomplete"),g.removeAttribute("aria-controls"),g.removeAttribute("aria-activedescendant"),g.removeAttribute("aria-owns"),g.removeAttribute("aria-haspopup"),A(),y(),m=!0},fetch:function(){B(g.value,3,g.selectionStart||0)}}}}));
//# sourceMappingURL=autocomplete.min.js.map
/**
* Copyright (c) 2016 Denys Krasnoshchok
* Copyright (c) 2016 Denis Taran
*

@@ -194,3 +194,3 @@ * Homepage: https://smartscheduling.com/en/documentation/autocomplete

container.className = 'autocomplete ' + (settings.className || '');
container.className = [container.className, 'autocomplete', settings.className || ''].join(' ').trim();
container.setAttribute('role', 'listbox');

@@ -197,0 +197,0 @@

{
"name": "autocompleter",
"version": "9.2.1",
"version": "9.3.0",
"description": "Blazing fast and lightweight autocomplete library without dependencies. 1KB gzipped.",

@@ -25,3 +25,3 @@ "main": "autocomplete.js",

},
"author": "Denys Krasnoshchok",
"author": "Denis Taran",
"license": "MIT",

@@ -28,0 +28,0 @@ "devDependencies": {

@@ -264,3 +264,3 @@

Copyright (c) 2016 - Denys Krasnoshchok
Copyright (c) 2016 - Denis Taran

@@ -267,0 +267,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc