@ukho/admiralty-core 4.0.0-next.8 → 4.0.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.
@@ -1,2 +1,2 @@
1
- import{p as e,b as a}from"./p-71979ff5.js";export{s as setNonce}from"./p-71979ff5.js";import{g as i}from"./p-e1255160.js";var l=()=>{const a=import.meta.url;const i={};if(a!==""){i.resourcesUrl=new URL(".",a).href}return e(i)};l().then((async e=>{await i();return a([["p-6dde3d41",[[2,"admiralty-autocomplete",{autoselect:[4],cssNamespace:[1,"css-namespace"],displayMenu:[1,"display-menu"],minLength:[2,"min-length"],name:[1],placeholder:[1],confirmOnBlur:[4,"confirm-on-blur"],showNoOptionsFound:[4,"show-no-options-found"],showAllValues:[4,"show-all-values"],required:[4],assistiveHint:[1,"assistive-hint"],menuAttributes:[8,"menu-attributes"],inputClasses:[1,"input-classes"],menuClasses:[1,"menu-classes"],label:[1],hint:[1],invalid:[4],invalidMessage:[1,"invalid-message"],disabled:[4],value:[1025],focused:[32],hovered:[32],menuOpen:[32],options:[32],option:[32],query:[32],validChoiceMade:[32],selected:[32],ariaHint:[32]},null,{value:["onValueChange"],focused:["onFocusedChange"]}]]],["p-1e01bb1c",[[2,"admiralty-input",{name:[1],label:[1],hint:[1],disabled:[4],type:[1],placeholder:[1],width:[2],required:[4],invalid:[4],invalidMessage:[1,"invalid-message"],autocomplete:[1],value:[1032]},null,{value:["valueChanged"]}]]],["p-2dc3c122",[[6,"admiralty-select",{disabled:[4],invalid:[4],invalidMessage:[1,"invalid-message"],hint:[1],label:[1],width:[2],value:[1032]},null,{value:["valueChanged"]}]]],["p-f8e59c54",[[2,"admiralty-textarea",{label:[1],hint:[1],width:[2],disabled:[4],invalid:[4],invalidMessage:[1,"invalid-message"],value:[1032]},null,{value:["valueChanged"]}]]],["p-4b6b0163",[[6,"admiralty-radio-group",{name:[1],label:[1],hint:[1],disabled:[4],value:[1032],displayVertical:[4,"display-vertical"],invalid:[4],invalidMessage:[1,"invalid-message"]},null,{value:["valueChanged"],invalid:["invalidChanged"]}]]],["p-1ee163a0",[[6,"admiralty-colour-block",{width:[2],height:[2],heading:[1],colour:[1],href:[1],linkText:[1,"link-text"],suppressRedirect:[4,"suppress-redirect"],enableCardEvent:[4,"enable-card-event"],actionText:[1,"action-text"]}]]],["p-ee0d714b",[[6,"admiralty-error-summary",{heading:[1]}]]],["p-0d01b051",[[2,"admiralty-file-input",{label:[1],multiple:[4],invalid:[4],invalidMessage:[1,"invalid-message"],files:[32]}]]],["p-2d0123c2",[[6,"admiralty-filter",{filterTitle:[1,"filter-title"]}]]],["p-ae15e60d",[[6,"admiralty-filter-group",{groupTitle:[1,"group-title"]}]]],["p-d3ccf10f",[[2,"admiralty-paginator",{pages:[2],currentPage:[2,"current-page"],label:[1]}]]],["p-7580d6f4",[[6,"admiralty-breadcrumb",{active:[4],first:[4],href:[1]}]]],["p-f9a0ba9e",[[6,"admiralty-header",{headerTitle:[1,"header-title"],headerTitleUrl:[1,"header-title-url"],logoLinkUrl:[1,"logo-link-url"],logoImgUrl:[1,"logo-img-url"],logoAltText:[1,"logo-alt-text"],mobileMenuOpen:[32],displayHamburger:[32]}]]],["p-5cf15d73",[[2,"admiralty-pill",{text:[1],number:[1],label:[1],colour:[1],selected:[4]}]]],["p-a0466b05",[[2,"admiralty-progress-bar",{label:[1],progression:[2],error:[4],progressionValue:[32]},null,{progression:["progressionChanged"]}]]],["p-f9b7b9c4",[[6,"admiralty-read-more",{heading:[1],expanded:[32]}]]],["p-86def5ca",[[2,"admiralty-autocomplete-option",{value:[8]}]]],["p-f2bd7504",[[6,"admiralty-breadcrumbs"]]],["p-7491b43a",[[6,"admiralty-card",{heading:[1]}]]],["p-cc089471",[[2,"admiralty-checkbox",{checkboxRight:[4,"checkbox-right"],disabled:[4],name:[1],checked:[1540],value:[8],labelText:[1,"label-text"],labelHidden:[4,"label-hidden"]},null,{checked:["checkedChanged"]}]]],["p-304203b2",[[6,"admiralty-footer",{variant:[1],imageLink:[1,"image-link"],imageSrc:[1,"image-src"],imageAlt:[1,"image-alt"],text:[1],hasSlotContent:[32]},[[2,"slotchange","handleSlotChange"]]]]],["p-cd9ecb06",[[6,"admiralty-header-menu-item",{menuTitle:[1,"menu-title"],active:[4]}]]],["p-e9677a9c",[[6,"admiralty-header-menu-link",{menuTitle:[1,"menu-title"],active:[4],href:[1],suppressRedirect:[4,"suppress-redirect"]}]]],["p-6ab48ce9",[[2,"admiralty-header-profile",{isSignedIn:[4,"is-signed-in"],signedInText:[1,"signed-in-text"],signInOnly:[4,"sign-in-only"]}]]],["p-fd1fcc7b",[[6,"admiralty-header-sub-menu-item",{menuTitle:[1,"menu-title"],href:[1],suppressRedirect:[4,"suppress-redirect"]}]]],["p-63f82d75",[[2,"admiralty-hr"]]],["p-a9229ed5",[[6,"admiralty-link",{href:[1],newTab:[4,"new-tab"]}]]],["p-e056352f",[[6,"admiralty-modal-dialog",{heading:[1],label:[1],description:[1],show:[4]}]]],["p-d37fc718",[[4,"admiralty-paginator-wrapper",null,[[0,"pageChange","pageChangedHandler"]]]]],["p-972fd212",[[2,"admiralty-phase-banner",{phase:[1],link:[1]}]]],["p-9812a01a",[[6,"admiralty-radio",{name:[1],value:[1025],disabled:[4],checked:[1028],invalid:[4],buttonTabindex:[32],setButtonTabindex:[64]},null,{value:["valueChanged"]}]]],["p-2638a62a",[[6,"admiralty-side-nav",{label:[1]}]]],["p-fdfe8eea",[[2,"admiralty-side-nav-item",{sideNavItemId:[1,"side-nav-item-id"],headingTitle:[1,"heading-title"],navActive:[4,"nav-active"]}]]],["p-0d787491",[[4,"admiralty-side-nav-wrapper",null,[[0,"sideNavItemSelected","onSideNavItemSelected"]]]]],["p-38f0f379",[[2,"admiralty-skip-link",{href:[1]}]]],["p-bba95259",[[6,"admiralty-tab",{label:[1],tabLabelId:[1,"tab-label-id"],tabContentId:[1,"tab-content-id"]}]]],["p-f2f2c51d",[[6,"admiralty-tab-group",{selectedIndex:[1026,"selected-index"]}]]],["p-2c76b091",[[6,"admiralty-table",{caption:[1]}]]],["p-32d4bc23",[[6,"admiralty-table-body"]]],["p-1432feef",[[6,"admiralty-table-cell"]]],["p-7fe7c173",[[6,"admiralty-table-header"]]],["p-99a105e6",[[6,"admiralty-table-header-cell"]]],["p-9269a7c0",[[6,"admiralty-table-row"]]],["p-9f8541ad",[[1,"admiralty-icon",{iconName:[1,"icon-name"],iconPrefix:[1,"icon-prefix"]}]]],["p-6d123507",[[6,"admiralty-dialogue",{type:[1],heading:[1],sectionRole:[1,"section-role"]}]]],["p-1e574971",[[6,"admiralty-expansion",{heading:[1],expanded:[1540],alignHeadingRight:[4,"align-heading-right"],hideBorder:[4,"hide-border"]}]]],["p-a228de74",[[6,"admiralty-button",{variant:[1],icon:[1],disabled:[516],type:[1],form:[1],name:[1],value:[1]}]]],["p-438c6046",[[6,"admiralty-hint",{disabled:[4]}],[6,"admiralty-label",{disabled:[4],for:[1]}],[6,"admiralty-input-invalid"]]]],e)}));
1
+ import{p as e,b as a}from"./p-71979ff5.js";export{s as setNonce}from"./p-71979ff5.js";import{g as i}from"./p-e1255160.js";var l=()=>{const a=import.meta.url;const i={};if(a!==""){i.resourcesUrl=new URL(".",a).href}return e(i)};l().then((async e=>{await i();return a([["p-1940d66d",[[2,"admiralty-autocomplete",{autoselect:[4],cssNamespace:[1,"css-namespace"],displayMenu:[1,"display-menu"],minLength:[2,"min-length"],name:[1],placeholder:[1],confirmOnBlur:[4,"confirm-on-blur"],showNoOptionsFound:[4,"show-no-options-found"],showAllValues:[4,"show-all-values"],required:[4],assistiveHint:[1,"assistive-hint"],menuAttributes:[8,"menu-attributes"],inputClasses:[1,"input-classes"],menuClasses:[1,"menu-classes"],label:[1],hint:[1],invalid:[4],invalidMessage:[1,"invalid-message"],disabled:[4],value:[1025],focused:[32],hovered:[32],menuOpen:[32],options:[32],option:[32],query:[32],validChoiceMade:[32],selected:[32],ariaHint:[32]},null,{value:["onValueChange"],focused:["onFocusedChange"]}]]],["p-1e01bb1c",[[2,"admiralty-input",{name:[1],label:[1],hint:[1],disabled:[4],type:[1],placeholder:[1],width:[2],required:[4],invalid:[4],invalidMessage:[1,"invalid-message"],autocomplete:[1],value:[1032]},null,{value:["valueChanged"]}]]],["p-2dc3c122",[[6,"admiralty-select",{disabled:[4],invalid:[4],invalidMessage:[1,"invalid-message"],hint:[1],label:[1],width:[2],value:[1032]},null,{value:["valueChanged"]}]]],["p-f8e59c54",[[2,"admiralty-textarea",{label:[1],hint:[1],width:[2],disabled:[4],invalid:[4],invalidMessage:[1,"invalid-message"],value:[1032]},null,{value:["valueChanged"]}]]],["p-4b6b0163",[[6,"admiralty-radio-group",{name:[1],label:[1],hint:[1],disabled:[4],value:[1032],displayVertical:[4,"display-vertical"],invalid:[4],invalidMessage:[1,"invalid-message"]},null,{value:["valueChanged"],invalid:["invalidChanged"]}]]],["p-1ee163a0",[[6,"admiralty-colour-block",{width:[2],height:[2],heading:[1],colour:[1],href:[1],linkText:[1,"link-text"],suppressRedirect:[4,"suppress-redirect"],enableCardEvent:[4,"enable-card-event"],actionText:[1,"action-text"]}]]],["p-ee0d714b",[[6,"admiralty-error-summary",{heading:[1]}]]],["p-0d01b051",[[2,"admiralty-file-input",{label:[1],multiple:[4],invalid:[4],invalidMessage:[1,"invalid-message"],files:[32]}]]],["p-2d0123c2",[[6,"admiralty-filter",{filterTitle:[1,"filter-title"]}]]],["p-ae15e60d",[[6,"admiralty-filter-group",{groupTitle:[1,"group-title"]}]]],["p-d3ccf10f",[[2,"admiralty-paginator",{pages:[2],currentPage:[2,"current-page"],label:[1]}]]],["p-7580d6f4",[[6,"admiralty-breadcrumb",{active:[4],first:[4],href:[1]}]]],["p-f9a0ba9e",[[6,"admiralty-header",{headerTitle:[1,"header-title"],headerTitleUrl:[1,"header-title-url"],logoLinkUrl:[1,"logo-link-url"],logoImgUrl:[1,"logo-img-url"],logoAltText:[1,"logo-alt-text"],mobileMenuOpen:[32],displayHamburger:[32]}]]],["p-5cf15d73",[[2,"admiralty-pill",{text:[1],number:[1],label:[1],colour:[1],selected:[4]}]]],["p-a0466b05",[[2,"admiralty-progress-bar",{label:[1],progression:[2],error:[4],progressionValue:[32]},null,{progression:["progressionChanged"]}]]],["p-f9b7b9c4",[[6,"admiralty-read-more",{heading:[1],expanded:[32]}]]],["p-86def5ca",[[2,"admiralty-autocomplete-option",{value:[8]}]]],["p-f2bd7504",[[6,"admiralty-breadcrumbs"]]],["p-37d5653a",[[6,"admiralty-card",{heading:[1]}]]],["p-cc089471",[[2,"admiralty-checkbox",{checkboxRight:[4,"checkbox-right"],disabled:[4],name:[1],checked:[1540],value:[8],labelText:[1,"label-text"],labelHidden:[4,"label-hidden"]},null,{checked:["checkedChanged"]}]]],["p-304203b2",[[6,"admiralty-footer",{variant:[1],imageLink:[1,"image-link"],imageSrc:[1,"image-src"],imageAlt:[1,"image-alt"],text:[1],hasSlotContent:[32]},[[2,"slotchange","handleSlotChange"]]]]],["p-cd9ecb06",[[6,"admiralty-header-menu-item",{menuTitle:[1,"menu-title"],active:[4]}]]],["p-e9677a9c",[[6,"admiralty-header-menu-link",{menuTitle:[1,"menu-title"],active:[4],href:[1],suppressRedirect:[4,"suppress-redirect"]}]]],["p-6ab48ce9",[[2,"admiralty-header-profile",{isSignedIn:[4,"is-signed-in"],signedInText:[1,"signed-in-text"],signInOnly:[4,"sign-in-only"]}]]],["p-fd1fcc7b",[[6,"admiralty-header-sub-menu-item",{menuTitle:[1,"menu-title"],href:[1],suppressRedirect:[4,"suppress-redirect"]}]]],["p-63f82d75",[[2,"admiralty-hr"]]],["p-a9229ed5",[[6,"admiralty-link",{href:[1],newTab:[4,"new-tab"]}]]],["p-e056352f",[[6,"admiralty-modal-dialog",{heading:[1],label:[1],description:[1],show:[4]}]]],["p-d37fc718",[[4,"admiralty-paginator-wrapper",null,[[0,"pageChange","pageChangedHandler"]]]]],["p-972fd212",[[2,"admiralty-phase-banner",{phase:[1],link:[1]}]]],["p-9812a01a",[[6,"admiralty-radio",{name:[1],value:[1025],disabled:[4],checked:[1028],invalid:[4],buttonTabindex:[32],setButtonTabindex:[64]},null,{value:["valueChanged"]}]]],["p-2638a62a",[[6,"admiralty-side-nav",{label:[1]}]]],["p-fdfe8eea",[[2,"admiralty-side-nav-item",{sideNavItemId:[1,"side-nav-item-id"],headingTitle:[1,"heading-title"],navActive:[4,"nav-active"]}]]],["p-0d787491",[[4,"admiralty-side-nav-wrapper",null,[[0,"sideNavItemSelected","onSideNavItemSelected"]]]]],["p-38f0f379",[[2,"admiralty-skip-link",{href:[1]}]]],["p-bba95259",[[6,"admiralty-tab",{label:[1],tabLabelId:[1,"tab-label-id"],tabContentId:[1,"tab-content-id"]}]]],["p-f2f2c51d",[[6,"admiralty-tab-group",{selectedIndex:[1026,"selected-index"]}]]],["p-2c76b091",[[6,"admiralty-table",{caption:[1]}]]],["p-32d4bc23",[[6,"admiralty-table-body"]]],["p-1432feef",[[6,"admiralty-table-cell"]]],["p-7fe7c173",[[6,"admiralty-table-header"]]],["p-99a105e6",[[6,"admiralty-table-header-cell"]]],["p-9269a7c0",[[6,"admiralty-table-row"]]],["p-9f8541ad",[[1,"admiralty-icon",{iconName:[1,"icon-name"],iconPrefix:[1,"icon-prefix"]}]]],["p-6d123507",[[6,"admiralty-dialogue",{type:[1],heading:[1],sectionRole:[1,"section-role"]}]]],["p-1e574971",[[6,"admiralty-expansion",{heading:[1],expanded:[1540],alignHeadingRight:[4,"align-heading-right"],hideBorder:[4,"hide-border"]}]]],["p-a228de74",[[6,"admiralty-button",{variant:[1],icon:[1],disabled:[516],type:[1],form:[1],name:[1],value:[1]}]]],["p-438c6046",[[6,"admiralty-hint",{disabled:[4]}],[6,"admiralty-label",{disabled:[4],for:[1]}],[6,"admiralty-input-invalid"]]]],e)}));
2
2
  //# sourceMappingURL=admiralty.esm.js.map
@@ -0,0 +1,2 @@
1
+ import{r as t,c as i,f as o,h as e,g as a}from"./p-71979ff5.js";const s=(t,i,o)=>{if(typeof MutationObserver==="undefined"){return}const e=new MutationObserver((t=>{o(l(t,i))}));e.observe(t,{childList:true,subtree:true});return e};const l=(t,i)=>{let o;t.forEach((t=>{for(let e=0;e<t.addedNodes.length;e++){o=n(t.addedNodes[e],i)||o}}));return o};const n=(t,i)=>{if(t.nodeType!==1){return undefined}const o=t;const e=o.tagName===i.toUpperCase()?[o]:Array.from(o.querySelectorAll(i));return e.find((t=>t.value===o.value))};const r=".visually-hidden.sc-admiralty-autocomplete:not(:focus):not(:active){position:absolute !important;width:1px !important;height:1px !important;margin:0 !important;padding:0 !important;overflow:hidden !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;border:0 !important;white-space:nowrap !important}@media (max-width: 1023px){.desktop-only.sc-admiralty-autocomplete{display:none}}@media (min-width: 1024px){.not-desktop.sc-admiralty-autocomplete{display:none}}@media (min-width: 1024px){.tablet-only.sc-admiralty-autocomplete{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-only.sc-admiralty-autocomplete{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-or-desktop.sc-admiralty-autocomplete{display:none}}@media (min-width: 1024px){.phone-or-tablet.sc-admiralty-autocomplete{display:none}}@media (min-width: 1024px){.phone-only.sc-admiralty-autocomplete{display:none}}@media (max-width: 1023px) and (min-width: 480px){.phone-only.sc-admiralty-autocomplete{display:none}}.autocomplete__wrapper.sc-admiralty-autocomplete{position:relative}.autocomplete__hint.sc-admiralty-autocomplete,.autocomplete__input.sc-admiralty-autocomplete{appearance:none;border:2px solid var(--admiralty-text-colour);border-radius:0;box-sizing:border-box;color:var(--admiralty-text-colour);margin-bottom:0;line-height:1.5;width:100%}.autocomplete__label.sc-admiralty-autocomplete{background-color:transparent;position:relative;font-size:var(--admiralty-autocomplete-label-font-size, var(--admiralty-font-size-0))}.autocomplete__input.sc-admiralty-autocomplete{background-color:transparent;position:relative}.autocomplete__hint.sc-admiralty-autocomplete{color:var(--admiralty-text-colour);position:absolute}.autocomplete__input-wrapper.sc-admiralty-autocomplete{position:relative}.autocomplete__input--default.sc-admiralty-autocomplete{padding:12px}.autocomplete__input--focused.sc-admiralty-autocomplete{outline:3px solid var(--admiralty-focus-colour);outline-offset:0;box-shadow:inset 0 0 0 2px var(--admiralty-text-colour)}.autocomplete__input--show-all-values.sc-admiralty-autocomplete{padding:12px 35px 12px 12px;cursor:pointer}.autocomplete__input--invalid.sc-admiralty-autocomplete{border-color:var(--admiralty-colour-danger)}.autocomplete__input--disabled.sc-admiralty-autocomplete{border-color:var(--admiralty-disabled-colour)}.autocomplete__menu.sc-admiralty-autocomplete{background-color:var(--admiralty-background-colour);border:2px solid var(--admiralty-text-colour);border-top:0;color:var(--admiralty-text-colour);margin:0;max-height:342px;overflow-x:hidden;padding:0;width:100%;width:calc(100% - 4px)}.autocomplete__menu--visible.sc-admiralty-autocomplete{display:block}.autocomplete__menu--hidden.sc-admiralty-autocomplete{display:none}.autocomplete__menu--overlay.sc-admiralty-autocomplete{box-shadow:rgba(0, 0, 0, 0.256863) 0px 2px 6px;left:0;position:absolute;top:100%;z-index:100}.autocomplete__menu--inline.sc-admiralty-autocomplete{position:relative}.autocomplete__option.sc-admiralty-autocomplete{border-bottom:solid var(--admiralty-colour-light-shade);border-width:1px 0;color:var(--admiralty-text-colour);cursor:pointer;display:block;position:relative;margin-bottom:0}.autocomplete__option.sc-admiralty-autocomplete:before{content:none}.autocomplete__option.sc-admiralty-autocomplete>*.sc-admiralty-autocomplete{pointer-events:none}.autocomplete__option.sc-admiralty-autocomplete:first-of-type{border-top-width:0}.autocomplete__option.sc-admiralty-autocomplete:last-of-type{border-bottom-width:0}.autocomplete__option--focused.sc-admiralty-autocomplete,.autocomplete__option.sc-admiralty-autocomplete:hover{background-color:var(--admiralty-colour-info);border-color:var(--admiralty-colour-info);color:var(--admiralty-colour-info-contrast);outline:none}.autocomplete__option--no-results.sc-admiralty-autocomplete{background-color:var(--admiralty-background-colour);color:var(--admiralty-text-colour);text-align:center;margin-top:50px;margin-bottom:50px;cursor:not-allowed}.autocomplete__option--no-results.sc-admiralty-autocomplete:hover{background-color:var(--admiralty-background-colour);border-color:var(--admiralty-background-colour);color:var(--admiralty-text-colour);text-align:center;margin-top:50px;margin-bottom:50px;cursor:not-allowed}.autocomplete__hint.sc-admiralty-autocomplete,.autocomplete__input.sc-admiralty-autocomplete,.autocomplete__option.sc-admiralty-autocomplete{font-size:var(--admiralty-autocomplete-option-font-size, var(--admiralty-font-size-0));font-weight:var(--admiralty-autocomplete-option-font-weight, var(--admiralty-font-weight-normal))}.autocomplete__hint.sc-admiralty-autocomplete,.autocomplete__option.sc-admiralty-autocomplete{padding:10px}.autocomplete-down-icon.sc-admiralty-autocomplete{font-size:var(--admiralty-autocomplete-icon-font-size, var(--admiralty-font-size-2));font-weight:var(--admiralty-autocomplete-icon-font-weight, var(--admiralty-font-weight-normal));pointer-events:none;position:absolute;right:12px;top:14px}admiralty-icon.disabled.sc-admiralty-autocomplete{color:var(--admiralty-disabled-colour)}admiralty-input-invalid.sc-admiralty-autocomplete{margin-top:6px}";const c=r;const h={13:"enter",27:"escape",32:"space",38:"up",40:"down"};function d(){return typeof navigator!=="undefined"&&!!(navigator.userAgent.match(/(iPod|iPhone|iPad)/g)&&navigator.userAgent.match(/AppleWebKit/g))}function u(t){return t>47&&t<58||t===32||t===8||t>64&&t<91||t>95&&t<112||t>185&&t<193||t>218&&t<223}function p(t,i){return t.filter((({text:t})=>t.toLowerCase().indexOf(i.toLowerCase())!==-1))}function m(t,i){return t.filter((({value:t})=>t.toString().toLowerCase().indexOf(i.toLowerCase())!==-1))}const y=class{constructor(o){t(this,o);this.admiraltyChange=i(this,"admiraltyChange",7);this.internalId=++f;this.elementReferences={};this.source=[];this.autoselect=false;this.cssNamespace="autocomplete";this.displayMenu="inline";this.minLength=0;this.name=undefined;this.placeholder="";this.confirmOnBlur=true;this.showNoOptionsFound=true;this.showAllValues=true;this.required=false;this.assistiveHint="When autocomplete results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures.";this.menuAttributes=undefined;this.inputClasses=undefined;this.menuClasses=undefined;this.label=null;this.hint=null;this.invalid=false;this.invalidMessage=null;this.disabled=false;this.value=null;this.focused=null;this.hovered=null;this.menuOpen=false;this.options=[];this.option=null;this.query=null;this.validChoiceMade=false;this.selected=null;this.ariaHint=true}onValueChange(t,i){var o,e;if(this.source.length===0){return}if(t&&t.length>0){const i=m(this.source,t);const o=i.length>0;this.options=i;this.validChoiceMade=o;this.option=i[0];this.query=o?i[0].text:"";this.menuOpen=false;this.ariaHint=false}else{this.options=[];this.option=null;this.query="";this.ariaHint=true}this.admiraltyChange.emit({value:(e=(o=this.option)===null||o===void 0?void 0:o.value)!==null&&e!==void 0?e:""})}onFocusedChange(t,i){var o;const e=this.focused===null;const a=i!==t;const s=a&&!e;if(s){(o=this.elementReferences[this.focused])===null||o===void 0?void 0:o.focus()}const l=this.focused===-1;const n=a&&i===null;const r=l&&n;if(r){const t=this.elementReferences[this.focused];t.setSelectionRange(0,t.value.length)}}isQueryAnOption(t,i){return i.map((({text:t})=>this.templateInputValue(t).toLowerCase())).indexOf(t.toLowerCase())!==-1}connectedCallback(){this.mutation=s(this.el,"admiralty-autocomplete-option",(async()=>{var t,i,e;this.source=this.childOpts.map((({textContent:t,value:i})=>({text:(t===null||t===void 0?void 0:t.length)>0?t:i,value:i!==null&&i!==void 0?i:t})));if(this.query===null&&((t=this.value)===null||t===void 0?void 0:t.length)>0){const t=m(this.source,this.value);this.options=t;this.option=t[0];this.query=(e=(i=t[0])===null||i===void 0?void 0:i.text)!==null&&e!==void 0?e:""}o(this)}))}disconnectedCallback(){clearTimeout(this.$pollInput)}pollInputElement(){this.getDirectInputChanges();this.$pollInput=setTimeout((()=>{this.pollInputElement()}),100)}getDirectInputChanges(){const t=this.elementReferences[-1];const i=t&&t.value!==this.query;if(i){this.handleInputChange({target:{value:t.value}})}}get childOpts(){return Array.from(this.el.querySelectorAll("admiralty-autocomplete-option"))}hasAutoselect(){return d()?false:this.autoselect}templateInputValue(t){return t}templateSuggestion(t){return t}handleComponentBlur(t){let i;if(this.confirmOnBlur){i=t.query||this.query;const o=p(this.source,i);const e=(i===null||i===void 0?void 0:i.length)>0&&o.length>0;const a=e?o[0]:{value:null,text:""};this.value=a.value}else{i=this.query}this.focused=null;this.menuOpen=t.menuOpen||false;this.selected=null;this.validChoiceMade=this.isQueryAnOption(i,this.options)}handleListMouseLeave(){this.hovered=null}handleOptionBlur(t,i){var o,e;const a=t.relatedTarget===null;const s=t.relatedTarget===this.elementReferences[-1];const l=this.focused!==i&&this.focused!==-1;const n=!l&&a||!(l||s);if(n){const t=this.menuOpen&&d();this.handleComponentBlur({menuOpen:t,query:this.templateInputValue((e=(o=this.options[this.selected])===null||o===void 0?void 0:o.text)!==null&&e!==void 0?e:"")})}}handleInputBlur(t){const i=this.focused!==-1;if(!i){const t=this.menuOpen&&d();this.handleComponentBlur({menuOpen:t,query:this.query})}}handleInputChange(t){const i=this.hasAutoselect();const o=t.target.value;const e=o.length===0;const a=this.query!==o;const s=o.length>=this.minLength;this.query=o;this.ariaHint=e;const l=this.showAllValues||!e&&a&&s;if(l){const t=p(this.source,this.query);const o=t.length>0;this.menuOpen=o;this.options=t;this.selected=i&&o?0:-1;this.validChoiceMade=false}else if(e||!s){this.menuOpen=false;this.options=[]}}handleInputClick(t){this.handleInputChange(t)}handleInputFocus(t){var i;const o=!this.validChoiceMade&&((i=this.query)===null||i===void 0?void 0:i.length)>=this.minLength&&this.options.length>0;if(o){this.focused=-1;this.menuOpen=o||this.menuOpen;this.selected=-1}else{this.focused=-1}}handleOptionFocus(t){this.focused=t;this.hovered=null;this.selected=t}handleOptionMouseEnter(t){if(!d()){this.hovered=t}}handleOptionClick(t,i){const e=this.options[i];this.value=e.value;this.focused=-1;this.hovered=null;this.menuOpen=false;this.selected=i;this.validChoiceMade=true;o(this)}handleOptionMouseDown(t){t.preventDefault()}handleUpArrow(t){t.preventDefault();const i=this.selected!==-1;const o=i&&this.menuOpen;if(o){this.handleOptionFocus(this.selected-1)}}handleDownArrow(t){t.preventDefault();if(this.showAllValues&&this.menuOpen===false){t.preventDefault();const i=p(this.source,"");this.menuOpen=true;this.options=i;this.selected=0;this.focused=0;this.hovered=null}else if(this.menuOpen===true){const t=this.selected!==this.options.length-1;const i=t&&this.menuOpen;if(i){this.handleOptionFocus(this.selected+1)}}}handleSpace(t){if(this.showAllValues&&this.menuOpen===false&&this.query===""){t.preventDefault();const i=p(this.source,"");this.menuOpen=true;this.options=i}const i=this.focused!==-1;if(i){t.preventDefault();this.handleOptionClick(t,this.focused)}}handleEnter(t){if(this.menuOpen){t.preventDefault();const i=this.selected>=0;if(i){this.handleOptionClick(t,this.selected)}}}handlePrintableKey(t){const i=this.elementReferences[-1];const o=t.target===i;if(!o){i.focus()}}handleKeyDown(t){switch(h[t.keyCode]){case"up":this.handleUpArrow(t);break;case"down":this.handleDownArrow(t);break;case"space":this.handleSpace(t);break;case"enter":this.handleEnter(t);break;case"escape":this.handleComponentBlur({query:this.query,menuOpen:this.menuOpen});break;default:if(u(t.keyCode)){this.handlePrintableKey(t)}break}}render(){var t,i,o,a,s,l;const n=this.el.id!=""?this.el.id:`admiralty-autocomplete-${this.internalId}`;const r=`${n}-input`;const c=`${n}-hint`;const h=`${n}-error`;const u=this.focused===-1;const p=this.options.length===0;const m=((t=this.query)===null||t===void 0?void 0:t.length)!==0;const y=((i=this.query)===null||i===void 0?void 0:i.length)>=this.minLength;const f=this.showNoOptionsFound&&u&&p&&m&&y;const v=`${this.cssNamespace}__wrapper`;const b=this.focused!==-1&&this.focused!==null;const _=`${this.cssNamespace}__option`;const x=n+"__assistiveHint";const g={"aria-describedby":`${this.hint?c:""} ${this.ariaHint?x:""} ${this.invalid?h:""}`,"aria-expanded":this.menuOpen?"true":"false","aria-activedescendant":b?`${n}__option--${this.focused}`:null,"aria-owns":`${n}__listbox`,"aria-autocomplete":this.hasAutoselect()?"both":"list"};const w=`${this.cssNamespace}__input`;const k=[w,this.showAllValues?`${w}--show-all-values`:`${w}--default`];const $=this.focused!==null;if($){k.push(`${w}--focused`)}if(this.inputClasses){k.push(this.inputClasses)}if(this.invalid&&this.invalidMessage){k.push(`${w}--invalid`)}if(this.disabled){k.push(`${w}--disabled`)}const C=`${this.cssNamespace}__menu`;const O=`${C}--${this.displayMenu}`;const z=this.menuOpen||f;const I=`${C}--${z?"visible":"hidden"}`;const M=[C,O,I];if(this.menuClasses){M.push(this.menuClasses)}if(((o=this.menuAttributes)===null||o===void 0?void 0:o.class)||((a=this.menuAttributes)===null||a===void 0?void 0:a.className)){M.push(((s=this.menuAttributes)===null||s===void 0?void 0:s.class)||((l=this.menuAttributes)===null||l===void 0?void 0:l.className))}const A=Object.assign(Object.assign({},this.menuAttributes),{id:`${n}__listbox`,role:"listbox",onMouseLeave:this.handleListMouseLeave});delete A.class;return e("div",{key:"4136155c810c71813619ffa286730bcfcca3d772",class:v,onKeyDown:t=>this.handleKeyDown(t)},this.label?e("admiralty-label",{class:"autocomplete__label",disabled:this.disabled,for:r},this.label):null,this.hint?e("admiralty-hint",{id:c,disabled:this.disabled},this.hint):null,e("div",{key:"681a74fa8d076be8b6bad11f70c3db4f05bfbc40",class:"autocomplete__input-wrapper"},e("input",Object.assign({key:"42235e1077c30f746dfef4cda228cac3af2fd145"},g,{disabled:this.disabled,"aria-disabled":this.disabled,autoComplete:"off",class:k.join(" "),id:r,onClick:t=>this.handleInputClick(t),onBlur:t=>this.handleInputBlur(t),onInput:t=>this.handleInputChange(t),onFocus:t=>this.handleInputFocus(t),name:this.name,placeholder:this.placeholder,ref:t=>{this.elementReferences[-1]=t},type:"text",role:"combobox",required:this.required,value:this.query})),this.showAllValues&&e("admiralty-icon",{key:"2169c9d3827a9ec7be70d009656cee134340385f",class:`autocomplete-down-icon ${this.disabled?"disabled":""}`,"icon-name":this.menuOpen||f?"angle-up":"angle-down"})),e("ul",Object.assign({key:"a46459188a4149fdee4cf9ee4b2e39f81756723a"},A,{class:M.join(" ")}),this.options.map(((t,i)=>{const o=this.focused===-1?this.selected===i:this.focused===i;const a=o&&this.hovered===null?` ${_}--focused`:"";const s=d()?`<span id=${n}__option-suffix--${i} style="border:0;clip:rect(0 0 0 0);height:1px;`+"marginBottom:-1px;marginRight:-1px;overflow:hidden;padding:0;position:absolute;"+'whiteSpace:nowrap;width:1px">'+` ${i+1} of ${this.options.length}</span>`:"";return e("li",{"aria-selected":this.focused===i?"true":"false",class:`${_}${a}`,innerHTML:this.templateSuggestion(t.text)+s,id:`${n}__option--${i}`,key:i,onBlur:t=>this.handleOptionBlur(t,i),onClick:t=>this.handleOptionClick(t,i),onMouseDown:t=>this.handleOptionMouseDown(t),onMouseEnter:()=>this.handleOptionMouseEnter(i),ref:t=>{this.elementReferences[i]=t},role:"option",tabIndex:-1,"aria-posinset":i+1,"aria-setsize":this.options.length})})),f&&e("li",{key:"d006b14b1ac0c953443e87c5407d476015b49988",class:`${_} ${_}--no-results`},"No results found")),e("span",{key:"a77fb4fe1d40c8e7ee1ee95d7387928d5f341093",id:x,style:{display:"none"}},this.assistiveHint),this.invalid&&this.invalidMessage&&e("admiralty-input-invalid",{key:"d784dd5fde4a2cdee858c308bcebb5ea6964c8c0",id:h,style:{visibility:this.invalid&&this.invalidMessage?"visible":"hidden"}},this.invalidMessage))}get el(){return a(this)}static get watchers(){return{value:["onValueChange"],focused:["onFocusedChange"]}}};let f=0;y.style=c;export{y as admiralty_autocomplete};
2
+ //# sourceMappingURL=p-1940d66d.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["watchForOptions","containerEl","tagName","onChange","MutationObserver","mutation","mutationList","getSelectedOption","observe","childList","subtree","newOption","forEach","mut","i","addedNodes","length","findCheckedOption","node","nodeType","undefined","el","options","toUpperCase","Array","from","querySelectorAll","find","o","value","autocompleteCss","AdmiraltyAutocompleteStyle0","keyCodes","isIosDevice","navigator","userAgent","match","isPrintableKeyCode","keyCode","filterOptions","searchTerm","filter","text","toLowerCase","indexOf","filterOptionsByValue","toString","AutocompleteComponent","this","internalId","nextId","elementReferences","source","onValueChange","newVal","_","matches","matchFound","validChoiceMade","option","query","menuOpen","ariaHint","admiraltyChange","emit","_b","_a","onFocusedChange","oldVal","componentLostFocus","focused","focusedChanged","focusDifferentElement","focus","focusedInput","componentGainedFocus","selectAllText","inputElement","setSelectionRange","isQueryAnOption","map","templateInputValue","connectedCallback","async","childOpts","textContent","_c","forceUpdate","disconnectedCallback","clearTimeout","$pollInput","pollInputElement","getDirectInputChanges","setTimeout","inputReference","queryHasChanged","handleInputChange","target","hasAutoselect","autoselect","templateSuggestion","handleComponentBlur","newState","newQuery","confirmOnBlur","selected","handleListMouseLeave","hovered","handleOptionBlur","event","index","focusingOutsideComponent","relatedTarget","focusingInput","focusingAnotherOption","blurComponent","keepMenuOpen","handleInputBlur","focusingAnOption","queryEmpty","queryChanged","queryLongEnough","minLength","searchForOptions","showAllValues","optionsAvailable","handleInputClick","handleInputFocus","shouldReopenMenu","handleOptionFocus","handleOptionMouseEnter","handleOptionClick","selectedOption","handleOptionMouseDown","preventDefault","handleUpArrow","isNotAtTop","allowMoveUp","handleDownArrow","isNotAtBottom","allowMoveDown","handleSpace","focusIsOnOption","handleEnter","hasSelectedOption","handlePrintableKey","eventIsOnInput","handleKeyDown","render","id","inputId","hintId","errorId","inputFocused","noOptionsAvailable","queryNotEmpty","showNoOptionsFound","wrapperClassName","cssNamespace","optionFocused","optionClassName","assistiveHintID","ariaProps","hint","invalid","inputClassName","inputClassList","componentIsFocused","push","inputClasses","invalidMessage","disabled","menuClassName","menuModifierDisplayMenu","displayMenu","menuIsVisible","menuModifierVisibility","menuClassList","menuClasses","menuAttributes","class","_d","className","_e","_f","computedMenuAttributes","Object","assign","role","onMouseLeave","h","key","onKeyDown","label","for","autoComplete","join","onClick","onBlur","onInput","onFocus","name","placeholder","ref","type","required","showFocused","optionModifierFocused","iosPosinsetHtml","innerHTML","onMouseDown","onMouseEnter","optionEl","tabIndex","style","display","assistiveHint","visibility"],"sources":["src/components/autocomplete/optionsWatcher.ts","src/components/autocomplete/autocomplete.scss?tag=admiralty-autocomplete&encapsulation=scoped","src/components/autocomplete/autocomplete.tsx"],"sourcesContent":["export const watchForOptions = <T extends HTMLElement>(containerEl: HTMLElement, tagName: string, onChange: (el: T | undefined) => void) => {\n if (typeof MutationObserver === 'undefined') {\n return;\n }\n\n const mutation = new MutationObserver(mutationList => {\n onChange(getSelectedOption<T>(mutationList, tagName));\n });\n mutation.observe(containerEl, {\n childList: true,\n subtree: true,\n });\n return mutation;\n};\n\nconst getSelectedOption = <T extends HTMLElement>(mutationList: MutationRecord[], tagName: string): T | undefined => {\n let newOption: T | undefined;\n mutationList.forEach(mut => {\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < mut.addedNodes.length; i++) {\n newOption = findCheckedOption<T>(mut.addedNodes[i], tagName) || newOption;\n }\n });\n return newOption;\n};\n\n/**\n * The \"value\" key is only set on some components such as ion-select-option.\n * As a result, we create a default union type of HTMLElement and the \"value\" key.\n * However, implementers are required to provide the appropriate component type\n * such as HTMLIonSelectOptionElement.\n */\nexport const findCheckedOption = <T extends HTMLElement & { value?: any | null }>(node: Node, tagName: string) => {\n /**\n * https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType\n * The above check ensures \"node\" is an Element (nodeType 1).\n */\n if (node.nodeType !== 1) {\n return undefined;\n }\n\n // HTMLElement inherits from Element, so we cast \"el\" as T.\n const el = node as T;\n\n const options: T[] = el.tagName === tagName.toUpperCase() ? [el] : Array.from(el.querySelectorAll(tagName));\n\n return options.find((o: T) => o.value === el.value);\n};\n","@import './autocomplete.vars';\n\n.autocomplete__wrapper {\n position: relative;\n}\n\n.autocomplete__hint,\n.autocomplete__input {\n appearance: none;\n border: 2px solid $autocomplete-input-border-colour;\n border-radius: 0; /* Safari 10 on iOS adds implicit border rounding. */\n box-sizing: border-box;\n color: $autocomplete-text-colour;\n margin-bottom: 0; /* BUG: Safari 10 on macOS seems to add an implicit margin. */\n line-height: 1.5;\n width: 100%;\n}\n\n.autocomplete__label {\n background-color: transparent;\n position: relative;\n font-size: $autocomplete-label-font-size;\n}\n\n.autocomplete__input {\n background-color: transparent;\n position: relative;\n}\n\n.autocomplete__hint {\n color: $autocomplete-text-colour;\n position: absolute;\n}\n\n.autocomplete__input-wrapper {\n position: relative;\n}\n\n.autocomplete__input--default {\n padding: 12px;\n}\n\n.autocomplete__input--focused {\n outline: 3px solid $autocomplete-focus-colour;\n outline-offset: 0;\n box-shadow: inset 0 0 0 2px $autocomplete-text-colour;\n}\n\n.autocomplete__input--show-all-values {\n padding: 12px 35px 12px 12px; /* Space for arrow. Other padding should match .autocomplete__input--default. */\n cursor: pointer;\n}\n\n.autocomplete__input--invalid {\n border-color: $autocomplete-error-border-colour;\n}\n\n.autocomplete__input--disabled {\n border-color: $autocomplete-disabled-border-colour;\n}\n\n.autocomplete__menu {\n background-color: $autocomplete-background-colour;\n border: 2px solid $autocomplete-input-border-colour;\n border-top: 0;\n color: $autocomplete-text-colour;\n margin: 0;\n max-height: 342px;\n overflow-x: hidden;\n padding: 0;\n width: 100%;\n width: calc(100% - 4px);\n}\n\n.autocomplete__menu--visible {\n display: block;\n}\n\n.autocomplete__menu--hidden {\n display: none;\n}\n\n.autocomplete__menu--overlay {\n box-shadow: rgba(0, 0, 0, 0.256863) 0px 2px 6px;\n left: 0;\n position: absolute;\n top: 100%;\n z-index: 100;\n}\n\n.autocomplete__menu--inline {\n position: relative;\n}\n\n.autocomplete__option {\n border-bottom: solid $autocomplete-option-border-colour;\n border-width: 1px 0;\n color: $autocomplete-text-colour;\n cursor: pointer;\n display: block;\n position: relative;\n margin-bottom: 0;\n}\n\n.autocomplete__option:before {\n content: none;\n}\n\n.autocomplete__option > * {\n pointer-events: none;\n}\n\n.autocomplete__option:first-of-type {\n border-top-width: 0;\n}\n\n.autocomplete__option:last-of-type {\n border-bottom-width: 0;\n}\n\n.autocomplete__option--focused,\n.autocomplete__option:hover {\n background-color: $autocomplete-option-hover-background-colour;\n border-color: $autocomplete-option-hover-background-colour;\n color: $autocomplete-option-hover-text-colour;\n outline: none;\n}\n\n.autocomplete__option--no-results {\n background-color: $autocomplete-option-no-results-background-colour;\n color: $autocomplete-option-no-results-text-colour;\n text-align: center;\n\n margin-top: 50px;\n margin-bottom: 50px;\n cursor: not-allowed;\n}\n.autocomplete__option--no-results:hover {\n background-color: $autocomplete-option-no-results-background-colour;\n border-color: $autocomplete-option-no-results-background-colour;\n color: $autocomplete-option-no-results-text-colour;\n text-align: center;\n\n margin-top: 50px;\n margin-bottom: 50px;\n cursor: not-allowed;\n}\n\n.autocomplete__hint,\n.autocomplete__input,\n.autocomplete__option {\n font-size: $autocomplete-option-font-size;\n font-weight: $autocomplete-option-font-weight;\n}\n\n.autocomplete__hint,\n.autocomplete__option {\n padding: 10px;\n}\n\n.autocomplete-down-icon {\n font-size: $autocomplete-icon-font-size;\n font-weight: $autocomplete-icon-font-weight;\n pointer-events: none;\n position: absolute;\n right: 12px;\n top: 14px;\n}\n\nadmiralty-icon.disabled {\n color: $autocomplete-dropdown-icon-colour;\n}\n\nadmiralty-input-invalid {\n margin-top: 6px;\n}\n","/**\n * This component takes heavy inspiration from the autocomplete component created by alphagov: https://github.com/alphagov/accessible-autocomplete\n */\n\nimport { Component, forceUpdate, Prop, State, h, Element, EventEmitter, Event, Watch } from '@stencil/core';\nimport { watchForOptions } from './optionsWatcher';\nimport { AutoCompleteChangeEventDetail } from './autocomplete.interface';\n\ninterface Option {\n text: string;\n value: any;\n}\n\nconst keyCodes = {\n 13: 'enter',\n 27: 'escape',\n 32: 'space',\n 38: 'up',\n 40: 'down',\n};\n\nfunction isIosDevice() {\n return typeof navigator !== 'undefined' && !!(navigator.userAgent.match(/(iPod|iPhone|iPad)/g) && navigator.userAgent.match(/AppleWebKit/g));\n}\n\nfunction isPrintableKeyCode(keyCode) {\n return (\n (keyCode > 47 && keyCode < 58) || // number keys\n keyCode === 32 ||\n keyCode === 8 || // spacebar or backspace\n (keyCode > 64 && keyCode < 91) || // letter keys\n (keyCode > 95 && keyCode < 112) || // numpad keys\n (keyCode > 185 && keyCode < 193) || // ;=,-./` (in order)\n (keyCode > 218 && keyCode < 223) // [\\]' (in order)\n );\n}\n\nfunction filterOptions(options: Option[], searchTerm: string) {\n return options.filter(({ text }) => text.toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1);\n}\n\nfunction filterOptionsByValue(options: Option[], searchTerm: string) {\n return options.filter(({ value }) => value.toString().toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1);\n}\n\n@Component({\n tag: 'admiralty-autocomplete',\n styleUrl: 'autocomplete.scss',\n scoped: true,\n})\nexport class AutocompleteComponent {\n private internalId = ++nextId;\n\n @Element() el!: HTMLAdmiraltyAutocompleteElement;\n\n /**\n * Automatically select the first matching option.\n */\n @Prop() autoselect: boolean = false;\n /**\n * The default CSS namespace.\n */\n @Prop() cssNamespace: string = 'autocomplete';\n /**\n * When set to `overlay` this option will display the menu as an absolutely positioned overlay instead of inline.\n */\n @Prop() displayMenu: string = 'inline';\n /**\n * Prevent displaying options until the minimum string length is reached. Ignored when show all values is enabled.\n */\n @Prop() minLength: number = 0;\n /**\n * The name for the `<input>` element.\n */\n @Prop() name: string;\n /**\n * Populate the placeholder attribute on the `<input>` element.\n */\n @Prop() placeholder: string = '';\n /**\n * Toggle automatically confirming a selection when the field is blurred.\n */\n @Prop() confirmOnBlur: boolean = true;\n /**\n * Toggle whether to display the \"No results found\" message.\n */\n @Prop() showNoOptionsFound: boolean = true;\n /**\n * Toggle showing all values when the input is clicked, like a default dropdown. This will hide the chevron when set to false.\n */\n @Prop() showAllValues: boolean = true;\n /**\n * Populates the required field on the `<input>` element.\n */\n @Prop() required: boolean = false;\n /**\n * The hint that is provided to assistive users.\n */\n @Prop() assistiveHint: string =\n 'When autocomplete results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures.';\n\n /**\n * Sets HTML attributes and their values on the generated `ul` menu element. Useful for adding `aria-labelledby`\n * and setting to the value of the `id` attribute on your existing label, to provide context to an assistive\n * technology user. e.g.\n * ```\n * const menuAttributes = {\n * className: 'custom-className',\n * class: 'custom-class',\n * id: 'custom-id',\n * role: 'custom-role'\n * }\n * ```\n * */\n @Prop() menuAttributes: any;\n /**\n * Classes to add to the component's `<input>` element.\n */\n @Prop() inputClasses: string;\n /**\n * Classes to add to the menu displaying the options.\n */\n @Prop() menuClasses: string;\n /**\n * The text that will be used as a field label.\n */\n @Prop() label: string = null;\n /**\n * TThe text which will be used under the label to describe the input.\n */\n @Prop() hint: string = null;\n /**\n * Whether to show that the component is in an invalid state.\n */\n @Prop() invalid: boolean = false;\n /**\n * The message to show when the component is invalid.\n */\n @Prop() invalidMessage: string = null;\n /**\n * When `true`, the component cannot be interacted with.\n */\n @Prop() disabled: boolean = false;\n /**\n * The value of the input.\n */\n @Prop({ mutable: true }) value?: string | null = null;\n\n /**\n * Emitted when the value has changed.\n */\n @Event() admiraltyChange: EventEmitter<AutoCompleteChangeEventDetail>;\n\n elementReferences = {};\n $pollInput: NodeJS.Timeout;\n\n source: Option[] = [];\n\n @State() focused: number | null = null;\n @State() hovered: number | null = null;\n @State() menuOpen: boolean = false;\n @State() options: Option[] = [];\n @State() option: Option = null;\n @State() query: string = null;\n @State() validChoiceMade: boolean = false;\n @State() selected: number | null = null;\n @State() ariaHint: boolean = true;\n\n @Watch('value')\n onValueChange(newVal: string, _: string) {\n if (this.source.length === 0) {\n // If this is the initial render, the options won't have been set yet, so do nothing\n return;\n }\n if (newVal && newVal.length > 0) {\n const matches = filterOptionsByValue(this.source, newVal);\n const matchFound = matches.length > 0;\n this.options = matches;\n this.validChoiceMade = matchFound;\n this.option = matches[0];\n this.query = matchFound ? matches[0].text : '';\n this.menuOpen = false;\n this.ariaHint = false;\n } else {\n this.options = [];\n this.option = null;\n this.query = '';\n this.ariaHint = true;\n }\n\n this.admiraltyChange.emit({ value: this.option?.value ?? '' });\n }\n\n @Watch('focused')\n onFocusedChange(newVal: number | null, oldVal: number | null) {\n const componentLostFocus = this.focused === null;\n const focusedChanged = oldVal !== newVal;\n const focusDifferentElement = focusedChanged && !componentLostFocus;\n if (focusDifferentElement) {\n this.elementReferences[this.focused]?.focus();\n }\n const focusedInput = this.focused === -1;\n const componentGainedFocus = focusedChanged && oldVal === null;\n const selectAllText = focusedInput && componentGainedFocus;\n if (selectAllText) {\n const inputElement = this.elementReferences[this.focused];\n inputElement.setSelectionRange(0, inputElement.value.length);\n }\n }\n\n isQueryAnOption(query: string, options: Option[]) {\n return options.map(({ text }) => this.templateInputValue(text).toLowerCase()).indexOf(query.toLowerCase()) !== -1;\n }\n\n connectedCallback() {\n this.mutation = watchForOptions<HTMLAdmiraltyAutocompleteOptionElement>(this.el, 'admiralty-autocomplete-option', async () => {\n this.source = this.childOpts.map(({ textContent, value }) => ({\n text: textContent?.length > 0 ? textContent : value,\n value: value ?? textContent,\n }));\n if (this.query === null && this.value?.length > 0) {\n const matches = filterOptionsByValue(this.source, this.value);\n this.options = matches;\n this.option = matches[0];\n this.query = matches[0]?.text ?? '';\n }\n forceUpdate(this);\n });\n // this.pollInputElement();\n }\n\n disconnectedCallback() {\n clearTimeout(this.$pollInput);\n }\n\n // Applications like Dragon NaturallySpeaking will modify the\n // `input` field by directly changing its `.value`. These events\n // don't trigger our JavaScript event listeners, so we need to poll\n // to handle when and if they occur.\n pollInputElement() {\n this.getDirectInputChanges();\n this.$pollInput = setTimeout(() => {\n this.pollInputElement();\n }, 100);\n }\n\n getDirectInputChanges() {\n const inputReference = this.elementReferences[-1];\n const queryHasChanged = inputReference && inputReference.value !== this.query;\n\n if (queryHasChanged) {\n this.handleInputChange({ target: { value: inputReference.value } });\n }\n }\n\n mutation: MutationObserver;\n\n private get childOpts() {\n return Array.from(this.el.querySelectorAll('admiralty-autocomplete-option'));\n }\n\n hasAutoselect() {\n return isIosDevice() ? false : this.autoselect;\n }\n\n // This template is used when converting from a state.options object into a state.query.\n templateInputValue(value) {\n // const inputValueTemplate = this.templates && this.templates.inputValue;\n // return inputValueTemplate ? inputValueTemplate(value) : value;\n return value;\n }\n\n // This template is used when displaying results / suggestions.\n templateSuggestion(value) {\n // const suggestionTemplate = this.templates && this.templates.suggestion;\n // return suggestionTemplate ? suggestionTemplate(value) : value;\n return value;\n }\n\n handleComponentBlur(newState: { menuOpen: boolean; query: string }) {\n let newQuery: string;\n if (this.confirmOnBlur) {\n newQuery = newState.query || this.query;\n const matches = filterOptions(this.source, newQuery);\n const matchFound = newQuery?.length > 0 && matches.length > 0;\n const option = matchFound ? matches[0] : { value: null, text: '' };\n this.value = option.value;\n } else {\n newQuery = this.query;\n }\n this.focused = null;\n this.menuOpen = newState.menuOpen || false;\n this.selected = null;\n this.validChoiceMade = this.isQueryAnOption(newQuery, this.options);\n }\n\n handleListMouseLeave() {\n this.hovered = null;\n }\n\n handleOptionBlur(event, index) {\n const focusingOutsideComponent = event.relatedTarget === null;\n const focusingInput = event.relatedTarget === this.elementReferences[-1];\n const focusingAnotherOption = this.focused !== index && this.focused !== -1;\n const blurComponent = (!focusingAnotherOption && focusingOutsideComponent) || !(focusingAnotherOption || focusingInput);\n if (blurComponent) {\n const keepMenuOpen = this.menuOpen && isIosDevice();\n this.handleComponentBlur({\n menuOpen: keepMenuOpen,\n query: this.templateInputValue(this.options[this.selected]?.text ?? ''),\n });\n }\n }\n\n handleInputBlur(_) {\n const focusingAnOption = this.focused !== -1;\n if (!focusingAnOption) {\n const keepMenuOpen = this.menuOpen && isIosDevice();\n this.handleComponentBlur({\n menuOpen: keepMenuOpen,\n query: this.query,\n });\n }\n }\n\n handleInputChange(event) {\n const autoselect = this.hasAutoselect();\n const query = event.target.value;\n const queryEmpty = query.length === 0;\n const queryChanged = this.query !== query;\n const queryLongEnough = query.length >= this.minLength;\n\n this.query = query;\n this.ariaHint = queryEmpty;\n\n const searchForOptions = this.showAllValues || (!queryEmpty && queryChanged && queryLongEnough);\n if (searchForOptions) {\n const matches = filterOptions(this.source, this.query);\n const optionsAvailable = matches.length > 0;\n this.menuOpen = optionsAvailable;\n this.options = matches;\n this.selected = autoselect && optionsAvailable ? 0 : -1;\n this.validChoiceMade = false;\n } else if (queryEmpty || !queryLongEnough) {\n this.menuOpen = false;\n this.options = [];\n }\n }\n\n handleInputClick(event) {\n this.handleInputChange(event);\n }\n\n handleInputFocus(_) {\n const shouldReopenMenu = !this.validChoiceMade && this.query?.length >= this.minLength && this.options.length > 0;\n\n if (shouldReopenMenu) {\n this.focused = -1;\n this.menuOpen = shouldReopenMenu || this.menuOpen;\n this.selected = -1;\n } else {\n this.focused = -1;\n }\n }\n\n handleOptionFocus(index) {\n this.focused = index;\n this.hovered = null;\n this.selected = index;\n }\n\n handleOptionMouseEnter(index) {\n // iOS Safari prevents click event if mouseenter adds hover background colour\n // See: https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW4\n if (!isIosDevice()) {\n this.hovered = index;\n }\n }\n\n handleOptionClick(_, index) {\n const selectedOption = this.options[index];\n this.value = selectedOption.value;\n this.focused = -1;\n this.hovered = null;\n this.menuOpen = false;\n this.selected = index;\n this.validChoiceMade = true;\n forceUpdate(this);\n }\n\n handleOptionMouseDown(event) {\n // Safari triggers focusOut before click, but if you\n // preventDefault on mouseDown, you can stop that from happening.\n // If this is removed, clicking on an option in Safari will trigger\n // `handleOptionBlur`, which closes the menu, and the click will\n // trigger on the element underneath instead.\n // See: http://stackoverflow.com/questions/7621711/how-to-prevent-blur-running-when-clicking-a-link-in-jquery\n event.preventDefault();\n }\n\n handleUpArrow(event) {\n event.preventDefault();\n const isNotAtTop = this.selected !== -1;\n const allowMoveUp = isNotAtTop && this.menuOpen;\n if (allowMoveUp) {\n this.handleOptionFocus(this.selected - 1);\n }\n }\n\n handleDownArrow(event) {\n event.preventDefault();\n // if not open, open\n if (this.showAllValues && this.menuOpen === false) {\n event.preventDefault();\n const matches = filterOptions(this.source, '');\n this.menuOpen = true;\n this.options = matches;\n this.selected = 0;\n this.focused = 0;\n this.hovered = null;\n } else if (this.menuOpen === true) {\n const isNotAtBottom = this.selected !== this.options.length - 1;\n const allowMoveDown = isNotAtBottom && this.menuOpen;\n if (allowMoveDown) {\n this.handleOptionFocus(this.selected + 1);\n }\n }\n }\n\n handleSpace(event) {\n // if not open, open\n if (this.showAllValues && this.menuOpen === false && this.query === '') {\n event.preventDefault();\n const matches = filterOptions(this.source, '');\n this.menuOpen = true;\n this.options = matches;\n }\n const focusIsOnOption = this.focused !== -1;\n if (focusIsOnOption) {\n event.preventDefault();\n this.handleOptionClick(event, this.focused);\n }\n }\n\n handleEnter(event) {\n if (this.menuOpen) {\n event.preventDefault();\n const hasSelectedOption = this.selected >= 0;\n if (hasSelectedOption) {\n this.handleOptionClick(event, this.selected);\n }\n }\n }\n\n handlePrintableKey(event) {\n const inputElement = this.elementReferences[-1];\n const eventIsOnInput = event.target === inputElement;\n if (!eventIsOnInput) {\n // FIXME: This would be better if it was in componentDidUpdate,\n // but using setState to trigger that seems to not work correctly\n // in preact@8.1.0.\n inputElement.focus();\n }\n }\n\n handleKeyDown(event) {\n switch (keyCodes[event.keyCode]) {\n case 'up':\n this.handleUpArrow(event);\n break;\n case 'down':\n this.handleDownArrow(event);\n break;\n case 'space':\n this.handleSpace(event);\n break;\n case 'enter':\n this.handleEnter(event);\n break;\n case 'escape':\n this.handleComponentBlur({\n query: this.query,\n menuOpen: this.menuOpen,\n });\n break;\n default:\n if (isPrintableKeyCode(event.keyCode)) {\n this.handlePrintableKey(event);\n }\n break;\n }\n }\n\n render() {\n const id = this.el.id != '' ? this.el.id : `admiralty-autocomplete-${this.internalId}`;\n const inputId = `${id}-input`;\n const hintId = `${id}-hint`;\n const errorId = `${id}-error`;\n\n const inputFocused = this.focused === -1;\n const noOptionsAvailable = this.options.length === 0;\n const queryNotEmpty = this.query?.length !== 0;\n const queryLongEnough = this.query?.length >= this.minLength;\n const showNoOptionsFound = this.showNoOptionsFound && inputFocused && noOptionsAvailable && queryNotEmpty && queryLongEnough;\n\n const wrapperClassName = `${this.cssNamespace}__wrapper`;\n const optionFocused = this.focused !== -1 && this.focused !== null;\n\n const optionClassName = `${this.cssNamespace}__option`;\n\n const assistiveHintID = id + '__assistiveHint';\n const ariaProps = {\n 'aria-describedby': `${this.hint ? hintId : ''} ${this.ariaHint ? assistiveHintID : ''} ${this.invalid ? errorId : ''}`,\n 'aria-expanded': this.menuOpen ? 'true' : 'false',\n 'aria-activedescendant': optionFocused ? `${id}__option--${this.focused}` : null,\n 'aria-owns': `${id}__listbox`,\n 'aria-autocomplete': this.hasAutoselect() ? 'both' : 'list',\n };\n\n const inputClassName = `${this.cssNamespace}__input`;\n const inputClassList = [inputClassName, this.showAllValues ? `${inputClassName}--show-all-values` : `${inputClassName}--default`];\n\n const componentIsFocused = this.focused !== null;\n if (componentIsFocused) {\n inputClassList.push(`${inputClassName}--focused`);\n }\n\n if (this.inputClasses) {\n inputClassList.push(this.inputClasses);\n }\n\n if (this.invalid && this.invalidMessage) {\n inputClassList.push(`${inputClassName}--invalid`);\n }\n\n if (this.disabled) {\n inputClassList.push(`${inputClassName}--disabled`);\n }\n\n const menuClassName = `${this.cssNamespace}__menu`;\n const menuModifierDisplayMenu = `${menuClassName}--${this.displayMenu}`;\n const menuIsVisible = this.menuOpen || showNoOptionsFound;\n const menuModifierVisibility = `${menuClassName}--${menuIsVisible ? 'visible' : 'hidden'}`;\n\n const menuClassList = [menuClassName, menuModifierDisplayMenu, menuModifierVisibility];\n\n if (this.menuClasses) {\n menuClassList.push(this.menuClasses);\n }\n\n if (this.menuAttributes?.class || this.menuAttributes?.className) {\n menuClassList.push(this.menuAttributes?.class || this.menuAttributes?.className);\n }\n\n const computedMenuAttributes = {\n // Copy the attributes passed as props\n ...this.menuAttributes,\n // And add the values computed for the autocomplete\n id: `${id}__listbox`,\n role: 'listbox',\n onMouseLeave: this.handleListMouseLeave,\n };\n\n // Preact would override our computed `className`\n // with the `class` from the `menuAttributes` so\n // we need to clean it up from the computed attributes\n delete computedMenuAttributes.class;\n\n return (\n <div class={wrapperClassName} onKeyDown={event => this.handleKeyDown(event)}>\n {this.label ? (\n <admiralty-label class=\"autocomplete__label\" disabled={this.disabled} for={inputId}>\n {this.label}\n </admiralty-label>\n ) : null}\n {this.hint ? (\n <admiralty-hint id={hintId} disabled={this.disabled}>\n {this.hint}\n </admiralty-hint>\n ) : null}\n <div class=\"autocomplete__input-wrapper\">\n <input\n {...ariaProps}\n disabled={this.disabled}\n aria-disabled={this.disabled}\n autoComplete=\"off\"\n class={inputClassList.join(' ')}\n id={inputId}\n onClick={event => this.handleInputClick(event)}\n onBlur={event => this.handleInputBlur(event)}\n onInput={event => this.handleInputChange(event)}\n onFocus={event => this.handleInputFocus(event)}\n name={this.name}\n placeholder={this.placeholder}\n ref={inputElement => {\n this.elementReferences[-1] = inputElement;\n }}\n type=\"text\"\n role=\"combobox\"\n required={this.required}\n value={this.query}\n />\n {this.showAllValues &&\n <admiralty-icon class={`autocomplete-down-icon ${this.disabled ? \"disabled\" : \"\"}`} icon-name={this.menuOpen || showNoOptionsFound ? \"angle-up\" : \"angle-down\"} />\n }\n </div>\n\n <ul {...computedMenuAttributes} class={menuClassList.join(' ')}>\n {this.options.map((option, index) => {\n const showFocused = this.focused === -1 ? this.selected === index : this.focused === index;\n const optionModifierFocused = showFocused && this.hovered === null ? ` ${optionClassName}--focused` : '';\n const iosPosinsetHtml = isIosDevice()\n ? `<span id=${id}__option-suffix--${index} style=\"border:0;clip:rect(0 0 0 0);height:1px;` +\n 'marginBottom:-1px;marginRight:-1px;overflow:hidden;padding:0;position:absolute;' +\n 'whiteSpace:nowrap;width:1px\">' +\n ` ${index + 1} of ${this.options.length}</span>`\n : '';\n\n return (\n <li\n aria-selected={this.focused === index ? 'true' : 'false'}\n class={`${optionClassName}${optionModifierFocused}`}\n innerHTML={this.templateSuggestion(option.text) + iosPosinsetHtml}\n id={`${id}__option--${index}`}\n key={index}\n onBlur={event => this.handleOptionBlur(event, index)}\n onClick={event => this.handleOptionClick(event, index)}\n onMouseDown={event => this.handleOptionMouseDown(event)}\n onMouseEnter={() => this.handleOptionMouseEnter(index)}\n ref={optionEl => {\n this.elementReferences[index] = optionEl;\n }}\n role=\"option\"\n tabIndex={-1}\n aria-posinset={index + 1}\n aria-setsize={this.options.length}\n />\n );\n })}\n\n {showNoOptionsFound && <li class={`${optionClassName} ${optionClassName}--no-results`}>No results found</li>}\n </ul>\n\n <span id={assistiveHintID} style={{ display: 'none' }}>\n {this.assistiveHint}\n </span>\n {this.invalid && this.invalidMessage && (\n <admiralty-input-invalid id={errorId} style={{ visibility: this.invalid && this.invalidMessage ? 'visible' : 'hidden' }}>\n {this.invalidMessage}\n </admiralty-input-invalid>\n )}\n </div>\n );\n }\n}\nlet nextId = 0;\n"],"mappings":"gEAAO,MAAMA,EAAkB,CAAwBC,EAA0BC,EAAiBC,KAChG,UAAWC,mBAAqB,YAAa,CAC3C,M,CAGF,MAAMC,EAAW,IAAID,kBAAiBE,IACpCH,EAASI,EAAqBD,EAAcJ,GAAS,IAEvDG,EAASG,QAAQP,EAAa,CAC5BQ,UAAW,KACXC,QAAS,OAEX,OAAOL,CAAQ,EAGjB,MAAME,EAAoB,CAAwBD,EAAgCJ,KAChF,IAAIS,EACJL,EAAaM,SAAQC,IAEnB,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAIE,WAAWC,OAAQF,IAAK,CAC9CH,EAAYM,EAAqBJ,EAAIE,WAAWD,GAAIZ,IAAYS,C,KAGpE,OAAOA,CAAS,EASX,MAAMM,EAAoB,CAAiDC,EAAYhB,KAK5F,GAAIgB,EAAKC,WAAa,EAAG,CACvB,OAAOC,S,CAIT,MAAMC,EAAKH,EAEX,MAAMI,EAAeD,EAAGnB,UAAYA,EAAQqB,cAAgB,CAACF,GAAMG,MAAMC,KAAKJ,EAAGK,iBAAiBxB,IAElG,OAAOoB,EAAQK,MAAMC,GAASA,EAAEC,QAAUR,EAAGQ,OAAM,EC9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K,IACpB,YAAYoH,qBAAsBvC,mDAClC,kFACA,gCACA,IAAIA,EAAQ,QAAQ9D,KAAK1B,QAAQN,gBACjC,GAEJ,OACE8K,EAAA,sBACiB9I,KAAKsB,UAAYwC,EAAQ,OAAS,QACjDsE,MAAO,GAAGpB,IAAkB+C,IAC5BE,UAAWjK,KAAKoD,mBAAmBzC,EAAOjB,MAAQsK,EAClD3D,GAAI,GAAGA,cAAevC,IACtBiF,IAAKjF,EACLwF,OAAQzF,GAAS7D,KAAK4D,iBAAiBC,EAAOC,GAC9CuF,QAASxF,GAAS7D,KAAKmF,kBAAkBtB,EAAOC,GAChDoG,YAAarG,GAAS7D,KAAKqF,sBAAsBxB,GACjDsG,aAAc,IAAMnK,KAAKkF,uBAAuBpB,GAChD6F,IAAKS,IACHpK,KAAKG,kBAAkB2D,GAASsG,CAAQ,EAE1CxB,KAAK,SACLyB,UAAW,EAAC,gBACGvG,EAAQ,EAAC,eACV9D,KAAK1B,QAAQN,QAC3B,IAIL4I,GAAsBkC,EAAA,MAAAC,IAAA,2CAAIX,MAAO,GAAGpB,KAAmBA,iBAA6B,qBAGvF8B,EAAA,QAAAC,IAAA,2CAAM1C,GAAIY,EAAiBqD,MAAO,CAAEC,QAAS,SAC1CvK,KAAKwK,eAEPxK,KAAKoH,SAAWpH,KAAK0H,gBACpBoB,EAAA,2BAAAC,IAAA,2CAAyB1C,GAAIG,EAAS8D,MAAO,CAAEG,WAAYzK,KAAKoH,SAAWpH,KAAK0H,eAAiB,UAAY,WAC1G1H,KAAK0H,gB,6GAOlB,IAAIxH,EAAS,E","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import{r as a,h as i}from"./p-71979ff5.js";const t=".visually-hidden.sc-admiralty-card:not(:focus):not(:active){position:absolute !important;width:1px !important;height:1px !important;margin:0 !important;padding:0 !important;overflow:hidden !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;border:0 !important;white-space:nowrap !important}@media (max-width: 1023px){.desktop-only.sc-admiralty-card{display:none}}@media (min-width: 1024px){.not-desktop.sc-admiralty-card{display:none}}@media (min-width: 1024px){.tablet-only.sc-admiralty-card{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-only.sc-admiralty-card{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-or-desktop.sc-admiralty-card{display:none}}@media (min-width: 1024px){.phone-or-tablet.sc-admiralty-card{display:none}}@media (min-width: 1024px){.phone-only.sc-admiralty-card{display:none}}@media (max-width: 1023px) and (min-width: 480px){.phone-only.sc-admiralty-card{display:none}}.visually-hidden.sc-admiralty-card:not(:focus):not(:active){position:absolute !important;width:1px !important;height:1px !important;margin:0 !important;padding:0 !important;overflow:hidden !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;border:0 !important;white-space:nowrap !important}@media (max-width: 1023px){.desktop-only.sc-admiralty-card{display:none}}@media (min-width: 1024px){.not-desktop.sc-admiralty-card{display:none}}@media (min-width: 1024px){.tablet-only.sc-admiralty-card{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-only.sc-admiralty-card{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-or-desktop.sc-admiralty-card{display:none}}@media (min-width: 1024px){.phone-or-tablet.sc-admiralty-card{display:none}}@media (min-width: 1024px){.phone-only.sc-admiralty-card{display:none}}@media (max-width: 1023px) and (min-width: 480px){.phone-only.sc-admiralty-card{display:none}}.card.sc-admiralty-card{display:flex;flex-direction:column;border:1px solid var(--admiralty-colour-light)}.card.sc-admiralty-card>h6.sc-admiralty-card{font-size:var(--admiralty-card-heading-font-size, var(--admiralty-font-size-0));height:60px;line-height:60px;border:1px solid var(--admiralty-colour-primary);color:var(--admiralty-colour-primary-contrast);background-color:var(--admiralty-colour-primary);margin:0;padding:0 30px}@media (max-width: 1023px){.card.sc-admiralty-card>h6.sc-admiralty-card{padding:0px 18px;height:48px;line-height:48px}}.card.sc-admiralty-card>div.sc-admiralty-card{border-top:none;flex-grow:1;padding:30px}@media (max-width: 1023px){.card.sc-admiralty-card>div.sc-admiralty-card{padding:24px 18px}}.text-input-form.sc-admiralty-card .text-input-wrap.sc-admiralty-card{margin-bottom:30px}.text-input-form.sc-admiralty-card .text-input-wrap.sc-admiralty-card:last-child{margin-bottom:0}";const d=t;const r=class{constructor(i){a(this,i);this.heading=undefined}render(){return i("section",{key:"5372dea9a3941efe1a7c4412546f5a18f328c920",class:"card"},this.heading?i("h6",null,this.heading):null,i("div",{key:"d4adac313a7d4f9e5f828c040e68390bad78ea8b"},i("slot",{key:"b5b5c68693df31eb89d548cb70cccc12d423bada"})))}};r.style=d;export{r as admiralty_card};
2
- //# sourceMappingURL=p-7491b43a.entry.js.map
1
+ import{r as a,h as d}from"./p-71979ff5.js";const i=".visually-hidden.sc-admiralty-card:not(:focus):not(:active){position:absolute !important;width:1px !important;height:1px !important;margin:0 !important;padding:0 !important;overflow:hidden !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;border:0 !important;white-space:nowrap !important}@media (max-width: 1023px){.desktop-only.sc-admiralty-card{display:none}}@media (min-width: 1024px){.not-desktop.sc-admiralty-card{display:none}}@media (min-width: 1024px){.tablet-only.sc-admiralty-card{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-only.sc-admiralty-card{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-or-desktop.sc-admiralty-card{display:none}}@media (min-width: 1024px){.phone-or-tablet.sc-admiralty-card{display:none}}@media (min-width: 1024px){.phone-only.sc-admiralty-card{display:none}}@media (max-width: 1023px) and (min-width: 480px){.phone-only.sc-admiralty-card{display:none}}.visually-hidden.sc-admiralty-card:not(:focus):not(:active){position:absolute !important;width:1px !important;height:1px !important;margin:0 !important;padding:0 !important;overflow:hidden !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;border:0 !important;white-space:nowrap !important}@media (max-width: 1023px){.desktop-only.sc-admiralty-card{display:none}}@media (min-width: 1024px){.not-desktop.sc-admiralty-card{display:none}}@media (min-width: 1024px){.tablet-only.sc-admiralty-card{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-only.sc-admiralty-card{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-or-desktop.sc-admiralty-card{display:none}}@media (min-width: 1024px){.phone-or-tablet.sc-admiralty-card{display:none}}@media (min-width: 1024px){.phone-only.sc-admiralty-card{display:none}}@media (max-width: 1023px) and (min-width: 480px){.phone-only.sc-admiralty-card{display:none}}.card.sc-admiralty-card{display:flex;flex-direction:column;border:1px solid var(--admiralty-card-border-colour, var(--admiralty-colour-light));background-color:var(--admiralty-card-background-colour, var(--admiralty-background-colour))}.card.sc-admiralty-card>h6.sc-admiralty-card{font-size:var(--admiralty-card-heading-font-size, var(--admiralty-font-size-0));height:60px;line-height:60px;border:1px solid var(--admiralty-card-heading-border-colour, var(--admiralty-colour-primary));color:var(--admiralty-card-heading-text-colour, var(--admiralty-colour-primary-contrast));background-color:var(--admiralty-card-heading-colour, var(--admiralty-colour-primary));margin:0;padding:0 30px}@media (max-width: 1023px){.card.sc-admiralty-card>h6.sc-admiralty-card{padding:0px 18px;height:48px;line-height:48px}}.card.sc-admiralty-card>div.sc-admiralty-card{border-top:none;flex-grow:1;padding:var(--admiralty-card-padding, 30px)}@media (max-width: 1023px){.card.sc-admiralty-card>div.sc-admiralty-card{padding:var(--admiralty-card-not-desktop-padding, 24px 18px)}}.text-input-form.sc-admiralty-card .text-input-wrap.sc-admiralty-card{margin-bottom:30px}.text-input-form.sc-admiralty-card .text-input-wrap.sc-admiralty-card:last-child{margin-bottom:0}";const t=i;const r=class{constructor(d){a(this,d);this.heading=undefined}render(){return d("section",{key:"5372dea9a3941efe1a7c4412546f5a18f328c920",class:"card"},this.heading?d("h6",null,this.heading):null,d("div",{key:"d4adac313a7d4f9e5f828c040e68390bad78ea8b"},d("slot",{key:"b5b5c68693df31eb89d548cb70cccc12d423bada"})))}};r.style=t;export{r as admiralty_card};
2
+ //# sourceMappingURL=p-37d5653a.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["cardCss","AdmiraltyCardStyle0","CardComponent","render","h","key","class","this","heading"],"sources":["src/components/card/card.scss?tag=admiralty-card&encapsulation=scoped","src/components/card/card.tsx"],"sourcesContent":["@import 'card.vars';\n@import '../../styles/vars/globals';\n\n.card {\n display: flex;\n flex-direction: column;\n border: 1px solid $card-border-colour;\n background-color: $card-background-colour;\n\n & > h6 {\n font-size: $card-heading-font-size;\n height: 60px;\n line-height: 60px;\n border: 1px solid $card-heading-border-colour;\n color: $card-heading-text-colour;\n background-color: $card-heading-colour;\n margin: 0;\n padding: 0 30px;\n @include not-desktop {\n padding: 0px 18px;\n height: 48px;\n line-height: 48px;\n }\n }\n\n & > div {\n border-top: none;\n flex-grow: 1;\n padding: $card-padding;\n @include not-desktop {\n padding: $card-padding-not-desktop;\n }\n }\n}\n\n.text-input-form {\n .text-input-wrap {\n margin-bottom: 30px;\n }\n\n .text-input-wrap:last-child {\n margin-bottom: 0;\n }\n}\n","import { Component, Prop, h } from '@stencil/core';\n\n@Component({\n tag: 'admiralty-card',\n styleUrl: 'card.scss',\n scoped: true,\n})\nexport class CardComponent {\n /**\n * The title of the card.\n */\n @Prop() heading: string;\n\n render() {\n return (\n <section class=\"card\">\n {this.heading ? <h6>{this.heading}</h6> : null}\n <div>\n <slot></slot>\n </div>\n </section>\n );\n }\n}\n"],"mappings":"2CAAA,MAAMA,EAAU,8qGAChB,MAAAC,EAAeD,E,MCMFE,EAAa,M,gDAMxB,MAAAC,GACE,OACEC,EAAA,WAAAC,IAAA,2CAASC,MAAM,QACZC,KAAKC,QAAUJ,EAAA,UAAKG,KAAKC,SAAgB,KAC1CJ,EAAA,OAAAC,IAAA,4CACED,EAAA,QAAAC,IAAA,8C","ignoreList":[]}
@@ -74,7 +74,7 @@ function filterOptions(options, searchTerm) {
74
74
  return options.filter(({ text }) => text.toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1);
75
75
  }
76
76
  function filterOptionsByValue(options, searchTerm) {
77
- return options.filter(({ value }) => value.toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1);
77
+ return options.filter(({ value }) => value.toString().toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1);
78
78
  }
79
79
  const AutocompleteComponent = class {
80
80
  constructor(hostRef) {
@@ -467,10 +467,10 @@ const AutocompleteComponent = class {
467
467
  // with the `class` from the `menuAttributes` so
468
468
  // we need to clean it up from the computed attributes
469
469
  delete computedMenuAttributes.class;
470
- return (index.h("div", { key: '9cb9e0e2dad7646540004b2d36870c31b116f035', class: wrapperClassName, onKeyDown: event => this.handleKeyDown(event) }, this.label ? (index.h("admiralty-label", { class: "autocomplete__label", disabled: this.disabled, for: inputId }, this.label)) : null, this.hint ? (index.h("admiralty-hint", { id: hintId, disabled: this.disabled }, this.hint)) : null, index.h("div", { key: '93189d20cea5100ed4bc408824735569ea9d5e26', class: "autocomplete__input-wrapper" }, index.h("input", Object.assign({ key: '74770128149f77d1a4c17be5389188e29e34df1e' }, ariaProps, { disabled: this.disabled, "aria-disabled": this.disabled, autoComplete: "off", class: inputClassList.join(' '), id: inputId, onClick: event => this.handleInputClick(event), onBlur: event => this.handleInputBlur(event), onInput: event => this.handleInputChange(event), onFocus: event => this.handleInputFocus(event), name: this.name, placeholder: this.placeholder, ref: inputElement => {
470
+ return (index.h("div", { key: '4136155c810c71813619ffa286730bcfcca3d772', class: wrapperClassName, onKeyDown: event => this.handleKeyDown(event) }, this.label ? (index.h("admiralty-label", { class: "autocomplete__label", disabled: this.disabled, for: inputId }, this.label)) : null, this.hint ? (index.h("admiralty-hint", { id: hintId, disabled: this.disabled }, this.hint)) : null, index.h("div", { key: '681a74fa8d076be8b6bad11f70c3db4f05bfbc40', class: "autocomplete__input-wrapper" }, index.h("input", Object.assign({ key: '42235e1077c30f746dfef4cda228cac3af2fd145' }, ariaProps, { disabled: this.disabled, "aria-disabled": this.disabled, autoComplete: "off", class: inputClassList.join(' '), id: inputId, onClick: event => this.handleInputClick(event), onBlur: event => this.handleInputBlur(event), onInput: event => this.handleInputChange(event), onFocus: event => this.handleInputFocus(event), name: this.name, placeholder: this.placeholder, ref: inputElement => {
471
471
  this.elementReferences[-1] = inputElement;
472
472
  }, type: "text", role: "combobox", required: this.required, value: this.query })), this.showAllValues &&
473
- index.h("admiralty-icon", { key: '98032793bfdc0fb9ca7c90be9352e234de7d72bb', class: `autocomplete-down-icon ${this.disabled ? "disabled" : ""}`, "icon-name": this.menuOpen || showNoOptionsFound ? "angle-up" : "angle-down" })), index.h("ul", Object.assign({ key: '4b0ba76ad0eefa89c67b85bb8bb574133696e574' }, computedMenuAttributes, { class: menuClassList.join(' ') }), this.options.map((option, index$1) => {
473
+ index.h("admiralty-icon", { key: '2169c9d3827a9ec7be70d009656cee134340385f', class: `autocomplete-down-icon ${this.disabled ? "disabled" : ""}`, "icon-name": this.menuOpen || showNoOptionsFound ? "angle-up" : "angle-down" })), index.h("ul", Object.assign({ key: 'a46459188a4149fdee4cf9ee4b2e39f81756723a' }, computedMenuAttributes, { class: menuClassList.join(' ') }), this.options.map((option, index$1) => {
474
474
  const showFocused = this.focused === -1 ? this.selected === index$1 : this.focused === index$1;
475
475
  const optionModifierFocused = showFocused && this.hovered === null ? ` ${optionClassName}--focused` : '';
476
476
  const iosPosinsetHtml = isIosDevice()
@@ -482,7 +482,7 @@ const AutocompleteComponent = class {
482
482
  return (index.h("li", { "aria-selected": this.focused === index$1 ? 'true' : 'false', class: `${optionClassName}${optionModifierFocused}`, innerHTML: this.templateSuggestion(option.text) + iosPosinsetHtml, id: `${id}__option--${index$1}`, key: index$1, onBlur: event => this.handleOptionBlur(event, index$1), onClick: event => this.handleOptionClick(event, index$1), onMouseDown: event => this.handleOptionMouseDown(event), onMouseEnter: () => this.handleOptionMouseEnter(index$1), ref: optionEl => {
483
483
  this.elementReferences[index$1] = optionEl;
484
484
  }, role: "option", tabIndex: -1, "aria-posinset": index$1 + 1, "aria-setsize": this.options.length }));
485
- }), showNoOptionsFound && index.h("li", { key: 'aef863d0e03270176d2967cc4f98ee813063debc', class: `${optionClassName} ${optionClassName}--no-results` }, "No results found")), index.h("span", { key: 'bf9764e00280f22c3f0901e7e9276e7a9c1d5eae', id: assistiveHintID, style: { display: 'none' } }, this.assistiveHint), this.invalid && this.invalidMessage && (index.h("admiralty-input-invalid", { key: '6be96502d68013e546a9e33d0ccdede7462fbb19', id: errorId, style: { visibility: this.invalid && this.invalidMessage ? 'visible' : 'hidden' } }, this.invalidMessage))));
485
+ }), showNoOptionsFound && index.h("li", { key: 'd006b14b1ac0c953443e87c5407d476015b49988', class: `${optionClassName} ${optionClassName}--no-results` }, "No results found")), index.h("span", { key: 'a77fb4fe1d40c8e7ee1ee95d7387928d5f341093', id: assistiveHintID, style: { display: 'none' } }, this.assistiveHint), this.invalid && this.invalidMessage && (index.h("admiralty-input-invalid", { key: 'd784dd5fde4a2cdee858c308bcebb5ea6964c8c0', id: errorId, style: { visibility: this.invalid && this.invalidMessage ? 'visible' : 'hidden' } }, this.invalidMessage))));
486
486
  }
487
487
  get el() { return index.getElement(this); }
488
488
  static get watchers() { return {
@@ -1 +1 @@
1
- {"file":"admiralty-autocomplete.entry.cjs.js","mappings":";;;;;;AAAO,MAAM,eAAe,GAAG,CAAwB,WAAwB,EAAE,OAAe,EAAE,QAAqC;IACrI,IAAI,OAAO,gBAAgB,KAAK,WAAW,EAAE;QAC3C,OAAO;KACR;IAED,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,YAAY;QAChD,QAAQ,CAAC,iBAAiB,CAAI,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;KACvD,CAAC,CAAC;IACH,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE;QAC5B,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG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Ac,GAAG,SAAS,GAAG,QAAQ,EAAE,IACpH,IAAI,CAAC,cAAc,CACI,CAC3B,CACG,EACN;KACH;;;;;;;AAEH,IAAI,MAAM,GAAG,CAAC,CAAC;;;;;","names":["forceUpdate","index","h"],"sources":["src/components/autocomplete/optionsWatcher.ts","src/components/autocomplete/autocomplete.scss?tag=admiralty-autocomplete&encapsulation=scoped","src/components/autocomplete/autocomplete.tsx"],"sourcesContent":["export const watchForOptions = <T extends HTMLElement>(containerEl: HTMLElement, tagName: string, onChange: (el: T | undefined) => void) => {\n if (typeof MutationObserver === 'undefined') {\n return;\n }\n\n const mutation = new MutationObserver(mutationList => {\n onChange(getSelectedOption<T>(mutationList, tagName));\n });\n mutation.observe(containerEl, {\n childList: true,\n subtree: true,\n });\n return mutation;\n};\n\nconst getSelectedOption = <T extends HTMLElement>(mutationList: MutationRecord[], tagName: string): T | undefined => {\n let newOption: T | undefined;\n mutationList.forEach(mut => {\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < mut.addedNodes.length; i++) {\n newOption = findCheckedOption<T>(mut.addedNodes[i], tagName) || newOption;\n }\n });\n return newOption;\n};\n\n/**\n * The \"value\" key is only set on some components such as ion-select-option.\n * As a result, we create a default union type of HTMLElement and the \"value\" key.\n * However, implementers are required to provide the appropriate component type\n * such as HTMLIonSelectOptionElement.\n */\nexport const findCheckedOption = <T extends HTMLElement & { value?: any | null }>(node: Node, tagName: string) => {\n /**\n * https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType\n * The above check ensures \"node\" is an Element (nodeType 1).\n */\n if (node.nodeType !== 1) {\n return undefined;\n }\n\n // HTMLElement inherits from Element, so we cast \"el\" as T.\n const el = node as T;\n\n const options: T[] = el.tagName === tagName.toUpperCase() ? [el] : Array.from(el.querySelectorAll(tagName));\n\n return options.find((o: T) => o.value === el.value);\n};\n","@import './autocomplete.vars';\n\n.autocomplete__wrapper {\n position: relative;\n}\n\n.autocomplete__hint,\n.autocomplete__input {\n appearance: none;\n border: 2px solid $autocomplete-input-border-colour;\n border-radius: 0; /* Safari 10 on iOS adds implicit border rounding. */\n box-sizing: border-box;\n color: $autocomplete-text-colour;\n margin-bottom: 0; /* BUG: Safari 10 on macOS seems to add an implicit margin. */\n line-height: 1.5;\n width: 100%;\n}\n\n.autocomplete__label {\n background-color: transparent;\n position: relative;\n font-size: $autocomplete-label-font-size;\n}\n\n.autocomplete__input {\n background-color: transparent;\n position: relative;\n}\n\n.autocomplete__hint {\n color: $autocomplete-text-colour;\n position: absolute;\n}\n\n.autocomplete__input-wrapper {\n position: relative;\n}\n\n.autocomplete__input--default {\n padding: 12px;\n}\n\n.autocomplete__input--focused {\n outline: 3px solid $autocomplete-focus-colour;\n outline-offset: 0;\n box-shadow: inset 0 0 0 2px $autocomplete-text-colour;\n}\n\n.autocomplete__input--show-all-values {\n padding: 12px 35px 12px 12px; /* Space for arrow. Other padding should match .autocomplete__input--default. */\n cursor: pointer;\n}\n\n.autocomplete__input--invalid {\n border-color: $autocomplete-error-border-colour;\n}\n\n.autocomplete__input--disabled {\n border-color: $autocomplete-disabled-border-colour;\n}\n\n.autocomplete__menu {\n background-color: $autocomplete-background-colour;\n border: 2px solid $autocomplete-input-border-colour;\n border-top: 0;\n color: $autocomplete-text-colour;\n margin: 0;\n max-height: 342px;\n overflow-x: hidden;\n padding: 0;\n width: 100%;\n width: calc(100% - 4px);\n}\n\n.autocomplete__menu--visible {\n display: block;\n}\n\n.autocomplete__menu--hidden {\n display: none;\n}\n\n.autocomplete__menu--overlay {\n box-shadow: rgba(0, 0, 0, 0.256863) 0px 2px 6px;\n left: 0;\n position: absolute;\n top: 100%;\n z-index: 100;\n}\n\n.autocomplete__menu--inline {\n position: relative;\n}\n\n.autocomplete__option {\n border-bottom: solid $autocomplete-option-border-colour;\n border-width: 1px 0;\n color: $autocomplete-text-colour;\n cursor: pointer;\n display: block;\n position: relative;\n margin-bottom: 0;\n}\n\n.autocomplete__option:before {\n content: none;\n}\n\n.autocomplete__option > * {\n pointer-events: none;\n}\n\n.autocomplete__option:first-of-type {\n border-top-width: 0;\n}\n\n.autocomplete__option:last-of-type {\n border-bottom-width: 0;\n}\n\n.autocomplete__option--focused,\n.autocomplete__option:hover {\n background-color: $autocomplete-option-hover-background-colour;\n border-color: $autocomplete-option-hover-background-colour;\n color: $autocomplete-option-hover-text-colour;\n outline: none;\n}\n\n.autocomplete__option--no-results {\n background-color: $autocomplete-option-no-results-background-colour;\n color: $autocomplete-option-no-results-text-colour;\n text-align: center;\n\n margin-top: 50px;\n margin-bottom: 50px;\n cursor: not-allowed;\n}\n.autocomplete__option--no-results:hover {\n background-color: $autocomplete-option-no-results-background-colour;\n border-color: $autocomplete-option-no-results-background-colour;\n color: $autocomplete-option-no-results-text-colour;\n text-align: center;\n\n margin-top: 50px;\n margin-bottom: 50px;\n cursor: not-allowed;\n}\n\n.autocomplete__hint,\n.autocomplete__input,\n.autocomplete__option {\n font-size: $autocomplete-option-font-size;\n font-weight: $autocomplete-option-font-weight;\n}\n\n.autocomplete__hint,\n.autocomplete__option {\n padding: 10px;\n}\n\n.autocomplete-down-icon {\n font-size: $autocomplete-icon-font-size;\n font-weight: $autocomplete-icon-font-weight;\n pointer-events: none;\n position: absolute;\n right: 12px;\n top: 14px;\n}\n\nadmiralty-icon.disabled {\n color: $autocomplete-dropdown-icon-colour;\n}\n\nadmiralty-input-invalid {\n margin-top: 6px;\n}\n","/**\n * This component takes heavy inspiration from the autocomplete component created by alphagov: https://github.com/alphagov/accessible-autocomplete\n */\n\nimport { Component, forceUpdate, Prop, State, h, Element, EventEmitter, Event, Watch } from '@stencil/core';\nimport { watchForOptions } from './optionsWatcher';\nimport { AutoCompleteChangeEventDetail } from './autocomplete.interface';\n\ninterface Option {\n text: string;\n value: any;\n}\n\nconst keyCodes = {\n 13: 'enter',\n 27: 'escape',\n 32: 'space',\n 38: 'up',\n 40: 'down',\n};\n\nfunction isIosDevice() {\n return typeof navigator !== 'undefined' && !!(navigator.userAgent.match(/(iPod|iPhone|iPad)/g) && navigator.userAgent.match(/AppleWebKit/g));\n}\n\nfunction isPrintableKeyCode(keyCode) {\n return (\n (keyCode > 47 && keyCode < 58) || // number keys\n keyCode === 32 ||\n keyCode === 8 || // spacebar or backspace\n (keyCode > 64 && keyCode < 91) || // letter keys\n (keyCode > 95 && keyCode < 112) || // numpad keys\n (keyCode > 185 && keyCode < 193) || // ;=,-./` (in order)\n (keyCode > 218 && keyCode < 223) // [\\]' (in order)\n );\n}\n\nfunction filterOptions(options: Option[], searchTerm: string) {\n return options.filter(({ text }) => text.toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1);\n}\n\nfunction filterOptionsByValue(options: Option[], searchTerm: string) {\n return options.filter(({ value }) => value.toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1);\n}\n\n@Component({\n tag: 'admiralty-autocomplete',\n styleUrl: 'autocomplete.scss',\n scoped: true,\n})\nexport class AutocompleteComponent {\n private internalId = ++nextId;\n\n @Element() el!: HTMLAdmiraltyAutocompleteElement;\n\n /**\n * Automatically select the first matching option.\n */\n @Prop() autoselect: boolean = false;\n /**\n * The default CSS namespace.\n */\n @Prop() cssNamespace: string = 'autocomplete';\n /**\n * When set to `overlay` this option will display the menu as an absolutely positioned overlay instead of inline.\n */\n @Prop() displayMenu: string = 'inline';\n /**\n * Prevent displaying options until the minimum string length is reached. Ignored when show all values is enabled.\n */\n @Prop() minLength: number = 0;\n /**\n * The name for the `<input>` element.\n */\n @Prop() name: string;\n /**\n * Populate the placeholder attribute on the `<input>` element.\n */\n @Prop() placeholder: string = '';\n /**\n * Toggle automatically confirming a selection when the field is blurred.\n */\n @Prop() confirmOnBlur: boolean = true;\n /**\n * Toggle whether to display the \"No results found\" message.\n */\n @Prop() showNoOptionsFound: boolean = true;\n /**\n * Toggle showing all values when the input is clicked, like a default dropdown. This will hide the chevron when set to false.\n */\n @Prop() showAllValues: boolean = true;\n /**\n * Populates the required field on the `<input>` element.\n */\n @Prop() required: boolean = false;\n /**\n * The hint that is provided to assistive users.\n */\n @Prop() assistiveHint: string =\n 'When autocomplete results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures.';\n\n /**\n * Sets HTML attributes and their values on the generated `ul` menu element. Useful for adding `aria-labelledby`\n * and setting to the value of the `id` attribute on your existing label, to provide context to an assistive\n * technology user. e.g.\n * ```\n * const menuAttributes = {\n * className: 'custom-className',\n * class: 'custom-class',\n * id: 'custom-id',\n * role: 'custom-role'\n * }\n * ```\n * */\n @Prop() menuAttributes: any;\n /**\n * Classes to add to the component's `<input>` element.\n */\n @Prop() inputClasses: string;\n /**\n * Classes to add to the menu displaying the options.\n */\n @Prop() menuClasses: string;\n /**\n * The text that will be used as a field label.\n */\n @Prop() label: string = null;\n /**\n * TThe text which will be used under the label to describe the input.\n */\n @Prop() hint: string = null;\n /**\n * Whether to show that the component is in an invalid state.\n */\n @Prop() invalid: boolean = false;\n /**\n * The message to show when the component is invalid.\n */\n @Prop() invalidMessage: string = null;\n /**\n * When `true`, the component cannot be interacted with.\n */\n @Prop() disabled: boolean = false;\n /**\n * The value of the input.\n */\n @Prop({ mutable: true }) value?: string | null = null;\n\n /**\n * Emitted when the value has changed.\n */\n @Event() admiraltyChange: EventEmitter<AutoCompleteChangeEventDetail>;\n\n elementReferences = {};\n $pollInput: NodeJS.Timeout;\n\n source: Option[] = [];\n\n @State() focused: number | null = null;\n @State() hovered: number | null = null;\n @State() menuOpen: boolean = false;\n @State() options: Option[] = [];\n @State() option: Option = null;\n @State() query: string = null;\n @State() validChoiceMade: boolean = false;\n @State() selected: number | null = null;\n @State() ariaHint: boolean = true;\n\n @Watch('value')\n onValueChange(newVal: string, _: string) {\n if (this.source.length === 0) {\n // If this is the initial render, the options won't have been set yet, so do nothing\n return;\n }\n if (newVal && newVal.length > 0) {\n const matches = filterOptionsByValue(this.source, newVal);\n const matchFound = matches.length > 0;\n this.options = matches;\n this.validChoiceMade = matchFound;\n this.option = matches[0];\n this.query = matchFound ? matches[0].text : '';\n this.menuOpen = false;\n this.ariaHint = false;\n } else {\n this.options = [];\n this.option = null;\n this.query = '';\n this.ariaHint = true;\n }\n\n this.admiraltyChange.emit({ value: this.option?.value ?? '' });\n }\n\n @Watch('focused')\n onFocusedChange(newVal: number | null, oldVal: number | null) {\n const componentLostFocus = this.focused === null;\n const focusedChanged = oldVal !== newVal;\n const focusDifferentElement = focusedChanged && !componentLostFocus;\n if (focusDifferentElement) {\n this.elementReferences[this.focused]?.focus();\n }\n const focusedInput = this.focused === -1;\n const componentGainedFocus = focusedChanged && oldVal === null;\n const selectAllText = focusedInput && componentGainedFocus;\n if (selectAllText) {\n const inputElement = this.elementReferences[this.focused];\n inputElement.setSelectionRange(0, inputElement.value.length);\n }\n }\n\n isQueryAnOption(query: string, options: Option[]) {\n return options.map(({ text }) => this.templateInputValue(text).toLowerCase()).indexOf(query.toLowerCase()) !== -1;\n }\n\n connectedCallback() {\n this.mutation = watchForOptions<HTMLAdmiraltyAutocompleteOptionElement>(this.el, 'admiralty-autocomplete-option', async () => {\n this.source = this.childOpts.map(({ textContent, value }) => ({\n text: textContent?.length > 0 ? textContent : value,\n value: value ?? textContent,\n }));\n if (this.query === null && this.value?.length > 0) {\n const matches = filterOptionsByValue(this.source, this.value);\n this.options = matches;\n this.option = matches[0];\n this.query = matches[0]?.text ?? '';\n }\n forceUpdate(this);\n });\n // this.pollInputElement();\n }\n\n disconnectedCallback() {\n clearTimeout(this.$pollInput);\n }\n\n // Applications like Dragon NaturallySpeaking will modify the\n // `input` field by directly changing its `.value`. These events\n // don't trigger our JavaScript event listeners, so we need to poll\n // to handle when and if they occur.\n pollInputElement() {\n this.getDirectInputChanges();\n this.$pollInput = setTimeout(() => {\n this.pollInputElement();\n }, 100);\n }\n\n getDirectInputChanges() {\n const inputReference = this.elementReferences[-1];\n const queryHasChanged = inputReference && inputReference.value !== this.query;\n\n if (queryHasChanged) {\n this.handleInputChange({ target: { value: inputReference.value } });\n }\n }\n\n mutation: MutationObserver;\n\n private get childOpts() {\n return Array.from(this.el.querySelectorAll('admiralty-autocomplete-option'));\n }\n\n hasAutoselect() {\n return isIosDevice() ? false : this.autoselect;\n }\n\n // This template is used when converting from a state.options object into a state.query.\n templateInputValue(value) {\n // const inputValueTemplate = this.templates && this.templates.inputValue;\n // return inputValueTemplate ? inputValueTemplate(value) : value;\n return value;\n }\n\n // This template is used when displaying results / suggestions.\n templateSuggestion(value) {\n // const suggestionTemplate = this.templates && this.templates.suggestion;\n // return suggestionTemplate ? suggestionTemplate(value) : value;\n return value;\n }\n\n handleComponentBlur(newState: { menuOpen: boolean; query: string }) {\n let newQuery: string;\n if (this.confirmOnBlur) {\n newQuery = newState.query || this.query;\n const matches = filterOptions(this.source, newQuery);\n const matchFound = newQuery?.length > 0 && matches.length > 0;\n const option = matchFound ? matches[0] : { value: null, text: '' };\n this.value = option.value;\n } else {\n newQuery = this.query;\n }\n this.focused = null;\n this.menuOpen = newState.menuOpen || false;\n this.selected = null;\n this.validChoiceMade = this.isQueryAnOption(newQuery, this.options);\n }\n\n handleListMouseLeave() {\n this.hovered = null;\n }\n\n handleOptionBlur(event, index) {\n const focusingOutsideComponent = event.relatedTarget === null;\n const focusingInput = event.relatedTarget === this.elementReferences[-1];\n const focusingAnotherOption = this.focused !== index && this.focused !== -1;\n const blurComponent = (!focusingAnotherOption && focusingOutsideComponent) || !(focusingAnotherOption || focusingInput);\n if (blurComponent) {\n const keepMenuOpen = this.menuOpen && isIosDevice();\n this.handleComponentBlur({\n menuOpen: keepMenuOpen,\n query: this.templateInputValue(this.options[this.selected]?.text ?? ''),\n });\n }\n }\n\n handleInputBlur(_) {\n const focusingAnOption = this.focused !== -1;\n if (!focusingAnOption) {\n const keepMenuOpen = this.menuOpen && isIosDevice();\n this.handleComponentBlur({\n menuOpen: keepMenuOpen,\n query: this.query,\n });\n }\n }\n\n handleInputChange(event) {\n const autoselect = this.hasAutoselect();\n const query = event.target.value;\n const queryEmpty = query.length === 0;\n const queryChanged = this.query !== query;\n const queryLongEnough = query.length >= this.minLength;\n\n this.query = query;\n this.ariaHint = queryEmpty;\n\n const searchForOptions = this.showAllValues || (!queryEmpty && queryChanged && queryLongEnough);\n if (searchForOptions) {\n const matches = filterOptions(this.source, this.query);\n const optionsAvailable = matches.length > 0;\n this.menuOpen = optionsAvailable;\n this.options = matches;\n this.selected = autoselect && optionsAvailable ? 0 : -1;\n this.validChoiceMade = false;\n } else if (queryEmpty || !queryLongEnough) {\n this.menuOpen = false;\n this.options = [];\n }\n }\n\n handleInputClick(event) {\n this.handleInputChange(event);\n }\n\n handleInputFocus(_) {\n const shouldReopenMenu = !this.validChoiceMade && this.query?.length >= this.minLength && this.options.length > 0;\n\n if (shouldReopenMenu) {\n this.focused = -1;\n this.menuOpen = shouldReopenMenu || this.menuOpen;\n this.selected = -1;\n } else {\n this.focused = -1;\n }\n }\n\n handleOptionFocus(index) {\n this.focused = index;\n this.hovered = null;\n this.selected = index;\n }\n\n handleOptionMouseEnter(index) {\n // iOS Safari prevents click event if mouseenter adds hover background colour\n // See: https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW4\n if (!isIosDevice()) {\n this.hovered = index;\n }\n }\n\n handleOptionClick(_, index) {\n const selectedOption = this.options[index];\n this.value = selectedOption.value;\n this.focused = -1;\n this.hovered = null;\n this.menuOpen = false;\n this.selected = index;\n this.validChoiceMade = true;\n forceUpdate(this);\n }\n\n handleOptionMouseDown(event) {\n // Safari triggers focusOut before click, but if you\n // preventDefault on mouseDown, you can stop that from happening.\n // If this is removed, clicking on an option in Safari will trigger\n // `handleOptionBlur`, which closes the menu, and the click will\n // trigger on the element underneath instead.\n // See: http://stackoverflow.com/questions/7621711/how-to-prevent-blur-running-when-clicking-a-link-in-jquery\n event.preventDefault();\n }\n\n handleUpArrow(event) {\n event.preventDefault();\n const isNotAtTop = this.selected !== -1;\n const allowMoveUp = isNotAtTop && this.menuOpen;\n if (allowMoveUp) {\n this.handleOptionFocus(this.selected - 1);\n }\n }\n\n handleDownArrow(event) {\n event.preventDefault();\n // if not open, open\n if (this.showAllValues && this.menuOpen === false) {\n event.preventDefault();\n const matches = filterOptions(this.source, '');\n this.menuOpen = true;\n this.options = matches;\n this.selected = 0;\n this.focused = 0;\n this.hovered = null;\n } else if (this.menuOpen === true) {\n const isNotAtBottom = this.selected !== this.options.length - 1;\n const allowMoveDown = isNotAtBottom && this.menuOpen;\n if (allowMoveDown) {\n this.handleOptionFocus(this.selected + 1);\n }\n }\n }\n\n handleSpace(event) {\n // if not open, open\n if (this.showAllValues && this.menuOpen === false && this.query === '') {\n event.preventDefault();\n const matches = filterOptions(this.source, '');\n this.menuOpen = true;\n this.options = matches;\n }\n const focusIsOnOption = this.focused !== -1;\n if (focusIsOnOption) {\n event.preventDefault();\n this.handleOptionClick(event, this.focused);\n }\n }\n\n handleEnter(event) {\n if (this.menuOpen) {\n event.preventDefault();\n const hasSelectedOption = this.selected >= 0;\n if (hasSelectedOption) {\n this.handleOptionClick(event, this.selected);\n }\n }\n }\n\n handlePrintableKey(event) {\n const inputElement = this.elementReferences[-1];\n const eventIsOnInput = event.target === inputElement;\n if (!eventIsOnInput) {\n // FIXME: This would be better if it was in componentDidUpdate,\n // but using setState to trigger that seems to not work correctly\n // in preact@8.1.0.\n inputElement.focus();\n }\n }\n\n handleKeyDown(event) {\n switch (keyCodes[event.keyCode]) {\n case 'up':\n this.handleUpArrow(event);\n break;\n case 'down':\n this.handleDownArrow(event);\n break;\n case 'space':\n this.handleSpace(event);\n break;\n case 'enter':\n this.handleEnter(event);\n break;\n case 'escape':\n this.handleComponentBlur({\n query: this.query,\n menuOpen: this.menuOpen,\n });\n break;\n default:\n if (isPrintableKeyCode(event.keyCode)) {\n this.handlePrintableKey(event);\n }\n break;\n }\n }\n\n render() {\n const id = this.el.id != '' ? this.el.id : `admiralty-autocomplete-${this.internalId}`;\n const inputId = `${id}-input`;\n const hintId = `${id}-hint`;\n const errorId = `${id}-error`;\n\n const inputFocused = this.focused === -1;\n const noOptionsAvailable = this.options.length === 0;\n const queryNotEmpty = this.query?.length !== 0;\n const queryLongEnough = this.query?.length >= this.minLength;\n const showNoOptionsFound = this.showNoOptionsFound && inputFocused && noOptionsAvailable && queryNotEmpty && queryLongEnough;\n\n const wrapperClassName = `${this.cssNamespace}__wrapper`;\n const optionFocused = this.focused !== -1 && this.focused !== null;\n\n const optionClassName = `${this.cssNamespace}__option`;\n\n const assistiveHintID = id + '__assistiveHint';\n const ariaProps = {\n 'aria-describedby': `${this.hint ? hintId : ''} ${this.ariaHint ? assistiveHintID : ''} ${this.invalid ? errorId : ''}`,\n 'aria-expanded': this.menuOpen ? 'true' : 'false',\n 'aria-activedescendant': optionFocused ? `${id}__option--${this.focused}` : null,\n 'aria-owns': `${id}__listbox`,\n 'aria-autocomplete': this.hasAutoselect() ? 'both' : 'list',\n };\n\n const inputClassName = `${this.cssNamespace}__input`;\n const inputClassList = [inputClassName, this.showAllValues ? `${inputClassName}--show-all-values` : `${inputClassName}--default`];\n\n const componentIsFocused = this.focused !== null;\n if (componentIsFocused) {\n inputClassList.push(`${inputClassName}--focused`);\n }\n\n if (this.inputClasses) {\n inputClassList.push(this.inputClasses);\n }\n\n if (this.invalid && this.invalidMessage) {\n inputClassList.push(`${inputClassName}--invalid`);\n }\n\n if (this.disabled) {\n inputClassList.push(`${inputClassName}--disabled`);\n }\n\n const menuClassName = `${this.cssNamespace}__menu`;\n const menuModifierDisplayMenu = `${menuClassName}--${this.displayMenu}`;\n const menuIsVisible = this.menuOpen || showNoOptionsFound;\n const menuModifierVisibility = `${menuClassName}--${menuIsVisible ? 'visible' : 'hidden'}`;\n\n const menuClassList = [menuClassName, menuModifierDisplayMenu, menuModifierVisibility];\n\n if (this.menuClasses) {\n menuClassList.push(this.menuClasses);\n }\n\n if (this.menuAttributes?.class || this.menuAttributes?.className) {\n menuClassList.push(this.menuAttributes?.class || this.menuAttributes?.className);\n }\n\n const computedMenuAttributes = {\n // Copy the attributes passed as props\n ...this.menuAttributes,\n // And add the values computed for the autocomplete\n id: `${id}__listbox`,\n role: 'listbox',\n onMouseLeave: this.handleListMouseLeave,\n };\n\n // Preact would override our computed `className`\n // with the `class` from the `menuAttributes` so\n // we need to clean it up from the computed attributes\n delete computedMenuAttributes.class;\n\n return (\n <div class={wrapperClassName} onKeyDown={event => this.handleKeyDown(event)}>\n {this.label ? (\n <admiralty-label class=\"autocomplete__label\" disabled={this.disabled} for={inputId}>\n {this.label}\n </admiralty-label>\n ) : null}\n {this.hint ? (\n <admiralty-hint id={hintId} disabled={this.disabled}>\n {this.hint}\n </admiralty-hint>\n ) : null}\n <div class=\"autocomplete__input-wrapper\">\n <input\n {...ariaProps}\n disabled={this.disabled}\n aria-disabled={this.disabled}\n autoComplete=\"off\"\n class={inputClassList.join(' ')}\n id={inputId}\n onClick={event => this.handleInputClick(event)}\n onBlur={event => this.handleInputBlur(event)}\n onInput={event => this.handleInputChange(event)}\n onFocus={event => this.handleInputFocus(event)}\n name={this.name}\n placeholder={this.placeholder}\n ref={inputElement => {\n this.elementReferences[-1] = inputElement;\n }}\n type=\"text\"\n role=\"combobox\"\n required={this.required}\n value={this.query}\n />\n {this.showAllValues &&\n <admiralty-icon class={`autocomplete-down-icon ${this.disabled ? \"disabled\" : \"\"}`} icon-name={this.menuOpen || showNoOptionsFound ? \"angle-up\" : \"angle-down\"} />\n }\n </div>\n\n <ul {...computedMenuAttributes} class={menuClassList.join(' ')}>\n {this.options.map((option, index) => {\n const showFocused = this.focused === -1 ? this.selected === index : this.focused === index;\n const optionModifierFocused = showFocused && this.hovered === null ? ` ${optionClassName}--focused` : '';\n const iosPosinsetHtml = isIosDevice()\n ? `<span id=${id}__option-suffix--${index} style=\"border:0;clip:rect(0 0 0 0);height:1px;` +\n 'marginBottom:-1px;marginRight:-1px;overflow:hidden;padding:0;position:absolute;' +\n 'whiteSpace:nowrap;width:1px\">' +\n ` ${index + 1} of ${this.options.length}</span>`\n : '';\n\n return (\n <li\n aria-selected={this.focused === index ? 'true' : 'false'}\n class={`${optionClassName}${optionModifierFocused}`}\n innerHTML={this.templateSuggestion(option.text) + iosPosinsetHtml}\n id={`${id}__option--${index}`}\n key={index}\n onBlur={event => this.handleOptionBlur(event, index)}\n onClick={event => this.handleOptionClick(event, index)}\n onMouseDown={event => this.handleOptionMouseDown(event)}\n onMouseEnter={() => this.handleOptionMouseEnter(index)}\n ref={optionEl => {\n this.elementReferences[index] = optionEl;\n }}\n role=\"option\"\n tabIndex={-1}\n aria-posinset={index + 1}\n aria-setsize={this.options.length}\n />\n );\n })}\n\n {showNoOptionsFound && <li class={`${optionClassName} ${optionClassName}--no-results`}>No results found</li>}\n </ul>\n\n <span id={assistiveHintID} style={{ display: 'none' }}>\n {this.assistiveHint}\n </span>\n {this.invalid && this.invalidMessage && (\n <admiralty-input-invalid id={errorId} style={{ visibility: this.invalid && this.invalidMessage ? 'visible' : 'hidden' }}>\n {this.invalidMessage}\n </admiralty-input-invalid>\n )}\n </div>\n );\n }\n}\nlet nextId = 0;\n"],"version":3}
1
+ {"file":"admiralty-autocomplete.entry.cjs.js","mappings":";;;;;;AAAO,MAAM,eAAe,GAAG,CAAwB,WAAwB,EAAE,OAAe,EAAE,QAAqC;IACrI,IAAI,OAAO,gBAAgB,KAAK,WAAW,EAAE;QAC3C,OAAO;KACR;IAED,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,YAAY;QAChD,QAAQ,CAAC,iBAAiB,CAAI,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;KACvD,CAAC,CAAC;IACH,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE;QAC5B,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAwB,YAA8B,EAAE,OAAe;IAC/F,IAAI,SAAwB,CAAC;IAC7B,YAAY,CAAC,OAAO,CAAC,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C3B,CACG,EACN;KACH;;;;;;;AAEH,IAAI,MAAM,GAAG,CAAC,CAAC;;;;;","names":["forceUpdate","index","h"],"sources":["src/components/autocomplete/optionsWatcher.ts","src/components/autocomplete/autocomplete.scss?tag=admiralty-autocomplete&encapsulation=scoped","src/components/autocomplete/autocomplete.tsx"],"sourcesContent":["export const watchForOptions = <T extends HTMLElement>(containerEl: HTMLElement, tagName: string, onChange: (el: T | undefined) => void) => {\n if (typeof MutationObserver === 'undefined') {\n return;\n }\n\n const mutation = new MutationObserver(mutationList => {\n onChange(getSelectedOption<T>(mutationList, tagName));\n });\n mutation.observe(containerEl, {\n childList: true,\n subtree: true,\n });\n return mutation;\n};\n\nconst getSelectedOption = <T extends HTMLElement>(mutationList: MutationRecord[], tagName: string): T | undefined => {\n let newOption: T | undefined;\n mutationList.forEach(mut => {\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < mut.addedNodes.length; i++) {\n newOption = findCheckedOption<T>(mut.addedNodes[i], tagName) || newOption;\n }\n });\n return newOption;\n};\n\n/**\n * The \"value\" key is only set on some components such as ion-select-option.\n * As a result, we create a default union type of HTMLElement and the \"value\" key.\n * However, implementers are required to provide the appropriate component type\n * such as HTMLIonSelectOptionElement.\n */\nexport const findCheckedOption = <T extends HTMLElement & { value?: any | null }>(node: Node, tagName: string) => {\n /**\n * https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType\n * The above check ensures \"node\" is an Element (nodeType 1).\n */\n if (node.nodeType !== 1) {\n return undefined;\n }\n\n // HTMLElement inherits from Element, so we cast \"el\" as T.\n const el = node as T;\n\n const options: T[] = el.tagName === tagName.toUpperCase() ? [el] : Array.from(el.querySelectorAll(tagName));\n\n return options.find((o: T) => o.value === el.value);\n};\n","@import './autocomplete.vars';\n\n.autocomplete__wrapper {\n position: relative;\n}\n\n.autocomplete__hint,\n.autocomplete__input {\n appearance: none;\n border: 2px solid $autocomplete-input-border-colour;\n border-radius: 0; /* Safari 10 on iOS adds implicit border rounding. */\n box-sizing: border-box;\n color: $autocomplete-text-colour;\n margin-bottom: 0; /* BUG: Safari 10 on macOS seems to add an implicit margin. */\n line-height: 1.5;\n width: 100%;\n}\n\n.autocomplete__label {\n background-color: transparent;\n position: relative;\n font-size: $autocomplete-label-font-size;\n}\n\n.autocomplete__input {\n background-color: transparent;\n position: relative;\n}\n\n.autocomplete__hint {\n color: $autocomplete-text-colour;\n position: absolute;\n}\n\n.autocomplete__input-wrapper {\n position: relative;\n}\n\n.autocomplete__input--default {\n padding: 12px;\n}\n\n.autocomplete__input--focused {\n outline: 3px solid $autocomplete-focus-colour;\n outline-offset: 0;\n box-shadow: inset 0 0 0 2px $autocomplete-text-colour;\n}\n\n.autocomplete__input--show-all-values {\n padding: 12px 35px 12px 12px; /* Space for arrow. Other padding should match .autocomplete__input--default. */\n cursor: pointer;\n}\n\n.autocomplete__input--invalid {\n border-color: $autocomplete-error-border-colour;\n}\n\n.autocomplete__input--disabled {\n border-color: $autocomplete-disabled-border-colour;\n}\n\n.autocomplete__menu {\n background-color: $autocomplete-background-colour;\n border: 2px solid $autocomplete-input-border-colour;\n border-top: 0;\n color: $autocomplete-text-colour;\n margin: 0;\n max-height: 342px;\n overflow-x: hidden;\n padding: 0;\n width: 100%;\n width: calc(100% - 4px);\n}\n\n.autocomplete__menu--visible {\n display: block;\n}\n\n.autocomplete__menu--hidden {\n display: none;\n}\n\n.autocomplete__menu--overlay {\n box-shadow: rgba(0, 0, 0, 0.256863) 0px 2px 6px;\n left: 0;\n position: absolute;\n top: 100%;\n z-index: 100;\n}\n\n.autocomplete__menu--inline {\n position: relative;\n}\n\n.autocomplete__option {\n border-bottom: solid $autocomplete-option-border-colour;\n border-width: 1px 0;\n color: $autocomplete-text-colour;\n cursor: pointer;\n display: block;\n position: relative;\n margin-bottom: 0;\n}\n\n.autocomplete__option:before {\n content: none;\n}\n\n.autocomplete__option > * {\n pointer-events: none;\n}\n\n.autocomplete__option:first-of-type {\n border-top-width: 0;\n}\n\n.autocomplete__option:last-of-type {\n border-bottom-width: 0;\n}\n\n.autocomplete__option--focused,\n.autocomplete__option:hover {\n background-color: $autocomplete-option-hover-background-colour;\n border-color: $autocomplete-option-hover-background-colour;\n color: $autocomplete-option-hover-text-colour;\n outline: none;\n}\n\n.autocomplete__option--no-results {\n background-color: $autocomplete-option-no-results-background-colour;\n color: $autocomplete-option-no-results-text-colour;\n text-align: center;\n\n margin-top: 50px;\n margin-bottom: 50px;\n cursor: not-allowed;\n}\n.autocomplete__option--no-results:hover {\n background-color: $autocomplete-option-no-results-background-colour;\n border-color: $autocomplete-option-no-results-background-colour;\n color: $autocomplete-option-no-results-text-colour;\n text-align: center;\n\n margin-top: 50px;\n margin-bottom: 50px;\n cursor: not-allowed;\n}\n\n.autocomplete__hint,\n.autocomplete__input,\n.autocomplete__option {\n font-size: $autocomplete-option-font-size;\n font-weight: $autocomplete-option-font-weight;\n}\n\n.autocomplete__hint,\n.autocomplete__option {\n padding: 10px;\n}\n\n.autocomplete-down-icon {\n font-size: $autocomplete-icon-font-size;\n font-weight: $autocomplete-icon-font-weight;\n pointer-events: none;\n position: absolute;\n right: 12px;\n top: 14px;\n}\n\nadmiralty-icon.disabled {\n color: $autocomplete-dropdown-icon-colour;\n}\n\nadmiralty-input-invalid {\n margin-top: 6px;\n}\n","/**\n * This component takes heavy inspiration from the autocomplete component created by alphagov: https://github.com/alphagov/accessible-autocomplete\n */\n\nimport { Component, forceUpdate, Prop, State, h, Element, EventEmitter, Event, Watch } from '@stencil/core';\nimport { watchForOptions } from './optionsWatcher';\nimport { AutoCompleteChangeEventDetail } from './autocomplete.interface';\n\ninterface Option {\n text: string;\n value: any;\n}\n\nconst keyCodes = {\n 13: 'enter',\n 27: 'escape',\n 32: 'space',\n 38: 'up',\n 40: 'down',\n};\n\nfunction isIosDevice() {\n return typeof navigator !== 'undefined' && !!(navigator.userAgent.match(/(iPod|iPhone|iPad)/g) && navigator.userAgent.match(/AppleWebKit/g));\n}\n\nfunction isPrintableKeyCode(keyCode) {\n return (\n (keyCode > 47 && keyCode < 58) || // number keys\n keyCode === 32 ||\n keyCode === 8 || // spacebar or backspace\n (keyCode > 64 && keyCode < 91) || // letter keys\n (keyCode > 95 && keyCode < 112) || // numpad keys\n (keyCode > 185 && keyCode < 193) || // ;=,-./` (in order)\n (keyCode > 218 && keyCode < 223) // [\\]' (in order)\n );\n}\n\nfunction filterOptions(options: Option[], searchTerm: string) {\n return options.filter(({ text }) => text.toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1);\n}\n\nfunction filterOptionsByValue(options: Option[], searchTerm: string) {\n return options.filter(({ value }) => value.toString().toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1);\n}\n\n@Component({\n tag: 'admiralty-autocomplete',\n styleUrl: 'autocomplete.scss',\n scoped: true,\n})\nexport class AutocompleteComponent {\n private internalId = ++nextId;\n\n @Element() el!: HTMLAdmiraltyAutocompleteElement;\n\n /**\n * Automatically select the first matching option.\n */\n @Prop() autoselect: boolean = false;\n /**\n * The default CSS namespace.\n */\n @Prop() cssNamespace: string = 'autocomplete';\n /**\n * When set to `overlay` this option will display the menu as an absolutely positioned overlay instead of inline.\n */\n @Prop() displayMenu: string = 'inline';\n /**\n * Prevent displaying options until the minimum string length is reached. Ignored when show all values is enabled.\n */\n @Prop() minLength: number = 0;\n /**\n * The name for the `<input>` element.\n */\n @Prop() name: string;\n /**\n * Populate the placeholder attribute on the `<input>` element.\n */\n @Prop() placeholder: string = '';\n /**\n * Toggle automatically confirming a selection when the field is blurred.\n */\n @Prop() confirmOnBlur: boolean = true;\n /**\n * Toggle whether to display the \"No results found\" message.\n */\n @Prop() showNoOptionsFound: boolean = true;\n /**\n * Toggle showing all values when the input is clicked, like a default dropdown. This will hide the chevron when set to false.\n */\n @Prop() showAllValues: boolean = true;\n /**\n * Populates the required field on the `<input>` element.\n */\n @Prop() required: boolean = false;\n /**\n * The hint that is provided to assistive users.\n */\n @Prop() assistiveHint: string =\n 'When autocomplete results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures.';\n\n /**\n * Sets HTML attributes and their values on the generated `ul` menu element. Useful for adding `aria-labelledby`\n * and setting to the value of the `id` attribute on your existing label, to provide context to an assistive\n * technology user. e.g.\n * ```\n * const menuAttributes = {\n * className: 'custom-className',\n * class: 'custom-class',\n * id: 'custom-id',\n * role: 'custom-role'\n * }\n * ```\n * */\n @Prop() menuAttributes: any;\n /**\n * Classes to add to the component's `<input>` element.\n */\n @Prop() inputClasses: string;\n /**\n * Classes to add to the menu displaying the options.\n */\n @Prop() menuClasses: string;\n /**\n * The text that will be used as a field label.\n */\n @Prop() label: string = null;\n /**\n * TThe text which will be used under the label to describe the input.\n */\n @Prop() hint: string = null;\n /**\n * Whether to show that the component is in an invalid state.\n */\n @Prop() invalid: boolean = false;\n /**\n * The message to show when the component is invalid.\n */\n @Prop() invalidMessage: string = null;\n /**\n * When `true`, the component cannot be interacted with.\n */\n @Prop() disabled: boolean = false;\n /**\n * The value of the input.\n */\n @Prop({ mutable: true }) value?: string | null = null;\n\n /**\n * Emitted when the value has changed.\n */\n @Event() admiraltyChange: EventEmitter<AutoCompleteChangeEventDetail>;\n\n elementReferences = {};\n $pollInput: NodeJS.Timeout;\n\n source: Option[] = [];\n\n @State() focused: number | null = null;\n @State() hovered: number | null = null;\n @State() menuOpen: boolean = false;\n @State() options: Option[] = [];\n @State() option: Option = null;\n @State() query: string = null;\n @State() validChoiceMade: boolean = false;\n @State() selected: number | null = null;\n @State() ariaHint: boolean = true;\n\n @Watch('value')\n onValueChange(newVal: string, _: string) {\n if (this.source.length === 0) {\n // If this is the initial render, the options won't have been set yet, so do nothing\n return;\n }\n if (newVal && newVal.length > 0) {\n const matches = filterOptionsByValue(this.source, newVal);\n const matchFound = matches.length > 0;\n this.options = matches;\n this.validChoiceMade = matchFound;\n this.option = matches[0];\n this.query = matchFound ? matches[0].text : '';\n this.menuOpen = false;\n this.ariaHint = false;\n } else {\n this.options = [];\n this.option = null;\n this.query = '';\n this.ariaHint = true;\n }\n\n this.admiraltyChange.emit({ value: this.option?.value ?? '' });\n }\n\n @Watch('focused')\n onFocusedChange(newVal: number | null, oldVal: number | null) {\n const componentLostFocus = this.focused === null;\n const focusedChanged = oldVal !== newVal;\n const focusDifferentElement = focusedChanged && !componentLostFocus;\n if (focusDifferentElement) {\n this.elementReferences[this.focused]?.focus();\n }\n const focusedInput = this.focused === -1;\n const componentGainedFocus = focusedChanged && oldVal === null;\n const selectAllText = focusedInput && componentGainedFocus;\n if (selectAllText) {\n const inputElement = this.elementReferences[this.focused];\n inputElement.setSelectionRange(0, inputElement.value.length);\n }\n }\n\n isQueryAnOption(query: string, options: Option[]) {\n return options.map(({ text }) => this.templateInputValue(text).toLowerCase()).indexOf(query.toLowerCase()) !== -1;\n }\n\n connectedCallback() {\n this.mutation = watchForOptions<HTMLAdmiraltyAutocompleteOptionElement>(this.el, 'admiralty-autocomplete-option', async () => {\n this.source = this.childOpts.map(({ textContent, value }) => ({\n text: textContent?.length > 0 ? textContent : value,\n value: value ?? textContent,\n }));\n if (this.query === null && this.value?.length > 0) {\n const matches = filterOptionsByValue(this.source, this.value);\n this.options = matches;\n this.option = matches[0];\n this.query = matches[0]?.text ?? '';\n }\n forceUpdate(this);\n });\n // this.pollInputElement();\n }\n\n disconnectedCallback() {\n clearTimeout(this.$pollInput);\n }\n\n // Applications like Dragon NaturallySpeaking will modify the\n // `input` field by directly changing its `.value`. These events\n // don't trigger our JavaScript event listeners, so we need to poll\n // to handle when and if they occur.\n pollInputElement() {\n this.getDirectInputChanges();\n this.$pollInput = setTimeout(() => {\n this.pollInputElement();\n }, 100);\n }\n\n getDirectInputChanges() {\n const inputReference = this.elementReferences[-1];\n const queryHasChanged = inputReference && inputReference.value !== this.query;\n\n if (queryHasChanged) {\n this.handleInputChange({ target: { value: inputReference.value } });\n }\n }\n\n mutation: MutationObserver;\n\n private get childOpts() {\n return Array.from(this.el.querySelectorAll('admiralty-autocomplete-option'));\n }\n\n hasAutoselect() {\n return isIosDevice() ? false : this.autoselect;\n }\n\n // This template is used when converting from a state.options object into a state.query.\n templateInputValue(value) {\n // const inputValueTemplate = this.templates && this.templates.inputValue;\n // return inputValueTemplate ? inputValueTemplate(value) : value;\n return value;\n }\n\n // This template is used when displaying results / suggestions.\n templateSuggestion(value) {\n // const suggestionTemplate = this.templates && this.templates.suggestion;\n // return suggestionTemplate ? suggestionTemplate(value) : value;\n return value;\n }\n\n handleComponentBlur(newState: { menuOpen: boolean; query: string }) {\n let newQuery: string;\n if (this.confirmOnBlur) {\n newQuery = newState.query || this.query;\n const matches = filterOptions(this.source, newQuery);\n const matchFound = newQuery?.length > 0 && matches.length > 0;\n const option = matchFound ? matches[0] : { value: null, text: '' };\n this.value = option.value;\n } else {\n newQuery = this.query;\n }\n this.focused = null;\n this.menuOpen = newState.menuOpen || false;\n this.selected = null;\n this.validChoiceMade = this.isQueryAnOption(newQuery, this.options);\n }\n\n handleListMouseLeave() {\n this.hovered = null;\n }\n\n handleOptionBlur(event, index) {\n const focusingOutsideComponent = event.relatedTarget === null;\n const focusingInput = event.relatedTarget === this.elementReferences[-1];\n const focusingAnotherOption = this.focused !== index && this.focused !== -1;\n const blurComponent = (!focusingAnotherOption && focusingOutsideComponent) || !(focusingAnotherOption || focusingInput);\n if (blurComponent) {\n const keepMenuOpen = this.menuOpen && isIosDevice();\n this.handleComponentBlur({\n menuOpen: keepMenuOpen,\n query: this.templateInputValue(this.options[this.selected]?.text ?? ''),\n });\n }\n }\n\n handleInputBlur(_) {\n const focusingAnOption = this.focused !== -1;\n if (!focusingAnOption) {\n const keepMenuOpen = this.menuOpen && isIosDevice();\n this.handleComponentBlur({\n menuOpen: keepMenuOpen,\n query: this.query,\n });\n }\n }\n\n handleInputChange(event) {\n const autoselect = this.hasAutoselect();\n const query = event.target.value;\n const queryEmpty = query.length === 0;\n const queryChanged = this.query !== query;\n const queryLongEnough = query.length >= this.minLength;\n\n this.query = query;\n this.ariaHint = queryEmpty;\n\n const searchForOptions = this.showAllValues || (!queryEmpty && queryChanged && queryLongEnough);\n if (searchForOptions) {\n const matches = filterOptions(this.source, this.query);\n const optionsAvailable = matches.length > 0;\n this.menuOpen = optionsAvailable;\n this.options = matches;\n this.selected = autoselect && optionsAvailable ? 0 : -1;\n this.validChoiceMade = false;\n } else if (queryEmpty || !queryLongEnough) {\n this.menuOpen = false;\n this.options = [];\n }\n }\n\n handleInputClick(event) {\n this.handleInputChange(event);\n }\n\n handleInputFocus(_) {\n const shouldReopenMenu = !this.validChoiceMade && this.query?.length >= this.minLength && this.options.length > 0;\n\n if (shouldReopenMenu) {\n this.focused = -1;\n this.menuOpen = shouldReopenMenu || this.menuOpen;\n this.selected = -1;\n } else {\n this.focused = -1;\n }\n }\n\n handleOptionFocus(index) {\n this.focused = index;\n this.hovered = null;\n this.selected = index;\n }\n\n handleOptionMouseEnter(index) {\n // iOS Safari prevents click event if mouseenter adds hover background colour\n // See: https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW4\n if (!isIosDevice()) {\n this.hovered = index;\n }\n }\n\n handleOptionClick(_, index) {\n const selectedOption = this.options[index];\n this.value = selectedOption.value;\n this.focused = -1;\n this.hovered = null;\n this.menuOpen = false;\n this.selected = index;\n this.validChoiceMade = true;\n forceUpdate(this);\n }\n\n handleOptionMouseDown(event) {\n // Safari triggers focusOut before click, but if you\n // preventDefault on mouseDown, you can stop that from happening.\n // If this is removed, clicking on an option in Safari will trigger\n // `handleOptionBlur`, which closes the menu, and the click will\n // trigger on the element underneath instead.\n // See: http://stackoverflow.com/questions/7621711/how-to-prevent-blur-running-when-clicking-a-link-in-jquery\n event.preventDefault();\n }\n\n handleUpArrow(event) {\n event.preventDefault();\n const isNotAtTop = this.selected !== -1;\n const allowMoveUp = isNotAtTop && this.menuOpen;\n if (allowMoveUp) {\n this.handleOptionFocus(this.selected - 1);\n }\n }\n\n handleDownArrow(event) {\n event.preventDefault();\n // if not open, open\n if (this.showAllValues && this.menuOpen === false) {\n event.preventDefault();\n const matches = filterOptions(this.source, '');\n this.menuOpen = true;\n this.options = matches;\n this.selected = 0;\n this.focused = 0;\n this.hovered = null;\n } else if (this.menuOpen === true) {\n const isNotAtBottom = this.selected !== this.options.length - 1;\n const allowMoveDown = isNotAtBottom && this.menuOpen;\n if (allowMoveDown) {\n this.handleOptionFocus(this.selected + 1);\n }\n }\n }\n\n handleSpace(event) {\n // if not open, open\n if (this.showAllValues && this.menuOpen === false && this.query === '') {\n event.preventDefault();\n const matches = filterOptions(this.source, '');\n this.menuOpen = true;\n this.options = matches;\n }\n const focusIsOnOption = this.focused !== -1;\n if (focusIsOnOption) {\n event.preventDefault();\n this.handleOptionClick(event, this.focused);\n }\n }\n\n handleEnter(event) {\n if (this.menuOpen) {\n event.preventDefault();\n const hasSelectedOption = this.selected >= 0;\n if (hasSelectedOption) {\n this.handleOptionClick(event, this.selected);\n }\n }\n }\n\n handlePrintableKey(event) {\n const inputElement = this.elementReferences[-1];\n const eventIsOnInput = event.target === inputElement;\n if (!eventIsOnInput) {\n // FIXME: This would be better if it was in componentDidUpdate,\n // but using setState to trigger that seems to not work correctly\n // in preact@8.1.0.\n inputElement.focus();\n }\n }\n\n handleKeyDown(event) {\n switch (keyCodes[event.keyCode]) {\n case 'up':\n this.handleUpArrow(event);\n break;\n case 'down':\n this.handleDownArrow(event);\n break;\n case 'space':\n this.handleSpace(event);\n break;\n case 'enter':\n this.handleEnter(event);\n break;\n case 'escape':\n this.handleComponentBlur({\n query: this.query,\n menuOpen: this.menuOpen,\n });\n break;\n default:\n if (isPrintableKeyCode(event.keyCode)) {\n this.handlePrintableKey(event);\n }\n break;\n }\n }\n\n render() {\n const id = this.el.id != '' ? this.el.id : `admiralty-autocomplete-${this.internalId}`;\n const inputId = `${id}-input`;\n const hintId = `${id}-hint`;\n const errorId = `${id}-error`;\n\n const inputFocused = this.focused === -1;\n const noOptionsAvailable = this.options.length === 0;\n const queryNotEmpty = this.query?.length !== 0;\n const queryLongEnough = this.query?.length >= this.minLength;\n const showNoOptionsFound = this.showNoOptionsFound && inputFocused && noOptionsAvailable && queryNotEmpty && queryLongEnough;\n\n const wrapperClassName = `${this.cssNamespace}__wrapper`;\n const optionFocused = this.focused !== -1 && this.focused !== null;\n\n const optionClassName = `${this.cssNamespace}__option`;\n\n const assistiveHintID = id + '__assistiveHint';\n const ariaProps = {\n 'aria-describedby': `${this.hint ? hintId : ''} ${this.ariaHint ? assistiveHintID : ''} ${this.invalid ? errorId : ''}`,\n 'aria-expanded': this.menuOpen ? 'true' : 'false',\n 'aria-activedescendant': optionFocused ? `${id}__option--${this.focused}` : null,\n 'aria-owns': `${id}__listbox`,\n 'aria-autocomplete': this.hasAutoselect() ? 'both' : 'list',\n };\n\n const inputClassName = `${this.cssNamespace}__input`;\n const inputClassList = [inputClassName, this.showAllValues ? `${inputClassName}--show-all-values` : `${inputClassName}--default`];\n\n const componentIsFocused = this.focused !== null;\n if (componentIsFocused) {\n inputClassList.push(`${inputClassName}--focused`);\n }\n\n if (this.inputClasses) {\n inputClassList.push(this.inputClasses);\n }\n\n if (this.invalid && this.invalidMessage) {\n inputClassList.push(`${inputClassName}--invalid`);\n }\n\n if (this.disabled) {\n inputClassList.push(`${inputClassName}--disabled`);\n }\n\n const menuClassName = `${this.cssNamespace}__menu`;\n const menuModifierDisplayMenu = `${menuClassName}--${this.displayMenu}`;\n const menuIsVisible = this.menuOpen || showNoOptionsFound;\n const menuModifierVisibility = `${menuClassName}--${menuIsVisible ? 'visible' : 'hidden'}`;\n\n const menuClassList = [menuClassName, menuModifierDisplayMenu, menuModifierVisibility];\n\n if (this.menuClasses) {\n menuClassList.push(this.menuClasses);\n }\n\n if (this.menuAttributes?.class || this.menuAttributes?.className) {\n menuClassList.push(this.menuAttributes?.class || this.menuAttributes?.className);\n }\n\n const computedMenuAttributes = {\n // Copy the attributes passed as props\n ...this.menuAttributes,\n // And add the values computed for the autocomplete\n id: `${id}__listbox`,\n role: 'listbox',\n onMouseLeave: this.handleListMouseLeave,\n };\n\n // Preact would override our computed `className`\n // with the `class` from the `menuAttributes` so\n // we need to clean it up from the computed attributes\n delete computedMenuAttributes.class;\n\n return (\n <div class={wrapperClassName} onKeyDown={event => this.handleKeyDown(event)}>\n {this.label ? (\n <admiralty-label class=\"autocomplete__label\" disabled={this.disabled} for={inputId}>\n {this.label}\n </admiralty-label>\n ) : null}\n {this.hint ? (\n <admiralty-hint id={hintId} disabled={this.disabled}>\n {this.hint}\n </admiralty-hint>\n ) : null}\n <div class=\"autocomplete__input-wrapper\">\n <input\n {...ariaProps}\n disabled={this.disabled}\n aria-disabled={this.disabled}\n autoComplete=\"off\"\n class={inputClassList.join(' ')}\n id={inputId}\n onClick={event => this.handleInputClick(event)}\n onBlur={event => this.handleInputBlur(event)}\n onInput={event => this.handleInputChange(event)}\n onFocus={event => this.handleInputFocus(event)}\n name={this.name}\n placeholder={this.placeholder}\n ref={inputElement => {\n this.elementReferences[-1] = inputElement;\n }}\n type=\"text\"\n role=\"combobox\"\n required={this.required}\n value={this.query}\n />\n {this.showAllValues &&\n <admiralty-icon class={`autocomplete-down-icon ${this.disabled ? \"disabled\" : \"\"}`} icon-name={this.menuOpen || showNoOptionsFound ? \"angle-up\" : \"angle-down\"} />\n }\n </div>\n\n <ul {...computedMenuAttributes} class={menuClassList.join(' ')}>\n {this.options.map((option, index) => {\n const showFocused = this.focused === -1 ? this.selected === index : this.focused === index;\n const optionModifierFocused = showFocused && this.hovered === null ? ` ${optionClassName}--focused` : '';\n const iosPosinsetHtml = isIosDevice()\n ? `<span id=${id}__option-suffix--${index} style=\"border:0;clip:rect(0 0 0 0);height:1px;` +\n 'marginBottom:-1px;marginRight:-1px;overflow:hidden;padding:0;position:absolute;' +\n 'whiteSpace:nowrap;width:1px\">' +\n ` ${index + 1} of ${this.options.length}</span>`\n : '';\n\n return (\n <li\n aria-selected={this.focused === index ? 'true' : 'false'}\n class={`${optionClassName}${optionModifierFocused}`}\n innerHTML={this.templateSuggestion(option.text) + iosPosinsetHtml}\n id={`${id}__option--${index}`}\n key={index}\n onBlur={event => this.handleOptionBlur(event, index)}\n onClick={event => this.handleOptionClick(event, index)}\n onMouseDown={event => this.handleOptionMouseDown(event)}\n onMouseEnter={() => this.handleOptionMouseEnter(index)}\n ref={optionEl => {\n this.elementReferences[index] = optionEl;\n }}\n role=\"option\"\n tabIndex={-1}\n aria-posinset={index + 1}\n aria-setsize={this.options.length}\n />\n );\n })}\n\n {showNoOptionsFound && <li class={`${optionClassName} ${optionClassName}--no-results`}>No results found</li>}\n </ul>\n\n <span id={assistiveHintID} style={{ display: 'none' }}>\n {this.assistiveHint}\n </span>\n {this.invalid && this.invalidMessage && (\n <admiralty-input-invalid id={errorId} style={{ visibility: this.invalid && this.invalidMessage ? 'visible' : 'hidden' }}>\n {this.invalidMessage}\n </admiralty-input-invalid>\n )}\n </div>\n );\n }\n}\nlet nextId = 0;\n"],"version":3}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2aa80b51.js');
6
6
 
7
- const cardCss = ".visually-hidden.sc-admiralty-card:not(:focus):not(:active){position:absolute !important;width:1px !important;height:1px !important;margin:0 !important;padding:0 !important;overflow:hidden !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;border:0 !important;white-space:nowrap !important}@media (max-width: 1023px){.desktop-only.sc-admiralty-card{display:none}}@media (min-width: 1024px){.not-desktop.sc-admiralty-card{display:none}}@media (min-width: 1024px){.tablet-only.sc-admiralty-card{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-only.sc-admiralty-card{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-or-desktop.sc-admiralty-card{display:none}}@media (min-width: 1024px){.phone-or-tablet.sc-admiralty-card{display:none}}@media (min-width: 1024px){.phone-only.sc-admiralty-card{display:none}}@media (max-width: 1023px) and (min-width: 480px){.phone-only.sc-admiralty-card{display:none}}.visually-hidden.sc-admiralty-card:not(:focus):not(:active){position:absolute !important;width:1px !important;height:1px !important;margin:0 !important;padding:0 !important;overflow:hidden !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;border:0 !important;white-space:nowrap !important}@media (max-width: 1023px){.desktop-only.sc-admiralty-card{display:none}}@media (min-width: 1024px){.not-desktop.sc-admiralty-card{display:none}}@media (min-width: 1024px){.tablet-only.sc-admiralty-card{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-only.sc-admiralty-card{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-or-desktop.sc-admiralty-card{display:none}}@media (min-width: 1024px){.phone-or-tablet.sc-admiralty-card{display:none}}@media (min-width: 1024px){.phone-only.sc-admiralty-card{display:none}}@media (max-width: 1023px) and (min-width: 480px){.phone-only.sc-admiralty-card{display:none}}.card.sc-admiralty-card{display:flex;flex-direction:column;border:1px solid var(--admiralty-colour-light)}.card.sc-admiralty-card>h6.sc-admiralty-card{font-size:var(--admiralty-card-heading-font-size, var(--admiralty-font-size-0));height:60px;line-height:60px;border:1px solid var(--admiralty-colour-primary);color:var(--admiralty-colour-primary-contrast);background-color:var(--admiralty-colour-primary);margin:0;padding:0 30px}@media (max-width: 1023px){.card.sc-admiralty-card>h6.sc-admiralty-card{padding:0px 18px;height:48px;line-height:48px}}.card.sc-admiralty-card>div.sc-admiralty-card{border-top:none;flex-grow:1;padding:30px}@media (max-width: 1023px){.card.sc-admiralty-card>div.sc-admiralty-card{padding:24px 18px}}.text-input-form.sc-admiralty-card .text-input-wrap.sc-admiralty-card{margin-bottom:30px}.text-input-form.sc-admiralty-card .text-input-wrap.sc-admiralty-card:last-child{margin-bottom:0}";
7
+ const cardCss = ".visually-hidden.sc-admiralty-card:not(:focus):not(:active){position:absolute !important;width:1px !important;height:1px !important;margin:0 !important;padding:0 !important;overflow:hidden !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;border:0 !important;white-space:nowrap !important}@media (max-width: 1023px){.desktop-only.sc-admiralty-card{display:none}}@media (min-width: 1024px){.not-desktop.sc-admiralty-card{display:none}}@media (min-width: 1024px){.tablet-only.sc-admiralty-card{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-only.sc-admiralty-card{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-or-desktop.sc-admiralty-card{display:none}}@media (min-width: 1024px){.phone-or-tablet.sc-admiralty-card{display:none}}@media (min-width: 1024px){.phone-only.sc-admiralty-card{display:none}}@media (max-width: 1023px) and (min-width: 480px){.phone-only.sc-admiralty-card{display:none}}.visually-hidden.sc-admiralty-card:not(:focus):not(:active){position:absolute !important;width:1px !important;height:1px !important;margin:0 !important;padding:0 !important;overflow:hidden !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;border:0 !important;white-space:nowrap !important}@media (max-width: 1023px){.desktop-only.sc-admiralty-card{display:none}}@media (min-width: 1024px){.not-desktop.sc-admiralty-card{display:none}}@media (min-width: 1024px){.tablet-only.sc-admiralty-card{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-only.sc-admiralty-card{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-or-desktop.sc-admiralty-card{display:none}}@media (min-width: 1024px){.phone-or-tablet.sc-admiralty-card{display:none}}@media (min-width: 1024px){.phone-only.sc-admiralty-card{display:none}}@media (max-width: 1023px) and (min-width: 480px){.phone-only.sc-admiralty-card{display:none}}.card.sc-admiralty-card{display:flex;flex-direction:column;border:1px solid var(--admiralty-card-border-colour, var(--admiralty-colour-light));background-color:var(--admiralty-card-background-colour, var(--admiralty-background-colour))}.card.sc-admiralty-card>h6.sc-admiralty-card{font-size:var(--admiralty-card-heading-font-size, var(--admiralty-font-size-0));height:60px;line-height:60px;border:1px solid var(--admiralty-card-heading-border-colour, var(--admiralty-colour-primary));color:var(--admiralty-card-heading-text-colour, var(--admiralty-colour-primary-contrast));background-color:var(--admiralty-card-heading-colour, var(--admiralty-colour-primary));margin:0;padding:0 30px}@media (max-width: 1023px){.card.sc-admiralty-card>h6.sc-admiralty-card{padding:0px 18px;height:48px;line-height:48px}}.card.sc-admiralty-card>div.sc-admiralty-card{border-top:none;flex-grow:1;padding:var(--admiralty-card-padding, 30px)}@media (max-width: 1023px){.card.sc-admiralty-card>div.sc-admiralty-card{padding:var(--admiralty-card-not-desktop-padding, 24px 18px)}}.text-input-form.sc-admiralty-card .text-input-wrap.sc-admiralty-card{margin-bottom:30px}.text-input-form.sc-admiralty-card .text-input-wrap.sc-admiralty-card:last-child{margin-bottom:0}";
8
8
  const AdmiraltyCardStyle0 = cardCss;
9
9
 
10
10
  const CardComponent = class {
@@ -1 +1 @@
1
- {"file":"admiralty-card.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,OAAO,GAAG,m2FAAm2F,CAAC;AACp3F,4BAAe,OAAO;;MCMT,aAAa;;;;;IAMxB,MAAM;QACJ,QACEA,sEAAS,KAAK,EAAC,MAAM,IAClB,IAAI,CAAC,OAAO,GAAGA,oBAAK,IAAI,CAAC,OAAO,CAAM,GAAG,IAAI,EAC9CA,oEACEA,oEAAa,CACT,CACE,EACV;KACH;;;;;;","names":["h"],"sources":["src/components/card/card.scss?tag=admiralty-card&encapsulation=scoped","src/components/card/card.tsx"],"sourcesContent":["@import 'card.vars';\n@import '../../styles/vars/globals';\n\n.card {\n display: flex;\n flex-direction: column;\n border: 1px solid $card-border-colour;\n\n & > h6 {\n font-size: $card-heading-font-size;\n height: 60px;\n line-height: 60px;\n border: 1px solid $card-heading-border-colour;\n color: $card-heading-text-colour;\n background-color: $card-heading-colour;\n margin: 0;\n padding: 0 30px;\n @include not-desktop {\n padding: 0px 18px;\n height: 48px;\n line-height: 48px;\n }\n }\n\n & > div {\n border-top: none;\n flex-grow: 1;\n padding: 30px;\n @include not-desktop {\n padding: 24px 18px;\n }\n }\n}\n\n.text-input-form {\n .text-input-wrap {\n margin-bottom: 30px;\n }\n\n .text-input-wrap:last-child {\n margin-bottom: 0;\n }\n}\n","import { Component, Prop, h } from '@stencil/core';\n\n@Component({\n tag: 'admiralty-card',\n styleUrl: 'card.scss',\n scoped: true,\n})\nexport class CardComponent {\n /**\n * The title of the card.\n */\n @Prop() heading: string;\n\n render() {\n return (\n <section class=\"card\">\n {this.heading ? <h6>{this.heading}</h6> : null}\n <div>\n <slot></slot>\n </div>\n </section>\n );\n }\n}\n"],"version":3}
1
+ {"file":"admiralty-card.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,OAAO,GAAG,6qGAA6qG,CAAC;AAC9rG,4BAAe,OAAO;;MCMT,aAAa;;;;;IAMxB,MAAM;QACJ,QACEA,sEAAS,KAAK,EAAC,MAAM,IAClB,IAAI,CAAC,OAAO,GAAGA,oBAAK,IAAI,CAAC,OAAO,CAAM,GAAG,IAAI,EAC9CA,oEACEA,oEAAa,CACT,CACE,EACV;KACH;;;;;;","names":["h"],"sources":["src/components/card/card.scss?tag=admiralty-card&encapsulation=scoped","src/components/card/card.tsx"],"sourcesContent":["@import 'card.vars';\n@import '../../styles/vars/globals';\n\n.card {\n display: flex;\n flex-direction: column;\n border: 1px solid $card-border-colour;\n background-color: $card-background-colour;\n\n & > h6 {\n font-size: $card-heading-font-size;\n height: 60px;\n line-height: 60px;\n border: 1px solid $card-heading-border-colour;\n color: $card-heading-text-colour;\n background-color: $card-heading-colour;\n margin: 0;\n padding: 0 30px;\n @include not-desktop {\n padding: 0px 18px;\n height: 48px;\n line-height: 48px;\n }\n }\n\n & > div {\n border-top: none;\n flex-grow: 1;\n padding: $card-padding;\n @include not-desktop {\n padding: $card-padding-not-desktop;\n }\n }\n}\n\n.text-input-form {\n .text-input-wrap {\n margin-bottom: 30px;\n }\n\n .text-input-wrap:last-child {\n margin-bottom: 0;\n }\n}\n","import { Component, Prop, h } from '@stencil/core';\n\n@Component({\n tag: 'admiralty-card',\n styleUrl: 'card.scss',\n scoped: true,\n})\nexport class CardComponent {\n /**\n * The title of the card.\n */\n @Prop() heading: string;\n\n render() {\n return (\n <section class=\"card\">\n {this.heading ? <h6>{this.heading}</h6> : null}\n <div>\n <slot></slot>\n </div>\n </section>\n );\n }\n}\n"],"version":3}
@@ -27,7 +27,7 @@ function filterOptions(options, searchTerm) {
27
27
  return options.filter(({ text }) => text.toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1);
28
28
  }
29
29
  function filterOptionsByValue(options, searchTerm) {
30
- return options.filter(({ value }) => value.toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1);
30
+ return options.filter(({ value }) => value.toString().toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1);
31
31
  }
32
32
  export class AutocompleteComponent {
33
33
  constructor() {
@@ -418,10 +418,10 @@ export class AutocompleteComponent {
418
418
  // with the `class` from the `menuAttributes` so
419
419
  // we need to clean it up from the computed attributes
420
420
  delete computedMenuAttributes.class;
421
- return (h("div", { key: '9cb9e0e2dad7646540004b2d36870c31b116f035', class: wrapperClassName, onKeyDown: event => this.handleKeyDown(event) }, this.label ? (h("admiralty-label", { class: "autocomplete__label", disabled: this.disabled, for: inputId }, this.label)) : null, this.hint ? (h("admiralty-hint", { id: hintId, disabled: this.disabled }, this.hint)) : null, h("div", { key: '93189d20cea5100ed4bc408824735569ea9d5e26', class: "autocomplete__input-wrapper" }, h("input", Object.assign({ key: '74770128149f77d1a4c17be5389188e29e34df1e' }, ariaProps, { disabled: this.disabled, "aria-disabled": this.disabled, autoComplete: "off", class: inputClassList.join(' '), id: inputId, onClick: event => this.handleInputClick(event), onBlur: event => this.handleInputBlur(event), onInput: event => this.handleInputChange(event), onFocus: event => this.handleInputFocus(event), name: this.name, placeholder: this.placeholder, ref: inputElement => {
421
+ return (h("div", { key: '4136155c810c71813619ffa286730bcfcca3d772', class: wrapperClassName, onKeyDown: event => this.handleKeyDown(event) }, this.label ? (h("admiralty-label", { class: "autocomplete__label", disabled: this.disabled, for: inputId }, this.label)) : null, this.hint ? (h("admiralty-hint", { id: hintId, disabled: this.disabled }, this.hint)) : null, h("div", { key: '681a74fa8d076be8b6bad11f70c3db4f05bfbc40', class: "autocomplete__input-wrapper" }, h("input", Object.assign({ key: '42235e1077c30f746dfef4cda228cac3af2fd145' }, ariaProps, { disabled: this.disabled, "aria-disabled": this.disabled, autoComplete: "off", class: inputClassList.join(' '), id: inputId, onClick: event => this.handleInputClick(event), onBlur: event => this.handleInputBlur(event), onInput: event => this.handleInputChange(event), onFocus: event => this.handleInputFocus(event), name: this.name, placeholder: this.placeholder, ref: inputElement => {
422
422
  this.elementReferences[-1] = inputElement;
423
423
  }, type: "text", role: "combobox", required: this.required, value: this.query })), this.showAllValues &&
424
- h("admiralty-icon", { key: '98032793bfdc0fb9ca7c90be9352e234de7d72bb', class: `autocomplete-down-icon ${this.disabled ? "disabled" : ""}`, "icon-name": this.menuOpen || showNoOptionsFound ? "angle-up" : "angle-down" })), h("ul", Object.assign({ key: '4b0ba76ad0eefa89c67b85bb8bb574133696e574' }, computedMenuAttributes, { class: menuClassList.join(' ') }), this.options.map((option, index) => {
424
+ h("admiralty-icon", { key: '2169c9d3827a9ec7be70d009656cee134340385f', class: `autocomplete-down-icon ${this.disabled ? "disabled" : ""}`, "icon-name": this.menuOpen || showNoOptionsFound ? "angle-up" : "angle-down" })), h("ul", Object.assign({ key: 'a46459188a4149fdee4cf9ee4b2e39f81756723a' }, computedMenuAttributes, { class: menuClassList.join(' ') }), this.options.map((option, index) => {
425
425
  const showFocused = this.focused === -1 ? this.selected === index : this.focused === index;
426
426
  const optionModifierFocused = showFocused && this.hovered === null ? ` ${optionClassName}--focused` : '';
427
427
  const iosPosinsetHtml = isIosDevice()
@@ -433,7 +433,7 @@ export class AutocompleteComponent {
433
433
  return (h("li", { "aria-selected": this.focused === index ? 'true' : 'false', class: `${optionClassName}${optionModifierFocused}`, innerHTML: this.templateSuggestion(option.text) + iosPosinsetHtml, id: `${id}__option--${index}`, key: index, onBlur: event => this.handleOptionBlur(event, index), onClick: event => this.handleOptionClick(event, index), onMouseDown: event => this.handleOptionMouseDown(event), onMouseEnter: () => this.handleOptionMouseEnter(index), ref: optionEl => {
434
434
  this.elementReferences[index] = optionEl;
435
435
  }, role: "option", tabIndex: -1, "aria-posinset": index + 1, "aria-setsize": this.options.length }));
436
- }), showNoOptionsFound && h("li", { key: 'aef863d0e03270176d2967cc4f98ee813063debc', class: `${optionClassName} ${optionClassName}--no-results` }, "No results found")), h("span", { key: 'bf9764e00280f22c3f0901e7e9276e7a9c1d5eae', id: assistiveHintID, style: { display: 'none' } }, this.assistiveHint), this.invalid && this.invalidMessage && (h("admiralty-input-invalid", { key: '6be96502d68013e546a9e33d0ccdede7462fbb19', id: errorId, style: { visibility: this.invalid && this.invalidMessage ? 'visible' : 'hidden' } }, this.invalidMessage))));
436
+ }), showNoOptionsFound && h("li", { key: 'd006b14b1ac0c953443e87c5407d476015b49988', class: `${optionClassName} ${optionClassName}--no-results` }, "No results found")), h("span", { key: 'a77fb4fe1d40c8e7ee1ee95d7387928d5f341093', id: assistiveHintID, style: { display: 'none' } }, this.assistiveHint), this.invalid && this.invalidMessage && (h("admiralty-input-invalid", { key: 'd784dd5fde4a2cdee858c308bcebb5ea6964c8c0', id: errorId, style: { visibility: this.invalid && this.invalidMessage ? 'visible' : 'hidden' } }, this.invalidMessage))));
437
437
  }
438
438
  static get is() { return "admiralty-autocomplete"; }
439
439
  static get encapsulation() { return "scoped"; }