katalyst-govuk-formbuilder 1.4.0 → 1.5.0
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.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/app/assets/builds/katalyst/govuk/formbuilder.css +58 -5
- data/app/assets/builds/katalyst/govuk/formbuilder.js +98 -64
- data/app/assets/builds/katalyst/govuk/formbuilder.min.js +1 -1
- data/app/assets/stylesheets/katalyst/govuk/components/richtextarea/_index.scss +7 -6
- data/lib/katalyst/govuk/formbuilder/version.rb +1 -1
- data/vendor/assets/stylesheets/govuk-frontend/govuk/all-ie8.scss +8 -0
- data/vendor/assets/stylesheets/govuk-frontend/govuk/components/accordion/_index.scss +3 -3
- data/vendor/assets/stylesheets/govuk-frontend/govuk/components/back-link/_index.scss +1 -1
- data/vendor/assets/stylesheets/govuk-frontend/govuk/components/breadcrumbs/_index.scss +1 -1
- data/vendor/assets/stylesheets/govuk-frontend/govuk/components/button/_index.scss +8 -6
- data/vendor/assets/stylesheets/govuk-frontend/govuk/components/checkboxes/_index.scss +6 -6
- data/vendor/assets/stylesheets/govuk-frontend/govuk/components/file-upload/_index.scss +6 -1
- data/vendor/assets/stylesheets/govuk-frontend/govuk/components/footer/_index.scss +0 -7
- data/vendor/assets/stylesheets/govuk-frontend/govuk/components/input/_index.scss +15 -3
- data/vendor/assets/stylesheets/govuk-frontend/govuk/components/radios/_index.scss +5 -5
- data/vendor/assets/stylesheets/govuk-frontend/govuk/components/select/_index.scss +7 -1
- data/vendor/assets/stylesheets/govuk-frontend/govuk/components/tag/_index.scss +18 -18
- data/vendor/assets/stylesheets/govuk-frontend/govuk/components/textarea/_index.scss +8 -1
- data/vendor/assets/stylesheets/govuk-frontend/govuk/core/_all.scss +1 -0
- data/vendor/assets/stylesheets/govuk-frontend/govuk/core/_govuk-frontend-version.scss +5 -0
- data/vendor/assets/stylesheets/govuk-frontend/govuk/helpers/_colour.scss +5 -2
- data/vendor/assets/stylesheets/govuk-frontend/govuk/helpers/_focused.scss +1 -1
- data/vendor/assets/stylesheets/govuk-frontend/govuk/helpers/_font-faces.scss +1 -1
- data/vendor/assets/stylesheets/govuk-frontend/govuk/objects/_width-container.scss +1 -1
- data/vendor/assets/stylesheets/govuk-frontend/govuk/settings/_colours-organisations.scss +4 -0
- data/vendor/assets/stylesheets/govuk-frontend/govuk/settings/_ie8.scss +16 -0
- data/vendor/assets/stylesheets/govuk-frontend/govuk/settings/_links.scss +5 -1
- data/vendor/assets/stylesheets/govuk-frontend/govuk/tools/_ie8.scss +38 -2
- metadata +4 -3
@@ -1 +1 @@
|
|
1
|
-
function t(t,e){if(window.NodeList.prototype.forEach)return t.forEach(e);for(var n=0;n<t.length;n++)e.call(window,t[n],n,t)}function e(){for(var t=function(t){var e={},n=function(t,o){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var r=t[i],a=o?o+"."+i:i;"object"==typeof r?n(r,a):e[a]=r}};return n(t),e},e={},n=0;n<arguments.length;n++){var o=t(arguments[n]);for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e}function n(t){if("string"!=typeof t)return t;var e=t.trim();return"true"===e||"false"!==e&&(e.length>0&&isFinite(e)?Number(e):t)}function o(t){var e={};for(var o in t)e[o]=n(t[o]);return e}(function(t){var e,n,o,i;"defineProperty"in Object&&function(){try{return Object.defineProperty({},"test",{value:42}),!0}catch(t){return!1}}()||(e=Object.defineProperty,n=Object.prototype.hasOwnProperty("__defineGetter__"),o="Getters & setters cannot be defined on this javascript engine",i="A property cannot both have accessors and be writable or have a value",Object.defineProperty=function(t,r,a){if(e&&(t===window||t===document||t===Element.prototype||t instanceof Element))return e(t,r,a);if(null===t||!(t instanceof Object||"object"==typeof t))throw new TypeError("Object.defineProperty called on non-object");if(!(a instanceof Object))throw new TypeError("Property description must be an object");var s=String(r),c="value"in a||"writable"in a,l="get"in a&&typeof a.get,u="set"in a&&typeof a.set;if(l){if("function"!==l)throw new TypeError("Getter must be a function");if(!n)throw new TypeError(o);if(c)throw new TypeError(i);Object.__defineGetter__.call(t,s,a.get)}else t[s]=a.value;if(u){if("function"!==u)throw new TypeError("Setter must be a function");if(!n)throw new TypeError(o);if(c)throw new TypeError(i);Object.__defineSetter__.call(t,s,a.set)}return"value"in a&&(t[s]=a.value),t})}).call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){"Document"in this||"undefined"==typeof WorkerGlobalScope&&"function"!=typeof importScripts&&(this.HTMLDocument?this.Document=this.HTMLDocument:(this.Document=this.HTMLDocument=document.constructor=new Function("return function Document() {}")(),this.Document.prototype=document))}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){"Element"in this&&"HTMLElement"in this||function(){if(!window.Element||window.HTMLElement){window.Element=window.HTMLElement=new Function("return function Element() {}")();var t,e=document.appendChild(document.createElement("body")),n=e.appendChild(document.createElement("iframe")).contentWindow.document,o=Element.prototype=n.appendChild(n.createElement("*")),i={},r=function(t,e){var n,o,a,s=t.childNodes||[],c=-1;if(1===t.nodeType&&t.constructor!==Element)for(n in t.constructor=Element,i)o=i[n],t[n]=o;for(;a=e&&s[++c];)r(a,e);return t},a=document.getElementsByTagName("*"),s=document.createElement,c=100;o.attachEvent("onpropertychange",(function(t){for(var e,n=t.propertyName,r=!i.hasOwnProperty(n),s=o[n],c=i[n],l=-1;e=a[++l];)1===e.nodeType&&(r||e[n]===c)&&(e[n]=s);i[n]=s})),o.constructor=Element,o.hasAttribute||(o.hasAttribute=function(t){return null!==this.getAttribute(t)}),l()||(document.onreadystatechange=l,t=setInterval(l,25)),document.createElement=function(t){var e=s(String(t).toLowerCase());return r(e)},document.removeChild(e)}else window.HTMLElement=window.Element;function l(){return c--||clearTimeout(t),!(!document.body||document.body.prototype||!/(complete|interactive)/.test(document.readyState))&&(r(document,!0),t&&document.body.prototype&&clearTimeout(t),!!document.body.prototype)}}()}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){(function(){if(!document.documentElement.dataset)return!1;var t=document.createElement("div");return t.setAttribute("data-a-b","c"),t.dataset&&"c"==t.dataset.aB})()||Object.defineProperty(Element.prototype,"dataset",{get:function(){for(var t=this.attributes,e={},n=0;n<t.length;n++){var o=t[n];if(o&&o.name&&/^data-\w[.\w-]*$/.test(o.name)){var i=o.name,r=o.value,a=i.substr(5).replace(/-./g,(function(t){return t.charAt(1).toUpperCase()}));"__defineGetter__"in Object.prototype&&"__defineSetter__"in Object.prototype?Object.defineProperty(e,a,{enumerable:!0,get:function(){return this.value}.bind({value:r||""}),set:function(t,e){void 0!==e?this.setAttribute(t,e):this.removeAttribute(t)}.bind(this,i)}):e[a]=r}}return e}})}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){"trim"in String.prototype||(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")})}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){"Window"in this||"undefined"==typeof WorkerGlobalScope&&"function"!=typeof importScripts&&function(t){t.constructor?t.Window=t.constructor:(t.Window=t.constructor=new Function("return function Window() {}")()).prototype=this}(this)}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){(function(t){if(!("Event"in t))return!1;if("function"==typeof t.Event)return!0;try{return new Event("click"),!0}catch(t){return!1}})(this)||function(){var e={click:1,dblclick:1,keyup:1,keypress:1,keydown:1,mousedown:1,mouseup:1,mousemove:1,mouseover:1,mouseenter:1,mouseleave:1,mouseout:1,storage:1,storagecommit:1,textinput:1};if("undefined"!=typeof document&&"undefined"!=typeof window){var n=window.Event&&window.Event.prototype||null;window.Event=Window.prototype.Event=function(e,n){if(!e)throw new Error("Not enough arguments");var o;if("createEvent"in document){o=document.createEvent("Event");var i=!(!n||n.bubbles===t)&&n.bubbles,r=!(!n||n.cancelable===t)&&n.cancelable;return o.initEvent(e,i,r),o}return(o=document.createEventObject()).type=e,o.bubbles=!(!n||n.bubbles===t)&&n.bubbles,o.cancelable=!(!n||n.cancelable===t)&&n.cancelable,o},n&&Object.defineProperty(window.Event,"prototype",{configurable:!1,enumerable:!1,writable:!0,value:n}),"createEvent"in document||(window.addEventListener=Window.prototype.addEventListener=Document.prototype.addEventListener=Element.prototype.addEventListener=function(){var t=this,n=arguments[0],i=arguments[1];if(t===window&&n in e)throw new Error("In IE8 the event: "+n+" is not available on the window object. Please see https://github.com/Financial-Times/polyfill-service/issues/317 for more information.");t._events||(t._events={}),t._events[n]||(t._events[n]=function(e){var n,i=t._events[e.type].list,r=i.slice(),a=-1,s=r.length;for(e.preventDefault=function(){!1!==e.cancelable&&(e.returnValue=!1)},e.stopPropagation=function(){e.cancelBubble=!0},e.stopImmediatePropagation=function(){e.cancelBubble=!0,e.cancelImmediate=!0},e.currentTarget=t,e.relatedTarget=e.fromElement||null,e.target=e.target||e.srcElement||t,e.timeStamp=(new Date).getTime(),e.clientX&&(e.pageX=e.clientX+document.documentElement.scrollLeft,e.pageY=e.clientY+document.documentElement.scrollTop);++a<s&&!e.cancelImmediate;)a in r&&-1!==o(i,n=r[a])&&"function"==typeof n&&n.call(t,e)},t._events[n].list=[],t.attachEvent&&t.attachEvent("on"+n,t._events[n])),t._events[n].list.push(i)},window.removeEventListener=Window.prototype.removeEventListener=Document.prototype.removeEventListener=Element.prototype.removeEventListener=function(){var t,e=this,n=arguments[0],i=arguments[1];e._events&&e._events[n]&&e._events[n].list&&-1!==(t=o(e._events[n].list,i))&&(e._events[n].list.splice(t,1),e._events[n].list.length||(e.detachEvent&&e.detachEvent("on"+n,e._events[n]),delete e._events[n]))},window.dispatchEvent=Window.prototype.dispatchEvent=Document.prototype.dispatchEvent=Element.prototype.dispatchEvent=function(t){if(!arguments.length)throw new Error("Not enough arguments");if(!t||"string"!=typeof t.type)throw new Error("DOM Events Exception 0");var e=this,n=t.type;try{if(!t.bubbles){t.cancelBubble=!0;var o=function(t){t.cancelBubble=!0,(e||window).detachEvent("on"+n,o)};this.attachEvent("on"+n,o)}this.fireEvent("on"+n,t)}catch(o){t.target=e;do{t.currentTarget=e,"_events"in e&&"function"==typeof e._events[n]&&e._events[n].call(e,t),"function"==typeof e["on"+n]&&e["on"+n].call(e,t),e=9===e.nodeType?e.parentWindow:e.parentNode}while(e&&!t.cancelBubble)}return!0},document.attachEvent("onreadystatechange",(function(){"complete"===document.readyState&&document.dispatchEvent(new Event("DOMContentLoaded",{bubbles:!0}))})))}function o(t,e){for(var n=-1,o=t.length;++n<o;)if(n in t&&t[n]===e)return n;return-1}}()}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){"bind"in Function.prototype||Object.defineProperty(Function.prototype,"bind",{value:function(t){var e,n=Array,o=Object,i=o.prototype,r=n.prototype,a=function(){},s=i.toString,c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,l=Function.prototype.toString;e=function(t){if("function"!=typeof t)return!1;if(c)return function(t){try{return l.call(t),!0}catch(t){return!1}}(t);var e=s.call(t);return"[object Function]"===e||"[object GeneratorFunction]"===e};var u=r.slice,d=r.concat,p=r.push,h=Math.max,f=this;if(!e(f))throw new TypeError("Function.prototype.bind called on incompatible "+f);for(var m,v=u.call(arguments,1),b=h(0,f.length-v.length),y=[],g=0;g<b;g++)p.call(y,"$"+g);return m=Function("binder","return function ("+y.join(",")+"){ return binder.apply(this, arguments); }")((function(){if(this instanceof m){var e=f.apply(this,d.call(v,u.call(arguments)));return o(e)===e?e:this}return f.apply(t,d.call(v,u.call(arguments)))})),f.prototype&&(a.prototype=f.prototype,m.prototype=new a,a.prototype=null),m}})}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{});function i(t,n){if(!t)return this;this.$module=t,this.debounceFormSubmitTimer=null;this.config=e({preventDoubleClick:!1},n||{},o(t.dataset))}function r(t,e){var n=t.closest("["+e+"]");if(n)return n.getAttribute(e)}function a(t,e){this.translations=t||{},this.locale=e&&e.locale||document.documentElement.lang||"en"}i.prototype.init=function(){this.$module&&(this.$module.addEventListener("keydown",this.handleKeyDown),this.$module.addEventListener("click",this.debounce.bind(this)))},i.prototype.handleKeyDown=function(t){var e=t.target;"button"===e.getAttribute("role")&&32===t.keyCode&&(t.preventDefault(),e.click())},i.prototype.debounce=function(t){if(this.config.preventDoubleClick)return this.debounceFormSubmitTimer?(t.preventDefault(),!1):void(this.debounceFormSubmitTimer=setTimeout(function(){this.debounceFormSubmitTimer=null}.bind(this),1e3))},function(t){"document"in this&&"matches"in document.documentElement||(Element.prototype.matches=Element.prototype.webkitMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.mozMatchesSelector||function(t){for(var e=this,n=(e.document||e.ownerDocument).querySelectorAll(t),o=0;n[o]&&n[o]!==e;)++o;return!!n[o]})}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){"document"in this&&"closest"in document.documentElement||(Element.prototype.closest=function(t){for(var e=this;e;){if(e.matches(t))return e;e="SVGElement"in window&&e instanceof SVGElement?e.parentNode:e.parentElement}return null})}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),a.prototype.t=function(t,e){if(!t)throw new Error("i18n: lookup key missing");if(e&&void 0!==e.count&&(t=t+"."+this.getPluralSuffix(t,e.count)),t in this.translations){var n=this.translations[t];if(n.match(/%{(.\S+)}/)){if(!e)throw new Error("i18n: cannot replace placeholders in string if no option data provided");return this.replacePlaceholders(n,e)}return n}return t},a.prototype.replacePlaceholders=function(t,e){var n;return this.hasIntlNumberFormatSupport()&&(n=new Intl.NumberFormat(this.locale)),t.replace(/%{(.\S+)}/g,(function(t,o){if(Object.prototype.hasOwnProperty.call(e,o)){var i=e[o];return!1===i?"":"number"==typeof i&&n?n.format(i):i}throw new Error("i18n: no data found to replace "+t+" placeholder in string")}))},a.prototype.hasIntlPluralRulesSupport=function(){return Boolean(window.Intl&&"PluralRules"in window.Intl&&Intl.PluralRules.supportedLocalesOf(this.locale).length)},a.prototype.hasIntlNumberFormatSupport=function(){return Boolean(window.Intl&&"NumberFormat"in window.Intl&&Intl.NumberFormat.supportedLocalesOf(this.locale).length)},a.prototype.getPluralSuffix=function(t,e){if(e=Number(e),!isFinite(e))return"other";var n;if(t+"."+(n=this.hasIntlPluralRulesSupport()?new Intl.PluralRules(this.locale).select(e):this.selectPluralFormUsingFallbackRules(e))in this.translations)return n;if(t+".other"in this.translations)return console&&"warn"in console&&console.warn('i18n: Missing plural form ".'+n+'" for "'+this.locale+'" locale. Falling back to ".other".'),"other";throw new Error('i18n: Plural form ".other" is required for "'+this.locale+'" locale')},a.prototype.selectPluralFormUsingFallbackRules=function(t){t=Math.abs(Math.floor(t));var e=this.getPluralRulesForLocale();return e?a.pluralRules[e](t):"other"},a.prototype.getPluralRulesForLocale=function(){var t=this.locale,e=t.split("-")[0];for(var n in a.pluralRulesMap)if(Object.prototype.hasOwnProperty.call(a.pluralRulesMap,n))for(var o=a.pluralRulesMap[n],i=0;i<o.length;i++)if(o[i]===t||o[i]===e)return n},a.pluralRulesMap={arabic:["ar"],chinese:["my","zh","id","ja","jv","ko","ms","th","vi"],french:["hy","bn","fr","gu","hi","fa","pa","zu"],german:["af","sq","az","eu","bg","ca","da","nl","en","et","fi","ka","de","el","hu","lb","no","so","sw","sv","ta","te","tr","ur"],irish:["ga"],russian:["ru","uk"],scottish:["gd"],spanish:["pt-PT","it","es"],welsh:["cy"]},a.pluralRules={arabic:function(t){return 0===t?"zero":1===t?"one":2===t?"two":t%100>=3&&t%100<=10?"few":t%100>=11&&t%100<=99?"many":"other"},chinese:function(){return"other"},french:function(t){return 0===t||1===t?"one":"other"},german:function(t){return 1===t?"one":"other"},irish:function(t){return 1===t?"one":2===t?"two":t>=3&&t<=6?"few":t>=7&&t<=10?"many":"other"},russian:function(t){var e=t%100,n=e%10;return 1===n&&11!==e?"one":n>=2&&n<=4&&!(e>=12&&e<=14)?"few":0===n||n>=5&&n<=9||e>=11&&e<=14?"many":"other"},scottish:function(t){return 1===t||11===t?"one":2===t||12===t?"two":t>=3&&t<=10||t>=13&&t<=19?"few":"other"},spanish:function(t){return 1===t?"one":t%1e6==0&&0!==t?"many":"other"},welsh:function(t){return 0===t?"zero":1===t?"one":2===t?"two":3===t?"few":6===t?"many":"other"}},function(t){"Date"in self&&"now"in self.Date&&"getTime"in self.Date.prototype||(Date.now=function(){return(new Date).getTime()})}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){var e;"DOMTokenList"in this&&(!("classList"in(e=document.createElement("x")))||!e.classList.toggle("x",!1)&&!e.className)||function(e){var n;"DOMTokenList"in e&&e.DOMTokenList&&(!document.createElementNS||!document.createElementNS("http://www.w3.org/2000/svg","svg")||document.createElementNS("http://www.w3.org/2000/svg","svg").classList instanceof DOMTokenList)||(e.DOMTokenList=function(){var e=!0,n=function(t,n,o,i){Object.defineProperty?Object.defineProperty(t,n,{configurable:!1===e||!!i,get:o}):t.__defineGetter__(n,o)};try{n({},"support")}catch(t){e=!1}return function(e,o){var i=this,r=[],a={},s=0,c=0,l=function(t){n(i,t,(function(){return d(),r[t]}),!1)},u=function(){if(s>=c)for(;c<s;++c)l(c)},d=function(){var t,n,i=arguments,c=/\s+/;if(i.length)for(n=0;n<i.length;++n)if(c.test(i[n]))throw(t=new SyntaxError('String "'+i[n]+'" contains an invalid character')).code=5,t.name="InvalidCharacterError",t;for(""===(r="object"==typeof e[o]?(""+e[o].baseVal).replace(/^\s+|\s+$/g,"").split(c):(""+e[o]).replace(/^\s+|\s+$/g,"").split(c))[0]&&(r=[]),a={},n=0;n<r.length;++n)a[r[n]]=!0;s=r.length,u()};return d(),n(i,"length",(function(){return d(),s})),i.toLocaleString=i.toString=function(){return d(),r.join(" ")},i.item=function(t){return d(),r[t]},i.contains=function(t){return d(),!!a[t]},i.add=function(){d.apply(i,t=arguments);for(var t,n,c=0,l=t.length;c<l;++c)a[n=t[c]]||(r.push(n),a[n]=!0);s!==r.length&&(s=r.length>>>0,"object"==typeof e[o]?e[o].baseVal=r.join(" "):e[o]=r.join(" "),u())},i.remove=function(){d.apply(i,t=arguments);for(var t,n={},c=0,l=[];c<t.length;++c)n[t[c]]=!0,delete a[t[c]];for(c=0;c<r.length;++c)n[r[c]]||l.push(r[c]);r=l,s=l.length>>>0,"object"==typeof e[o]?e[o].baseVal=r.join(" "):e[o]=r.join(" "),u()},i.toggle=function(e,n){return d.apply(i,[e]),t!==n?n?(i.add(e),!0):(i.remove(e),!1):a[e]?(i.remove(e),!1):(i.add(e),!0)},i}}()),"classList"in(n=document.createElement("span"))&&(n.classList.toggle("x",!1),n.classList.contains("x")&&(n.classList.constructor.prototype.toggle=function(e){var n=arguments[1];if(n===t){var o=!this.contains(e);return this[o?"add":"remove"](e),o}return this[(n=!!n)?"add":"remove"](e),n})),function(){var t=document.createElement("span");if("classList"in t&&(t.classList.add("a","b"),!t.classList.contains("b"))){var e=t.classList.constructor.prototype.add;t.classList.constructor.prototype.add=function(){for(var t=arguments,n=arguments.length,o=0;o<n;o++)e.call(this,t[o])}}}(),function(){var t=document.createElement("span");if("classList"in t&&(t.classList.add("a"),t.classList.add("b"),t.classList.remove("a","b"),t.classList.contains("b"))){var e=t.classList.constructor.prototype.remove;t.classList.constructor.prototype.remove=function(){for(var t=arguments,n=arguments.length,o=0;o<n;o++)e.call(this,t[o])}}}()}(this)}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){var e;"document"in this&&"classList"in document.documentElement&&"Element"in this&&"classList"in Element.prototype&&((e=document.createElement("span")).classList.add("a","b"),e.classList.contains("b"))||function(t){var e=!0,n=function(t,n,o,i){Object.defineProperty?Object.defineProperty(t,n,{configurable:!1===e||!!i,get:o}):t.__defineGetter__(n,o)};try{n({},"support")}catch(t){e=!1}var o=function(t,i,r){n(t.prototype,i,(function(){var t,a=this,s="__defineGetter__DEFINE_PROPERTY"+i;if(a[s])return t;if(a[s]=!0,!1===e){for(var c,l=o.mirror||document.createElement("div"),u=l.childNodes,d=u.length,p=0;p<d;++p)if(u[p]._R===a){c=u[p];break}c||(c=l.appendChild(document.createElement("div"))),t=DOMTokenList.call(c,a,r)}else t=new DOMTokenList(a,r);return n(a,i,(function(){return t})),delete a[s],t}),!0)};o(t.Element,"classList","className"),o(t.HTMLElement,"classList","className"),o(t.HTMLLinkElement,"relList","rel"),o(t.HTMLAnchorElement,"relList","rel"),o(t.HTMLAreaElement,"relList","rel")}(this)}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{});var s={charactersUnderLimit:{one:"You have %{count} character remaining",other:"You have %{count} characters remaining"},charactersAtLimit:"You have 0 characters remaining",charactersOverLimit:{one:"You have %{count} character too many",other:"You have %{count} characters too many"},wordsUnderLimit:{one:"You have %{count} word remaining",other:"You have %{count} words remaining"},wordsAtLimit:"You have 0 words remaining",wordsOverLimit:{one:"You have %{count} word too many",other:"You have %{count} words too many"},textareaDescription:{other:""}};function c(t,n){if(!t)return this;var i={threshold:0,i18n:s},c=o(t.dataset),l={};if(("maxwords"in c||"maxlength"in c)&&(l={maxlength:!1,maxwords:!1}),this.config=e(i,n||{},l,c),this.i18n=new a(function(t,e){if(!t||"object"!=typeof t)throw new Error('Provide a `configObject` of type "object".');if(!e||"string"!=typeof e)throw new Error('Provide a `namespace` of type "string" to filter the `configObject` by.');var n={};for(var o in t){var i=o.split(".");Object.prototype.hasOwnProperty.call(t,o)&&i[0]===e&&(i.length>1&&i.shift(),n[i.join(".")]=t[o])}return n}(this.config,"i18n"),{locale:r(t,"lang")}),this.config.maxwords)this.maxLength=this.config.maxwords;else{if(!this.config.maxlength)return;this.maxLength=this.config.maxlength}this.$module=t,this.$textarea=t.querySelector(".govuk-js-character-count"),this.$visibleCountMessage=null,this.$screenReaderCountMessage=null,this.lastInputTimestamp=null}function l(t){this.$module=t,this.$inputs=t.querySelectorAll('input[type="checkbox"]')}function u(t,n){if(!t)return this;this.$module=t;this.config=e({disableAutoFocus:!1},n||{},o(t.dataset))}function d(t){this.$module=t,this.$inputs=t.querySelectorAll('input[type="radio"]')}function p(e){const n=void 0!==(e=void 0!==e?e:{}).scope?e.scope:document;t(n.querySelectorAll('[data-module="govuk-button"]'),(function(t){new i(t).init()}));t(n.querySelectorAll('[data-module="govuk-character-count"]'),(function(t){new c(t).init()}));t(n.querySelectorAll('[data-module="govuk-checkboxes"]'),(function(t){new l(t).init()}));new u(n.querySelector('[data-module="govuk-error-summary"]')).init();t(n.querySelectorAll('[data-module="govuk-radios"]'),(function(t){new d(t).init()}))}c.prototype.init=function(){if(this.$textarea){var t=this.$textarea,e=document.getElementById(t.id+"-info");e.innerText.match(/^\s*$/)&&(e.innerText=this.i18n.t("textareaDescription",{count:this.maxLength})),t.insertAdjacentElement("afterend",e);var n=document.createElement("div");n.className="govuk-character-count__sr-status govuk-visually-hidden",n.setAttribute("aria-live","polite"),this.$screenReaderCountMessage=n,e.insertAdjacentElement("afterend",n);var o=document.createElement("div");o.className=e.className,o.classList.add("govuk-character-count__status"),o.setAttribute("aria-hidden","true"),this.$visibleCountMessage=o,e.insertAdjacentElement("afterend",o),e.classList.add("govuk-visually-hidden"),t.removeAttribute("maxlength"),this.bindChangeEvents(),"onpageshow"in window?window.addEventListener("pageshow",this.updateCountMessage.bind(this)):window.addEventListener("DOMContentLoaded",this.updateCountMessage.bind(this)),this.updateCountMessage()}},c.prototype.bindChangeEvents=function(){var t=this.$textarea;t.addEventListener("keyup",this.handleKeyUp.bind(this)),t.addEventListener("focus",this.handleFocus.bind(this)),t.addEventListener("blur",this.handleBlur.bind(this))},c.prototype.handleKeyUp=function(){this.updateVisibleCountMessage(),this.lastInputTimestamp=Date.now()},c.prototype.handleFocus=function(){this.valueChecker=setInterval(function(){(!this.lastInputTimestamp||Date.now()-500>=this.lastInputTimestamp)&&this.updateIfValueChanged()}.bind(this),1e3)},c.prototype.handleBlur=function(){clearInterval(this.valueChecker)},c.prototype.updateIfValueChanged=function(){this.$textarea.oldValue||(this.$textarea.oldValue=""),this.$textarea.value!==this.$textarea.oldValue&&(this.$textarea.oldValue=this.$textarea.value,this.updateCountMessage())},c.prototype.updateCountMessage=function(){this.updateVisibleCountMessage(),this.updateScreenReaderCountMessage()},c.prototype.updateVisibleCountMessage=function(){var t=this.$textarea,e=this.$visibleCountMessage,n=this.maxLength-this.count(t.value);this.isOverThreshold()?e.classList.remove("govuk-character-count__message--disabled"):e.classList.add("govuk-character-count__message--disabled"),n<0?(t.classList.add("govuk-textarea--error"),e.classList.remove("govuk-hint"),e.classList.add("govuk-error-message")):(t.classList.remove("govuk-textarea--error"),e.classList.remove("govuk-error-message"),e.classList.add("govuk-hint")),e.innerText=this.getCountMessage()},c.prototype.updateScreenReaderCountMessage=function(){var t=this.$screenReaderCountMessage;this.isOverThreshold()?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",!0),t.innerText=this.getCountMessage()},c.prototype.count=function(t){return this.config.maxwords?(t.match(/\S+/g)||[]).length:t.length},c.prototype.getCountMessage=function(){var t=this.maxLength-this.count(this.$textarea.value),e=this.config.maxwords?"words":"characters";return this.formatCountMessage(t,e)},c.prototype.formatCountMessage=function(t,e){if(0===t)return this.i18n.t(e+"AtLimit");var n=t<0?"OverLimit":"UnderLimit";return this.i18n.t(e+n,{count:Math.abs(t)})},c.prototype.isOverThreshold=function(){if(!this.config.threshold)return!0;var t=this.$textarea,e=this.count(t.value);return this.maxLength*this.config.threshold/100<=e},l.prototype.init=function(){var e=this.$module;t(this.$inputs,(function(t){var e=t.getAttribute("data-aria-controls");e&&document.getElementById(e)&&(t.setAttribute("aria-controls",e),t.removeAttribute("data-aria-controls"))})),"onpageshow"in window?window.addEventListener("pageshow",this.syncAllConditionalReveals.bind(this)):window.addEventListener("DOMContentLoaded",this.syncAllConditionalReveals.bind(this)),this.syncAllConditionalReveals(),e.addEventListener("click",this.handleClick.bind(this))},l.prototype.syncAllConditionalReveals=function(){t(this.$inputs,this.syncConditionalRevealWithInputState.bind(this))},l.prototype.syncConditionalRevealWithInputState=function(t){var e=document.getElementById(t.getAttribute("aria-controls"));if(e&&e.classList.contains("govuk-checkboxes__conditional")){var n=t.checked;t.setAttribute("aria-expanded",n),e.classList.toggle("govuk-checkboxes__conditional--hidden",!n)}},l.prototype.unCheckAllInputsExcept=function(e){t(document.querySelectorAll('input[type="checkbox"][name="'+e.name+'"]'),function(t){e.form===t.form&&t!==e&&(t.checked=!1,this.syncConditionalRevealWithInputState(t))}.bind(this))},l.prototype.unCheckExclusiveInputs=function(e){t(document.querySelectorAll('input[data-behaviour="exclusive"][type="checkbox"][name="'+e.name+'"]'),function(t){e.form===t.form&&(t.checked=!1,this.syncConditionalRevealWithInputState(t))}.bind(this))},l.prototype.handleClick=function(t){var e=t.target;"checkbox"===e.type&&(e.getAttribute("aria-controls")&&this.syncConditionalRevealWithInputState(e),e.checked&&("exclusive"===e.getAttribute("data-behaviour")?this.unCheckAllInputsExcept(e):this.unCheckExclusiveInputs(e)))},u.prototype.init=function(){var t=this.$module;t&&(this.setFocus(),t.addEventListener("click",this.handleClick.bind(this)))},u.prototype.setFocus=function(){var t=this.$module;this.config.disableAutoFocus||(t.setAttribute("tabindex","-1"),t.addEventListener("blur",(function(){t.removeAttribute("tabindex")})),t.focus())},u.prototype.handleClick=function(t){var e=t.target;this.focusTarget(e)&&t.preventDefault()},u.prototype.focusTarget=function(t){if("A"!==t.tagName||!1===t.href)return!1;var e=this.getFragmentFromUrl(t.href),n=document.getElementById(e);if(!n)return!1;var o=this.getAssociatedLegendOrLabel(n);return!!o&&(o.scrollIntoView(),n.focus({preventScroll:!0}),!0)},u.prototype.getFragmentFromUrl=function(t){return-1!==t.indexOf("#")&&t.split("#").pop()},u.prototype.getAssociatedLegendOrLabel=function(t){var e=t.closest("fieldset");if(e){var n=e.getElementsByTagName("legend");if(n.length){var o=n[0];if("checkbox"===t.type||"radio"===t.type)return o;var i=o.getBoundingClientRect().top,r=t.getBoundingClientRect();if(r.height&&window.innerHeight)if(r.top+r.height-i<window.innerHeight/2)return o}}return document.querySelector("label[for='"+t.getAttribute("id")+"']")||t.closest("label")},d.prototype.init=function(){var e=this.$module;t(this.$inputs,(function(t){var e=t.getAttribute("data-aria-controls");e&&document.getElementById(e)&&(t.setAttribute("aria-controls",e),t.removeAttribute("data-aria-controls"))})),"onpageshow"in window?window.addEventListener("pageshow",this.syncAllConditionalReveals.bind(this)):window.addEventListener("DOMContentLoaded",this.syncAllConditionalReveals.bind(this)),this.syncAllConditionalReveals(),e.addEventListener("click",this.handleClick.bind(this))},d.prototype.syncAllConditionalReveals=function(){t(this.$inputs,this.syncConditionalRevealWithInputState.bind(this))},d.prototype.syncConditionalRevealWithInputState=function(t){var e=document.getElementById(t.getAttribute("aria-controls"));if(e&&e.classList.contains("govuk-radios__conditional")){var n=t.checked;t.setAttribute("aria-expanded",n),e.classList.toggle("govuk-radios__conditional--hidden",!n)}},d.prototype.handleClick=function(e){var n=e.target;"radio"===n.type&&t(document.querySelectorAll('input[type="radio"][aria-controls]'),function(t){var e=t.form===n.form;t.name===n.name&&e&&this.syncConditionalRevealWithInputState(t)}.bind(this))};export{i as Button,c as CharacterCount,l as Checkboxes,u as ErrorSummary,d as Radios,p as initAll};
|
1
|
+
function t(t,e){if(window.NodeList.prototype.forEach)return t.forEach(e);for(var n=0;n<t.length;n++)e.call(window,t[n],n,t)}function e(){for(var t=function(t){var e={},n=function(t,o){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var r=t[i],a=o?o+"."+i:i;"object"==typeof r?n(r,a):e[a]=r}};return n(t),e},e={},n=0;n<arguments.length;n++){var o=t(arguments[n]);for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e}function n(t){if("string"!=typeof t)return t;var e=t.trim();return"true"===e||"false"!==e&&(e.length>0&&isFinite(Number(e))?Number(e):t)}function o(t){var e={};for(var o in t)e[o]=n(t[o]);return e}(function(t){var e,n,o,i;"defineProperty"in Object&&function(){try{return Object.defineProperty({},"test",{value:42}),!0}catch(t){return!1}}()||(e=Object.defineProperty,n=Object.prototype.hasOwnProperty("__defineGetter__"),o="Getters & setters cannot be defined on this javascript engine",i="A property cannot both have accessors and be writable or have a value",Object.defineProperty=function(t,r,a){if(e&&(t===window||t===document||t===Element.prototype||t instanceof Element))return e(t,r,a);if(null===t||!(t instanceof Object||"object"==typeof t))throw new TypeError("Object.defineProperty called on non-object");if(!(a instanceof Object))throw new TypeError("Property description must be an object");var s=String(r),c="value"in a||"writable"in a,l="get"in a&&typeof a.get,u="set"in a&&typeof a.set;if(l){if("function"!==l)throw new TypeError("Getter must be a function");if(!n)throw new TypeError(o);if(c)throw new TypeError(i);Object.__defineGetter__.call(t,s,a.get)}else t[s]=a.value;if(u){if("function"!==u)throw new TypeError("Setter must be a function");if(!n)throw new TypeError(o);if(c)throw new TypeError(i);Object.__defineSetter__.call(t,s,a.set)}return"value"in a&&(t[s]=a.value),t})}).call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){"Document"in this||"undefined"==typeof WorkerGlobalScope&&"function"!=typeof importScripts&&(this.HTMLDocument?this.Document=this.HTMLDocument:(this.Document=this.HTMLDocument=document.constructor=new Function("return function Document() {}")(),this.Document.prototype=document))}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){"Element"in this&&"HTMLElement"in this||function(){if(!window.Element||window.HTMLElement){window.Element=window.HTMLElement=new Function("return function Element() {}")();var t,e=document.appendChild(document.createElement("body")),n=e.appendChild(document.createElement("iframe")).contentWindow.document,o=Element.prototype=n.appendChild(n.createElement("*")),i={},r=function(t,e){var n,o,a,s=t.childNodes||[],c=-1;if(1===t.nodeType&&t.constructor!==Element)for(n in t.constructor=Element,i)o=i[n],t[n]=o;for(;a=e&&s[++c];)r(a,e);return t},a=document.getElementsByTagName("*"),s=document.createElement,c=100;o.attachEvent("onpropertychange",(function(t){for(var e,n=t.propertyName,r=!i.hasOwnProperty(n),s=o[n],c=i[n],l=-1;e=a[++l];)1===e.nodeType&&(r||e[n]===c)&&(e[n]=s);i[n]=s})),o.constructor=Element,o.hasAttribute||(o.hasAttribute=function(t){return null!==this.getAttribute(t)}),l()||(document.onreadystatechange=l,t=setInterval(l,25)),document.createElement=function(t){var e=s(String(t).toLowerCase());return r(e)},document.removeChild(e)}else window.HTMLElement=window.Element;function l(){return c--||clearTimeout(t),!(!document.body||document.body.prototype||!/(complete|interactive)/.test(document.readyState))&&(r(document,!0),t&&document.body.prototype&&clearTimeout(t),!!document.body.prototype)}}()}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){(function(){if(!document.documentElement.dataset)return!1;var t=document.createElement("div");return t.setAttribute("data-a-b","c"),t.dataset&&"c"==t.dataset.aB})()||Object.defineProperty(Element.prototype,"dataset",{get:function(){for(var t=this.attributes,e={},n=0;n<t.length;n++){var o=t[n];if(o&&o.name&&/^data-\w[.\w-]*$/.test(o.name)){var i=o.name,r=o.value,a=i.substr(5).replace(/-./g,(function(t){return t.charAt(1).toUpperCase()}));"__defineGetter__"in Object.prototype&&"__defineSetter__"in Object.prototype?Object.defineProperty(e,a,{enumerable:!0,get:function(){return this.value}.bind({value:r||""}),set:function(t,e){void 0!==e?this.setAttribute(t,e):this.removeAttribute(t)}.bind(this,i)}):e[a]=r}}return e}})}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){"trim"in String.prototype||(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")})}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){"Window"in this||"undefined"==typeof WorkerGlobalScope&&"function"!=typeof importScripts&&function(t){t.constructor?t.Window=t.constructor:(t.Window=t.constructor=new Function("return function Window() {}")()).prototype=this}(this)}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){(function(t){if(!("Event"in t))return!1;if("function"==typeof t.Event)return!0;try{return new Event("click"),!0}catch(t){return!1}})(this)||function(){var e={click:1,dblclick:1,keyup:1,keypress:1,keydown:1,mousedown:1,mouseup:1,mousemove:1,mouseover:1,mouseenter:1,mouseleave:1,mouseout:1,storage:1,storagecommit:1,textinput:1};if("undefined"!=typeof document&&"undefined"!=typeof window){var n=window.Event&&window.Event.prototype||null;window.Event=Window.prototype.Event=function(e,n){if(!e)throw new Error("Not enough arguments");var o;if("createEvent"in document){o=document.createEvent("Event");var i=!(!n||n.bubbles===t)&&n.bubbles,r=!(!n||n.cancelable===t)&&n.cancelable;return o.initEvent(e,i,r),o}return(o=document.createEventObject()).type=e,o.bubbles=!(!n||n.bubbles===t)&&n.bubbles,o.cancelable=!(!n||n.cancelable===t)&&n.cancelable,o},n&&Object.defineProperty(window.Event,"prototype",{configurable:!1,enumerable:!1,writable:!0,value:n}),"createEvent"in document||(window.addEventListener=Window.prototype.addEventListener=Document.prototype.addEventListener=Element.prototype.addEventListener=function(){var t=this,n=arguments[0],i=arguments[1];if(t===window&&n in e)throw new Error("In IE8 the event: "+n+" is not available on the window object. Please see https://github.com/Financial-Times/polyfill-service/issues/317 for more information.");t._events||(t._events={}),t._events[n]||(t._events[n]=function(e){var n,i=t._events[e.type].list,r=i.slice(),a=-1,s=r.length;for(e.preventDefault=function(){!1!==e.cancelable&&(e.returnValue=!1)},e.stopPropagation=function(){e.cancelBubble=!0},e.stopImmediatePropagation=function(){e.cancelBubble=!0,e.cancelImmediate=!0},e.currentTarget=t,e.relatedTarget=e.fromElement||null,e.target=e.target||e.srcElement||t,e.timeStamp=(new Date).getTime(),e.clientX&&(e.pageX=e.clientX+document.documentElement.scrollLeft,e.pageY=e.clientY+document.documentElement.scrollTop);++a<s&&!e.cancelImmediate;)a in r&&-1!==o(i,n=r[a])&&"function"==typeof n&&n.call(t,e)},t._events[n].list=[],t.attachEvent&&t.attachEvent("on"+n,t._events[n])),t._events[n].list.push(i)},window.removeEventListener=Window.prototype.removeEventListener=Document.prototype.removeEventListener=Element.prototype.removeEventListener=function(){var t,e=this,n=arguments[0],i=arguments[1];e._events&&e._events[n]&&e._events[n].list&&-1!==(t=o(e._events[n].list,i))&&(e._events[n].list.splice(t,1),e._events[n].list.length||(e.detachEvent&&e.detachEvent("on"+n,e._events[n]),delete e._events[n]))},window.dispatchEvent=Window.prototype.dispatchEvent=Document.prototype.dispatchEvent=Element.prototype.dispatchEvent=function(t){if(!arguments.length)throw new Error("Not enough arguments");if(!t||"string"!=typeof t.type)throw new Error("DOM Events Exception 0");var e=this,n=t.type;try{if(!t.bubbles){t.cancelBubble=!0;var o=function(t){t.cancelBubble=!0,(e||window).detachEvent("on"+n,o)};this.attachEvent("on"+n,o)}this.fireEvent("on"+n,t)}catch(o){t.target=e;do{t.currentTarget=e,"_events"in e&&"function"==typeof e._events[n]&&e._events[n].call(e,t),"function"==typeof e["on"+n]&&e["on"+n].call(e,t),e=9===e.nodeType?e.parentWindow:e.parentNode}while(e&&!t.cancelBubble)}return!0},document.attachEvent("onreadystatechange",(function(){"complete"===document.readyState&&document.dispatchEvent(new Event("DOMContentLoaded",{bubbles:!0}))})))}function o(t,e){for(var n=-1,o=t.length;++n<o;)if(n in t&&t[n]===e)return n;return-1}}()}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){"bind"in Function.prototype||Object.defineProperty(Function.prototype,"bind",{value:function(t){var e,n=Array,o=Object,i=o.prototype,r=n.prototype,a=function(){},s=i.toString,c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,l=Function.prototype.toString;e=function(t){if("function"!=typeof t)return!1;if(c)return function(t){try{return l.call(t),!0}catch(t){return!1}}(t);var e=s.call(t);return"[object Function]"===e||"[object GeneratorFunction]"===e};var u=r.slice,d=r.concat,p=r.push,f=Math.max,h=this;if(!e(h))throw new TypeError("Function.prototype.bind called on incompatible "+h);for(var m,v=u.call(arguments,1),y=f(0,h.length-v.length),b=[],g=0;g<y;g++)p.call(b,"$"+g);return m=Function("binder","return function ("+b.join(",")+"){ return binder.apply(this, arguments); }")((function(){if(this instanceof m){var e=h.apply(this,d.call(v,u.call(arguments)));return o(e)===e?e:this}return h.apply(t,d.call(v,u.call(arguments)))})),h.prototype&&(a.prototype=h.prototype,m.prototype=new a,a.prototype=null),m}})}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{});function i(t,n){if(!(t instanceof HTMLElement))return this;this.$module=t,this.debounceFormSubmitTimer=null;this.config=e({preventDoubleClick:!1},n||{},o(t.dataset))}function r(t,e){this.translations=t||{},this.locale=e&&e.locale||document.documentElement.lang||"en"}i.prototype.init=function(){this.$module&&(this.$module.addEventListener("keydown",this.handleKeyDown),this.$module.addEventListener("click",this.debounce.bind(this)))},i.prototype.handleKeyDown=function(t){var e=t.target;32===t.keyCode&&e instanceof HTMLElement&&"button"===e.getAttribute("role")&&(t.preventDefault(),e.click())},i.prototype.debounce=function(t){if(this.config.preventDoubleClick)return this.debounceFormSubmitTimer?(t.preventDefault(),!1):void(this.debounceFormSubmitTimer=setTimeout(function(){this.debounceFormSubmitTimer=null}.bind(this),1e3))},function(t){"document"in this&&"matches"in document.documentElement||(Element.prototype.matches=Element.prototype.webkitMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.mozMatchesSelector||function(t){for(var e=this,n=(e.document||e.ownerDocument).querySelectorAll(t),o=0;n[o]&&n[o]!==e;)++o;return!!n[o]})}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){"document"in this&&"closest"in document.documentElement||(Element.prototype.closest=function(t){for(var e=this;e;){if(e.matches(t))return e;e="SVGElement"in window&&e instanceof SVGElement?e.parentNode:e.parentElement}return null})}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),r.prototype.t=function(t,e){if(!t)throw new Error("i18n: lookup key missing");e&&"number"==typeof e.count&&(t=t+"."+this.getPluralSuffix(t,e.count));var n=this.translations[t];if("string"==typeof n){if(n.match(/%{(.\S+)}/)){if(!e)throw new Error("i18n: cannot replace placeholders in string if no option data provided");return this.replacePlaceholders(n,e)}return n}return t},r.prototype.replacePlaceholders=function(t,e){var n;return this.hasIntlNumberFormatSupport()&&(n=new Intl.NumberFormat(this.locale)),t.replace(/%{(.\S+)}/g,(function(t,o){if(Object.prototype.hasOwnProperty.call(e,o)){var i=e[o];return!1===i||"number"!=typeof i&&"string"!=typeof i?"":"number"==typeof i?n?n.format(i):i.toString():i}throw new Error("i18n: no data found to replace "+t+" placeholder in string")}))},r.prototype.hasIntlPluralRulesSupport=function(){return Boolean(window.Intl&&"PluralRules"in window.Intl&&Intl.PluralRules.supportedLocalesOf(this.locale).length)},r.prototype.hasIntlNumberFormatSupport=function(){return Boolean(window.Intl&&"NumberFormat"in window.Intl&&Intl.NumberFormat.supportedLocalesOf(this.locale).length)},r.prototype.getPluralSuffix=function(t,e){if(e=Number(e),!isFinite(e))return"other";var n;if(t+"."+(n=this.hasIntlPluralRulesSupport()?new Intl.PluralRules(this.locale).select(e):this.selectPluralFormUsingFallbackRules(e))in this.translations)return n;if(t+".other"in this.translations)return console&&"warn"in console&&console.warn('i18n: Missing plural form ".'+n+'" for "'+this.locale+'" locale. Falling back to ".other".'),"other";throw new Error('i18n: Plural form ".other" is required for "'+this.locale+'" locale')},r.prototype.selectPluralFormUsingFallbackRules=function(t){t=Math.abs(Math.floor(t));var e=this.getPluralRulesForLocale();return e?r.pluralRules[e](t):"other"},r.prototype.getPluralRulesForLocale=function(){var t=this.locale,e=t.split("-")[0];for(var n in r.pluralRulesMap)if(Object.prototype.hasOwnProperty.call(r.pluralRulesMap,n))for(var o=r.pluralRulesMap[n],i=0;i<o.length;i++)if(o[i]===t||o[i]===e)return n},r.pluralRulesMap={arabic:["ar"],chinese:["my","zh","id","ja","jv","ko","ms","th","vi"],french:["hy","bn","fr","gu","hi","fa","pa","zu"],german:["af","sq","az","eu","bg","ca","da","nl","en","et","fi","ka","de","el","hu","lb","no","so","sw","sv","ta","te","tr","ur"],irish:["ga"],russian:["ru","uk"],scottish:["gd"],spanish:["pt-PT","it","es"],welsh:["cy"]},r.pluralRules={arabic:function(t){return 0===t?"zero":1===t?"one":2===t?"two":t%100>=3&&t%100<=10?"few":t%100>=11&&t%100<=99?"many":"other"},chinese:function(){return"other"},french:function(t){return 0===t||1===t?"one":"other"},german:function(t){return 1===t?"one":"other"},irish:function(t){return 1===t?"one":2===t?"two":t>=3&&t<=6?"few":t>=7&&t<=10?"many":"other"},russian:function(t){var e=t%100,n=e%10;return 1===n&&11!==e?"one":n>=2&&n<=4&&!(e>=12&&e<=14)?"few":0===n||n>=5&&n<=9||e>=11&&e<=14?"many":"other"},scottish:function(t){return 1===t||11===t?"one":2===t||12===t?"two":t>=3&&t<=10||t>=13&&t<=19?"few":"other"},spanish:function(t){return 1===t?"one":t%1e6==0&&0!==t?"many":"other"},welsh:function(t){return 0===t?"zero":1===t?"one":2===t?"two":3===t?"few":6===t?"many":"other"}},function(t){"Date"in self&&"now"in self.Date&&"getTime"in self.Date.prototype||(Date.now=function(){return(new Date).getTime()})}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){var e;"DOMTokenList"in this&&(!("classList"in(e=document.createElement("x")))||!e.classList.toggle("x",!1)&&!e.className)||function(e){var n;"DOMTokenList"in e&&e.DOMTokenList&&(!document.createElementNS||!document.createElementNS("http://www.w3.org/2000/svg","svg")||document.createElementNS("http://www.w3.org/2000/svg","svg").classList instanceof DOMTokenList)||(e.DOMTokenList=function(){var e=!0,n=function(t,n,o,i){Object.defineProperty?Object.defineProperty(t,n,{configurable:!1===e||!!i,get:o}):t.__defineGetter__(n,o)};try{n({},"support")}catch(t){e=!1}return function(e,o){var i=this,r=[],a={},s=0,c=0,l=function(t){n(i,t,(function(){return d(),r[t]}),!1)},u=function(){if(s>=c)for(;c<s;++c)l(c)},d=function(){var t,n,i=arguments,c=/\s+/;if(i.length)for(n=0;n<i.length;++n)if(c.test(i[n]))throw(t=new SyntaxError('String "'+i[n]+'" contains an invalid character')).code=5,t.name="InvalidCharacterError",t;for(""===(r="object"==typeof e[o]?(""+e[o].baseVal).replace(/^\s+|\s+$/g,"").split(c):(""+e[o]).replace(/^\s+|\s+$/g,"").split(c))[0]&&(r=[]),a={},n=0;n<r.length;++n)a[r[n]]=!0;s=r.length,u()};return d(),n(i,"length",(function(){return d(),s})),i.toLocaleString=i.toString=function(){return d(),r.join(" ")},i.item=function(t){return d(),r[t]},i.contains=function(t){return d(),!!a[t]},i.add=function(){d.apply(i,t=arguments);for(var t,n,c=0,l=t.length;c<l;++c)a[n=t[c]]||(r.push(n),a[n]=!0);s!==r.length&&(s=r.length>>>0,"object"==typeof e[o]?e[o].baseVal=r.join(" "):e[o]=r.join(" "),u())},i.remove=function(){d.apply(i,t=arguments);for(var t,n={},c=0,l=[];c<t.length;++c)n[t[c]]=!0,delete a[t[c]];for(c=0;c<r.length;++c)n[r[c]]||l.push(r[c]);r=l,s=l.length>>>0,"object"==typeof e[o]?e[o].baseVal=r.join(" "):e[o]=r.join(" "),u()},i.toggle=function(e,n){return d.apply(i,[e]),t!==n?n?(i.add(e),!0):(i.remove(e),!1):a[e]?(i.remove(e),!1):(i.add(e),!0)},i}}()),"classList"in(n=document.createElement("span"))&&(n.classList.toggle("x",!1),n.classList.contains("x")&&(n.classList.constructor.prototype.toggle=function(e){var n=arguments[1];if(n===t){var o=!this.contains(e);return this[o?"add":"remove"](e),o}return this[(n=!!n)?"add":"remove"](e),n})),function(){var t=document.createElement("span");if("classList"in t&&(t.classList.add("a","b"),!t.classList.contains("b"))){var e=t.classList.constructor.prototype.add;t.classList.constructor.prototype.add=function(){for(var t=arguments,n=arguments.length,o=0;o<n;o++)e.call(this,t[o])}}}(),function(){var t=document.createElement("span");if("classList"in t&&(t.classList.add("a"),t.classList.add("b"),t.classList.remove("a","b"),t.classList.contains("b"))){var e=t.classList.constructor.prototype.remove;t.classList.constructor.prototype.remove=function(){for(var t=arguments,n=arguments.length,o=0;o<n;o++)e.call(this,t[o])}}}()}(this)}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){var e;"document"in this&&"classList"in document.documentElement&&"Element"in this&&"classList"in Element.prototype&&((e=document.createElement("span")).classList.add("a","b"),e.classList.contains("b"))||function(t){var e=!0,n=function(t,n,o,i){Object.defineProperty?Object.defineProperty(t,n,{configurable:!1===e||!!i,get:o}):t.__defineGetter__(n,o)};try{n({},"support")}catch(t){e=!1}var o=function(t,i,r){n(t.prototype,i,(function(){var t,a=this,s="__defineGetter__DEFINE_PROPERTY"+i;if(a[s])return t;if(a[s]=!0,!1===e){for(var c,l=o.mirror||document.createElement("div"),u=l.childNodes,d=u.length,p=0;p<d;++p)if(u[p]._R===a){c=u[p];break}c||(c=l.appendChild(document.createElement("div"))),t=DOMTokenList.call(c,a,r)}else t=new DOMTokenList(a,r);return n(a,i,(function(){return t})),delete a[s],t}),!0)};o(t.Element,"classList","className"),o(t.HTMLElement,"classList","className"),o(t.HTMLLinkElement,"relList","rel"),o(t.HTMLAnchorElement,"relList","rel"),o(t.HTMLAreaElement,"relList","rel")}(this)}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{});var a={charactersUnderLimit:{one:"You have %{count} character remaining",other:"You have %{count} characters remaining"},charactersAtLimit:"You have 0 characters remaining",charactersOverLimit:{one:"You have %{count} character too many",other:"You have %{count} characters too many"},wordsUnderLimit:{one:"You have %{count} word remaining",other:"You have %{count} words remaining"},wordsAtLimit:"You have 0 words remaining",wordsOverLimit:{one:"You have %{count} word too many",other:"You have %{count} words too many"},textareaDescription:{other:""}};function s(t,n){if(!(t instanceof HTMLElement))return this;var i=t.querySelector(".govuk-js-character-count");if(!(i instanceof HTMLTextAreaElement||i instanceof HTMLInputElement))return this;var s,c,l,u={threshold:0,i18n:a},d=o(t.dataset),p={};if(("maxwords"in d||"maxlength"in d)&&(p={maxlength:!1,maxwords:!1}),this.config=e(u,n||{},p,d),this.i18n=new r(function(t,e){if(!t||"object"!=typeof t)throw new Error('Provide a `configObject` of type "object".');if(!e||"string"!=typeof e)throw new Error('Provide a `namespace` of type "string" to filter the `configObject` by.');var n={};for(var o in t){var i=o.split(".");Object.prototype.hasOwnProperty.call(t,o)&&i[0]===e&&(i.length>1&&i.shift(),n[i.join(".")]=t[o])}return n}(this.config,"i18n"),{locale:(s=t,c="lang",l=s.closest("["+c+"]"),l?l.getAttribute(c):null)}),this.maxLength=1/0,"maxwords"in this.config&&this.config.maxwords)this.maxLength=this.config.maxwords;else{if(!("maxlength"in this.config)||!this.config.maxlength)return;this.maxLength=this.config.maxlength}this.$module=t,this.$textarea=i,this.$visibleCountMessage=null,this.$screenReaderCountMessage=null,this.lastInputTimestamp=null,this.lastInputValue="",this.valueChecker=null}function c(t){if(!(t instanceof HTMLElement))return this;var e=t.querySelectorAll('input[type="checkbox"]');if(!e.length)return this;this.$module=t,this.$inputs=e}function l(t,n){if(!(t instanceof HTMLElement))return this;this.$module=t;this.config=e({disableAutoFocus:!1},n||{},o(t.dataset))}function u(t){if(!(t instanceof HTMLElement))return this;var e=t.querySelectorAll('input[type="radio"]');if(!e.length)return this;this.$module=t,this.$inputs=e}function d(e){const n=void 0!==(e=void 0!==e?e:{}).scope?e.scope:document;t(n.querySelectorAll('[data-module="govuk-button"]'),(function(t){new i(t).init()}));t(n.querySelectorAll('[data-module="govuk-character-count"]'),(function(t){new s(t).init()}));t(n.querySelectorAll('[data-module="govuk-checkboxes"]'),(function(t){new c(t).init()}));new l(n.querySelector('[data-module="govuk-error-summary"]')).init();t(n.querySelectorAll('[data-module="govuk-radios"]'),(function(t){new u(t).init()}))}s.prototype.init=function(){if(this.$module&&this.$textarea){var t=this.$textarea,e=document.getElementById(t.id+"-info");if(e){e.innerText.match(/^\s*$/)&&(e.innerText=this.i18n.t("textareaDescription",{count:this.maxLength})),t.insertAdjacentElement("afterend",e);var n=document.createElement("div");n.className="govuk-character-count__sr-status govuk-visually-hidden",n.setAttribute("aria-live","polite"),this.$screenReaderCountMessage=n,e.insertAdjacentElement("afterend",n);var o=document.createElement("div");o.className=e.className,o.classList.add("govuk-character-count__status"),o.setAttribute("aria-hidden","true"),this.$visibleCountMessage=o,e.insertAdjacentElement("afterend",o),e.classList.add("govuk-visually-hidden"),t.removeAttribute("maxlength"),this.bindChangeEvents(),window.addEventListener("onpageshow"in window?"pageshow":"DOMContentLoaded",this.updateCountMessage.bind(this)),this.updateCountMessage()}}},s.prototype.bindChangeEvents=function(){var t=this.$textarea;t.addEventListener("keyup",this.handleKeyUp.bind(this)),t.addEventListener("focus",this.handleFocus.bind(this)),t.addEventListener("blur",this.handleBlur.bind(this))},s.prototype.handleKeyUp=function(){this.updateVisibleCountMessage(),this.lastInputTimestamp=Date.now()},s.prototype.handleFocus=function(){this.valueChecker=setInterval(function(){(!this.lastInputTimestamp||Date.now()-500>=this.lastInputTimestamp)&&this.updateIfValueChanged()}.bind(this),1e3)},s.prototype.handleBlur=function(){clearInterval(this.valueChecker)},s.prototype.updateIfValueChanged=function(){this.$textarea.value!==this.lastInputValue&&(this.lastInputValue=this.$textarea.value,this.updateCountMessage())},s.prototype.updateCountMessage=function(){this.updateVisibleCountMessage(),this.updateScreenReaderCountMessage()},s.prototype.updateVisibleCountMessage=function(){var t=this.$textarea,e=this.$visibleCountMessage,n=this.maxLength-this.count(t.value);this.isOverThreshold()?e.classList.remove("govuk-character-count__message--disabled"):e.classList.add("govuk-character-count__message--disabled"),n<0?(t.classList.add("govuk-textarea--error"),e.classList.remove("govuk-hint"),e.classList.add("govuk-error-message")):(t.classList.remove("govuk-textarea--error"),e.classList.remove("govuk-error-message"),e.classList.add("govuk-hint")),e.innerText=this.getCountMessage()},s.prototype.updateScreenReaderCountMessage=function(){var t=this.$screenReaderCountMessage;this.isOverThreshold()?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden","true"),t.innerText=this.getCountMessage()},s.prototype.count=function(t){return"maxwords"in this.config&&this.config.maxwords?(t.match(/\S+/g)||[]).length:t.length},s.prototype.getCountMessage=function(){var t=this.maxLength-this.count(this.$textarea.value),e="maxwords"in this.config&&this.config.maxwords?"words":"characters";return this.formatCountMessage(t,e)},s.prototype.formatCountMessage=function(t,e){if(0===t)return this.i18n.t(e+"AtLimit");var n=t<0?"OverLimit":"UnderLimit";return this.i18n.t(e+n,{count:Math.abs(t)})},s.prototype.isOverThreshold=function(){if(!this.config.threshold)return!0;var t=this.$textarea,e=this.count(t.value);return this.maxLength*this.config.threshold/100<=e},c.prototype.init=function(){if(this.$module&&this.$inputs){var e=this.$module;t(this.$inputs,(function(t){var e=t.getAttribute("data-aria-controls");e&&document.getElementById(e)&&(t.setAttribute("aria-controls",e),t.removeAttribute("data-aria-controls"))})),window.addEventListener("onpageshow"in window?"pageshow":"DOMContentLoaded",this.syncAllConditionalReveals.bind(this)),this.syncAllConditionalReveals(),e.addEventListener("click",this.handleClick.bind(this))}},c.prototype.syncAllConditionalReveals=function(){t(this.$inputs,this.syncConditionalRevealWithInputState.bind(this))},c.prototype.syncConditionalRevealWithInputState=function(t){var e=t.getAttribute("aria-controls");if(e){var n=document.getElementById(e);if(n&&n.classList.contains("govuk-checkboxes__conditional")){var o=t.checked;t.setAttribute("aria-expanded",o.toString()),n.classList.toggle("govuk-checkboxes__conditional--hidden",!o)}}},c.prototype.unCheckAllInputsExcept=function(e){var n=this;t(document.querySelectorAll('input[type="checkbox"][name="'+e.name+'"]'),(function(t){e.form===t.form&&t!==e&&(t.checked=!1,n.syncConditionalRevealWithInputState(t))}))},c.prototype.unCheckExclusiveInputs=function(e){var n=this;t(document.querySelectorAll('input[data-behaviour="exclusive"][type="checkbox"][name="'+e.name+'"]'),(function(t){e.form===t.form&&(t.checked=!1,n.syncConditionalRevealWithInputState(t))}))},c.prototype.handleClick=function(t){var e=t.target;e instanceof HTMLInputElement&&"checkbox"===e.type&&(e.getAttribute("aria-controls")&&this.syncConditionalRevealWithInputState(e),e.checked&&("exclusive"===e.getAttribute("data-behaviour")?this.unCheckAllInputsExcept(e):this.unCheckExclusiveInputs(e)))},l.prototype.init=function(){if(this.$module){var t=this.$module;this.setFocus(),t.addEventListener("click",this.handleClick.bind(this))}},l.prototype.setFocus=function(){var t=this.$module;this.config.disableAutoFocus||(t.setAttribute("tabindex","-1"),t.addEventListener("blur",(function(){t.removeAttribute("tabindex")})),t.focus())},l.prototype.handleClick=function(t){var e=t.target;this.focusTarget(e)&&t.preventDefault()},l.prototype.focusTarget=function(t){if(!(t instanceof HTMLAnchorElement))return!1;var e=this.getFragmentFromUrl(t.href);if(!e)return!1;var n=document.getElementById(e);if(!n)return!1;var o=this.getAssociatedLegendOrLabel(n);return!!o&&(o.scrollIntoView(),n.focus({preventScroll:!0}),!0)},l.prototype.getFragmentFromUrl=function(t){if(-1!==t.indexOf("#"))return t.split("#").pop()},l.prototype.getAssociatedLegendOrLabel=function(t){var e=t.closest("fieldset");if(e){var n=e.getElementsByTagName("legend");if(n.length){var o=n[0];if(t instanceof HTMLInputElement&&("checkbox"===t.type||"radio"===t.type))return o;var i=o.getBoundingClientRect().top,r=t.getBoundingClientRect();if(r.height&&window.innerHeight)if(r.top+r.height-i<window.innerHeight/2)return o}}return document.querySelector("label[for='"+t.getAttribute("id")+"']")||t.closest("label")},u.prototype.init=function(){if(this.$module&&this.$inputs){var e=this.$module;t(this.$inputs,(function(t){var e=t.getAttribute("data-aria-controls");e&&document.getElementById(e)&&(t.setAttribute("aria-controls",e),t.removeAttribute("data-aria-controls"))})),window.addEventListener("onpageshow"in window?"pageshow":"DOMContentLoaded",this.syncAllConditionalReveals.bind(this)),this.syncAllConditionalReveals(),e.addEventListener("click",this.handleClick.bind(this))}},u.prototype.syncAllConditionalReveals=function(){t(this.$inputs,this.syncConditionalRevealWithInputState.bind(this))},u.prototype.syncConditionalRevealWithInputState=function(t){var e=t.getAttribute("aria-controls");if(e){var n=document.getElementById(e);if(n&&n.classList.contains("govuk-radios__conditional")){var o=t.checked;t.setAttribute("aria-expanded",o.toString()),n.classList.toggle("govuk-radios__conditional--hidden",!o)}}},u.prototype.handleClick=function(e){var n=this,o=e.target;if(o instanceof HTMLInputElement&&"radio"===o.type){var i=document.querySelectorAll('input[type="radio"][aria-controls]'),r=o.form,a=o.name;t(i,(function(t){var e=t.form===r;t.name===a&&e&&n.syncConditionalRevealWithInputState(t)}))}};export{i as Button,s as CharacterCount,c as Checkboxes,l as ErrorSummary,u as Radios,d as initAll};
|
@@ -29,16 +29,17 @@
|
|
29
29
|
// this instead of changing `border-width` (which changes element size) and
|
30
30
|
// since `outline` is already used for the yellow focus state.
|
31
31
|
box-shadow: inset 0 0 0 $govuk-border-width-form-element;
|
32
|
+
}
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
&:disabled {
|
35
|
+
opacity: .5;
|
36
|
+
color: inherit;
|
37
|
+
background-color: transparent;
|
38
|
+
cursor: not-allowed;
|
38
39
|
}
|
39
40
|
}
|
40
41
|
|
41
|
-
.govuk-
|
42
|
+
.govuk-textarea--error {
|
42
43
|
border-color: $govuk-error-colour;
|
43
44
|
|
44
45
|
&:focus {
|
@@ -1,3 +1,11 @@
|
|
1
|
+
// Ignore IE8 related warnings whilst we continue to generate IE8 specific
|
2
|
+
// stylesheets for the review app or dist versions of GOV.UK Frontend
|
3
|
+
$govuk-suppressed-warnings: if(
|
4
|
+
variable-exists(govuk-suppressed-warnings),
|
5
|
+
append($govuk-suppressed-warnings, "ie8"),
|
6
|
+
("ie8")
|
7
|
+
);
|
8
|
+
|
1
9
|
// By setting $govuk-is-ie8 to true, we create a version of the stylesheet that
|
2
10
|
// targets IE8 – e.g. conditionally including or excluding styles, and
|
3
11
|
// rasterizing media queries.
|
@@ -155,7 +155,7 @@
|
|
155
155
|
vertical-align: middle;
|
156
156
|
|
157
157
|
// IE8 fallback of icon
|
158
|
-
@include
|
158
|
+
@include _govuk-if-ie8 {
|
159
159
|
display: inline-block;
|
160
160
|
max-height: 20px;
|
161
161
|
line-height: 1;
|
@@ -184,7 +184,7 @@
|
|
184
184
|
border-right: govuk-px-to-rem(2px) solid;
|
185
185
|
|
186
186
|
// IE8 fallback of icon with HTML symbol
|
187
|
-
@include
|
187
|
+
@include _govuk-if-ie8 {
|
188
188
|
content: "\25B2"; // "▲"
|
189
189
|
position: relative;
|
190
190
|
border: 0;
|
@@ -199,7 +199,7 @@
|
|
199
199
|
transform: rotate(180deg);
|
200
200
|
|
201
201
|
// IE8 fallback of arrow icon
|
202
|
-
@include
|
202
|
+
@include _govuk-if-ie8 {
|
203
203
|
&:after {
|
204
204
|
content: "\25BC"; // "▼"
|
205
205
|
-webkit-transform: none;
|
@@ -61,7 +61,7 @@ $govuk-button-text-colour: govuk-colour("white") !default;
|
|
61
61
|
cursor: pointer;
|
62
62
|
-webkit-appearance: none;
|
63
63
|
|
64
|
-
@include
|
64
|
+
@include _govuk-if-ie8 {
|
65
65
|
border-bottom: $button-shadow-size solid $govuk-button-shadow-colour;
|
66
66
|
}
|
67
67
|
|
@@ -92,7 +92,7 @@ $govuk-button-text-colour: govuk-colour("white") !default;
|
|
92
92
|
// Bump the button down so it looks like its being pressed in
|
93
93
|
top: $button-shadow-size;
|
94
94
|
|
95
|
-
@include
|
95
|
+
@include _govuk-if-ie8 {
|
96
96
|
border-bottom-width: 0;
|
97
97
|
}
|
98
98
|
}
|
@@ -103,11 +103,11 @@ $govuk-button-text-colour: govuk-colour("white") !default;
|
|
103
103
|
// backgrounds and box-shadows disappear, so we need to ensure there's a
|
104
104
|
// transparent outline which will be set to a visible colour.
|
105
105
|
// Since Internet Explorer 8 does not support box-shadow, we want to force the user-agent outlines
|
106
|
-
@include
|
106
|
+
@include _govuk-not-ie8 {
|
107
107
|
outline: $govuk-focus-width solid transparent;
|
108
108
|
}
|
109
109
|
// Since Internet Explorer does not support `:not()` we set a clearer focus style to match user-agent outlines.
|
110
|
-
@include
|
110
|
+
@include _govuk-if-ie8 {
|
111
111
|
color: $govuk-focus-text-colour;
|
112
112
|
background-color: $govuk-focus-colour;
|
113
113
|
}
|
@@ -166,6 +166,8 @@ $govuk-button-text-colour: govuk-colour("white") !default;
|
|
166
166
|
}
|
167
167
|
}
|
168
168
|
|
169
|
+
// @deprecated Disabling buttons using the .govuk-button--disabled class is
|
170
|
+
// deprecated and will be removed in the next major version.
|
169
171
|
.govuk-button--disabled,
|
170
172
|
.govuk-button[disabled="disabled"],
|
171
173
|
.govuk-button[disabled] {
|
@@ -173,13 +175,13 @@ $govuk-button-text-colour: govuk-colour("white") !default;
|
|
173
175
|
|
174
176
|
&:hover {
|
175
177
|
background-color: $govuk-button-colour;
|
176
|
-
cursor:
|
178
|
+
cursor: not-allowed;
|
177
179
|
}
|
178
180
|
|
179
181
|
&:active {
|
180
182
|
top: 0;
|
181
183
|
box-shadow: 0 $button-shadow-size 0 $govuk-button-shadow-colour; // s0
|
182
|
-
@include
|
184
|
+
@include _govuk-if-ie8 {
|
183
185
|
border-bottom: $button-shadow-size solid $govuk-button-shadow-colour; // s0
|
184
186
|
}
|
185
187
|
}
|
@@ -36,7 +36,7 @@
|
|
36
36
|
|
37
37
|
// IE8 doesn’t support pseudo-elements, so we don’t want to hide native
|
38
38
|
// elements there.
|
39
|
-
@include
|
39
|
+
@include _govuk-not-ie8 {
|
40
40
|
position: absolute;
|
41
41
|
|
42
42
|
z-index: 1;
|
@@ -50,7 +50,7 @@
|
|
50
50
|
opacity: 0;
|
51
51
|
}
|
52
52
|
|
53
|
-
@include
|
53
|
+
@include _govuk-if-ie8 {
|
54
54
|
margin-top: 10px;
|
55
55
|
margin-right: $govuk-checkboxes-size / -2;
|
56
56
|
margin-left: $govuk-checkboxes-size / -2;
|
@@ -73,7 +73,7 @@
|
|
73
73
|
touch-action: manipulation;
|
74
74
|
}
|
75
75
|
|
76
|
-
@include
|
76
|
+
@include _govuk-not-ie8 {
|
77
77
|
// [ ] Check box
|
78
78
|
.govuk-checkboxes__label:before {
|
79
79
|
content: "";
|
@@ -152,7 +152,7 @@
|
|
152
152
|
// Disabled state
|
153
153
|
.govuk-checkboxes__input:disabled,
|
154
154
|
.govuk-checkboxes__input:disabled + .govuk-checkboxes__label {
|
155
|
-
cursor:
|
155
|
+
cursor: not-allowed;
|
156
156
|
}
|
157
157
|
|
158
158
|
.govuk-checkboxes__input:disabled + .govuk-checkboxes__label,
|
@@ -229,11 +229,11 @@
|
|
229
229
|
// ▲┆└─ Check box pseudo element, aligned with margin
|
230
230
|
// └─── Touch target (invisible input), shifted into the margin
|
231
231
|
.govuk-checkboxes__input {
|
232
|
-
@include
|
232
|
+
@include _govuk-not-ie8 {
|
233
233
|
left: $input-offset * -1;
|
234
234
|
}
|
235
235
|
|
236
|
-
@include
|
236
|
+
@include _govuk-if-ie8 {
|
237
237
|
margin-left: $govuk-small-checkboxes-size * -1;
|
238
238
|
}
|
239
239
|
}
|
@@ -30,7 +30,7 @@
|
|
30
30
|
// yellow focus state.
|
31
31
|
box-shadow: inset 0 0 0 4px $govuk-input-border-colour;
|
32
32
|
|
33
|
-
@include
|
33
|
+
@include _govuk-if-ie8 {
|
34
34
|
// IE8 doesn't support `box-shadow` so add an actual border
|
35
35
|
border: 4px solid $govuk-input-border-colour;
|
36
36
|
}
|
@@ -46,5 +46,10 @@
|
|
46
46
|
|
47
47
|
box-shadow: inset 0 0 0 4px $govuk-input-border-colour;
|
48
48
|
}
|
49
|
+
|
50
|
+
&:disabled {
|
51
|
+
opacity: .5;
|
52
|
+
cursor: not-allowed;
|
53
|
+
}
|
49
54
|
}
|
50
55
|
}
|
@@ -169,13 +169,6 @@
|
|
169
169
|
list-style: none;
|
170
170
|
-webkit-column-gap: $govuk-gutter;
|
171
171
|
column-gap: $govuk-gutter; // Support: Columns
|
172
|
-
|
173
|
-
// Disable thicker underlines on hover because of a bug in Chromium
|
174
|
-
// affecting links within columns
|
175
|
-
// https://bugs.chromium.org/p/chromium/issues/detail?id=1190987
|
176
|
-
.govuk-footer__link:hover {
|
177
|
-
text-decoration-thickness: auto;
|
178
|
-
}
|
179
172
|
}
|
180
173
|
|
181
174
|
@include govuk-media-query ($from: desktop) {
|
@@ -34,12 +34,19 @@
|
|
34
34
|
// here as it is already used for the yellow focus state.
|
35
35
|
box-shadow: inset 0 0 0 $govuk-border-width-form-element;
|
36
36
|
|
37
|
-
@include
|
37
|
+
@include _govuk-if-ie8 {
|
38
38
|
// IE8 doesn't support `box-shadow` so double the border with
|
39
39
|
// `border-width`.
|
40
40
|
border-width: $govuk-border-width-form-element * 2;
|
41
41
|
}
|
42
42
|
}
|
43
|
+
|
44
|
+
&:disabled {
|
45
|
+
opacity: .5;
|
46
|
+
color: inherit;
|
47
|
+
background-color: transparent;
|
48
|
+
cursor: not-allowed;
|
49
|
+
}
|
43
50
|
}
|
44
51
|
|
45
52
|
.govuk-input::-webkit-outer-spin-button,
|
@@ -60,6 +67,11 @@
|
|
60
67
|
}
|
61
68
|
}
|
62
69
|
|
70
|
+
.govuk-input--extra-letter-spacing {
|
71
|
+
@include govuk-font(false, $tabular: true);
|
72
|
+
letter-spacing: .05em;
|
73
|
+
}
|
74
|
+
|
63
75
|
// em measurements are based on the point size of the typeface
|
64
76
|
// Extra space is added on the right hand side to allow for the Safari prefill icon
|
65
77
|
|
@@ -161,7 +173,7 @@
|
|
161
173
|
border-bottom: 0;
|
162
174
|
}
|
163
175
|
@include govuk-media-query($from: mobile) {
|
164
|
-
@include
|
176
|
+
@include _govuk-not-ie8 {
|
165
177
|
border-right: 0;
|
166
178
|
}
|
167
179
|
}
|
@@ -173,7 +185,7 @@
|
|
173
185
|
border-top: 0;
|
174
186
|
}
|
175
187
|
@include govuk-media-query($from: mobile) {
|
176
|
-
@include
|
188
|
+
@include _govuk-not-ie8 {
|
177
189
|
border-left: 0;
|
178
190
|
}
|
179
191
|
}
|
@@ -39,7 +39,7 @@
|
|
39
39
|
|
40
40
|
// IE8 doesn’t support pseudo-elements, so we don’t want to hide native
|
41
41
|
// elements there.
|
42
|
-
@include
|
42
|
+
@include _govuk-not-ie8 {
|
43
43
|
position: absolute;
|
44
44
|
|
45
45
|
z-index: 1;
|
@@ -53,7 +53,7 @@
|
|
53
53
|
opacity: 0;
|
54
54
|
}
|
55
55
|
|
56
|
-
@include
|
56
|
+
@include _govuk-if-ie8 {
|
57
57
|
margin-top: 10px;
|
58
58
|
margin-right: $govuk-radios-size / -2;
|
59
59
|
margin-left: $govuk-radios-size / -2;
|
@@ -146,7 +146,7 @@
|
|
146
146
|
// Disabled state
|
147
147
|
.govuk-radios__input:disabled,
|
148
148
|
.govuk-radios__input:disabled + .govuk-radios__label {
|
149
|
-
cursor:
|
149
|
+
cursor: not-allowed;
|
150
150
|
}
|
151
151
|
|
152
152
|
.govuk-radios__input:disabled + .govuk-radios__label,
|
@@ -239,11 +239,11 @@
|
|
239
239
|
// ▲┆└─ Radio pseudo element, aligned with margin
|
240
240
|
// └─── Touch target (invisible input), shifted into the margin
|
241
241
|
.govuk-radios__input {
|
242
|
-
@include
|
242
|
+
@include _govuk-not-ie8 {
|
243
243
|
left: $input-offset * -1;
|
244
244
|
}
|
245
245
|
|
246
|
-
@include
|
246
|
+
@include _govuk-if-ie8 {
|
247
247
|
margin-left: $govuk-small-radios-size * -1;
|
248
248
|
}
|
249
249
|
}
|
@@ -35,12 +35,18 @@
|
|
35
35
|
// since `outline` is already used for the yellow focus state.
|
36
36
|
box-shadow: inset 0 0 0 $govuk-border-width-form-element;
|
37
37
|
|
38
|
-
@include
|
38
|
+
@include _govuk-if-ie8 {
|
39
39
|
// IE8 doesn't support `box-shadow` so double the border with
|
40
40
|
// `border-width`.
|
41
41
|
border-width: $govuk-border-width-form-element * 2;
|
42
42
|
}
|
43
43
|
}
|
44
|
+
|
45
|
+
&:disabled {
|
46
|
+
opacity: .5;
|
47
|
+
color: inherit;
|
48
|
+
cursor: not-allowed;
|
49
|
+
}
|
44
50
|
}
|
45
51
|
|
46
52
|
.govuk-select option:active,
|
@@ -35,47 +35,47 @@
|
|
35
35
|
}
|
36
36
|
|
37
37
|
.govuk-tag--grey {
|
38
|
-
color: govuk-shade(govuk-colour("dark-grey", $legacy: "grey-1"), 30);
|
39
|
-
background: govuk-tint(govuk-colour("dark-grey", $legacy: "grey-1"), 90);
|
38
|
+
color: govuk-shade(govuk-colour("dark-grey", $legacy: "grey-1"), 30%);
|
39
|
+
background: govuk-tint(govuk-colour("dark-grey", $legacy: "grey-1"), 90%);
|
40
40
|
}
|
41
41
|
|
42
42
|
.govuk-tag--purple {
|
43
|
-
color: govuk-shade(govuk-colour("purple"), 20);
|
44
|
-
background: govuk-tint(govuk-colour("purple"), 80);
|
43
|
+
color: govuk-shade(govuk-colour("purple"), 20%);
|
44
|
+
background: govuk-tint(govuk-colour("purple"), 80%);
|
45
45
|
}
|
46
46
|
|
47
47
|
.govuk-tag--turquoise {
|
48
|
-
color: govuk-shade(govuk-colour("turquoise"), 60);
|
49
|
-
background: govuk-tint(govuk-colour("turquoise"), 70);
|
48
|
+
color: govuk-shade(govuk-colour("turquoise"), 60%);
|
49
|
+
background: govuk-tint(govuk-colour("turquoise"), 70%);
|
50
50
|
}
|
51
51
|
|
52
52
|
.govuk-tag--blue {
|
53
|
-
color: govuk-shade(govuk-colour("blue"), 30);
|
54
|
-
background: govuk-tint(govuk-colour("blue"), 80);
|
53
|
+
color: govuk-shade(govuk-colour("blue"), 30%);
|
54
|
+
background: govuk-tint(govuk-colour("blue"), 80%);
|
55
55
|
}
|
56
56
|
|
57
57
|
.govuk-tag--yellow {
|
58
|
-
color: govuk-shade(govuk-colour("yellow"), 65);
|
59
|
-
background: govuk-tint(govuk-colour("yellow"), 75);
|
58
|
+
color: govuk-shade(govuk-colour("yellow"), 65%);
|
59
|
+
background: govuk-tint(govuk-colour("yellow"), 75%);
|
60
60
|
}
|
61
61
|
|
62
62
|
.govuk-tag--orange {
|
63
|
-
color: govuk-shade(govuk-colour("orange"), 55);
|
64
|
-
background: govuk-tint(govuk-colour("orange"), 70);
|
63
|
+
color: govuk-shade(govuk-colour("orange"), 55%);
|
64
|
+
background: govuk-tint(govuk-colour("orange"), 70%);
|
65
65
|
}
|
66
66
|
|
67
67
|
.govuk-tag--red {
|
68
|
-
color: govuk-shade(govuk-colour("red"), 30);
|
69
|
-
background: govuk-tint(govuk-colour("red"), 80);
|
68
|
+
color: govuk-shade(govuk-colour("red"), 30%);
|
69
|
+
background: govuk-tint(govuk-colour("red"), 80%);
|
70
70
|
}
|
71
71
|
|
72
72
|
.govuk-tag--pink {
|
73
|
-
color: govuk-shade(govuk-colour("pink"), 40);
|
74
|
-
background: govuk-tint(govuk-colour("pink"), 80);
|
73
|
+
color: govuk-shade(govuk-colour("pink"), 40%);
|
74
|
+
background: govuk-tint(govuk-colour("pink"), 80%);
|
75
75
|
}
|
76
76
|
|
77
77
|
.govuk-tag--green {
|
78
|
-
color: govuk-shade(govuk-colour("green"), 20);
|
79
|
-
background: govuk-tint(govuk-colour("green"), 80);
|
78
|
+
color: govuk-shade(govuk-colour("green"), 20%);
|
79
|
+
background: govuk-tint(govuk-colour("green"), 80%);
|
80
80
|
}
|
81
81
|
}
|
@@ -29,12 +29,19 @@
|
|
29
29
|
// since `outline` is already used for the yellow focus state.
|
30
30
|
box-shadow: inset 0 0 0 $govuk-border-width-form-element;
|
31
31
|
|
32
|
-
@include
|
32
|
+
@include _govuk-if-ie8 {
|
33
33
|
// IE8 doesn't support `box-shadow` so double the border with
|
34
34
|
// `border-width`.
|
35
35
|
border-width: $govuk-border-width-form-element * 2;
|
36
36
|
}
|
37
37
|
}
|
38
|
+
|
39
|
+
&:disabled {
|
40
|
+
opacity: .5;
|
41
|
+
color: inherit;
|
42
|
+
background-color: transparent;
|
43
|
+
cursor: not-allowed;
|
44
|
+
}
|
38
45
|
}
|
39
46
|
|
40
47
|
.govuk-textarea--error {
|
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
/// Get colour
|
10
10
|
///
|
11
|
-
/// @param {String} $colour - Name of colour from the colour palette
|
11
|
+
/// @param {String | Colour} $colour - Name of colour from the colour palette
|
12
12
|
/// (`$govuk-colours`)
|
13
13
|
/// @param {String} $legacy - Either the name of colour from the legacy palette
|
14
14
|
/// or a colour literal, to return instead when in 'legacy mode' - matching
|
@@ -36,7 +36,10 @@
|
|
36
36
|
$colour: $legacy;
|
37
37
|
}
|
38
38
|
|
39
|
-
|
39
|
+
@if type-of($colour) == "color" {
|
40
|
+
// stylelint-disable-next-line scss/function-quote-no-quoted-strings-inside
|
41
|
+
$colour: quote("#{$colour}");
|
42
|
+
}
|
40
43
|
|
41
44
|
@if not map-has-key($govuk-colours, $colour) {
|
42
45
|
@error "Unknown colour `#{$colour}`";
|