@nrk/core-input
Advanced tools
Comparing version 1.4.4 to 1.4.5
'use strict'; | ||
var name = "@nrk/core-input"; | ||
var version = "1.4.4"; | ||
var version = "1.4.5"; | ||
@@ -6,0 +6,0 @@ var IS_BROWSER = typeof window !== 'undefined'; |
/*! @nrk/core-input v1.4.4 - 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(i,e){"use strict";i=i&&i.hasOwnProperty("default")?i.default:i,e=e&&e.hasOwnProperty("default")?e.default:e;var t="undefined"!=typeof window,u=(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={"&":"&","<":"<",">":">",'"':""","/":"/","'":"'"};function a(e){return String(e||"").replace(/[&<>"'/]/g,function(e){return r[e]})}var l="prevent_recursive_dispatch_maximum_callstack";function c(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 p(e){(window.requestAnimationFrame||window.setTimeout)(e)}function s(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.4.4".replace(/\W+/g,"-"),f=13,m=27,v=33,h=34,b=35,x=36,g=38,y=40,A=500;function E(e,t){var i="object"==typeof t?t:{content:t},a="string"==typeof i.content;return s(e).map(function(e){var t=e.nextElementSibling,n=void 0===i.ajax?e.getAttribute(d):i.ajax,r=void 0===i.limit?e.getAttribute(d+"-limit"):Math.max(i.limit||0,0),o=void 0===i.open?e===document.activeElement:i.open;return e.setAttribute(d,n||""),e.setAttribute(d+"-limit",r||0),e.setAttribute(u?"data-role":"role","combobox"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("autocomplete","off"),a&&(t.innerHTML=i.content),s("a,button",t).forEach(function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return C.apply(void 0,[r].concat(e))}),j(e,o),e})}function w(a){a.ctrlKey||a.altKey||a.metaKey||a.defaultPrevented||s("["+d+"]").forEach(function(e){var t,n,r=e.nextElementSibling,o=e===a.target||r.contains(a.target),i="click"===a.type&&o&&s('[tabindex="-1"]',r).filter(function(e){return e.contains(a.target)})[0];i?(t=e,n={relatedTarget:r,currentTarget:i,value:i.value||i.textContent.trim()},c(t,"input.select",n)&&(t.value=n.value,t.focus(),p(function(){return j(t,!1)}))):j(e,o)})}function S(e,t){var n=e.nextElementSibling,r=[e].concat(s('[tabindex="-1"]:not([hidden])',n)),o=t.keyCode===m&&"true"===e.getAttribute("aria-expanded"),i=r.indexOf(document.activeElement),a=!1;t.keyCode===y?a=r[i+1]||r[0]:t.keyCode===g?a=r[i-1]||r.pop():n.contains(t.target)&&(t.keyCode===b||t.keyCode===h?a=r.pop():t.keyCode===x||t.keyCode===v?a=r[1]:t.keyCode!==f&&e.focus()),j(e,t.keyCode!==m),(!1!==a||o)&&t.preventDefault(),a&&a.focus()}function j(e,t){void 0===t&&(t="true"===e.getAttribute("aria-expanded")),p(function(){e.nextElementSibling[t?"removeAttribute":"setAttribute"]("hidden",""),e.setAttribute("aria-expanded",t)})}function C(e,t,n,r){t.setAttribute("aria-label",t.textContent.trim()+", "+(n+1)+" av "+r.length),t.setAttribute("tabindex","-1"),t.setAttribute("type","button"),(e=Number(e)||1/0)&&e<=n&&t.parentElement.setAttribute("hidden","")}function L(e){var t=e.getAttribute(d),n=L.xhr=L.xhr||new window.XMLHttpRequest;if(!t)return!1;clearTimeout(L.timer),n.abort(),n.onload=function(){try{n.responseJSON=JSON.parse(n.responseText)}catch(e){n.responseJSON=!1}c(e,"input.ajax",n)},L.timer=setTimeout(function(){e.value&&c(e,"input.ajax.beforeSend",n)&&(n.open("GET",t.replace("{{value}}",window.encodeURIComponent(e.value)),!0),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.send())},A)}E.escapeHTML=a,E.highlight=function(e,t){var n=t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");return a(e).replace(new RegExp(n||".^","gi"),"<mark>$&</mark>")},n(d,"click",w),n(d,"focus",w,!0),n(d,"input",function(e){var a,t,n=e.target;n.hasAttribute(d)&&(t={relatedTarget:(a=n).nextElementSibling},c(a,"input.filter",t)&&!1===L(a)&&s('[tabindex="-1"]',a.nextElementSibling).reduce(function(e,t,n){var r="LI"===t.parentElement.nodeName&&t.parentElement,o=-1!==t.textContent.toLowerCase().indexOf(a.value.toLowerCase()),i=o?"removeAttribute":"setAttribute";return r&&r[i]("hidden",""),t[i]("hidden",""),o?e.concat(t):e},[]).forEach(function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return C.apply(void 0,[a.getAttribute(d+"-limit")].concat(e))}))}),n(d,"keydown",function(e){if(!(e.ctrlKey||e.altKey||e.metaKey)){if(e.target.hasAttribute&&e.target.hasAttribute(d))return S(e.target,e);for(var t=e.target,n=void 0;t;t=t.parentElement)if((n=t.previousElementSibling)&&n.hasAttribute(d))return S(n,e)}},!0);var k=function(n){function t(e){var t=this;n.call(this,e),this.onFilter=function(e){return t.props.onFilter&&t.props.onFilter(e)},this.onSelect=function(e){return t.props.onSelect&&t.props.onSelect(e)},this.onAjaxBeforeSend=function(e){return t.props.onAjaxBeforeSend&&t.props.onAjaxBeforeSend(e)},this.onAjax=function(e){return t.props.onAjax&&t.props.onAjax(e)}}n&&(t.__proto__=n),(t.prototype=Object.create(n&&n.prototype)).constructor=t;var e={defaultProps:{configurable:!0}};return e.defaultProps.get=function(){return{open:null,limit:null,ajax:null,onAjax:null,onAjaxBeforeSend:null,onFilter:null,onSelect:null}},t.prototype.componentDidMount=function(){this.el.addEventListener("input.filter",this.onFilter),this.el.addEventListener("input.select",this.onSelect),this.el.addEventListener("input.ajax.beforeSend",this.onAjaxBeforeSend),this.el.addEventListener("input.ajax",this.onAjax),E(this.el.firstElementChild,this.props)},t.prototype.componentDidUpdate=function(){E(this.el.firstElementChild)},t.prototype.componentWillUnmount=function(){this.el.removeEventListener("input.filter",this.onFilter),this.el.removeEventListener("input.select",this.onSelect),this.el.removeEventListener("input.ajax.beforeSend",this.onAjaxBeforeSend),this.el.removeEventListener("input.ajax",this.onAjax)},t.prototype.render=function(){var n,r,e,o=this;return i.createElement("div",(n=this.props,r=t.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)),i.Children.map(this.props.children,function(e,t){return 0===t?i.cloneElement(e,{"aria-expanded":String(Boolean(o.props.open))}):1===t?i.cloneElement(e,{hidden:!o.props.open}):e}))},Object.defineProperties(t,e),t}(i.Component);return k.Highlight=function(e){var t=e.text,n=e.query;return void 0===n&&(n=""),i.createElement("span",{dangerouslySetInnerHTML:{__html:E.highlight(t,n)}})},k.propTypes={onFilter:e.func,onSelect:e.func,onAjaxBeforeSend:e.func,onAjax:e.func,open:e.bool,limit:e.number,ajax:e.oneOfType([e.string,e.object])},k}); | ||
!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(i,e){"use strict";i=i&&i.hasOwnProperty("default")?i.default:i,e=e&&e.hasOwnProperty("default")?e.default:e;var t="undefined"!=typeof window,u=(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={"&":"&","<":"<",">":">",'"':""","/":"/","'":"'"};function a(e){return String(e||"").replace(/[&<>"'/]/g,function(e){return r[e]})}var l="prevent_recursive_dispatch_maximum_callstack";function c(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 p(e){(window.requestAnimationFrame||window.setTimeout)(e)}function s(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.4.5".replace(/\W+/g,"-"),f=13,m=27,v=33,h=34,b=35,x=36,g=38,y=40,A=500;function E(e,t){var i="object"==typeof t?t:{content:t},a="string"==typeof i.content;return s(e).map(function(e){var t=e.nextElementSibling,n=void 0===i.ajax?e.getAttribute(d):i.ajax,r=void 0===i.limit?e.getAttribute(d+"-limit"):Math.max(i.limit||0,0),o=void 0===i.open?e===document.activeElement:i.open;return e.setAttribute(d,n||""),e.setAttribute(d+"-limit",r||0),e.setAttribute(u?"data-role":"role","combobox"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("autocomplete","off"),a&&(t.innerHTML=i.content),s("a,button",t).forEach(function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return C.apply(void 0,[r].concat(e))}),j(e,o),e})}function w(a){a.ctrlKey||a.altKey||a.metaKey||a.defaultPrevented||s("["+d+"]").forEach(function(e){var t,n,r=e.nextElementSibling,o=e===a.target||r.contains(a.target),i="click"===a.type&&o&&s('[tabindex="-1"]',r).filter(function(e){return e.contains(a.target)})[0];i?(t=e,n={relatedTarget:r,currentTarget:i,value:i.value||i.textContent.trim()},c(t,"input.select",n)&&(t.value=n.value,t.focus(),p(function(){return j(t,!1)}))):j(e,o)})}function S(e,t){var n=e.nextElementSibling,r=[e].concat(s('[tabindex="-1"]:not([hidden])',n)),o=t.keyCode===m&&"true"===e.getAttribute("aria-expanded"),i=r.indexOf(document.activeElement),a=!1;t.keyCode===y?a=r[i+1]||r[0]:t.keyCode===g?a=r[i-1]||r.pop():n.contains(t.target)&&(t.keyCode===b||t.keyCode===h?a=r.pop():t.keyCode===x||t.keyCode===v?a=r[1]:t.keyCode!==f&&e.focus()),j(e,t.keyCode!==m),(!1!==a||o)&&t.preventDefault(),a&&a.focus()}function j(e,t){void 0===t&&(t="true"===e.getAttribute("aria-expanded")),p(function(){e.nextElementSibling[t?"removeAttribute":"setAttribute"]("hidden",""),e.setAttribute("aria-expanded",t)})}function C(e,t,n,r){t.setAttribute("aria-label",t.textContent.trim()+", "+(n+1)+" av "+r.length),t.setAttribute("tabindex","-1"),t.setAttribute("type","button"),(e=Number(e)||1/0)&&e<=n&&t.parentElement.setAttribute("hidden","")}function L(e){var t=e.getAttribute(d),n=L.xhr=L.xhr||new window.XMLHttpRequest;if(!t)return!1;clearTimeout(L.timer),n.abort(),n.onload=function(){try{n.responseJSON=JSON.parse(n.responseText)}catch(e){n.responseJSON=!1}c(e,"input.ajax",n)},L.timer=setTimeout(function(){e.value&&c(e,"input.ajax.beforeSend",n)&&(n.open("GET",t.replace("{{value}}",window.encodeURIComponent(e.value)),!0),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.send())},A)}E.escapeHTML=a,E.highlight=function(e,t){var n=t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");return a(e).replace(new RegExp(n||".^","gi"),"<mark>$&</mark>")},n(d,"click",w),n(d,"focus",w,!0),n(d,"input",function(e){var a,t,n=e.target;n.hasAttribute(d)&&(t={relatedTarget:(a=n).nextElementSibling},c(a,"input.filter",t)&&!1===L(a)&&s('[tabindex="-1"]',a.nextElementSibling).reduce(function(e,t,n){var r="LI"===t.parentElement.nodeName&&t.parentElement,o=-1!==t.textContent.toLowerCase().indexOf(a.value.toLowerCase()),i=o?"removeAttribute":"setAttribute";return r&&r[i]("hidden",""),t[i]("hidden",""),o?e.concat(t):e},[]).forEach(function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return C.apply(void 0,[a.getAttribute(d+"-limit")].concat(e))}))}),n(d,"keydown",function(e){if(!(e.ctrlKey||e.altKey||e.metaKey)){if(e.target.hasAttribute&&e.target.hasAttribute(d))return S(e.target,e);for(var t=e.target,n=void 0;t;t=t.parentElement)if((n=t.previousElementSibling)&&n.hasAttribute(d))return S(n,e)}},!0);var k=function(n){function t(e){var t=this;n.call(this,e),this.onFilter=function(e){return t.props.onFilter&&t.props.onFilter(e)},this.onSelect=function(e){return t.props.onSelect&&t.props.onSelect(e)},this.onAjaxBeforeSend=function(e){return t.props.onAjaxBeforeSend&&t.props.onAjaxBeforeSend(e)},this.onAjax=function(e){return t.props.onAjax&&t.props.onAjax(e)}}n&&(t.__proto__=n),(t.prototype=Object.create(n&&n.prototype)).constructor=t;var e={defaultProps:{configurable:!0}};return e.defaultProps.get=function(){return{open:null,limit:null,ajax:null,onAjax:null,onAjaxBeforeSend:null,onFilter:null,onSelect:null}},t.prototype.componentDidMount=function(){this.el.addEventListener("input.filter",this.onFilter),this.el.addEventListener("input.select",this.onSelect),this.el.addEventListener("input.ajax.beforeSend",this.onAjaxBeforeSend),this.el.addEventListener("input.ajax",this.onAjax),E(this.el.firstElementChild,this.props)},t.prototype.componentDidUpdate=function(){E(this.el.firstElementChild)},t.prototype.componentWillUnmount=function(){this.el.removeEventListener("input.filter",this.onFilter),this.el.removeEventListener("input.select",this.onSelect),this.el.removeEventListener("input.ajax.beforeSend",this.onAjaxBeforeSend),this.el.removeEventListener("input.ajax",this.onAjax)},t.prototype.render=function(){var n,r,e,o=this;return i.createElement("div",(n=this.props,r=t.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)),i.Children.map(this.props.children,function(e,t){return 0===t?i.cloneElement(e,{"aria-expanded":String(Boolean(o.props.open))}):1===t?i.cloneElement(e,{hidden:!o.props.open}):e}))},Object.defineProperties(t,e),t}(i.Component);return k.Highlight=function(e){var t=e.text,n=e.query;return void 0===n&&(n=""),i.createElement("span",{dangerouslySetInnerHTML:{__html:E.highlight(t,n)}})},k.propTypes={onFilter:e.func,onSelect:e.func,onAjaxBeforeSend:e.func,onAjax:e.func,open:e.bool,limit:e.number,ajax:e.oneOfType([e.string,e.object])},k}); | ||
//# sourceMappingURL=core-input.jsx.js.map |
/*! @nrk/core-input v1.4.4 - Copyright (c) 2017-2019 NRK */ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).coreInput=e()}(this,function(){"use strict";var t="undefined"!=typeof window,u=(t&&/(android)/i.test(navigator.userAgent),t&&/iPad|iPhone|iPod/.test(String(navigator.platform))),r=function(t){void 0===t&&(t=!1);try{window.addEventListener("test",null,{get passive(){t=!0}})}catch(t){}return t}();function e(t,e,n,i){(void 0===i&&(i=!1),"undefined"==typeof window||window[t=t+"-"+e])||(r||"object"!=typeof i||(i=Boolean(i.capture)),("resize"===e||"load"===e?window:document).addEventListener(window[t]=e,n,i))}var n={"&":"&","<":"<",">":">",'"':""","/":"/","'":"'"};function i(t){return String(t||"").replace(/[&<>"'/]/g,function(t){return n[t]})}var a="prevent_recursive_dispatch_maximum_callstack";function c(t,e,n){void 0===n&&(n={});var i,r=""+a+e;if(t[r])return!0;t[r]=!0,"function"==typeof window.CustomEvent?i=new window.CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n}):(i=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,n);var o=t.dispatchEvent(i);return t[r]=null,o}function d(t){(window.requestAnimationFrame||window.setTimeout)(t)}function l(t,e){if(void 0===e&&(e=document),t){if(t.nodeType)return[t];if("string"==typeof t)return[].slice.call(e.querySelectorAll(t));if(t.length)return[].slice.call(t)}return[]}var f="data-@nrk/core-input-1.4.4".replace(/\W+/g,"-"),s=13,p=27,m=33,v=34,b=35,g=36,y=38,x=40,o=500;function w(t,e){var o="object"==typeof e?e:{content:e},a="string"==typeof o.content;return l(t).map(function(t){var e=t.nextElementSibling,n=void 0===o.ajax?t.getAttribute(f):o.ajax,i=void 0===o.limit?t.getAttribute(f+"-limit"):Math.max(o.limit||0,0),r=void 0===o.open?t===document.activeElement:o.open;return t.setAttribute(f,n||""),t.setAttribute(f+"-limit",i||0),t.setAttribute(u?"data-role":"role","combobox"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("autocomplete","off"),a&&(e.innerHTML=o.content),l("a,button",e).forEach(function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return C.apply(void 0,[i].concat(t))}),E(t,r),t})}function h(a){a.ctrlKey||a.altKey||a.metaKey||a.defaultPrevented||l("["+f+"]").forEach(function(t){var e,n,i=t.nextElementSibling,r=t===a.target||i.contains(a.target),o="click"===a.type&&r&&l('[tabindex="-1"]',i).filter(function(t){return t.contains(a.target)})[0];o?(e=t,n={relatedTarget:i,currentTarget:o,value:o.value||o.textContent.trim()},c(e,"input.select",n)&&(e.value=n.value,e.focus(),d(function(){return E(e,!1)}))):E(t,r)})}function A(t,e){var n=t.nextElementSibling,i=[t].concat(l('[tabindex="-1"]:not([hidden])',n)),r=e.keyCode===p&&"true"===t.getAttribute("aria-expanded"),o=i.indexOf(document.activeElement),a=!1;e.keyCode===x?a=i[o+1]||i[0]:e.keyCode===y?a=i[o-1]||i.pop():n.contains(e.target)&&(e.keyCode===b||e.keyCode===v?a=i.pop():e.keyCode===g||e.keyCode===m?a=i[1]:e.keyCode!==s&&t.focus()),E(t,e.keyCode!==p),(!1!==a||r)&&e.preventDefault(),a&&a.focus()}function E(t,e){void 0===e&&(e="true"===t.getAttribute("aria-expanded")),d(function(){t.nextElementSibling[e?"removeAttribute":"setAttribute"]("hidden",""),t.setAttribute("aria-expanded",e)})}function C(t,e,n,i){e.setAttribute("aria-label",e.textContent.trim()+", "+(n+1)+" av "+i.length),e.setAttribute("tabindex","-1"),e.setAttribute("type","button"),(t=Number(t)||1/0)&&t<=n&&e.parentElement.setAttribute("hidden","")}function k(t){var e=t.getAttribute(f),n=k.xhr=k.xhr||new window.XMLHttpRequest;if(!e)return!1;clearTimeout(k.timer),n.abort(),n.onload=function(){try{n.responseJSON=JSON.parse(n.responseText)}catch(t){n.responseJSON=!1}c(t,"input.ajax",n)},k.timer=setTimeout(function(){t.value&&c(t,"input.ajax.beforeSend",n)&&(n.open("GET",e.replace("{{value}}",window.encodeURIComponent(t.value)),!0),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.send())},o)}return w.escapeHTML=i,w.highlight=function(t,e){var n=e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");return i(t).replace(new RegExp(n||".^","gi"),"<mark>$&</mark>")},e(f,"click",h),e(f,"focus",h,!0),e(f,"input",function(t){var a,e,n=t.target;n.hasAttribute(f)&&(e={relatedTarget:(a=n).nextElementSibling},c(a,"input.filter",e)&&!1===k(a)&&l('[tabindex="-1"]',a.nextElementSibling).reduce(function(t,e,n){var i="LI"===e.parentElement.nodeName&&e.parentElement,r=-1!==e.textContent.toLowerCase().indexOf(a.value.toLowerCase()),o=r?"removeAttribute":"setAttribute";return i&&i[o]("hidden",""),e[o]("hidden",""),r?t.concat(e):t},[]).forEach(function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return C.apply(void 0,[a.getAttribute(f+"-limit")].concat(t))}))}),e(f,"keydown",function(t){if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.target.hasAttribute&&t.target.hasAttribute(f))return A(t.target,t);for(var e=t.target,n=void 0;e;e=e.parentElement)if((n=e.previousElementSibling)&&n.hasAttribute(f))return A(n,t)}},!0),w}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).coreInput=e()}(this,function(){"use strict";var t="undefined"!=typeof window,u=(t&&/(android)/i.test(navigator.userAgent),t&&/iPad|iPhone|iPod/.test(String(navigator.platform))),r=function(t){void 0===t&&(t=!1);try{window.addEventListener("test",null,{get passive(){t=!0}})}catch(t){}return t}();function e(t,e,n,i){(void 0===i&&(i=!1),"undefined"==typeof window||window[t=t+"-"+e])||(r||"object"!=typeof i||(i=Boolean(i.capture)),("resize"===e||"load"===e?window:document).addEventListener(window[t]=e,n,i))}var n={"&":"&","<":"<",">":">",'"':""","/":"/","'":"'"};function i(t){return String(t||"").replace(/[&<>"'/]/g,function(t){return n[t]})}var a="prevent_recursive_dispatch_maximum_callstack";function c(t,e,n){void 0===n&&(n={});var i,r=""+a+e;if(t[r])return!0;t[r]=!0,"function"==typeof window.CustomEvent?i=new window.CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n}):(i=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,n);var o=t.dispatchEvent(i);return t[r]=null,o}function d(t){(window.requestAnimationFrame||window.setTimeout)(t)}function l(t,e){if(void 0===e&&(e=document),t){if(t.nodeType)return[t];if("string"==typeof t)return[].slice.call(e.querySelectorAll(t));if(t.length)return[].slice.call(t)}return[]}var f="data-@nrk/core-input-1.4.5".replace(/\W+/g,"-"),s=13,p=27,m=33,v=34,b=35,g=36,y=38,x=40,o=500;function w(t,e){var o="object"==typeof e?e:{content:e},a="string"==typeof o.content;return l(t).map(function(t){var e=t.nextElementSibling,n=void 0===o.ajax?t.getAttribute(f):o.ajax,i=void 0===o.limit?t.getAttribute(f+"-limit"):Math.max(o.limit||0,0),r=void 0===o.open?t===document.activeElement:o.open;return t.setAttribute(f,n||""),t.setAttribute(f+"-limit",i||0),t.setAttribute(u?"data-role":"role","combobox"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("autocomplete","off"),a&&(e.innerHTML=o.content),l("a,button",e).forEach(function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return C.apply(void 0,[i].concat(t))}),E(t,r),t})}function h(a){a.ctrlKey||a.altKey||a.metaKey||a.defaultPrevented||l("["+f+"]").forEach(function(t){var e,n,i=t.nextElementSibling,r=t===a.target||i.contains(a.target),o="click"===a.type&&r&&l('[tabindex="-1"]',i).filter(function(t){return t.contains(a.target)})[0];o?(e=t,n={relatedTarget:i,currentTarget:o,value:o.value||o.textContent.trim()},c(e,"input.select",n)&&(e.value=n.value,e.focus(),d(function(){return E(e,!1)}))):E(t,r)})}function A(t,e){var n=t.nextElementSibling,i=[t].concat(l('[tabindex="-1"]:not([hidden])',n)),r=e.keyCode===p&&"true"===t.getAttribute("aria-expanded"),o=i.indexOf(document.activeElement),a=!1;e.keyCode===x?a=i[o+1]||i[0]:e.keyCode===y?a=i[o-1]||i.pop():n.contains(e.target)&&(e.keyCode===b||e.keyCode===v?a=i.pop():e.keyCode===g||e.keyCode===m?a=i[1]:e.keyCode!==s&&t.focus()),E(t,e.keyCode!==p),(!1!==a||r)&&e.preventDefault(),a&&a.focus()}function E(t,e){void 0===e&&(e="true"===t.getAttribute("aria-expanded")),d(function(){t.nextElementSibling[e?"removeAttribute":"setAttribute"]("hidden",""),t.setAttribute("aria-expanded",e)})}function C(t,e,n,i){e.setAttribute("aria-label",e.textContent.trim()+", "+(n+1)+" av "+i.length),e.setAttribute("tabindex","-1"),e.setAttribute("type","button"),(t=Number(t)||1/0)&&t<=n&&e.parentElement.setAttribute("hidden","")}function k(t){var e=t.getAttribute(f),n=k.xhr=k.xhr||new window.XMLHttpRequest;if(!e)return!1;clearTimeout(k.timer),n.abort(),n.onload=function(){try{n.responseJSON=JSON.parse(n.responseText)}catch(t){n.responseJSON=!1}c(t,"input.ajax",n)},k.timer=setTimeout(function(){t.value&&c(t,"input.ajax.beforeSend",n)&&(n.open("GET",e.replace("{{value}}",window.encodeURIComponent(t.value)),!0),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.send())},o)}return w.escapeHTML=i,w.highlight=function(t,e){var n=e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");return i(t).replace(new RegExp(n||".^","gi"),"<mark>$&</mark>")},e(f,"click",h),e(f,"focus",h,!0),e(f,"input",function(t){var a,e,n=t.target;n.hasAttribute(f)&&(e={relatedTarget:(a=n).nextElementSibling},c(a,"input.filter",e)&&!1===k(a)&&l('[tabindex="-1"]',a.nextElementSibling).reduce(function(t,e,n){var i="LI"===e.parentElement.nodeName&&e.parentElement,r=-1!==e.textContent.toLowerCase().indexOf(a.value.toLowerCase()),o=r?"removeAttribute":"setAttribute";return i&&i[o]("hidden",""),e[o]("hidden",""),r?t.concat(e):t},[]).forEach(function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return C.apply(void 0,[a.getAttribute(f+"-limit")].concat(t))}))}),e(f,"keydown",function(t){if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.target.hasAttribute&&t.target.hasAttribute(f))return A(t.target,t);for(var e=t.target,n=void 0;e;e=e.parentElement)if((n=e.previousElementSibling)&&n.hasAttribute(f))return A(n,t)}},!0),w}); | ||
//# sourceMappingURL=core-input.min.js.map |
@@ -9,3 +9,3 @@ 'use strict'; | ||
var name = "@nrk/core-input"; | ||
var version = "1.4.4"; | ||
var version = "1.4.5"; | ||
@@ -12,0 +12,0 @@ var IS_BROWSER = typeof window !== 'undefined'; |
@@ -5,3 +5,3 @@ { | ||
"author": "NRK <opensource@nrk.no> (https://www.nrk.no/)", | ||
"version": "1.4.4", | ||
"version": "1.4.5", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "main": "core-input.cjs.js", |
@@ -0,1 +1,9 @@ | ||
# =============== DEPRECATED =============== | ||
> [Use Core Suggest →](https://github.com/nrkno/core-components/tree/master/packages/core-suggest) | ||
--- | ||
## Old readme: | ||
# Core Input | ||
@@ -2,0 +10,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
434
0
115905
12