scb-wc 0.1.48 → 0.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -41
- package/all.js +2 -0
- package/icons.json +178 -178
- package/index.js +90 -88
- package/mvc/components/all.js +2 -0
- package/mvc/components/scb-accordion/scb-accordion-item.js +1 -1
- package/mvc/{vendor → components/scb-chevron}/scb-chevron.js +1 -1
- package/mvc/components/scb-datepicker/scb-datepicker.js +296 -0
- package/mvc/components/scb-dropdown/scb-dropdown.js +1 -1
- package/mvc/components/scb-header/scb-header.js +12 -2
- package/mvc/components/scb-menu/scb-menu-item.js +1 -1
- package/mvc/components/scb-select/scb-select.js +1 -1
- package/mvc/components/scb-textfield/scb-textfield.js +24 -319
- package/mvc/components/scb-toc/scb-toc-item.js +1 -1
- package/mvc/scb-logo.svg +20 -20
- package/mvc/scb.svg +13 -13
- package/package.json +2 -2
- package/scb-chevron/scb-chevron.js +1 -0
- package/scb-components/index.d.ts +94 -0
- package/scb-components/scb-chevron/scb-chevron.d.ts +11 -0
- package/scb-components/scb-datepicker/scb-datepicker.d.ts +39 -0
- package/scb-datepicker/scb-datepicker.js +1 -0
- package/scb-header/scb-header.js +11 -1
- package/scb-wc.bundle.js +838 -828
- package/scb-wc.d.ts +188 -184
- package/scb-wc-public-entry/index.d.ts +0 -92
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../scb-drawer/scb-drawer.js","../../vendor/decorate.js","../../vendor/vendor.js","../../vendor/vendor-lit.js","../scb-divider/scb-divider.js","../../vendor/assertClassBrand.js","../scb-menu/scb-menu.js","../scb-menu/scb-menu-item.js","../../vendor/preload-helper.js","
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../scb-drawer/scb-drawer.js","../../vendor/decorate.js","../../vendor/vendor.js","../../vendor/vendor-lit.js","../scb-divider/scb-divider.js","../../vendor/assertClassBrand.js","../scb-menu/scb-menu.js","../scb-menu/scb-menu-item.js","../../vendor/preload-helper.js","../scb-chevron/scb-chevron.js","../scb-menu/scb-menu-section.js","../scb-menu/scb-sub-menu.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import"../../vendor/vendor-material.js";import{_ as M,b as E,g as P,h as c,m as x,v as f,y as m}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as n}from"../../vendor/decorate.js";import"../scb-button/scb-button.js";import{t as $}from"../../vendor/preload-helper.js";import"../scb-search/scb-search.js";import"../scb-link/scb-link.js";import"../scb-dropdown/scb-dropdown.js";import"../scb-grid/scb-grid-item.js";import"../scb-grid/scb-grid.js";import"../scb-skeleton/scb-skeleton.js";(function(){try{var b=typeof globalThis<"u"?globalThis:window;if(!b.__scb_ce_guard_installed__){b.__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(a){var i=String(a||"");if(i.indexOf("already been used")===-1&&i.indexOf("NotSupportedError")===-1)throw a}}}}catch{}})();var S,C,I=0,N=()=>{if(typeof window>"u"||typeof document>"u"||!("customElements"in window)||document.head.querySelector("style[data-scb-header-pre-upgrade]"))return;const b=document.createElement("style");b.setAttribute("data-scb-header-pre-upgrade",""),b.textContent=`
|
|
3
3
|
scb-header:not(:defined),
|
|
4
4
|
scb-header[data-upgrading] {
|
|
@@ -208,9 +208,9 @@ import"../../vendor/vendor-material.js";import{_ as M,b as E,g as P,h as c,m as
|
|
|
208
208
|
|
|
209
209
|
${g?this._renderMenuButton("menu-trigger--tabs-right"):f}
|
|
210
210
|
</div>
|
|
211
|
-
<div class="divider" role="presentation"></div>
|
|
212
211
|
</scb-grid-item>
|
|
213
212
|
</scb-grid>
|
|
213
|
+
<div class="divider" role="presentation"></div>
|
|
214
214
|
</div>
|
|
215
215
|
|
|
216
216
|
${p?m`
|
|
@@ -397,6 +397,16 @@ import"../../vendor/vendor-material.js";import{_ as M,b as E,g as P,h as c,m as
|
|
|
397
397
|
);
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
+
.header-landmark > scb-grid {
|
|
401
|
+
padding-inline: 20px;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
@media (min-width: 840px) {
|
|
405
|
+
.header-landmark > scb-grid {
|
|
406
|
+
padding-inline: 32px;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
400
410
|
.top-row {
|
|
401
411
|
display: flex;
|
|
402
412
|
align-items: center;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/vendor-material.js","../../vendor/vendor.js","../../vendor/vendor-lit.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as g,b as _,g as f,h as r,m as v,v as u,y as l}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as s}from"../../vendor/decorate.js";import"
|
|
2
|
+
import{_ as g,b as _,g as f,h as r,m as v,v as u,y as l}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as s}from"../../vendor/decorate.js";import"../scb-chevron/scb-chevron.js";import{t as h}from"../../vendor/preload-helper.js";(function(){try{var a=typeof globalThis<"u"?globalThis:window;if(!a.__scb_ce_guard_installed__){a.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,n,d){try{customElements.get(t)||e(t,n,d)}catch(p){var m=String(p||"");if(m.indexOf("already been used")===-1&&m.indexOf("NotSupportedError")===-1)throw p}}}}catch{}})();var c,o,b={fromAttribute:a=>a==null?!1:!/^(false|0|off|no)$/i.test(a),toAttribute:a=>a?"":null},i=(c=class extends g{constructor(...e){super(...e),this.label="",this.selected=!1,this.noHighlightSelected=!1,this.leadingIcon="",this.itemHref="",this.hasChildren=!1,this.loading=!1,this.hasSlotContent=!1,this.expanded=!1,this.__submenuId=`sub-${Math.random().toString(36).slice(2)}`,this.__focusId=`f-${Math.random().toString(36).slice(2)}`,this._toggleExpand=t=>{t&&t.stopPropagation(),this.__isExpandable&&this.__setExpanded(!this.expanded)},this._onButtonClick=t=>{t.stopPropagation(),this._dispatchSelect(),this._toggleExpand()},this._onLinkClick=()=>{this._dispatchSelect()},this._onKeyDown=t=>{const n=Array.from(this.closest("scb-sub-menu, scb-menu")?.querySelectorAll("scb-menu-item")||[]),d=n.indexOf(this);switch(t.key){case"ArrowDown":t.preventDefault(),(n[d+1]||n[0]).shadowRoot?.querySelector(".scb-menu-label-text")?.focus();break;case"ArrowUp":t.preventDefault(),(n[d-1]||n[n.length-1]).shadowRoot?.querySelector(".scb-menu-label-text")?.focus();break;case"Home":t.preventDefault(),n[0].shadowRoot?.querySelector(".scb-menu-label-text")?.focus();break;case"End":t.preventDefault(),n[n.length-1].shadowRoot?.querySelector(".scb-menu-label-text")?.focus();break}}}get __submenuEl(){return this.renderRoot.querySelector(`#${this.__submenuId}`)}get __isExpandable(){return this.hasSlotContent||this.hasChildren}async __ensureDepsLoaded(){o.__rippleLoaded||(await h(()=>import("../../vendor/vendor-material.js").then(e=>e.f),__vite__mapDeps([0,1,2]),import.meta.url),o.__rippleLoaded=!0),o.__focusRingLoaded||(await h(()=>import("../../vendor/vendor-material.js").then(e=>e.m),__vite__mapDeps([0,1,2]),import.meta.url),o.__focusRingLoaded=!0),this.leadingIcon&&!o.__iconLoaded&&(await h(()=>import("../../vendor/vendor-material.js").then(e=>e.p),__vite__mapDeps([0,1,2]),import.meta.url),o.__iconLoaded=!0)}__syncHasSlotContentFromLightDom(){const e=Array.from(this.children);this.hasSlotContent=e.some(t=>t.tagName==="SCB-SUB-MENU")}connectedCallback(){super.connectedCallback(),this.__syncHasSlotContentFromLightDom()}_onSlotChange(e){const t=e.target.assignedElements({flatten:!0});this.hasSlotContent=t.some(n=>n.tagName==="SCB-SUB-MENU")}__setExpanded(e){if(!this.__isExpandable)return;this.expanded=e;const t={item:this,expanded:e,hasChildren:this.hasChildren,hasSlotContent:this.hasSlotContent,loading:this.loading,lazy:this.hasChildren&&!this.hasSlotContent};this.dispatchEvent(new CustomEvent("scb-menu-expand",{bubbles:!0,composed:!0,detail:t})),this.dispatchEvent(new CustomEvent("scbmenuexpand",{bubbles:!0,composed:!0,detail:t}))}_dispatchSelect(){this.dispatchEvent(new CustomEvent("scb-menu-select",{bubbles:!0,composed:!0,detail:{item:this}})),this.dispatchEvent(new CustomEvent("scbmenuselect",{bubbles:!0,composed:!0,detail:{item:this}}))}async firstUpdated(){await this.__ensureDepsLoaded(),this.__applyInert()}updated(e){e.has("leadingIcon")&&this.leadingIcon&&this.__ensureDepsLoaded(),(e.has("hasSlotContent")&&this.hasSlotContent||e.has("hasChildren")&&this.hasChildren||e.has("loading")&&this.loading)&&this.__ensureDepsLoaded(),(e.has("expanded")||e.has("hasChildren")||e.has("loading"))&&this.__applyInert()}__applyInert(){const e=this.__submenuEl;e&&(this.loading?e.setAttribute("aria-busy","true"):e.removeAttribute("aria-busy"),this.expanded?(e.removeAttribute("inert"),e.setAttribute("aria-hidden","false")):(e.setAttribute("inert",""),e.setAttribute("aria-hidden","true")))}render(){const e=!!this.leadingIcon,t=!!this.itemHref,n=this.__isExpandable;return l`
|
|
3
3
|
<div class="scb-menu-item">
|
|
4
4
|
<div class="scb-menu-item-label" ?selected=${this.selected} ?no-highlight-selected=${this.noHighlightSelected}>
|
|
5
5
|
${t?l`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../vendor/vendor-material.js";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{t as l}from"../../vendor/decorate.js";import"
|
|
1
|
+
import"../../vendor/vendor-material.js";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{t as l}from"../../vendor/decorate.js";import"../scb-chevron/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"}"
|