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

@nrk/core-input

Package Overview
Dependencies
Maintainers
120
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nrk/core-input - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

4

core-input.cjs.js
'use strict';
var name = "@nrk/core-input";
var version = "1.2.0";
var version = "1.2.1";

@@ -151,3 +151,3 @@ var IS_BROWSER = typeof window !== 'undefined';

if (event.ctrlKey || event.altKey || event.metaKey) { return }
if (event.target.hasAttribute(UUID)) { return onKey(event.target, event) } // Quick check
if (event.target.hasAttribute && event.target.hasAttribute(UUID)) { return onKey(event.target, event) } // Quick check
for (var el = event.target, prev = (void 0); el; el = el.parentElement) { // Check if inside list

@@ -154,0 +154,0 @@ if ((prev = el.previousElementSibling) && prev.hasAttribute(UUID)) { return onKey(prev, event) }

@@ -57,3 +57,3 @@ import { name, version } from './package.json'

if (event.ctrlKey || event.altKey || event.metaKey) return
if (event.target.hasAttribute(UUID)) return onKey(event.target, event) // Quick check
if (event.target.hasAttribute && event.target.hasAttribute(UUID)) return onKey(event.target, event) // Quick check
for (let el = event.target, prev; el; el = el.parentElement) { // Check if inside list

@@ -60,0 +60,0 @@ if ((prev = el.previousElementSibling) && prev.hasAttribute(UUID)) return onKey(prev, event)

@@ -1,3 +0,3 @@

/*! @nrk/core-input v1.2.0 - Copyright (c) 2017-2019 NRK */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["react","prop-types"],t):(e=e||self).CoreInput=t(e.React,e.PropTypes)}(this,function(a,e){"use strict";a=a&&a.hasOwnProperty("default")?a.default:a,e=e&&e.hasOwnProperty("default")?e.default:e;var t="undefined"!=typeof window,i=(t&&/(android)/i.test(navigator.userAgent),t&&/iPad|iPhone|iPod/.test(String(navigator.platform))),r=function(e){void 0===e&&(e=!1);try{window.addEventListener("test",null,{get passive(){e=!0}})}catch(e){}return e}();function n(e,t,n,o){(void 0===o&&(o=!1),"undefined"==typeof window||window[e=e+"-"+t])||(r||"object"!=typeof o||(o=Boolean(o.capture)),("resize"===t||"load"===t?window:document).addEventListener(window[e]=t,n,o))}var o={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","/":"&#x2F;","'":"&#x27;"};function u(e){return String(e||"").replace(/[&<>"'/]/g,function(e){return o[e]})}var l="prevent_recursive_dispatch_maximum_callstack";function s(e,t,n){void 0===n&&(n={});var o,r=""+l+t;if(e[r])return!0;e[r]=!0,"function"==typeof window.CustomEvent?o=new window.CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n}):(o=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,n);var i=e.dispatchEvent(o);return e[r]=null,i}function c(e,t){if(void 0===t&&(t=document),e){if(e.nodeType)return[e];if("string"==typeof e)return[].slice.call(t.querySelectorAll(e));if(e.length)return[].slice.call(e)}return[]}var p="data-@nrk/core-input-1.2.0".replace(/\W+/g,"-"),d=13,f=27,h=33,v=34,m=35,y=36,b=38,g=40,x='[tabindex="-1"]',E=500;function w(e,t){var o="object"==typeof t?t:{content:t},r="string"==typeof o.content;return c(e).map(function(e){var t=e.nextElementSibling,n=void 0===o.ajax?e.getAttribute(p):o.ajax;return e.setAttribute(p,n||""),e.setAttribute(i?"data-role":"role","combobox"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("autocomplete","off"),r&&(t.innerHTML=o.content),c("a,button",t).forEach(C),j(e,o.open),e})}function A(a){a.ctrlKey||a.altKey||a.metaKey||a.defaultPrevented||c("["+p+"]").forEach(function(e){var t,n,o=e.nextElementSibling,r=e===a.target||o.contains(a.target),i="click"===a.type&&r&&c(x,o).filter(function(e){return e.contains(a.target)})[0];i?(t=e,n={relatedTarget:o,currentTarget:i,value:i.value||i.textContent.trim()},s(t,"input.select",n)&&(t.value=n.value,t.focus(),j(t,!1))):j(e,r)})}function S(e,t){var n=e.nextElementSibling,o=[e].concat(c(x+":not([hidden])",n)),r=t.keyCode===f&&"true"===e.getAttribute("aria-expanded"),i=o.indexOf(document.activeElement),a=!1;t.keyCode===g?a=o[i+1]||o[0]:t.keyCode===b?a=o[i-1]||o.pop():n.contains(t.target)&&(t.keyCode===m||t.keyCode===v?a=o.pop():t.keyCode===y||t.keyCode===h?a=o[1]:t.keyCode!==d&&e.focus()),j(e,t.keyCode!==f),(!1!==a||r)&&t.preventDefault(),a&&a.focus()}function j(e,t){var n;void 0===t&&(t="true"===e.getAttribute("aria-expanded")),n=function(){e.nextElementSibling[t?"removeAttribute":"setAttribute"]("hidden",""),e.setAttribute("aria-expanded",t)},(window.requestAnimationFrame||window.setTimeout)(n)}function C(e,t,n){e.setAttribute("aria-label",e.textContent.trim()+", "+(t+1)+" av "+n.length),e.setAttribute("tabindex","-1"),e.setAttribute("type","button")}function k(e){var t=e.getAttribute(p),n=k.xhr=k.xhr||new window.XMLHttpRequest;if(!t)return!1;clearTimeout(k.timer),n.abort(),n.onload=function(){try{n.responseJSON=JSON.parse(n.responseText)}catch(e){n.responseJSON=!1}s(e,"input.ajax",n)},k.timer=setTimeout(function(){e.value&&s(e,"input.ajax.beforeSend",n)&&(n.open("GET",t.replace("{{value}}",window.encodeURIComponent(e.value)),!0),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.send())},E)}w.escapeHTML=u,w.highlight=function(e,t){var n=t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");return u(e).replace(new RegExp(n||".^","gi"),"<mark>$&</mark>")},n(p,"click",A),n(p,"focus",A,!0),n(p,"input",function(e){var i,t,n=e.target;n.hasAttribute(p)&&(t={relatedTarget:(i=n).nextElementSibling},s(i,"input.filter",t)&&!1===k(i)&&c(x,i.nextElementSibling).reduce(function(e,t){var n="LI"===t.parentElement.nodeName&&t.parentElement,o=-1!==t.textContent.toLowerCase().indexOf(i.value.toLowerCase()),r=o?"removeAttribute":"setAttribute";return n&&n[r]("hidden",""),t[r]("hidden",""),o?e.concat(t):e},[]).forEach(C))}),n(p,"keydown",function(e){if(!(e.ctrlKey||e.altKey||e.metaKey)){if(e.target.hasAttribute(p))return S(e.target,e);for(var t=e.target,n=void 0;t;t=t.parentElement)if((n=t.previousElementSibling)&&n.hasAttribute(p))return S(n,e)}},!0);var L=function(t){function i(e){t.call(this,e),this.onFilter=this.onFilter.bind(this),this.onSelect=this.onSelect.bind(this),this.onAjax=this.onAjax.bind(this)}t&&(i.__proto__=t),(i.prototype=Object.create(t&&t.prototype)).constructor=i;var e={defaultProps:{configurable:!0}};return e.defaultProps.get=function(){return{open:null,ajax:null,onAjax:null,onFilter:null,onSelect:null}},i.prototype.componentDidMount=function(){this.el.addEventListener("input.filter",this.onFilter),this.el.addEventListener("input.select",this.onSelect),this.el.addEventListener("input.ajax",this.onAjax),w(this.el.firstElementChild,this.props)},i.prototype.componentDidUpdate=function(){w(this.el.firstElementChild)},i.prototype.componentWillUnmount=function(){this.el.removeEventListener("input.filter",this.onFilter),this.el.removeEventListener("input.select",this.onSelect),this.el.removeEventListener("input.ajax",this.onAjax)},i.prototype.onFilter=function(e){this.props.onFilter&&this.props.onFilter(e)},i.prototype.onSelect=function(e){this.props.onSelect&&this.props.onSelect(e)},i.prototype.onAjax=function(e){this.props.onAjax&&this.props.onAjax(e)},i.prototype.render=function(){var n,o,e,r=this;return a.createElement("div",(n=this.props,o=i.defaultProps,void 0===(e={ref:function(e){return r.el=e}})&&(e={}),Object.keys(n).reduce(function(e,t){return o.hasOwnProperty(t)||(e[t]=n[t]),e},e)),a.Children.map(this.props.children,function(e,t){return 0===t?a.cloneElement(e,{"aria-expanded":String(Boolean(r.props.open))}):1===t?a.cloneElement(e,{hidden:!r.props.open}):e}))},Object.defineProperties(i,e),i}(a.Component);return L.Highlight=function(e){var t=e.text,n=e.query;return void 0===n&&(n=""),a.createElement("span",{dangerouslySetInnerHTML:{__html:w.highlight(t,n)}})},L.propTypes={onFilter:e.func,onSelect:e.func,onAjax:e.func,open:e.bool,ajax:e.oneOfType([e.string,e.object])},L});
/*! @nrk/core-input v1.2.1 - Copyright (c) 2017-2019 NRK */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["react","prop-types"],t):(e=e||self).CoreInput=t(e.React,e.PropTypes)}(this,function(a,e){"use strict";a=a&&a.hasOwnProperty("default")?a.default:a,e=e&&e.hasOwnProperty("default")?e.default:e;var t="undefined"!=typeof window,i=(t&&/(android)/i.test(navigator.userAgent),t&&/iPad|iPhone|iPod/.test(String(navigator.platform))),o=function(e){void 0===e&&(e=!1);try{window.addEventListener("test",null,{get passive(){e=!0}})}catch(e){}return e}();function n(e,t,n,r){(void 0===r&&(r=!1),"undefined"==typeof window||window[e=e+"-"+t])||(o||"object"!=typeof r||(r=Boolean(r.capture)),("resize"===t||"load"===t?window:document).addEventListener(window[e]=t,n,r))}var r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","/":"&#x2F;","'":"&#x27;"};function u(e){return String(e||"").replace(/[&<>"'/]/g,function(e){return r[e]})}var l="prevent_recursive_dispatch_maximum_callstack";function s(e,t,n){void 0===n&&(n={});var r,o=""+l+t;if(e[o])return!0;e[o]=!0,"function"==typeof window.CustomEvent?r=new window.CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n}):(r=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,n);var i=e.dispatchEvent(r);return e[o]=null,i}function c(e,t){if(void 0===t&&(t=document),e){if(e.nodeType)return[e];if("string"==typeof e)return[].slice.call(t.querySelectorAll(e));if(e.length)return[].slice.call(e)}return[]}var p="data-@nrk/core-input-1.2.1".replace(/\W+/g,"-"),d=13,f=27,h=33,v=34,m=35,b=36,y=38,g=40,x='[tabindex="-1"]',E=500;function w(e,t){var r="object"==typeof t?t:{content:t},o="string"==typeof r.content;return c(e).map(function(e){var t=e.nextElementSibling,n=void 0===r.ajax?e.getAttribute(p):r.ajax;return e.setAttribute(p,n||""),e.setAttribute(i?"data-role":"role","combobox"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("autocomplete","off"),o&&(t.innerHTML=r.content),c("a,button",t).forEach(C),j(e,r.open),e})}function A(a){a.ctrlKey||a.altKey||a.metaKey||a.defaultPrevented||c("["+p+"]").forEach(function(e){var t,n,r=e.nextElementSibling,o=e===a.target||r.contains(a.target),i="click"===a.type&&o&&c(x,r).filter(function(e){return e.contains(a.target)})[0];i?(t=e,n={relatedTarget:r,currentTarget:i,value:i.value||i.textContent.trim()},s(t,"input.select",n)&&(t.value=n.value,t.focus(),j(t,!1))):j(e,o)})}function S(e,t){var n=e.nextElementSibling,r=[e].concat(c(x+":not([hidden])",n)),o=t.keyCode===f&&"true"===e.getAttribute("aria-expanded"),i=r.indexOf(document.activeElement),a=!1;t.keyCode===g?a=r[i+1]||r[0]:t.keyCode===y?a=r[i-1]||r.pop():n.contains(t.target)&&(t.keyCode===m||t.keyCode===v?a=r.pop():t.keyCode===b||t.keyCode===h?a=r[1]:t.keyCode!==d&&e.focus()),j(e,t.keyCode!==f),(!1!==a||o)&&t.preventDefault(),a&&a.focus()}function j(e,t){var n;void 0===t&&(t="true"===e.getAttribute("aria-expanded")),n=function(){e.nextElementSibling[t?"removeAttribute":"setAttribute"]("hidden",""),e.setAttribute("aria-expanded",t)},(window.requestAnimationFrame||window.setTimeout)(n)}function C(e,t,n){e.setAttribute("aria-label",e.textContent.trim()+", "+(t+1)+" av "+n.length),e.setAttribute("tabindex","-1"),e.setAttribute("type","button")}function k(e){var t=e.getAttribute(p),n=k.xhr=k.xhr||new window.XMLHttpRequest;if(!t)return!1;clearTimeout(k.timer),n.abort(),n.onload=function(){try{n.responseJSON=JSON.parse(n.responseText)}catch(e){n.responseJSON=!1}s(e,"input.ajax",n)},k.timer=setTimeout(function(){e.value&&s(e,"input.ajax.beforeSend",n)&&(n.open("GET",t.replace("{{value}}",window.encodeURIComponent(e.value)),!0),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.send())},E)}w.escapeHTML=u,w.highlight=function(e,t){var n=t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");return u(e).replace(new RegExp(n||".^","gi"),"<mark>$&</mark>")},n(p,"click",A),n(p,"focus",A,!0),n(p,"input",function(e){var i,t,n=e.target;n.hasAttribute(p)&&(t={relatedTarget:(i=n).nextElementSibling},s(i,"input.filter",t)&&!1===k(i)&&c(x,i.nextElementSibling).reduce(function(e,t){var n="LI"===t.parentElement.nodeName&&t.parentElement,r=-1!==t.textContent.toLowerCase().indexOf(i.value.toLowerCase()),o=r?"removeAttribute":"setAttribute";return n&&n[o]("hidden",""),t[o]("hidden",""),r?e.concat(t):e},[]).forEach(C))}),n(p,"keydown",function(e){if(!(e.ctrlKey||e.altKey||e.metaKey)){if(e.target.hasAttribute&&e.target.hasAttribute(p))return S(e.target,e);for(var t=e.target,n=void 0;t;t=t.parentElement)if((n=t.previousElementSibling)&&n.hasAttribute(p))return S(n,e)}},!0);var L=function(t){function i(e){t.call(this,e),this.onFilter=this.onFilter.bind(this),this.onSelect=this.onSelect.bind(this),this.onAjax=this.onAjax.bind(this)}t&&(i.__proto__=t),(i.prototype=Object.create(t&&t.prototype)).constructor=i;var e={defaultProps:{configurable:!0}};return e.defaultProps.get=function(){return{open:null,ajax:null,onAjax:null,onFilter:null,onSelect:null}},i.prototype.componentDidMount=function(){this.el.addEventListener("input.filter",this.onFilter),this.el.addEventListener("input.select",this.onSelect),this.el.addEventListener("input.ajax",this.onAjax),w(this.el.firstElementChild,this.props)},i.prototype.componentDidUpdate=function(){w(this.el.firstElementChild)},i.prototype.componentWillUnmount=function(){this.el.removeEventListener("input.filter",this.onFilter),this.el.removeEventListener("input.select",this.onSelect),this.el.removeEventListener("input.ajax",this.onAjax)},i.prototype.onFilter=function(e){this.props.onFilter&&this.props.onFilter(e)},i.prototype.onSelect=function(e){this.props.onSelect&&this.props.onSelect(e)},i.prototype.onAjax=function(e){this.props.onAjax&&this.props.onAjax(e)},i.prototype.render=function(){var n,r,e,o=this;return a.createElement("div",(n=this.props,r=i.defaultProps,void 0===(e={ref:function(e){return o.el=e}})&&(e={}),Object.keys(n).reduce(function(e,t){return r.hasOwnProperty(t)||(e[t]=n[t]),e},e)),a.Children.map(this.props.children,function(e,t){return 0===t?a.cloneElement(e,{"aria-expanded":String(Boolean(o.props.open))}):1===t?a.cloneElement(e,{hidden:!o.props.open}):e}))},Object.defineProperties(i,e),i}(a.Component);return L.Highlight=function(e){var t=e.text,n=e.query;return void 0===n&&(n=""),a.createElement("span",{dangerouslySetInnerHTML:{__html:w.highlight(t,n)}})},L.propTypes={onFilter:e.func,onSelect:e.func,onAjax:e.func,open:e.bool,ajax:e.oneOfType([e.string,e.object])},L});
//# sourceMappingURL=core-input.jsx.js.map

@@ -1,3 +0,3 @@

/*! @nrk/core-input v1.2.0 - Copyright (c) 2017-2019 NRK */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).coreInput=t()}(this,function(){"use strict";var e="undefined"!=typeof window,o=(e&&/(android)/i.test(navigator.userAgent),e&&/iPad|iPhone|iPod/.test(String(navigator.platform))),i=function(e){void 0===e&&(e=!1);try{window.addEventListener("test",null,{get passive(){e=!0}})}catch(e){}return e}();function t(e,t,n,r){(void 0===r&&(r=!1),"undefined"==typeof window||window[e=e+"-"+t])||(i||"object"!=typeof r||(r=Boolean(r.capture)),("resize"===t||"load"===t?window:document).addEventListener(window[e]=t,n,r))}var n={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","/":"&#x2F;","'":"&#x27;"};function r(e){return String(e||"").replace(/[&<>"'/]/g,function(e){return n[e]})}var a="prevent_recursive_dispatch_maximum_callstack";function u(e,t,n){void 0===n&&(n={});var r,i=""+a+t;if(e[i])return!0;e[i]=!0,"function"==typeof window.CustomEvent?r=new window.CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n}):(r=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,n);var o=e.dispatchEvent(r);return e[i]=null,o}function c(e,t){if(void 0===t&&(t=document),e){if(e.nodeType)return[e];if("string"==typeof e)return[].slice.call(t.querySelectorAll(e));if(e.length)return[].slice.call(e)}return[]}var d="data-@nrk/core-input-1.2.0".replace(/\W+/g,"-"),l=13,f=27,s=33,p=34,v=35,m=36,b=38,g=40,y='[tabindex="-1"]',w=500;function x(e,t){var r="object"==typeof t?t:{content:t},i="string"==typeof r.content;return c(e).map(function(e){var t=e.nextElementSibling,n=void 0===r.ajax?e.getAttribute(d):r.ajax;return e.setAttribute(d,n||""),e.setAttribute(o?"data-role":"role","combobox"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("autocomplete","off"),i&&(t.innerHTML=r.content),c("a,button",t).forEach(C),A(e,r.open),e})}function h(a){a.ctrlKey||a.altKey||a.metaKey||a.defaultPrevented||c("["+d+"]").forEach(function(e){var t,n,r=e.nextElementSibling,i=e===a.target||r.contains(a.target),o="click"===a.type&&i&&c(y,r).filter(function(e){return e.contains(a.target)})[0];o?(t=e,n={relatedTarget:r,currentTarget:o,value:o.value||o.textContent.trim()},u(t,"input.select",n)&&(t.value=n.value,t.focus(),A(t,!1))):A(e,i)})}function E(e,t){var n=e.nextElementSibling,r=[e].concat(c(y+":not([hidden])",n)),i=t.keyCode===f&&"true"===e.getAttribute("aria-expanded"),o=r.indexOf(document.activeElement),a=!1;t.keyCode===g?a=r[o+1]||r[0]:t.keyCode===b?a=r[o-1]||r.pop():n.contains(t.target)&&(t.keyCode===v||t.keyCode===p?a=r.pop():t.keyCode===m||t.keyCode===s?a=r[1]:t.keyCode!==l&&e.focus()),A(e,t.keyCode!==f),(!1!==a||i)&&t.preventDefault(),a&&a.focus()}function A(e,t){var n;void 0===t&&(t="true"===e.getAttribute("aria-expanded")),n=function(){e.nextElementSibling[t?"removeAttribute":"setAttribute"]("hidden",""),e.setAttribute("aria-expanded",t)},(window.requestAnimationFrame||window.setTimeout)(n)}function C(e,t,n){e.setAttribute("aria-label",e.textContent.trim()+", "+(t+1)+" av "+n.length),e.setAttribute("tabindex","-1"),e.setAttribute("type","button")}function k(e){var t=e.getAttribute(d),n=k.xhr=k.xhr||new window.XMLHttpRequest;if(!t)return!1;clearTimeout(k.timer),n.abort(),n.onload=function(){try{n.responseJSON=JSON.parse(n.responseText)}catch(e){n.responseJSON=!1}u(e,"input.ajax",n)},k.timer=setTimeout(function(){e.value&&u(e,"input.ajax.beforeSend",n)&&(n.open("GET",t.replace("{{value}}",window.encodeURIComponent(e.value)),!0),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.send())},w)}return x.escapeHTML=r,x.highlight=function(e,t){var n=t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");return r(e).replace(new RegExp(n||".^","gi"),"<mark>$&</mark>")},t(d,"click",h),t(d,"focus",h,!0),t(d,"input",function(e){var o,t,n=e.target;n.hasAttribute(d)&&(t={relatedTarget:(o=n).nextElementSibling},u(o,"input.filter",t)&&!1===k(o)&&c(y,o.nextElementSibling).reduce(function(e,t){var n="LI"===t.parentElement.nodeName&&t.parentElement,r=-1!==t.textContent.toLowerCase().indexOf(o.value.toLowerCase()),i=r?"removeAttribute":"setAttribute";return n&&n[i]("hidden",""),t[i]("hidden",""),r?e.concat(t):e},[]).forEach(C))}),t(d,"keydown",function(e){if(!(e.ctrlKey||e.altKey||e.metaKey)){if(e.target.hasAttribute(d))return E(e.target,e);for(var t=e.target,n=void 0;t;t=t.parentElement)if((n=t.previousElementSibling)&&n.hasAttribute(d))return E(n,e)}},!0),x});
/*! @nrk/core-input v1.2.1 - Copyright (c) 2017-2019 NRK */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).coreInput=t()}(this,function(){"use strict";var e="undefined"!=typeof window,o=(e&&/(android)/i.test(navigator.userAgent),e&&/iPad|iPhone|iPod/.test(String(navigator.platform))),i=function(e){void 0===e&&(e=!1);try{window.addEventListener("test",null,{get passive(){e=!0}})}catch(e){}return e}();function t(e,t,n,r){(void 0===r&&(r=!1),"undefined"==typeof window||window[e=e+"-"+t])||(i||"object"!=typeof r||(r=Boolean(r.capture)),("resize"===t||"load"===t?window:document).addEventListener(window[e]=t,n,r))}var n={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","/":"&#x2F;","'":"&#x27;"};function r(e){return String(e||"").replace(/[&<>"'/]/g,function(e){return n[e]})}var a="prevent_recursive_dispatch_maximum_callstack";function u(e,t,n){void 0===n&&(n={});var r,i=""+a+t;if(e[i])return!0;e[i]=!0,"function"==typeof window.CustomEvent?r=new window.CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n}):(r=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,n);var o=e.dispatchEvent(r);return e[i]=null,o}function c(e,t){if(void 0===t&&(t=document),e){if(e.nodeType)return[e];if("string"==typeof e)return[].slice.call(t.querySelectorAll(e));if(e.length)return[].slice.call(e)}return[]}var d="data-@nrk/core-input-1.2.1".replace(/\W+/g,"-"),l=13,s=27,f=33,p=34,v=35,m=36,b=38,g=40,y='[tabindex="-1"]',w=500;function x(e,t){var r="object"==typeof t?t:{content:t},i="string"==typeof r.content;return c(e).map(function(e){var t=e.nextElementSibling,n=void 0===r.ajax?e.getAttribute(d):r.ajax;return e.setAttribute(d,n||""),e.setAttribute(o?"data-role":"role","combobox"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("autocomplete","off"),i&&(t.innerHTML=r.content),c("a,button",t).forEach(C),A(e,r.open),e})}function h(a){a.ctrlKey||a.altKey||a.metaKey||a.defaultPrevented||c("["+d+"]").forEach(function(e){var t,n,r=e.nextElementSibling,i=e===a.target||r.contains(a.target),o="click"===a.type&&i&&c(y,r).filter(function(e){return e.contains(a.target)})[0];o?(t=e,n={relatedTarget:r,currentTarget:o,value:o.value||o.textContent.trim()},u(t,"input.select",n)&&(t.value=n.value,t.focus(),A(t,!1))):A(e,i)})}function E(e,t){var n=e.nextElementSibling,r=[e].concat(c(y+":not([hidden])",n)),i=t.keyCode===s&&"true"===e.getAttribute("aria-expanded"),o=r.indexOf(document.activeElement),a=!1;t.keyCode===g?a=r[o+1]||r[0]:t.keyCode===b?a=r[o-1]||r.pop():n.contains(t.target)&&(t.keyCode===v||t.keyCode===p?a=r.pop():t.keyCode===m||t.keyCode===f?a=r[1]:t.keyCode!==l&&e.focus()),A(e,t.keyCode!==s),(!1!==a||i)&&t.preventDefault(),a&&a.focus()}function A(e,t){var n;void 0===t&&(t="true"===e.getAttribute("aria-expanded")),n=function(){e.nextElementSibling[t?"removeAttribute":"setAttribute"]("hidden",""),e.setAttribute("aria-expanded",t)},(window.requestAnimationFrame||window.setTimeout)(n)}function C(e,t,n){e.setAttribute("aria-label",e.textContent.trim()+", "+(t+1)+" av "+n.length),e.setAttribute("tabindex","-1"),e.setAttribute("type","button")}function k(e){var t=e.getAttribute(d),n=k.xhr=k.xhr||new window.XMLHttpRequest;if(!t)return!1;clearTimeout(k.timer),n.abort(),n.onload=function(){try{n.responseJSON=JSON.parse(n.responseText)}catch(e){n.responseJSON=!1}u(e,"input.ajax",n)},k.timer=setTimeout(function(){e.value&&u(e,"input.ajax.beforeSend",n)&&(n.open("GET",t.replace("{{value}}",window.encodeURIComponent(e.value)),!0),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.send())},w)}return x.escapeHTML=r,x.highlight=function(e,t){var n=t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");return r(e).replace(new RegExp(n||".^","gi"),"<mark>$&</mark>")},t(d,"click",h),t(d,"focus",h,!0),t(d,"input",function(e){var o,t,n=e.target;n.hasAttribute(d)&&(t={relatedTarget:(o=n).nextElementSibling},u(o,"input.filter",t)&&!1===k(o)&&c(y,o.nextElementSibling).reduce(function(e,t){var n="LI"===t.parentElement.nodeName&&t.parentElement,r=-1!==t.textContent.toLowerCase().indexOf(o.value.toLowerCase()),i=r?"removeAttribute":"setAttribute";return n&&n[i]("hidden",""),t[i]("hidden",""),r?e.concat(t):e},[]).forEach(C))}),t(d,"keydown",function(e){if(!(e.ctrlKey||e.altKey||e.metaKey)){if(e.target.hasAttribute&&e.target.hasAttribute(d))return E(e.target,e);for(var t=e.target,n=void 0;t;t=t.parentElement)if((n=t.previousElementSibling)&&n.hasAttribute(d))return E(n,e)}},!0),x});
//# sourceMappingURL=core-input.min.js.map

@@ -9,3 +9,3 @@ 'use strict';

var name = "@nrk/core-input";
var version = "1.2.0";
var version = "1.2.1";

@@ -172,3 +172,3 @@ var IS_BROWSER = typeof window !== 'undefined';

if (event.ctrlKey || event.altKey || event.metaKey) { return }
if (event.target.hasAttribute(UUID)) { return onKey(event.target, event) } // Quick check
if (event.target.hasAttribute && event.target.hasAttribute(UUID)) { return onKey(event.target, event) } // Quick check
for (var el = event.target, prev = (void 0); el; el = el.parentElement) { // Check if inside list

@@ -175,0 +175,0 @@ if ((prev = el.previousElementSibling) && prev.hasAttribute(UUID)) { return onKey(prev, event) }

@@ -5,3 +5,3 @@ {

"author": "NRK <opensource@nrk.no> (https://www.nrk.no/)",
"version": "1.2.1",
"version": "1.2.2",
"license": "MIT",

@@ -8,0 +8,0 @@ "main": "core-input.cjs.js",

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