scb-wc 0.1.78 → 0.1.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -22
- package/all.js +0 -2
- package/index.js +88 -90
- package/mvc/components/all.js +0 -2
- package/mvc/components/scb-accordion/scb-accordion-item.js +3 -173
- package/mvc/components/scb-accordion/scb-accordion.js +4 -33
- package/mvc/components/scb-app-bar/scb-app-bar.js +2 -110
- package/mvc/components/scb-avatar/scb-avatar.js +2 -94
- package/mvc/components/scb-badge/scb-badge.js +2 -72
- package/mvc/components/scb-breadcrumb/scb-breadcrumb-item.js +2 -12
- package/mvc/components/scb-breadcrumb/scb-breadcrumb.js +4 -91
- package/mvc/components/scb-button/scb-button.js +47 -309
- package/mvc/components/scb-calendar/scb-calendar-event.js +2 -6
- package/mvc/components/scb-calendar/scb-calendar.js +6 -120
- package/mvc/components/scb-calendar-card/scb-calendar-card.js +21 -350
- package/mvc/components/scb-card/scb-card.js +54 -819
- package/mvc/components/scb-checkbox/scb-checkbox-group.js +3 -31
- package/mvc/components/scb-checkbox/scb-checkbox.js +5 -127
- package/mvc/components/scb-chip/scb-chip.js +2 -76
- package/mvc/components/scb-collapse/scb-collapse.js +2 -44
- package/mvc/components/scb-cookies-consent/scb-cookies-consent.js +7 -73
- package/mvc/components/scb-dialog/scb-dialog.js +2 -213
- package/mvc/components/scb-divider/scb-divider.js +1 -69
- package/mvc/components/scb-drawer/scb-drawer.js +6 -102
- package/mvc/components/scb-drop-zone/scb-drop-zone.js +2 -410
- package/mvc/components/scb-dropdown/scb-dropdown.js +17 -222
- package/mvc/components/scb-fab/scb-fab.js +7 -95
- package/mvc/components/scb-fact-card/scb-fact-card-content.js +2 -69
- package/mvc/components/scb-fact-card/scb-fact-card.js +2 -214
- package/mvc/components/scb-footer/scb-footer-section.js +1 -3
- package/mvc/components/scb-footer/scb-footer.js +3 -172
- package/mvc/components/scb-gallery-grid/scb-gallery-grid.js +2 -112
- package/mvc/components/scb-grid/scb-grid-item.js +1 -32
- package/mvc/components/scb-grid/scb-grid.js +1 -99
- package/mvc/components/scb-grid/scb-stack.js +1 -33
- package/mvc/components/scb-header/scb-header-menu-item.js +1 -5
- package/mvc/components/scb-header/scb-header-tab.js +1 -5
- package/mvc/components/scb-header/scb-header.js +75 -888
- package/mvc/components/scb-horizontal-scroller/scb-horizontal-scroller.js +43 -168
- package/mvc/components/scb-icon-button/scb-icon-button.js +59 -171
- package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +17 -218
- package/mvc/components/scb-link/scb-link.js +4 -55
- package/mvc/components/scb-list/scb-list-item.js +23 -126
- package/mvc/components/scb-list/scb-list.js +5 -26
- package/mvc/components/scb-menu/scb-menu-item.js +16 -190
- package/mvc/components/scb-menu/scb-menu-section.js +4 -36
- package/mvc/components/scb-menu/scb-menu.js +5 -69
- package/mvc/components/scb-menu/scb-sub-menu.js +2 -7
- package/mvc/components/scb-nav/scb-nav-item.js +1 -28
- package/mvc/components/scb-nav/scb-nav.js +5 -98
- package/mvc/components/scb-notification-card/scb-notification-card.js +7 -364
- package/mvc/components/scb-options-menu/scb-options-menu-item.js +3 -50
- package/mvc/components/scb-options-menu/scb-options-menu.js +2 -82
- package/mvc/components/scb-options-menu/scb-options-sub-menu.js +2 -31
- package/mvc/components/scb-overlay/scb-overlay.js +3 -43
- package/mvc/components/scb-pagination/scb-pagination.js +19 -221
- package/mvc/components/scb-progress-indicator/scb-progress-indicator.js +2 -67
- package/mvc/components/scb-progress-stepper/scb-progress-step.js +4 -121
- package/mvc/components/scb-progress-stepper/scb-progress-stepper.js +2 -56
- package/mvc/components/scb-radio-button/scb-radio-button.js +5 -116
- package/mvc/components/scb-radio-button/scb-radio-group.js +2 -32
- package/mvc/components/scb-scrollspy/scb-scrollspy.js +2 -61
- package/mvc/components/scb-search/scb-search.js +5 -249
- package/mvc/components/scb-segmented-button/scb-segmented-button.js +1 -32
- package/mvc/components/scb-segmented-button/scb-segmented-item.js +2 -70
- package/mvc/components/scb-select/scb-select-option.js +2 -54
- package/mvc/components/scb-select/scb-select.js +4 -244
- package/mvc/components/scb-skeleton/scb-skeleton.js +2 -35
- package/mvc/components/scb-slider/scb-slider.js +5 -9
- package/mvc/components/scb-snackbar/scb-snackbar.js +9 -84
- package/mvc/components/scb-status-pill/scb-status-pill.js +2 -43
- package/mvc/components/scb-stepper/scb-step.js +8 -186
- package/mvc/components/scb-stepper/scb-stepper.js +2 -130
- package/mvc/components/scb-switch/scb-switch.js +4 -49
- package/mvc/components/scb-table/scb-table.js +2 -48
- package/mvc/components/scb-table-advanced/scb-table-advanced.js +2 -53
- package/mvc/components/scb-tabs/scb-primary-tab.js +2 -7
- package/mvc/components/scb-tabs/scb-secondary-tab.js +2 -7
- package/mvc/components/scb-tabs/scb-tabs.js +4 -31
- package/mvc/components/scb-textfield/scb-textfield.js +142 -388
- package/mvc/components/scb-toc/scb-toc-item.js +3 -251
- package/mvc/components/scb-toc/scb-toc.js +2 -16
- package/mvc/components/scb-tooltip/scb-tooltip.js +8 -155
- package/mvc/components/scb-viz/scb-viz.js +4 -619
- package/mvc/scb-wc-core.css +1 -1
- package/mvc/scb-wc-selfhost.css +1 -1
- package/mvc/scb-wc.css +1 -1
- package/mvc/vendor/assist-chip.js +3 -3
- package/mvc/vendor/chip-set.js +1 -1
- package/mvc/vendor/chip.js +2 -2
- package/mvc/vendor/elevation.js +2 -2
- package/mvc/vendor/filter-chip.js +1 -1
- package/mvc/vendor/focusable.js +1 -1
- package/mvc/vendor/form-associated.js +1 -1
- package/mvc/vendor/icon.js +2 -2
- package/mvc/vendor/lazy-focus-ring.js +2 -0
- package/mvc/vendor/lazy-ripple.js +2 -0
- package/mvc/vendor/md-focus-ring.js +2 -2
- package/mvc/vendor/ripple.js +2 -2
- package/mvc/vendor/scb-card-variants.internal.js +284 -0
- package/mvc/vendor/scb-chevron.js +10 -0
- package/mvc/vendor/scb-header-drawer.internal.js +71 -0
- package/mvc/vendor/shared-styles.js +1 -1
- package/mvc/vendor/tab-styles.js +3 -3
- package/mvc/vendor/validator.js +1 -1
- package/mvc/vendor/vendor.js +3 -4
- package/package.json +2 -2
- package/scb-accordion/scb-accordion-item.js +33 -32
- package/scb-app-bar/scb-app-bar.js +1 -1
- package/scb-button/scb-button.js +287 -259
- package/scb-calendar/scb-calendar.js +49 -49
- package/scb-calendar-card/scb-calendar-card.js +105 -59
- package/scb-card/scb-card-variants.internal.js +230 -0
- package/scb-card/scb-card.js +387 -528
- package/scb-checkbox/scb-checkbox.js +0 -1
- package/scb-chevron/scb-chevron.js +0 -1
- package/scb-components/scb-button/scb-button.d.ts +14 -2
- package/scb-components/scb-calendar/scb-calendar.d.ts +1 -0
- package/scb-components/scb-calendar-card/scb-calendar-card.d.ts +16 -4
- package/scb-components/scb-card/scb-card-variants.internal.d.ts +15 -0
- package/scb-components/scb-card/scb-card.d.ts +26 -9
- package/scb-components/scb-cookies-consent/scb-cookies-consent.d.ts +3 -0
- package/scb-components/scb-header/scb-header-drawer.internal.d.ts +31 -0
- package/scb-components/scb-header/scb-header.d.ts +1 -2
- package/scb-components/scb-horizontal-scroller/scb-horizontal-scroller.d.ts +6 -1
- package/scb-components/scb-icon-button/scb-icon-button.d.ts +28 -29
- package/scb-components/scb-keyfigure-card/scb-keyfigure-card.d.ts +13 -4
- package/scb-components/scb-list/scb-list-item.d.ts +20 -2
- package/scb-components/scb-list/scb-list.d.ts +1 -2
- package/scb-components/scb-nav/scb-nav.d.ts +2 -0
- package/scb-components/scb-segmented-button/scb-segmented-item.d.ts +1 -0
- package/scb-components/scb-select/scb-select-option.d.ts +2 -0
- package/scb-components/scb-toc/scb-toc-item.d.ts +1 -0
- package/scb-components/scb-tooltip/scb-tooltip.d.ts +2 -0
- package/scb-cookies-consent/scb-cookies-consent.js +43 -31
- package/scb-datepicker/scb-datepicker.js +27 -25
- package/scb-dialog/scb-dialog.js +1 -1
- package/scb-dropdown/scb-dropdown.js +29 -28
- package/scb-header/scb-header-drawer.internal.js +78 -0
- package/scb-header/scb-header.js +41 -89
- package/scb-horizontal-scroller/scb-horizontal-scroller.js +181 -88
- package/scb-icon-button/scb-icon-button.js +293 -205
- package/scb-keyfigure-card/scb-keyfigure-card.js +96 -43
- package/scb-list/scb-list-item.js +117 -52
- package/scb-list/scb-list.js +9 -9
- package/scb-nav/scb-nav.js +26 -23
- package/scb-notification-card/scb-notification-card.js +0 -2
- package/scb-options-menu/scb-options-menu-item.js +20 -20
- package/scb-pagination/scb-pagination.js +0 -1
- package/scb-progress-stepper/scb-progress-step.js +19 -17
- package/scb-radio-button/scb-radio-button.js +0 -1
- package/scb-search/scb-search.js +29 -28
- package/scb-segmented-button/scb-segmented-item.js +22 -19
- package/scb-select/scb-select-option.js +20 -14
- package/scb-select/scb-select.js +26 -26
- package/scb-stepper/scb-step.js +34 -31
- package/scb-textfield/scb-textfield.js +39 -39
- package/scb-toc/scb-toc-item.js +26 -26
- package/scb-tooltip/scb-tooltip.js +5 -4
- package/scb-viz/scb-viz.js +1 -1
- package/scb-wc-core.css +1 -1
- package/scb-wc-public-entry/index.d.ts +97 -0
- package/scb-wc-selfhost.css +1 -1
- package/scb-wc.bundle.js +1873 -1476
- package/scb-wc.css +1 -1
- package/scb-wc.d.ts +194 -198
- package/mvc/components/scb-chevron/scb-chevron.js +0 -41
- package/mvc/components/scb-datepicker/scb-datepicker.js +0 -296
- package/mvc/vendor/element-internals.js +0 -1
- package/mvc/vendor/filled-icon-button.js +0 -2
- package/mvc/vendor/filled-tonal-icon-button.js +0 -2
- package/mvc/vendor/form-label-activation.js +0 -1
- package/mvc/vendor/form-submitter.js +0 -1
- package/mvc/vendor/icon-button.js +0 -2
- package/mvc/vendor/list.js +0 -8
- package/mvc/vendor/outlined-icon-button.js +0 -2
- package/mvc/vendor/shared-styles2.js +0 -30
- package/scb-components/index.d.ts +0 -99
- package/scb-components/scb-chevron/scb-chevron.d.ts +0 -11
- package/scb-components/scb-datepicker/scb-datepicker.d.ts +0 -39
|
@@ -1,26 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
`}},d.styles=[f`
|
|
7
|
-
:host {
|
|
8
|
-
display: block;
|
|
9
|
-
--scb-list-bg: transparent;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
md-list {
|
|
13
|
-
background: var(--scb-list-bg);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/* Visa top-border på första raden endast när listan saknar no-divider
|
|
17
|
-
och endast om första item inte själv är markerad med no-divider. */
|
|
18
|
-
:host(:not([no-divider])) ::slotted(scb-list-item:first-of-type:not([no-divider])) {
|
|
19
|
-
border-top: 1px solid var(--md-sys-color-outline-variant);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/* När listan har no-divider, tryck ned variabeln till alla barn */
|
|
23
|
-
:host([no-divider]) ::slotted(scb-list-item) {
|
|
24
|
-
--stroke-border: 0px;
|
|
25
|
-
}
|
|
26
|
-
`],d);n([o({type:Boolean,attribute:"no-divider",reflect:!0})],a.prototype,"noDivider",void 0);n([o({type:String,reflect:!0})],a.prototype,"spacing",void 0);n([o({type:String,reflect:!0,attribute:"spacing-top"})],a.prototype,"spacingTop",void 0);n([o({type:String,reflect:!0,attribute:"spacing-bottom"})],a.prototype,"spacingBottom",void 0);n([o({type:String,reflect:!0,attribute:"spacing-left"})],a.prototype,"spacingLeft",void 0);n([o({type:String,reflect:!0,attribute:"spacing-right"})],a.prototype,"spacingRight",void 0);n([_("slot")],a.prototype,"_slotEl",void 0);a=n([b("scb-list")],a);export{a as ScbList};
|
|
1
|
+
import{d as h,h as u,m,p as a,v as f,y as b}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as n}from"../../vendor/decorate.js";import"./scb-list-item.js";(function(){try{var c=typeof globalThis<"u"?globalThis:window;if(!c.__scb_ce_guard_installed__){c.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(e,i,s){try{customElements.get(e)||t(e,i,s)}catch(p){var r=String(p||"");if(r.indexOf("already been used")===-1&&r.indexOf("NotSupportedError")===-1)throw p}}}}catch{}})();var l,o=(l=class extends u{constructor(...t){super(...t),this.noDivider=!1,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._onSlotChange=()=>this._setupItems()}firstUpdated(){this._setupItems(),this._applySpacing()}updated(t){super.updated(t),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&this._applySpacing()}_getItems(){return(this._slotEl?.assignedElements({flatten:!0})??[]).filter(t=>t instanceof HTMLElement)}_setupItems(){this._getItems().forEach((e,i)=>{e.hasAttribute("role")||e.setAttribute("role","listitem"),e.setAttribute("tabindex",i===0?"0":"-1")});const t=this.renderRoot?.querySelector(".list");t&&!t.hasAttribute("data-kbd")&&(t.setAttribute("data-kbd","true"),t.addEventListener("keydown",e=>this._onKeyDown(e)))}_onKeyDown(t){const e=this._getItems();if(!e.length)return;const i=e.findIndex(r=>r.getAttribute("tabindex")==="0"),s=r=>{const p=(r%e.length+e.length)%e.length;e.forEach(g=>g.setAttribute("tabindex","-1"));const d=e[p];d.setAttribute("tabindex","0"),d.focus()};switch(t.key){case"ArrowDown":case"ArrowRight":t.preventDefault(),s(i<0?0:i+1);break;case"ArrowUp":case"ArrowLeft":t.preventDefault(),s(i<0?0:i-1);break;case"Home":t.preventDefault(),s(0);break;case"End":t.preventDefault(),s(e.length-1);break;default:break}}_mapSpacingToken(t){if(!t)return;const e=String(t).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e}_applySpacing(){const t=this._mapSpacingToken(this.spacing),e=this._mapSpacingToken(this.spacingTop)??t,i=this._mapSpacingToken(this.spacingBottom)??t,s=this._mapSpacingToken(this.spacingLeft),r=this._mapSpacingToken(this.spacingRight);e?this.style.marginBlockStart=e:this.style.removeProperty("margin-block-start"),i?this.style.marginBlockEnd=i:this.style.removeProperty("margin-block-end"),s?this.style.marginInlineStart=s:this.style.removeProperty("margin-inline-start"),r?this.style.marginInlineEnd=r:this.style.removeProperty("margin-inline-end")}render(){return f`
|
|
2
|
+
<div class="list" role="list">
|
|
3
|
+
<slot @slotchange=${this._onSlotChange}></slot>
|
|
4
|
+
</div>
|
|
5
|
+
`}},l.styles=[b`:host{display:block;--scb-list-bg:transparent}.list{background:var(--scb-list-bg);padding-block:var(--scb-list-container-padding-block, 8px)}:host(:not([no-divider])) ::slotted(scb-list-item:first-of-type:not([no-divider])){border-top:1px solid var(--md-sys-color-outline-variant)}:host([no-divider]) ::slotted(scb-list-item){--stroke-border:0px}`],l);n([a({type:Boolean,attribute:"no-divider",reflect:!0})],o.prototype,"noDivider",void 0);n([a({type:String,reflect:!0})],o.prototype,"spacing",void 0);n([a({type:String,reflect:!0,attribute:"spacing-top"})],o.prototype,"spacingTop",void 0);n([a({type:String,reflect:!0,attribute:"spacing-bottom"})],o.prototype,"spacingBottom",void 0);n([a({type:String,reflect:!0,attribute:"spacing-left"})],o.prototype,"spacingLeft",void 0);n([a({type:String,reflect:!0,attribute:"spacing-right"})],o.prototype,"spacingRight",void 0);n([h("slot")],o.prototype,"_slotEl",void 0);o=n([m("scb-list")],o);export{o as ScbList};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/ripple.js","../../vendor/rolldown-runtime.js","../../vendor/vendor.js","../../vendor/attachable-controller.js","../../vendor/vendor-lit.js","../../vendor/md-focus-ring.js","../../vendor/icon.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{
|
|
2
|
+
import{f as g,g as u,h as _,m as f,p as r,v as d,y as v}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as h}from"../../vendor/preload-helper.js";import{t as s}from"../../vendor/decorate.js";import"../../vendor/scb-chevron.js";(function(){try{var a=typeof globalThis<"u"?globalThis:window;if(!a.__scb_ce_guard_installed__){a.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,i,l){try{customElements.get(t)||e(t,i,l)}catch(p){var m=String(p||"");if(m.indexOf("already been used")===-1&&m.indexOf("NotSupportedError")===-1)throw p}}}}catch{}})();var c,o,b={fromAttribute:a=>a==null?!1:!/^(false|0|off|no)$/i.test(a),toAttribute:a=>a?"":null},n=(c=class extends _{constructor(...e){super(...e),this.label="",this.selected=!1,this.noHighlightSelected=!1,this.leadingIcon="",this.itemHref="",this.hasChildren=!1,this.loading=!1,this.hasSlotContent=!1,this.expanded=!1,this.__submenuId=`sub-${Math.random().toString(36).slice(2)}`,this.__focusId=`f-${Math.random().toString(36).slice(2)}`,this._toggleExpand=t=>{t&&t.stopPropagation(),this.__isExpandable&&this.__setExpanded(!this.expanded)},this._onButtonClick=t=>{t.stopPropagation(),this._dispatchSelect(),this._toggleExpand()},this._onLinkClick=()=>{this._dispatchSelect()},this._onKeyDown=t=>{const i=Array.from(this.closest("scb-sub-menu, scb-menu")?.querySelectorAll("scb-menu-item")||[]),l=i.indexOf(this);switch(t.key){case"ArrowDown":t.preventDefault(),(i[l+1]||i[0]).shadowRoot?.querySelector(".scb-menu-label-text")?.focus();break;case"ArrowUp":t.preventDefault(),(i[l-1]||i[i.length-1]).shadowRoot?.querySelector(".scb-menu-label-text")?.focus();break;case"Home":t.preventDefault(),i[0].shadowRoot?.querySelector(".scb-menu-label-text")?.focus();break;case"End":t.preventDefault(),i[i.length-1].shadowRoot?.querySelector(".scb-menu-label-text")?.focus();break}}}get __submenuEl(){return this.renderRoot.querySelector(`#${this.__submenuId}`)}get __isExpandable(){return this.hasSlotContent||this.hasChildren}async __ensureDepsLoaded(){o.__rippleLoaded||(await h(()=>import("../../vendor/ripple.js").then(e=>e.t),__vite__mapDeps([0,1,2,3,4]),import.meta.url),o.__rippleLoaded=!0),o.__focusRingLoaded||(await h(()=>import("../../vendor/md-focus-ring.js").then(e=>e.t),__vite__mapDeps([5,1,2,3,4]),import.meta.url),o.__focusRingLoaded=!0),this.leadingIcon&&!o.__iconLoaded&&(await h(()=>import("../../vendor/icon.js").then(e=>e.t),__vite__mapDeps([6,1,2,4]),import.meta.url),o.__iconLoaded=!0)}__syncHasSlotContentFromLightDom(){const e=Array.from(this.children);this.hasSlotContent=e.some(t=>t.tagName==="SCB-SUB-MENU")}connectedCallback(){super.connectedCallback(),this.__syncHasSlotContentFromLightDom()}_onSlotChange(e){const t=e.target.assignedElements({flatten:!0});this.hasSlotContent=t.some(i=>i.tagName==="SCB-SUB-MENU")}__setExpanded(e){if(!this.__isExpandable)return;this.expanded=e;const t={item:this,expanded:e,hasChildren:this.hasChildren,hasSlotContent:this.hasSlotContent,loading:this.loading,lazy:this.hasChildren&&!this.hasSlotContent};this.dispatchEvent(new CustomEvent("scb-menu-expand",{bubbles:!0,composed:!0,detail:t})),this.dispatchEvent(new CustomEvent("scbmenuexpand",{bubbles:!0,composed:!0,detail:t}))}_dispatchSelect(){this.dispatchEvent(new CustomEvent("scb-menu-select",{bubbles:!0,composed:!0,detail:{item:this}})),this.dispatchEvent(new CustomEvent("scbmenuselect",{bubbles:!0,composed:!0,detail:{item:this}}))}async firstUpdated(){await this.__ensureDepsLoaded(),this.__applyInert()}updated(e){e.has("leadingIcon")&&this.leadingIcon&&this.__ensureDepsLoaded(),(e.has("hasSlotContent")&&this.hasSlotContent||e.has("hasChildren")&&this.hasChildren||e.has("loading")&&this.loading)&&this.__ensureDepsLoaded(),(e.has("expanded")||e.has("hasChildren")||e.has("loading"))&&this.__applyInert()}__applyInert(){const e=this.__submenuEl;e&&(this.loading?e.setAttribute("aria-busy","true"):e.removeAttribute("aria-busy"),this.expanded?(e.removeAttribute("inert"),e.setAttribute("aria-hidden","false")):(e.setAttribute("inert",""),e.setAttribute("aria-hidden","true")))}render(){const e=!!this.leadingIcon,t=!!this.itemHref,i=this.__isExpandable;return d`
|
|
3
3
|
<div class="scb-menu-item">
|
|
4
4
|
<div class="scb-menu-item-label" ?selected=${this.selected} ?no-highlight-selected=${this.noHighlightSelected}>
|
|
5
|
-
${t?
|
|
5
|
+
${t?d`
|
|
6
6
|
<a
|
|
7
7
|
id=${this.__focusId}
|
|
8
8
|
class="scb-menu-label-text"
|
|
@@ -14,31 +14,31 @@ import{_ as g,b as _,g as f,h as r,m as v,v as u,y as l}from"../../vendor/vendor
|
|
|
14
14
|
>
|
|
15
15
|
<span class="scb-menu-click ${e?"has-icon":""}">
|
|
16
16
|
<md-ripple></md-ripple>
|
|
17
|
-
${e?
|
|
17
|
+
${e?d`<md-icon>${this.leadingIcon}</md-icon>`:""}
|
|
18
18
|
${this.label}
|
|
19
19
|
</span>
|
|
20
20
|
</a>
|
|
21
21
|
<md-focus-ring for=${this.__focusId} inward></md-focus-ring>
|
|
22
|
-
`:
|
|
22
|
+
`:d`
|
|
23
23
|
<button
|
|
24
24
|
id=${this.__focusId}
|
|
25
25
|
type="button"
|
|
26
26
|
class="scb-menu-label-text"
|
|
27
27
|
@click=${this._onButtonClick}
|
|
28
28
|
@keydown=${this._onKeyDown}
|
|
29
|
-
aria-expanded=${
|
|
30
|
-
aria-controls=${
|
|
31
|
-
aria-busy=${
|
|
29
|
+
aria-expanded=${i?String(this.expanded):u}
|
|
30
|
+
aria-controls=${i?this.__submenuId:u}
|
|
31
|
+
aria-busy=${i&&this.loading?"true":u}
|
|
32
32
|
>
|
|
33
33
|
<span class="scb-menu-click ${e?"has-icon":""}">
|
|
34
34
|
<md-ripple></md-ripple>
|
|
35
|
-
${e?
|
|
35
|
+
${e?d`<md-icon>${this.leadingIcon}</md-icon>`:""}
|
|
36
36
|
${this.label}
|
|
37
37
|
</span>
|
|
38
38
|
</button>
|
|
39
39
|
<md-focus-ring for=${this.__focusId} inward></md-focus-ring>
|
|
40
40
|
`}
|
|
41
|
-
${
|
|
41
|
+
${i?d`
|
|
42
42
|
<button
|
|
43
43
|
class="menu-chevron-button"
|
|
44
44
|
type="button"
|
|
@@ -46,7 +46,7 @@ import{_ as g,b as _,g as f,h as r,m as v,v as u,y as l}from"../../vendor/vendor
|
|
|
46
46
|
aria-expanded=${String(this.expanded)}
|
|
47
47
|
aria-controls=${this.__submenuId}
|
|
48
48
|
tabindex=${t?"0":"-1"}
|
|
49
|
-
@click=${
|
|
49
|
+
@click=${l=>{l.stopPropagation(),this._toggleExpand(l)}}
|
|
50
50
|
>
|
|
51
51
|
<md-ripple></md-ripple>
|
|
52
52
|
<scb-chevron class="menu-chevron" .open=${this.expanded}></scb-chevron>
|
|
@@ -59,194 +59,20 @@ import{_ as g,b as _,g as f,h as r,m as v,v as u,y as l}from"../../vendor/vendor
|
|
|
59
59
|
class="submenu ${this.expanded?"expanded":""}"
|
|
60
60
|
role="region"
|
|
61
61
|
aria-hidden=${this.expanded?"false":"true"}
|
|
62
|
-
aria-busy=${
|
|
62
|
+
aria-busy=${i&&this.loading?"true":u}
|
|
63
63
|
>
|
|
64
64
|
<div class="submenu__inner">
|
|
65
65
|
<slot @slotchange=${this._onSlotChange}></slot>
|
|
66
|
-
${this.loading?
|
|
66
|
+
${this.loading?d`<div class="submenu-loading" role="status">Laddar…</div>`:u}
|
|
67
67
|
</div>
|
|
68
68
|
</div>
|
|
69
69
|
</div>
|
|
70
|
-
`}},o=c,c.__rippleLoaded=!1,c.__iconLoaded=!1,c.__focusRingLoaded=!1,c.styles=
|
|
71
|
-
:host {
|
|
72
|
-
/* Animationtokens */
|
|
73
|
-
--scb-menu-sub-transition-duration: var(--scb-motion-duration-quick, 150ms);
|
|
74
|
-
--scb-menu-sub-transition-easing: var(--scb-motion-easing-standard, cubic-bezier(.69,.16,.2,.98));
|
|
75
|
-
|
|
76
|
-
--scb-menu-chevron-transition-duration: var(--motion-duration-medium, 150ms);
|
|
77
|
-
--scb-menu-chevron-transition-easing: var(
|
|
70
|
+
`}},o=c,c.__rippleLoaded=!1,c.__iconLoaded=!1,c.__focusRingLoaded=!1,c.styles=v`@keyframes scb-menu-loading-spin{to{transform:rotate(1turn)}}:host{--scb-menu-sub-transition-duration:var(--scb-motion-duration-quick, 150ms);--scb-menu-sub-transition-easing:var(--scb-motion-easing-standard, cubic-bezier(.69,.16,.2,.98));--scb-menu-chevron-transition-duration:var(--motion-duration-medium, 150ms);--scb-menu-chevron-transition-easing:var(
|
|
78
71
|
--motion-easing-emphasized-accelerate,
|
|
79
72
|
var(--motion-easing-emphasized, cubic-bezier(.69,.16,.2,.98))
|
|
80
|
-
)
|
|
81
|
-
|
|
82
|
-
--scb-menu-item-padding-y: 14px;
|
|
83
|
-
--scb-menu-item-padding-x: 20px;
|
|
84
|
-
--scb-menu-item-padding-x-has-icon: var(--spacing-4, 12px);
|
|
85
|
-
--scb-menu-item-radius: 28px;
|
|
86
|
-
--scb-menu-item-gap: var(--spacing-4, 12px);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
:host([expanded]) {
|
|
90
|
-
--scb-menu-chevron-transition-easing: var(
|
|
73
|
+
);--scb-menu-item-padding-y:14px;--scb-menu-item-padding-x:20px;--scb-menu-item-padding-x-has-icon:var(--spacing-4, 12px);--scb-menu-item-radius:28px;--scb-menu-item-gap:var(--spacing-4, 12px)}:host([expanded]){--scb-menu-chevron-transition-easing:var(
|
|
91
74
|
--motion-easing-emphasized-decelerate,
|
|
92
75
|
var(--motion-easing-emphasized, cubic-bezier(.69,.16,.2,.98))
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.scb-menu-item-label {
|
|
97
|
-
display: flex;
|
|
98
|
-
align-items: center;
|
|
99
|
-
position: relative;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.scb-menu-label-text {
|
|
103
|
-
width: 100%;
|
|
104
|
-
display: block;
|
|
105
|
-
background: transparent;
|
|
106
|
-
border: 0;
|
|
107
|
-
text-align: left;
|
|
108
|
-
font: inherit;
|
|
109
|
-
color: inherit;
|
|
110
|
-
text-decoration: none;
|
|
111
|
-
cursor: pointer;
|
|
112
|
-
padding: 0;
|
|
113
|
-
margin: 0;
|
|
114
|
-
appearance: none;
|
|
115
|
-
-webkit-appearance: none;
|
|
116
|
-
box-sizing: border-box;
|
|
117
|
-
outline: none;
|
|
118
|
-
-webkit-tap-highlight-color: transparent;
|
|
119
|
-
}
|
|
120
|
-
.scb-menu-label-text:focus,
|
|
121
|
-
.scb-menu-label-text:focus-visible {
|
|
122
|
-
outline: none;
|
|
123
|
-
}
|
|
124
|
-
.scb-menu-label-text:-moz-focusring {
|
|
125
|
-
outline: none;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.scb-menu-click {
|
|
129
|
-
display: flex;
|
|
130
|
-
align-items: center;
|
|
131
|
-
gap: var(--scb-menu-item-gap);
|
|
132
|
-
padding-block: var(--scb-menu-item-padding-y);
|
|
133
|
-
padding-inline: var(--scb-menu-item-padding-x);
|
|
134
|
-
border-radius: var(--scb-menu-item-radius);
|
|
135
|
-
position: relative;
|
|
136
|
-
overflow: hidden;
|
|
137
|
-
color: var(--md-sys-color-on-surface);
|
|
138
|
-
}
|
|
139
|
-
.scb-menu-click.has-icon {
|
|
140
|
-
padding-inline: var(--scb-menu-item-padding-x-has-icon);
|
|
141
|
-
padding-block: var(--scb-menu-item-padding-y);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.scb-menu-click md-ripple {
|
|
145
|
-
--md-ripple-focus-opacity: 0;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.scb-menu-item-label[selected]:not([no-highlight-selected]) .scb-menu-click,
|
|
149
|
-
:host([selected]):not([no-highlight-selected]) .scb-menu-click {
|
|
150
|
-
color: var(--md-sys-color-on-secondary-container);
|
|
151
|
-
background: var(--md-sys-color-secondary-container);
|
|
152
|
-
font-weight: 600;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.menu-chevron-button {
|
|
156
|
-
margin-left: auto;
|
|
157
|
-
flex: 0 0 auto;
|
|
158
|
-
position: relative;
|
|
159
|
-
display: inline-flex;
|
|
160
|
-
align-items: center;
|
|
161
|
-
justify-content: center;
|
|
162
|
-
inline-size: 48px;
|
|
163
|
-
block-size: 48px;
|
|
164
|
-
padding: 0;
|
|
165
|
-
border: 0;
|
|
166
|
-
border-radius: 999px;
|
|
167
|
-
background: transparent;
|
|
168
|
-
color: inherit;
|
|
169
|
-
cursor: pointer;
|
|
170
|
-
-webkit-tap-highlight-color: transparent;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.menu-chevron-button:focus {
|
|
174
|
-
outline: none;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
.menu-chevron-button md-ripple {
|
|
178
|
-
border-radius: inherit;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.menu-chevron {
|
|
182
|
-
--scb-chevron-size: var(--icon-size-medium, 24px);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
:host([loading]) .menu-chevron-button {
|
|
186
|
-
cursor: progress;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
:host([loading]) .menu-chevron {
|
|
190
|
-
opacity: 0.7;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/* Undermeny: CSS-grid 0fr till 1fr för höjd-animation utan JS-mätningar */
|
|
194
|
-
.submenu {
|
|
195
|
-
display: grid;
|
|
196
|
-
grid-template-rows: 0fr;
|
|
197
|
-
transition:
|
|
198
|
-
grid-template-rows var(--scb-menu-sub-transition-duration) var(--scb-menu-sub-transition-easing),
|
|
199
|
-
opacity var(--scb-menu-sub-transition-duration) var(--scb-menu-sub-transition-easing);
|
|
200
|
-
opacity: 0;
|
|
201
|
-
overflow: hidden;
|
|
202
|
-
padding-left: var(--spacing-5, 16px);
|
|
203
|
-
}
|
|
204
|
-
.submenu.expanded {
|
|
205
|
-
grid-template-rows: 1fr;
|
|
206
|
-
opacity: 1;
|
|
207
|
-
}
|
|
208
|
-
.submenu__inner {
|
|
209
|
-
overflow: hidden;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
.submenu-loading {
|
|
213
|
-
display: flex;
|
|
214
|
-
align-items: center;
|
|
215
|
-
gap: var(--spacing-3, 8px);
|
|
216
|
-
padding-block: var(--spacing-3, 8px);
|
|
217
|
-
padding-inline: var(--spacing-5, 16px);
|
|
218
|
-
color: var(
|
|
219
|
-
--scb-menu-loading-color,
|
|
76
|
+
)}.scb-menu-item-label{display:flex;align-items:center;position:relative}.scb-menu-label-text{width:100%;display:block;background:0 0;border:0;text-align:left;font:inherit;color:inherit;text-decoration:none;cursor:pointer;padding:0;margin:0;appearance:none;-webkit-appearance:none;box-sizing:border-box;outline:0;-webkit-tap-highlight-color:transparent}.scb-menu-label-text:focus,.scb-menu-label-text:focus-visible{outline:0}.scb-menu-label-text:-moz-focusring{outline:0}.scb-menu-click,.scb-menu-click.has-icon{padding-block:var(--scb-menu-item-padding-y)}.scb-menu-click{display:flex;align-items:center;gap:var(--scb-menu-item-gap);padding-inline:var(--scb-menu-item-padding-x);border-radius:var(--scb-menu-item-radius);position:relative;overflow:hidden;color:var(--md-sys-color-on-surface)}.scb-menu-click.has-icon{padding-inline:var(--scb-menu-item-padding-x-has-icon)}.scb-menu-click md-ripple{--md-ripple-focus-opacity:0}.scb-menu-item-label[selected]:not([no-highlight-selected]) .scb-menu-click,:host([selected]):not([no-highlight-selected]) .scb-menu-click{color:var(--md-sys-color-on-secondary-container);background:var(--md-sys-color-secondary-container);font-weight:600}.menu-chevron-button{margin-left:auto;flex:0 0 auto;position:relative;display:inline-flex;align-items:center;justify-content:center;inline-size:48px;block-size:48px;padding:0;border:0;border-radius:999px;background:0 0;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}.menu-chevron-button:focus{outline:0}.menu-chevron-button md-ripple{border-radius:inherit}.menu-chevron{--scb-chevron-size:var(--icon-size-medium, 24px)}:host([loading]) .menu-chevron-button{cursor:progress}:host([loading]) .menu-chevron{opacity:.7}.submenu{display:grid;grid-template-rows:0fr;transition:grid-template-rows var(--scb-menu-sub-transition-duration) var(--scb-menu-sub-transition-easing),opacity var(--scb-menu-sub-transition-duration) var(--scb-menu-sub-transition-easing);opacity:0;padding-left:var(--spacing-5, 16px)}.submenu.expanded{grid-template-rows:1fr;opacity:1}.submenu,.submenu__inner{overflow:hidden}.submenu-loading{display:flex;align-items:center;gap:var(--spacing-3, 8px);padding-block:var(--spacing-3, 8px);padding-inline:var(--spacing-5, 16px);color:var(--scb-menu-loading-color,
|
|
220
77
|
var(--md-sys-color-on-surface-variant, currentColor)
|
|
221
|
-
);
|
|
222
|
-
font-size: var(--md-sys-typescale-body-small-size, 0.875rem);
|
|
223
|
-
line-height: var(--md-sys-typescale-body-small-line-height, 1.25rem);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
.submenu-loading::before {
|
|
227
|
-
content: '';
|
|
228
|
-
inline-size: 0.75rem;
|
|
229
|
-
block-size: 0.75rem;
|
|
230
|
-
border-radius: 999px;
|
|
231
|
-
border: 2px solid currentColor;
|
|
232
|
-
border-inline-end-color: transparent;
|
|
233
|
-
animation: scb-menu-loading-spin 700ms linear infinite;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
@keyframes scb-menu-loading-spin {
|
|
237
|
-
to {
|
|
238
|
-
transform: rotate(1turn);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/* Minskar rörelse för användare som önskar det */
|
|
243
|
-
@media (prefers-reduced-motion: reduce) {
|
|
244
|
-
.submenu {
|
|
245
|
-
transition: none;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
.submenu-loading::before {
|
|
249
|
-
animation: none;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
`,c);s([r({type:String})],i.prototype,"label",void 0);s([r({type:Boolean,reflect:!0})],i.prototype,"selected",void 0);s([r({type:Boolean,attribute:"no-highlight-selected",reflect:!0})],i.prototype,"noHighlightSelected",void 0);s([r({type:String,attribute:"leading-icon"})],i.prototype,"leadingIcon",void 0);s([r({type:String,attribute:"item-href"})],i.prototype,"itemHref",void 0);s([r({type:Boolean,attribute:"has-children",reflect:!0,converter:b})],i.prototype,"hasChildren",void 0);s([r({type:Boolean,reflect:!0,converter:b})],i.prototype,"loading",void 0);s([v()],i.prototype,"hasSlotContent",void 0);s([r({type:Boolean,reflect:!0})],i.prototype,"expanded",void 0);i=o=s([f("scb-menu-item")],i);
|
|
78
|
+
);font-size:var(--md-sys-typescale-body-small-size, 0.875rem);line-height:var(--md-sys-typescale-body-small-line-height, 1.25rem)}.submenu-loading::before{content:"";inline-size:.75rem;block-size:.75rem;border-radius:999px;border:2px solid currentColor;border-inline-end-color:transparent;animation:scb-menu-loading-spin 700ms linear infinite}@media (prefers-reduced-motion:reduce){.submenu{transition:none}.submenu-loading::before{animation:none}}`,c);s([r({type:String})],n.prototype,"label",void 0);s([r({type:Boolean,reflect:!0})],n.prototype,"selected",void 0);s([r({type:Boolean,attribute:"no-highlight-selected",reflect:!0})],n.prototype,"noHighlightSelected",void 0);s([r({type:String,attribute:"leading-icon"})],n.prototype,"leadingIcon",void 0);s([r({type:String,attribute:"item-href"})],n.prototype,"itemHref",void 0);s([r({type:Boolean,attribute:"has-children",reflect:!0,converter:b})],n.prototype,"hasChildren",void 0);s([r({type:Boolean,reflect:!0,converter:b})],n.prototype,"loading",void 0);s([g()],n.prototype,"hasSlotContent",void 0);s([r({type:Boolean,reflect:!0})],n.prototype,"expanded",void 0);n=o=s([f("scb-menu-item")],n);
|
|
@@ -1,42 +1,10 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{h as m,m as b,p as u,v as c,y as p}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as l}from"../../vendor/decorate.js";import"../scb-divider/scb-divider.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var i=customElements.define.bind(customElements);customElements.define=function(s,o,d){try{customElements.get(s)||i(s,o,d)}catch(r){var a=String(r||"");if(a.indexOf("already been used")===-1&&a.indexOf("NotSupportedError")===-1)throw r}}}}catch{}})();var t,n=(t=class extends m{constructor(...i){super(...i),this.label=""}render(){return c`
|
|
2
2
|
<scb-divider></scb-divider>
|
|
3
|
-
${this.label?
|
|
3
|
+
${this.label?c`
|
|
4
4
|
<div class="scb-menu-section">
|
|
5
5
|
<div class="scb-menu-label">${this.label}</div>
|
|
6
6
|
</div>
|
|
7
7
|
`:""}
|
|
8
|
-
`}},t.styles=
|
|
9
|
-
:host {
|
|
10
|
-
color: var(--md-sys-color-on-surface);
|
|
11
|
-
font-family: var(--brand-font);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.scb-menu-section {
|
|
15
|
-
display: block;
|
|
16
|
-
width: 100%;
|
|
17
|
-
|
|
18
|
-
padding-block: var(--scb-menu-section-padding-block, 14px);
|
|
19
|
-
padding-inline: var(--spacing-4, 12px);
|
|
20
|
-
color: var(--md-sys-color-on-surface);
|
|
21
|
-
font-weight: var(--weight-semibold, 600);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.scb-menu-label {
|
|
25
|
-
font-family: var(--brand-font);
|
|
26
|
-
font-size: var(--md-sys-typescale-label-medium-size);
|
|
27
|
-
line-height: var(--md-sys-typescale-label-medium-line-height);
|
|
28
|
-
font-weight: var(
|
|
29
|
-
--md-sys-typescale-label-medium-weight,
|
|
8
|
+
`}},t.styles=p`:host{color:var(--md-sys-color-on-surface);font-family:var(--brand-font)}.scb-menu-label,.scb-menu-section{color:var(--md-sys-color-on-surface)}.scb-menu-section{display:block;width:100%;padding-block:var(--scb-menu-section-padding-block, 14px);padding-inline:var(--spacing-4, 12px);font-weight:var(--weight-semibold, 600)}.scb-menu-label{font-family:var(--brand-font);font-size:var(--md-sys-typescale-label-medium-size);line-height:var(--md-sys-typescale-label-medium-line-height);font-weight:var(--md-sys-typescale-label-medium-weight,
|
|
30
9
|
var(--weight-semibold)
|
|
31
|
-
);
|
|
32
|
-
letter-spacing: var(
|
|
33
|
-
--md-sys-typescale-label-medium-tracking
|
|
34
|
-
);
|
|
35
|
-
color: var(--md-sys-color-on-surface);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
scb-divider {
|
|
39
|
-
margin-block: var(--spacing-2, 4px);
|
|
40
|
-
margin-inline: var(--spacing-4, 12px);
|
|
41
|
-
}
|
|
42
|
-
`,t);c([v({type:String})],a.prototype,"label",void 0);a=c([u("scb-menu-section")],a);
|
|
10
|
+
);letter-spacing:var(--md-sys-typescale-label-medium-tracking)}scb-divider{margin-block:var(--spacing-2, 4px);margin-inline:var(--spacing-4, 12px)}`,t);l([u({type:String})],n.prototype,"label",void 0);n=l([b("scb-menu-section")],n);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{g as m,h as f,m as v,p as n,v as b,y as z}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as r}from"../../vendor/decorate.js";import{n as _,t as y}from"../../vendor/assertClassBrand.js";import"../scb-divider/scb-divider.js";import"./scb-menu-item.js";import"./scb-menu-section.js";import"./scb-sub-menu.js";(function(){try{var c=typeof globalThis<"u"?globalThis:window;if(!c.__scb_ce_guard_installed__){c.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,i,a){try{customElements.get(t)||e(t,i,a)}catch(o){var l=String(o||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var h,u,s=(h=new WeakSet,u=class extends f{constructor(...e){super(...e),_(this,h),this.label="",this.subLabel="",this.noHighlightSelected=!1,this.elevation=!1,this.lazySrc="",this.lazyIdParam="id",this.lazyChildrenField="",this.lazyIdField="id",this.lazyLabelField="label",this.lazyHrefField="href",this.lazyHasChildrenField="hasChildren",this.lazyHasLinkField="hasLink",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._lazyCache=new Map,this._onGlobalSelect=t=>{const i=t;this.querySelectorAll("scb-menu-item").forEach(a=>{a.selected=!1,this.noHighlightSelected?a.setAttribute("no-highlight-selected",""):a.removeAttribute("no-highlight-selected")}),this.contains(i.detail.item)&&(i.detail.item.selected=!0)},this._onMenuExpand=t=>{this._loadLazyChildren(t)}}render(){return b`
|
|
2
2
|
<nav
|
|
3
3
|
aria-label="${this.label}"
|
|
4
4
|
>
|
|
@@ -10,77 +10,13 @@ import{_ as m,b as f,g as v,h as n,v as _,y as b}from"../../vendor/vendor.js";im
|
|
|
10
10
|
</div>
|
|
11
11
|
</div>
|
|
12
12
|
<scb-divider></scb-divider>
|
|
13
|
-
`:
|
|
13
|
+
`:m}
|
|
14
14
|
<div class="panel">
|
|
15
15
|
<slot></slot>
|
|
16
16
|
</div>
|
|
17
17
|
</nav>
|
|
18
|
-
`}firstUpdated(e){super.firstUpdated(e),y(h,this,g).call(this)}updated(e){super.updated(e),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&y(h,this,g).call(this)}mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}connectedCallback(){super.connectedCallback(),window.addEventListener("scb-menu-select",this._onGlobalSelect),this.addEventListener("scb-menu-expand",this._onMenuExpand)}disconnectedCallback(){window.removeEventListener("scb-menu-select",this._onGlobalSelect),this.removeEventListener("scb-menu-expand",this._onMenuExpand),super.disconnectedCallback()}async _loadLazyChildren(e){if(!this.lazySrc)return;const t=e.detail?.item;if(!t||!this.contains(t)||!e.detail?.expanded||t.hasAttribute("data-loaded")||!t.hasAttribute("has-children")||e.detail?.lazy===!1||this._hasSubMenu(t))return;const i=t.getAttribute("data-node-id")??t.dataset.nodeId;if(i){this._setItemLoading(t,!0),t.removeAttribute("data-load-error");try{const a=await this._fetchLazyChildren(i),l=this._createSubMenu(t,a);t.appendChild(l),t.setAttribute("data-loaded",""),this.dispatchEvent(new CustomEvent("scb-menu-lazy-load",{bubbles:!0,composed:!0,detail:{item:t,nodeId:i,children:a}}))}catch(a){t.setAttribute("data-load-error",""),this.dispatchEvent(new CustomEvent("scb-menu-lazy-error",{bubbles:!0,composed:!0,detail:{item:t,nodeId:i,error:a}}))}finally{this._setItemLoading(t,!1)}}}_setItemLoading(e,t){e.loading=t,e.toggleAttribute("loading",t),t?e.setAttribute("aria-busy","true"):e.removeAttribute("aria-busy")}_hasSubMenu(e){return Array.from(e.children).some(t=>t.tagName==="SCB-SUB-MENU")}_createSubMenu(e,t){const i=document.createElement("scb-sub-menu");i.setAttribute("label",e.getAttribute("label")??"");for(const a of t)i.appendChild(this._createLazyMenuItem(a));return i}_createLazyMenuItem(e){const t=document.createElement("scb-menu-item"),i=this._getRecordValue(e,this.lazyIdField,["id","Id"]),a=this._getRecordValue(e,this.lazyLabelField,["label","Label","name","Name"]),l=this._getRecordValue(e,this.lazyHrefField,["href","Href","url","Url"]),o=this._toBoolean(this._getRecordValue(e,this.lazyHasChildrenField,["hasChildren","HasChildren"])),d=this._getRecordValue(e,this.lazyHasLinkField,["hasLink","HasLink"]),p=d==null?!!l:this._toBoolean(d);return a!=null&&t.setAttribute("label",String(a)),i!=null&&t.setAttribute("data-node-id",String(i)),o&&t.setAttribute("has-children",""),p&&l!=null&&String(l).trim()&&t.setAttribute("item-href",String(l)),t}async _fetchLazyChildren(e){const t=`${this.lazySrc}|${this.lazyIdParam}|${e}`;let i=this._lazyCache.get(t);return i||(i=fetch(this._createLazyUrl(e),{credentials:"same-origin"}).then(async a=>{if(!a.ok)throw new Error(`Kunde inte ladda menybarn (${a.status}).`);const l=await a.json();return this._normalizeChildren(l)}).catch(a=>{throw this._lazyCache.delete(t),a}),this._lazyCache.set(t,i)),i}_createLazyUrl(e){if(this.lazySrc.includes("{id}"))return this.lazySrc.split("{id}").join(encodeURIComponent(e));const t=new URL(this.lazySrc,document.baseURI);return this.lazyIdParam&&t.searchParams.set(this.lazyIdParam,e),t.toString()}_normalizeChildren(e){const t=Array.isArray(e)?e:this._getRecordValue(e,this.lazyChildrenField,["children","Children","items","Items","data","Data"]);return Array.isArray(t)?t.filter(i=>!!i&&typeof i=="object"&&!Array.isArray(i)):[]}_getRecordValue(e,t,i=[]){if(!e||typeof e!="object"||Array.isArray(e))return;const a=e,l=[t,...i].filter(Boolean);for(const o of l){if(o in a)return a[o];const d=Object.keys(a).find(p=>p.toLowerCase()===o.toLowerCase());if(d)return a[d]}}_toBoolean(e){return typeof e=="boolean"?e:typeof e=="number"?e!==0:typeof e=="string"?!/^(false|0|off|no|nej)$/i.test(e.trim()):!!e}},u.styles=
|
|
19
|
-
:host {
|
|
20
|
-
display: block;
|
|
21
|
-
color: var(--md-sys-color-on-surface);
|
|
22
|
-
padding: var(--spacing-4, 12px);
|
|
23
|
-
background: var(--scb-menu-background, var(--md-sys-color-surface-container-low));
|
|
24
|
-
font-family: var(--brand-font);
|
|
25
|
-
|
|
26
|
-
margin-block-start: var(--scb-menu-spacing-block-start, 0);
|
|
27
|
-
margin-block-end: var(--scb-menu-spacing-block-end, 0);
|
|
28
|
-
margin-inline-start: var(--scb-menu-spacing-inline-start, 0);
|
|
29
|
-
margin-inline-end: var(--scb-menu-spacing-inline-end, 0);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
:host([elevation]) {
|
|
33
|
-
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.30), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
|
|
34
|
-
border-radius: 0 var(--radius-Large, 16px) var(--radius-Large, 16px) 0;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.scb-menu-label {
|
|
38
|
-
font-size: var(--md-sys-typescale-label-large-size);
|
|
39
|
-
line-height: var(
|
|
40
|
-
--md-sys-typescale-label-large-line-height
|
|
41
|
-
);
|
|
42
|
-
font-weight: var(
|
|
43
|
-
--md-sys-typescale-label-large-weight,
|
|
18
|
+
`}firstUpdated(e){super.firstUpdated(e),y(h,this,g).call(this)}updated(e){super.updated(e),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&y(h,this,g).call(this)}mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}connectedCallback(){super.connectedCallback(),window.addEventListener("scb-menu-select",this._onGlobalSelect),this.addEventListener("scb-menu-expand",this._onMenuExpand)}disconnectedCallback(){window.removeEventListener("scb-menu-select",this._onGlobalSelect),this.removeEventListener("scb-menu-expand",this._onMenuExpand),super.disconnectedCallback()}async _loadLazyChildren(e){if(!this.lazySrc)return;const t=e.detail?.item;if(!t||!this.contains(t)||!e.detail?.expanded||t.hasAttribute("data-loaded")||!t.hasAttribute("has-children")||e.detail?.lazy===!1||this._hasSubMenu(t))return;const i=t.getAttribute("data-node-id")??t.dataset.nodeId;if(i){this._setItemLoading(t,!0),t.removeAttribute("data-load-error");try{const a=await this._fetchLazyChildren(i),l=this._createSubMenu(t,a);t.appendChild(l),t.setAttribute("data-loaded",""),this.dispatchEvent(new CustomEvent("scb-menu-lazy-load",{bubbles:!0,composed:!0,detail:{item:t,nodeId:i,children:a}}))}catch(a){t.setAttribute("data-load-error",""),this.dispatchEvent(new CustomEvent("scb-menu-lazy-error",{bubbles:!0,composed:!0,detail:{item:t,nodeId:i,error:a}}))}finally{this._setItemLoading(t,!1)}}}_setItemLoading(e,t){e.loading=t,e.toggleAttribute("loading",t),t?e.setAttribute("aria-busy","true"):e.removeAttribute("aria-busy")}_hasSubMenu(e){return Array.from(e.children).some(t=>t.tagName==="SCB-SUB-MENU")}_createSubMenu(e,t){const i=document.createElement("scb-sub-menu");i.setAttribute("label",e.getAttribute("label")??"");for(const a of t)i.appendChild(this._createLazyMenuItem(a));return i}_createLazyMenuItem(e){const t=document.createElement("scb-menu-item"),i=this._getRecordValue(e,this.lazyIdField,["id","Id"]),a=this._getRecordValue(e,this.lazyLabelField,["label","Label","name","Name"]),l=this._getRecordValue(e,this.lazyHrefField,["href","Href","url","Url"]),o=this._toBoolean(this._getRecordValue(e,this.lazyHasChildrenField,["hasChildren","HasChildren"])),d=this._getRecordValue(e,this.lazyHasLinkField,["hasLink","HasLink"]),p=d==null?!!l:this._toBoolean(d);return a!=null&&t.setAttribute("label",String(a)),i!=null&&t.setAttribute("data-node-id",String(i)),o&&t.setAttribute("has-children",""),p&&l!=null&&String(l).trim()&&t.setAttribute("item-href",String(l)),t}async _fetchLazyChildren(e){const t=`${this.lazySrc}|${this.lazyIdParam}|${e}`;let i=this._lazyCache.get(t);return i||(i=fetch(this._createLazyUrl(e),{credentials:"same-origin"}).then(async a=>{if(!a.ok)throw new Error(`Kunde inte ladda menybarn (${a.status}).`);const l=await a.json();return this._normalizeChildren(l)}).catch(a=>{throw this._lazyCache.delete(t),a}),this._lazyCache.set(t,i)),i}_createLazyUrl(e){if(this.lazySrc.includes("{id}"))return this.lazySrc.split("{id}").join(encodeURIComponent(e));const t=new URL(this.lazySrc,document.baseURI);return this.lazyIdParam&&t.searchParams.set(this.lazyIdParam,e),t.toString()}_normalizeChildren(e){const t=Array.isArray(e)?e:this._getRecordValue(e,this.lazyChildrenField,["children","Children","items","Items","data","Data"]);return Array.isArray(t)?t.filter(i=>!!i&&typeof i=="object"&&!Array.isArray(i)):[]}_getRecordValue(e,t,i=[]){if(!e||typeof e!="object"||Array.isArray(e))return;const a=e,l=[t,...i].filter(Boolean);for(const o of l){if(o in a)return a[o];const d=Object.keys(a).find(p=>p.toLowerCase()===o.toLowerCase());if(d)return a[d]}}_toBoolean(e){return typeof e=="boolean"?e:typeof e=="number"?e!==0:typeof e=="string"?!/^(false|0|off|no|nej)$/i.test(e.trim()):!!e}},u.styles=z`:host{display:block;color:var(--md-sys-color-on-surface);padding:var(--spacing-4, 12px);background:var(--scb-menu-background, var(--md-sys-color-surface-container-low));font-family:var(--brand-font);margin-block-start:var(--scb-menu-spacing-block-start, 0);margin-block-end:var(--scb-menu-spacing-block-end, 0);margin-inline-start:var(--scb-menu-spacing-inline-start, 0);margin-inline-end:var(--scb-menu-spacing-inline-end, 0)}:host([elevation]){box-shadow:0 1px 2px 0 rgba(0,0,0,.3),0 2px 6px 2px rgba(0,0,0,.15);border-radius:0 var(--radius-Large, 16px) var(--radius-Large, 16px)0}.scb-menu-label,.scb-menu-sublabel{color:var(--md-sys-color-on-surface)}.scb-menu-label{font-size:var(--md-sys-typescale-label-large-size);line-height:var(--md-sys-typescale-label-large-line-height);font-weight:var(--md-sys-typescale-label-large-weight,
|
|
44
19
|
var(--weight-semibold)
|
|
45
|
-
);
|
|
46
|
-
letter-spacing: var(
|
|
47
|
-
--md-sys-typescale-label-large-tracking
|
|
48
|
-
);
|
|
49
|
-
color: var(--md-sys-color-on-surface);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.scb-menu-sublabel {
|
|
53
|
-
font-size: var(--md-sys-typescale-body-small-size);
|
|
54
|
-
line-height: var(
|
|
55
|
-
--md-sys-typescale-body-small-line-height
|
|
56
|
-
);
|
|
57
|
-
font-weight: var(
|
|
58
|
-
--md-sys-typescale-body-small-weight,
|
|
20
|
+
);letter-spacing:var(--md-sys-typescale-label-large-tracking)}.scb-menu-sublabel{font-size:var(--md-sys-typescale-body-small-size);line-height:var(--md-sys-typescale-body-small-line-height);font-weight:var(--md-sys-typescale-body-small-weight,
|
|
59
21
|
var(--weight-regular)
|
|
60
|
-
);
|
|
61
|
-
letter-spacing: var(
|
|
62
|
-
--md-sys-typescale-body-small-tracking
|
|
63
|
-
);
|
|
64
|
-
color: var(--md-sys-color-on-surface);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.scb-menu-label-wrapper {
|
|
68
|
-
padding: var(--spacing-4, 12px);
|
|
69
|
-
color: inherit;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
scb-divider {
|
|
73
|
-
margin-block: var(--spacing-2, 4px);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
::slotted(scb-search) {
|
|
77
|
-
display: block;
|
|
78
|
-
width: 100%;
|
|
79
|
-
box-sizing: border-box;
|
|
80
|
-
padding: var(--scb-menu-search-padding, var(--spacing-4, 12px));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.panel {
|
|
84
|
-
contain: layout paint style;
|
|
85
|
-
}
|
|
86
|
-
`,u);function g(){const c=this.mapSpacingToken(this.spacing),e=this.mapSpacingToken(this.spacingTop)??c,t=this.mapSpacingToken(this.spacingBottom)??c,i=this.mapSpacingToken(this.spacingLeft),a=this.mapSpacingToken(this.spacingRight);e?this.style.setProperty("--scb-menu-spacing-block-start",e):this.style.removeProperty("--scb-menu-spacing-block-start"),t?this.style.setProperty("--scb-menu-spacing-block-end",t):this.style.removeProperty("--scb-menu-spacing-block-end"),i?this.style.setProperty("--scb-menu-spacing-inline-start",i):this.style.removeProperty("--scb-menu-spacing-inline-start"),a?this.style.setProperty("--scb-menu-spacing-inline-end",a):this.style.removeProperty("--scb-menu-spacing-inline-end")}r([n({type:String})],s.prototype,"label",void 0);r([n({type:String,attribute:"sub-label"})],s.prototype,"subLabel",void 0);r([n({type:Boolean,attribute:"no-highlight-selected",reflect:!0})],s.prototype,"noHighlightSelected",void 0);r([n({type:Boolean,reflect:!0})],s.prototype,"elevation",void 0);r([n({type:String,attribute:"lazy-src"})],s.prototype,"lazySrc",void 0);r([n({type:String,attribute:"lazy-id-param"})],s.prototype,"lazyIdParam",void 0);r([n({type:String,attribute:"lazy-children-field"})],s.prototype,"lazyChildrenField",void 0);r([n({type:String,attribute:"lazy-id-field"})],s.prototype,"lazyIdField",void 0);r([n({type:String,attribute:"lazy-label-field"})],s.prototype,"lazyLabelField",void 0);r([n({type:String,attribute:"lazy-href-field"})],s.prototype,"lazyHrefField",void 0);r([n({type:String,attribute:"lazy-has-children-field"})],s.prototype,"lazyHasChildrenField",void 0);r([n({type:String,attribute:"lazy-has-link-field"})],s.prototype,"lazyHasLinkField",void 0);r([n({type:String,reflect:!0})],s.prototype,"spacing",void 0);r([n({type:String,attribute:"spacing-top",reflect:!0})],s.prototype,"spacingTop",void 0);r([n({type:String,attribute:"spacing-bottom",reflect:!0})],s.prototype,"spacingBottom",void 0);r([n({type:String,attribute:"spacing-left",reflect:!0})],s.prototype,"spacingLeft",void 0);r([n({type:String,attribute:"spacing-right",reflect:!0})],s.prototype,"spacingRight",void 0);s=r([v("scb-menu")],s);export{s as ScbMenu};
|
|
22
|
+
);letter-spacing:var(--md-sys-typescale-body-small-tracking)}.scb-menu-label-wrapper{padding:var(--spacing-4, 12px);color:inherit}scb-divider{margin-block:var(--spacing-2, 4px)}::slotted(scb-search){display:block;width:100%;box-sizing:border-box;padding:var(--scb-menu-search-padding, var(--spacing-4, 12px))}.panel{contain:layout paint style}`,u);function g(){const c=this.mapSpacingToken(this.spacing),e=this.mapSpacingToken(this.spacingTop)??c,t=this.mapSpacingToken(this.spacingBottom)??c,i=this.mapSpacingToken(this.spacingLeft),a=this.mapSpacingToken(this.spacingRight);e?this.style.setProperty("--scb-menu-spacing-block-start",e):this.style.removeProperty("--scb-menu-spacing-block-start"),t?this.style.setProperty("--scb-menu-spacing-block-end",t):this.style.removeProperty("--scb-menu-spacing-block-end"),i?this.style.setProperty("--scb-menu-spacing-inline-start",i):this.style.removeProperty("--scb-menu-spacing-inline-start"),a?this.style.setProperty("--scb-menu-spacing-inline-end",a):this.style.removeProperty("--scb-menu-spacing-inline-end")}r([n({type:String})],s.prototype,"label",void 0);r([n({type:String,attribute:"sub-label"})],s.prototype,"subLabel",void 0);r([n({type:Boolean,attribute:"no-highlight-selected",reflect:!0})],s.prototype,"noHighlightSelected",void 0);r([n({type:Boolean,reflect:!0})],s.prototype,"elevation",void 0);r([n({type:String,attribute:"lazy-src"})],s.prototype,"lazySrc",void 0);r([n({type:String,attribute:"lazy-id-param"})],s.prototype,"lazyIdParam",void 0);r([n({type:String,attribute:"lazy-children-field"})],s.prototype,"lazyChildrenField",void 0);r([n({type:String,attribute:"lazy-id-field"})],s.prototype,"lazyIdField",void 0);r([n({type:String,attribute:"lazy-label-field"})],s.prototype,"lazyLabelField",void 0);r([n({type:String,attribute:"lazy-href-field"})],s.prototype,"lazyHrefField",void 0);r([n({type:String,attribute:"lazy-has-children-field"})],s.prototype,"lazyHasChildrenField",void 0);r([n({type:String,attribute:"lazy-has-link-field"})],s.prototype,"lazyHasLinkField",void 0);r([n({type:String,reflect:!0})],s.prototype,"spacing",void 0);r([n({type:String,attribute:"spacing-top",reflect:!0})],s.prototype,"spacingTop",void 0);r([n({type:String,attribute:"spacing-bottom",reflect:!0})],s.prototype,"spacingBottom",void 0);r([n({type:String,attribute:"spacing-left",reflect:!0})],s.prototype,"spacingLeft",void 0);r([n({type:String,attribute:"spacing-right",reflect:!0})],s.prototype,"spacingRight",void 0);s=r([v("scb-menu")],s);export{s as ScbMenu};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{h as d,m as u,p as b,v as m,y as _}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as r}from"../../vendor/decorate.js";(function(){try{var s=typeof globalThis<"u"?globalThis:window;if(!s.__scb_ce_guard_installed__){s.__scb_ce_guard_installed__=!0;var n=customElements.define.bind(customElements);customElements.define=function(e,t,l){try{customElements.get(e)||n(e,t,l)}catch(o){var i=String(o||"");if(i.indexOf("already been used")===-1&&i.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var c,a=(c=class extends d{constructor(...n){super(...n),this.label="",this._onGlobalSelect=e=>{const t=e;this.querySelectorAll("scb-menu-item").forEach(l=>l.selected=!1),this.contains(t.detail.item)&&(t.detail.item.selected=!0)}}connectedCallback(){super.connectedCallback(),window.addEventListener("scb-menu-select",this._onGlobalSelect)}disconnectedCallback(){window.removeEventListener("scb-menu-select",this._onGlobalSelect),super.disconnectedCallback()}render(){return m`
|
|
2
2
|
<nav aria-label="${this.label}">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</nav>
|
|
5
|
-
`}},c.styles=u
|
|
6
|
-
:host {
|
|
7
|
-
display: block;
|
|
8
|
-
width: 100%;
|
|
9
|
-
}
|
|
10
|
-
`,c);r([m({type:String})],a.prototype,"label",void 0);a=r([b("scb-sub-menu")],a);
|
|
5
|
+
`}},c.styles=_`:host{display:block;width:100%}`,c);r([b({type:String})],a.prototype,"label",void 0);a=r([u("scb-sub-menu")],a);
|
|
@@ -1,28 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
:host {
|
|
3
|
-
display: inline-flex;
|
|
4
|
-
align-items: center;
|
|
5
|
-
justify-content: center;
|
|
6
|
-
outline: none;
|
|
7
|
-
position: relative;
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
:host([disabled]) {
|
|
12
|
-
cursor: default;
|
|
13
|
-
pointer-events: none;
|
|
14
|
-
opacity: 0.6;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
:host(:focus-visible) {
|
|
18
|
-
outline: none;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
:host(:focus) {
|
|
22
|
-
outline: none;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.label {
|
|
26
|
-
pointer-events: none;
|
|
27
|
-
}
|
|
28
|
-
`,o);s([a({type:String})],n.prototype,"href",void 0);s([a({type:String,attribute:"data-href"})],n.prototype,"dataHref",void 0);s([a({type:Boolean,reflect:!0})],n.prototype,"disabled",void 0);n=s([f("scb-nav-item")],n);
|
|
1
|
+
import{h,m as f,p as a,v as u,y as _}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as s}from"../../vendor/decorate.js";(function(){try{var r=typeof globalThis<"u"?globalThis:window;if(!r.__scb_ce_guard_installed__){r.__scb_ce_guard_installed__=!0;var i=customElements.define.bind(customElements);customElements.define=function(e,t,c){try{customElements.get(e)||i(e,t,c)}catch(l){var d=String(l||"");if(d.indexOf("already been used")===-1&&d.indexOf("NotSupportedError")===-1)throw l}}}}catch{}})();var o,n=(o=class extends h{constructor(...i){super(...i),this.href="",this.dataHref="",this.disabled=!1,this.__onClick=e=>{if(e.defaultPrevented)return;if(this.disabled){e.preventDefault(),e.stopImmediatePropagation();return}const t=(this.href||"").trim();if(t){if(t.startsWith("#")){typeof window<"u"&&(window.location.hash=t.slice(1));return}if((this.getAttribute("target")||"").trim()==="_blank"){window.open(t,"_blank","noopener,noreferrer");return}window.location.href=t}},this.__onKeyDown=e=>{if(!this.disabled){if(e.key==="Enter"){e.preventDefault(),this.click();return}e.key===" "&&e.preventDefault()}},this.__onKeyUp=e=>{this.disabled||e.key===" "&&(e.preventDefault(),this.click())}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.__onClick),this.addEventListener("keydown",this.__onKeyDown),this.addEventListener("keyup",this.__onKeyUp),this.__syncA11y()}disconnectedCallback(){this.removeEventListener("click",this.__onClick),this.removeEventListener("keydown",this.__onKeyDown),this.removeEventListener("keyup",this.__onKeyUp),super.disconnectedCallback()}updated(){this.__syncA11y()}__syncA11y(){const i=!!(this.href||"").trim();if(this.disabled){this.setAttribute("aria-disabled","true"),this.tabIndex=-1,this.removeAttribute("role");return}this.removeAttribute("aria-disabled"),this.tabIndex=0,this.setAttribute("role",i?"link":"button")}render(){return u`<span class="label"><slot></slot></span>`}},o.styles=_`:host{display:inline-flex;align-items:center;justify-content:center;outline:0;position:relative;overflow:hidden}:host([disabled]){cursor:default;pointer-events:none;opacity:.6}:host(:focus),:host(:focus-visible){outline:0}.label{pointer-events:none}`,o);s([a({type:String})],n.prototype,"href",void 0);s([a({type:String,attribute:"data-href"})],n.prototype,"dataHref",void 0);s([a({type:Boolean,reflect:!0})],n.prototype,"disabled",void 0);n=s([f("scb-nav-item")],n);
|