scb-wc-test 0.1.21 → 0.1.23
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/all.js +2 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/mvc/components/all.js +1 -1
- package/mvc/components/scb-chip/scb-chip.js +48 -0
- package/mvc/components/scb-dialog/scb-dialog.js +2 -2
- package/mvc/components/scb-header/scb-header.js +9 -14
- package/mvc/components/scb-list/scb-list-item.js +7 -4
- package/mvc/components/scb-list/scb-list.js +11 -4
- package/package.json +6 -10
- package/{scb-chips → scb-chip}/scb-chip.d.ts +2 -0
- package/{scb-chips → scb-chip}/scb-chip.js +34 -24
- package/scb-dialog/scb-dialog.js +1 -1
- package/scb-header/scb-header.js +5 -10
- package/scb-list/scb-list-item.d.ts +1 -0
- package/scb-list/scb-list-item.js +9 -3
- package/scb-list/scb-list.d.ts +6 -0
- package/scb-list/scb-list.js +48 -38
- package/scb-wc-test.bundle.js +163 -156
- package/mvc/components/scb-chips/scb-chip.js +0 -46
package/all.js
CHANGED
|
@@ -12,7 +12,7 @@ import './mvc/components/scb-calendar-card/scb-calendar-card.js';
|
|
|
12
12
|
import './mvc/components/scb-card/scb-card.js';
|
|
13
13
|
import './mvc/components/scb-checkbox/scb-checkbox-group.js';
|
|
14
14
|
import './mvc/components/scb-checkbox/scb-checkbox.js';
|
|
15
|
-
import './mvc/components/scb-
|
|
15
|
+
import './mvc/components/scb-chip/scb-chip.js';
|
|
16
16
|
import './mvc/components/scb-dialog/scb-dialog.js';
|
|
17
17
|
import './mvc/components/scb-divider/scb-divider.js';
|
|
18
18
|
import './mvc/components/scb-drawer/scb-drawer-item.js';
|
|
@@ -70,7 +70,7 @@ import './scb-calendar-card/scb-calendar-card.js';
|
|
|
70
70
|
import './scb-card/scb-card.js';
|
|
71
71
|
import './scb-checkbox/scb-checkbox-group.js';
|
|
72
72
|
import './scb-checkbox/scb-checkbox.js';
|
|
73
|
-
import './scb-
|
|
73
|
+
import './scb-chip/scb-chip.js';
|
|
74
74
|
import './scb-dialog/scb-dialog.js';
|
|
75
75
|
import './scb-divider/scb-divider.js';
|
|
76
76
|
import './scb-drawer/scb-drawer-item.js';
|
package/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export * from './scb-calendar-card/scb-calendar-card';
|
|
|
9
9
|
export * from './scb-card/scb-card';
|
|
10
10
|
export * from './scb-checkbox/scb-checkbox-group';
|
|
11
11
|
export * from './scb-checkbox/scb-checkbox';
|
|
12
|
-
export * from './scb-
|
|
12
|
+
export * from './scb-chip/scb-chip';
|
|
13
13
|
export * from './scb-dialog/scb-dialog';
|
|
14
14
|
export * from './scb-divider/scb-divider';
|
|
15
15
|
export * from './scb-drawer/scb-drawer-item';
|
package/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { ScbCalendarCard as C } from "./scb-calendar-card/scb-calendar-card.js";
|
|
|
9
9
|
import { ScbCard as B } from "./scb-card/scb-card.js";
|
|
10
10
|
import { ScbCheckboxGroup as T } from "./scb-checkbox/scb-checkbox-group.js";
|
|
11
11
|
import { ScbCheckbox as w } from "./scb-checkbox/scb-checkbox.js";
|
|
12
|
-
import { ScbChip as F } from "./scb-
|
|
12
|
+
import { ScbChip as F } from "./scb-chip/scb-chip.js";
|
|
13
13
|
import { ScbDialog as k } from "./scb-dialog/scb-dialog.js";
|
|
14
14
|
import { ScbDivider as H } from "./scb-divider/scb-divider.js";
|
|
15
15
|
import { ScbDrawerItem as A } from "./scb-drawer/scb-drawer-item.js";
|
package/mvc/components/all.js
CHANGED
|
@@ -9,7 +9,7 @@ import './scb-calendar-card/scb-calendar-card.js';
|
|
|
9
9
|
import './scb-card/scb-card.js';
|
|
10
10
|
import './scb-checkbox/scb-checkbox.js';
|
|
11
11
|
import './scb-checkbox/scb-checkbox-group.js';
|
|
12
|
-
import './scb-
|
|
12
|
+
import './scb-chip/scb-chip.js';
|
|
13
13
|
import './scb-dialog/scb-dialog.js';
|
|
14
14
|
import './scb-divider/scb-divider.js';
|
|
15
15
|
import './scb-drawer/scb-drawer.js';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/vendor-material.js","../../vendor/vendor.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as h}from"../../vendor/preload-helper.js";import{a as p,n as r,i as _,x as c,t as u}from"../../vendor/vendor.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var a=customElements.define.bind(customElements);customElements.define=function(o,l,i){try{customElements.get(o)||a(o,l,i)}catch(n){var d=String(n||"");if(d.indexOf("already been used")===-1&&d.indexOf("NotSupportedError")===-1)throw n}}}}catch{}})();var f=Object.defineProperty,m=Object.getOwnPropertyDescriptor,s=(e,a,o,l)=>{for(var i=l>1?void 0:l?m(a,o):a,d=e.length-1,n;d>=0;d--)(n=e[d])&&(i=(l?n(a,o,i):n(i))||i);return l&&i&&f(a,o,i),i};let t=class extends _{constructor(){super(...arguments),this.variant="assist",this.label="",this.icon="",this.disabled=!1,this.elevated=!1,this.removable=!1,this.selected=!1,this.href="",this.target="",this.__loadedVariants=new Set,this.__chipSetLoaded=!1,this.__iconLoaded=!1}updated(e){super.updated(e),(e.has("variant")||e.has("icon"))&&this.__ensureDepsLoaded()}firstUpdated(){this.__ensureDepsLoaded()}async __ensureDepsLoaded(){if(!this.__loadedVariants.has(this.variant)){switch(this.variant){case"assist":await h(()=>import("../../vendor/vendor-material.js").then(e=>e.j),__vite__mapDeps([0,1]),import.meta.url);break;case"filter":await h(()=>import("../../vendor/vendor-material.js").then(e=>e.k),__vite__mapDeps([0,1]),import.meta.url);break}this.__loadedVariants.add(this.variant)}!this._insideChipSet&&!this.__chipSetLoaded&&(await h(()=>import("../../vendor/vendor-material.js").then(e=>e.n),__vite__mapDeps([0,1]),import.meta.url),this.__chipSetLoaded=!0),this.icon&&!this.__iconLoaded&&(await h(()=>import("../../vendor/vendor-material.js").then(e=>e.i),__vite__mapDeps([0,1]),import.meta.url),this.__iconLoaded=!0)}get _insideChipSet(){return!!this.closest("md-chip-set")}render(){const e=this._renderChip();return this._insideChipSet?e:c`<md-chip-set>${e}</md-chip-set>`}_renderChip(){const e=this.icon?c`<md-icon slot="icon">${this.icon}</md-icon>`:null;switch(this.variant){case"assist":{const a=this.target==="_blank"?"noopener noreferrer":void 0;return c`
|
|
3
|
+
<md-assist-chip
|
|
4
|
+
label=${this.label}
|
|
5
|
+
?disabled=${this.disabled}
|
|
6
|
+
?elevated=${this.elevated}
|
|
7
|
+
href=${this.href||void 0}
|
|
8
|
+
target=${this.href&&this.target||void 0}
|
|
9
|
+
rel=${a}
|
|
10
|
+
@update-focus=${this._forward}
|
|
11
|
+
>
|
|
12
|
+
${e}
|
|
13
|
+
</md-assist-chip>
|
|
14
|
+
`}case"filter":return c`
|
|
15
|
+
<md-filter-chip
|
|
16
|
+
label=${this.label}
|
|
17
|
+
?disabled=${this.disabled}
|
|
18
|
+
?removable=${this.removable}
|
|
19
|
+
?selected=${this.selected}
|
|
20
|
+
@remove=${this._onRemove}
|
|
21
|
+
@update-focus=${this._forward}
|
|
22
|
+
@click=${()=>this._toggleSelected()}
|
|
23
|
+
>
|
|
24
|
+
${e}
|
|
25
|
+
</md-filter-chip>
|
|
26
|
+
`;default:return c``}}_toggleSelected(){this.selected=!this.selected,this.dispatchEvent(new CustomEvent("selected-changed",{detail:{selected:this.selected},bubbles:!0,composed:!0}))}_onRemove(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("remove",{detail:{label:this.label},bubbles:!0,composed:!0}))}_forward(e){this.dispatchEvent(new CustomEvent(e.type,{detail:e.detail,bubbles:!0,composed:!0}))}};t.styles=p`
|
|
27
|
+
:host {
|
|
28
|
+
display: inline-block;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Sätt samma färg på label för assist som är på filter */
|
|
32
|
+
:host md-assist-chip {
|
|
33
|
+
--_label-text-color: var(--md-sys-color-on-surface-variant);
|
|
34
|
+
--_hover-label-text-color: var(--md-sys-color-on-surface-variant);
|
|
35
|
+
--_focus-label-text-color: var(--md-sys-color-on-surface-variant);
|
|
36
|
+
--_pressed-label-text-color: var(--md-sys-color-on-surface-variant);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
md-icon {
|
|
40
|
+
color: var(--p-20);
|
|
41
|
+
font-size: var(--scb-icon-size-large);
|
|
42
|
+
}
|
|
43
|
+
@media (prefers-color-scheme: dark) {
|
|
44
|
+
md-icon {
|
|
45
|
+
color: var(--md-sys-color-on-surface);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`;s([r({type:String,reflect:!0})],t.prototype,"variant",2);s([r({type:String})],t.prototype,"label",2);s([r({type:String})],t.prototype,"icon",2);s([r({type:Boolean,reflect:!0})],t.prototype,"disabled",2);s([r({type:Boolean,reflect:!0})],t.prototype,"elevated",2);s([r({type:Boolean,reflect:!0})],t.prototype,"removable",2);s([r({type:Boolean,reflect:!0})],t.prototype,"selected",2);s([r({type:String})],t.prototype,"href",2);s([r({type:String})],t.prototype,"target",2);t=s([u("scb-chip")],t);export{t as ScbChip};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../scb-textfield/scb-textfield.js","../../vendor/preload-helper.js","../../vendor/vendor.js","../scb-checkbox/scb-checkbox.js","../../vendor/vendor-material.js","../scb-radio-button/scb-radio-button.js","../scb-switch/scb-switch.js","../scb-
|
|
2
|
-
import{_ as d}from"../../vendor/preload-helper.js";import{a as h,n,i as m,E as p,x as a,t as _}from"../../vendor/vendor.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(o,c,r){try{customElements.get(o)||e(o,c,r)}catch(u){var l=String(u||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw u}}}}catch{}})();var b=Object.defineProperty,f=Object.getOwnPropertyDescriptor,s=(t,e,o,c)=>{for(var r=c>1?void 0:c?f(e,o):e,l=t.length-1,u;l>=0;l--)(u=t[l])&&(r=(c?u(e,o,r):u(r))||r);return c&&r&&b(e,o,r),r};let i=class extends m{constructor(){super(...arguments),this.open=!1,this.inSb=!1,this.scrimClose=!0,this.variant="basic",this.label="",this.icon="",this.supportingText="",this.okButton="OK",this.cancelButton="Avbryt",this.deleteButton="Delete",this.confirmButton="Ta bort",this.denyButton="Avbryt",this.resetButton="Återställ",this.submitButton="Spara",this.formId="",this.formAction="",this.formMethod="",this.__lastTriggerEl=null,this.__slotDeps={"SCB-TEXTFIELD":()=>d(()=>import("../scb-textfield/scb-textfield.js"),__vite__mapDeps([0,1,2]),import.meta.url),"SCB-CHECKBOX":()=>d(()=>import("../scb-checkbox/scb-checkbox.js"),__vite__mapDeps([3,2,4]),import.meta.url),"SCB-RADIO-BUTTON":()=>d(()=>import("../scb-radio-button/scb-radio-button.js"),__vite__mapDeps([5,2,4]),import.meta.url),"SCB-SWITCH":()=>d(()=>import("../scb-switch/scb-switch.js"),__vite__mapDeps([6,1,2]),import.meta.url),"SCB-CHIP":()=>d(()=>import("../scb-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../scb-textfield/scb-textfield.js","../../vendor/preload-helper.js","../../vendor/vendor.js","../scb-checkbox/scb-checkbox.js","../../vendor/vendor-material.js","../scb-radio-button/scb-radio-button.js","../scb-switch/scb-switch.js","../scb-chip/scb-chip.js","../scb-button/scb-button.js","../scb-icon-button/scb-icon-button.js","../scb-tooltip/scb-tooltip.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as d}from"../../vendor/preload-helper.js";import{a as h,n,i as m,E as p,x as a,t as _}from"../../vendor/vendor.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(o,c,r){try{customElements.get(o)||e(o,c,r)}catch(u){var l=String(u||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw u}}}}catch{}})();var b=Object.defineProperty,f=Object.getOwnPropertyDescriptor,s=(t,e,o,c)=>{for(var r=c>1?void 0:c?f(e,o):e,l=t.length-1,u;l>=0;l--)(u=t[l])&&(r=(c?u(e,o,r):u(r))||r);return c&&r&&b(e,o,r),r};let i=class extends m{constructor(){super(...arguments),this.open=!1,this.inSb=!1,this.scrimClose=!0,this.variant="basic",this.label="",this.icon="",this.supportingText="",this.okButton="OK",this.cancelButton="Avbryt",this.deleteButton="Delete",this.confirmButton="Ta bort",this.denyButton="Avbryt",this.resetButton="Återställ",this.submitButton="Spara",this.formId="",this.formAction="",this.formMethod="",this.__lastTriggerEl=null,this.__slotDeps={"SCB-TEXTFIELD":()=>d(()=>import("../scb-textfield/scb-textfield.js"),__vite__mapDeps([0,1,2]),import.meta.url),"SCB-CHECKBOX":()=>d(()=>import("../scb-checkbox/scb-checkbox.js"),__vite__mapDeps([3,2,4]),import.meta.url),"SCB-RADIO-BUTTON":()=>d(()=>import("../scb-radio-button/scb-radio-button.js"),__vite__mapDeps([5,2,4]),import.meta.url),"SCB-SWITCH":()=>d(()=>import("../scb-switch/scb-switch.js"),__vite__mapDeps([6,1,2]),import.meta.url),"SCB-CHIP":()=>d(()=>import("../scb-chip/scb-chip.js"),__vite__mapDeps([7,1,2]),import.meta.url)},this.__onDocumentClick=t=>{this.__getActionFromEvent(t)==="toggle"&&(this.__setOpen(!this.open),t.stopPropagation())},this.__onDocumentKeydown=t=>{this.open&&t.key==="Escape"&&(this.__fire("esc"),this.__setOpen(!1))},this.__onScrimClick=()=>{this.scrimClose&&(this.__fire("scrim"),this.__setOpen(!1))},this.__onOk=()=>{this.__fire("ok"),this.__setOpen(!1)},this.__onCancel=()=>{this.__fire("cancel"),this.__setOpen(!1)},this.__onConfirm=()=>{this.__fire("confirm"),this.__setOpen(!1)},this.__onDeny=()=>{this.__fire("deny"),this.__setOpen(!1)},this.__onReset=()=>{this.shadowRoot?.querySelector("form")?.reset(),(this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:!0})??[]).forEach(e=>{const o=e.tagName;o==="SCB-TEXTFIELD"&&(e.value=""),o==="SCB-CHECKBOX"&&(e.checked=!1),o==="SCB-RADIO-BUTTON"&&(e.checked=!1),o==="SCB-SWITCH"&&(e.selected=!1),o==="SCB-CHIP"&&(e.selected=!1)}),this.__fire("reset")},this.__onSubmit=()=>{this.shadowRoot?.querySelector("form")?.requestSubmit(),this.__fire("submit"),this.__setOpen(!1)},this.__onKeydownTrap=t=>{if(!this.open||t.key!=="Tab")return;const e=Array.from(this.shadowRoot.querySelectorAll('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])')).filter(r=>!r.hasAttribute("disabled"));if(!e.length)return;const o=e[0],c=e[e.length-1];t.shiftKey&&document.activeElement===o?(c.focus(),t.preventDefault()):!t.shiftKey&&document.activeElement===c&&(o.focus(),t.preventDefault())}}async firstUpdated(){await d(()=>import("../scb-button/scb-button.js"),__vite__mapDeps([8,1,2]),import.meta.url),await d(()=>import("../scb-icon-button/scb-icon-button.js"),__vite__mapDeps([9,1,2,4,10,8]),import.meta.url),this.icon&&await d(()=>import("../../vendor/vendor-material.js").then(t=>t.i),__vite__mapDeps([4,2]),import.meta.url),await this.__ensureSlottedDeps()}async __ensureSlottedDeps(){const t=this.shadowRoot?.querySelector("slot");if(!t)return;const e=async o=>{const c=new Set(o.map(r=>r.tagName));for(const r of c){const l=this.__slotDeps[r];l&&await l()}};await e(t.assignedElements({flatten:!0})),t.addEventListener("slotchange",async()=>e(t.assignedElements({flatten:!0})))}__getActionFromEvent(t){if(!this.id)return null;for(const e of t.composedPath())if(e instanceof Element){if(e.getAttribute("data-dialog-toggle")===this.id)return this.__lastTriggerEl=e,"toggle";if(e.getAttribute("aria-controls")===this.id)return this.__lastTriggerEl=e,"toggle"}return null}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.__onDocumentClick,!1),document.addEventListener("keydown",this.__onDocumentKeydown,!0),this.addEventListener("keydown",this.__onKeydownTrap)}disconnectedCallback(){document.removeEventListener("click",this.__onDocumentClick,!1),document.removeEventListener("keydown",this.__onDocumentKeydown,!0),this.removeEventListener("keydown",this.__onKeydownTrap),super.disconnectedCallback()}updated(t){if(t.has("open")){const e=t.get("open");this.__updateTriggersExpanded(),this.open&&!e?this.updateComplete.then(()=>{this.shadowRoot?.querySelector('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])')?.focus?.()}):!this.open&&e&&this.__lastTriggerEl?.focus?.(),this.__toggleScrollLock(this.open)}t.has("icon")&&this.icon&&d(()=>import("../../vendor/vendor-material.js").then(e=>e.i),__vite__mapDeps([4,2]),import.meta.url)}__updateTriggersExpanded(){this.id&&document.querySelectorAll(`[aria-controls="${this.id}"], [data-dialog-toggle="${this.id}"]`).forEach(t=>{t.hasAttribute("aria-controls")&&t.setAttribute("aria-expanded",String(this.open))})}__toggleScrollLock(t){if(this.inSb)return;const e=document.documentElement;e.style.overflow=t?"hidden":""}__setOpen(t){this.open=t,this.__fire(t?"open":"close")}__fire(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}__slotIsEmpty(){const t=this.shadowRoot?.querySelector("slot");return t?t.assignedElements({flatten:!0}).length===0:!0}renderHeader(t){const e=this.variant==="form"||this.variant==="floating";return a`
|
|
3
3
|
<div class="header">
|
|
4
4
|
<div class="title">
|
|
5
5
|
${this.icon?a`<md-icon class="dialog-icon">${this.icon}</md-icon>`:p}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as f,n as l,r as p,i as x,x as c,E as d,t as S}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"../scb-grid/scb-grid-item.js";import"../scb-grid/scb-grid.js";import"../scb-link/scb-link.js";import"../scb-search/scb-search.js";import"../scb-tabs/scb-tabs.js";import"../scb-tabs/scb-secondary-tab.js";import"../scb-drawer/scb-drawer.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-button/scb-button.js";import"../scb-list/scb-list.js";import"../../vendor/preload-helper.js";import"../scb-list/scb-list-item.js";import"../scb-tabs/scb-primary-tab.js";import"../scb-divider/scb-divider.js";import"../scb-drawer/scb-drawer-item.js";import"../scb-drawer/scb-drawer-section.js";import"../scb-drawer/scb-sub-drawer.js";import"../scb-tooltip/scb-tooltip.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(s,
|
|
1
|
+
import{a as f,n as l,r as p,i as x,x as c,E as d,t as S}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"../scb-grid/scb-grid-item.js";import"../scb-grid/scb-grid.js";import"../scb-link/scb-link.js";import"../scb-search/scb-search.js";import"../scb-tabs/scb-tabs.js";import"../scb-tabs/scb-secondary-tab.js";import"../scb-drawer/scb-drawer.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-button/scb-button.js";import"../scb-list/scb-list.js";import"../../vendor/preload-helper.js";import"../scb-list/scb-list-item.js";import"../scb-tabs/scb-primary-tab.js";import"../scb-divider/scb-divider.js";import"../scb-drawer/scb-drawer-item.js";import"../scb-drawer/scb-drawer-section.js";import"../scb-drawer/scb-sub-drawer.js";import"../scb-tooltip/scb-tooltip.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(s,i,o){try{customElements.get(s)||t(s,i,o)}catch(n){var h=String(n||"");if(h.indexOf("already been used")===-1&&h.indexOf("NotSupportedError")===-1)throw n}}}}catch{}})();var C=Object.defineProperty,M=Object.getOwnPropertyDescriptor,a=(e,t,s,i)=>{for(var o=i>1?void 0:i?M(t,s):t,h=e.length-1,n;h>=0;h--)(n=e[h])&&(o=(i?n(t,s,o):n(o))||o);return i&&o&&C(t,s,o),o};const _={fromAttribute:e=>e==null?!0:!/^(false|0|off|no)$/i.test(e),toAttribute:e=>String(!!e)};let r=class extends x{constructor(){super(...arguments),this.maxWidth="1440px",this.logoText="Statistikmyndigheten",this.logoHref="/",this.banner=!1,this.tabs=[],this.activeTab=0,this.utilityItems=[],this.showDrawer=!0,this.showSearch=!0,this.includeUtilityInDrawer=!1,this._drawerId="main-drawer",this._drawerMounted=!1,this._drawerExpanded=!1,this._searchId="header-search",this._slotTabs=[],this._slotUtils=[],this._slotMenu=[],this._measureScheduled=!1,this._scheduleMeasure=()=>{this._measureScheduled||(this._measureScheduled=!0,requestAnimationFrame(()=>{this._measureScheduled=!1,this._measure()}))},this._onWindowResize=()=>{this._scheduleMeasure()},this._onDrawerSelect=e=>{this.dispatchEvent(new CustomEvent("drawer-select",{detail:e.detail,bubbles:!0,composed:!0})),this._closeDrawerNow()},this._collapsed=!1,this._unlockAtWidth=0,this._hideLogoText=!1,this._logoTextUnlockAt=0,this._harvestPending=!1,this._harvest=()=>{const e=this._slotEl;if(!e)return;const t=e.assignedElements({flatten:!0}),s=[],i=[],o=[],h=n=>({label:n.getAttribute("label")??"",href:n.getAttribute("href")??void 0,icon:n.getAttribute("icon")??void 0});for(const n of t){const u=n.tagName.toLowerCase();if(u==="scb-header-tab"){s.push({label:n.getAttribute("label")??"",href:n.getAttribute("href")??"#"});continue}if(u==="scb-header-utility"){i.push({label:n.getAttribute("label")??"",href:n.getAttribute("href")??"#",target:n.getAttribute("target")??void 0});continue}if(u==="scb-header-drawer-group"){const b={label:n.getAttribute("label")??"",icon:n.getAttribute("icon")??void 0,children:[]};n.querySelectorAll("scb-header-drawer-item").forEach(m=>b.children.push(h(m))),o.push(b);continue}u==="scb-header-drawer-item"&&o.push(h(n))}this._slotTabs=s,this._slotUtils=i,this._slotMenu=o,queueMicrotask(()=>{this.updateComplete.then(()=>{this._applyActiveToTabs(),this._scheduleMeasure()})})},this._measure=()=>{const e=this._top,t=this._logoGroup;if(!e||!t)return;const s=window.innerWidth,i=e.clientWidth,o=this._overflows(this._util),h=this._overflows(this._tabsEl),n=s<this.BP_MD||o||h;this._collapsed?!n&&i>=this._unlockAtWidth&&this._setCollapsed(!1):n&&(this._unlockAtWidth=i+this._HYST,this._setCollapsed(!0));let u=!1;if(this.showSearch&&s>=this.BP_SM&&s<this.BP_MD&&this._searchWrap){const m=getComputedStyle(this._searchWrap),y=Math.max(this._num(m.minWidth,this._tokenPx("--scb-header-search-min",320)),this._tokenPx("--scb-header-search-min",320)),g=this._num(getComputedStyle(e).gap,this._tokenPx("--spacing-7",24)),w=this.showDrawer&&(s<this.BP_MD||this._collapsed)?this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-large",48):0;u=t.getBoundingClientRect().width+g+y+g+w+8>i+.5}this._setHideSearch(u);let b=!1;if(this.showDrawer&&(s<this.BP_MD||this._collapsed)&&!this._visible(this._util)&&!this._visible(this._searchWrap)){const m=this._num(getComputedStyle(e).gap,this._tokenPx("--spacing-7",24)),y=this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-large",48),g=(this._logoGroup?.getBoundingClientRect().width||0)+m+y;this._hideLogoText?b=!(i>=this._logoTextUnlockAt):g>i+.5&&(b=!0,this._logoTextUnlockAt=i+this._HYST)}else b=!1,this._logoTextUnlockAt=0;this._setHideLogoText(b)},this._onMenuClick=async e=>{e.preventDefault(),e.stopPropagation(),this.showDrawer&&(this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0})),await this._ensureDrawerMounted(),await r._nextFrame(),await r._nextFrame(),this._openDrawerNow())},this._onSearchClick=e=>{const t=this._searchEl;if(t?.submit&&typeof t.submit=="function"){t.submit();return}const s=t?.value??void 0;this.dispatchEvent(new CustomEvent("search-click",{detail:{value:s},bubbles:!0,composed:!0})),t?.focus?.()},this._onTabsChange=e=>{const s=e?.detail?.activeTabIndex??e.target?.activeTabIndex??0;this.activeTab=s;const o=(this._slotTabs.length?this._slotTabs:this.tabs)[s]?.href??"";this.dispatchEvent(new CustomEvent("tab-change",{detail:{index:s,href:o},bubbles:!0,composed:!0}))}}get _HYST(){return this._tokenPx("--spacing-11",64)}get BP_SM(){return this._tokenPx("--bp-sm",r.BP_SM_DEFAULT)}get BP_MD(){return this._tokenPx("--bp-md",r.BP_MD_DEFAULT)}_scheduleHarvest(){this._harvestPending||(this._harvestPending=!0,queueMicrotask(()=>{this._harvestPending=!1,this._harvest()}))}get _slotEl(){return this.shadowRoot?.querySelector("slot#data-slot")??null}get _top(){return this.renderRoot.querySelector(".top-row")}get _util(){return this.renderRoot.querySelector(".utility")}get _tabsEl(){return this.renderRoot.querySelector("scb-tabs")}get _logoGroup(){return this.renderRoot.querySelector(".logo-wrap")||this.renderRoot.querySelector(".logo-group")}get _searchWrap(){return this.renderRoot.querySelector(".search")}get _menuBtn(){return this.renderRoot.querySelector(".menu-trigger")}get _searchEl(){return this.renderRoot.querySelector(`#${this._searchId}`)}_attachSlotObservers(){this._slotMo?.disconnect();const e=new MutationObserver(t=>{this._scheduleHarvest()});this._slotMo=e,e.observe(this,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["label","href","icon","target"]})}_setCollapsed(e){this._collapsed!==e&&(this._collapsed=e,e?this.setAttribute("data-collapsed",""):this.removeAttribute("data-collapsed"))}_setHideSearch(e){e?this.setAttribute("data-hide-search",""):this.removeAttribute("data-hide-search")}_setHideLogoText(e){this._hideLogoText!==e&&(this._hideLogoText=e,e?this.setAttribute("data-hide-logo-text",""):this.removeAttribute("data-hide-logo-text"))}_num(e,t){const s=Number.parseFloat(String(e??"").trim());return Number.isFinite(s)?s:t}_tokenPx(e,t){const s=getComputedStyle(this);return this._num(s.getPropertyValue(e),t)}_visible(e){return e?getComputedStyle(e).display!=="none":!1}_overflows(e){return!e||!this._visible(e)?!1:e.scrollWidth>e.clientWidth+1}firstUpdated(){this.updateComplete.then(()=>{this._harvest(),this._attachSlotObservers()});const e=this._top;e&&(this._ro=new ResizeObserver(()=>this._scheduleMeasure()),this._ro.observe(e)),window.addEventListener("resize",this._onWindowResize,{passive:!0});const t=this._menuBtn,s=()=>this._ensureDrawerMounted();t?.addEventListener("pointerenter",s,{once:!0}),t?.addEventListener("focusin",s,{once:!0}),t?.addEventListener("touchstart",s,{once:!0,passive:!0})}updated(e){e.has("searchMax")&&this.style.setProperty("--scb-header-search-max",this.searchMax??"480px"),e.has("searchMin")&&this.style.setProperty("--scb-header-search-min",this.searchMin??"320px"),e.has("searchHeight")&&(this.searchHeight&&this.searchHeight.trim()?this.style.setProperty("--scb-search-height",this.searchHeight.trim()):this.style.removeProperty("--scb-search-height")),(e.has("utilityItems")||e.has("tabs")||e.has("logoText")||e.has("activeTab")||e.has("_slotTabs")||e.has("_slotUtils")||e.has("_slotMenu")||e.has("showDrawer")||e.has("showSearch")||e.has("searchMax")||e.has("searchMin"))&&this.updateComplete.then(()=>{this._scheduleMeasure(),this._applyActiveToTabs()})}disconnectedCallback(){this._ro?.disconnect(),this._slotMo?.disconnect(),window.removeEventListener("resize",this._onWindowResize),super.disconnectedCallback()}async _ensureDrawerMounted(){this._drawerMounted||(this._drawerMounted=!0,await this.updateComplete)}_openDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!0,e.setAttribute("open",""),e.show?.(),e.openDrawer?.(),this._drawerExpanded=!0,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-open",{bubbles:!0,composed:!0})))}_closeDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!1),this._drawerExpanded=!1,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-close",{bubbles:!0,composed:!0}))}_syncMenuBtnAria(){const e=this.renderRoot.querySelector(".menu-trigger");e&&e.setAttribute("aria-expanded",String(this._drawerExpanded))}_applyActiveToTabs(){const e=this._tabsEl;if(!e)return;e.activeTabIndex=this.activeTab,e.querySelectorAll("scb-secondary-tab").forEach((s,i)=>{s.selected=i===this.activeTab})}_renderDrawerNodes(e){return!e||e.length===0?c``:c`${e.map(t=>{const s=Array.isArray(t.children)&&t.children.length>0;return c`
|
|
2
2
|
<scb-drawer-item
|
|
3
3
|
label=${t.label}
|
|
4
4
|
?selected=${!1}
|
|
@@ -7,17 +7,17 @@ import{a as f,n as l,r as p,i as x,x as c,E as d,t as S}from"../../vendor/vendor
|
|
|
7
7
|
>
|
|
8
8
|
${s?c`
|
|
9
9
|
<scb-sub-drawer label=${t.label}>
|
|
10
|
-
${t.children.map(
|
|
10
|
+
${t.children.map(i=>c`
|
|
11
11
|
<scb-drawer-item
|
|
12
|
-
label=${
|
|
13
|
-
item-href=${
|
|
14
|
-
leading-icon=${
|
|
12
|
+
label=${i.label}
|
|
13
|
+
item-href=${i.href??""}
|
|
14
|
+
leading-icon=${i.icon??""}
|
|
15
15
|
></scb-drawer-item>
|
|
16
16
|
`)}
|
|
17
17
|
</scb-sub-drawer>
|
|
18
18
|
`:d}
|
|
19
19
|
</scb-drawer-item>
|
|
20
|
-
`})}`}_syncFlags(e,t){this.toggleAttribute("data-no-utility",e),this.toggleAttribute("data-no-search",t)}render(){const e=this._slotTabs.length?this._slotTabs:this.tabs,t=this._slotUtils.length?this._slotUtils:this.utilityItems,s=this._slotMenu.length?this._slotMenu:this.menuData??[];this._syncFlags(t.length===0,!this.showSearch);const
|
|
20
|
+
`})}`}_syncFlags(e,t){this.toggleAttribute("data-no-utility",e),this.toggleAttribute("data-no-search",t)}render(){const e=this._slotTabs.length?this._slotTabs:this.tabs,t=this._slotUtils.length?this._slotUtils:this.utilityItems,s=this._slotMenu.length?this._slotMenu:this.menuData??[];this._syncFlags(t.length===0,!this.showSearch);const i=this.searchHeight&&this.searchHeight.trim()?`--scb-search-height:${this.searchHeight.trim()}`:d;return c`
|
|
21
21
|
<slot id="data-slot" @slotchange=${()=>{this._harvest(),this._attachSlotObservers()}} hidden></slot>
|
|
22
22
|
|
|
23
23
|
<div
|
|
@@ -41,11 +41,11 @@ import{a as f,n as l,r as p,i as x,x as c,E as d,t as S}from"../../vendor/vendor
|
|
|
41
41
|
</nav>
|
|
42
42
|
|
|
43
43
|
${this.showSearch?c`
|
|
44
|
-
<div class="search" style=${
|
|
44
|
+
<div class="search" style=${i}>
|
|
45
45
|
<scb-search
|
|
46
46
|
id=${this._searchId}
|
|
47
47
|
size="compact"
|
|
48
|
-
style=${
|
|
48
|
+
style=${i}
|
|
49
49
|
.supportingText=${this.searchPlaceholder??""}
|
|
50
50
|
></scb-search>
|
|
51
51
|
<scb-button
|
|
@@ -173,12 +173,7 @@ import{a as f,n as l,r as p,i as x,x as c,E as d,t as S}from"../../vendor/vendor
|
|
|
173
173
|
line-height: var(--md-sys-typescale-body-medium-line-height);
|
|
174
174
|
font-weight: var(--md-sys-typescale-body-medium-weight);
|
|
175
175
|
letter-spacing: var(--md-sys-typescale-body-medium-tracking);
|
|
176
|
-
|
|
177
176
|
--scb-link-color: var(--md-sys-color-primary);
|
|
178
|
-
--scb-link-decoration: underline;
|
|
179
|
-
--scb-link-underline-offset: 3px;
|
|
180
|
-
--scb-link-underline-thickness: 1px;
|
|
181
|
-
--scb-link-hover-thickness: 2px;
|
|
182
177
|
--scb-link-white-space: nowrap;
|
|
183
178
|
}
|
|
184
179
|
@media (min-width:840px){ .utility{ display:flex; } }
|
|
@@ -265,4 +260,4 @@ import{a as f,n as l,r as p,i as x,x as c,E as d,t as S}from"../../vendor/vendor
|
|
|
265
260
|
:host([data-hide-logo-text]) .logo-text {
|
|
266
261
|
display: none;
|
|
267
262
|
}
|
|
268
|
-
`;r._nextFrame=()=>new Promise(e=>requestAnimationFrame(()=>e()));
|
|
263
|
+
`;r._nextFrame=()=>new Promise(e=>requestAnimationFrame(()=>e()));a([l({type:String,attribute:"max-width"})],r.prototype,"maxWidth",2);a([l({type:String,attribute:"logo-text"})],r.prototype,"logoText",2);a([l({type:String,attribute:"logo-href"})],r.prototype,"logoHref",2);a([l({type:Boolean,reflect:!0})],r.prototype,"banner",2);a([l({type:String,attribute:"banner-label"})],r.prototype,"bannerLabel",2);a([l({attribute:"tabs",converter:r._JSON_ARRAY})],r.prototype,"tabs",2);a([l({type:Number,attribute:"active-tab"})],r.prototype,"activeTab",2);a([l({attribute:"utility-items",converter:r._JSON_ARRAY})],r.prototype,"utilityItems",2);a([l({type:String,attribute:"search-placeholder"})],r.prototype,"searchPlaceholder",2);a([l({type:String,attribute:"drawer-label"})],r.prototype,"drawerLabel",2);a([l({type:String,attribute:"drawer-sub-label"})],r.prototype,"drawerSubLabel",2);a([l({type:String,attribute:"drawer-section-label"})],r.prototype,"drawerSectionLabel",2);a([l({type:String,attribute:"drawer-search-placeholder"})],r.prototype,"drawerSearchPlaceholder",2);a([l({attribute:"menu-data",converter:r._JSON_ARRAY})],r.prototype,"menuData",2);a([l({attribute:"show-drawer",reflect:!0,converter:_})],r.prototype,"showDrawer",2);a([l({attribute:"show-search",reflect:!0,converter:_})],r.prototype,"showSearch",2);a([l({attribute:"include-utility-in-drawer",reflect:!0,converter:_})],r.prototype,"includeUtilityInDrawer",2);a([l({type:String,attribute:"search-max"})],r.prototype,"searchMax",2);a([l({type:String,attribute:"search-min"})],r.prototype,"searchMin",2);a([l({type:String,attribute:"search-height"})],r.prototype,"searchHeight",2);a([p()],r.prototype,"_drawerId",2);a([p()],r.prototype,"_drawerMounted",2);a([p()],r.prototype,"_drawerExpanded",2);a([p()],r.prototype,"_searchId",2);a([p()],r.prototype,"_slotTabs",2);a([p()],r.prototype,"_slotUtils",2);a([p()],r.prototype,"_slotMenu",2);a([p()],r.prototype,"_collapsed",2);a([p()],r.prototype,"_hideLogoText",2);r=a([S("scb-header")],r);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/vendor-material.js","../../vendor/vendor.js","../scb-checkbox/scb-checkbox.js","../scb-switch/scb-switch.js","../../vendor/preload-helper.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as m}from"../../vendor/preload-helper.js";import{n as s,t as $,i as V,a as I,E as d,x as l}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var i=customElements.define.bind(customElements);customElements.define=function(e,n,c){try{customElements.get(e)||i(e,n,c)}catch(o){var p=String(o||"");if(p.indexOf("already been used")===-1&&p.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var E=Object.defineProperty,L=Object.getOwnPropertyDescriptor,S=t=>{throw TypeError(t)},r=(t,i,e,n)=>{for(var c=n>1?void 0:n?L(i,e):i,p=t.length-1,o;p>=0;p--)(o=t[p])&&(c=(n?o(i,e,c):o(c))||c);return n&&c&&E(i,e,c),c},k=(t,i,e)=>i.has(t)||S("Cannot "+e),g=(t,i,e)=>(k(t,i,"read from private field"),e?e.call(t):i.get(t)),h=(t,i,e)=>i.has(t)?S("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(t):i.set(t,e),b=(t,i,e,n)=>(k(t,i,"write to private field"),i.set(t,e),e),x=(t,i,e)=>(k(t,i,"access private method"),e),u,f,y,v,_,w;let a=class extends V{constructor(){super(...arguments),h(this,v),this.type="text",this.href="",this.itemHref="",this.target="",this.disabled=!1,this.label="",this.supportingText="",this.overline="",this.leading=!1,this.leadingVariant="",this.leadingIcon="",this.avatarLabel="",this.avatarAlt="",this.avatarVariant="icon",this.avatarSrc="",this.imgHrefImage="",this.trailing=!1,this.trailingVariant="",this.trailingIcon="",this.density=0,h(this,u,!1),h(this,f,!1),h(this,y,!1),this.onRowClick=()=>{if(this.type==="link"&&(this.href||this.itemHref))return;const t=this.shadowRoot?.querySelector("scb-checkbox"),i=this.shadowRoot?.querySelector("scb-switch");t&&(t.checked=!t.checked),i&&(i.selected=!i.selected)},h(this,w,t=>{if(!t.defaultPrevented&&(t.key==="Enter"||t.key===" ")){if(this.type==="link"){const i=this.shadowRoot?.querySelector("a[href]");if(i){t.preventDefault(),i.click();return}}t.preventDefault(),this.onRowClick()}})}static get styles(){return I`
|
|
2
|
+
import{_ as m}from"../../vendor/preload-helper.js";import{n as s,t as $,i as V,a as I,E as d,x as l}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var i=customElements.define.bind(customElements);customElements.define=function(e,n,c){try{customElements.get(e)||i(e,n,c)}catch(o){var p=String(o||"");if(p.indexOf("already been used")===-1&&p.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var E=Object.defineProperty,L=Object.getOwnPropertyDescriptor,S=t=>{throw TypeError(t)},r=(t,i,e,n)=>{for(var c=n>1?void 0:n?L(i,e):i,p=t.length-1,o;p>=0;p--)(o=t[p])&&(c=(n?o(i,e,c):o(c))||c);return n&&c&&E(i,e,c),c},k=(t,i,e)=>i.has(t)||S("Cannot "+e),g=(t,i,e)=>(k(t,i,"read from private field"),e?e.call(t):i.get(t)),h=(t,i,e)=>i.has(t)?S("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(t):i.set(t,e),b=(t,i,e,n)=>(k(t,i,"write to private field"),i.set(t,e),e),x=(t,i,e)=>(k(t,i,"access private method"),e),u,f,y,v,_,w;let a=class extends V{constructor(){super(...arguments),h(this,v),this.type="text",this.href="",this.itemHref="",this.target="",this.disabled=!1,this.label="",this.supportingText="",this.overline="",this.leading=!1,this.leadingVariant="",this.leadingIcon="",this.avatarLabel="",this.avatarAlt="",this.avatarVariant="icon",this.avatarSrc="",this.imgHrefImage="",this.trailing=!1,this.trailingVariant="",this.trailingIcon="",this.density=0,this.noDivider=!1,h(this,u,!1),h(this,f,!1),h(this,y,!1),this.onRowClick=()=>{if(this.type==="link"&&(this.href||this.itemHref))return;const t=this.shadowRoot?.querySelector("scb-checkbox"),i=this.shadowRoot?.querySelector("scb-switch");t&&(t.checked=!t.checked),i&&(i.selected=!i.selected)},h(this,w,t=>{if(!t.defaultPrevented&&(t.key==="Enter"||t.key===" ")){if(this.type==="link"){const i=this.shadowRoot?.querySelector("a[href]");if(i){t.preventDefault(),i.click();return}}t.preventDefault(),this.onRowClick()}})}static get styles(){return I`
|
|
3
3
|
:host {
|
|
4
4
|
border-bottom: var(--stroke-border, 1px) solid var(--md-sys-color-outline-variant);
|
|
5
5
|
margin-bottom: calc(var(--stroke-border, 1px) * -1);
|
|
@@ -9,6 +9,9 @@ import{_ as m}from"../../vendor/preload-helper.js";import{n as s,t as $,i as V,a
|
|
|
9
9
|
font-family: var(--brand-font);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
/* Per-item: ingen divider när attributet är satt */
|
|
13
|
+
:host([no-divider]) { --stroke-border: 0px; }
|
|
14
|
+
|
|
12
15
|
md-focus-ring {
|
|
13
16
|
position: absolute;
|
|
14
17
|
inset: 0;
|
|
@@ -93,11 +96,11 @@ import{_ as m}from"../../vendor/preload-helper.js";import{n as s,t as $,i as V,a
|
|
|
93
96
|
|
|
94
97
|
:host([trailing-variant="checkbox"]) .row,
|
|
95
98
|
:host([trailing-variant="switch"]) .row {
|
|
96
|
-
|
|
99
|
+
cursor: pointer;
|
|
97
100
|
}
|
|
98
101
|
|
|
99
102
|
:host([disabled]) .row {
|
|
100
|
-
|
|
103
|
+
cursor: default;
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
.link { text-decoration: none; color: inherit; display: contents; }
|
|
@@ -127,4 +130,4 @@ import{_ as m}from"../../vendor/preload-helper.js";import{n as s,t as $,i as V,a
|
|
|
127
130
|
</div>
|
|
128
131
|
|
|
129
132
|
<md-focus-ring></md-focus-ring>
|
|
130
|
-
`}};u=new WeakMap;f=new WeakMap;y=new WeakMap;v=new WeakSet;_=async function(){const t=this.type==="link"&&(!this.trailing||this.trailingVariant==="icon");(this.leading&&this.leadingVariant==="icon"||this.trailing&&this.trailingVariant==="icon"||t)&&!g(this,u)&&(await m(()=>import("../../vendor/vendor-material.js").then(e=>e.i),__vite__mapDeps([0,1]),import.meta.url),b(this,u,!0)),this.trailing&&this.trailingVariant==="checkbox"&&!g(this,f)&&(await m(()=>import("../scb-checkbox/scb-checkbox.js"),__vite__mapDeps([2,1,0]),import.meta.url),b(this,f,!0)),this.trailing&&this.trailingVariant==="switch"&&!g(this,y)&&(await m(()=>import("../scb-switch/scb-switch.js"),__vite__mapDeps([3,4,1]),import.meta.url),b(this,y,!0))};w=new WeakMap;r([s({type:String,reflect:!0,attribute:"type"})],a.prototype,"type",2);r([s({type:String})],a.prototype,"href",2);r([s({type:String,attribute:"item-href"})],a.prototype,"itemHref",2);r([s({type:String,attribute:"target"})],a.prototype,"target",2);r([s({type:Boolean,attribute:"disabled"})],a.prototype,"disabled",2);r([s({type:String,reflect:!0})],a.prototype,"label",2);r([s({type:String,attribute:"supporting-text"})],a.prototype,"supportingText",2);r([s({type:String,attribute:"overline"})],a.prototype,"overline",2);r([s({type:Boolean})],a.prototype,"leading",2);r([s({type:String,attribute:"leading-variant",reflect:!0})],a.prototype,"leadingVariant",2);r([s({type:String,attribute:"leading-icon"})],a.prototype,"leadingIcon",2);r([s({type:String,attribute:"avatar-label"})],a.prototype,"avatarLabel",2);r([s({type:String,attribute:"avatar-alt"})],a.prototype,"avatarAlt",2);r([s({type:String,attribute:"avatar-variant"})],a.prototype,"avatarVariant",2);r([s({type:String,attribute:"avatar-src"})],a.prototype,"avatarSrc",2);r([s({type:String,reflect:!0,attribute:"img-href-image"})],a.prototype,"imgHrefImage",2);r([s({type:Boolean})],a.prototype,"trailing",2);r([s({type:String,attribute:"trailing-variant",reflect:!0})],a.prototype,"trailingVariant",2);r([s({type:String,attribute:"trailing-icon"})],a.prototype,"trailingIcon",2);r([s({type:Number,reflect:!0})],a.prototype,"density",2);a=r([$("scb-list-item")],a);
|
|
133
|
+
`}};u=new WeakMap;f=new WeakMap;y=new WeakMap;v=new WeakSet;_=async function(){const t=this.type==="link"&&(!this.trailing||this.trailingVariant==="icon");(this.leading&&this.leadingVariant==="icon"||this.trailing&&this.trailingVariant==="icon"||t)&&!g(this,u)&&(await m(()=>import("../../vendor/vendor-material.js").then(e=>e.i),__vite__mapDeps([0,1]),import.meta.url),b(this,u,!0)),this.trailing&&this.trailingVariant==="checkbox"&&!g(this,f)&&(await m(()=>import("../scb-checkbox/scb-checkbox.js"),__vite__mapDeps([2,1,0]),import.meta.url),b(this,f,!0)),this.trailing&&this.trailingVariant==="switch"&&!g(this,y)&&(await m(()=>import("../scb-switch/scb-switch.js"),__vite__mapDeps([3,4,1]),import.meta.url),b(this,y,!0))};w=new WeakMap;r([s({type:String,reflect:!0,attribute:"type"})],a.prototype,"type",2);r([s({type:String})],a.prototype,"href",2);r([s({type:String,attribute:"item-href"})],a.prototype,"itemHref",2);r([s({type:String,attribute:"target"})],a.prototype,"target",2);r([s({type:Boolean,attribute:"disabled"})],a.prototype,"disabled",2);r([s({type:String,reflect:!0})],a.prototype,"label",2);r([s({type:String,attribute:"supporting-text"})],a.prototype,"supportingText",2);r([s({type:String,attribute:"overline"})],a.prototype,"overline",2);r([s({type:Boolean})],a.prototype,"leading",2);r([s({type:String,attribute:"leading-variant",reflect:!0})],a.prototype,"leadingVariant",2);r([s({type:String,attribute:"leading-icon"})],a.prototype,"leadingIcon",2);r([s({type:String,attribute:"avatar-label"})],a.prototype,"avatarLabel",2);r([s({type:String,attribute:"avatar-alt"})],a.prototype,"avatarAlt",2);r([s({type:String,attribute:"avatar-variant"})],a.prototype,"avatarVariant",2);r([s({type:String,attribute:"avatar-src"})],a.prototype,"avatarSrc",2);r([s({type:String,reflect:!0,attribute:"img-href-image"})],a.prototype,"imgHrefImage",2);r([s({type:Boolean})],a.prototype,"trailing",2);r([s({type:String,attribute:"trailing-variant",reflect:!0})],a.prototype,"trailingVariant",2);r([s({type:String,attribute:"trailing-icon"})],a.prototype,"trailingIcon",2);r([s({type:Number,reflect:!0})],a.prototype,"density",2);r([s({type:Boolean,attribute:"no-divider",reflect:!0})],a.prototype,"noDivider",2);a=r([$("scb-list-item")],a);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/vendor-material.js","../../vendor/vendor.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as f}from"../../vendor/preload-helper.js";import{a as h,
|
|
2
|
+
import{_ as f}from"../../vendor/preload-helper.js";import{a as h,n as p,b as v,i as m,x as b,t as g}from"../../vendor/vendor.js";import"./scb-list-item.js";import"../../vendor/vendor-material.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(r,s,i){try{customElements.get(r)||t(r,s,i)}catch(a){var o=String(a||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw a}}}}catch{}})();var y=Object.defineProperty,w=Object.getOwnPropertyDescriptor,c=e=>{throw TypeError(e)},l=(e,t,r,s)=>{for(var i=s>1?void 0:s?w(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=(s?a(t,r,i):a(i))||i);return s&&i&&y(t,r,i),i},_=(e,t,r)=>t.has(e)||c("Cannot "+r),E=(e,t,r)=>(_(e,t,"read from private field"),t.get(e)),A=(e,t,r)=>t.has(e)?c("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),k=(e,t,r,s)=>(_(e,t,"write to private field"),t.set(e,r),r),d;let n=class extends m{constructor(){super(...arguments),A(this,d,!1),this.noDivider=!1,this._onSlotChange=()=>this._setupItems()}async firstUpdated(){E(this,d)||(await f(()=>import("../../vendor/vendor-material.js").then(e=>e.l),__vite__mapDeps([0,1]),import.meta.url),k(this,d,!0)),this._setupItems()}_getItems(){return(this._slotEl?.assignedElements({flatten:!0})??[]).filter(t=>t instanceof HTMLElement)}_setupItems(){this._getItems().forEach((r,s)=>{r.hasAttribute("role")||r.setAttribute("role","listitem"),r.setAttribute("tabindex",s===0?"0":"-1")});const t=this.renderRoot?.querySelector("md-list");t&&!t.hasAttribute("data-kbd")&&(t.setAttribute("data-kbd","true"),t.addEventListener("keydown",r=>this._onKeyDown(r)))}_onKeyDown(e){const t=this._getItems();if(!t.length)return;const r=t.findIndex(i=>i.getAttribute("tabindex")==="0"),s=i=>{const o=(i%t.length+t.length)%t.length;t.forEach(u=>u.setAttribute("tabindex","-1"));const a=t[o];a.setAttribute("tabindex","0"),a.focus()};switch(e.key){case"ArrowDown":case"ArrowRight":e.preventDefault(),s(r<0?0:r+1);break;case"ArrowUp":case"ArrowLeft":e.preventDefault(),s(r<0?0:r-1);break;case"Home":e.preventDefault(),s(0);break;case"End":e.preventDefault(),s(t.length-1);break}}render(){return b`
|
|
3
3
|
<md-list role="list" @slotchange=${this._onSlotChange}>
|
|
4
4
|
<slot></slot>
|
|
5
5
|
</md-list>
|
|
6
|
-
`}};
|
|
6
|
+
`}};d=new WeakMap;n.styles=[h`
|
|
7
7
|
:host {
|
|
8
8
|
display: block;
|
|
9
9
|
--scb-list-bg: var(--md-sys-color-surface-container-lowest);
|
|
@@ -13,7 +13,14 @@ import{_ as f}from"../../vendor/preload-helper.js";import{a as h,b as p,i as m,x
|
|
|
13
13
|
background: var(--scb-list-bg);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
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])) {
|
|
17
19
|
border-top: 1px solid var(--md-sys-color-outline-variant);
|
|
18
20
|
}
|
|
19
|
-
|
|
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
|
+
`];l([p({type:Boolean,attribute:"no-divider",reflect:!0})],n.prototype,"noDivider",2);l([v("slot")],n.prototype,"_slotEl",2);n=l([g("scb-list")],n);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -99,14 +99,10 @@
|
|
|
99
99
|
"import": "./scb-checkbox/scb-checkbox-group.js",
|
|
100
100
|
"require": "./scb-checkbox/scb-checkbox-group.js"
|
|
101
101
|
},
|
|
102
|
-
"./scb-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
"./scb-chips/scb-chip": {
|
|
107
|
-
"import": "./scb-chips/scb-chip.js",
|
|
108
|
-
"require": "./scb-chips/scb-chip.js"
|
|
109
|
-
},
|
|
102
|
+
"./scb-chip": {
|
|
103
|
+
"import": "./scb-chip/scb-chip.js",
|
|
104
|
+
"require": "./scb-chip/scb-chip.js"
|
|
105
|
+
},
|
|
110
106
|
"./scb-dialog": {
|
|
111
107
|
"import": "./scb-dialog/scb-dialog.js",
|
|
112
108
|
"require": "./scb-dialog/scb-dialog.js"
|
|
@@ -277,5 +273,5 @@
|
|
|
277
273
|
},
|
|
278
274
|
"./mvc/*": "./mvc/*"
|
|
279
275
|
},
|
|
280
|
-
"buildHash": "
|
|
276
|
+
"buildHash": "5F40611B0DC1ACA78DE09CF5715A1EAC30A4DD9B1DFA99FFD414224DCCEFC0C3"
|
|
281
277
|
}
|
|
@@ -7,6 +7,8 @@ export declare class ScbChip extends LitElement {
|
|
|
7
7
|
elevated: boolean;
|
|
8
8
|
removable: boolean;
|
|
9
9
|
selected: boolean;
|
|
10
|
+
href: string;
|
|
11
|
+
target: '_self' | '_blank' | '_parent' | '_top' | '';
|
|
10
12
|
private __loadedVariants;
|
|
11
13
|
private __chipSetLoaded;
|
|
12
14
|
private __iconLoaded;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
3
|
-
var
|
|
4
|
-
for (var
|
|
5
|
-
(
|
|
6
|
-
return l &&
|
|
1
|
+
import { css as n, LitElement as p, html as o } from "lit";
|
|
2
|
+
import { property as i, customElement as f } from "lit/decorators.js";
|
|
3
|
+
var m = Object.defineProperty, v = Object.getOwnPropertyDescriptor, s = (e, a, d, l) => {
|
|
4
|
+
for (var r = l > 1 ? void 0 : l ? v(a, d) : a, c = e.length - 1, h; c >= 0; c--)
|
|
5
|
+
(h = e[c]) && (r = (l ? h(a, d, r) : h(r)) || r);
|
|
6
|
+
return l && r && m(a, d, r), r;
|
|
7
7
|
};
|
|
8
|
-
let t = class extends
|
|
8
|
+
let t = class extends p {
|
|
9
9
|
constructor() {
|
|
10
|
-
super(...arguments), this.variant = "assist", this.label = "", this.icon = "", this.disabled = !1, this.elevated = !1, this.removable = !1, this.selected = !1, this.__loadedVariants = /* @__PURE__ */ new Set(), this.__chipSetLoaded = !1, this.__iconLoaded = !1;
|
|
10
|
+
super(...arguments), this.variant = "assist", this.label = "", this.icon = "", this.disabled = !1, this.elevated = !1, this.removable = !1, this.selected = !1, this.href = "", this.target = "", this.__loadedVariants = /* @__PURE__ */ new Set(), this.__chipSetLoaded = !1, this.__iconLoaded = !1;
|
|
11
11
|
}
|
|
12
12
|
// aria-disabled på host
|
|
13
13
|
updated(e) {
|
|
@@ -37,30 +37,34 @@ let t = class extends h {
|
|
|
37
37
|
}
|
|
38
38
|
render() {
|
|
39
39
|
const e = this._renderChip();
|
|
40
|
-
return this._insideChipSet ? e :
|
|
40
|
+
return this._insideChipSet ? e : o`<md-chip-set>${e}</md-chip-set>`;
|
|
41
41
|
}
|
|
42
42
|
_renderChip() {
|
|
43
|
-
const e = this.icon ?
|
|
43
|
+
const e = this.icon ? o`<md-icon slot="icon">${this.icon}</md-icon>` : null;
|
|
44
44
|
switch (this.variant) {
|
|
45
|
-
case "assist":
|
|
46
|
-
|
|
45
|
+
case "assist": {
|
|
46
|
+
const a = this.target === "_blank" ? "noopener noreferrer" : void 0;
|
|
47
|
+
return o`
|
|
47
48
|
<md-assist-chip
|
|
48
49
|
label=${this.label}
|
|
49
50
|
?disabled=${this.disabled}
|
|
50
51
|
?elevated=${this.elevated}
|
|
52
|
+
href=${this.href || void 0}
|
|
53
|
+
target=${this.href && this.target || void 0}
|
|
54
|
+
rel=${a}
|
|
51
55
|
@update-focus=${this._forward}
|
|
52
56
|
>
|
|
53
57
|
${e}
|
|
54
58
|
</md-assist-chip>
|
|
55
59
|
`;
|
|
60
|
+
}
|
|
56
61
|
case "filter":
|
|
57
|
-
return
|
|
62
|
+
return o`
|
|
58
63
|
<md-filter-chip
|
|
59
64
|
label=${this.label}
|
|
60
65
|
?disabled=${this.disabled}
|
|
61
66
|
?removable=${this.removable}
|
|
62
67
|
?selected=${this.selected}
|
|
63
|
-
|
|
64
68
|
@remove=${this._onRemove}
|
|
65
69
|
@update-focus=${this._forward}
|
|
66
70
|
@click=${() => this._toggleSelected()}
|
|
@@ -69,7 +73,7 @@ let t = class extends h {
|
|
|
69
73
|
</md-filter-chip>
|
|
70
74
|
`;
|
|
71
75
|
default:
|
|
72
|
-
return
|
|
76
|
+
return o``;
|
|
73
77
|
}
|
|
74
78
|
}
|
|
75
79
|
_toggleSelected() {
|
|
@@ -98,7 +102,7 @@ let t = class extends h {
|
|
|
98
102
|
);
|
|
99
103
|
}
|
|
100
104
|
};
|
|
101
|
-
t.styles =
|
|
105
|
+
t.styles = n`
|
|
102
106
|
:host {
|
|
103
107
|
display: inline-block;
|
|
104
108
|
}
|
|
@@ -122,28 +126,34 @@ t.styles = p`
|
|
|
122
126
|
}
|
|
123
127
|
`;
|
|
124
128
|
s([
|
|
125
|
-
|
|
129
|
+
i({ type: String, reflect: !0 })
|
|
126
130
|
], t.prototype, "variant", 2);
|
|
127
131
|
s([
|
|
128
|
-
|
|
132
|
+
i({ type: String })
|
|
129
133
|
], t.prototype, "label", 2);
|
|
130
134
|
s([
|
|
131
|
-
|
|
135
|
+
i({ type: String })
|
|
132
136
|
], t.prototype, "icon", 2);
|
|
133
137
|
s([
|
|
134
|
-
|
|
138
|
+
i({ type: Boolean, reflect: !0 })
|
|
135
139
|
], t.prototype, "disabled", 2);
|
|
136
140
|
s([
|
|
137
|
-
|
|
141
|
+
i({ type: Boolean, reflect: !0 })
|
|
138
142
|
], t.prototype, "elevated", 2);
|
|
139
143
|
s([
|
|
140
|
-
|
|
144
|
+
i({ type: Boolean, reflect: !0 })
|
|
141
145
|
], t.prototype, "removable", 2);
|
|
142
146
|
s([
|
|
143
|
-
|
|
147
|
+
i({ type: Boolean, reflect: !0 })
|
|
144
148
|
], t.prototype, "selected", 2);
|
|
149
|
+
s([
|
|
150
|
+
i({ type: String })
|
|
151
|
+
], t.prototype, "href", 2);
|
|
152
|
+
s([
|
|
153
|
+
i({ type: String })
|
|
154
|
+
], t.prototype, "target", 2);
|
|
145
155
|
t = s([
|
|
146
|
-
|
|
156
|
+
f("scb-chip")
|
|
147
157
|
], t);
|
|
148
158
|
export {
|
|
149
159
|
t as ScbChip
|
package/scb-dialog/scb-dialog.js
CHANGED
|
@@ -12,7 +12,7 @@ let i = class extends u {
|
|
|
12
12
|
"SCB-CHECKBOX": () => import("../scb-checkbox/scb-checkbox.js"),
|
|
13
13
|
"SCB-RADIO-BUTTON": () => import("../scb-radio-button/scb-radio-button.js"),
|
|
14
14
|
"SCB-SWITCH": () => import("../scb-switch/scb-switch.js"),
|
|
15
|
-
"SCB-CHIP": () => import("../scb-
|
|
15
|
+
"SCB-CHIP": () => import("../scb-chip/scb-chip.js")
|
|
16
16
|
}, this.__onDocumentClick = (t) => {
|
|
17
17
|
this.__getActionFromEvent(t) === "toggle" && (this.__setOpen(!this.open), t.stopPropagation());
|
|
18
18
|
}, this.__onDocumentKeydown = (t) => {
|
package/scb-header/scb-header.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css as C, LitElement as M, html as c, nothing as p } from "lit";
|
|
2
|
-
import { property as l, state as u, customElement as
|
|
2
|
+
import { property as l, state as u, customElement as A } from "lit/decorators.js";
|
|
3
3
|
import "@material/web/focus/md-focus-ring.js";
|
|
4
4
|
import "../scb-grid/scb-grid-item.js";
|
|
5
5
|
import "../scb-grid/scb-grid.js";
|
|
@@ -10,10 +10,10 @@ import "../scb-tabs/scb-secondary-tab.js";
|
|
|
10
10
|
import "../scb-drawer/scb-drawer.js";
|
|
11
11
|
import "../scb-icon-button/scb-icon-button.js";
|
|
12
12
|
import "../scb-button/scb-button.js";
|
|
13
|
-
var
|
|
14
|
-
for (var o = i > 1 ? void 0 : i ?
|
|
13
|
+
var T = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, a = (e, t, s, i) => {
|
|
14
|
+
for (var o = i > 1 ? void 0 : i ? $(t, s) : t, h = e.length - 1, n; h >= 0; h--)
|
|
15
15
|
(n = e[h]) && (o = (i ? n(t, s, o) : n(o)) || o);
|
|
16
|
-
return i && o &&
|
|
16
|
+
return i && o && T(t, s, o), o;
|
|
17
17
|
};
|
|
18
18
|
const v = {
|
|
19
19
|
fromAttribute: (e) => e == null ? !0 : !/^(false|0|off|no)$/i.test(e),
|
|
@@ -446,12 +446,7 @@ r.styles = C`
|
|
|
446
446
|
line-height: var(--md-sys-typescale-body-medium-line-height);
|
|
447
447
|
font-weight: var(--md-sys-typescale-body-medium-weight);
|
|
448
448
|
letter-spacing: var(--md-sys-typescale-body-medium-tracking);
|
|
449
|
-
|
|
450
449
|
--scb-link-color: var(--md-sys-color-primary);
|
|
451
|
-
--scb-link-decoration: underline;
|
|
452
|
-
--scb-link-underline-offset: 3px;
|
|
453
|
-
--scb-link-underline-thickness: 1px;
|
|
454
|
-
--scb-link-hover-thickness: 2px;
|
|
455
450
|
--scb-link-white-space: nowrap;
|
|
456
451
|
}
|
|
457
452
|
@media (min-width:840px){ .utility{ display:flex; } }
|
|
@@ -628,7 +623,7 @@ a([
|
|
|
628
623
|
u()
|
|
629
624
|
], r.prototype, "_hideLogoText", 2);
|
|
630
625
|
r = a([
|
|
631
|
-
|
|
626
|
+
A("scb-header")
|
|
632
627
|
], r);
|
|
633
628
|
export {
|
|
634
629
|
r as ScbHeader
|
|
@@ -21,6 +21,7 @@ export declare class ScbListItem extends LitElement {
|
|
|
21
21
|
trailingVariant: '' | 'icon' | 'checkbox' | 'switch';
|
|
22
22
|
trailingIcon: string;
|
|
23
23
|
density: -4 | -2 | 0;
|
|
24
|
+
noDivider: boolean;
|
|
24
25
|
static get styles(): import('lit').CSSResult;
|
|
25
26
|
protected firstUpdated(): Promise<void>;
|
|
26
27
|
protected updated(changed: PropertyValues): void;
|