@opensystemslab/map 0.4.9 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/component-lib.es.js
CHANGED
@@ -6544,7 +6544,7 @@ x:-moz-any-link {
|
|
6544
6544
|
}
|
6545
6545
|
:host .autocomplete__menu {
|
6546
6546
|
max-height: var(--autocomplete__menu__max-height, 342px);
|
6547
|
-
}`,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,displayMenu:"overlay",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)}`;await fetch(o+`&offset=${t}`).then((t=>t.json())).then((t=>{var i,o,n;(t.error||t.fault)&&(this._osError=(null==(i=t.error)?void 0:i.message)||(null==(o=t.fault)?void 0:o.faultstring)||"Something went wrong"),this._totalAddresses=null==(n=t.header)?void 0:n.totalresults;const r=e.concat(t.results||[]);if(this._addressesInPostcode=r,this.dispatch("ready",{postcode:this.postcode,status:`fetched ${this._addressesInPostcode.length}/${this._totalAddresses} addresses`}),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 this.osPlacesApiKey?this._osError?t=this._osError:0===this._totalAddresses&&(t=`No addresses found in postcode ${this.postcode}`):t="Missing OS Places API key",t?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\n id="','-container"\n role="status"\n
|
6547
|
+
}`,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,displayMenu:"overlay",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)}`;await fetch(o+`&offset=${t}`).then((t=>t.json())).then((t=>{var i,o,n;(t.error||t.fault)&&(this._osError=(null==(i=t.error)?void 0:i.message)||(null==(o=t.fault)?void 0:o.faultstring)||"Something went wrong"),this._totalAddresses=null==(n=t.header)?void 0:n.totalresults;const r=e.concat(t.results||[]);if(this._addressesInPostcode=r,this.dispatch("ready",{postcode:this.postcode,status:`fetched ${this._addressesInPostcode.length}/${this._totalAddresses} addresses`}),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 this.osPlacesApiKey?this._osError?t=this._osError:0===this._totalAddresses&&(t=`No addresses found in postcode ${this.postcode}`):t="Missing OS Places API key",t?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\n id="','-container"\n role="status"\n spellcheck="false"\n ></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";
|
6548
6548
|
.govuk-link {
|
6549
6549
|
font-family: "GDS Transport", arial, sans-serif;
|
6550
6550
|
-webkit-font-smoothing: antialiased;
|
@@ -6544,7 +6544,7 @@ x:-moz-any-link {
|
|
6544
6544
|
}
|
6545
6545
|
:host .autocomplete__menu {
|
6546
6546
|
max-height: var(--autocomplete__menu__max-height, 342px);
|
6547
|
-
}`,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,displayMenu:"overlay",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)}`;await fetch(o+`&offset=${t}`).then((t=>t.json())).then((t=>{var i,o,n;(t.error||t.fault)&&(this._osError=(null==(i=t.error)?void 0:i.message)||(null==(o=t.fault)?void 0:o.faultstring)||"Something went wrong"),this._totalAddresses=null==(n=t.header)?void 0:n.totalresults;const r=e.concat(t.results||[]);if(this._addressesInPostcode=r,this.dispatch("ready",{postcode:this.postcode,status:`fetched ${this._addressesInPostcode.length}/${this._totalAddresses} addresses`}),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 this.osPlacesApiKey?this._osError?t=this._osError:0===this._totalAddresses&&(t=`No addresses found in postcode ${this.postcode}`):t="Missing OS Places API key",t?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\n id="','-container"\n role="status"\n
|
6547
|
+
}`,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,displayMenu:"overlay",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)}`;await fetch(o+`&offset=${t}`).then((t=>t.json())).then((t=>{var i,o,n;(t.error||t.fault)&&(this._osError=(null==(i=t.error)?void 0:i.message)||(null==(o=t.fault)?void 0:o.faultstring)||"Something went wrong"),this._totalAddresses=null==(n=t.header)?void 0:n.totalresults;const r=e.concat(t.results||[]);if(this._addressesInPostcode=r,this.dispatch("ready",{postcode:this.postcode,status:`fetched ${this._addressesInPostcode.length}/${this._totalAddresses} addresses`}),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 this.osPlacesApiKey?this._osError?t=this._osError:0===this._totalAddresses&&(t=`No addresses found in postcode ${this.postcode}`):t="Missing OS Places API key",t?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\n id="','-container"\n role="status"\n spellcheck="false"\n ></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,$y=function(t){return t.replace(Zy,"").toUpperCase()},Hy=function(t,e){return $y(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)?$y(t).replace(Vy,""):null},e_=function(t){if(!Jy(t))return null;var e=Hy(t,Vy);return Yy(e)},i_=function(t){if(!Jy(t))return null;var e=Hy(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=Hy(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";
|
6548
6548
|
.govuk-link {
|
6549
6549
|
font-family: "GDS Transport", arial, sans-serif;
|
6550
6550
|
-webkit-font-smoothing: antialiased;
|