scb-wc 0.1.75 → 0.1.76
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/index.js +20 -20
- package/mvc/components/scb-accordion/scb-accordion-item.js +2 -2
- package/mvc/components/scb-avatar/scb-avatar.js +2 -2
- package/mvc/components/scb-breadcrumb/scb-breadcrumb.js +33 -15
- package/mvc/components/scb-button/scb-button.js +80 -41
- package/mvc/components/scb-calendar/scb-calendar.js +1 -1
- package/mvc/components/scb-calendar-card/scb-calendar-card.js +4 -4
- package/mvc/components/scb-card/scb-card.js +3 -3
- package/mvc/components/scb-checkbox/scb-checkbox.js +32 -7
- package/mvc/components/scb-chip/scb-chip.js +6 -6
- package/mvc/components/scb-dialog/scb-dialog.js +1 -1
- package/mvc/components/scb-dropdown/scb-dropdown.js +1 -1
- package/mvc/components/scb-fab/scb-fab.js +24 -6
- package/mvc/components/scb-fact-card/scb-fact-card.js +4 -4
- package/mvc/components/scb-header/scb-header.js +474 -124
- package/mvc/components/scb-horizontal-scroller/scb-horizontal-scroller.js +1 -1
- package/mvc/components/scb-icon-button/scb-icon-button.js +2 -2
- package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +2 -2
- package/mvc/components/scb-link/scb-link.js +14 -10
- package/mvc/components/scb-list/scb-list-item.js +5 -5
- package/mvc/components/scb-list/scb-list.js +3 -3
- package/mvc/components/scb-menu/scb-menu-item.js +2 -2
- package/mvc/components/scb-nav/scb-nav.js +1 -1
- package/mvc/components/scb-notification-card/scb-notification-card.js +1 -1
- package/mvc/components/scb-options-menu/scb-options-menu-item.js +1 -1
- package/mvc/components/scb-pagination/scb-pagination.js +1 -1
- package/mvc/components/scb-progress-stepper/scb-progress-step.js +1 -1
- package/mvc/components/scb-radio-button/scb-radio-button.js +39 -9
- package/mvc/components/scb-search/scb-search.js +3 -3
- package/mvc/components/scb-segmented-button/scb-segmented-item.js +1 -1
- package/mvc/components/scb-select/scb-select-option.js +3 -3
- package/mvc/components/scb-select/scb-select.js +1 -1
- package/mvc/components/scb-slider/scb-slider.js +58 -4
- package/mvc/components/scb-status-pill/scb-status-pill.js +1 -1
- package/mvc/components/scb-stepper/scb-step.js +1 -1
- package/mvc/components/scb-switch/scb-switch.js +51 -6
- package/mvc/components/scb-tabs/scb-primary-tab.js +3 -2
- package/mvc/components/scb-tabs/scb-secondary-tab.js +3 -2
- package/mvc/components/scb-tabs/scb-tabs.js +11 -2
- package/mvc/components/scb-textfield/scb-textfield.js +1 -1
- package/mvc/components/scb-toc/scb-toc-item.js +1 -1
- package/mvc/components/scb-tooltip/scb-tooltip.js +1 -1
- package/mvc/vendor/assist-chip.js +20 -0
- package/mvc/vendor/attachable-controller.js +1 -0
- package/mvc/vendor/checkbox-validator.js +1 -0
- package/mvc/vendor/chip-set.js +2 -0
- package/mvc/vendor/chip.js +18 -0
- package/mvc/vendor/delegate.js +1 -0
- package/mvc/vendor/element-internals.js +1 -0
- package/mvc/vendor/elevation.js +2 -0
- package/mvc/vendor/filled-icon-button.js +2 -0
- package/mvc/vendor/filled-tonal-icon-button.js +2 -0
- package/mvc/vendor/filter-chip.js +43 -0
- package/mvc/vendor/focusable.js +1 -0
- package/mvc/vendor/form-associated.js +1 -0
- package/mvc/vendor/form-label-activation.js +1 -0
- package/mvc/vendor/form-submitter.js +1 -0
- package/mvc/vendor/icon-button.js +2 -0
- package/mvc/vendor/icon.js +2 -0
- package/mvc/vendor/list.js +8 -0
- package/mvc/vendor/md-focus-ring.js +2 -0
- package/mvc/vendor/outlined-icon-button.js +2 -0
- package/mvc/vendor/redispatch-event.js +1 -0
- package/mvc/vendor/ripple.js +2 -0
- package/mvc/vendor/rolldown-runtime.js +1 -0
- package/mvc/vendor/shared-styles.js +3 -0
- package/mvc/vendor/shared-styles2.js +30 -0
- package/mvc/vendor/tab-styles.js +17 -0
- package/mvc/vendor/validator.js +1 -0
- package/package.json +2 -2
- package/scb-breadcrumb/scb-breadcrumb.js +38 -21
- package/scb-components/scb-header/scb-header.d.ts +11 -4
- package/scb-header/scb-header.js +512 -156
- package/scb-link/scb-link.js +24 -20
- package/scb-wc.bundle.js +602 -232
- package/mvc/vendor/vendor-material.js +0 -364
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../scb-list/scb-list.js","../../vendor/classPrivateFieldGet2.js","../../vendor/assertClassBrand.js","../../vendor/decorate.js","../../vendor/preload-helper.js","../../vendor/vendor.js","../../vendor/vendor-lit.js","../scb-list/scb-list-item.js","../../vendor/vendor-
|
|
2
|
-
import
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../scb-list/scb-list.js","../../vendor/classPrivateFieldGet2.js","../../vendor/assertClassBrand.js","../../vendor/decorate.js","../../vendor/preload-helper.js","../../vendor/vendor.js","../../vendor/vendor-lit.js","../scb-list/scb-list-item.js","../../vendor/md-focus-ring.js","../../vendor/rolldown-runtime.js","../../vendor/attachable-controller.js","../../vendor/ripple.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as x,b as S,g as w,h as o,m as A,v,y as h}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/md-focus-ring.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{t as a}from"../../vendor/decorate.js";import{t as k}from"../../vendor/preload-helper.js";(function(){try{var u=typeof globalThis<"u"?globalThis:window;if(!u.__scb_ce_guard_installed__){u.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(e,s,r){try{customElements.get(e)||t(e,s,r)}catch(l){var i=String(l||"");if(i.indexOf("already been used")===-1&&i.indexOf("NotSupportedError")===-1)throw l}}}}catch{}})();var d,E=0,n=(d=class extends x{async _ensureListDepsLoaded(){this._listDepsLoaded||(this._listDepsPromise??(this._listDepsPromise=k(()=>import("../scb-list/scb-list.js").then(()=>{this._listDepsLoaded=!0}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url)),await this._listDepsPromise)}_ensureListDepsWhenNeeded(){const t=(this.value??"").trim().length>0;!this._inputFocused||!t||!this._hasSuggestions||this._ensureListDepsLoaded().then(()=>this.requestUpdate())}constructor(){super(),this._internals=null,this.supportingText="",this.value="",this.name="",this.disabled=!1,this.required=!1,this.autocomplete=!1,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.size="large",this.fullScreen=!1,this._inputFocused=!1,this._visibleSuggestions=0,this._listDepsLoaded=!1,this._activeIndex=-1,this._listboxId=`scb-search-listbox-${++E}`,this._kbMode=!1,this._valueOnFocus="",this._lastChangeValue="",this._kbShouldShowRing=!1,this._onGlobalKeydown=t=>{t.key==="Tab"&&(this._kbShouldShowRing=!0,this._inputFocused&&this._updateInputRingVisibility())},this._onGlobalPointerDown=()=>{this._kbShouldShowRing=!1,this._inputFocused&&this._updateInputRingVisibility()},this._form=null,this._formResetHandler=null,this._formSubmitHandler=null,this._initialValue="",this._customValidationMessage="",this._listScrollHandler=()=>{const t=this._getActiveItem();this._kbMode&&t&&this._positionOptionRing(t)},"attachInternals"in this&&(this._internals=this.attachInternals())}_syncDensityForSize(){this.size==="small"?this.setAttribute("data-density","-4"):this.size==="medium"?this.setAttribute("data-density","-2"):this.removeAttribute("data-density")}connectedCallback(){super.connectedCallback(),this._syncDensityForSize(),this._onWindowResize=this._onWindowResize.bind(this),window.addEventListener("resize",this._onWindowResize,{passive:!0}),window.addEventListener("keydown",this._onGlobalKeydown,!0),window.addEventListener("pointerdown",this._onGlobalPointerDown,!0),this._initialValue=this.value??"",this._lastChangeValue=this.value??"",this._form=this.closest("form"),this._form&&(this._formSubmitHandler=t=>{this.reportValidity()||(t.preventDefault(),t.stopPropagation())},this._form.addEventListener("submit",this._formSubmitHandler,!0),this._formResetHandler=()=>{this.value=this._initialValue;const t=this._inputEl();t&&(t.value=this._initialValue),this._lastChangeValue=this._initialValue,this._syncFormValue(),this._filterSuggestions(this.value),this._activeIndex=-1,this._kbMode=!1,this._updateComboboxA11y()},this._form.addEventListener("reset",this._formResetHandler,!0)),this._syncFormValue(),this._syncValidity()}disconnectedCallback(){const t=this._inputEl();t&&this._boundNativeKeydown&&t.removeEventListener("keydown",this._boundNativeKeydown,!0),this._detachListScrollListener(),window.removeEventListener("resize",this._onWindowResize),window.removeEventListener("keydown",this._onGlobalKeydown,!0),window.removeEventListener("pointerdown",this._onGlobalPointerDown,!0),this._form&&this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0),this._form&&this._formSubmitHandler&&this._form.removeEventListener("submit",this._formSubmitHandler,!0),super.disconnectedCallback()}firstUpdated(){this._ensureListboxA11y(),this._updateComboboxA11y();const t=this._inputEl();t&&(this._boundNativeKeydown=e=>this._handleKey(e),t.addEventListener("keydown",this._boundNativeKeydown,!0),t.disabled=this.disabled),this.applySpacing()}updated(t){if(super.updated(t),t.has("size")&&this._syncDensityForSize(),this._ensureListboxA11y(),this._updateComboboxA11y(),this._attachListScrollListener(),(t.has("value")||t.has("disabled"))&&this._syncFormValue(),(t.has("value")||t.has("disabled")||t.has("required"))&&this._syncValidity(),t.has("disabled")){this.toggleAttribute("aria-disabled",this.disabled);const e=this._inputEl();e&&(e.disabled=this.disabled)}(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&this.applySpacing()}render(){const t=(this.value??"").trim().length>0,e=this._inputFocused&&t&&this._hasSuggestions&&this._listDepsLoaded;return h`
|
|
3
3
|
<div class="ripple-wrapper">
|
|
4
4
|
<md-icon class="leading">${t?"arrow_back":"search"}</md-icon>
|
|
5
5
|
|
|
@@ -290,4 +290,4 @@ import"../../vendor/vendor-material.js";import{_ as x,b as S,g as w,h as o,m as
|
|
|
290
290
|
color: var(--md-sys-color-on-surface);
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
`,d);a([o({type:String,attribute:"trailing-icon"})],n.prototype,"trailingIcon",void 0);a([o({type:String,attribute:"supporting-text"})],n.prototype,"supportingText",void 0);a([o({type:String})],n.prototype,"value",void 0);a([o({type:String,reflect:!0})],n.prototype,"name",void 0);a([o({type:Boolean,reflect:!0})],n.prototype,"disabled",void 0);a([o({type:Boolean,reflect:!0})],n.prototype,"required",void 0);a([o({type:Boolean,reflect:!0})],n.prototype,"autocomplete",void 0);a([o({type:String,reflect:!0})],n.prototype,"spacing",void 0);a([o({type:String,attribute:"spacing-top",reflect:!0})],n.prototype,"spacingTop",void 0);a([o({type:String,attribute:"spacing-bottom",reflect:!0})],n.prototype,"spacingBottom",void 0);a([o({type:String,attribute:"spacing-left",reflect:!0})],n.prototype,"spacingLeft",void 0);a([o({type:String,attribute:"spacing-right",reflect:!0})],n.prototype,"spacingRight",void 0);a([o({type:String,reflect:!0})],n.prototype,"size",void 0);a([o({type:Boolean,attribute:"full-screen",reflect:!0})],n.prototype,"fullScreen",void 0);a([A()],n.prototype,"_listDepsLoaded",void 0);n=a([w("scb-search")],n);
|
|
293
|
+
`,d);a([o({type:String,attribute:"trailing-icon"})],n.prototype,"trailingIcon",void 0);a([o({type:String,attribute:"supporting-text"})],n.prototype,"supportingText",void 0);a([o({type:String})],n.prototype,"value",void 0);a([o({type:String,reflect:!0})],n.prototype,"name",void 0);a([o({type:Boolean,reflect:!0})],n.prototype,"disabled",void 0);a([o({type:Boolean,reflect:!0})],n.prototype,"required",void 0);a([o({type:Boolean,reflect:!0})],n.prototype,"autocomplete",void 0);a([o({type:String,reflect:!0})],n.prototype,"spacing",void 0);a([o({type:String,attribute:"spacing-top",reflect:!0})],n.prototype,"spacingTop",void 0);a([o({type:String,attribute:"spacing-bottom",reflect:!0})],n.prototype,"spacingBottom",void 0);a([o({type:String,attribute:"spacing-left",reflect:!0})],n.prototype,"spacingLeft",void 0);a([o({type:String,attribute:"spacing-right",reflect:!0})],n.prototype,"spacingRight",void 0);a([o({type:String,reflect:!0})],n.prototype,"size",void 0);a([o({type:Boolean,attribute:"full-screen",reflect:!0})],n.prototype,"fullScreen",void 0);a([A()],n.prototype,"_listDepsLoaded",void 0);n=a([w("scb-search")],n);export{n as ScbSearch};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{_ as u,b as m,g as p,h as n,y as s}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/md-focus-ring.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{t as o}from"../../vendor/decorate.js";(function(){try{var l=typeof globalThis<"u"?globalThis:window;if(!l.__scb_ce_guard_installed__){l.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,i,c){try{customElements.get(t)||e(t,i,c)}catch(d){var a=String(d||"");if(a.indexOf("already been used")===-1&&a.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var h,r=(h=class extends u{constructor(...e){super(...e),this.label="",this.value="",this.selected=!1,this.icon="",this.href="",this.disabled=!1,this.onHostKeydown=t=>{if(!this.href||this.isEffectivelyDisabled||t.code!=="Space"&&t.code!=="Enter"&&t.code!=="NumpadEnter")return;const i=this.shadowRoot?.querySelector("a[href]");i&&(t.preventDefault(),t.stopPropagation(),i.click())}}get isEffectivelyDisabled(){const e=this.parentElement?.hasAttribute?.("disabled");return this.disabled||!!e}get hasDefaultSlotContent(){return Array.from(this.childNodes).some(e=>e.nodeType===1?!0:e.nodeType===3?(e.textContent??"").trim()!=="":!1)}render(){const e=this.isEffectivelyDisabled,t=!!this.icon,i=!!this.label||this.hasDefaultSlotContent,c=this.label?s`${this.label}`:s`<slot></slot>`,a=`segmented-item${t||this.selected?" has-icon":""}${i?"":" no-label"}`,d=s`
|
|
2
2
|
<md-ripple ?disabled="${e}"></md-ripple>
|
|
3
3
|
${this.selected?t&&i?s`<md-icon>check</md-icon>`:t?s`<md-icon>check</md-icon><md-icon>${this.icon}</md-icon>`:s`<md-icon>check</md-icon>`:t?s`<md-icon>${this.icon}</md-icon>`:""}
|
|
4
4
|
${i?s`<span>${c}</span>`:""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{_ as p,b,g as m,h as o,y as i}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/md-focus-ring.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{t}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 c=customElements.define.bind(customElements);customElements.define=function(a,n,h){try{customElements.get(a)||c(a,n,h)}catch(d){var l=String(d||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var r,e=(r=class extends p{constructor(...c){super(...c),this.value="",this.disabled=!1,this.showCheckbox=!1,this.checked=!1,this.showRadio=!1,this.label="",this.noHighlightSelected=!1}render(){return i`
|
|
2
2
|
<div class="item ${this.checked?"checked":""}" ?aria-disabled=${this.disabled}>
|
|
3
3
|
<md-ripple></md-ripple>
|
|
4
4
|
${this.showCheckbox?i`<md-icon class="${this.checked?"checkbox-checked":""}" aria-hidden="true">${this.checked?"check_box":"check_box_outline_blank"}</md-icon>`:null}
|
|
@@ -6,7 +6,7 @@ import"../../vendor/vendor-material.js";import{_ as p,b,g as m,h as o,y as i}fro
|
|
|
6
6
|
<div class="label">${this.label?this.label:i`<slot></slot>`}</div>
|
|
7
7
|
<md-focus-ring inward></md-focus-ring>
|
|
8
8
|
</div>
|
|
9
|
-
`}},
|
|
9
|
+
`}},r.styles=b`
|
|
10
10
|
:host {
|
|
11
11
|
display: block;
|
|
12
12
|
outline: none;
|
|
@@ -58,4 +58,4 @@ import"../../vendor/vendor-material.js";import{_ as p,b,g as m,h as o,y as i}fro
|
|
|
58
58
|
md-icon.radio-checked {
|
|
59
59
|
color: var(--md-sys-color-primary);
|
|
60
60
|
}
|
|
61
|
-
`,
|
|
61
|
+
`,r);t([o({type:String})],e.prototype,"value",void 0);t([o({type:Boolean,reflect:!0})],e.prototype,"disabled",void 0);t([o({type:Boolean})],e.prototype,"showCheckbox",void 0);t([o({type:Boolean})],e.prototype,"checked",void 0);t([o({type:Boolean})],e.prototype,"showRadio",void 0);t([o({type:String})],e.prototype,"label",void 0);t([o({type:Boolean,attribute:"no-highlight-selected",reflect:!0})],e.prototype,"noHighlightSelected",void 0);e=t([m("scb-select-option")],e);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{_ as h,b as u,g as b,h as a,s as g,y as d}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/md-focus-ring.js";import{t as l}from"../../vendor/decorate.js";import"../../vendor/scb-chevron.js";import"./scb-select-option.js";(function(){try{var p=typeof globalThis<"u"?globalThis:window;if(!p.__scb_ce_guard_installed__){p.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,s,r){try{customElements.get(t)||e(t,s,r)}catch(o){var n=String(o||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var c,i=(c=class extends h{constructor(){super(),this._optionsObserver=null,this._internals=null,this.focusedIndex=-1,this.variant="single-select",this.value="",this.values=[],this.disabled=!1,this.required=!1,this.open=!1,this.label="",this.name="",this.placeholder="",this.supportingText="",this.withRadiobuttons=!1,this.noHighlightSelected=!1,this.size="large",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.zIndex=void 0,this._form=null,this._formResetHandler=null,this._formSubmitHandler=null,this._initialValue="",this._initialValues=[],this._customValidationMessage="",this._onDocumentClick=e=>{this.open&&(e.composedPath().includes(this)||this._setOpen(!1))},this._onSlotClick=e=>{const t=this.shadowRoot?.querySelector("slot");if(!t)return;const s=t.assignedElements({flatten:!0}).filter(o=>o.tagName.toLowerCase()==="scb-select-option"),r=e.composedPath(),n=s.find(o=>r.includes(o));n&&(this._selectOption(n),e.stopPropagation())},this._onKeyDown=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this._toggleOpen())},this._onOptionKeyDown=e=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();const t=this.shadowRoot?.querySelector("slot");if(!t)return;const s=t.assignedElements({flatten:!0}).filter(o=>o.tagName.toLowerCase()==="scb-select-option"),r=e.composedPath(),n=s.find(o=>r.includes(o));n&&this._selectOption(n)}},"attachInternals"in this&&(this._internals=this.attachInternals())}_syncDensityForSize(){this.size==="extra-small"?this.setAttribute("data-density","-5"):this.size==="small"?this.setAttribute("data-density","-4"):this.size==="medium"?this.setAttribute("data-density","-2"):this.removeAttribute("data-density")}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._onDocumentClick),this._optionsObserver=new MutationObserver(()=>{this.requestUpdate()}),this._optionsObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["label","value","disabled"]}),this._syncDensityForSize(),this._initialValue=this.value,this._initialValues=Array.isArray(this.values)?[...this.values]:[],this._form=this.closest("form"),this._form&&(this._formResetHandler=()=>{this.value=this._initialValue,this.values=Array.isArray(this._initialValues)?[...this._initialValues]:[],this._syncFormValue(),this._syncValidity(),this.requestUpdate()},this._formSubmitHandler=e=>{this.reportValidity()||(e.preventDefault(),e.stopPropagation())},this._form.addEventListener("reset",this._formResetHandler,!0),this._form.addEventListener("submit",this._formSubmitHandler,!0))}disconnectedCallback(){document.removeEventListener("mousedown",this._onDocumentClick),this._form&&this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0),this._form&&this._formSubmitHandler&&this._form.removeEventListener("submit",this._formSubmitHandler,!0),this._optionsObserver?.disconnect(),this._optionsObserver=null,super.disconnectedCallback()}_getMultiValues(){return Array.isArray(this.values)&&this.values.length>0?this.values:this.value?this.value.split(",").map(e=>e.trim()).filter(Boolean):[]}_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}_applySpacing(){const e=this._mapSpacingToken(this.spacing),t=this._mapSpacingToken(this.spacingTop)??e,s=this._mapSpacingToken(this.spacingBottom)??e,r=this._mapSpacingToken(this.spacingLeft),n=this._mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-select-spacing-block-start",t):this.style.removeProperty("--scb-select-spacing-block-start"),s?this.style.setProperty("--scb-select-spacing-block-end",s):this.style.removeProperty("--scb-select-spacing-block-end"),r?this.style.setProperty("--scb-select-spacing-inline-start",r):this.style.removeProperty("--scb-select-spacing-inline-start"),n?this.style.setProperty("--scb-select-spacing-inline-end",n):this.style.removeProperty("--scb-select-spacing-inline-end")}_setOpen(e){this.open!==e&&(this.open=e,e?(this.focusedIndex=0,this.requestUpdate()):this.focusedIndex=-1)}_toggleOpen(){this.disabled||this._setOpen(!this.open)}_hasMoreThanFourOptions(){const e=this.shadowRoot?.querySelector("slot");if(!e)return!1;const t=e.assignedElements({flatten:!0}).filter(s=>s.tagName.toLowerCase()==="scb-select-option");return["extra-small","small","medium"].includes(this.size)?t.length>5:t.length>4}_selectOption(e){if(!e.disabled){if(this.variant==="multi-select"){const t=this._getMultiValues();t.indexOf(e.value)>-1?this.values=t.filter(s=>s!==e.value):this.values=[...t,e.value],this.value=this.values.join(","),this.dispatchEvent(new CustomEvent("change",{detail:{values:this.values},bubbles:!0,composed:!0}))}else this.variant==="single-select"&&this.withRadiobuttons?(this.value=e.value,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))):(this.value=e.value,this._setOpen(!1),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0})));this._updateOptionsChecked(),this.requestUpdate()}}_getOptionLabel(e){return e.label||e.textContent?.trim()||""}_getSelectedLabel(){const e=this.shadowRoot?.querySelector("slot");if(!e)return"";const t=e.assignedElements({flatten:!0}).filter(s=>s.tagName.toLowerCase()==="scb-select-option");if(this.variant==="multi-select"){const s=this._getMultiValues(),r=t.filter(n=>s.includes(n.value));return r&&r.length>0?r.map(n=>this._getOptionLabel(n)).join(", "):""}else{const s=t.find(r=>r.value===this.value);return s?this._getOptionLabel(s):""}}firstUpdated(){this._updateOptionsChecked(),this._syncFormValue(),this._syncValidity(),this._applySpacing()}updated(e){this._updateOptionsChecked(),this._syncFormValue(),this._syncValidity(),e.has("size")&&this._syncDensityForSize(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&this._applySpacing()}_syncFormValue(){if(this._internals){if(this.disabled||!this.name){this._internals.setFormValue(null);return}if(this.variant==="multi-select"){const e=this._getMultiValues();if(e.length===0){this._internals.setFormValue(null);return}const t=new FormData;e.forEach(s=>t.append(this.name,s)),this._internals.setFormValue(t);return}this._internals.setFormValue(this.value||null)}}_getValidationMessage(){return this._customValidationMessage?this._customValidationMessage:this.required&&!(this.variant==="multi-select"?this._getMultiValues().length>0:this.value)?"Välj ett alternativ.":""}_syncValidity(){if(!this._internals)return;const e=this.disabled?"":this._getValidationMessage(),t=this.shadowRoot?.querySelector(".selected-value");if(!e){this._internals.setValidity({}),this.removeAttribute("aria-invalid"),t&&t.setCustomValidity("");return}t&&t.setCustomValidity(e),this._internals.setValidity({valueMissing:!0},e,t??void 0),this.setAttribute("aria-invalid","true")}checkValidity(){return!this._getValidationMessage()}reportValidity(){return this._syncValidity(),this._internals?this._internals.reportValidity():this.checkValidity()}setCustomValidity(e){this._customValidationMessage=e,this._syncValidity()}get validity(){return this._internals?.validity}get validationMessage(){return this._internals?.validationMessage??this._getValidationMessage()}get willValidate(){return this._internals?.willValidate??!0}_updateOptionsChecked(){const e=this.shadowRoot?.querySelector("slot");e&&e.assignedElements({flatten:!0}).filter(t=>t.tagName.toLowerCase()==="scb-select-option").forEach(t=>{if(this.noHighlightSelected?t.setAttribute("no-highlight-selected",""):t.removeAttribute("no-highlight-selected"),this.variant==="multi-select"){const s=this._getMultiValues();t.showCheckbox=!0,t.checked=s.includes(t.value),t.showRadio=!1}else t.showCheckbox=!1,t.checked=this.value===t.value,this.withRadiobuttons&&(t.showRadio=!0)})}render(){return d`
|
|
2
2
|
${this.label?d`
|
|
3
3
|
<label
|
|
4
4
|
class="select-label ${this.supportingText?"":"select-label--without-supporting"}"
|
|
@@ -1,4 +1,58 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{_ as y,a as T,b as _,c as u,f as S,g as E,h as r,i as g,l as n,m as p,p as b,v as m,y as v}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/md-focus-ring.js";import"../../vendor/ripple.js";import{t as o}from"../../vendor/decorate.js";import"../../vendor/elevation.js";import{t as V}from"../../vendor/delegate.js";import{n as P}from"../../vendor/element-internals.js";import{n as H,t as O}from"../../vendor/form-label-activation.js";import{t as w}from"../../vendor/redispatch-event.js";import{n as I,r as B}from"../../vendor/form-associated.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(a,s,c){try{customElements.get(a)||t(a,s,c)}catch(h){var d=String(h||"");if(d.indexOf("already been used")===-1&&d.indexOf("NotSupportedError")===-1)throw h}}}}catch{}})();var R=_`@media(forced-colors: active){:host{--md-slider-active-track-color: CanvasText;--md-slider-disabled-active-track-color: GrayText;--md-slider-disabled-active-track-opacity: 1;--md-slider-disabled-handle-color: GrayText;--md-slider-disabled-inactive-track-color: GrayText;--md-slider-disabled-inactive-track-opacity: 1;--md-slider-focus-handle-color: CanvasText;--md-slider-handle-color: CanvasText;--md-slider-handle-shadow-color: Canvas;--md-slider-hover-handle-color: CanvasText;--md-slider-hover-state-layer-color: Canvas;--md-slider-hover-state-layer-opacity: 1;--md-slider-inactive-track-color: Canvas;--md-slider-label-container-color: Canvas;--md-slider-label-text-color: CanvasText;--md-slider-pressed-handle-color: CanvasText;--md-slider-pressed-state-layer-color: Canvas;--md-slider-pressed-state-layer-opacity: 1;--md-slider-with-overlap-handle-outline-color: CanvasText}.label,.label::before{border:var(--_with-overlap-handle-outline-color) solid var(--_with-overlap-handle-outline-width)}:host(:not([disabled])) .track::before{border:1px solid var(--_active-track-color)}.tickmarks::before{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='CanvasText'%3E%3Ccircle cx='2' cy='2' r='1'/%3E%3C/svg%3E")}.tickmarks::after{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='Canvas'%3E%3Ccircle cx='2' cy='2' r='1'/%3E%3C/svg%3E")}:host([disabled]) .tickmarks::before{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='Canvas'%3E%3Ccircle cx='2' cy='2' r='1'/%3E%3C/svg%3E")}}
|
|
2
|
+
`,F=B(P(y)),i=class extends F{get nameStart(){return this.getAttribute("name-start")??this.name}set nameStart(e){this.setAttribute("name-start",e)}get nameEnd(){return this.getAttribute("name-end")??this.nameStart}set nameEnd(e){this.setAttribute("name-end",e)}get renderAriaLabelStart(){const{ariaLabel:e}=this;return this.ariaLabelStart||e&&`${e} start`||this.valueLabelStart||String(this.valueStart)}get renderAriaValueTextStart(){return this.ariaValueTextStart||this.valueLabelStart||String(this.valueStart)}get renderAriaLabelEnd(){const{ariaLabel:e}=this;return this.range?this.ariaLabelEnd||e&&`${e} end`||this.valueLabelEnd||String(this.valueEnd):e||this.valueLabel||String(this.value)}get renderAriaValueTextEnd(){if(this.range)return this.ariaValueTextEnd||this.valueLabelEnd||String(this.valueEnd);const{ariaValueText:e}=this;return e||this.valueLabel||String(this.value)}constructor(){super(),this.min=0,this.max=100,this.valueLabel="",this.valueLabelStart="",this.valueLabelEnd="",this.ariaLabelStart="",this.ariaValueTextStart="",this.ariaLabelEnd="",this.ariaValueTextEnd="",this.step=1,this.ticks=!1,this.labeled=!1,this.range=!1,this.handleStartHover=!1,this.handleEndHover=!1,this.startOnTop=!1,this.handlesOverlapping=!1,this.ripplePointerId=1,this.isRedispatchingEvent=!1,this.addEventListener("click",e=>{!H(e)||!this.inputEnd||(this.focus(),O(this.inputEnd))})}focus(){this.inputEnd?.focus()}willUpdate(e){this.renderValueStart=e.has("valueStart")?this.valueStart:this.inputStart?.valueAsNumber;const t=e.has("valueEnd")&&this.range||e.has("value");this.renderValueEnd=t?this.range?this.valueEnd:this.value:this.inputEnd?.valueAsNumber,e.get("handleStartHover")!==void 0?this.toggleRippleHover(this.rippleStart,this.handleStartHover):e.get("handleEndHover")!==void 0&&this.toggleRippleHover(this.rippleEnd,this.handleEndHover)}updated(e){if(this.range&&(this.renderValueStart=this.inputStart.valueAsNumber),this.renderValueEnd=this.inputEnd.valueAsNumber,this.range){const t=(this.max-this.min)/3;if(this.valueStart===void 0){this.inputStart.valueAsNumber=this.min+t;const a=this.inputStart.valueAsNumber;this.valueStart=this.renderValueStart=a}if(this.valueEnd===void 0){this.inputEnd.valueAsNumber=this.min+2*t;const a=this.inputEnd.valueAsNumber;this.valueEnd=this.renderValueEnd=a}}else this.value??(this.value=this.renderValueEnd);if(e.has("range")||e.has("renderValueStart")||e.has("renderValueEnd")||this.isUpdatePending){const t=this.handleStart?.querySelector(".handleNub"),a=this.handleEnd?.querySelector(".handleNub");this.handlesOverlapping=M(t,a)}this.performUpdate()}render(){const e=this.step===0?1:this.step,t=Math.max(this.max-this.min,e),a=this.range?((this.renderValueStart??this.min)-this.min)/t:0,s=((this.renderValueEnd??this.min)-this.min)/t,c={"--_start-fraction":String(a),"--_end-fraction":String(s),"--_tick-count":String(t/e)},d={ranged:this.range},h=this.valueLabelStart||String(this.renderValueStart),z=(this.range?this.valueLabelEnd:this.valueLabel)||String(this.renderValueEnd),$={start:!0,value:this.renderValueStart,ariaLabel:this.renderAriaLabelStart,ariaValueText:this.renderAriaValueTextStart,ariaMin:this.min,ariaMax:this.valueEnd??this.max},A={start:!1,value:this.renderValueEnd,ariaLabel:this.renderAriaLabelEnd,ariaValueText:this.renderAriaValueTextEnd,ariaMin:this.range?this.valueStart??this.min:this.min,ariaMax:this.max},C={start:!0,hover:this.handleStartHover,label:h},N={start:!1,hover:this.handleEndHover,label:z},L={hover:this.handleStartHover||this.handleEndHover};return v` <div
|
|
3
|
+
class="container ${u(d)}"
|
|
4
|
+
style=${T(c)}>
|
|
5
|
+
${g(this.range,()=>this.renderInput($))}
|
|
6
|
+
${this.renderInput(A)} ${this.renderTrack()}
|
|
7
|
+
<div class="handleContainerPadded">
|
|
8
|
+
<div class="handleContainerBlock">
|
|
9
|
+
<div class="handleContainer ${u(L)}">
|
|
10
|
+
${g(this.range,()=>this.renderHandle(C))}
|
|
11
|
+
${this.renderHandle(N)}
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</div>`}renderTrack(){return v`
|
|
16
|
+
<div class="track"></div>
|
|
17
|
+
${this.ticks?v`<div class="tickmarks"></div>`:m}
|
|
18
|
+
`}renderLabel(e){return v`<div class="label" aria-hidden="true">
|
|
19
|
+
<span class="labelContent" part="label">${e}</span>
|
|
20
|
+
</div>`}renderHandle({start:e,hover:t,label:a}){const s=!this.disabled&&e===this.startOnTop,c=!this.disabled&&this.handlesOverlapping,d=e?"start":"end";return v`<div
|
|
21
|
+
class="handle ${u({[d]:!0,hover:t,onTop:s,isOverlapping:c})}">
|
|
22
|
+
<md-focus-ring part="focus-ring" for=${d}></md-focus-ring>
|
|
23
|
+
<md-ripple
|
|
24
|
+
for=${d}
|
|
25
|
+
class=${d}
|
|
26
|
+
?disabled=${this.disabled}></md-ripple>
|
|
27
|
+
<div class="handleNub">
|
|
28
|
+
<md-elevation part="elevation"></md-elevation>
|
|
29
|
+
</div>
|
|
30
|
+
${g(this.labeled,()=>this.renderLabel(a))}
|
|
31
|
+
</div>`}renderInput({start:e,value:t,ariaLabel:a,ariaValueText:s,ariaMin:c,ariaMax:d}){const h=e?"start":"end";return v`<input
|
|
32
|
+
type="range"
|
|
33
|
+
class="${u({start:e,end:!e})}"
|
|
34
|
+
@focus=${this.handleFocus}
|
|
35
|
+
@pointerdown=${this.handleDown}
|
|
36
|
+
@pointerup=${this.handleUp}
|
|
37
|
+
@pointerenter=${this.handleEnter}
|
|
38
|
+
@pointermove=${this.handleMove}
|
|
39
|
+
@pointerleave=${this.handleLeave}
|
|
40
|
+
@keydown=${this.handleKeydown}
|
|
41
|
+
@keyup=${this.handleKeyup}
|
|
42
|
+
@input=${this.handleInput}
|
|
43
|
+
@change=${this.handleChange}
|
|
44
|
+
id=${h}
|
|
45
|
+
.disabled=${this.disabled}
|
|
46
|
+
.min=${String(this.min)}
|
|
47
|
+
aria-valuemin=${c}
|
|
48
|
+
.max=${String(this.max)}
|
|
49
|
+
aria-valuemax=${d}
|
|
50
|
+
.step=${String(this.step)}
|
|
51
|
+
.value=${String(t)}
|
|
52
|
+
.tabIndex=${e?1:0}
|
|
53
|
+
aria-label=${a||m}
|
|
54
|
+
aria-valuetext=${s} />`}async toggleRippleHover(e,t){const a=await e;a&&(t?a.handlePointerenter(new PointerEvent("pointerenter",{isPrimary:!0,pointerId:this.ripplePointerId})):a.handlePointerleave(new PointerEvent("pointerleave",{isPrimary:!0,pointerId:this.ripplePointerId})))}handleFocus(e){this.updateOnTop(e.target)}startAction(e){const t=e.target,a=t===this.inputStart?this.inputEnd:this.inputStart;this.action={canFlip:e.type==="pointerdown",flipped:!1,target:t,fixed:a,values:new Map([[t,t.valueAsNumber],[a,a?.valueAsNumber]])}}finishAction(e){this.action=void 0}handleKeydown(e){this.startAction(e)}handleKeyup(e){this.finishAction(e)}handleDown(e){this.startAction(e),this.ripplePointerId=e.pointerId;const t=e.target===this.inputStart;this.handleStartHover=!this.disabled&&t&&!!this.handleStart,this.handleEndHover=!this.disabled&&!t&&!!this.handleEnd}async handleUp(e){if(!this.action)return;const{target:t,values:a,flipped:s}=this.action;await new Promise(requestAnimationFrame),t!==void 0&&(t.focus(),s&&t.valueAsNumber!==a.get(t)&&t.dispatchEvent(new Event("change",{bubbles:!0}))),this.finishAction(e)}handleMove(e){this.handleStartHover=!this.disabled&&x(e,this.handleStart),this.handleEndHover=!this.disabled&&x(e,this.handleEnd)}handleEnter(e){this.handleMove(e)}handleLeave(){this.handleStartHover=!1,this.handleEndHover=!1}updateOnTop(e){this.startOnTop=e.classList.contains("start")}needsClamping(){if(!this.action)return!1;const{target:e,fixed:t}=this.action;return e===this.inputStart?e.valueAsNumber>t.valueAsNumber:e.valueAsNumber<t.valueAsNumber}isActionFlipped(){const{action:e}=this;if(!e)return!1;const{target:t,fixed:a,values:s}=e;return e.canFlip&&s.get(t)===s.get(a)&&this.needsClamping()&&(e.canFlip=!1,e.flipped=!0,e.target=a,e.fixed=t),e.flipped}flipAction(){if(!this.action)return!1;const{target:e,fixed:t,values:a}=this.action,s=e.valueAsNumber!==t.valueAsNumber;return e.valueAsNumber=t.valueAsNumber,t.valueAsNumber=a.get(t),s}clampAction(){if(!this.needsClamping()||!this.action)return!1;const{target:e,fixed:t}=this.action;return e.valueAsNumber=t.valueAsNumber,!0}handleInput(e){if(this.isRedispatchingEvent)return;let t=!1,a=!1;this.range&&(this.isActionFlipped()&&(t=!0,a=this.flipAction()),this.clampAction()&&(t=!0,a=!1));const s=e.target;this.updateOnTop(s),this.range?(this.valueStart=this.inputStart.valueAsNumber,this.valueEnd=this.inputEnd.valueAsNumber):this.value=this.inputEnd.valueAsNumber,t&&e.stopPropagation(),a&&(this.isRedispatchingEvent=!0,w(s,e),this.isRedispatchingEvent=!1)}handleChange(e){const t=e.target,{target:a,values:s}=this.action??{};a&&a.valueAsNumber===s.get(t)||w(this,e),this.finishAction(e)}[I](){if(this.range){const e=new FormData;return e.append(this.nameStart,String(this.valueStart)),e.append(this.nameEnd,String(this.valueEnd)),e}return String(this.value)}formResetCallback(){if(this.range){const t=this.getAttribute("value-start");this.valueStart=t!==null?Number(t):void 0;const a=this.getAttribute("value-end");this.valueEnd=a!==null?Number(a):void 0;return}const e=this.getAttribute("value");this.value=e!==null?Number(e):void 0}formStateRestoreCallback(e){if(Array.isArray(e)){const[[,t],[,a]]=e;this.valueStart=Number(t),this.valueEnd=Number(a),this.range=!0;return}this.value=Number(e),this.range=!1}};V(i);i.shadowRootOptions={...y.shadowRootOptions,delegatesFocus:!0};n([r({type:Number})],i.prototype,"min",void 0);n([r({type:Number})],i.prototype,"max",void 0);n([r({type:Number})],i.prototype,"value",void 0);n([r({type:Number,attribute:"value-start"})],i.prototype,"valueStart",void 0);n([r({type:Number,attribute:"value-end"})],i.prototype,"valueEnd",void 0);n([r({attribute:"value-label"})],i.prototype,"valueLabel",void 0);n([r({attribute:"value-label-start"})],i.prototype,"valueLabelStart",void 0);n([r({attribute:"value-label-end"})],i.prototype,"valueLabelEnd",void 0);n([r({attribute:"aria-label-start"})],i.prototype,"ariaLabelStart",void 0);n([r({attribute:"aria-valuetext-start"})],i.prototype,"ariaValueTextStart",void 0);n([r({attribute:"aria-label-end"})],i.prototype,"ariaLabelEnd",void 0);n([r({attribute:"aria-valuetext-end"})],i.prototype,"ariaValueTextEnd",void 0);n([r({type:Number})],i.prototype,"step",void 0);n([r({type:Boolean})],i.prototype,"ticks",void 0);n([r({type:Boolean})],i.prototype,"labeled",void 0);n([r({type:Boolean})],i.prototype,"range",void 0);n([b("input.start")],i.prototype,"inputStart",void 0);n([b(".handle.start")],i.prototype,"handleStart",void 0);n([S("md-ripple.start")],i.prototype,"rippleStart",void 0);n([b("input.end")],i.prototype,"inputEnd",void 0);n([b(".handle.end")],i.prototype,"handleEnd",void 0);n([S("md-ripple.end")],i.prototype,"rippleEnd",void 0);n([p()],i.prototype,"handleStartHover",void 0);n([p()],i.prototype,"handleEndHover",void 0);n([p()],i.prototype,"startOnTop",void 0);n([p()],i.prototype,"handlesOverlapping",void 0);n([p()],i.prototype,"renderValueStart",void 0);n([p()],i.prototype,"renderValueEnd",void 0);function x({x:e,y:t},a){if(!a)return!1;const{top:s,left:c,bottom:d,right:h}=a.getBoundingClientRect();return e>=c&&e<=h&&t>=s&&t<=d}function M(e,t){if(!(e&&t))return!1;const a=e.getBoundingClientRect(),s=t.getBoundingClientRect();return!(a.top>s.bottom||a.right<s.left||a.bottom<s.top||a.left>s.right)}var U=_`:host{--_active-track-color: var(--md-slider-active-track-color, var(--md-sys-color-primary, #6750a4));--_active-track-height: var(--md-slider-active-track-height, 4px);--_active-track-shape: var(--md-slider-active-track-shape, var(--md-sys-shape-corner-full, 9999px));--_disabled-active-track-color: var(--md-slider-disabled-active-track-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-active-track-opacity: var(--md-slider-disabled-active-track-opacity, 0.38);--_disabled-handle-color: var(--md-slider-disabled-handle-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-handle-elevation: var(--md-slider-disabled-handle-elevation, 0);--_disabled-inactive-track-color: var(--md-slider-disabled-inactive-track-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-inactive-track-opacity: var(--md-slider-disabled-inactive-track-opacity, 0.12);--_focus-handle-color: var(--md-slider-focus-handle-color, var(--md-sys-color-primary, #6750a4));--_handle-color: var(--md-slider-handle-color, var(--md-sys-color-primary, #6750a4));--_handle-elevation: var(--md-slider-handle-elevation, 1);--_handle-height: var(--md-slider-handle-height, 20px);--_handle-shadow-color: var(--md-slider-handle-shadow-color, var(--md-sys-color-shadow, #000));--_handle-shape: var(--md-slider-handle-shape, var(--md-sys-shape-corner-full, 9999px));--_handle-width: var(--md-slider-handle-width, 20px);--_hover-handle-color: var(--md-slider-hover-handle-color, var(--md-sys-color-primary, #6750a4));--_hover-state-layer-color: var(--md-slider-hover-state-layer-color, var(--md-sys-color-primary, #6750a4));--_hover-state-layer-opacity: var(--md-slider-hover-state-layer-opacity, 0.08);--_inactive-track-color: var(--md-slider-inactive-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));--_inactive-track-height: var(--md-slider-inactive-track-height, 4px);--_inactive-track-shape: var(--md-slider-inactive-track-shape, var(--md-sys-shape-corner-full, 9999px));--_label-container-color: var(--md-slider-label-container-color, var(--md-sys-color-primary, #6750a4));--_label-container-height: var(--md-slider-label-container-height, 28px);--_pressed-handle-color: var(--md-slider-pressed-handle-color, var(--md-sys-color-primary, #6750a4));--_pressed-state-layer-color: var(--md-slider-pressed-state-layer-color, var(--md-sys-color-primary, #6750a4));--_pressed-state-layer-opacity: var(--md-slider-pressed-state-layer-opacity, 0.12);--_state-layer-size: var(--md-slider-state-layer-size, 40px);--_with-overlap-handle-outline-color: var(--md-slider-with-overlap-handle-outline-color, var(--md-sys-color-on-primary, #fff));--_with-overlap-handle-outline-width: var(--md-slider-with-overlap-handle-outline-width, 1px);--_with-tick-marks-active-container-color: var(--md-slider-with-tick-marks-active-container-color, var(--md-sys-color-on-primary, #fff));--_with-tick-marks-container-size: var(--md-slider-with-tick-marks-container-size, 2px);--_with-tick-marks-disabled-container-color: var(--md-slider-with-tick-marks-disabled-container-color, var(--md-sys-color-on-surface, #1d1b20));--_with-tick-marks-inactive-container-color: var(--md-slider-with-tick-marks-inactive-container-color, var(--md-sys-color-on-surface-variant, #49454f));--_label-text-color: var(--md-slider-label-text-color, var(--md-sys-color-on-primary, #fff));--_label-text-font: var(--md-slider-label-text-font, var(--md-sys-typescale-label-medium-font, var(--md-ref-typeface-plain, Roboto)));--_label-text-line-height: var(--md-slider-label-text-line-height, var(--md-sys-typescale-label-medium-line-height, 1rem));--_label-text-size: var(--md-slider-label-text-size, var(--md-sys-typescale-label-medium-size, 0.75rem));--_label-text-weight: var(--md-slider-label-text-weight, var(--md-sys-typescale-label-medium-weight, var(--md-ref-typeface-weight-medium, 500)));--_start-fraction: 0;--_end-fraction: 0;--_tick-count: 0;display:inline-flex;vertical-align:middle;min-inline-size:200px;--md-elevation-level: var(--_handle-elevation);--md-elevation-shadow-color: var(--_handle-shadow-color)}md-focus-ring{height:48px;inset:unset;width:48px}md-elevation{transition-duration:250ms}@media(prefers-reduced-motion){.label{transition-duration:0}}:host([disabled]){opacity:var(--_disabled-active-track-opacity);--md-elevation-level: var(--_disabled-handle-elevation)}.container{flex:1;display:flex;align-items:center;position:relative;block-size:var(--_state-layer-size);pointer-events:none;touch-action:none}.track,.tickmarks{position:absolute;inset:0;display:flex;align-items:center}.track::before,.tickmarks::before,.track::after,.tickmarks::after{position:absolute;content:"";inset-inline-start:calc(var(--_state-layer-size)/2 - var(--_with-tick-marks-container-size));inset-inline-end:calc(var(--_state-layer-size)/2 - var(--_with-tick-marks-container-size));background-size:calc((100% - var(--_with-tick-marks-container-size)*2)/var(--_tick-count)) 100%}.track::before,.tickmarks::before{block-size:var(--_inactive-track-height);border-radius:var(--_inactive-track-shape)}.track::before{background:var(--_inactive-track-color)}.tickmarks::before{background-image:radial-gradient(circle at var(--_with-tick-marks-container-size) center, var(--_with-tick-marks-inactive-container-color) 0, var(--_with-tick-marks-inactive-container-color) calc(var(--_with-tick-marks-container-size) / 2), transparent calc(var(--_with-tick-marks-container-size) / 2))}:host([disabled]) .track::before{opacity:calc(1/var(--_disabled-active-track-opacity)*var(--_disabled-inactive-track-opacity));background:var(--_disabled-inactive-track-color)}.track::after,.tickmarks::after{block-size:var(--_active-track-height);border-radius:var(--_active-track-shape);clip-path:inset(0 calc(var(--_with-tick-marks-container-size) * min((1 - var(--_end-fraction)) * 1000000000, 1) + (100% - var(--_with-tick-marks-container-size) * 2) * (1 - var(--_end-fraction))) 0 calc(var(--_with-tick-marks-container-size) * min(var(--_start-fraction) * 1000000000, 1) + (100% - var(--_with-tick-marks-container-size) * 2) * var(--_start-fraction)))}.track::after{background:var(--_active-track-color)}.tickmarks::after{background-image:radial-gradient(circle at var(--_with-tick-marks-container-size) center, var(--_with-tick-marks-active-container-color) 0, var(--_with-tick-marks-active-container-color) calc(var(--_with-tick-marks-container-size) / 2), transparent calc(var(--_with-tick-marks-container-size) / 2))}.track:dir(rtl)::after{clip-path:inset(0 calc(var(--_with-tick-marks-container-size) * min(var(--_start-fraction) * 1000000000, 1) + (100% - var(--_with-tick-marks-container-size) * 2) * var(--_start-fraction)) 0 calc(var(--_with-tick-marks-container-size) * min((1 - var(--_end-fraction)) * 1000000000, 1) + (100% - var(--_with-tick-marks-container-size) * 2) * (1 - var(--_end-fraction))))}.tickmarks:dir(rtl)::after{clip-path:inset(0 calc(var(--_with-tick-marks-container-size) * min(var(--_start-fraction) * 1000000000, 1) + (100% - var(--_with-tick-marks-container-size) * 2) * var(--_start-fraction)) 0 calc(var(--_with-tick-marks-container-size) * min((1 - var(--_end-fraction)) * 1000000000, 1) + (100% - var(--_with-tick-marks-container-size) * 2) * (1 - var(--_end-fraction))))}:host([disabled]) .track::after{background:var(--_disabled-active-track-color)}:host([disabled]) .tickmarks::before{background-image:radial-gradient(circle at var(--_with-tick-marks-container-size) center, var(--_with-tick-marks-disabled-container-color) 0, var(--_with-tick-marks-disabled-container-color) calc(var(--_with-tick-marks-container-size) / 2), transparent calc(var(--_with-tick-marks-container-size) / 2))}.handleContainerPadded{position:relative;block-size:100%;inline-size:100%;padding-inline:calc(var(--_state-layer-size)/2)}.handleContainerBlock{position:relative;block-size:100%;inline-size:100%}.handleContainer{position:absolute;inset-block-start:0;inset-block-end:0;inset-inline-start:calc(100%*var(--_start-fraction));inline-size:calc(100%*(var(--_end-fraction) - var(--_start-fraction)))}.handle{position:absolute;block-size:var(--_state-layer-size);inline-size:var(--_state-layer-size);border-radius:var(--_handle-shape);display:flex;place-content:center;place-items:center}.handleNub{position:absolute;height:var(--_handle-height);width:var(--_handle-width);border-radius:var(--_handle-shape);background:var(--_handle-color)}:host([disabled]) .handleNub{background:var(--_disabled-handle-color)}input.end:focus~.handleContainerPadded .handle.end>.handleNub,input.start:focus~.handleContainerPadded .handle.start>.handleNub{background:var(--_focus-handle-color)}.container>.handleContainerPadded .handle.hover>.handleNub{background:var(--_hover-handle-color)}:host(:not([disabled])) input.end:active~.handleContainerPadded .handle.end>.handleNub,:host(:not([disabled])) input.start:active~.handleContainerPadded .handle.start>.handleNub{background:var(--_pressed-handle-color)}.onTop.isOverlapping .label,.onTop.isOverlapping .label::before{outline:var(--_with-overlap-handle-outline-color) solid var(--_with-overlap-handle-outline-width)}.onTop.isOverlapping .handleNub{border:var(--_with-overlap-handle-outline-color) solid var(--_with-overlap-handle-outline-width)}.handle.start{inset-inline-start:calc(0px - var(--_state-layer-size)/2)}.handle.end{inset-inline-end:calc(0px - var(--_state-layer-size)/2)}.label{position:absolute;box-sizing:border-box;display:flex;padding:4px;place-content:center;place-items:center;border-radius:var(--md-sys-shape-corner-full, 9999px);color:var(--_label-text-color);font-family:var(--_label-text-font);font-size:var(--_label-text-size);line-height:var(--_label-text-line-height);font-weight:var(--_label-text-weight);inset-block-end:100%;min-inline-size:var(--_label-container-height);min-block-size:var(--_label-container-height);background:var(--_label-container-color);transition:transform 100ms cubic-bezier(0.2, 0, 0, 1);transform-origin:center bottom;transform:scale(0)}:host(:focus-within) .label,.handleContainer.hover .label,:where(:has(input:active)) .label{transform:scale(1)}.label::before,.label::after{position:absolute;display:block;content:"";background:inherit}.label::before{inline-size:calc(var(--_label-container-height)/2);block-size:calc(var(--_label-container-height)/2);bottom:calc(var(--_label-container-height)/-10);transform:rotate(45deg)}.label::after{inset:0px;border-radius:inherit}.labelContent{z-index:1}input[type=range]{opacity:0;-webkit-tap-highlight-color:rgba(0,0,0,0);position:absolute;box-sizing:border-box;height:100%;width:100%;margin:0;background:rgba(0,0,0,0);cursor:pointer;pointer-events:auto;appearance:none}input[type=range]:focus{outline:none}::-webkit-slider-runnable-track{-webkit-appearance:none}::-moz-range-track{appearance:none}::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;block-size:var(--_handle-height);inline-size:var(--_handle-width);opacity:0;z-index:2}input.end::-webkit-slider-thumb{--_track-and-knob-padding: calc( (var(--_state-layer-size) - var(--_handle-width)) / 2 );--_x-translate: calc( var(--_track-and-knob-padding) - 2 * var(--_end-fraction) * var(--_track-and-knob-padding) );transform:translateX(var(--_x-translate))}input.end:dir(rtl)::-webkit-slider-thumb{transform:translateX(calc(-1 * var(--_x-translate)))}input.start::-webkit-slider-thumb{--_track-and-knob-padding: calc( (var(--_state-layer-size) - var(--_handle-width)) / 2 );--_x-translate: calc( var(--_track-and-knob-padding) - 2 * var(--_start-fraction) * var(--_track-and-knob-padding) );transform:translateX(var(--_x-translate))}input.start:dir(rtl)::-webkit-slider-thumb{transform:translateX(calc(-1 * var(--_x-translate)))}::-moz-range-thumb{appearance:none;block-size:var(--_state-layer-size);inline-size:var(--_state-layer-size);transform:scaleX(0);opacity:0;z-index:2}.ranged input.start{clip-path:inset(0 calc(100% - (var(--_state-layer-size) / 2 + (100% - var(--_state-layer-size)) * (var(--_start-fraction) + (var(--_end-fraction) - var(--_start-fraction)) / 2))) 0 0)}.ranged input.start:dir(rtl){clip-path:inset(0 0 0 calc(100% - (var(--_state-layer-size) / 2 + (100% - var(--_state-layer-size)) * (var(--_start-fraction) + (var(--_end-fraction) - var(--_start-fraction)) / 2))))}.ranged input.end{clip-path:inset(0 0 0 calc(var(--_state-layer-size) / 2 + (100% - var(--_state-layer-size)) * (var(--_start-fraction) + (var(--_end-fraction) - var(--_start-fraction)) / 2)))}.ranged input.end:dir(rtl){clip-path:inset(0 calc(var(--_state-layer-size) / 2 + (100% - var(--_state-layer-size)) * (var(--_start-fraction) + (var(--_end-fraction) - var(--_start-fraction)) / 2)) 0 0)}.onTop{z-index:1}.handle{--md-ripple-hover-color: var(--_hover-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-color: var(--_pressed-state-layer-color);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}md-ripple{border-radius:50%;height:var(--_state-layer-size);width:var(--_state-layer-size)}
|
|
55
|
+
`,k=class extends i{};k.styles=[U,R];k=n([E("md-slider")],k);var f,l=(f=class extends y{constructor(...t){super(...t),this.ticks=!1,this.step=5,this.value=20,this.range=!1,this.valueStart=0,this.valueEnd=100,this.min=0,this.max=100,this.labeled=!0,this.disabled=!1,this.name=""}_onInput(t){const a=t.target;this.range?(this.valueStart=a.valueStart,this.valueEnd=a.valueEnd):this.value=a.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0}))}_onChange(t){const a=t.target;this.range?(this.valueStart=a.valueStart,this.valueEnd=a.valueEnd):this.value=a.value,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}render(){const t=this.labeled?m:this.ariaLabel||m;return v`
|
|
2
56
|
<md-slider
|
|
3
57
|
?ticks=${this.ticks}
|
|
4
58
|
.value=${this.value}
|
|
@@ -13,15 +67,15 @@ import"../../vendor/vendor-material.js";import{_ as v,b,g as h,h as a,v as u,y a
|
|
|
13
67
|
.valueLabelStart=${this.valueLabelStart}
|
|
14
68
|
.valueLabelEnd=${this.valueLabelEnd}
|
|
15
69
|
?disabled=${this.disabled}
|
|
16
|
-
aria-label=${
|
|
70
|
+
aria-label=${t}
|
|
17
71
|
name=${this.name}
|
|
18
72
|
name-start=${this.nameStart}
|
|
19
73
|
name-end=${this.nameEnd}
|
|
20
74
|
@input=${this._onInput}
|
|
21
75
|
@change=${this._onChange}
|
|
22
76
|
></md-slider>
|
|
23
|
-
`}},
|
|
77
|
+
`}},f.styles=_`
|
|
24
78
|
:host {
|
|
25
79
|
display: block;
|
|
26
80
|
}
|
|
27
|
-
`,
|
|
81
|
+
`,f);o([r({type:Boolean})],l.prototype,"ticks",void 0);o([r({type:Number})],l.prototype,"step",void 0);o([r({type:Number,reflect:!0})],l.prototype,"value",void 0);o([r({type:Boolean})],l.prototype,"range",void 0);o([r({type:Number,attribute:"value-start"})],l.prototype,"valueStart",void 0);o([r({type:Number,attribute:"value-end"})],l.prototype,"valueEnd",void 0);o([r({type:Number,reflect:!0})],l.prototype,"min",void 0);o([r({type:Number,reflect:!0})],l.prototype,"max",void 0);o([r({type:Boolean})],l.prototype,"labeled",void 0);o([r({type:String,attribute:"value-label"})],l.prototype,"valueLabel",void 0);o([r({type:String,attribute:"value-label-start"})],l.prototype,"valueLabelStart",void 0);o([r({type:String,attribute:"value-label-end"})],l.prototype,"valueLabelEnd",void 0);o([r({type:Boolean,reflect:!0})],l.prototype,"disabled",void 0);o([r({type:String,reflect:!0})],l.prototype,"name",void 0);o([r({type:String,attribute:"name-start",reflect:!0})],l.prototype,"nameStart",void 0);o([r({type:String,attribute:"name-end",reflect:!0})],l.prototype,"nameEnd",void 0);l=o([E("scb-slider")],l);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{_ as d,b as u,g as h,h as a,y as c}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import{t as e}from"../../vendor/decorate.js";(function(){try{var l=typeof globalThis<"u"?globalThis:window;if(!l.__scb_ce_guard_installed__){l.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(s,r,o){try{customElements.get(s)||t(s,r,o)}catch(g){var n=String(g||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw g}}}}catch{}})();var p,i=(p=class extends d{constructor(...t){super(...t),this.status="",this.label="",this.showIcon=!1,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0}mapSpacingToken(t){if(!t)return;const s=String(t).trim();if(s)return/^\d+$/.test(s)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(s,10)))})`:s}applySpacing(){const t=this.mapSpacingToken(this.spacing),s=this.mapSpacingToken(this.spacingTop)??t,r=this.mapSpacingToken(this.spacingBottom)??t,o=this.mapSpacingToken(this.spacingLeft),n=this.mapSpacingToken(this.spacingRight);s?this.style.setProperty("--scb-status-pill-spacing-block-start",s):this.style.removeProperty("--scb-status-pill-spacing-block-start"),r?this.style.setProperty("--scb-status-pill-spacing-block-end",r):this.style.removeProperty("--scb-status-pill-spacing-block-end"),o?this.style.setProperty("--scb-status-pill-spacing-inline-start",o):this.style.removeProperty("--scb-status-pill-spacing-inline-start"),n?this.style.setProperty("--scb-status-pill-spacing-inline-end",n):this.style.removeProperty("--scb-status-pill-spacing-inline-end")}connectedCallback(){super.connectedCallback(),this.applySpacing()}updated(t){super.updated(t),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&this.applySpacing()}render(){return c`
|
|
2
2
|
${this.showIcon?this.status==="success"?c`<md-icon>check_circle</md-icon>`:this.status==="warning"?c`<md-icon>warning</md-icon>`:this.status==="error"?c`<md-icon>error</md-icon>`:"":""}
|
|
3
3
|
<span class="label">${this.label}</span>
|
|
4
4
|
`}},p.styles=u`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{_ as b,b as p,g as h,h as a,y as s}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/md-focus-ring.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{t as i}from"../../vendor/decorate.js";(function(){try{var n=typeof globalThis<"u"?globalThis:window;if(!n.__scb_ce_guard_installed__){n.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(o,d,m){try{customElements.get(o)||e(o,d,m)}catch(c){var r=String(c||"");if(r.indexOf("already been used")===-1&&r.indexOf("NotSupportedError")===-1)throw c}}}}catch{}})();var l,t=(l=class extends b{constructor(...e){super(...e),this.label="",this.subLabel="",this.symbolVariant="number",this.number=0,this.active=!1,this.completed=!1,this.changeOnCompleted=!1,this.islast=!1,this.variant="horizontal",this.widthWeight=1,this.icon=""}updated(){!this.subLabel||this.subLabel.trim()===""?this.setAttribute("no-content",""):this.removeAttribute("no-content"),this.widthWeight>0?this.style.setProperty("--scb-step-width-weight",String(this.widthWeight)):this.style.removeProperty("--scb-step-width-weight")}handleKeyDown(e){e.key==="Enter"||e.key===" "?(e.preventDefault(),this.dispatchEvent(new MouseEvent("click",{bubbles:!0,composed:!0}))):(e.key==="ArrowRight"||e.key==="ArrowLeft")&&(this.dispatchEvent(new CustomEvent("scb-stepper-keynav",{detail:{key:e.key},bubbles:!0,composed:!0})),e.preventDefault())}render(){const e=this.active?"step":void 0,o=this.label?`${this.label}${this.subLabel?": "+this.subLabel:""}`:void 0;switch(this.symbolVariant){case"icon":return s`
|
|
2
2
|
<div
|
|
3
3
|
class="scb-step-content"
|
|
4
4
|
tabindex="0"
|
|
@@ -1,17 +1,62 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{_,b as S,c as w,g as V,h as r,l as u,p as C,v as b,y as c}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/md-focus-ring.js";import"../../vendor/ripple.js";import{t as a}from"../../vendor/decorate.js";import{t as T}from"../../vendor/delegate.js";import{n as I}from"../../vendor/element-internals.js";import{n as B,t as M}from"../../vendor/form-label-activation.js";import{n as L,t as p}from"../../vendor/assertClassBrand.js";import{t as R}from"../../vendor/redispatch-event.js";import{i as z,n as q,r as O}from"../../vendor/validator.js";import{n as H,r as P,t as A}from"../../vendor/form-associated.js";import{t as F}from"../../vendor/checkbox-validator.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(s,o,l){try{customElements.get(s)||e(s,o,l)}catch(m){var h=String(m||"");if(h.indexOf("already been used")===-1&&h.indexOf("NotSupportedError")===-1)throw m}}}}catch{}})();var E=Symbol("dispatchHooks");function j(t,e){const s=t[E];if(!s)throw new Error(`'${t.type}' event needs setupDispatchHooks().`);s.addEventListener("after",e)}var k=new WeakMap;function D(t,...e){let s=k.get(t);s||(s=new Set,k.set(t,s));for(const o of e){if(s.has(o))continue;let l=!1;t.addEventListener(o,h=>{if(l)return;h.stopImmediatePropagation();const m=Reflect.construct(h.constructor,[h.type,h]),g=new EventTarget;m[E]=g,l=!0;const $=t.dispatchEvent(m);l=!1,$||h.preventDefault(),g.dispatchEvent(new Event("after"))},{capture:!0}),s.add(o)}}var G=z(P(I(_))),d=class extends G{constructor(){super(),this.selected=!1,this.icons=!1,this.showOnlySelectedIcon=!1,this.required=!1,this.value="on",this.addEventListener("click",t=>{!B(t)||!this.input||(this.focus(),M(this.input))}),D(this,"keydown"),this.addEventListener("keydown",t=>{j(t,()=>{t.defaultPrevented||t.key!=="Enter"||this.disabled||!this.input||this.input.click()})})}render(){return c`
|
|
2
|
+
<div class="switch ${w(this.getRenderClasses())}">
|
|
3
|
+
<input
|
|
4
|
+
id="switch"
|
|
5
|
+
class="touch"
|
|
6
|
+
type="checkbox"
|
|
7
|
+
role="switch"
|
|
8
|
+
aria-label=${this.ariaLabel||b}
|
|
9
|
+
?checked=${this.selected}
|
|
10
|
+
?disabled=${this.disabled}
|
|
11
|
+
?required=${this.required}
|
|
12
|
+
@input=${this.handleInput}
|
|
13
|
+
@change=${this.handleChange} />
|
|
14
|
+
|
|
15
|
+
<md-focus-ring part="focus-ring" for="switch"></md-focus-ring>
|
|
16
|
+
<span class="track"> ${this.renderHandle()} </span>
|
|
17
|
+
</div>
|
|
18
|
+
`}getRenderClasses(){return{selected:this.selected,unselected:!this.selected,disabled:this.disabled}}renderHandle(){const t={"with-icon":this.showOnlySelectedIcon?this.selected:this.icons};return c`
|
|
19
|
+
${this.renderTouchTarget()}
|
|
20
|
+
<span class="handle-container">
|
|
21
|
+
<md-ripple for="switch" ?disabled="${this.disabled}"></md-ripple>
|
|
22
|
+
<span class="handle ${w(t)}">
|
|
23
|
+
${this.shouldShowIcons()?this.renderIcons():c``}
|
|
24
|
+
</span>
|
|
25
|
+
</span>
|
|
26
|
+
`}renderIcons(){return c`
|
|
27
|
+
<div class="icons">
|
|
28
|
+
${this.renderOnIcon()}
|
|
29
|
+
${this.showOnlySelectedIcon?c``:this.renderOffIcon()}
|
|
30
|
+
</div>
|
|
31
|
+
`}renderOnIcon(){return c`
|
|
32
|
+
<slot class="icon icon--on" name="on-icon">
|
|
33
|
+
<svg viewBox="0 0 24 24">
|
|
34
|
+
<path
|
|
35
|
+
d="M9.55 18.2 3.65 12.3 5.275 10.675 9.55 14.95 18.725 5.775 20.35 7.4Z" />
|
|
36
|
+
</svg>
|
|
37
|
+
</slot>
|
|
38
|
+
`}renderOffIcon(){return c`
|
|
39
|
+
<slot class="icon icon--off" name="off-icon">
|
|
40
|
+
<svg viewBox="0 0 24 24">
|
|
41
|
+
<path
|
|
42
|
+
d="M6.4 19.2 4.8 17.6 10.4 12 4.8 6.4 6.4 4.8 12 10.4 17.6 4.8 19.2 6.4 13.6 12 19.2 17.6 17.6 19.2 12 13.6Z" />
|
|
43
|
+
</svg>
|
|
44
|
+
</slot>
|
|
45
|
+
`}renderTouchTarget(){return c`<span class="touch"></span>`}shouldShowIcons(){return this.icons||this.showOnlySelectedIcon}handleInput(t){const e=t.target;this.selected=e.checked}handleChange(t){R(this,t)}[H](){return this.selected?this.value:null}[A](){return String(this.selected)}formResetCallback(){this.selected=this.hasAttribute("selected")}formStateRestoreCallback(t){this.selected=t==="true"}[q](){return new F(()=>({checked:this.selected,required:this.required}))}[O](){return this.input}};T(d);d.shadowRootOptions={mode:"open",delegatesFocus:!0};u([r({type:Boolean})],d.prototype,"selected",void 0);u([r({type:Boolean})],d.prototype,"icons",void 0);u([r({type:Boolean,attribute:"show-only-selected-icon"})],d.prototype,"showOnlySelectedIcon",void 0);u([r({type:Boolean})],d.prototype,"required",void 0);u([r()],d.prototype,"value",void 0);u([C("input")],d.prototype,"input",void 0);var W=S`@layer styles, hcm;@layer styles{:host{display:inline-flex;outline:none;vertical-align:top;-webkit-tap-highlight-color:rgba(0,0,0,0);cursor:pointer}:host([disabled]){cursor:default}:host([touch-target=wrapper]){margin:max(0px,(48px - var(--md-switch-track-height, 32px))/2) 0px}md-focus-ring{--md-focus-ring-shape-start-start: var(--md-switch-track-shape-start-start, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));--md-focus-ring-shape-start-end: var(--md-switch-track-shape-start-end, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));--md-focus-ring-shape-end-end: var(--md-switch-track-shape-end-end, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));--md-focus-ring-shape-end-start: var(--md-switch-track-shape-end-start, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)))}.switch{align-items:center;display:inline-flex;flex-shrink:0;position:relative;width:var(--md-switch-track-width, 52px);height:var(--md-switch-track-height, 32px);border-start-start-radius:var(--md-switch-track-shape-start-start, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));border-start-end-radius:var(--md-switch-track-shape-start-end, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));border-end-end-radius:var(--md-switch-track-shape-end-end, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));border-end-start-radius:var(--md-switch-track-shape-end-start, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)))}input{appearance:none;height:48px;outline:none;margin:0;position:absolute;width:100%;z-index:1;cursor:inherit}:host([touch-target=none]) input{display:none}}@layer styles{.track{position:absolute;width:100%;height:100%;box-sizing:border-box;border-radius:inherit;display:flex;justify-content:center;align-items:center}.track::before{content:"";display:flex;position:absolute;height:100%;width:100%;border-radius:inherit;box-sizing:border-box;transition-property:opacity,background-color;transition-timing-function:linear;transition-duration:67ms}.disabled .track{background-color:rgba(0,0,0,0);border-color:rgba(0,0,0,0)}.disabled .track::before,.disabled .track::after{transition:none;opacity:var(--md-switch-disabled-track-opacity, 0.12)}.disabled .track::before{background-clip:content-box}.selected .track::before{background-color:var(--md-switch-selected-track-color, var(--md-sys-color-primary, #6750a4))}.selected:hover .track::before{background-color:var(--md-switch-selected-hover-track-color, var(--md-sys-color-primary, #6750a4))}.selected:focus-within .track::before{background-color:var(--md-switch-selected-focus-track-color, var(--md-sys-color-primary, #6750a4))}.selected:active .track::before{background-color:var(--md-switch-selected-pressed-track-color, var(--md-sys-color-primary, #6750a4))}.selected.disabled .track{background-clip:border-box}.selected.disabled .track::before{background-color:var(--md-switch-disabled-selected-track-color, var(--md-sys-color-on-surface, #1d1b20))}.unselected .track::before{background-color:var(--md-switch-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-track-outline-color, var(--md-sys-color-outline, #79747e));border-style:solid;border-width:var(--md-switch-track-outline-width, 2px)}.unselected:hover .track::before{background-color:var(--md-switch-hover-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-hover-track-outline-color, var(--md-sys-color-outline, #79747e))}.unselected:focus-visible .track::before{background-color:var(--md-switch-focus-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-focus-track-outline-color, var(--md-sys-color-outline, #79747e))}.unselected:active .track::before{background-color:var(--md-switch-pressed-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-pressed-track-outline-color, var(--md-sys-color-outline, #79747e))}.unselected.disabled .track::before{background-color:var(--md-switch-disabled-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-disabled-track-outline-color, var(--md-sys-color-on-surface, #1d1b20))}}@layer hcm{@media(forced-colors: active){.selected .track::before{background:ButtonText;border-color:ButtonText}.disabled .track::before{border-color:GrayText;opacity:1}.disabled.selected .track::before{background:GrayText}}}@layer styles{.handle-container{display:flex;place-content:center;place-items:center;position:relative;transition:margin 300ms cubic-bezier(0.175, 0.885, 0.32, 1.275)}.selected .handle-container{margin-inline-start:calc(var(--md-switch-track-width, 52px) - var(--md-switch-track-height, 32px))}.unselected .handle-container{margin-inline-end:calc(var(--md-switch-track-width, 52px) - var(--md-switch-track-height, 32px))}.disabled .handle-container{transition:none}.handle{border-start-start-radius:var(--md-switch-handle-shape-start-start, var(--md-switch-handle-shape, var(--md-sys-shape-corner-full, 9999px)));border-start-end-radius:var(--md-switch-handle-shape-start-end, var(--md-switch-handle-shape, var(--md-sys-shape-corner-full, 9999px)));border-end-end-radius:var(--md-switch-handle-shape-end-end, var(--md-switch-handle-shape, var(--md-sys-shape-corner-full, 9999px)));border-end-start-radius:var(--md-switch-handle-shape-end-start, var(--md-switch-handle-shape, var(--md-sys-shape-corner-full, 9999px)));height:var(--md-switch-handle-height, 16px);width:var(--md-switch-handle-width, 16px);transform-origin:center;transition-property:height,width;transition-duration:250ms,250ms;transition-timing-function:cubic-bezier(0.2, 0, 0, 1),cubic-bezier(0.2, 0, 0, 1);z-index:0}.handle::before{content:"";display:flex;inset:0;position:absolute;border-radius:inherit;box-sizing:border-box;transition:background-color 67ms linear}.disabled .handle,.disabled .handle::before{transition:none}.selected .handle{height:var(--md-switch-selected-handle-height, 24px);width:var(--md-switch-selected-handle-width, 24px)}.handle.with-icon{height:var(--md-switch-with-icon-handle-height, 24px);width:var(--md-switch-with-icon-handle-width, 24px)}.selected:not(.disabled):active .handle,.unselected:not(.disabled):active .handle{height:var(--md-switch-pressed-handle-height, 28px);width:var(--md-switch-pressed-handle-width, 28px);transition-timing-function:linear;transition-duration:100ms}.selected .handle::before{background-color:var(--md-switch-selected-handle-color, var(--md-sys-color-on-primary, #fff))}.selected:hover .handle::before{background-color:var(--md-switch-selected-hover-handle-color, var(--md-sys-color-primary-container, #eaddff))}.selected:focus-within .handle::before{background-color:var(--md-switch-selected-focus-handle-color, var(--md-sys-color-primary-container, #eaddff))}.selected:active .handle::before{background-color:var(--md-switch-selected-pressed-handle-color, var(--md-sys-color-primary-container, #eaddff))}.selected.disabled .handle::before{background-color:var(--md-switch-disabled-selected-handle-color, var(--md-sys-color-surface, #fef7ff));opacity:var(--md-switch-disabled-selected-handle-opacity, 1)}.unselected .handle::before{background-color:var(--md-switch-handle-color, var(--md-sys-color-outline, #79747e))}.unselected:hover .handle::before{background-color:var(--md-switch-hover-handle-color, var(--md-sys-color-on-surface-variant, #49454f))}.unselected:focus-within .handle::before{background-color:var(--md-switch-focus-handle-color, var(--md-sys-color-on-surface-variant, #49454f))}.unselected:active .handle::before{background-color:var(--md-switch-pressed-handle-color, var(--md-sys-color-on-surface-variant, #49454f))}.unselected.disabled .handle::before{background-color:var(--md-switch-disabled-handle-color, var(--md-sys-color-on-surface, #1d1b20));opacity:var(--md-switch-disabled-handle-opacity, 0.38)}md-ripple{border-radius:var(--md-switch-state-layer-shape, var(--md-sys-shape-corner-full, 9999px));height:var(--md-switch-state-layer-size, 40px);inset:unset;width:var(--md-switch-state-layer-size, 40px)}.selected md-ripple{--md-ripple-hover-color: var(--md-switch-selected-hover-state-layer-color, var(--md-sys-color-primary, #6750a4));--md-ripple-pressed-color: var(--md-switch-selected-pressed-state-layer-color, var(--md-sys-color-primary, #6750a4));--md-ripple-hover-opacity: var(--md-switch-selected-hover-state-layer-opacity, 0.08);--md-ripple-pressed-opacity: var(--md-switch-selected-pressed-state-layer-opacity, 0.12)}.unselected md-ripple{--md-ripple-hover-color: var(--md-switch-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-color: var(--md-switch-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-switch-hover-state-layer-opacity, 0.08);--md-ripple-pressed-opacity: var(--md-switch-pressed-state-layer-opacity, 0.12)}}@layer hcm{@media(forced-colors: active){.unselected .handle::before{background:ButtonText}.disabled .handle::before{opacity:1}.disabled.unselected .handle::before{background:GrayText}}}@layer styles{.icons{position:relative;height:100%;width:100%}.icon{position:absolute;inset:0;margin:auto;display:flex;align-items:center;justify-content:center;fill:currentColor;transition:fill 67ms linear,opacity 33ms linear,transform 167ms cubic-bezier(0.2, 0, 0, 1);opacity:0}.disabled .icon{transition:none}.selected .icon--on,.unselected .icon--off{opacity:1}.unselected .handle:not(.with-icon) .icon--on{transform:rotate(-45deg)}.icon--off{width:var(--md-switch-icon-size, 16px);height:var(--md-switch-icon-size, 16px);color:var(--md-switch-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9))}.unselected:hover .icon--off{color:var(--md-switch-hover-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9))}.unselected:focus-within .icon--off{color:var(--md-switch-focus-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9))}.unselected:active .icon--off{color:var(--md-switch-pressed-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9))}.unselected.disabled .icon--off{color:var(--md-switch-disabled-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9));opacity:var(--md-switch-disabled-icon-opacity, 0.38)}.icon--on{width:var(--md-switch-selected-icon-size, 16px);height:var(--md-switch-selected-icon-size, 16px);color:var(--md-switch-selected-icon-color, var(--md-sys-color-on-primary-container, #21005d))}.selected:hover .icon--on{color:var(--md-switch-selected-hover-icon-color, var(--md-sys-color-on-primary-container, #21005d))}.selected:focus-within .icon--on{color:var(--md-switch-selected-focus-icon-color, var(--md-sys-color-on-primary-container, #21005d))}.selected:active .icon--on{color:var(--md-switch-selected-pressed-icon-color, var(--md-sys-color-on-primary-container, #21005d))}.selected.disabled .icon--on{color:var(--md-switch-disabled-selected-icon-color, var(--md-sys-color-on-surface, #1d1b20));opacity:var(--md-switch-disabled-selected-icon-opacity, 0.38)}}@layer hcm{@media(forced-colors: active){.icon--off{fill:Canvas}.icon--on{fill:ButtonText}.disabled.unselected .icon--off,.disabled.selected .icon--on{opacity:1}.disabled .icon--on{fill:GrayText}}}
|
|
46
|
+
`,y=class extends d{};y.styles=[W];y=u([V("md-switch")],y);var n,f,i=(n=new WeakSet,f=class extends _{constructor(){super(),L(this,n),this._internals=null,this.label="",this.ariaLabel="",this.icons=!1,this.selected=!1,this.required=!1,this.disabled=!1,this.fullWidth=!1,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.name="",this.value="on",this._form=null,this._formResetHandler=null,this._initialSelected=!1,this._customValidationMessage="","attachInternals"in this&&(this._internals=this.attachInternals())}connectedCallback(){super.connectedCallback(),this._initialSelected=this.selected,this._form=this.closest("form"),this._form&&(this._formResetHandler=()=>{this.selected=this._initialSelected,this.__syncFormValue()},this._form.addEventListener("reset",this._formResetHandler,!0)),this.__syncFormValue()}disconnectedCallback(){this._form&&this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0),super.disconnectedCallback()}firstUpdated(){this.shadowRoot?.querySelector("md-switch")?.addEventListener("change",e=>{this.selected=e.target.selected,this.dispatchEvent(new CustomEvent("change",{detail:{selected:this.selected},bubbles:!0,composed:!0}))}),p(n,this,x).call(this)}updated(e){super.updated(e),e.has("disabled")&&this.toggleAttribute("aria-disabled",this.disabled),(e.has("selected")||e.has("disabled")||e.has("value"))&&this.__syncFormValue(),(e.has("selected")||e.has("disabled")||e.has("required"))&&this.__syncValidity(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&p(n,this,x).call(this)}formDisabledCallback(e){this.disabled=e}__getValidationMessage(){return this._customValidationMessage?this._customValidationMessage:this.required&&!this.selected?"Aktivera det här valet.":""}__syncValidity(){const e=this.shadowRoot?.querySelector("md-switch"),s=this.disabled?"":this.__getValidationMessage();this._internals&&(s?this._internals.setValidity({valueMissing:!0},s,e??void 0):this._internals.setValidity({})),this.toggleAttribute("aria-invalid",!!s)}checkValidity(){return!this.__getValidationMessage()}reportValidity(){return this.__syncValidity(),this._internals?this._internals.reportValidity():this.checkValidity()}setCustomValidity(e){this._customValidationMessage=e,this.__syncValidity()}get validity(){return this._internals?.validity}get validationMessage(){return this._internals?.validationMessage??this.__getValidationMessage()}get willValidate(){return this._internals?.willValidate??!0}__syncFormValue(){if(!this._internals)return;const e=this.disabled||!this.selected?null:this.value;this._internals.setFormValue(e)}render(){const e=this.label.trim().length>0,s=e?b:this.ariaLabel||b,o=c`
|
|
2
47
|
<md-switch
|
|
3
48
|
?icons=${this.icons}
|
|
4
49
|
?selected=${this.selected}
|
|
5
50
|
?disabled=${this.disabled}
|
|
6
51
|
aria-required=${this.required?"true":"false"}
|
|
7
|
-
aria-label=${
|
|
52
|
+
aria-label=${s}
|
|
8
53
|
></md-switch>
|
|
9
|
-
`;return
|
|
54
|
+
`;return e?c`
|
|
10
55
|
<label class="switch-container" ?disabled=${this.disabled}>
|
|
11
56
|
<span class="switch-label">${this.label}</span>
|
|
12
|
-
${
|
|
57
|
+
${o}
|
|
13
58
|
</label>
|
|
14
|
-
`:
|
|
59
|
+
`:o}},f.formAssociated=!0,f.styles=S`
|
|
15
60
|
:host {
|
|
16
61
|
display: block;
|
|
17
62
|
/* Vertikalt avstånd styrs av spacing-attributen via CSS-variabler */
|
|
@@ -56,4 +101,4 @@ import"../../vendor/vendor-material.js";import{_ as y,b as m,g as _,h as s,v as
|
|
|
56
101
|
/* Ärver färg från container */
|
|
57
102
|
color: var(--scb-switch-label-color, inherit);
|
|
58
103
|
}
|
|
59
|
-
`,
|
|
104
|
+
`,f);function x(){const t=p(n,this,v).call(this,this.spacing),e=p(n,this,v).call(this,this.spacingTop)??t,s=p(n,this,v).call(this,this.spacingBottom)??t,o=p(n,this,v).call(this,this.spacingLeft),l=p(n,this,v).call(this,this.spacingRight);e?this.style.setProperty("--scb-switch-spacing-block-start",e):this.style.removeProperty("--scb-switch-spacing-block-start"),s?this.style.setProperty("--scb-switch-spacing-block-end",s):this.style.removeProperty("--scb-switch-spacing-block-end"),o?this.style.setProperty("--scb-switch-spacing-inline-start",o):this.style.removeProperty("--scb-switch-spacing-inline-start"),l?this.style.setProperty("--scb-switch-spacing-inline-end",l):this.style.removeProperty("--scb-switch-spacing-inline-end")}function v(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}a([r({type:String})],i.prototype,"label",void 0);a([r({type:String,reflect:!0,attribute:"aria-label"})],i.prototype,"ariaLabel",void 0);a([r({type:Boolean,reflect:!0})],i.prototype,"icons",void 0);a([r({type:Boolean,reflect:!0})],i.prototype,"selected",void 0);a([r({type:Boolean,reflect:!0})],i.prototype,"required",void 0);a([r({type:Boolean,reflect:!0})],i.prototype,"disabled",void 0);a([r({type:Boolean,reflect:!0,attribute:"full-width"})],i.prototype,"fullWidth",void 0);a([r({type:String,reflect:!0})],i.prototype,"spacing",void 0);a([r({type:String,attribute:"spacing-top",reflect:!0})],i.prototype,"spacingTop",void 0);a([r({type:String,attribute:"spacing-bottom",reflect:!0})],i.prototype,"spacingBottom",void 0);a([r({type:String,attribute:"spacing-left",reflect:!0})],i.prototype,"spacingLeft",void 0);a([r({type:String,attribute:"spacing-right",reflect:!0})],i.prototype,"spacingRight",void 0);a([r({type:String})],i.prototype,"name",void 0);a([r({type:String})],i.prototype,"value",void 0);i=a([V("scb-switch")],i);export{i as ScbSwitch};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as d,g as m,h as i,l as p}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import{t as s}from"../../vendor/decorate.js";import{r as h,t as _}from"../../vendor/tab-styles.js";(function(){try{var o=typeof globalThis<"u"?globalThis:window;if(!o.__scb_ce_guard_installed__){o.__scb_ce_guard_installed__=!0;var a=customElements.define.bind(customElements);customElements.define=function(t,v,b){try{customElements.get(t)||a(t,v,b)}catch(l){var n=String(l||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw l}}}}catch{}})();var y=class extends h{constructor(){super(...arguments),this.inlineIcon=!1}getContentClasses(){return{...super.getContentClasses(),stacked:!this.inlineIcon}}};p([i({type:Boolean,attribute:"inline-icon"})],y.prototype,"inlineIcon",void 0);var u=d`:host{--_active-indicator-color: var(--md-primary-tab-active-indicator-color, var(--md-sys-color-primary, #6750a4));--_active-indicator-height: var(--md-primary-tab-active-indicator-height, 3px);--_active-indicator-shape: var(--md-primary-tab-active-indicator-shape, 3px 3px 0px 0px);--_active-hover-state-layer-color: var(--md-primary-tab-active-hover-state-layer-color, var(--md-sys-color-primary, #6750a4));--_active-hover-state-layer-opacity: var(--md-primary-tab-active-hover-state-layer-opacity, 0.08);--_active-pressed-state-layer-color: var(--md-primary-tab-active-pressed-state-layer-color, var(--md-sys-color-primary, #6750a4));--_active-pressed-state-layer-opacity: var(--md-primary-tab-active-pressed-state-layer-opacity, 0.12);--_container-color: var(--md-primary-tab-container-color, var(--md-sys-color-surface, #fef7ff));--_container-elevation: var(--md-primary-tab-container-elevation, 0);--_container-height: var(--md-primary-tab-container-height, 48px);--_with-icon-and-label-text-container-height: var(--md-primary-tab-with-icon-and-label-text-container-height, 64px);--_hover-state-layer-color: var(--md-primary-tab-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-state-layer-opacity: var(--md-primary-tab-hover-state-layer-opacity, 0.08);--_pressed-state-layer-color: var(--md-primary-tab-pressed-state-layer-color, var(--md-sys-color-primary, #6750a4));--_pressed-state-layer-opacity: var(--md-primary-tab-pressed-state-layer-opacity, 0.12);--_active-focus-icon-color: var(--md-primary-tab-active-focus-icon-color, var(--md-sys-color-primary, #6750a4));--_active-hover-icon-color: var(--md-primary-tab-active-hover-icon-color, var(--md-sys-color-primary, #6750a4));--_active-icon-color: var(--md-primary-tab-active-icon-color, var(--md-sys-color-primary, #6750a4));--_active-pressed-icon-color: var(--md-primary-tab-active-pressed-icon-color, var(--md-sys-color-primary, #6750a4));--_icon-size: var(--md-primary-tab-icon-size, 24px);--_focus-icon-color: var(--md-primary-tab-focus-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-icon-color: var(--md-primary-tab-hover-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_icon-color: var(--md-primary-tab-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_pressed-icon-color: var(--md-primary-tab-pressed-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_label-text-font: var(--md-primary-tab-label-text-font, var(--md-sys-typescale-title-small-font, var(--md-ref-typeface-plain, Roboto)));--_label-text-line-height: var(--md-primary-tab-label-text-line-height, var(--md-sys-typescale-title-small-line-height, 1.25rem));--_label-text-size: var(--md-primary-tab-label-text-size, var(--md-sys-typescale-title-small-size, 0.875rem));--_label-text-weight: var(--md-primary-tab-label-text-weight, var(--md-sys-typescale-title-small-weight, var(--md-ref-typeface-weight-medium, 500)));--_active-focus-label-text-color: var(--md-primary-tab-active-focus-label-text-color, var(--md-sys-color-primary, #6750a4));--_active-hover-label-text-color: var(--md-primary-tab-active-hover-label-text-color, var(--md-sys-color-primary, #6750a4));--_active-label-text-color: var(--md-primary-tab-active-label-text-color, var(--md-sys-color-primary, #6750a4));--_active-pressed-label-text-color: var(--md-primary-tab-active-pressed-label-text-color, var(--md-sys-color-primary, #6750a4));--_focus-label-text-color: var(--md-primary-tab-focus-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-label-text-color: var(--md-primary-tab-hover-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_label-text-color: var(--md-primary-tab-label-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_pressed-label-text-color: var(--md-primary-tab-pressed-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_container-shape-start-start: var(--md-primary-tab-container-shape-start-start, var(--md-primary-tab-container-shape, var(--md-sys-shape-corner-none, 0px)));--_container-shape-start-end: var(--md-primary-tab-container-shape-start-end, var(--md-primary-tab-container-shape, var(--md-sys-shape-corner-none, 0px)));--_container-shape-end-end: var(--md-primary-tab-container-shape-end-end, var(--md-primary-tab-container-shape, var(--md-sys-shape-corner-none, 0px)));--_container-shape-end-start: var(--md-primary-tab-container-shape-end-start, var(--md-primary-tab-container-shape, var(--md-sys-shape-corner-none, 0px)))}.content.stacked{flex-direction:column;gap:2px}.content.stacked.has-icon.has-label{height:var(--_with-icon-and-label-text-container-height)}
|
|
2
|
+
`,r=class extends y{};r.styles=[_,u];r=p([m("md-primary-tab")],r);var c,e=(c=class extends r{constructor(...a){super(...a),this.iconOnly=!1,this.inlineIcon=!1,this._onActivate=()=>{const t=this.textContent?.trim()??"";this.dispatchEvent(new CustomEvent("activate",{detail:{label:t},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","tab")}get icon(){return this._icon}set icon(a){const t=this._icon;t!==a&&(this._icon=a,this.requestUpdate("icon",t),this.updateIconSlot())}firstUpdated(a){super.firstUpdated(a),this.addEventListener("click",this._onActivate),this._icon&&this.updateIconSlot()}updated(){if(super.updated(),this.setAttribute("aria-selected",this.active?"true":"false"),this.iconOnly&&!this.hasAttribute("aria-label")){const a=this.textContent?.trim()??"";a&&this.setAttribute("aria-label",a)}}updateIconSlot(){const a=this.querySelector('md-icon[slot="icon"]');if(!this._icon){a?.remove();return}if(a)a.textContent=this._icon;else{const t=document.createElement("md-icon");t.setAttribute("slot","icon"),t.textContent=this._icon,this.appendChild(t)}}},c.styles=[...r.styles,d`
|
|
2
3
|
/* Icon-only: dölj textslot */
|
|
3
4
|
:host([icon-only]) slot:not([name='icon']) {
|
|
4
5
|
display: none;
|
|
5
6
|
}
|
|
6
|
-
`],
|
|
7
|
+
`],c);s([i({type:String})],e.prototype,"icon",null);s([i({type:Boolean,reflect:!0,attribute:"icon-only"})],e.prototype,"iconOnly",void 0);s([i({type:Boolean,reflect:!0,attribute:"inline-icon"})],e.prototype,"inlineIcon",void 0);e=s([m("scb-primary-tab")],e);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as d,g as l,h as v,l as m}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import{t as c}from"../../vendor/decorate.js";import{r as h,t as p}from"../../vendor/tab-styles.js";(function(){try{var o=typeof globalThis<"u"?globalThis:window;if(!o.__scb_ce_guard_installed__){o.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,y,b){try{customElements.get(t)||e(t,y,b)}catch(i){var n=String(i||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw i}}}}catch{}})();var u=class extends h{constructor(){super(...arguments),this.fullWidthIndicator=!0}},_=d`:host{--_active-indicator-color: var(--md-secondary-tab-active-indicator-color, var(--md-sys-color-primary, #6750a4));--_active-indicator-height: var(--md-secondary-tab-active-indicator-height, 2px);--_active-label-text-color: var(--md-secondary-tab-active-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_container-color: var(--md-secondary-tab-container-color, var(--md-sys-color-surface, #fef7ff));--_container-elevation: var(--md-secondary-tab-container-elevation, 0);--_container-height: var(--md-secondary-tab-container-height, 48px);--_focus-label-text-color: var(--md-secondary-tab-focus-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-label-text-color: var(--md-secondary-tab-hover-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-state-layer-color: var(--md-secondary-tab-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-state-layer-opacity: var(--md-secondary-tab-hover-state-layer-opacity, 0.08);--_label-text-font: var(--md-secondary-tab-label-text-font, var(--md-sys-typescale-title-small-font, var(--md-ref-typeface-plain, Roboto)));--_label-text-line-height: var(--md-secondary-tab-label-text-line-height, var(--md-sys-typescale-title-small-line-height, 1.25rem));--_label-text-size: var(--md-secondary-tab-label-text-size, var(--md-sys-typescale-title-small-size, 0.875rem));--_label-text-weight: var(--md-secondary-tab-label-text-weight, var(--md-sys-typescale-title-small-weight, var(--md-ref-typeface-weight-medium, 500)));--_pressed-label-text-color: var(--md-secondary-tab-pressed-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_pressed-state-layer-color: var(--md-secondary-tab-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_pressed-state-layer-opacity: var(--md-secondary-tab-pressed-state-layer-opacity, 0.12);--_active-focus-icon-color: var(--md-secondary-tab-active-focus-icon-color, );--_active-focus-label-text-color: var(--md-secondary-tab-active-focus-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_active-hover-icon-color: var(--md-secondary-tab-active-hover-icon-color, );--_active-hover-label-text-color: var(--md-secondary-tab-active-hover-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_active-hover-state-layer-color: var(--md-secondary-tab-active-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_active-hover-state-layer-opacity: var(--md-secondary-tab-active-hover-state-layer-opacity, 0.08);--_active-icon-color: var(--md-secondary-tab-active-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_active-indicator-shape: var(--md-secondary-tab-active-indicator-shape, 0);--_active-pressed-icon-color: var(--md-secondary-tab-active-pressed-icon-color, );--_active-pressed-label-text-color: var(--md-secondary-tab-active-pressed-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_active-pressed-state-layer-color: var(--md-secondary-tab-active-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_active-pressed-state-layer-opacity: var(--md-secondary-tab-active-pressed-state-layer-opacity, 0.12);--_label-text-color: var(--md-secondary-tab-label-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_focus-icon-color: var(--md-secondary-tab-focus-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-icon-color: var(--md-secondary-tab-hover-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_icon-size: var(--md-secondary-tab-icon-size, 24px);--_icon-color: var(--md-secondary-tab-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_pressed-icon-color: var(--md-secondary-tab-pressed-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_container-shape-start-start: var(--md-secondary-tab-container-shape-start-start, var(--md-secondary-tab-container-shape, var(--md-sys-shape-corner-none, 0px)));--_container-shape-start-end: var(--md-secondary-tab-container-shape-start-end, var(--md-secondary-tab-container-shape, var(--md-sys-shape-corner-none, 0px)));--_container-shape-end-end: var(--md-secondary-tab-container-shape-end-end, var(--md-secondary-tab-container-shape, var(--md-sys-shape-corner-none, 0px)));--_container-shape-end-start: var(--md-secondary-tab-container-shape-end-start, var(--md-secondary-tab-container-shape, var(--md-sys-shape-corner-none, 0px)))}
|
|
2
|
+
`,a=class extends u{};a.styles=[p,_];a=m([l("md-secondary-tab")],a);var s,r=(s=class extends a{constructor(...e){super(...e),this.iconOnly=!1,this._onActivate=()=>{const t=this.textContent?.trim()??"";this.dispatchEvent(new CustomEvent("activate",{detail:{label:t},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","tab")}get icon(){return this._icon}set icon(e){const t=this._icon;t!==e&&(this._icon=e,this.requestUpdate("icon",t),this.updateIconSlot())}firstUpdated(e){if(super.firstUpdated(e),this.iconOnly&&!this.hasAttribute("aria-label")){const t=this.textContent?.trim()??"";t&&this.setAttribute("aria-label",t)}this.addEventListener("click",this._onActivate),this._icon&&this.updateIconSlot()}updated(){if(super.updated(),this.iconOnly&&!this.hasAttribute("aria-label")){const e=this.textContent?.trim()??"";e&&this.setAttribute("aria-label",e)}}updateIconSlot(){const e=this.querySelector('md-icon[slot="icon"]');if(!this._icon){e?.remove();return}if(e)e.textContent=this._icon;else{const t=document.createElement("md-icon");t.setAttribute("slot","icon"),t.textContent=this._icon,this.appendChild(t)}}},s.styles=[...a.styles,d`
|
|
2
3
|
/* Icon-only: göm all text utom slot="icon" */
|
|
3
4
|
:host([icon-only]) slot:not([name='icon']) {
|
|
4
5
|
display: none;
|
|
5
6
|
}
|
|
6
|
-
`],
|
|
7
|
+
`],s);c([v({type:String})],r.prototype,"icon",null);c([v({type:Boolean,reflect:!0,attribute:"icon-only"})],r.prototype,"iconOnly",void 0);r=c([l("scb-secondary-tab")],r);
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{_ as S,b as k,d as L,g as w,h as r,l as n,p as C,y as M}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as b}from"../../vendor/decorate.js";import{n as P,t as h}from"../../vendor/assertClassBrand.js";import{n as A}from"../../vendor/tab-styles.js";import"./scb-primary-tab.js";import"./scb-secondary-tab.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(s,i,c){try{customElements.get(s)||e(s,i,c)}catch(a){var o=String(a||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw a}}}}catch{}})();var T=class extends S{constructor(){super(...arguments),this.inset=!1,this.insetStart=!1,this.insetEnd=!1}};n([r({type:Boolean,reflect:!0})],T.prototype,"inset",void 0);n([r({type:Boolean,reflect:!0,attribute:"inset-start"})],T.prototype,"insetStart",void 0);n([r({type:Boolean,reflect:!0,attribute:"inset-end"})],T.prototype,"insetEnd",void 0);var B=k`:host{box-sizing:border-box;color:var(--md-divider-color, var(--md-sys-color-outline-variant, #cac4d0));display:flex;height:var(--md-divider-thickness, 1px);width:100%}:host([inset]),:host([inset-start]){padding-inline-start:16px}:host([inset]),:host([inset-end]){padding-inline-end:16px}:host::before{background:currentColor;content:"";height:100%;width:100%}@media(forced-colors: active){:host::before{background:CanvasText}}
|
|
2
|
+
`,_=class extends T{};_.styles=[B];_=n([w("md-divider")],_);var p=class extends S{get activeTab(){return this.tabs.find(t=>t.active)??null}set activeTab(t){t&&this.activateTab(t)}get activeTabIndex(){return this.tabs.findIndex(t=>t.active)}set activeTabIndex(t){const e=()=>{const s=this.tabs[t];s&&this.activateTab(s)};if(!this.slotElement){this.updateComplete.then(e);return}e()}get focusedTab(){return this.tabs.find(t=>t.matches(":focus-within"))}constructor(){super(),this.autoActivate=!1,this.internals=this.attachInternals(),this.internals.role="tablist",this.addEventListener("keydown",this.handleKeydown.bind(this)),this.addEventListener("keyup",this.handleKeyup.bind(this)),this.addEventListener("focusout",this.handleFocusout.bind(this))}async scrollToTab(t){await this.updateComplete;const{tabs:e}=this;if(t??(t=this.activeTab),!t||!e.includes(t)||!this.tabsScrollerElement)return;for(const I of this.tabs)await I.updateComplete;const s=t.offsetLeft,i=t.offsetWidth,c=this.scrollLeft,o=this.offsetWidth,a=48,u=s-a,m=s+i-o+a,y=Math.min(u,Math.max(m,c)),g=this.focusedTab?"auto":"instant";this.tabsScrollerElement.scrollTo({behavior:g,top:0,left:y})}render(){return M`
|
|
3
|
+
<div class="tabs">
|
|
4
|
+
<slot
|
|
5
|
+
@slotchange=${this.handleSlotChange}
|
|
6
|
+
@click=${this.handleTabClick}></slot>
|
|
7
|
+
</div>
|
|
8
|
+
<md-divider part="divider"></md-divider>
|
|
9
|
+
`}async handleTabClick(t){const e=t.target;await 0,!(t.defaultPrevented||!D(e)||e.active)&&this.activateTab(e)}activateTab(t){const{tabs:e}=this,s=this.activeTab;if(!(!e.includes(t)||s===t)){for(const i of e)i.active=i===t;if(s){if(!this.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))){for(const i of e)i.active=i===s;return}t[A](s)}this.updateFocusableTab(t),this.scrollToTab(t)}}updateFocusableTab(t){for(const e of this.tabs)e.tabIndex=e===t?0:-1}async handleKeydown(t){await 0;const e=t.key==="ArrowLeft",s=t.key==="ArrowRight",i=t.key==="Home",c=t.key==="End";if(t.defaultPrevented||!e&&!s&&!i&&!c)return;const{tabs:o}=this;if(o.length<2)return;t.preventDefault();let a;if(i||c)a=i?0:o.length-1;else{const m=getComputedStyle(this).direction==="rtl"?e:s,{focusedTab:y}=this;if(!y)a=m?0:o.length-1;else{const g=this.tabs.indexOf(y);a=m?g+1:g-1,a>=o.length?a=0:a<0&&(a=o.length-1)}}const u=o[a];u.focus(),this.autoActivate?this.activateTab(u):this.updateFocusableTab(u)}handleKeyup(){this.scrollToTab(this.focusedTab??this.activeTab)}handleFocusout(){if(this.matches(":focus-within"))return;const{activeTab:t}=this;t&&this.updateFocusableTab(t)}handleSlotChange(){const t=this.tabs[0];!this.activeTab&&t&&this.activateTab(t),this.scrollToTab(this.activeTab)}};n([L({flatten:!0,selector:"[md-tab]"})],p.prototype,"tabs",void 0);n([r({type:Number,attribute:"active-tab-index"})],p.prototype,"activeTabIndex",null);n([r({type:Boolean,attribute:"auto-activate"})],p.prototype,"autoActivate",void 0);n([C(".tabs")],p.prototype,"tabsScrollerElement",void 0);n([C("slot")],p.prototype,"slotElement",void 0);function D(t){return t instanceof HTMLElement&&t.hasAttribute("md-tab")}var F=k`:host{box-sizing:border-box;display:flex;flex-direction:column;overflow:auto;scroll-behavior:smooth;scrollbar-width:none;position:relative}:host([hidden]){display:none}:host::-webkit-scrollbar{display:none}.tabs{align-items:end;display:flex;height:100%;overflow:inherit;scroll-behavior:inherit;scrollbar-width:inherit;justify-content:space-between;width:100%}::slotted(*){flex:1}::slotted([active]){z-index:1}
|
|
10
|
+
`,v=class extends p{};v.styles=[F];v=n([w("md-tabs")],v);var l,x,d=(l=new WeakSet,x=class extends v{constructor(...e){super(...e),P(this,l),this.ariaLabel="",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._isDispatching=!1,this._onChange=s=>{if(!s.composed&&!this._isDispatching){s.stopPropagation(),this._isDispatching=!0;const i=s.target.activeTabIndex;this.dispatchEvent(new CustomEvent("change",{detail:{activeTabIndex:i},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("tabschange",{detail:{activeTabIndex:i},bubbles:!0,composed:!0})),this._isDispatching=!1}}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","tablist")}firstUpdated(e){super.firstUpdated(e),this.addEventListener("change",this._onChange),h(l,this,E).call(this)}updated(e){super.updated(e),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&h(l,this,E).call(this)}},x.styles=[...v.styles,k`
|
|
2
11
|
:host {
|
|
3
12
|
/*Containerfärg */
|
|
4
13
|
--md-primary-tab-container-color: var(--md-sys-color-surface);
|
|
@@ -25,4 +34,4 @@ import{l as g}from"../../vendor/vendor-material.js";import{b as y,g as v,h as c}
|
|
|
25
34
|
margin-inline-start: var(--scb-tabs-spacing-inline-start, 0);
|
|
26
35
|
margin-inline-end: var(--scb-tabs-spacing-inline-end, 0);
|
|
27
36
|
}
|
|
28
|
-
`],
|
|
37
|
+
`],x);function E(){const t=h(l,this,f).call(this,this.spacing),e=h(l,this,f).call(this,this.spacingTop)??t,s=h(l,this,f).call(this,this.spacingBottom)??t,i=h(l,this,f).call(this,this.spacingLeft),c=h(l,this,f).call(this,this.spacingRight);e?this.style.setProperty("--scb-tabs-spacing-block-start",e):this.style.removeProperty("--scb-tabs-spacing-block-start"),s?this.style.setProperty("--scb-tabs-spacing-block-end",s):this.style.removeProperty("--scb-tabs-spacing-block-end"),i?this.style.setProperty("--scb-tabs-spacing-inline-start",i):this.style.removeProperty("--scb-tabs-spacing-inline-start"),c?this.style.setProperty("--scb-tabs-spacing-inline-end",c):this.style.removeProperty("--scb-tabs-spacing-inline-end")}function f(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}b([r({type:String,reflect:!0,attribute:"aria-label"})],d.prototype,"ariaLabel",void 0);b([r({type:String,reflect:!0})],d.prototype,"spacing",void 0);b([r({type:String,attribute:"spacing-top",reflect:!0})],d.prototype,"spacingTop",void 0);b([r({type:String,attribute:"spacing-bottom",reflect:!0})],d.prototype,"spacingBottom",void 0);b([r({type:String,attribute:"spacing-left",reflect:!0})],d.prototype,"spacingLeft",void 0);b([r({type:String,attribute:"spacing-right",reflect:!0})],d.prototype,"spacingRight",void 0);d=b([w("scb-tabs")],d);
|