UNPKG

@cbpds/web-components

Version:
5 lines 1.74 kB
/*! * CPB Design System web components - built with Stencil */ import{r as t,h as e,a as o,g as i}from"./p-654179c2.js";import{s}from"./p-93ade441.js";const a="cbp-skip-nav a{display:inline-block;padding:0.75rem 1.25rem;border-radius:var(--cbp-border-radius-softest);position:absolute;top:-1000rem;left:var(--cbp-space-1x);background-color:var(--cbp-color-black);color:var(--cbp-color-text-lightest);font-size:1rem;font-weight:var(--cbp-font-weight-bold);font-family:inherit}cbp-skip-nav a:active,cbp-skip-nav a:focus{top:var(--cbp-space-1x);text-decoration:none;outline-style:solid;outline-width:var(--cbp-border-size-md);outline-color:var(--cbp-button-color-outline-focus);outline-offset:calc(-1 * var(--cbp-space-1x));z-index:var(-cbp-z-index-level-top)}";const c=a;const n=class{constructor(e){t(this,e);this.targetId="main";this.shortcutKey=undefined;this.sx={}}handleClick(t){t.preventDefault();t.stopPropagation();const e=document.querySelector(`#${this.targetId}`);if(e){e.focus()}}componentWillLoad(){const t=document.querySelector(`#${this.targetId}`);if(!t)console.warn(`Configuration Error (cbp-skip-nav): The specified targetId of "${this.targetId}" cannot be found in the current page.`);if(typeof this.sx=="string"){this.sx=JSON.parse(this.sx)||{}}s(this.link,Object.assign({},this.sx))}render(){return e(o,{key:"dac3142eed78f0c85ffaa9e9f0a5a4b3d0fadd37"},e("a",{key:"b2a7927f238d985ffacdbf6beb32fabc08c20982",href:this.targetId?`#${this.targetId}`:null,accessKey:this.shortcutKey,ref:t=>this.link=t,onClick:t=>this.handleClick(t)},e("slot",{key:"e9ea15fe4a1e8176777277fb96604ffd0ee40502"},"Skip to main content")))}get host(){return i(this)}};n.style=c;export{n as cbp_skip_nav}; //# sourceMappingURL=p-d441a80b.entry.js.map