scb-wc 0.1.136 → 0.1.138
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/mvc/components/scb-button/scb-button.js +3 -3
- package/mvc/components/scb-collapse/scb-collapse.js +54 -46
- package/mvc/components/scb-header/scb-header.js +19 -17
- package/mvc/components/scb-search/scb-search.js +3 -3
- package/mvc/components/scb-select/scb-select.js +2 -2
- package/package.json +2 -2
- package/scb-button/scb-button.js +10 -2
- package/scb-collapse/scb-collapse.js +157 -53
- package/scb-components/scb-button/scb-button.d.ts +2 -2
- package/scb-components/scb-collapse/scb-collapse.d.ts +9 -0
- package/scb-components/scb-search/scb-search.d.ts +1 -1
- package/scb-header/scb-header.js +29 -11
- package/scb-search/scb-search.js +20 -7
- package/scb-select/scb-select.js +3 -2
- package/scb-wc.bundle.js +1014 -910
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as h,f as b,h as v,m as y,p as l,v as d,y as f}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import{ensureFocusRingOnFocusVisible as _}from"../shared/lazy-focus-ring.js";import{t as n}from"../../vendor/decorate.js";import"../scb-chevron/scb-chevron.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-tooltip/scb-tooltip.js";(function(){try{var g=typeof globalThis<"u"?globalThis:window;if(!g.__scb_ce_guard_installed__){g.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,s,i){try{customElements.get(t)||e(t,s,i)}catch(r){var o=String(r||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw r}}}}catch{}})();var u,a=(u=class extends v{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.error=!1,this.open=!1,this.label="",this.name="",this.placeholder="",this.supportingText="",this.errorText="",this.helpText="",this.helpLabel="Visa hjälptext",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._validationMessage="",this._hasValidationBeenReported=!1,this._selectId=`scb-select-${Math.random().toString(36).slice(2,11)}`,this._placementFrame=0,this._optionsPlacement="below",this._activeDescendant="",this._onDocumentClick=e=>{this.open&&(e.composedPath().includes(this)||(this._setOpen(!1),requestAnimationFrame(()=>{this.open||this._focusTrigger()})))},this._scheduleOptionsPlacement=()=>{!this.open||!this.isConnected||(this._placementFrame&&cancelAnimationFrame(this._placementFrame),this._placementFrame=requestAnimationFrame(()=>{this._placementFrame=0,this._updateOptionsPlacement()}))},this._onSlotClick=e=>{const t=this._getOptions(),s=e.composedPath(),i=t.find(o=>s.includes(o));i&&(this._selectOption(i),e.stopPropagation())},this._onKeyDown=e=>{if(e.key==="Escape"&&this.open){e.preventDefault(),e.stopPropagation(),this._setOpen(!1),this._focusTrigger();return}if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault(),e.stopPropagation();const t=e.key==="ArrowDown"?1:-1;if(!this.open){this._setOpen(!0),this.updateComplete.then(()=>{this._setFocusedIndex(this._getInitialFocusedIndex()),this.focusedIndex>=0&&e.key==="ArrowUp"&&this._moveFocusedIndex(-1)});return}this._moveFocusedIndex(t);return}if((e.key==="Home"||e.key==="End")&&this.open){e.preventDefault(),e.stopPropagation();const t=this._getOptions();let s=t.findIndex(i=>!i.disabled);if(e.key==="End"){for(let i=t.length-1;i>=0;i-=1)if(!t[i]?.disabled){s=i;break}}this._setFocusedIndex(s);return}if(e.key==="Enter"||e.key===" "){if(e.preventDefault(),this.open){const t=this._getFocusedOption();t&&this._selectOption(t);return}this._setOpen(!0)}},this._onOptionKeyDown=e=>{if(e.key==="Escape"&&this.open){e.preventDefault(),e.stopPropagation(),this._setOpen(!1),this._focusTrigger();return}if(e.key==="Enter"||e.key===" "){e.preventDefault();const t=this._getOptions(),s=e.composedPath(),i=t.find(o=>s.includes(o));i&&this._selectOption(i)}},"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),document.addEventListener("scroll",this._scheduleOptionsPlacement,!0),window.addEventListener("resize",this._scheduleOptionsPlacement),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.error=!1,this._hasValidationBeenReported=!1,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),document.removeEventListener("scroll",this._scheduleOptionsPlacement,!0),window.removeEventListener("resize",this._scheduleOptionsPlacement),this._placementFrame&&(cancelAnimationFrame(this._placementFrame),this._placementFrame=0),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,i=this._mapSpacingToken(this.spacingLeft),o=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"),i?this.style.setProperty("--scb-select-spacing-inline-start",i):this.style.removeProperty("--scb-select-spacing-inline-start"),o?this.style.setProperty("--scb-select-spacing-inline-end",o):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)}_focusTrigger(){this.shadowRoot?.querySelector(".selected-value-container")?.focus()}_getOptions(){const e=this.shadowRoot?.querySelector("slot");return e?e.assignedElements({flatten:!0}).filter(t=>t.tagName.toLowerCase()==="scb-select-option"):[]}_ensureOptionIds(e=this._getOptions()){e.forEach((t,s)=>{t.id||(t.id=`${this._selectId}-option-${s}`)})}_getInitialFocusedIndex(){const e=this._getOptions(),t=this.variant==="multi-select"?this._getMultiValues():[this.value],s=e.findIndex(i=>!i.disabled&&t.includes(i.value));return s>=0?s:e.findIndex(i=>!i.disabled)}_setFocusedIndex(e){const t=this._getOptions();if(this._ensureOptionIds(t),t.forEach(o=>o.removeAttribute("data-focused")),e<0||t.length===0){this.focusedIndex=-1,this._activeDescendant="";return}let s=Math.max(0,Math.min(e,t.length-1));if(t[s]?.disabled){const o=t.findIndex((c,p)=>p>=s&&!c.disabled);let r=-1;for(let c=t.length-1;c>=0;c-=1)if(!t[c]?.disabled){r=c;break}s=o>=0?o:r}const i=t[s];if(!i||i.disabled){this.focusedIndex=-1,this._activeDescendant="";return}i.setAttribute("data-focused",""),this.focusedIndex=s,this._activeDescendant=i.id,i.scrollIntoView({block:"nearest"})}_moveFocusedIndex(e){const t=this._getOptions();if(t.length===0)return;let s=this.focusedIndex>=0?this.focusedIndex:this._getInitialFocusedIndex();for(let i=0;i<t.length;i+=1)if(s=(s+e+t.length)%t.length,!t[s]?.disabled){this._setFocusedIndex(s);return}}_getFocusedOption(){return this._getOptions()[this.focusedIndex]}_updateOptionsPlacement(){const e=this.shadowRoot?.querySelector(".selected-value-container");if(!e)return;const t=e.getBoundingClientRect(),s=8,i=3,o=240,r=window.innerHeight-t.bottom-i-s,c=t.top-i-s,p=r<160&&c>r,m=Math.max(96,Math.min(o,p?c:r));this._optionsPlacement=p?"above":"below",this.style.setProperty("--scb-select-options-max-height",`${m}px`)}_resetOptionsPlacement(){this._optionsPlacement="below",this.style.removeProperty("--scb-select-options-max-height")}_hasMoreThanFourOptions(){const e=this._getOptions();return["extra-small","small","medium"].includes(this.size)?e.length>5:e.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.updateComplete.then(()=>this._focusTrigger()));this._updateOptionsChecked(),this.requestUpdate()}}_getOptionLabel(e){return e.label||e.textContent?.trim()||""}_getSelectedLabel(){const e=this._getOptions();if(this.variant==="multi-select"){const t=this._getMultiValues(),s=e.filter(i=>t.includes(i.value));return s&&s.length>0?s.map(i=>this._getOptionLabel(i)).join(", "):""}else{const t=e.find(s=>s.value===this.value);return t?this._getOptionLabel(t):""}}firstUpdated(){this._updateOptionsChecked(),this._syncFormValue(),this._syncValidity(),this._applySpacing()}updated(e){this._updateOptionsChecked(),this._syncFormValue(),this._syncValidity(),e.has("size")&&this._syncDensityForSize(),e.has("errorText")&&this.error&&this._syncValidity(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&this._applySpacing(),e.has("open")&&(this.open?this.updateComplete.then(()=>{this._setFocusedIndex(this._getInitialFocusedIndex()),this._scheduleOptionsPlacement()}):(this._setFocusedIndex(-1),this._resetOptionsPlacement()))}_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)?this.errorText||"Välj ett alternativ.":""}_syncValidity(){const e=this.disabled?"":this._getValidationMessage(),t=this.shadowRoot?.querySelector(".selected-value"),s=this.error,i=this._validationMessage;if(this._validationMessage=e,this.error=this.disabled?!1:e?this._hasValidationBeenReported||s:s&&!this._hasValidationBeenReported&&!i,!e)this.removeAttribute("aria-invalid"),t&&t.setCustomValidity(""),this._internals&&this._internals.setValidity({});else if(t&&t.setCustomValidity(e),this._internals){const o=this._customValidationMessage?{customError:!0}:{valueMissing:!0};this._internals.setValidity(o,e,t??void 0)}this.toggleAttribute("aria-invalid",this.error),(s!==this.error||i!==this._validationMessage)&&this.requestUpdate()}checkValidity(){return this._syncValidity(),this._internals?this._internals.checkValidity():!this.error}reportValidity(){return this._hasValidationBeenReported=!0,this._syncValidity(),this._internals?this._internals.reportValidity():this.checkValidity()}setCustomValidity(e){this._customValidationMessage=String(e??""),this._syncValidity()}get form(){return this._internals?.form??this._form}get validity(){return this._internals?.validity}get validationMessage(){return this._internals?.validationMessage??this._getValidationMessage()}get willValidate(){return this._internals?.willValidate??!0}get labels(){return this._internals?.labels}_updateOptionsChecked(){const e=this._getOptions();this._ensureOptionIds(e),e.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)})}_renderLabel(){if(!this.label)return null;const e=!!this._getVisibleSupportingText(),t=`${this._selectId}-label`,s=d`
|
|
1
|
+
import{a as h,f as g,h as v,m as y,p as l,v as d,y as f}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import{ensureFocusRingOnFocusVisible as _}from"../shared/lazy-focus-ring.js";import{t as n}from"../../vendor/decorate.js";import"../scb-chevron/scb-chevron.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-tooltip/scb-tooltip.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,i){try{customElements.get(t)||e(t,s,i)}catch(r){var o=String(r||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw r}}}}catch{}})();var u,a=(u=class extends v{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.error=!1,this.open=!1,this.label="",this.name="",this.placeholder="",this.supportingText="",this.errorText="",this.helpText="",this.helpLabel="Visa hjälptext",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._validationMessage="",this._hasValidationBeenReported=!1,this._selectId=`scb-select-${Math.random().toString(36).slice(2,11)}`,this._placementFrame=0,this._optionsPlacement="below",this._activeDescendant="",this._onDocumentClick=e=>{this.open&&(e.composedPath().includes(this)||(this._setOpen(!1),requestAnimationFrame(()=>{this.open||this._focusTrigger()})))},this._scheduleOptionsPlacement=()=>{!this.open||!this.isConnected||(this._placementFrame&&cancelAnimationFrame(this._placementFrame),this._placementFrame=requestAnimationFrame(()=>{this._placementFrame=0,this._updateOptionsPlacement()}))},this._onSlotClick=e=>{const t=this._getOptions(),s=e.composedPath(),i=t.find(o=>s.includes(o));i&&(this._selectOption(i),e.stopPropagation())},this._onKeyDown=e=>{if(e.key==="Escape"&&this.open){e.preventDefault(),e.stopPropagation(),this._setOpen(!1),this._focusTrigger();return}if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault(),e.stopPropagation();const t=e.key==="ArrowDown"?1:-1;if(!this.open){this._setOpen(!0),this.updateComplete.then(()=>{this._setFocusedIndex(this._getInitialFocusedIndex()),this.focusedIndex>=0&&e.key==="ArrowUp"&&this._moveFocusedIndex(-1)});return}this._moveFocusedIndex(t);return}if((e.key==="Home"||e.key==="End")&&this.open){e.preventDefault(),e.stopPropagation();const t=this._getOptions();let s=t.findIndex(i=>!i.disabled);if(e.key==="End"){for(let i=t.length-1;i>=0;i-=1)if(!t[i]?.disabled){s=i;break}}this._setFocusedIndex(s);return}if(e.key==="Enter"||e.key===" "){if(e.preventDefault(),this.open){const t=this._getFocusedOption();t&&this._selectOption(t);return}this._setOpen(!0)}},this._onOptionKeyDown=e=>{if(e.key==="Escape"&&this.open){e.preventDefault(),e.stopPropagation(),this._setOpen(!1),this._focusTrigger();return}if(e.key==="Enter"||e.key===" "){e.preventDefault();const t=this._getOptions(),s=e.composedPath(),i=t.find(o=>s.includes(o));i&&this._selectOption(i)}},"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),document.addEventListener("scroll",this._scheduleOptionsPlacement,!0),window.addEventListener("resize",this._scheduleOptionsPlacement),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.error=!1,this._hasValidationBeenReported=!1,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),document.removeEventListener("scroll",this._scheduleOptionsPlacement,!0),window.removeEventListener("resize",this._scheduleOptionsPlacement),this._placementFrame&&(cancelAnimationFrame(this._placementFrame),this._placementFrame=0),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,i=this._mapSpacingToken(this.spacingLeft),o=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"),i?this.style.setProperty("--scb-select-spacing-inline-start",i):this.style.removeProperty("--scb-select-spacing-inline-start"),o?this.style.setProperty("--scb-select-spacing-inline-end",o):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)}_focusTrigger(){this.shadowRoot?.querySelector(".selected-value-container")?.focus()}_getOptions(){const e=this.shadowRoot?.querySelector("slot");return e?e.assignedElements({flatten:!0}).filter(t=>t.tagName.toLowerCase()==="scb-select-option"):[]}_ensureOptionIds(e=this._getOptions()){e.forEach((t,s)=>{t.id||(t.id=`${this._selectId}-option-${s}`)})}_getInitialFocusedIndex(){const e=this._getOptions(),t=this.variant==="multi-select"?this._getMultiValues():[this.value],s=e.findIndex(i=>!i.disabled&&t.includes(i.value));return s>=0?s:e.findIndex(i=>!i.disabled)}_setFocusedIndex(e){const t=this._getOptions();if(this._ensureOptionIds(t),t.forEach(o=>o.removeAttribute("data-focused")),e<0||t.length===0){this.focusedIndex=-1,this._activeDescendant="";return}let s=Math.max(0,Math.min(e,t.length-1));if(t[s]?.disabled){const o=t.findIndex((c,p)=>p>=s&&!c.disabled);let r=-1;for(let c=t.length-1;c>=0;c-=1)if(!t[c]?.disabled){r=c;break}s=o>=0?o:r}const i=t[s];if(!i||i.disabled){this.focusedIndex=-1,this._activeDescendant="";return}i.setAttribute("data-focused",""),this.focusedIndex=s,this._activeDescendant=i.id,i.scrollIntoView({block:"nearest"})}_moveFocusedIndex(e){const t=this._getOptions();if(t.length===0)return;let s=this.focusedIndex>=0?this.focusedIndex:this._getInitialFocusedIndex();for(let i=0;i<t.length;i+=1)if(s=(s+e+t.length)%t.length,!t[s]?.disabled){this._setFocusedIndex(s);return}}_getFocusedOption(){return this._getOptions()[this.focusedIndex]}_updateOptionsPlacement(){const e=this.shadowRoot?.querySelector(".selected-value-container");if(!e)return;const t=e.getBoundingClientRect(),s=8,i=3,o=240,r=window.innerHeight-t.bottom-i-s,c=t.top-i-s,p=r<160&&c>r,m=Math.max(96,Math.min(o,p?c:r));this._optionsPlacement=p?"above":"below",this.style.setProperty("--scb-select-options-max-height",`${m}px`)}_resetOptionsPlacement(){this._optionsPlacement="below",this.style.removeProperty("--scb-select-options-max-height")}_hasMoreThanFourOptions(){const e=this._getOptions();return["extra-small","small","medium"].includes(this.size)?e.length>5:e.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.updateComplete.then(()=>this._focusTrigger()));this._updateOptionsChecked(),this.requestUpdate()}}_getOptionLabel(e){return e.label||e.textContent?.trim()||""}_getSelectedLabel(){const e=this._getOptions();if(this.variant==="multi-select"){const t=this._getMultiValues(),s=e.filter(i=>t.includes(i.value));return s&&s.length>0?s.map(i=>this._getOptionLabel(i)).join(", "):""}else{const t=e.find(s=>s.value===this.value);return t?this._getOptionLabel(t):""}}firstUpdated(){this._updateOptionsChecked(),this._syncFormValue(),this._syncValidity(),this._applySpacing()}updated(e){this._updateOptionsChecked(),this._syncFormValue(),this._syncValidity(),e.has("size")&&this._syncDensityForSize(),e.has("errorText")&&this.error&&this._syncValidity(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&this._applySpacing(),e.has("open")&&(this.open?this.updateComplete.then(()=>{this._setFocusedIndex(this._getInitialFocusedIndex()),this._scheduleOptionsPlacement()}):(this._setFocusedIndex(-1),this._resetOptionsPlacement()))}_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)?this.errorText||"Välj ett alternativ.":""}_syncValidity(){const e=this.disabled?"":this._getValidationMessage(),t=this.shadowRoot?.querySelector(".selected-value"),s=this.error,i=this._validationMessage;if(this._validationMessage=e,this.error=this.disabled?!1:e?this._hasValidationBeenReported||s:s&&!this._hasValidationBeenReported&&!i,!e)this.removeAttribute("aria-invalid"),t&&t.setCustomValidity(""),this._internals&&this._internals.setValidity({});else if(t&&t.setCustomValidity(e),this._internals){const o=this._customValidationMessage?{customError:!0}:{valueMissing:!0};this._internals.setValidity(o,e,t??void 0)}this.toggleAttribute("aria-invalid",this.error),(s!==this.error||i!==this._validationMessage)&&this.requestUpdate()}checkValidity(){return this._syncValidity(),this._internals?this._internals.checkValidity():!this.error}reportValidity(){return this._hasValidationBeenReported=!0,this._syncValidity(),this._internals?this._internals.reportValidity():this.checkValidity()}setCustomValidity(e){this._customValidationMessage=String(e??""),this._syncValidity()}get form(){return this._internals?.form??this._form}get validity(){return this._internals?.validity}get validationMessage(){return this._internals?.validationMessage??this._getValidationMessage()}get willValidate(){return this._internals?.willValidate??!0}get labels(){return this._internals?.labels}_updateOptionsChecked(){const e=this._getOptions();this._ensureOptionIds(e),e.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)})}_renderLabel(){if(!this.label)return null;const e=!!this._getVisibleSupportingText(),t=`${this._selectId}-label`,s=d`
|
|
2
2
|
<label
|
|
3
3
|
class="select-label ${!e&&!this.helpText?"select-label--without-supporting":""}"
|
|
4
4
|
id=${t}
|
|
@@ -81,4 +81,4 @@ import{a as h,f as b,h as v,m as y,p as l,v as d,y as f}from"../../vendor/vendor
|
|
|
81
81
|
<slot @slotchange="${()=>{this.requestUpdate(),this._scheduleOptionsPlacement()}}"></slot>
|
|
82
82
|
</div>
|
|
83
83
|
</div>
|
|
84
|
-
`}},u.formAssociated=!0,u.styles=f`:host{display:flex;flex-direction:column;color:var(--md-sys-color-on-surface);font-family:var(--brand-font);--scb-select-max-width:400px;--scb-select-padding-x:var(--spacing-5);--scb-select-padding-y:var(--spacing-2);--scb-select-min-height:56px;--scb-select-font-size:var(--md-sys-typescale-body-large-size);--scb-select-line-height:var(--md-sys-typescale-body-large-line-height);--scb-select-letter-spacing:var(--md-sys-typescale-body-large-tracking);--scb-select-label-font-size:var(--md-sys-typescale-label-medium-size);--scb-select-label-line-height:var(--md-sys-typescale-label-medium-line-height);--scb-select-label-letter-spacing:var(--md-sys-typescale-label-medium-tracking);--scb-select-supporting-font-size:var(--md-sys-typescale-body-medium-size);--scb-select-supporting-line-height:var(--md-sys-typescale-body-medium-line-height);--scb-select-supporting-letter-spacing:var(--md-sys-typescale-body-medium-tracking);--scb-select-label-gap:var(--spacing-3);max-width:var(--scb-select-max-width);width:100%;margin-block-start:var(--scb-select-spacing-block-start, 0);margin-block-end:var(--scb-select-spacing-block-end, 0);margin-inline-start:var(--scb-select-spacing-inline-start, 0);margin-inline-end:var(--scb-select-spacing-inline-end, 0)}:host([disabled]){pointer-events:none;opacity:.38}:host([size='extra-small']),:host([size='medium']),:host([size='small']){--scb-select-label-font-size:var(--md-sys-typescale-label-small-size);--scb-select-label-line-height:var(--md-sys-typescale-label-small-line-height);--scb-select-label-letter-spacing:var(--md-sys-typescale-label-small-tracking);--scb-select-supporting-font-size:var(--md-sys-typescale-body-small-size);--scb-select-supporting-line-height:var(--md-sys-typescale-body-small-line-height);--scb-select-supporting-letter-spacing:var(--md-sys-typescale-body-small-tracking);--scb-select-option-padding-y:var(--spacing-2)}:host([size='medium']){--scb-select-padding-x:var(--spacing-4);--scb-select-padding-y:var(--spacing-3);--scb-select-min-height:48px;--scb-select-font-size:var(--md-sys-typescale-body-medium-size);--scb-select-line-height:var(--md-sys-typescale-body-medium-line-height);--scb-select-letter-spacing:var(--md-sys-typescale-body-medium-tracking);--scb-select-option-padding-x:var(--spacing-4);--scb-select-option-gap:var(--spacing-3);--scb-select-option-min-height:40px;--scb-select-option-font-size:var(--md-sys-typescale-body-medium-size);--scb-select-option-line-height:var(--md-sys-typescale-body-medium-line-height);--scb-select-option-letter-spacing:var(--md-sys-typescale-body-medium-tracking);--scb-select-option-icon-size:var(--icon-size-small, 20px)}:host([size='extra-small']),:host([size='small']){--scb-select-font-size:var(--md-sys-typescale-body-small-size);--scb-select-line-height:var(--md-sys-typescale-body-small-line-height);--scb-select-letter-spacing:var(--md-sys-typescale-body-small-tracking);--scb-select-option-font-size:var(--md-sys-typescale-body-small-size);--scb-select-option-line-height:var(--md-sys-typescale-body-small-line-height);--scb-select-option-letter-spacing:var(--md-sys-typescale-body-small-tracking)}:host([size='small']){--scb-select-padding-x:var(--spacing-4);--scb-select-padding-y:var(--spacing-3);--scb-select-min-height:40px;--scb-select-option-padding-x:var(--spacing-4);--scb-select-option-gap:var(--spacing-3);--scb-select-option-min-height:40px;--scb-select-option-icon-size:var(--icon-size-small, 20px)}:host([size='extra-small']){--scb-select-padding-x:var(--spacing-3);--scb-select-padding-y:var(--spacing-2);--scb-select-min-height:32px;--scb-select-option-padding-x:var(--spacing-3);--scb-select-option-gap:var(--spacing-2);--scb-select-option-min-height:32px;--scb-select-option-icon-size:var(--icon-size-extra-small, 16px)}.select{position:relative;background:var(--md-sys-color-surface);cursor:pointer;border-radius:var(--md-sys-shape-corner-small);border:
|
|
84
|
+
`}},u.formAssociated=!0,u.styles=f`:host{display:flex;flex-direction:column;color:var(--md-sys-color-on-surface);font-family:var(--brand-font);--scb-select-max-width:400px;--scb-select-padding-x:var(--spacing-5);--scb-select-padding-y:var(--spacing-2);--scb-select-border-width:var(--stroke-border, 1px);--scb-select-min-height:56px;--scb-select-font-size:var(--md-sys-typescale-body-large-size);--scb-select-line-height:var(--md-sys-typescale-body-large-line-height);--scb-select-letter-spacing:var(--md-sys-typescale-body-large-tracking);--scb-select-label-font-size:var(--md-sys-typescale-label-medium-size);--scb-select-label-line-height:var(--md-sys-typescale-label-medium-line-height);--scb-select-label-letter-spacing:var(--md-sys-typescale-label-medium-tracking);--scb-select-supporting-font-size:var(--md-sys-typescale-body-medium-size);--scb-select-supporting-line-height:var(--md-sys-typescale-body-medium-line-height);--scb-select-supporting-letter-spacing:var(--md-sys-typescale-body-medium-tracking);--scb-select-label-gap:var(--spacing-3);max-width:var(--scb-select-max-width);width:100%;margin-block-start:var(--scb-select-spacing-block-start, 0);margin-block-end:var(--scb-select-spacing-block-end, 0);margin-inline-start:var(--scb-select-spacing-inline-start, 0);margin-inline-end:var(--scb-select-spacing-inline-end, 0)}:host([disabled]){pointer-events:none;opacity:.38}:host([size='extra-small']),:host([size='medium']),:host([size='small']){--scb-select-label-font-size:var(--md-sys-typescale-label-small-size);--scb-select-label-line-height:var(--md-sys-typescale-label-small-line-height);--scb-select-label-letter-spacing:var(--md-sys-typescale-label-small-tracking);--scb-select-supporting-font-size:var(--md-sys-typescale-body-small-size);--scb-select-supporting-line-height:var(--md-sys-typescale-body-small-line-height);--scb-select-supporting-letter-spacing:var(--md-sys-typescale-body-small-tracking);--scb-select-option-padding-y:var(--spacing-2)}:host([size='medium']){--scb-select-padding-x:var(--spacing-4);--scb-select-padding-y:var(--spacing-3);--scb-select-min-height:48px;--scb-select-font-size:var(--md-sys-typescale-body-medium-size);--scb-select-line-height:var(--md-sys-typescale-body-medium-line-height);--scb-select-letter-spacing:var(--md-sys-typescale-body-medium-tracking);--scb-select-option-padding-x:var(--spacing-4);--scb-select-option-gap:var(--spacing-3);--scb-select-option-min-height:40px;--scb-select-option-font-size:var(--md-sys-typescale-body-medium-size);--scb-select-option-line-height:var(--md-sys-typescale-body-medium-line-height);--scb-select-option-letter-spacing:var(--md-sys-typescale-body-medium-tracking);--scb-select-option-icon-size:var(--icon-size-small, 20px)}:host([size='extra-small']),:host([size='small']){--scb-select-font-size:var(--md-sys-typescale-body-small-size);--scb-select-line-height:var(--md-sys-typescale-body-small-line-height);--scb-select-letter-spacing:var(--md-sys-typescale-body-small-tracking);--scb-select-option-font-size:var(--md-sys-typescale-body-small-size);--scb-select-option-line-height:var(--md-sys-typescale-body-small-line-height);--scb-select-option-letter-spacing:var(--md-sys-typescale-body-small-tracking)}:host([size='small']){--scb-select-padding-x:var(--spacing-4);--scb-select-padding-y:var(--spacing-3);--scb-select-min-height:40px;--scb-select-option-padding-x:var(--spacing-4);--scb-select-option-gap:var(--spacing-3);--scb-select-option-min-height:40px;--scb-select-option-icon-size:var(--icon-size-small, 20px)}:host([size='extra-small']){--scb-select-padding-x:var(--spacing-3);--scb-select-padding-y:var(--spacing-2);--scb-select-min-height:32px;--scb-select-option-padding-x:var(--spacing-3);--scb-select-option-gap:var(--spacing-2);--scb-select-option-min-height:32px;--scb-select-option-icon-size:var(--icon-size-extra-small, 16px)}.select{position:relative;background:var(--md-sys-color-surface);cursor:pointer;border-radius:var(--md-sys-shape-corner-small);border:var(--scb-select-border-width) solid var(--md-sys-color-outline);outline:1px solid transparent;transition:border .2s}:host .select:hover,:host([open]) .select{outline:1px solid var(--md-sys-color-outline)}:host([error]) .select{border-color:var(--md-sys-color-error)}:host([error]) .select:hover,:host([error][open]) .select{outline-color:var(--md-sys-color-error)}.selected-value{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;border:0;background:0 0;font:inherit;color:inherit;padding:0;outline:0;cursor:pointer;font-size:var(--scb-select-font-size);line-height:var(--scb-select-line-height);letter-spacing:var(--scb-select-letter-spacing)}.selected-value-container:focus-within{outline:0}.select-label{display:block;font-size:var(--scb-select-label-font-size);font-weight:var(--weight-semibold);line-height:var(--scb-select-label-line-height);letter-spacing:var(--scb-select-label-letter-spacing)}.select-label-row{display:flex;align-items:center;gap:var(--spacing-1, 2px)}.select-label-row--without-supporting{margin-bottom:var(--scb-select-label-gap)}.select-help-tooltip{display:inline-flex;align-items:center;flex:0 0 auto;line-height:0}.select-help-button{--scb-icon-button-container-size:var(--scale-06, 24px);--scb-icon-button-icon-size:var(--icon-size-extra-small, 16px)}.select-label--without-supporting,.select-sub-label{margin-bottom:var(--scb-select-label-gap)}.select-sub-label{display:block;font-size:var(--scb-select-supporting-font-size);line-height:var(--scb-select-supporting-line-height);letter-spacing:var(--scb-select-supporting-letter-spacing);font-weight:var(--weight-regular);color:var(--md-sys-color-on-surface-variant)}:host([error]) .select-sub-label{color:var(--md-sys-color-error)}md-focus-ring{position:absolute;border-radius:8px}.arrow,.options{position:absolute;pointer-events:none}.arrow{right:8px;top:50%;transform:translateY(-50%);display:flex;align-items:center;justify-content:center}.options{left:0;right:0;top:calc(100% + 3px);z-index:10;max-height:0;overflow-y:hidden;transition:max-height .3s cubic-bezier(.4,0,.2,1),opacity .15s linear .15s,visibility 0s linear .3s;visibility:hidden;opacity:0;border-radius:var(--md-sys-shape-corner-small);background:var(--md-sys-color-surface);padding:8px 0;box-shadow:0 1px 2px 0 rgba(0,0,0,.3),0 2px 6px 2px rgba(0,0,0,.15)}.options.options--above{top:auto;bottom:calc(100% + 3px)}.options::-webkit-scrollbar{width:12px;background:var(--md-sys-color-surface);border-radius:var(--md-sys-shape-corner-small)}.options::-webkit-scrollbar-thumb{background:var(--md-sys-color-outline);border-radius:var(--md-sys-shape-corner-small);border:4px solid var(--md-sys-color-surface)}.options::-webkit-scrollbar-track{background:var(--md-sys-color-surface);border-radius:var(--md-sys-shape-corner-small)}:host([open]) .options{max-height:var(--scb-select-options-max-height, 240px);visibility:visible;pointer-events:auto;transition:max-height .3s cubic-bezier(.4,0,.2,1),opacity 0s linear 0s,visibility 0s linear 0s;opacity:1}.options.options--scroll{overflow-y:auto}.option[aria-selected=true]{background:#e6f0fa}.option[aria-disabled=true]{color:#aaa;pointer-events:none}.selected-value-container{height:100%;min-height:calc(var(--scb-select-min-height) - (var(--scb-select-border-width)*2));box-sizing:border-box;position:relative;display:flex;align-items:center;padding:var(--scb-select-padding-y) 52px var(--scb-select-padding-y) var(--scb-select-padding-x)}:host([error]) .selected-value-container{padding-right:76px}:host([size='extra-small']) .selected-value-container{padding-right:44px}:host([error][size='extra-small']) .selected-value-container{padding-right:68px}.select-error-icon{position:absolute;right:36px;top:50%;transform:translateY(-50%);pointer-events:none;font-size:var(--icon-size-small, 20px);color:var(--md-sys-color-error)}`,u);n([l({type:String})],a.prototype,"variant",void 0);n([l({type:String})],a.prototype,"value",void 0);n([l({type:Array})],a.prototype,"values",void 0);n([l({type:Boolean,reflect:!0})],a.prototype,"disabled",void 0);n([l({type:Boolean,reflect:!0})],a.prototype,"required",void 0);n([l({type:Boolean,reflect:!0})],a.prototype,"error",void 0);n([l({type:Boolean,reflect:!0})],a.prototype,"open",void 0);n([l({type:String})],a.prototype,"label",void 0);n([l({type:String})],a.prototype,"name",void 0);n([l({type:String})],a.prototype,"placeholder",void 0);n([l({type:String,attribute:"supporting-text"})],a.prototype,"supportingText",void 0);n([l({type:String,attribute:"error-text"})],a.prototype,"errorText",void 0);n([l({type:String,attribute:"help-text"})],a.prototype,"helpText",void 0);n([l({type:String,attribute:"help-label"})],a.prototype,"helpLabel",void 0);n([l({type:Boolean,attribute:"with-radiobuttons"})],a.prototype,"withRadiobuttons",void 0);n([l({type:Boolean,attribute:"no-highlight-selected",reflect:!0})],a.prototype,"noHighlightSelected",void 0);n([l({type:String,reflect:!0})],a.prototype,"size",void 0);n([l({type:String,reflect:!0})],a.prototype,"spacing",void 0);n([l({type:String,attribute:"spacing-top",reflect:!0})],a.prototype,"spacingTop",void 0);n([l({type:String,attribute:"spacing-bottom",reflect:!0})],a.prototype,"spacingBottom",void 0);n([l({type:String,attribute:"spacing-left",reflect:!0})],a.prototype,"spacingLeft",void 0);n([l({type:String,attribute:"spacing-right",reflect:!0})],a.prototype,"spacingRight",void 0);n([l({type:String,attribute:"z-index"})],a.prototype,"zIndex",void 0);n([g()],a.prototype,"_optionsPlacement",void 0);n([g()],a.prototype,"_activeDescendant",void 0);a=n([y("scb-select")],a);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.138",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -472,5 +472,5 @@
|
|
|
472
472
|
},
|
|
473
473
|
"./mvc/*": "./mvc/*"
|
|
474
474
|
},
|
|
475
|
-
"buildHash": "
|
|
475
|
+
"buildHash": "E70DD81152035DB4E1E93936D0D812D04F9805CA75E4EB971C4E8883D4FB98DB"
|
|
476
476
|
}
|
package/scb-button/scb-button.js
CHANGED
|
@@ -133,7 +133,7 @@ var d = class extends t {
|
|
|
133
133
|
margin-inline-start: var(--scb-button-spacing-inline-start, 0);
|
|
134
134
|
margin-inline-end: var(--scb-button-spacing-inline-end, 0);
|
|
135
135
|
--scb-button-font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
|
|
136
|
-
--scb-button-padding-block: calc(var(--spacing-
|
|
136
|
+
--scb-button-padding-block: calc(var(--spacing-5) - var(--spacing-1));
|
|
137
137
|
--scb-button-label-text-line-height: var(--md-sys-typescale-label-small-line-height);
|
|
138
138
|
--scb-button-container-height: calc(
|
|
139
139
|
var(--scb-button-label-text-line-height) + var(--scb-button-padding-block) + var(--scb-button-padding-block)
|
|
@@ -146,7 +146,7 @@ var d = class extends t {
|
|
|
146
146
|
--scb-button-icon-size: var(--icon-size-small, 20px);
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
:host([size='small']) {
|
|
149
|
+
:host([size='extra-small']) {
|
|
150
150
|
--scb-button-padding-block: calc(var(--spacing-3) - var(--spacing-1));
|
|
151
151
|
--scb-button-padding-inline: var(--spacing-4);
|
|
152
152
|
--scb-button-icon-edge-space: var(--spacing-4);
|
|
@@ -154,6 +154,14 @@ var d = class extends t {
|
|
|
154
154
|
--scb-button-icon-size: var(--icon-size-small, 20px);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
:host([size='small']) {
|
|
158
|
+
--scb-button-padding-block: calc(var(--spacing-4) - var(--spacing-1));
|
|
159
|
+
--scb-button-padding-inline: var(--spacing-4);
|
|
160
|
+
--scb-button-icon-edge-space: var(--spacing-4);
|
|
161
|
+
--scb-button-icon-gap: var(--spacing-2);
|
|
162
|
+
--scb-button-icon-size: var(--icon-size-small, 20px);
|
|
163
|
+
}
|
|
164
|
+
|
|
157
165
|
:host([size='large']) {
|
|
158
166
|
--scb-button-padding-block: var(--spacing-5);
|
|
159
167
|
--scb-button-label-text-line-height: var(--md-sys-typescale-label-medium-line-height);
|
|
@@ -5,7 +5,7 @@ import { customElement as i, property as a } from "lit/decorators.js";
|
|
|
5
5
|
//#region src/scb-components/scb-collapse/scb-collapse.ts
|
|
6
6
|
var o = class extends t {
|
|
7
7
|
constructor(...e) {
|
|
8
|
-
super(...e), this._contentId = `scb-collapse-content-${Math.random().toString(36).substr(2, 9)}`, this.variant = "elements", this.collapsedHeight = 40, this.visibleElements = 1, this.expanded = !1, this.hideToggle = !1, this._elementCount = 0, this.expandButtonLabel = "Mer", this.collapseButtonLabel = "Mindre", this.spacing = void 0, this.spacingTop = void 0, this.spacingBottom = void 0, this.spacingLeft = void 0, this.spacingRight = void 0, this.itemsGap = void 0, this._contentHeight = 0, this.#r = 0, this.#i = 0, this.#o = 0, this.#s = 0;
|
|
8
|
+
super(...e), this._contentId = `scb-collapse-content-${Math.random().toString(36).substr(2, 9)}`, this.variant = "elements", this.collapsedHeight = 40, this.visibleElements = 1, this.expanded = !1, this.hideToggle = !1, this.toggleButtonVariant = "text", this.toggleButtonSize = "medium", this.togglePosition = "after", this.toggleLayout = "block", this._elementCount = 0, this.expandButtonLabel = "Mer", this.collapseButtonLabel = "Mindre", this.spacing = void 0, this.spacingTop = void 0, this.spacingBottom = void 0, this.spacingLeft = void 0, this.spacingRight = void 0, this.itemsGap = void 0, this._contentHeight = 0, this.#r = 0, this.#i = 0, this.#o = 0, this.#s = 0;
|
|
9
9
|
}
|
|
10
10
|
get _regionLabel() {
|
|
11
11
|
return `${this.expanded ? this.collapseButtonLabel : this.expandButtonLabel} – ${this._contentId}`;
|
|
@@ -41,8 +41,64 @@ var o = class extends t {
|
|
|
41
41
|
-webkit-mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - var(--scb-collapse-fade-height, 48px)), transparent 100%);
|
|
42
42
|
mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - var(--scb-collapse-fade-height, 48px)), transparent 100%);
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
.collapse-layout {
|
|
45
|
+
display: block;
|
|
46
|
+
}
|
|
47
|
+
.collapse-control-row {
|
|
48
|
+
display: block;
|
|
49
|
+
margin-block-start: 8px;
|
|
50
|
+
}
|
|
51
|
+
.collapse-control-row--before {
|
|
52
|
+
margin-block-start: 0;
|
|
53
|
+
margin-block-end: var(--spacing-3, 12px);
|
|
54
|
+
}
|
|
55
|
+
.collapse-toggle {
|
|
56
|
+
display: inline-grid;
|
|
57
|
+
inline-size: max-content;
|
|
58
|
+
}
|
|
59
|
+
.collapse-toggle scb-button,
|
|
60
|
+
.collapse-toggle__measure {
|
|
61
|
+
grid-area: 1 / 1;
|
|
62
|
+
}
|
|
63
|
+
.collapse-toggle scb-button {
|
|
64
|
+
inline-size: 100%;
|
|
65
|
+
}
|
|
66
|
+
.collapse-toggle__measure {
|
|
67
|
+
box-sizing: border-box;
|
|
68
|
+
display: inline-flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
gap: var(--scb-collapse-toggle-measure-icon-gap);
|
|
71
|
+
min-inline-size: 64px;
|
|
72
|
+
min-block-size: var(--scb-collapse-toggle-measure-block-size);
|
|
73
|
+
padding-inline: var(--scb-collapse-toggle-measure-padding-inline);
|
|
74
|
+
padding-block: var(--scb-collapse-toggle-measure-padding-block);
|
|
75
|
+
border-radius: 999px;
|
|
76
|
+
color: transparent;
|
|
77
|
+
font-family: var(--scb-collapse-toggle-measure-font-family);
|
|
78
|
+
font-size: var(--scb-collapse-toggle-measure-font-size);
|
|
79
|
+
font-weight: var(--scb-collapse-toggle-measure-font-weight);
|
|
80
|
+
line-height: var(--scb-collapse-toggle-measure-line-height);
|
|
81
|
+
pointer-events: none;
|
|
82
|
+
user-select: none;
|
|
83
|
+
white-space: nowrap;
|
|
84
|
+
visibility: hidden;
|
|
85
|
+
}
|
|
86
|
+
.collapse-toggle__measure-icon {
|
|
87
|
+
display: inline-block;
|
|
88
|
+
inline-size: var(--scb-collapse-toggle-measure-icon-size);
|
|
89
|
+
block-size: var(--scb-collapse-toggle-measure-icon-size);
|
|
90
|
+
}
|
|
91
|
+
:host([toggle-layout='inline']) .collapse-control-row {
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-wrap: wrap;
|
|
94
|
+
align-items: center;
|
|
95
|
+
gap: var(--spacing-3, 12px);
|
|
96
|
+
}
|
|
97
|
+
:host([toggle-layout='inline']) .collapse-toggle {
|
|
98
|
+
flex: 0 0 auto;
|
|
99
|
+
}
|
|
100
|
+
slot[name='toggle-content'] {
|
|
101
|
+
display: contents;
|
|
46
102
|
}
|
|
47
103
|
::slotted(.scb-collapsed-hidden) {
|
|
48
104
|
display: none !important;
|
|
@@ -52,6 +108,23 @@ var o = class extends t {
|
|
|
52
108
|
toggle() {
|
|
53
109
|
this.expanded = !this.expanded;
|
|
54
110
|
}
|
|
111
|
+
getDefaultSlot() {
|
|
112
|
+
return this.shadowRoot?.querySelector("slot:not([name])");
|
|
113
|
+
}
|
|
114
|
+
getToggleMeasureStyles() {
|
|
115
|
+
let e = this.toggleButtonSize === "small", t = this.toggleButtonSize === "medium" || !this.toggleButtonSize, n = this.toggleButtonSize === "large", r = n ? "var(--md-sys-typescale-label-medium-font)" : "var(--md-sys-typescale-label-small-font)", i = n ? "var(--md-sys-typescale-label-medium-size)" : "var(--md-sys-typescale-label-small-size)", a = n ? "var(--md-sys-typescale-label-medium-weight)" : "var(--md-sys-typescale-label-small-weight)", o = n ? "var(--md-sys-typescale-label-medium-line-height)" : "var(--md-sys-typescale-label-small-line-height)", s = n ? "var(--icon-size-medium, 24px)" : "var(--icon-size-small, 20px)", c = e ? "var(--spacing-2)" : "var(--spacing-3)", l = e ? "var(--spacing-4)" : t ? "var(--spacing-5)" : "var(--spacing-7)", u = e ? "calc(var(--spacing-3) - var(--spacing-1))" : t ? "calc(var(--spacing-4) - var(--spacing-1))" : "var(--spacing-5)";
|
|
116
|
+
return [
|
|
117
|
+
`--scb-collapse-toggle-measure-font-family:${r}`,
|
|
118
|
+
`--scb-collapse-toggle-measure-font-size:${i}`,
|
|
119
|
+
`--scb-collapse-toggle-measure-font-weight:${a}`,
|
|
120
|
+
`--scb-collapse-toggle-measure-line-height:${o}`,
|
|
121
|
+
`--scb-collapse-toggle-measure-icon-size:${s}`,
|
|
122
|
+
`--scb-collapse-toggle-measure-icon-gap:${c}`,
|
|
123
|
+
`--scb-collapse-toggle-measure-padding-inline:${l}`,
|
|
124
|
+
`--scb-collapse-toggle-measure-padding-block:${u}`,
|
|
125
|
+
`--scb-collapse-toggle-measure-block-size:calc(${o} + ${u} + ${u})`
|
|
126
|
+
].join(";");
|
|
127
|
+
}
|
|
55
128
|
mapSpacingToken(e) {
|
|
56
129
|
if (!e) return;
|
|
57
130
|
let t = String(e).trim();
|
|
@@ -64,7 +137,7 @@ var o = class extends t {
|
|
|
64
137
|
#t() {
|
|
65
138
|
let e = this.mapSpacingToken(this.itemsGap);
|
|
66
139
|
e ? this.style.setProperty("--scb-collapse-items-gap", e) : this.style.removeProperty("--scb-collapse-items-gap");
|
|
67
|
-
let t = this.
|
|
140
|
+
let t = this.getDefaultSlot();
|
|
68
141
|
t && t.assignedNodes({ flatten: !0 }).filter((e) => e.nodeType === Node.ELEMENT_NODE).forEach((t, n) => {
|
|
69
142
|
let r = t;
|
|
70
143
|
n === 0 || !e ? r.style.removeProperty("margin-block-start") : r.style.setProperty("margin-block-start", "var(--scb-collapse-items-gap)");
|
|
@@ -92,7 +165,7 @@ var o = class extends t {
|
|
|
92
165
|
requestAnimationFrame(() => {
|
|
93
166
|
this._measureContent(), this._countElements(), this.#t(), this.#h();
|
|
94
167
|
});
|
|
95
|
-
let e = this.
|
|
168
|
+
let e = this.getDefaultSlot();
|
|
96
169
|
e && e.addEventListener("slotchange", () => {
|
|
97
170
|
requestAnimationFrame(() => {
|
|
98
171
|
this._measureContent(), this._countElements(), this.#t(), this.#h();
|
|
@@ -152,7 +225,7 @@ var o = class extends t {
|
|
|
152
225
|
return Number.isFinite(e) ? Math.max(0, Math.floor(e)) : 0;
|
|
153
226
|
}
|
|
154
227
|
#m() {
|
|
155
|
-
let e = this.
|
|
228
|
+
let e = this.getDefaultSlot();
|
|
156
229
|
return e ? e.assignedNodes({ flatten: !0 }).filter((e) => e.nodeType === Node.ELEMENT_NODE) : [];
|
|
157
230
|
}
|
|
158
231
|
#h(e = this.expanded) {
|
|
@@ -201,7 +274,7 @@ var o = class extends t {
|
|
|
201
274
|
}
|
|
202
275
|
_measureContent(e = !0) {
|
|
203
276
|
if (this.variant === "height") {
|
|
204
|
-
let t = this.shadowRoot?.querySelector(".collapse-content"), n = this.
|
|
277
|
+
let t = this.shadowRoot?.querySelector(".collapse-content"), n = this.getDefaultSlot();
|
|
205
278
|
if (t) {
|
|
206
279
|
let n = t.scrollHeight;
|
|
207
280
|
n !== this._contentHeight && (this._contentHeight = n, e && this.requestUpdate());
|
|
@@ -220,67 +293,82 @@ var o = class extends t {
|
|
|
220
293
|
}
|
|
221
294
|
_countElements(e = !0) {
|
|
222
295
|
if (this.variant === "elements") {
|
|
223
|
-
let t = this.
|
|
296
|
+
let t = this.getDefaultSlot();
|
|
224
297
|
if (t) {
|
|
225
298
|
let n = t.assignedNodes({ flatten: !0 }).filter((e) => e.nodeType === Node.ELEMENT_NODE).length;
|
|
226
299
|
n !== this._elementCount && (this._elementCount = n, e && this.requestUpdate());
|
|
227
300
|
}
|
|
228
301
|
}
|
|
229
302
|
}
|
|
303
|
+
#b() {
|
|
304
|
+
let e = this.expandButtonLabel.length >= this.collapseButtonLabel.length ? this.expandButtonLabel : this.collapseButtonLabel;
|
|
305
|
+
return r`
|
|
306
|
+
<div class="collapse-toggle">
|
|
307
|
+
<span class="collapse-toggle__measure" aria-hidden="true" style="${this.getToggleMeasureStyles()}">
|
|
308
|
+
<span class="collapse-toggle__measure-icon"></span>
|
|
309
|
+
${e}
|
|
310
|
+
</span>
|
|
311
|
+
<scb-button
|
|
312
|
+
id="${this._contentId}-button"
|
|
313
|
+
@click="${this.toggle}"
|
|
314
|
+
variant="${this.toggleButtonVariant}"
|
|
315
|
+
size="${this.toggleButtonSize}"
|
|
316
|
+
full-width
|
|
317
|
+
label="${this.expanded ? this.collapseButtonLabel : this.expandButtonLabel}"
|
|
318
|
+
icon="${this.expanded ? "keyboard_arrow_up" : "keyboard_arrow_down"}"
|
|
319
|
+
aria-controls="${this._contentId}"
|
|
320
|
+
aria-expanded="${this.expanded ? "true" : "false"}"
|
|
321
|
+
>
|
|
322
|
+
</scb-button>
|
|
323
|
+
</div>
|
|
324
|
+
`;
|
|
325
|
+
}
|
|
326
|
+
#x() {
|
|
327
|
+
return r`
|
|
328
|
+
<div class="collapse-control-row collapse-control-row--${this.togglePosition === "before" ? "before" : "after"}">
|
|
329
|
+
${this.#b()}
|
|
330
|
+
<slot name="toggle-content"></slot>
|
|
331
|
+
</div>
|
|
332
|
+
`;
|
|
333
|
+
}
|
|
230
334
|
render() {
|
|
231
335
|
let e = this._isFullyCollapsed();
|
|
232
336
|
if (this.variant === "height") {
|
|
233
|
-
let t = this.expanded ? "none" : `${this.collapsedHeight}px`, n = this._contentHeight > this.collapsedHeight, i = n && !this.hideToggle;
|
|
337
|
+
let t = this.expanded ? "none" : `${this.collapsedHeight}px`, n = this._contentHeight > this.collapsedHeight, i = n && !this.hideToggle ? this.#x() : "";
|
|
234
338
|
return r`
|
|
235
|
-
<div
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
339
|
+
<div class="collapse-layout">
|
|
340
|
+
${this.togglePosition === "before" ? i : ""}
|
|
341
|
+
<div
|
|
342
|
+
class="collapse-content collapse-content--height ${this.expanded ? "expanded" : ""} ${n && !this.expanded ? "has-fade" : ""}"
|
|
343
|
+
id="${this._contentId}"
|
|
344
|
+
style="max-height: ${t};"
|
|
345
|
+
role="region"
|
|
346
|
+
aria-label="${this._regionLabel}"
|
|
347
|
+
aria-hidden="${e ? "true" : "false"}"
|
|
348
|
+
?inert=${e}
|
|
349
|
+
>
|
|
350
|
+
<slot></slot>
|
|
351
|
+
</div>
|
|
352
|
+
${this.togglePosition === "after" ? i : ""}
|
|
245
353
|
</div>
|
|
246
|
-
${i ? r`
|
|
247
|
-
<scb-button
|
|
248
|
-
id="${this._contentId}-button"
|
|
249
|
-
@click="${this.toggle}"
|
|
250
|
-
variant="text"
|
|
251
|
-
label="${this.expanded ? this.collapseButtonLabel : this.expandButtonLabel}"
|
|
252
|
-
icon="${this.expanded ? "keyboard_arrow_up" : "keyboard_arrow_down"}"
|
|
253
|
-
aria-controls="${this._contentId}"
|
|
254
|
-
aria-expanded="${this.expanded ? "true" : "false"}"
|
|
255
|
-
>
|
|
256
|
-
</scb-button>
|
|
257
|
-
` : ""}
|
|
258
354
|
`;
|
|
259
355
|
} else {
|
|
260
|
-
let t = this.#p(), n = this._elementCount > t && !this.hideToggle;
|
|
356
|
+
let t = this.#p(), n = this._elementCount > t && !this.hideToggle ? this.#x() : "";
|
|
261
357
|
return r`
|
|
262
|
-
<div
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
358
|
+
<div class="collapse-layout">
|
|
359
|
+
${this.togglePosition === "before" ? n : ""}
|
|
360
|
+
<div
|
|
361
|
+
class="collapse-content collapse-content--elements ${this.expanded ? "expanded" : ""}"
|
|
362
|
+
id="${this._contentId}"
|
|
363
|
+
role="region"
|
|
364
|
+
aria-label="${this._regionLabel}"
|
|
365
|
+
aria-hidden="${e ? "true" : "false"}"
|
|
366
|
+
?inert=${e}
|
|
367
|
+
>
|
|
368
|
+
<slot></slot>
|
|
369
|
+
</div>
|
|
370
|
+
${this.togglePosition === "after" ? n : ""}
|
|
271
371
|
</div>
|
|
272
|
-
${n ? r`
|
|
273
|
-
<scb-button
|
|
274
|
-
id="${this._contentId}-button"
|
|
275
|
-
@click="${this.toggle}"
|
|
276
|
-
variant="text"
|
|
277
|
-
label="${this.expanded ? this.collapseButtonLabel : this.expandButtonLabel}"
|
|
278
|
-
icon="${this.expanded ? "keyboard_arrow_up" : "keyboard_arrow_down"}"
|
|
279
|
-
aria-controls="${this._contentId}"
|
|
280
|
-
aria-expanded="${this.expanded ? "true" : "false"}"
|
|
281
|
-
>
|
|
282
|
-
</scb-button>
|
|
283
|
-
` : ""}
|
|
284
372
|
`;
|
|
285
373
|
}
|
|
286
374
|
}
|
|
@@ -301,6 +389,22 @@ e([a({ type: String })], o.prototype, "variant", void 0), e([a({
|
|
|
301
389
|
attribute: "hide-toggle",
|
|
302
390
|
reflect: !0
|
|
303
391
|
})], o.prototype, "hideToggle", void 0), e([a({
|
|
392
|
+
type: String,
|
|
393
|
+
attribute: "toggle-button-variant",
|
|
394
|
+
reflect: !0
|
|
395
|
+
})], o.prototype, "toggleButtonVariant", void 0), e([a({
|
|
396
|
+
type: String,
|
|
397
|
+
attribute: "toggle-button-size",
|
|
398
|
+
reflect: !0
|
|
399
|
+
})], o.prototype, "toggleButtonSize", void 0), e([a({
|
|
400
|
+
type: String,
|
|
401
|
+
attribute: "toggle-position",
|
|
402
|
+
reflect: !0
|
|
403
|
+
})], o.prototype, "togglePosition", void 0), e([a({
|
|
404
|
+
type: String,
|
|
405
|
+
attribute: "toggle-layout",
|
|
406
|
+
reflect: !0
|
|
407
|
+
})], o.prototype, "toggleLayout", void 0), e([a({
|
|
304
408
|
type: String,
|
|
305
409
|
attribute: "expand-button-label",
|
|
306
410
|
reflect: !0
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LitElement, TemplateResult } from 'lit';
|
|
2
2
|
/** "filled", "outlined", "filled-tonal" eller "text" */
|
|
3
3
|
export type ScbButtonVariant = 'filled' | 'outlined' | 'filled-tonal' | 'text';
|
|
4
|
-
/** "small", "medium" eller "large" */
|
|
5
|
-
export type ScbButtonSize = 'small' | 'medium' | 'large';
|
|
4
|
+
/** "extra-small", "small", "medium" eller "large" */
|
|
5
|
+
export type ScbButtonSize = 'extra-small' | 'small' | 'medium' | 'large';
|
|
6
6
|
export declare class ScbButton extends LitElement {
|
|
7
7
|
#private;
|
|
8
8
|
variant: ScbButtonVariant;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
+
import { ScbButtonSize, ScbButtonVariant } from '../scb-button/scb-button.js';
|
|
3
|
+
export type ScbCollapseTogglePosition = 'before' | 'after';
|
|
4
|
+
export type ScbCollapseToggleLayout = 'block' | 'inline';
|
|
2
5
|
export declare class ScbCollapse extends LitElement {
|
|
3
6
|
#private;
|
|
4
7
|
private _contentId;
|
|
@@ -8,6 +11,10 @@ export declare class ScbCollapse extends LitElement {
|
|
|
8
11
|
visibleElements: number;
|
|
9
12
|
expanded: boolean;
|
|
10
13
|
hideToggle: boolean;
|
|
14
|
+
toggleButtonVariant: ScbButtonVariant;
|
|
15
|
+
toggleButtonSize: ScbButtonSize;
|
|
16
|
+
togglePosition: ScbCollapseTogglePosition;
|
|
17
|
+
toggleLayout: ScbCollapseToggleLayout;
|
|
11
18
|
private _elementCount;
|
|
12
19
|
expandButtonLabel: string;
|
|
13
20
|
collapseButtonLabel: string;
|
|
@@ -19,6 +26,8 @@ export declare class ScbCollapse extends LitElement {
|
|
|
19
26
|
itemsGap: undefined;
|
|
20
27
|
static styles: import('lit').CSSResult;
|
|
21
28
|
toggle(): void;
|
|
29
|
+
private getDefaultSlot;
|
|
30
|
+
private getToggleMeasureStyles;
|
|
22
31
|
private mapSpacingToken;
|
|
23
32
|
private _contentHeight;
|
|
24
33
|
protected willUpdate(changedProps: Map<string, unknown>): void;
|
|
@@ -22,7 +22,7 @@ export declare class ScbSearch extends LitElement {
|
|
|
22
22
|
spacingBottom: undefined;
|
|
23
23
|
spacingLeft: undefined;
|
|
24
24
|
spacingRight: undefined;
|
|
25
|
-
size: 'small' | 'medium' | 'large';
|
|
25
|
+
size: 'extra-small' | 'small' | 'medium' | 'large';
|
|
26
26
|
fullScreen: boolean;
|
|
27
27
|
private _inputFocused;
|
|
28
28
|
private _visibleSuggestions;
|
package/scb-header/scb-header.js
CHANGED
|
@@ -410,11 +410,22 @@ var d = {
|
|
|
410
410
|
--scb-header-search-max: 380px;
|
|
411
411
|
--scb-header-search-min: 250px;
|
|
412
412
|
--scb-header-search-padding-x: var(--spacing-4, 12px);
|
|
413
|
-
--scb-header-search-padding-y: var(--spacing-
|
|
413
|
+
--scb-header-search-padding-y: calc(var(--spacing-3, 8px) - var(--stroke-border, 1px));
|
|
414
414
|
--scb-header-search-leading-size: var(--scale-10, 40px);
|
|
415
415
|
--scb-header-search-icon-size: var(--icon-size-medium, 24px);
|
|
416
416
|
--scb-header-search-font-size: var(--md-sys-typescale-body-medium-size, 16px);
|
|
417
417
|
--scb-header-search-line-height: var(--md-sys-typescale-body-medium-line-height, 24px);
|
|
418
|
+
--scb-header-search-button-padding-x: var(--spacing-5, 16px);
|
|
419
|
+
--scb-header-search-button-font-size: var(--md-sys-typescale-label-small-size, 14px);
|
|
420
|
+
--scb-header-search-button-line-height: var(--md-sys-typescale-label-small-line-height, 20px);
|
|
421
|
+
--scb-header-search-button-font-weight: var(--md-sys-typescale-label-small-weight, 600);
|
|
422
|
+
--scb-header-search-control-height: calc(
|
|
423
|
+
var(--scb-header-search-line-height) +
|
|
424
|
+
var(--scb-header-search-padding-y) +
|
|
425
|
+
var(--scb-header-search-padding-y) +
|
|
426
|
+
var(--stroke-border, 1px) +
|
|
427
|
+
var(--stroke-border, 1px)
|
|
428
|
+
);
|
|
418
429
|
--scb-header-padding-inline: var(--spacing-0, 0px);
|
|
419
430
|
--scb-header-padding-inline-expanded: var(--scb-header-padding-inline);
|
|
420
431
|
|
|
@@ -483,11 +494,12 @@ var d = {
|
|
|
483
494
|
);
|
|
484
495
|
|
|
485
496
|
--scb-header-search-padding-x: var(--spacing-3, 8px);
|
|
486
|
-
--scb-header-search-padding-y: var(--spacing-
|
|
487
|
-
--scb-header-search-leading-size: var(--scale-
|
|
497
|
+
--scb-header-search-padding-y: calc(var(--spacing-2, 4px) + var(--stroke-border, 1px));
|
|
498
|
+
--scb-header-search-leading-size: var(--scale-08, 32px);
|
|
488
499
|
--scb-header-search-icon-size: var(--icon-size-small, 20px);
|
|
489
500
|
--scb-header-search-font-size: var(--md-sys-typescale-body-small-size, 14px);
|
|
490
501
|
--scb-header-search-line-height: var(--md-sys-typescale-body-small-line-height, 20px);
|
|
502
|
+
--scb-header-search-button-padding-x: var(--spacing-4, 12px);
|
|
491
503
|
}
|
|
492
504
|
|
|
493
505
|
:host([size='large']) {
|
|
@@ -519,11 +531,15 @@ var d = {
|
|
|
519
531
|
);
|
|
520
532
|
|
|
521
533
|
--scb-header-search-padding-x: var(--spacing-5, 16px);
|
|
522
|
-
--scb-header-search-padding-y: var(--spacing-5, 16px);
|
|
534
|
+
--scb-header-search-padding-y: calc(var(--spacing-5, 16px) - var(--spacing-1, 2px));
|
|
523
535
|
--scb-header-search-leading-size: var(--scale-11, 48px);
|
|
524
536
|
--scb-header-search-icon-size: var(--icon-size-medium, 24px);
|
|
525
537
|
--scb-header-search-font-size: var(--md-sys-typescale-body-large-size, 18px);
|
|
526
538
|
--scb-header-search-line-height: var(--md-sys-typescale-body-large-line-height, 26px);
|
|
539
|
+
--scb-header-search-button-padding-x: var(--spacing-7, 24px);
|
|
540
|
+
--scb-header-search-button-font-size: var(--md-sys-typescale-label-medium-size, 16px);
|
|
541
|
+
--scb-header-search-button-line-height: var(--md-sys-typescale-label-medium-line-height, 24px);
|
|
542
|
+
--scb-header-search-button-font-weight: var(--md-sys-typescale-label-medium-weight, 600);
|
|
527
543
|
}
|
|
528
544
|
|
|
529
545
|
.header-grid {
|
|
@@ -720,11 +736,7 @@ var d = {
|
|
|
720
736
|
inline-size: 100%;
|
|
721
737
|
min-block-size: var(
|
|
722
738
|
--scb-search-height,
|
|
723
|
-
|
|
724
|
-
var(--scb-header-search-line-height) +
|
|
725
|
-
var(--scb-header-search-padding-y) +
|
|
726
|
-
var(--scb-header-search-padding-y)
|
|
727
|
-
)
|
|
739
|
+
var(--scb-header-search-control-height)
|
|
728
740
|
);
|
|
729
741
|
padding-block: var(--scb-header-search-padding-y);
|
|
730
742
|
padding-inline-start: calc(
|
|
@@ -1051,8 +1063,14 @@ var d = {
|
|
|
1051
1063
|
}
|
|
1052
1064
|
|
|
1053
1065
|
.search-submit {
|
|
1054
|
-
|
|
1055
|
-
min-
|
|
1066
|
+
block-size: var(--scb-search-height, var(--scb-header-search-control-height));
|
|
1067
|
+
min-block-size: var(--scb-search-height, var(--scb-header-search-control-height));
|
|
1068
|
+
min-inline-size: 64px;
|
|
1069
|
+
padding-block: 0;
|
|
1070
|
+
padding-inline: var(--scb-header-search-button-padding-x);
|
|
1071
|
+
font-size: var(--scb-header-search-button-font-size);
|
|
1072
|
+
line-height: var(--scb-header-search-button-line-height);
|
|
1073
|
+
font-weight: var(--scb-header-search-button-font-weight);
|
|
1056
1074
|
color: var(--md-sys-color-on-secondary-container, var(--p-30, #1e00be));
|
|
1057
1075
|
background: var(--md-sys-color-secondary-container, var(--p-90, #d6f1ff));
|
|
1058
1076
|
}
|