@nationalarchives/frontend 0.20.1 → 0.21.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.
- package/nationalarchives/all+analytics.js +1 -1
- package/nationalarchives/all+analytics.js.map +1 -1
- package/nationalarchives/all+analytics.mjs +2 -2
- package/nationalarchives/all.js +1 -1
- package/nationalarchives/all.js.map +1 -1
- package/nationalarchives/all.mjs +7 -5
- package/nationalarchives/components/date-input/date-input.js +1 -1
- package/nationalarchives/components/date-input/date-input.js.map +1 -1
- package/nationalarchives/components/date-input/date-input.mjs +42 -15
- package/nationalarchives/components/date-input/fixtures.json +15 -3
- package/nationalarchives/components/date-input/macro-options.json +5 -5
- package/nationalarchives/components/date-input/template.njk +4 -4
- package/package.json +2 -2
@@ -1,2 +1,2 @@
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TNAFrontend",[],t):"object"==typeof exports?exports.TNAFrontend=t():e.TNAFrontend=t()}(self,(()=>(()=>{"use strict";var e={169:(e,t,n)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,p(i.key),i)}}function l(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){var t=function(e){if("object"!=i(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}n.d(t,{A:()=>f}),window.TNAFrontendCookies=window.TNAFrontendCookies||null,window.TNAFrontendCookieEvents=window.TNAFrontendCookieEvents||null;var d=function(){return l((function e(){if(u(this,e),h(this,"events",{}),h(this,"oneTimeEvents",{}),window.TNAFrontendCookieEvents)return window.TNAFrontendCookieEvents;window.TNAFrontendCookieEvents=this}),[{key:"on",value:function(e,t){Object.hasOwn(this.events,e)||(this.events[e]=[]),this.events[e]=[].concat(s(this.events[e]),[t])}},{key:"once",value:function(e,t){Object.hasOwn(this.oneTimeEvents,e)||(this.oneTimeEvents[e]=[]),this.oneTimeEvents[e]=[].concat(s(this.oneTimeEvents[e]),[t])}},{key:"trigger",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Object.hasOwn(this.events,e)&&this.events[e].forEach((function(e){return e.call(t,n)})),Object.hasOwn(this.oneTimeEvents,e))for(var i=this.oneTimeEvents[e].length-1;i>=0;i--)this.oneTimeEvents[e][i].call(this,n),this.oneTimeEvents[e].splice(i,1)}}])}(),y=["usage","settings","marketing","essential"],f=function(){return l((function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u(this,e),h(this,"defaultDomain",""),h(this,"defaultPath",""),h(this,"secure",!0),h(this,"policiesKey",""),h(this,"events",null),h(this,"defaultAge",null),h(this,"completePoliciesOnInit",!1);var i=n.defaultDomain,o=n.defaultPath,r=n.secure,s=n.policiesKey,a=n.newInstance,c=void 0!==a&&a,l=n.defaultAge,p=n.noInit,f=void 0!==p&&p;if(!c&&window.TNAFrontendCookies)return window.TNAFrontendCookies;this.defaultDomain=void 0===i?document.documentElement.dataset.tnaCookiesDomain||"":i,this.defaultPath=void 0===o?document.documentElement.dataset.tnaCookiesPath||"/":o,this.secure=void 0===r?"true"!==document.documentElement.dataset.tnaCookiesInsecure:r,this.policiesKey=void 0===s?document.documentElement.dataset.tnaCookiesPoliciesKey||"cookies_policy":s,this.defaultAge=void 0===l?parseInt(document.documentElement.dataset.tnaCookiesDefaultAge)||31536e3:l,this.events=new d,this.completePoliciesOnInit=Object.keys(this.policies).length===y.length&&y.every((function(e){return Object.keys(t.policies).includes(e)&&"boolean"==typeof t.policies[e]})),this.completePoliciesOnInit||f||this.init(),window.TNAFrontendCookies=this}),[{key:"init",value:function(){var e=this.policies,t=Object.fromEntries(Object.keys(e).filter((function(e){return y.includes(e)})).map((function(t){return[t,e[t]]})));this.savePolicies(r(r({usage:!1,settings:!1,marketing:!1},t),{},{essential:!0}))}},{key:"destroyInstance",value:function(){window.TNAFrontendCookies=null}},{key:"all",get:function(){var e={};return document.cookie.split("; ").filter((function(e){return e})).forEach((function(t){var n=t.trim().split("=");n[0]&&(e[n[0]]=n[1])})),e}},{key:"policies",get:function(){try{return JSON.parse(this.get(this.policiesKey)||"{}")}catch(e){return{}}}},{key:"exists",value:function(e){return Object.hasOwn(this.all,e)}},{key:"hasValue",value:function(e,t){return this.get(e)==t}},{key:"get",value:function(e){return this.exists(e)?decodeURIComponent(this.all[e]):null}},{key:"set",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.maxAge,o=void 0===i?this.defaultAge:i,r=n.sameSite,s=void 0===r?"Lax":r,a=n.domain,u=void 0===a?this.defaultDomain:a,c=n.path,l=void 0===c?this.defaultPath:c,h=n.secure,p=void 0===h?this.secure:h,d=n.session,y=void 0!==d&&d;if(e){var f="".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t),";").concat(u?" domain=".concat(u,"; "):""," samesite=").concat(s,"; path=").concat(l).concat(y?"":"; max-age=".concat(o)).concat(p?"; secure":"");document.cookie=f,this.events.trigger("setCookie",{key:e,value:t,maxAge:o,path:l,sameSite:s,domain:u,secure:p,session:y,cookie:f})}}},{key:"delete",value:function(e){var t={maxAge:-1,path:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",domain:(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||void 0};this.set(e,"",t),this.events.trigger("deleteCookie",r({key:e},t))}},{key:"deleteAll",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Object.keys(this.all).forEach((function(i){e.delete(i,t,n)})),this.events.trigger("deleteAllCookies",{path:t,domain:n})}},{key:"acceptPolicy",value:function(e){this.setPolicy(e,!0),this.events.trigger("acceptPolicy",e),this.events.trigger("changePolicy",h({},e,!0))}},{key:"rejectPolicy",value:function(e){this.setPolicy(e,!1),this.events.trigger("rejectPolicy",e),this.events.trigger("changePolicy",h({},e,!1))}},{key:"setPolicy",value:function(e,t){"essential"!==e&&(this.savePolicies(r(r({},this.policies),{},h(h({},e,t),"essential",!0))),this.events.trigger("changePolicy",h({},e,t)))}},{key:"acceptAllPolicies",value:function(){var e=Object.fromEntries(Object.keys(this.policies).map((function(e){return[e.toLowerCase(),!0]})));this.savePolicies(e),this.events.trigger("acceptAllPolicies"),this.events.trigger("changePolicy",e)}},{key:"rejectAllPolicies",value:function(){var e=r(r({},Object.fromEntries(Object.keys(this.policies).map((function(e){return[e.toLowerCase(),!1]})))),{},{essential:!0});this.savePolicies(e),this.events.trigger("rejectAllPolicies"),this.events.trigger("changePolicy",e)}},{key:"savePolicies",value:function(e){this.set(this.policiesKey,JSON.stringify(e))}},{key:"isPolicyAccepted",value:function(e){return Object.hasOwn(this.policies,e)?!0===this.policies[e]:null}},{key:"on",value:function(e,t){this.events.on(e,t)}},{key:"once",value:function(e,t){this.events.once(e,t)}}])}()}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var r=t[i]={exports:{}};return e[i](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};n.r(i),n.d(i,{Cookies:()=>o.A,DateInput:()=>u});var o=n(169);function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function s(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,a(i.key),i)}}function a(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}var u=function(){return e=function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.$module=t,this.$dayWrapper=t&&t.querySelector(".tna-date-input__item--day"),this.$dayInput=this.$dayWrapper&&this.$dayWrapper.querySelector("input"),this.$monthWrapper=t&&t.querySelector(".tna-date-input__item--month"),this.$monthInput=this.$monthWrapper&&this.$monthWrapper.querySelector("input"),this.$yearWrapper=t&&t.querySelector(".tna-date-input__item--year"),this.$yearInput=this.$yearWrapper&&this.$yearWrapper.querySelector("input"),this.$module&&(this.update(),this.$yearInput&&(this.$yearInput.addEventListener("keyup",(function(){return n.update()})),this.$yearInput.addEventListener("change",(function(){return n.update()}))),this.$monthInput&&(this.$monthInput.addEventListener("keyup",(function(){return n.update()})),this.$monthInput.addEventListener("change",(function(){return n.update()}))),this.$dayInput&&(this.$dayInput.addEventListener("keyup",(function(){return n.update()})),this.$dayInput.addEventListener("change",(function(){return n.update()}))))},(t=[{key:"update",value:function(){this.isValidYear()?(this.showMonth(),this.isValidMonth()?this.showDay():this.hideDay()):(this.hideMonth(),this.hideDay())}},{key:"isValidYear",value:function(){if(!this.$yearInput)return!0;var e=parseInt(this.$yearInput.value.trim());return!isNaN(this.$yearInput.value)&&!isNaN(e)&&e>0}},{key:"isValidMonth",value:function(){if(!this.$monthInput)return!0;var e=parseInt(this.$monthInput.value.trim());return!isNaN(this.$monthInput.value)&&!isNaN(e)&&e>0&&e<=12}},{key:"showMonth",value:function(){this.$monthWrapper&&this.$monthWrapper.removeAttribute("hidden")}},{key:"hideMonth",value:function(){this.$monthWrapper&&this.$monthWrapper.setAttribute("hidden","")}},{key:"showDay",value:function(){this.$dayWrapper&&this.$dayWrapper.removeAttribute("hidden")}},{key:"hideDay",value:function(){this.$dayWrapper&&this.$dayWrapper.setAttribute("hidden","")}}])&&s(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();return i})()));
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TNAFrontend",[],t):"object"==typeof exports?exports.TNAFrontend=t():e.TNAFrontend=t()}(self,(()=>(()=>{"use strict";var e={169:(e,t,n)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,p(i.key),i)}}function l(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){var t=function(e){if("object"!=i(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}n.d(t,{A:()=>f}),window.TNAFrontendCookies=window.TNAFrontendCookies||null,window.TNAFrontendCookieEvents=window.TNAFrontendCookieEvents||null;var d=function(){return l((function e(){if(u(this,e),h(this,"events",{}),h(this,"oneTimeEvents",{}),window.TNAFrontendCookieEvents)return window.TNAFrontendCookieEvents;window.TNAFrontendCookieEvents=this}),[{key:"on",value:function(e,t){Object.hasOwn(this.events,e)||(this.events[e]=[]),this.events[e]=[].concat(s(this.events[e]),[t])}},{key:"once",value:function(e,t){Object.hasOwn(this.oneTimeEvents,e)||(this.oneTimeEvents[e]=[]),this.oneTimeEvents[e]=[].concat(s(this.oneTimeEvents[e]),[t])}},{key:"trigger",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Object.hasOwn(this.events,e)&&this.events[e].forEach((function(e){return e.call(t,n)})),Object.hasOwn(this.oneTimeEvents,e))for(var i=this.oneTimeEvents[e].length-1;i>=0;i--)this.oneTimeEvents[e][i].call(this,n),this.oneTimeEvents[e].splice(i,1)}}])}(),y=["usage","settings","marketing","essential"],f=function(){return l((function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u(this,e),h(this,"defaultDomain",""),h(this,"defaultPath",""),h(this,"secure",!0),h(this,"policiesKey",""),h(this,"events",null),h(this,"defaultAge",null),h(this,"completePoliciesOnInit",!1);var i=n.defaultDomain,o=n.defaultPath,r=n.secure,s=n.policiesKey,a=n.newInstance,c=void 0!==a&&a,l=n.defaultAge,p=n.noInit,f=void 0!==p&&p;if(!c&&window.TNAFrontendCookies)return window.TNAFrontendCookies;this.defaultDomain=void 0===i?document.documentElement.dataset.tnaCookiesDomain||"":i,this.defaultPath=void 0===o?document.documentElement.dataset.tnaCookiesPath||"/":o,this.secure=void 0===r?"true"!==document.documentElement.dataset.tnaCookiesInsecure:r,this.policiesKey=void 0===s?document.documentElement.dataset.tnaCookiesPoliciesKey||"cookies_policy":s,this.defaultAge=void 0===l?parseInt(document.documentElement.dataset.tnaCookiesDefaultAge)||31536e3:l,this.events=new d,this.completePoliciesOnInit=Object.keys(this.policies).length===y.length&&y.every((function(e){return Object.keys(t.policies).includes(e)&&"boolean"==typeof t.policies[e]})),this.completePoliciesOnInit||f||this.init(),window.TNAFrontendCookies=this}),[{key:"init",value:function(){var e=this.policies,t=Object.fromEntries(Object.keys(e).filter((function(e){return y.includes(e)})).map((function(t){return[t,e[t]]})));this.savePolicies(r(r({usage:!1,settings:!1,marketing:!1},t),{},{essential:!0}))}},{key:"destroyInstance",value:function(){window.TNAFrontendCookies=null}},{key:"all",get:function(){var e={};return document.cookie.split("; ").filter((function(e){return e})).forEach((function(t){var n=t.trim().split("=");n[0]&&(e[n[0]]=n[1])})),e}},{key:"policies",get:function(){try{return JSON.parse(this.get(this.policiesKey)||"{}")}catch(e){return{}}}},{key:"exists",value:function(e){return Object.hasOwn(this.all,e)}},{key:"hasValue",value:function(e,t){return this.get(e)==t}},{key:"get",value:function(e){return this.exists(e)?decodeURIComponent(this.all[e]):null}},{key:"set",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.maxAge,o=void 0===i?this.defaultAge:i,r=n.sameSite,s=void 0===r?"Lax":r,a=n.domain,u=void 0===a?this.defaultDomain:a,c=n.path,l=void 0===c?this.defaultPath:c,h=n.secure,p=void 0===h?this.secure:h,d=n.session,y=void 0!==d&&d;if(e){var f="".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t),";").concat(u?" domain=".concat(u,"; "):""," samesite=").concat(s,"; path=").concat(l).concat(y?"":"; max-age=".concat(o)).concat(p?"; secure":"");document.cookie=f,this.events.trigger("setCookie",{key:e,value:t,maxAge:o,path:l,sameSite:s,domain:u,secure:p,session:y,cookie:f})}}},{key:"delete",value:function(e){var t={maxAge:-1,path:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",domain:(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||void 0};this.set(e,"",t),this.events.trigger("deleteCookie",r({key:e},t))}},{key:"deleteAll",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Object.keys(this.all).forEach((function(i){e.delete(i,t,n)})),this.events.trigger("deleteAllCookies",{path:t,domain:n})}},{key:"acceptPolicy",value:function(e){this.setPolicy(e,!0),this.events.trigger("acceptPolicy",e),this.events.trigger("changePolicy",h({},e,!0))}},{key:"rejectPolicy",value:function(e){this.setPolicy(e,!1),this.events.trigger("rejectPolicy",e),this.events.trigger("changePolicy",h({},e,!1))}},{key:"setPolicy",value:function(e,t){"essential"!==e&&(this.savePolicies(r(r({},this.policies),{},h(h({},e,t),"essential",!0))),this.events.trigger("changePolicy",h({},e,t)))}},{key:"acceptAllPolicies",value:function(){var e=Object.fromEntries(Object.keys(this.policies).map((function(e){return[e.toLowerCase(),!0]})));this.savePolicies(e),this.events.trigger("acceptAllPolicies"),this.events.trigger("changePolicy",e)}},{key:"rejectAllPolicies",value:function(){var e=r(r({},Object.fromEntries(Object.keys(this.policies).map((function(e){return[e.toLowerCase(),!1]})))),{},{essential:!0});this.savePolicies(e),this.events.trigger("rejectAllPolicies"),this.events.trigger("changePolicy",e)}},{key:"savePolicies",value:function(e){this.set(this.policiesKey,JSON.stringify(e))}},{key:"isPolicyAccepted",value:function(e){return Object.hasOwn(this.policies,e)?!0===this.policies[e]:null}},{key:"on",value:function(e,t){this.events.on(e,t)}},{key:"once",value:function(e,t){this.events.once(e,t)}}])}()}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var r=t[i]={exports:{}};return e[i](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};n.r(i),n.d(i,{Cookies:()=>o.A,DateInputProgressive:()=>u});var o=n(169);function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function s(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,a(i.key),i)}}function a(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}var u=function(){return e=function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.$module=t,this.$yearWrapper=t&&t.querySelector(".tna-date-input__item--year"),this.$yearInput=this.$yearWrapper&&this.$yearWrapper.querySelector("input"),this.$monthWrapper=t&&t.querySelector(".tna-date-input__item--month"),this.$monthInput=this.$monthWrapper&&this.$monthWrapper.querySelector("input"),this.$dayWrapper=t&&t.querySelector(".tna-date-input__item--day"),this.$dayInput=this.$dayWrapper&&this.$dayWrapper.querySelector("input"),this.$module&&(this.update(),window.addEventListener("pageshow",(function(){return n.update()})),this.$yearInput&&(this.$yearInput.addEventListener("keyup",(function(){return n.update()})),this.$yearInput.addEventListener("change",(function(){return n.update()}))),this.$monthInput&&(this.$monthInput.addEventListener("keyup",(function(){return n.update()})),this.$monthInput.addEventListener("change",(function(){return n.update()}))),this.$dayInput&&(this.$dayInput.addEventListener("keyup",(function(){return n.update()})),this.$dayInput.addEventListener("change",(function(){return n.update()}))))},(t=[{key:"update",value:function(){this.isValidYear()?(this.showMonth(),this.isValidMonth()?this.showDay():this.hideDay()):(this.hideMonth(),this.hideDay())}},{key:"isValidYear",value:function(){if(!this.$yearInput)return!0;var e=parseInt(this.$yearInput.value.trim());return!isNaN(this.$yearInput.value)&&!isNaN(e)&&e>0}},{key:"isValidMonth",value:function(){if(!this.$monthInput)return!0;var e=this.$monthInput.value.trim(),t=parseInt(e);return!isNaN(this.$monthInput.value)&&!isNaN(t)&&t>0&&t<=12||["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","jun","jul","aug","sep","oct","nov","dec"].includes(e.toLowerCase())}},{key:"showMonth",value:function(){this.$monthWrapper&&this.$monthWrapper.removeAttribute("hidden")}},{key:"hideMonth",value:function(){this.$monthWrapper&&this.$monthWrapper.setAttribute("hidden","")}},{key:"showDay",value:function(){this.$dayWrapper&&this.$dayWrapper.removeAttribute("hidden")}},{key:"hideDay",value:function(){this.$dayWrapper&&this.$dayWrapper.setAttribute("hidden","")}}])&&s(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();return i})()));
|
2
2
|
//# sourceMappingURL=date-input.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"components/date-input/date-input.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,cAAe,GAAIH,GACA,iBAAZC,QACdA,QAAqB,YAAID,IAEzBD,EAAkB,YAAIC,GACvB,CAT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I,KAAKiI,YAGPjI,KAAKkI,YACLlI,KAAKiI,UAET,GAAC,CAAAhI,IAAA,cAAAC,MAED,WACE,IAAKF,KAAK0H,WACR,OAAO,EAET,IAAMS,EAAY1F,SAASzC,KAAK0H,WAAWxH,MAAMiE,QACjD,OAAQiE,MAAMpI,KAAK0H,WAAWxH,SAAWkI,MAAMD,IAAcA,EAAY,CAC3E,GAAC,CAAAlI,IAAA,eAAAC,MAED,WACE,IAAKF,KAAKwH,YACR,OAAO,EAET,IAAMa,EAAa5F,SAASzC,KAAKwH,YAAYtH,MAAMiE,QACnD,OACGiE,MAAMpI,KAAKwH,YAAYtH,SACvBkI,MAAMC,IACPA,EAAa,GACbA,GAAc,EAElB,GAAC,CAAApI,IAAA,YAAAC,MAED,WACMF,KAAKuH,eACPvH,KAAKuH,cAAce,gBAAgB,SAEvC,GAAC,CAAArI,IAAA,YAAAC,MAED,WACMF,KAAKuH,eACPvH,KAAKuH,cAAcgB,aAAa,SAAU,GAE9C,GAAC,CAAAtI,IAAA,UAAAC,MAED,WACMF,KAAKoH,aACPpH,KAAKoH,YAAYkB,gBAAgB,SAErC,GAAC,CAAArI,IAAA,UAAAC,MAED,WACMF,KAAKoH,aACPpH,KAAKoH,YAAYmB,aAAa,SAAU,GAE5C,M,6EAAC,CA9FmB,G","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/cookies.mjs","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/date-input/date-input.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","window.TNAFrontendCookies = window.TNAFrontendCookies || null;\nwindow.TNAFrontendCookieEvents = window.TNAFrontendCookieEvents || null;\n\nexport class CookieEventHandler {\n events = {};\n oneTimeEvents = {};\n\n constructor() {\n if (window.TNAFrontendCookieEvents) {\n return window.TNAFrontendCookieEvents;\n }\n window.TNAFrontendCookieEvents = this;\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n if (!Object.hasOwn(this.events, event)) {\n this.events[event] = [];\n }\n this.events[event] = [...this.events[event], callback];\n }\n\n once(event, callback) {\n if (!Object.hasOwn(this.oneTimeEvents, event)) {\n this.oneTimeEvents[event] = [];\n }\n this.oneTimeEvents[event] = [...this.oneTimeEvents[event], callback];\n }\n\n /** @protected */\n trigger(event, data = {}) {\n if (Object.hasOwn(this.events, event)) {\n this.events[event].forEach((eventToTrigger) =>\n eventToTrigger.call(this, data),\n );\n }\n if (Object.hasOwn(this.oneTimeEvents, event)) {\n for (let i = this.oneTimeEvents[event].length - 1; i >= 0; i--) {\n const eventToTrigger = this.oneTimeEvents[event][i];\n eventToTrigger.call(this, data);\n this.oneTimeEvents[event].splice(i, 1);\n }\n }\n }\n}\n\nconst tnaCookiePolicies = [\"usage\", \"settings\", \"marketing\", \"essential\"];\n\n/**\n * Class to handle cookies.\n * @class Cookies\n * @constructor\n * @public\n */\nexport default class Cookies {\n /** @protected */\n defaultDomain = \"\";\n /** @protected */\n defaultPath = \"\";\n /** @protected */\n secure = true;\n /** @protected */\n policiesKey = \"\";\n /** @protected */\n events = null;\n /** @protected */\n defaultAge = null;\n /** @protected */\n completePoliciesOnInit = false;\n\n /**\n * Create a cookie handler.\n * @param {String} [options.defaultDomain] - The domain to register the cookie with.\n * @param {String} [options.path] - The domain to register the cookie with.\n * @param {Boolean} [options.secure] - Only set cookie in HTTPS environments.\n * @param {String} [options.policiesKey] - The name of the cookie.\n * @param {String} [options.newInstance=false] - Create a fresh instance of the cookie class.\n * @param {Number} [options.defaultAge] - The default age of non-session cookies.\n * @param {Boolean} [options.noInit=false] - Don't initialise a blank cookie policy.\n */\n constructor(options = {}) {\n const {\n defaultDomain,\n defaultPath,\n secure,\n policiesKey,\n newInstance = false,\n defaultAge,\n noInit = false,\n } = options;\n if (!newInstance && window.TNAFrontendCookies) {\n return window.TNAFrontendCookies;\n }\n if (defaultDomain === undefined) {\n this.defaultDomain =\n document.documentElement.dataset.tnaCookiesDomain || \"\";\n } else {\n this.defaultDomain = defaultDomain;\n }\n if (defaultPath === undefined) {\n this.defaultPath = document.documentElement.dataset.tnaCookiesPath || \"/\";\n } else {\n this.defaultPath = defaultPath;\n }\n if (secure === undefined) {\n this.secure =\n document.documentElement.dataset.tnaCookiesInsecure !== \"true\";\n } else {\n this.secure = secure;\n }\n if (policiesKey === undefined) {\n this.policiesKey =\n document.documentElement.dataset.tnaCookiesPoliciesKey ||\n \"cookies_policy\";\n } else {\n this.policiesKey = policiesKey;\n }\n if (defaultAge === undefined) {\n this.defaultAge =\n parseInt(document.documentElement.dataset.tnaCookiesDefaultAge) ||\n 31536000; // 365 days;\n } else {\n this.defaultAge = defaultAge;\n }\n this.events = new CookieEventHandler();\n this.completePoliciesOnInit =\n Object.keys(this.policies).length === tnaCookiePolicies.length &&\n tnaCookiePolicies.every(\n (policy) =>\n Object.keys(this.policies).includes(policy) &&\n typeof this.policies[policy] === \"boolean\",\n );\n if (!this.completePoliciesOnInit && !noInit) {\n this.init();\n }\n window.TNAFrontendCookies = this;\n }\n\n /** @protected */\n init() {\n const existingPolicies = this.policies;\n const filteredExistingPolicies = Object.fromEntries(\n Object.keys(existingPolicies)\n .filter((policy) => tnaCookiePolicies.includes(policy))\n .map((policy) => [policy, existingPolicies[policy]]),\n );\n this.savePolicies({\n usage: false,\n settings: false,\n marketing: false,\n ...filteredExistingPolicies,\n essential: true,\n });\n }\n\n destroyInstance() {\n window.TNAFrontendCookies = null;\n }\n\n /** @protected */\n get all() {\n const deserialised = {};\n document.cookie\n .split(\"; \")\n .filter((x) => x)\n .forEach((cookie) => {\n const parts = cookie.trim().split(\"=\");\n if (parts[0]) {\n deserialised[parts[0]] = parts[1];\n }\n });\n return deserialised;\n }\n\n /** @protected */\n get policies() {\n try {\n return JSON.parse(this.get(this.policiesKey) || \"{}\");\n } catch (e) {\n return {};\n }\n }\n\n /**\n * Check to see whether a cookie exists or not.\n * @param {String} key - The cookie name.\n * @returns {Boolean}\n */\n exists(key) {\n return Object.hasOwn(this.all, key);\n }\n\n /**\n * Check to see whether a cookie has a particular value.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The value to check against.\n * @returns\n */\n hasValue(key, value) {\n return this.get(key) == value;\n }\n\n /**\n * Get a cookie.\n * @param {String} key - The cookie name.\n * @returns {String|Number|Boolean}\n */\n get(key) {\n return this.exists(key) ? decodeURIComponent(this.all[key]) : null;\n }\n\n /**\n * Set a cookie.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The cookie value.\n * @param {Object} options\n * @param {Number} [options.maxAge=this.defaultAge] - The maximum age of the cookie in seconds.\n * @param {String} [options.path=/] - The path to register the cookie for.\n * @param {String} [options.sameSite=Lax] - The sameSite attribute.\n * @param {String} [options.domain=this.defaultDomain] - The domain to register the cookie with.\n * @param {String} [options.path=this.defaultPath] - The path to register the cookie with.\n * @param {String} [options.secure=this.secure] - Only set cookie in HTTPS environments.\n * @param {String} [options.session=false] - Set a session cookie.\n */\n set(key, value, options = {}) {\n const {\n maxAge = this.defaultAge,\n sameSite = \"Lax\",\n domain = this.defaultDomain,\n path = this.defaultPath,\n secure = this.secure,\n session = false,\n } = options;\n if (!key) {\n return;\n }\n const cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)};${\n domain ? ` domain=${domain}; ` : \"\"\n } samesite=${sameSite}; path=${path}${!session ? `; max-age=${maxAge}` : \"\"}${\n secure ? \"; secure\" : \"\"\n }`;\n document.cookie = cookie;\n this.events.trigger(\"setCookie\", {\n key,\n value,\n maxAge,\n path,\n sameSite,\n domain,\n secure,\n session,\n cookie,\n });\n }\n\n /**\n * Delete a cookie.\n * @param {String} key - The cookie name.\n * @param {String} [path=/] - The path to the cookie is registered on.\n */\n delete(key, path = \"/\", domain = null) {\n const options = { maxAge: -1, path, domain: domain || undefined };\n this.set(key, \"\", options);\n this.events.trigger(\"deleteCookie\", { key, ...options });\n }\n\n /**\n * Delete all cookies.\n */\n deleteAll(path = \"/\", domain = null) {\n Object.keys(this.all).forEach((cookie) => {\n this.delete(cookie, path, domain);\n });\n this.events.trigger(\"deleteAllCookies\", { path, domain });\n }\n\n /**\n * Accept a policy.\n * @param {String} policy - The name of the policy.\n */\n acceptPolicy(policy) {\n this.setPolicy(policy, true);\n this.events.trigger(\"acceptPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: true });\n }\n\n /**\n * Reject a policy.\n * @param {String} policy - The name of the policy.\n */\n rejectPolicy(policy) {\n this.setPolicy(policy, false);\n this.events.trigger(\"rejectPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: false });\n }\n\n /**\n * Set a policy.\n * @param {String} policy - The name of the policy.\n * @param {Boolean} accepted - Whether the policy is accepted or not.\n */\n setPolicy(policy, accepted) {\n if (policy === \"essential\") {\n return;\n }\n this.savePolicies({\n ...this.policies,\n [policy]: accepted,\n essential: true,\n });\n this.events.trigger(\"changePolicy\", { [policy]: accepted });\n }\n\n /**\n * Accept all the cookie policies.\n */\n acceptAllPolicies() {\n const allPolicies = Object.fromEntries(\n Object.keys(this.policies).map((k) => [k.toLowerCase(), true]),\n );\n this.savePolicies(allPolicies);\n this.events.trigger(\"acceptAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Reject all the cookie policies.\n */\n rejectAllPolicies() {\n const allPolicies = {\n ...Object.fromEntries(\n Object.keys(this.policies).map((k) => [k.toLowerCase(), false]),\n ),\n essential: true,\n };\n this.savePolicies(allPolicies);\n this.events.trigger(\"rejectAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Commit policy preferences to the browser.\n * @param {object} policies - The policies to commit.\n */\n savePolicies(policies) {\n this.set(this.policiesKey, JSON.stringify(policies));\n }\n\n /**\n * Get the acceptance status of a policy.\n * @param {String} policy - The name of the policy.\n * @returns {Boolean}\n */\n isPolicyAccepted(policy) {\n return Object.hasOwn(this.policies, policy)\n ? this.policies[policy] === true\n : null;\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n this.events.on(event, callback);\n }\n\n /**\n * Add a one-time event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n once(event, callback) {\n this.events.once(event, callback);\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import Cookies from \"../../lib/cookies.mjs\";\n\nexport { Cookies };\n\nexport class DateInput {\n constructor($module) {\n this.$module = $module;\n this.$dayWrapper =\n $module && $module.querySelector(\".tna-date-input__item--day\");\n this.$dayInput =\n this.$dayWrapper && this.$dayWrapper.querySelector(\"input\");\n this.$monthWrapper =\n $module && $module.querySelector(\".tna-date-input__item--month\");\n this.$monthInput =\n this.$monthWrapper && this.$monthWrapper.querySelector(\"input\");\n this.$yearWrapper =\n $module && $module.querySelector(\".tna-date-input__item--year\");\n this.$yearInput =\n this.$yearWrapper && this.$yearWrapper.querySelector(\"input\");\n\n if (!this.$module) {\n return;\n }\n\n this.update();\n\n if (this.$yearInput) {\n this.$yearInput.addEventListener(\"keyup\", () => this.update());\n this.$yearInput.addEventListener(\"change\", () => this.update());\n }\n if (this.$monthInput) {\n this.$monthInput.addEventListener(\"keyup\", () => this.update());\n this.$monthInput.addEventListener(\"change\", () => this.update());\n }\n if (this.$dayInput) {\n this.$dayInput.addEventListener(\"keyup\", () => this.update());\n this.$dayInput.addEventListener(\"change\", () => this.update());\n }\n }\n\n update() {\n if (this.isValidYear()) {\n this.showMonth();\n\n if (this.isValidMonth()) {\n this.showDay();\n } else {\n this.hideDay();\n }\n } else {\n this.hideMonth();\n this.hideDay();\n }\n }\n\n isValidYear() {\n if (!this.$yearInput) {\n return true;\n }\n const yearValue = parseInt(this.$yearInput.value.trim());\n return !isNaN(this.$yearInput.value) && !isNaN(yearValue) && yearValue > 0;\n }\n\n isValidMonth() {\n if (!this.$monthInput) {\n return true;\n }\n const monthValue = parseInt(this.$monthInput.value.trim());\n return (\n !isNaN(this.$monthInput.value) &&\n !isNaN(monthValue) &&\n monthValue > 0 &&\n monthValue <= 12\n );\n }\n\n showMonth() {\n if (this.$monthWrapper) {\n this.$monthWrapper.removeAttribute(\"hidden\");\n }\n }\n\n hideMonth() {\n if (this.$monthWrapper) {\n this.$monthWrapper.setAttribute(\"hidden\", \"\");\n }\n }\n\n showDay() {\n if (this.$dayWrapper) {\n this.$dayWrapper.removeAttribute(\"hidden\");\n }\n }\n\n hideDay() {\n if (this.$dayWrapper) {\n this.$dayWrapper.setAttribute(\"hidden\", \"\");\n }\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","window","TNAFrontendCookies","TNAFrontendCookieEvents","CookieEventHandler","_createClass","_classCallCheck","_defineProperty","this","key","value","event","callback","Object","hasOwn","events","concat","_toConsumableArray","oneTimeEvents","_this","data","arguments","length","undefined","forEach","eventToTrigger","call","i","splice","tnaCookiePolicies","Cookies","_this2","options","defaultDomain","defaultPath","secure","policiesKey","_options$newInstance","newInstance","defaultAge","_options$noInit","noInit","document","documentElement","dataset","tnaCookiesDomain","tnaCookiesPath","tnaCookiesInsecure","tnaCookiesPoliciesKey","parseInt","tnaCookiesDefaultAge","completePoliciesOnInit","keys","policies","every","policy","includes","init","existingPolicies","filteredExistingPolicies","fromEntries","filter","map","savePolicies","_objectSpread","usage","settings","marketing","essential","get","deserialised","cookie","split","x","parts","trim","JSON","parse","e","all","exists","decodeURIComponent","_options$maxAge","maxAge","_options$sameSite","sameSite","_options$domain","domain","_options$path","path","_options$secure","_options$session","session","encodeURIComponent","trigger","set","_this3","setPolicy","accepted","allPolicies","k","toLowerCase","stringify","on","once","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","d","definition","o","defineProperty","enumerable","obj","prop","prototype","hasOwnProperty","r","Symbol","toStringTag","DateInput","$module","$dayWrapper","querySelector","$dayInput","$monthWrapper","$monthInput","$yearWrapper","$yearInput","update","addEventListener","isValidYear","showMonth","isValidMonth","showDay","hideDay","hideMonth","yearValue","isNaN","monthValue","removeAttribute","setAttribute"],"sourceRoot":""}
|
1
|
+
{"version":3,"file":"components/date-input/date-input.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACx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,kBAAMjH,EAAKgH,QAAQ,IAC5D3H,KAAK0H,UAAUE,iBAAiB,UAAU,kBAAMjH,EAAKgH,QAAQ,KAEjE,G,EAAC,EAAA1H,IAAA,SAAAC,MAED,WACMF,KAAK6H,eACP7H,KAAK8H,YACD9H,KAAK+H,eACP/H,KAAKgI,UAELhI,KAAKiI,YAGPjI,KAAKkI,YACLlI,KAAKiI,UAET,GAAC,CAAAhI,IAAA,cAAAC,MAED,WACE,IAAKF,KAAKsH,WACR,OAAO,EAET,IAAMa,EAAY1F,SAASzC,KAAKsH,WAAWpH,MAAMiE,QACjD,OAAQiE,MAAMpI,KAAKsH,WAAWpH,SAAWkI,MAAMD,IAAcA,EAAY,CAC3E,GAAC,CAAAlI,IAAA,eAAAC,MAED,WACE,IAAKF,KAAKwH,YACR,OAAO,EAET,IAAMa,EAAgBrI,KAAKwH,YAAYtH,MAAMiE,OACvCmE,EAAgB7F,SAAS4F,GA0B/B,OACID,MAAMpI,KAAKwH,YAAYtH,SACtBkI,MAAME,IACPA,EAAgB,GAChBA,GAAiB,IA7BK,CACxB,UACA,WACA,QACA,QACA,MACA,OACA,OACA,SACA,YACA,UACA,WACA,WACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,OAOkBtF,SAASqF,EAAcxC,cAE7C,GAAC,CAAA5F,IAAA,YAAAC,MAED,WACMF,KAAKuH,eACPvH,KAAKuH,cAAcgB,gBAAgB,SAEvC,GAAC,CAAAtI,IAAA,YAAAC,MAED,WACMF,KAAKuH,eACPvH,KAAKuH,cAAciB,aAAa,SAAU,GAE9C,GAAC,CAAAvI,IAAA,UAAAC,MAED,WACMF,KAAKyH,aACPzH,KAAKyH,YAAYc,gBAAgB,SAErC,GAAC,CAAAtI,IAAA,UAAAC,MAED,WACMF,KAAKyH,aACPzH,KAAKyH,YAAYe,aAAa,SAAU,GAE5C,M,6EAAC,CAzH8B,G","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/cookies.mjs","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/date-input/date-input.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","window.TNAFrontendCookies = window.TNAFrontendCookies || null;\nwindow.TNAFrontendCookieEvents = window.TNAFrontendCookieEvents || null;\n\nexport class CookieEventHandler {\n events = {};\n oneTimeEvents = {};\n\n constructor() {\n if (window.TNAFrontendCookieEvents) {\n return window.TNAFrontendCookieEvents;\n }\n window.TNAFrontendCookieEvents = this;\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n if (!Object.hasOwn(this.events, event)) {\n this.events[event] = [];\n }\n this.events[event] = [...this.events[event], callback];\n }\n\n once(event, callback) {\n if (!Object.hasOwn(this.oneTimeEvents, event)) {\n this.oneTimeEvents[event] = [];\n }\n this.oneTimeEvents[event] = [...this.oneTimeEvents[event], callback];\n }\n\n /** @protected */\n trigger(event, data = {}) {\n if (Object.hasOwn(this.events, event)) {\n this.events[event].forEach((eventToTrigger) =>\n eventToTrigger.call(this, data),\n );\n }\n if (Object.hasOwn(this.oneTimeEvents, event)) {\n for (let i = this.oneTimeEvents[event].length - 1; i >= 0; i--) {\n const eventToTrigger = this.oneTimeEvents[event][i];\n eventToTrigger.call(this, data);\n this.oneTimeEvents[event].splice(i, 1);\n }\n }\n }\n}\n\nconst tnaCookiePolicies = [\"usage\", \"settings\", \"marketing\", \"essential\"];\n\n/**\n * Class to handle cookies.\n * @class Cookies\n * @constructor\n * @public\n */\nexport default class Cookies {\n /** @protected */\n defaultDomain = \"\";\n /** @protected */\n defaultPath = \"\";\n /** @protected */\n secure = true;\n /** @protected */\n policiesKey = \"\";\n /** @protected */\n events = null;\n /** @protected */\n defaultAge = null;\n /** @protected */\n completePoliciesOnInit = false;\n\n /**\n * Create a cookie handler.\n * @param {String} [options.defaultDomain] - The domain to register the cookie with.\n * @param {String} [options.path] - The domain to register the cookie with.\n * @param {Boolean} [options.secure] - Only set cookie in HTTPS environments.\n * @param {String} [options.policiesKey] - The name of the cookie.\n * @param {String} [options.newInstance=false] - Create a fresh instance of the cookie class.\n * @param {Number} [options.defaultAge] - The default age of non-session cookies.\n * @param {Boolean} [options.noInit=false] - Don't initialise a blank cookie policy.\n */\n constructor(options = {}) {\n const {\n defaultDomain,\n defaultPath,\n secure,\n policiesKey,\n newInstance = false,\n defaultAge,\n noInit = false,\n } = options;\n if (!newInstance && window.TNAFrontendCookies) {\n return window.TNAFrontendCookies;\n }\n if (defaultDomain === undefined) {\n this.defaultDomain =\n document.documentElement.dataset.tnaCookiesDomain || \"\";\n } else {\n this.defaultDomain = defaultDomain;\n }\n if (defaultPath === undefined) {\n this.defaultPath = document.documentElement.dataset.tnaCookiesPath || \"/\";\n } else {\n this.defaultPath = defaultPath;\n }\n if (secure === undefined) {\n this.secure =\n document.documentElement.dataset.tnaCookiesInsecure !== \"true\";\n } else {\n this.secure = secure;\n }\n if (policiesKey === undefined) {\n this.policiesKey =\n document.documentElement.dataset.tnaCookiesPoliciesKey ||\n \"cookies_policy\";\n } else {\n this.policiesKey = policiesKey;\n }\n if (defaultAge === undefined) {\n this.defaultAge =\n parseInt(document.documentElement.dataset.tnaCookiesDefaultAge) ||\n 31536000; // 365 days;\n } else {\n this.defaultAge = defaultAge;\n }\n this.events = new CookieEventHandler();\n this.completePoliciesOnInit =\n Object.keys(this.policies).length === tnaCookiePolicies.length &&\n tnaCookiePolicies.every(\n (policy) =>\n Object.keys(this.policies).includes(policy) &&\n typeof this.policies[policy] === \"boolean\",\n );\n if (!this.completePoliciesOnInit && !noInit) {\n this.init();\n }\n window.TNAFrontendCookies = this;\n }\n\n /** @protected */\n init() {\n const existingPolicies = this.policies;\n const filteredExistingPolicies = Object.fromEntries(\n Object.keys(existingPolicies)\n .filter((policy) => tnaCookiePolicies.includes(policy))\n .map((policy) => [policy, existingPolicies[policy]]),\n );\n this.savePolicies({\n usage: false,\n settings: false,\n marketing: false,\n ...filteredExistingPolicies,\n essential: true,\n });\n }\n\n destroyInstance() {\n window.TNAFrontendCookies = null;\n }\n\n /** @protected */\n get all() {\n const deserialised = {};\n document.cookie\n .split(\"; \")\n .filter((x) => x)\n .forEach((cookie) => {\n const parts = cookie.trim().split(\"=\");\n if (parts[0]) {\n deserialised[parts[0]] = parts[1];\n }\n });\n return deserialised;\n }\n\n /** @protected */\n get policies() {\n try {\n return JSON.parse(this.get(this.policiesKey) || \"{}\");\n } catch (e) {\n return {};\n }\n }\n\n /**\n * Check to see whether a cookie exists or not.\n * @param {String} key - The cookie name.\n * @returns {Boolean}\n */\n exists(key) {\n return Object.hasOwn(this.all, key);\n }\n\n /**\n * Check to see whether a cookie has a particular value.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The value to check against.\n * @returns\n */\n hasValue(key, value) {\n return this.get(key) == value;\n }\n\n /**\n * Get a cookie.\n * @param {String} key - The cookie name.\n * @returns {String|Number|Boolean}\n */\n get(key) {\n return this.exists(key) ? decodeURIComponent(this.all[key]) : null;\n }\n\n /**\n * Set a cookie.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The cookie value.\n * @param {Object} options\n * @param {Number} [options.maxAge=this.defaultAge] - The maximum age of the cookie in seconds.\n * @param {String} [options.path=/] - The path to register the cookie for.\n * @param {String} [options.sameSite=Lax] - The sameSite attribute.\n * @param {String} [options.domain=this.defaultDomain] - The domain to register the cookie with.\n * @param {String} [options.path=this.defaultPath] - The path to register the cookie with.\n * @param {String} [options.secure=this.secure] - Only set cookie in HTTPS environments.\n * @param {String} [options.session=false] - Set a session cookie.\n */\n set(key, value, options = {}) {\n const {\n maxAge = this.defaultAge,\n sameSite = \"Lax\",\n domain = this.defaultDomain,\n path = this.defaultPath,\n secure = this.secure,\n session = false,\n } = options;\n if (!key) {\n return;\n }\n const cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)};${\n domain ? ` domain=${domain}; ` : \"\"\n } samesite=${sameSite}; path=${path}${!session ? `; max-age=${maxAge}` : \"\"}${\n secure ? \"; secure\" : \"\"\n }`;\n document.cookie = cookie;\n this.events.trigger(\"setCookie\", {\n key,\n value,\n maxAge,\n path,\n sameSite,\n domain,\n secure,\n session,\n cookie,\n });\n }\n\n /**\n * Delete a cookie.\n * @param {String} key - The cookie name.\n * @param {String} [path=/] - The path to the cookie is registered on.\n */\n delete(key, path = \"/\", domain = null) {\n const options = { maxAge: -1, path, domain: domain || undefined };\n this.set(key, \"\", options);\n this.events.trigger(\"deleteCookie\", { key, ...options });\n }\n\n /**\n * Delete all cookies.\n */\n deleteAll(path = \"/\", domain = null) {\n Object.keys(this.all).forEach((cookie) => {\n this.delete(cookie, path, domain);\n });\n this.events.trigger(\"deleteAllCookies\", { path, domain });\n }\n\n /**\n * Accept a policy.\n * @param {String} policy - The name of the policy.\n */\n acceptPolicy(policy) {\n this.setPolicy(policy, true);\n this.events.trigger(\"acceptPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: true });\n }\n\n /**\n * Reject a policy.\n * @param {String} policy - The name of the policy.\n */\n rejectPolicy(policy) {\n this.setPolicy(policy, false);\n this.events.trigger(\"rejectPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: false });\n }\n\n /**\n * Set a policy.\n * @param {String} policy - The name of the policy.\n * @param {Boolean} accepted - Whether the policy is accepted or not.\n */\n setPolicy(policy, accepted) {\n if (policy === \"essential\") {\n return;\n }\n this.savePolicies({\n ...this.policies,\n [policy]: accepted,\n essential: true,\n });\n this.events.trigger(\"changePolicy\", { [policy]: accepted });\n }\n\n /**\n * Accept all the cookie policies.\n */\n acceptAllPolicies() {\n const allPolicies = Object.fromEntries(\n Object.keys(this.policies).map((k) => [k.toLowerCase(), true]),\n );\n this.savePolicies(allPolicies);\n this.events.trigger(\"acceptAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Reject all the cookie policies.\n */\n rejectAllPolicies() {\n const allPolicies = {\n ...Object.fromEntries(\n Object.keys(this.policies).map((k) => [k.toLowerCase(), false]),\n ),\n essential: true,\n };\n this.savePolicies(allPolicies);\n this.events.trigger(\"rejectAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Commit policy preferences to the browser.\n * @param {object} policies - The policies to commit.\n */\n savePolicies(policies) {\n this.set(this.policiesKey, JSON.stringify(policies));\n }\n\n /**\n * Get the acceptance status of a policy.\n * @param {String} policy - The name of the policy.\n * @returns {Boolean}\n */\n isPolicyAccepted(policy) {\n return Object.hasOwn(this.policies, policy)\n ? this.policies[policy] === true\n : null;\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n this.events.on(event, callback);\n }\n\n /**\n * Add a one-time event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n once(event, callback) {\n this.events.once(event, callback);\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import Cookies from \"../../lib/cookies.mjs\";\n\nexport { Cookies };\n\nexport class DateInputProgressive {\n constructor($module) {\n this.$module = $module;\n this.$yearWrapper =\n $module && $module.querySelector(\".tna-date-input__item--year\");\n this.$yearInput =\n this.$yearWrapper && this.$yearWrapper.querySelector(\"input\");\n this.$monthWrapper =\n $module && $module.querySelector(\".tna-date-input__item--month\");\n this.$monthInput =\n this.$monthWrapper && this.$monthWrapper.querySelector(\"input\");\n this.$dayWrapper =\n $module && $module.querySelector(\".tna-date-input__item--day\");\n this.$dayInput =\n this.$dayWrapper && this.$dayWrapper.querySelector(\"input\");\n\n if (!this.$module) {\n return;\n }\n\n this.update();\n window.addEventListener(\"pageshow\", () => this.update());\n\n if (this.$yearInput) {\n this.$yearInput.addEventListener(\"keyup\", () => this.update());\n this.$yearInput.addEventListener(\"change\", () => this.update());\n }\n if (this.$monthInput) {\n this.$monthInput.addEventListener(\"keyup\", () => this.update());\n this.$monthInput.addEventListener(\"change\", () => this.update());\n }\n if (this.$dayInput) {\n this.$dayInput.addEventListener(\"keyup\", () => this.update());\n this.$dayInput.addEventListener(\"change\", () => this.update());\n }\n }\n\n update() {\n if (this.isValidYear()) {\n this.showMonth();\n if (this.isValidMonth()) {\n this.showDay();\n } else {\n this.hideDay();\n }\n } else {\n this.hideMonth();\n this.hideDay();\n }\n }\n\n isValidYear() {\n if (!this.$yearInput) {\n return true;\n }\n const yearValue = parseInt(this.$yearInput.value.trim());\n return !isNaN(this.$yearInput.value) && !isNaN(yearValue) && yearValue > 0;\n }\n\n isValidMonth() {\n if (!this.$monthInput) {\n return true;\n }\n const monthRawValue = this.$monthInput.value.trim();\n const monthIntValue = parseInt(monthRawValue);\n const validMonthStrings = [\n \"january\",\n \"february\",\n \"march\",\n \"april\",\n \"may\",\n \"june\",\n \"july\",\n \"august\",\n \"september\",\n \"october\",\n \"november\",\n \"december\",\n \"jan\",\n \"feb\",\n \"mar\",\n \"apr\",\n \"jun\",\n \"jul\",\n \"aug\",\n \"sep\",\n \"oct\",\n \"nov\",\n \"dec\",\n ];\n return (\n (!isNaN(this.$monthInput.value) &&\n !isNaN(monthIntValue) &&\n monthIntValue > 0 &&\n monthIntValue <= 12) ||\n validMonthStrings.includes(monthRawValue.toLowerCase())\n );\n }\n\n showMonth() {\n if (this.$monthWrapper) {\n this.$monthWrapper.removeAttribute(\"hidden\");\n }\n }\n\n hideMonth() {\n if (this.$monthWrapper) {\n this.$monthWrapper.setAttribute(\"hidden\", \"\");\n }\n }\n\n showDay() {\n if (this.$dayWrapper) {\n this.$dayWrapper.removeAttribute(\"hidden\");\n }\n }\n\n hideDay() {\n if (this.$dayWrapper) {\n this.$dayWrapper.setAttribute(\"hidden\", \"\");\n }\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","window","TNAFrontendCookies","TNAFrontendCookieEvents","CookieEventHandler","_createClass","_classCallCheck","_defineProperty","this","key","value","event","callback","Object","hasOwn","events","concat","_toConsumableArray","oneTimeEvents","_this","data","arguments","length","undefined","forEach","eventToTrigger","call","i","splice","tnaCookiePolicies","Cookies","_this2","options","defaultDomain","defaultPath","secure","policiesKey","_options$newInstance","newInstance","defaultAge","_options$noInit","noInit","document","documentElement","dataset","tnaCookiesDomain","tnaCookiesPath","tnaCookiesInsecure","tnaCookiesPoliciesKey","parseInt","tnaCookiesDefaultAge","completePoliciesOnInit","keys","policies","every","policy","includes","init","existingPolicies","filteredExistingPolicies","fromEntries","filter","map","savePolicies","_objectSpread","usage","settings","marketing","essential","get","deserialised","cookie","split","x","parts","trim","JSON","parse","e","all","exists","decodeURIComponent","_options$maxAge","maxAge","_options$sameSite","sameSite","_options$domain","domain","_options$path","path","_options$secure","_options$session","session","encodeURIComponent","trigger","set","_this3","setPolicy","accepted","allPolicies","k","toLowerCase","stringify","on","once","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","d","definition","o","defineProperty","enumerable","obj","prop","prototype","hasOwnProperty","r","Symbol","toStringTag","DateInputProgressive","$module","$yearWrapper","querySelector","$yearInput","$monthWrapper","$monthInput","$dayWrapper","$dayInput","update","addEventListener","isValidYear","showMonth","isValidMonth","showDay","hideDay","hideMonth","yearValue","isNaN","monthRawValue","monthIntValue","removeAttribute","setAttribute"],"sourceRoot":""}
|
@@ -2,27 +2,28 @@ import Cookies from "../../lib/cookies.mjs";
|
|
2
2
|
|
3
3
|
export { Cookies };
|
4
4
|
|
5
|
-
export class
|
5
|
+
export class DateInputProgressive {
|
6
6
|
constructor($module) {
|
7
7
|
this.$module = $module;
|
8
|
-
this.$dayWrapper =
|
9
|
-
$module && $module.querySelector(".tna-date-input__item--day");
|
10
|
-
this.$dayInput =
|
11
|
-
this.$dayWrapper && this.$dayWrapper.querySelector("input");
|
12
|
-
this.$monthWrapper =
|
13
|
-
$module && $module.querySelector(".tna-date-input__item--month");
|
14
|
-
this.$monthInput =
|
15
|
-
this.$monthWrapper && this.$monthWrapper.querySelector("input");
|
16
8
|
this.$yearWrapper =
|
17
9
|
$module && $module.querySelector(".tna-date-input__item--year");
|
18
10
|
this.$yearInput =
|
19
11
|
this.$yearWrapper && this.$yearWrapper.querySelector("input");
|
12
|
+
this.$monthWrapper =
|
13
|
+
$module && $module.querySelector(".tna-date-input__item--month");
|
14
|
+
this.$monthInput =
|
15
|
+
this.$monthWrapper && this.$monthWrapper.querySelector("input");
|
16
|
+
this.$dayWrapper =
|
17
|
+
$module && $module.querySelector(".tna-date-input__item--day");
|
18
|
+
this.$dayInput =
|
19
|
+
this.$dayWrapper && this.$dayWrapper.querySelector("input");
|
20
20
|
|
21
21
|
if (!this.$module) {
|
22
22
|
return;
|
23
23
|
}
|
24
24
|
|
25
25
|
this.update();
|
26
|
+
window.addEventListener("pageshow", () => this.update());
|
26
27
|
|
27
28
|
if (this.$yearInput) {
|
28
29
|
this.$yearInput.addEventListener("keyup", () => this.update());
|
@@ -41,7 +42,6 @@ export class DateInput {
|
|
41
42
|
update() {
|
42
43
|
if (this.isValidYear()) {
|
43
44
|
this.showMonth();
|
44
|
-
|
45
45
|
if (this.isValidMonth()) {
|
46
46
|
this.showDay();
|
47
47
|
} else {
|
@@ -65,12 +65,39 @@ export class DateInput {
|
|
65
65
|
if (!this.$monthInput) {
|
66
66
|
return true;
|
67
67
|
}
|
68
|
-
const
|
68
|
+
const monthRawValue = this.$monthInput.value.trim();
|
69
|
+
const monthIntValue = parseInt(monthRawValue);
|
70
|
+
const validMonthStrings = [
|
71
|
+
"january",
|
72
|
+
"february",
|
73
|
+
"march",
|
74
|
+
"april",
|
75
|
+
"may",
|
76
|
+
"june",
|
77
|
+
"july",
|
78
|
+
"august",
|
79
|
+
"september",
|
80
|
+
"october",
|
81
|
+
"november",
|
82
|
+
"december",
|
83
|
+
"jan",
|
84
|
+
"feb",
|
85
|
+
"mar",
|
86
|
+
"apr",
|
87
|
+
"jun",
|
88
|
+
"jul",
|
89
|
+
"aug",
|
90
|
+
"sep",
|
91
|
+
"oct",
|
92
|
+
"nov",
|
93
|
+
"dec",
|
94
|
+
];
|
69
95
|
return (
|
70
|
-
!isNaN(this.$monthInput.value) &&
|
71
|
-
|
72
|
-
|
73
|
-
|
96
|
+
(!isNaN(this.$monthInput.value) &&
|
97
|
+
!isNaN(monthIntValue) &&
|
98
|
+
monthIntValue > 0 &&
|
99
|
+
monthIntValue <= 12) ||
|
100
|
+
validMonthStrings.includes(monthRawValue.toLowerCase())
|
74
101
|
);
|
75
102
|
}
|
76
103
|
|
@@ -76,7 +76,19 @@
|
|
76
76
|
"name": "date",
|
77
77
|
"progressive": true
|
78
78
|
},
|
79
|
-
"html": "<div class=\"tna-form__group\" data-module=\"date-input\"><fieldset class=\"tna-form__fieldset\"><legend class=\"tna-form__legend\"><h4 class=\"tna-form__heading tna-form__heading--xs\">Enter a start date</h4></legend><div class=\"tna-date-input\" id=\"date\"><div class=\"tna-date-input__item tna-date-input__item--year\"><label for=\"date-year\" class=\"tna-date-input__item-label\">Year</label><input type=\"text\" id=\"date-year\" value=\"\" name=\"date-year\" class=\"tna-date-input__item-input tna-date-input__item-input--wider\" inputmode=\"numeric\"></div><div class=\"tna-date-input__item tna-date-input__item--month\"><label for=\"date-month\" class=\"tna-date-input__item-label\">Month</label><input type=\"text\" id=\"date-month\" value=\"\" name=\"date-month\" class=\"tna-date-input__item-input\" inputmode=\"numeric\"></div><div class=\"tna-date-input__item tna-date-input__item--day\"><label for=\"date-day\" class=\"tna-date-input__item-label\">Day</label><input type=\"text\" id=\"date-day\" value=\"\" name=\"date-day\" class=\"tna-date-input__item-input\" inputmode=\"numeric\"></div></div></fieldset></div>"
|
79
|
+
"html": "<div class=\"tna-form__group\" data-module=\"date-input-progressive\"><fieldset class=\"tna-form__fieldset\"><legend class=\"tna-form__legend\"><h4 class=\"tna-form__heading tna-form__heading--xs\">Enter a start date</h4></legend><div class=\"tna-date-input\" id=\"date\"><div class=\"tna-date-input__item tna-date-input__item--year\"><label for=\"date-year\" class=\"tna-date-input__item-label\">Year</label><input type=\"text\" id=\"date-year\" value=\"\" name=\"date-year\" class=\"tna-date-input__item-input tna-date-input__item-input--wider\" inputmode=\"numeric\"></div><div class=\"tna-date-input__item tna-date-input__item--month\"><label for=\"date-month\" class=\"tna-date-input__item-label\">Month</label><input type=\"text\" id=\"date-month\" value=\"\" name=\"date-month\" class=\"tna-date-input__item-input\" inputmode=\"numeric\"></div><div class=\"tna-date-input__item tna-date-input__item--day\"><label for=\"date-day\" class=\"tna-date-input__item-label\">Day</label><input type=\"text\" id=\"date-day\" value=\"\" name=\"date-day\" class=\"tna-date-input__item-input\" inputmode=\"numeric\"></div></div></fieldset></div>"
|
80
|
+
},
|
81
|
+
{
|
82
|
+
"name": "only day and month",
|
83
|
+
"options": {
|
84
|
+
"label": "Enter a start date",
|
85
|
+
"headingLevel": 4,
|
86
|
+
"headingSize": "xs",
|
87
|
+
"id": "date",
|
88
|
+
"name": "date",
|
89
|
+
"fields": ["d", "m"]
|
90
|
+
},
|
91
|
+
"html": "<div class=\"tna-form__group\"><fieldset class=\"tna-form__fieldset\"><legend class=\"tna-form__legend\"><h4 class=\"tna-form__heading tna-form__heading--xs\">Enter a start date</h4></legend><div class=\"tna-date-input\" id=\"date\"><div class=\"tna-date-input__item tna-date-input__item--day\"><label for=\"date-day\" class=\"tna-date-input__item-label\">Day</label><input type=\"text\" id=\"date-day\" value=\"\" name=\"date-day\" class=\"tna-date-input__item-input\" inputmode=\"numeric\"></div><div class=\"tna-date-input__item tna-date-input__item--month\"><label for=\"date-month\" class=\"tna-date-input__item-label\">Month</label><input type=\"text\" id=\"date-month\" value=\"\" name=\"date-month\" class=\"tna-date-input__item-input\" inputmode=\"numeric\"></div></div></fieldset></div>"
|
80
92
|
},
|
81
93
|
{
|
82
94
|
"name": "only month and year",
|
@@ -98,10 +110,10 @@
|
|
98
110
|
"headingSize": "xs",
|
99
111
|
"id": "date",
|
100
112
|
"name": "date",
|
101
|
-
"fields": ["
|
113
|
+
"fields": ["m", "y"],
|
102
114
|
"progressive": true
|
103
115
|
},
|
104
|
-
"html": "<div class=\"tna-form__group\" data-module=\"date-input\"><fieldset class=\"tna-form__fieldset\"><legend class=\"tna-form__legend\"><h4 class=\"tna-form__heading tna-form__heading--xs\">Enter a start date</h4></legend><div class=\"tna-date-input\" id=\"date\"><div class=\"tna-date-input__item tna-date-input__item--year\"><label for=\"date-year\" class=\"tna-date-input__item-label\">Year</label><input type=\"text\" id=\"date-year\" value=\"\" name=\"date-year\" class=\"tna-date-input__item-input tna-date-input__item-input--wider\" inputmode=\"numeric\"></div><div class=\"tna-date-input__item tna-date-input__item--month\"><label for=\"date-month\" class=\"tna-date-input__item-label\">Month</label><input type=\"text\" id=\"date-month\" value=\"\" name=\"date-month\" class=\"tna-date-input__item-input\" inputmode=\"numeric\"></div></div></fieldset></div>"
|
116
|
+
"html": "<div class=\"tna-form__group\" data-module=\"date-input-progressive\"><fieldset class=\"tna-form__fieldset\"><legend class=\"tna-form__legend\"><h4 class=\"tna-form__heading tna-form__heading--xs\">Enter a start date</h4></legend><div class=\"tna-date-input\" id=\"date\"><div class=\"tna-date-input__item tna-date-input__item--year\"><label for=\"date-year\" class=\"tna-date-input__item-label\">Year</label><input type=\"text\" id=\"date-year\" value=\"\" name=\"date-year\" class=\"tna-date-input__item-input tna-date-input__item-input--wider\" inputmode=\"numeric\"></div><div class=\"tna-date-input__item tna-date-input__item--month\"><label for=\"date-month\" class=\"tna-date-input__item-label\">Month</label><input type=\"text\" id=\"date-month\" value=\"\" name=\"date-month\" class=\"tna-date-input__item-input\" inputmode=\"numeric\"></div></div></fieldset></div>"
|
105
117
|
},
|
106
118
|
{
|
107
119
|
"name": "autofill date of birth",
|
@@ -39,7 +39,7 @@
|
|
39
39
|
"name": "fields",
|
40
40
|
"type": "array",
|
41
41
|
"required": false,
|
42
|
-
"description": ""
|
42
|
+
"description": "An array of fields to display. Can be `d`, `m` or `y`. Order is preserved unless `progressive` is true."
|
43
43
|
},
|
44
44
|
{
|
45
45
|
"name": "value",
|
@@ -51,19 +51,19 @@
|
|
51
51
|
"name": "day",
|
52
52
|
"type": "string",
|
53
53
|
"required": false,
|
54
|
-
"description": ""
|
54
|
+
"description": "The value for the day field."
|
55
55
|
},
|
56
56
|
{
|
57
57
|
"name": "month",
|
58
58
|
"type": "string",
|
59
59
|
"required": false,
|
60
|
-
"description": ""
|
60
|
+
"description": "The value for the month field. Usually a number between 1 and 12, a three character month (jan-dec) or the month name (January-December)."
|
61
61
|
},
|
62
62
|
{
|
63
63
|
"name": "year",
|
64
64
|
"type": "string",
|
65
65
|
"required": false,
|
66
|
-
"description": ""
|
66
|
+
"description": "The value for the year field."
|
67
67
|
}
|
68
68
|
]
|
69
69
|
},
|
@@ -91,7 +91,7 @@
|
|
91
91
|
"name": "progressive",
|
92
92
|
"type": "boolean",
|
93
93
|
"required": false,
|
94
|
-
"description": ""
|
94
|
+
"description": "If true, order the date fields in a year-month-day order and only show the next field when the previous has a valid value."
|
95
95
|
},
|
96
96
|
{
|
97
97
|
"name": "formGroupClasses",
|
@@ -11,7 +11,7 @@
|
|
11
11
|
{%- set inputClassesParams = [params.classes] if params.classes else [] -%}
|
12
12
|
{%- set inputClasses = inputClassesParams | join(' ') -%}
|
13
13
|
|
14
|
-
<div class="tna-form__group{% if params.error %} tna-form__group--error{% endif %}{% if classes %} {{ classes }}{% endif %}"{% if params.progressive %} data-module="date-input"{% endif %}{% for attribute, value in params.formGroupAttributes %} {{ attribute }}{% if value !== '' %}="{{ value }}"{% endif %}{% endfor %}>
|
14
|
+
<div class="tna-form__group{% if params.error %} tna-form__group--error{% endif %}{% if classes %} {{ classes }}{% endif %}"{% if params.progressive %} data-module="date-input-progressive"{% endif %}{% for attribute, value in params.formGroupAttributes %} {{ attribute }}{% if value !== '' %}="{{ value }}"{% endif %}{% endfor %}>
|
15
15
|
<fieldset class="tna-form__fieldset"{%- if params.hint or params.error %} aria-describedby="{%- if params.hint -%}{{ params.id }}-hint{%- endif %} {% if params.error -%}{{ params.id }}-error{%- endif -%}"{%- endif %}>
|
16
16
|
<legend class="tna-form__legend">
|
17
17
|
<h{{ params.headingLevel }} class="tna-form__heading tna-form__heading--{{ params.headingSize or 'm' }}">
|
@@ -34,13 +34,13 @@
|
|
34
34
|
{%- if params.fields %}
|
35
35
|
{%- set fields = [] -%}
|
36
36
|
{% if 'y' in params.fields %}
|
37
|
-
{%- set fields = fields + ['
|
37
|
+
{%- set fields = fields + ['y'] -%}
|
38
38
|
{%- endif %}
|
39
39
|
{% if 'm' in params.fields %}
|
40
|
-
{%- set fields = fields + ['
|
40
|
+
{%- set fields = fields + ['m'] -%}
|
41
41
|
{%- endif %}
|
42
42
|
{% if 'd' in params.fields %}
|
43
|
-
{%- set fields = fields + ['
|
43
|
+
{%- set fields = fields + ['d'] -%}
|
44
44
|
{%- endif %}
|
45
45
|
{%- else %}
|
46
46
|
{%- set fields = ['y', 'm', 'd'] -%}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nationalarchives/frontend",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.21.0",
|
4
4
|
"description": "The National Archives frontend styles",
|
5
5
|
"scripts": {
|
6
6
|
"start": "storybook dev -p 6006",
|
@@ -18,7 +18,7 @@
|
|
18
18
|
"test:package": "node tasks/test-package.js",
|
19
19
|
"test:storybook": "test-storybook --browsers=chromium",
|
20
20
|
"test:unit": "jest --verbose",
|
21
|
-
"update:fixtures": "node tasks/update-fixtures.js"
|
21
|
+
"update:fixtures": "node tasks/update-fixtures.js && npm run lint:fix"
|
22
22
|
},
|
23
23
|
"repository": {
|
24
24
|
"type": "git",
|