@opensystemslab/map 0.4.7 → 0.4.8

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.
@@ -6522,7 +6522,7 @@ x:-moz-any-link {
6522
6522
  ul,
6523
6523
  li {
6524
6524
  font-family: Inter, Helvetica, sans-serif;
6525
- }`,by=Object.freeze,xy=Object.defineProperty,ky=Object.getOwnPropertyDescriptor,wy=(t,e,i,o)=>{for(var n,r=o>1?void 0:o?ky(e,i):e,a=t.length-1;a>=0;a--)(n=t[a])&&(r=(o?n(e,i,r):n(r))||r);return o&&r&&xy(e,i,r),r},Sy=(t,e)=>by(xy(t,"raw",{value:by(e||t.slice())}));let Cy=class extends ht{constructor(){super(...arguments),this.id="autocomplete",this.postcode="SE5 0HU",this.label="Select an address",this.osPlacesApiKey="",this._totalAddresses=void 0,this._addressesInPostcode=[],this._options=[],this._selectedAddress=null,this._osError=void 0,this.dispatch=(t,e)=>this.dispatchEvent(new CustomEvent(t,{detail:e}))}connectedCallback(){super.connectedCallback(),this._fetchData()}disconnectedCallback(){super.disconnectedCallback()}firstUpdated(){yy({element:this.renderRoot.querySelector(`#${this.id}-container`),id:this.id,required:!0,source:this._options,showAllValues:!0,tNoResults:()=>"No addresses found",onConfirm:t=>{this._selectedAddress=this._addressesInPostcode.filter((e=>e.LPI.ADDRESS.split(`, ${e.LPI.ADMINISTRATIVE_AREA}`)[0]===t))[0],this._selectedAddress&&this.dispatch("addressSelection",{address:this._selectedAddress})}})}async _fetchData(t=0,e=[]){const i={postcode:this.postcode,dataset:"LPI",maxResults:"100",output_srs:"EPSG:4326",lr:"EN",key:this.osPlacesApiKey},o=`https://api.os.uk/search/places/v1/postcode?${new URLSearchParams(i).toString()}`;await fetch(o+`&offset=${t}`).then((t=>t.json())).then((t=>{var i;t.error&&(this._osError=t.error.message),this._totalAddresses=null==(i=t.header)?void 0:i.totalresults;const o=e.concat(t.results||[]);this._addressesInPostcode=o,this.dispatch("ready",{postcode:this.postcode,addresses:`fetched ${this._addressesInPostcode.length}/${this._totalAddresses}`}),t.results&&(t.results.filter((t=>"APPROVED"===t.LPI.LPI_LOGICAL_STATUS_CODE_DESCRIPTION)).map((t=>{this._options.push(t.LPI.ADDRESS.split(`, ${t.LPI.ADMINISTRATIVE_AREA}`)[0])})),this._options.sort(((t,e)=>t.localeCompare(e)))),this._totalAddresses&&this._totalAddresses>this._addressesInPostcode.length&&this._fetchData(this._addressesInPostcode.length,this._addressesInPostcode)})).catch((t=>console.log(t)))}render(){let t;return t=this.osPlacesApiKey?this._osError?this._osError:0===this._totalAddresses?`No addresses found in postcode ${this.postcode}`:"Something went wrong":"Missing OS Places API key",!this.osPlacesApiKey||this._osError||0===this._totalAddresses?U(my||(my=Sy(['<script src="https://cdn.polyfill.io/v2/polyfill.min.js"><\/script>\n <div class="govuk-warning-text" role="status">\n <span class="govuk-warning-text__icon" aria-hidden="true">!</span>\n <strong class="govuk-warning-text__text">\n <span class="govuk-warning-text__assistive">Warning</span>\n ',"\n </strong>\n </div>"])),t):U(vy||(vy=Sy(['<script src="https://cdn.polyfill.io/v2/polyfill.min.js"><\/script>\n <link\n rel="stylesheet"\n href="https://cdn.jsdelivr.net/npm/accessible-autocomplete@2.0.4/dist/accessible-autocomplete.min.css"\n />\n <label class="govuk-label" htmlFor=',"> ",' </label>\n <div id="','-container" role="status"></div>'])),this.id,this.label,this.id)}};Cy.styles=f(_y),wy([gt({type:String})],Cy.prototype,"id",2),wy([gt({type:String})],Cy.prototype,"postcode",2),wy([gt({type:String})],Cy.prototype,"label",2),wy([gt({type:String})],Cy.prototype,"osPlacesApiKey",2),wy([mt()],Cy.prototype,"_totalAddresses",2),wy([mt()],Cy.prototype,"_addressesInPostcode",2),wy([mt()],Cy.prototype,"_options",2),wy([mt()],Cy.prototype,"_selectedAddress",2),wy([mt()],Cy.prototype,"_osError",2),Cy=wy([ct("address-autocomplete")],Cy);var zy,Ty=function(){return(Ty=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},Ey=/^([a-z]{1,2}\d)([a-z])$/i,Oy=/[a-z]{2}$/i,Py=/\d[a-z]{2}$/i,jy=/^[a-z]{1,2}\d[a-z\d]?\s*\d[a-z]{2}$/i,Ry=/^[a-z]{1,2}/i,Iy={valid:!1,postcode:null,incode:null,outcode:null,area:null,district:null,subDistrict:null,sector:null,unit:null},Fy=function(t){return null===t?null:t[0]},My=/\s+/gi,Ay=function(t){return t.replace(My,"").toUpperCase()},Dy=function(t,e){return Ay(t).match(e)},Ly=function(t){return null!==t.match(jy)},Gy=function(t){var e=Ny(t);if(null===e)return null;var i=By(t);return null===i?null:e+" "+i},Ny=function(t){return Ly(t)?Ay(t).replace(Py,""):null},By=function(t){if(!Ly(t))return null;var e=Dy(t,Py);return Fy(e)},qy=function(t){if(!Ly(t))return null;var e=Dy(t,Ry);return Fy(e)},Wy=function(t){var e=Ny(t);if(null===e)return null;var i=By(t);return null===i?null:e+" "+i[0]},Vy=function(t){if(!Ly(t))return null;var e=Dy(t,Oy);return Fy(e)},Uy=function(t){var e=Ny(t);if(null===e)return null;var i=e.match(Ey);return null===i?e:i[1]},Xy=function(t){var e=Ny(t);return null===e||null===e.match(Ey)?null:e},Ky=g`@charset "UTF-8";
6525
+ }`,by=Object.freeze,xy=Object.defineProperty,ky=Object.getOwnPropertyDescriptor,wy=(t,e,i,o)=>{for(var n,r=o>1?void 0:o?ky(e,i):e,a=t.length-1;a>=0;a--)(n=t[a])&&(r=(o?n(e,i,r):n(r))||r);return o&&r&&xy(e,i,r),r},Sy=(t,e)=>by(xy(t,"raw",{value:by(e||t.slice())}));let Cy=class extends ht{constructor(){super(...arguments),this.id="autocomplete",this.postcode="SE5 0HU",this.label="Select an address",this.initialAddress="",this.osPlacesApiKey="",this._totalAddresses=void 0,this._addressesInPostcode=[],this._options=[],this._selectedAddress=null,this._osError=void 0,this.dispatch=(t,e)=>this.dispatchEvent(new CustomEvent(t,{detail:e}))}connectedCallback(){super.connectedCallback(),this._fetchData()}disconnectedCallback(){super.disconnectedCallback()}firstUpdated(){yy({element:this.renderRoot.querySelector(`#${this.id}-container`),id:this.id,required:!0,source:this._options,defaultValue:this.initialAddress,showAllValues:!0,tNoResults:()=>"No addresses found",onConfirm:t=>{this._selectedAddress=this._addressesInPostcode.filter((e=>e.LPI.ADDRESS.split(`, ${e.LPI.ADMINISTRATIVE_AREA}`)[0]===t))[0],this._selectedAddress&&this.dispatch("addressSelection",{address:this._selectedAddress})}})}async _fetchData(t=0,e=[]){const i={postcode:this.postcode,dataset:"LPI",maxResults:"100",output_srs:"EPSG:4326",lr:"EN",key:this.osPlacesApiKey},o=`https://api.os.uk/search/places/v1/postcode?${new URLSearchParams(i).toString()}`;await fetch(o+`&offset=${t}`).then((t=>t.json())).then((t=>{var i;t.error&&(this._osError=t.error.message),this._totalAddresses=null==(i=t.header)?void 0:i.totalresults;const o=e.concat(t.results||[]);if(this._addressesInPostcode=o,this.dispatch("ready",{postcode:this.postcode,addresses:`fetched ${this._addressesInPostcode.length}/${this._totalAddresses}`}),t.results){t.results.filter((t=>"APPROVED"===t.LPI.LPI_LOGICAL_STATUS_CODE_DESCRIPTION)).map((t=>{this._options.push(t.LPI.ADDRESS.split(`, ${t.LPI.ADMINISTRATIVE_AREA}`)[0])}));const e=new Intl.Collator([],{numeric:!0});this._options.sort(((t,i)=>e.compare(t,i)))}this._totalAddresses&&this._totalAddresses>this._addressesInPostcode.length&&this._fetchData(this._addressesInPostcode.length,this._addressesInPostcode)})).catch((t=>console.log(t)))}render(){let t;return t=this.osPlacesApiKey?this._osError?this._osError:0===this._totalAddresses?`No addresses found in postcode ${this.postcode}`:"Something went wrong":"Missing OS Places API key",!this.osPlacesApiKey||this._osError||0===this._totalAddresses?U(my||(my=Sy(['<script src="https://cdn.polyfill.io/v2/polyfill.min.js"><\/script>\n <div class="govuk-warning-text" role="status">\n <span class="govuk-warning-text__icon" aria-hidden="true">!</span>\n <strong class="govuk-warning-text__text">\n <span class="govuk-warning-text__assistive">Warning</span>\n ',"\n </strong>\n </div>"])),t):U(vy||(vy=Sy(['<script src="https://cdn.polyfill.io/v2/polyfill.min.js"><\/script>\n <link\n rel="stylesheet"\n href="https://cdn.jsdelivr.net/npm/accessible-autocomplete@2.0.4/dist/accessible-autocomplete.min.css"\n />\n <label class="govuk-label" htmlFor=',"> ",' </label>\n <div id="','-container" role="status"></div>'])),this.id,this.label,this.id)}};Cy.styles=f(_y),wy([gt({type:String})],Cy.prototype,"id",2),wy([gt({type:String})],Cy.prototype,"postcode",2),wy([gt({type:String})],Cy.prototype,"label",2),wy([gt({type:String})],Cy.prototype,"initialAddress",2),wy([gt({type:String})],Cy.prototype,"osPlacesApiKey",2),wy([mt()],Cy.prototype,"_totalAddresses",2),wy([mt()],Cy.prototype,"_addressesInPostcode",2),wy([mt()],Cy.prototype,"_options",2),wy([mt()],Cy.prototype,"_selectedAddress",2),wy([mt()],Cy.prototype,"_osError",2),Cy=wy([ct("address-autocomplete")],Cy);var zy,Ty=function(){return(Ty=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},Ey=/^([a-z]{1,2}\d)([a-z])$/i,Oy=/[a-z]{2}$/i,Py=/\d[a-z]{2}$/i,jy=/^[a-z]{1,2}\d[a-z\d]?\s*\d[a-z]{2}$/i,Ry=/^[a-z]{1,2}/i,Iy={valid:!1,postcode:null,incode:null,outcode:null,area:null,district:null,subDistrict:null,sector:null,unit:null},Fy=function(t){return null===t?null:t[0]},My=/\s+/gi,Ay=function(t){return t.replace(My,"").toUpperCase()},Dy=function(t,e){return Ay(t).match(e)},Ly=function(t){return null!==t.match(jy)},Gy=function(t){var e=Ny(t);if(null===e)return null;var i=By(t);return null===i?null:e+" "+i},Ny=function(t){return Ly(t)?Ay(t).replace(Py,""):null},By=function(t){if(!Ly(t))return null;var e=Dy(t,Py);return Fy(e)},qy=function(t){if(!Ly(t))return null;var e=Dy(t,Ry);return Fy(e)},Wy=function(t){var e=Ny(t);if(null===e)return null;var i=By(t);return null===i?null:e+" "+i[0]},Vy=function(t){if(!Ly(t))return null;var e=Dy(t,Oy);return Fy(e)},Uy=function(t){var e=Ny(t);if(null===e)return null;var i=e.match(Ey);return null===i?e:i[1]},Xy=function(t){var e=Ny(t);return null===e||null===e.match(Ey)?null:e},Ky=g`@charset "UTF-8";
6526
6526
  .govuk-link {
6527
6527
  font-family: "GDS Transport", arial, sans-serif;
6528
6528
  -webkit-font-smoothing: antialiased;
@@ -6522,7 +6522,7 @@ x:-moz-any-link {
6522
6522
  ul,
6523
6523
  li {
6524
6524
  font-family: Inter, Helvetica, sans-serif;
6525
- }`,My=Object.freeze,Ay=Object.defineProperty,Dy=Object.getOwnPropertyDescriptor,Ly=(t,e,i,o)=>{for(var n,r=o>1?void 0:o?Dy(e,i):e,a=t.length-1;a>=0;a--)(n=t[a])&&(r=(o?n(e,i,r):n(r))||r);return o&&r&&Ay(e,i,r),r},Gy=(t,e)=>My(Ay(t,"raw",{value:My(e||t.slice())}));t.AddressAutocomplete=class extends nt{constructor(){super(...arguments),this.id="autocomplete",this.postcode="SE5 0HU",this.label="Select an address",this.osPlacesApiKey="",this._totalAddresses=void 0,this._addressesInPostcode=[],this._options=[],this._selectedAddress=null,this._osError=void 0,this.dispatch=(t,e)=>this.dispatchEvent(new CustomEvent(t,{detail:e}))}connectedCallback(){super.connectedCallback(),this._fetchData()}disconnectedCallback(){super.disconnectedCallback()}firstUpdated(){Iy({element:this.renderRoot.querySelector(`#${this.id}-container`),id:this.id,required:!0,source:this._options,showAllValues:!0,tNoResults:()=>"No addresses found",onConfirm:t=>{this._selectedAddress=this._addressesInPostcode.filter((e=>e.LPI.ADDRESS.split(`, ${e.LPI.ADMINISTRATIVE_AREA}`)[0]===t))[0],this._selectedAddress&&this.dispatch("addressSelection",{address:this._selectedAddress})}})}async _fetchData(t=0,e=[]){const i={postcode:this.postcode,dataset:"LPI",maxResults:"100",output_srs:"EPSG:4326",lr:"EN",key:this.osPlacesApiKey},o=`https://api.os.uk/search/places/v1/postcode?${new URLSearchParams(i).toString()}`;await fetch(o+`&offset=${t}`).then((t=>t.json())).then((t=>{var i;t.error&&(this._osError=t.error.message),this._totalAddresses=null==(i=t.header)?void 0:i.totalresults;const o=e.concat(t.results||[]);this._addressesInPostcode=o,this.dispatch("ready",{postcode:this.postcode,addresses:`fetched ${this._addressesInPostcode.length}/${this._totalAddresses}`}),t.results&&(t.results.filter((t=>"APPROVED"===t.LPI.LPI_LOGICAL_STATUS_CODE_DESCRIPTION)).map((t=>{this._options.push(t.LPI.ADDRESS.split(`, ${t.LPI.ADMINISTRATIVE_AREA}`)[0])})),this._options.sort(((t,e)=>t.localeCompare(e)))),this._totalAddresses&&this._totalAddresses>this._addressesInPostcode.length&&this._fetchData(this._addressesInPostcode.length,this._addressesInPostcode)})).catch((t=>console.log(t)))}render(){let t;return t=this.osPlacesApiKey?this._osError?this._osError:0===this._totalAddresses?`No addresses found in postcode ${this.postcode}`:"Something went wrong":"Missing OS Places API key",!this.osPlacesApiKey||this._osError||0===this._totalAddresses?D(jy||(jy=Gy(['<script src="https://cdn.polyfill.io/v2/polyfill.min.js"><\/script>\n <div class="govuk-warning-text" role="status">\n <span class="govuk-warning-text__icon" aria-hidden="true">!</span>\n <strong class="govuk-warning-text__text">\n <span class="govuk-warning-text__assistive">Warning</span>\n ',"\n </strong>\n </div>"])),t):D(Ry||(Ry=Gy(['<script src="https://cdn.polyfill.io/v2/polyfill.min.js"><\/script>\n <link\n rel="stylesheet"\n href="https://cdn.jsdelivr.net/npm/accessible-autocomplete@2.0.4/dist/accessible-autocomplete.min.css"\n />\n <label class="govuk-label" htmlFor=',"> ",' </label>\n <div id="','-container" role="status"></div>'])),this.id,this.label,this.id)}},t.AddressAutocomplete.styles=a(Fy),Ly([st({type:String})],t.AddressAutocomplete.prototype,"id",2),Ly([st({type:String})],t.AddressAutocomplete.prototype,"postcode",2),Ly([st({type:String})],t.AddressAutocomplete.prototype,"label",2),Ly([st({type:String})],t.AddressAutocomplete.prototype,"osPlacesApiKey",2),Ly([lt()],t.AddressAutocomplete.prototype,"_totalAddresses",2),Ly([lt()],t.AddressAutocomplete.prototype,"_addressesInPostcode",2),Ly([lt()],t.AddressAutocomplete.prototype,"_options",2),Ly([lt()],t.AddressAutocomplete.prototype,"_selectedAddress",2),Ly([lt()],t.AddressAutocomplete.prototype,"_osError",2),t.AddressAutocomplete=Ly([rt("address-autocomplete")],t.AddressAutocomplete);var Ny,By=function(){return(By=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},qy=/^([a-z]{1,2}\d)([a-z])$/i,Wy=/[a-z]{2}$/i,Vy=/\d[a-z]{2}$/i,Uy=/^[a-z]{1,2}\d[a-z\d]?\s*\d[a-z]{2}$/i,Xy=/^[a-z]{1,2}/i,Ky={valid:!1,postcode:null,incode:null,outcode:null,area:null,district:null,subDistrict:null,sector:null,unit:null},Yy=function(t){return null===t?null:t[0]},Zy=/\s+/gi,Hy=function(t){return t.replace(Zy,"").toUpperCase()},$y=function(t,e){return Hy(t).match(e)},Jy=function(t){return null!==t.match(Uy)},Qy=function(t){var e=t_(t);if(null===e)return null;var i=e_(t);return null===i?null:e+" "+i},t_=function(t){return Jy(t)?Hy(t).replace(Vy,""):null},e_=function(t){if(!Jy(t))return null;var e=$y(t,Vy);return Yy(e)},i_=function(t){if(!Jy(t))return null;var e=$y(t,Xy);return Yy(e)},o_=function(t){var e=t_(t);if(null===e)return null;var i=e_(t);return null===i?null:e+" "+i[0]},n_=function(t){if(!Jy(t))return null;var e=$y(t,Wy);return Yy(e)},r_=function(t){var e=t_(t);if(null===e)return null;var i=e.match(qy);return null===i?e:i[1]},a_=function(t){var e=t_(t);return null===e||null===e.match(qy)?null:e},s_=s`@charset "UTF-8";
6525
+ }`,My=Object.freeze,Ay=Object.defineProperty,Dy=Object.getOwnPropertyDescriptor,Ly=(t,e,i,o)=>{for(var n,r=o>1?void 0:o?Dy(e,i):e,a=t.length-1;a>=0;a--)(n=t[a])&&(r=(o?n(e,i,r):n(r))||r);return o&&r&&Ay(e,i,r),r},Gy=(t,e)=>My(Ay(t,"raw",{value:My(e||t.slice())}));t.AddressAutocomplete=class extends nt{constructor(){super(...arguments),this.id="autocomplete",this.postcode="SE5 0HU",this.label="Select an address",this.initialAddress="",this.osPlacesApiKey="",this._totalAddresses=void 0,this._addressesInPostcode=[],this._options=[],this._selectedAddress=null,this._osError=void 0,this.dispatch=(t,e)=>this.dispatchEvent(new CustomEvent(t,{detail:e}))}connectedCallback(){super.connectedCallback(),this._fetchData()}disconnectedCallback(){super.disconnectedCallback()}firstUpdated(){Iy({element:this.renderRoot.querySelector(`#${this.id}-container`),id:this.id,required:!0,source:this._options,defaultValue:this.initialAddress,showAllValues:!0,tNoResults:()=>"No addresses found",onConfirm:t=>{this._selectedAddress=this._addressesInPostcode.filter((e=>e.LPI.ADDRESS.split(`, ${e.LPI.ADMINISTRATIVE_AREA}`)[0]===t))[0],this._selectedAddress&&this.dispatch("addressSelection",{address:this._selectedAddress})}})}async _fetchData(t=0,e=[]){const i={postcode:this.postcode,dataset:"LPI",maxResults:"100",output_srs:"EPSG:4326",lr:"EN",key:this.osPlacesApiKey},o=`https://api.os.uk/search/places/v1/postcode?${new URLSearchParams(i).toString()}`;await fetch(o+`&offset=${t}`).then((t=>t.json())).then((t=>{var i;t.error&&(this._osError=t.error.message),this._totalAddresses=null==(i=t.header)?void 0:i.totalresults;const o=e.concat(t.results||[]);if(this._addressesInPostcode=o,this.dispatch("ready",{postcode:this.postcode,addresses:`fetched ${this._addressesInPostcode.length}/${this._totalAddresses}`}),t.results){t.results.filter((t=>"APPROVED"===t.LPI.LPI_LOGICAL_STATUS_CODE_DESCRIPTION)).map((t=>{this._options.push(t.LPI.ADDRESS.split(`, ${t.LPI.ADMINISTRATIVE_AREA}`)[0])}));const e=new Intl.Collator([],{numeric:!0});this._options.sort(((t,i)=>e.compare(t,i)))}this._totalAddresses&&this._totalAddresses>this._addressesInPostcode.length&&this._fetchData(this._addressesInPostcode.length,this._addressesInPostcode)})).catch((t=>console.log(t)))}render(){let t;return t=this.osPlacesApiKey?this._osError?this._osError:0===this._totalAddresses?`No addresses found in postcode ${this.postcode}`:"Something went wrong":"Missing OS Places API key",!this.osPlacesApiKey||this._osError||0===this._totalAddresses?D(jy||(jy=Gy(['<script src="https://cdn.polyfill.io/v2/polyfill.min.js"><\/script>\n <div class="govuk-warning-text" role="status">\n <span class="govuk-warning-text__icon" aria-hidden="true">!</span>\n <strong class="govuk-warning-text__text">\n <span class="govuk-warning-text__assistive">Warning</span>\n ',"\n </strong>\n </div>"])),t):D(Ry||(Ry=Gy(['<script src="https://cdn.polyfill.io/v2/polyfill.min.js"><\/script>\n <link\n rel="stylesheet"\n href="https://cdn.jsdelivr.net/npm/accessible-autocomplete@2.0.4/dist/accessible-autocomplete.min.css"\n />\n <label class="govuk-label" htmlFor=',"> ",' </label>\n <div id="','-container" role="status"></div>'])),this.id,this.label,this.id)}},t.AddressAutocomplete.styles=a(Fy),Ly([st({type:String})],t.AddressAutocomplete.prototype,"id",2),Ly([st({type:String})],t.AddressAutocomplete.prototype,"postcode",2),Ly([st({type:String})],t.AddressAutocomplete.prototype,"label",2),Ly([st({type:String})],t.AddressAutocomplete.prototype,"initialAddress",2),Ly([st({type:String})],t.AddressAutocomplete.prototype,"osPlacesApiKey",2),Ly([lt()],t.AddressAutocomplete.prototype,"_totalAddresses",2),Ly([lt()],t.AddressAutocomplete.prototype,"_addressesInPostcode",2),Ly([lt()],t.AddressAutocomplete.prototype,"_options",2),Ly([lt()],t.AddressAutocomplete.prototype,"_selectedAddress",2),Ly([lt()],t.AddressAutocomplete.prototype,"_osError",2),t.AddressAutocomplete=Ly([rt("address-autocomplete")],t.AddressAutocomplete);var Ny,By=function(){return(By=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},qy=/^([a-z]{1,2}\d)([a-z])$/i,Wy=/[a-z]{2}$/i,Vy=/\d[a-z]{2}$/i,Uy=/^[a-z]{1,2}\d[a-z\d]?\s*\d[a-z]{2}$/i,Xy=/^[a-z]{1,2}/i,Ky={valid:!1,postcode:null,incode:null,outcode:null,area:null,district:null,subDistrict:null,sector:null,unit:null},Yy=function(t){return null===t?null:t[0]},Zy=/\s+/gi,Hy=function(t){return t.replace(Zy,"").toUpperCase()},$y=function(t,e){return Hy(t).match(e)},Jy=function(t){return null!==t.match(Uy)},Qy=function(t){var e=t_(t);if(null===e)return null;var i=e_(t);return null===i?null:e+" "+i},t_=function(t){return Jy(t)?Hy(t).replace(Vy,""):null},e_=function(t){if(!Jy(t))return null;var e=$y(t,Vy);return Yy(e)},i_=function(t){if(!Jy(t))return null;var e=$y(t,Xy);return Yy(e)},o_=function(t){var e=t_(t);if(null===e)return null;var i=e_(t);return null===i?null:e+" "+i[0]},n_=function(t){if(!Jy(t))return null;var e=$y(t,Wy);return Yy(e)},r_=function(t){var e=t_(t);if(null===e)return null;var i=e.match(qy);return null===i?e:i[1]},a_=function(t){var e=t_(t);return null===e||null===e.match(qy)?null:e},s_=s`@charset "UTF-8";
6526
6526
  .govuk-link {
6527
6527
  font-family: "GDS Transport", arial, sans-serif;
6528
6528
  -webkit-font-smoothing: antialiased;
package/dist/index.html CHANGED
@@ -25,10 +25,13 @@
25
25
  <div style="margin-bottom:1em;">
26
26
  <!--
27
27
  Examples (as of March 2022):
28
- SE5 OHU (Southwark): default/"normal" postcode example, fetches 65 LPI addresses
28
+ SE5 OHU (Southwark): default/"standard" postcode example, fetches 65 LPI addresses
29
29
  SE19 1NT (Lambeth): 56 DPA addresses -> 128 LPI addresses (87 "approved"), now requires paginated fetch
30
30
  HP11 1BR (Bucks): 0 addresses, shows "No addresses found in postcode" error message
31
31
  HP11 1BC (Bucks): valid postcode according to npm package but not OS, shows OS error message
32
+
33
+ Example with default value (used for planx "change" & "back" button behavior):
34
+ <address-autocomplete postcode="SE5 0HU" id="example-autocomplete" initialAddress="75, COBOURG ROAD, LONDON" />
32
35
  -->
33
36
  <address-autocomplete postcode="SE5 0HU" id="example-autocomplete" />
34
37
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensystemslab/map",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "license": "OGL-UK-3.0",
5
5
  "private": false,
6
6
  "repository": {
@@ -4,6 +4,7 @@ export declare class AddressAutocomplete extends LitElement {
4
4
  id: string;
5
5
  postcode: string;
6
6
  label: string;
7
+ initialAddress: string;
7
8
  osPlacesApiKey: string;
8
9
  private _totalAddresses;
9
10
  private _addressesInPostcode;