scb-wc 0.1.137 → 0.1.139
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/fonts/material-symbols-outlined/files/material-symbols-outlined-subset.woff2 +0 -0
- 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/mvc/fonts/material-symbols-outlined/files/material-symbols-outlined-subset.woff2 +0 -0
- 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 +174 -70
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/lazy-focus-ring.js","../../vendor/rolldown-runtime.js","../../vendor/preload-helper.js","../../vendor/lazy-ripple.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{g as s,h as
|
|
2
|
+
import{g as s,h as z,m as N,p as o,v as c,y as w}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as x}from"../../vendor/preload-helper.js";import{t as a}from"../../vendor/decorate.js";import{n as P,t as k}from"../../vendor/assertClassBrand.js";(function(){try{var p=typeof globalThis<"u"?globalThis:window;if(!p.__scb_ce_guard_installed__){p.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(e,i,r){try{customElements.get(e)||t(e,i,r)}catch(b){var l=String(b||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw b}}}}catch{}})();var h,f,m;function $(){return f??(f=x(()=>import("../../vendor/lazy-focus-ring.js").then(p=>p.i),__vite__mapDeps([0,1,2]),import.meta.url)),f}function R(){return m??(m=x(()=>import("../../vendor/lazy-ripple.js"),__vite__mapDeps([3,2]),import.meta.url)),m}var n=(h=new WeakSet,class extends z{constructor(...t){super(...t),P(this,h),this.variant="filled",this.size="medium",this.type="button",this.label="Button",this.trailingIcon=!1,this.icon="",this.iconFilled=!1,this.disabled=!1,this.fullWidth=!1,this.href="",this.target="",this.rel="",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.__hasDefaultSlotContent=!1,this.__nativeFocusRingReady=!1,this.__nativeRippleReady=!1,this.__nativeRipplePendingClick=!1,this.__ensureNativeFocusRing=()=>{this.__nativeFocusRingReady||$().then(({ensureFocusRingReady:e})=>(e(),customElements.whenDefined("md-focus-ring"))).then(()=>{this.__nativeFocusRingReady=!0,this.toggleAttribute("data-native-focus-ring-ready",!0),this.requestUpdate(),this.updateComplete.then(()=>this.__syncNativeFocusRingControl())})},this.__onNativeFocusIn=e=>{const i=e.composedPath()[0];i instanceof HTMLElement&&i.matches(":focus-visible")&&this.__ensureNativeFocusRing()},this.__ensureNativeRipple=e=>{this.__nativeRippleReady||this.disabled||(e&&(this.__nativeRipplePendingPointerEvent=e),R().then(({ensureRippleReady:i})=>i()).then(()=>{this.disabled||(this.__nativeRippleReady=!0,this.requestUpdate(),this.updateComplete.then(()=>{this.__syncNativeFocusRingControl(),this.__replayNativeRippleState()}))}))},this.__onNativePointerWarmup=e=>{this.__ensureNativeRipple(e)},this.__onNativeClick=e=>{if(this.disabled){e.preventDefault(),e.stopPropagation();return}(!this.__nativeRippleReady||this.__nativeRipplePendingPointerEvent)&&(this.__nativeRipplePendingClick=!0,this.__ensureNativeRipple())}}__getNativeControl(){return this.renderRoot.querySelector(".native-button")}__handleDefaultSlotChange(t){const e=t.target.assignedNodes({flatten:!0}).some(i=>i.nodeType===Node.TEXT_NODE?!!i.textContent?.trim():i.nodeType===Node.ELEMENT_NODE);this.__hasDefaultSlotContent!==e&&(this.__hasDefaultSlotContent=e,this.requestUpdate()),this.updateComplete.then(()=>this.__syncAriaToInner())}__syncAriaToInner(){const t=this.__getNativeControl();t&&this.__syncAriaToControl(t)}__syncAriaToControl(t){const e=(this.getAttribute("aria-label")||"").trim(),i=this.label.trim()===""&&!this.__hasDefaultSlotContent?(this.icon||"").trim():"",r=e||i;r?t.setAttribute("aria-label",r):t.removeAttribute("aria-label");const l=this.getAttribute("aria-controls");l!==null?t.setAttribute("aria-controls",l):t.removeAttribute("aria-controls");const b=this.getAttribute("aria-haspopup");b!==null?t.setAttribute("aria-haspopup",b):t.removeAttribute("aria-haspopup");const _=this.getAttribute("aria-expanded");_!==null?t.setAttribute("aria-expanded",_):t.removeAttribute("aria-expanded"),this.__ariaObserver?.disconnect(),this.__ariaObserver=new MutationObserver(S=>{const d=this.__getNativeControl();if(d)for(const v of S){if(v.type!=="attributes"||!v.attributeName)continue;const u=v.attributeName,g=this.getAttribute(u);if(u==="aria-label"){const y=(g||(this.label.trim()===""&&!this.__hasDefaultSlotContent?(this.icon||"").trim():"")).trim();y?d.setAttribute("aria-label",y):d.removeAttribute("aria-label")}else(u==="aria-controls"||u==="aria-expanded"||u==="aria-haspopup")&&(g===null?d.removeAttribute(u):d.setAttribute(u,g))}}),this.__ariaObserver.observe(this,{attributes:!0,attributeFilter:["aria-label","aria-controls","aria-expanded","aria-haspopup"]})}connectedCallback(){super.connectedCallback()}focus(t){const e=this.__getNativeControl();if(e){e.focus(t);return}this.updateComplete.then(()=>this.__getNativeControl()?.focus(t))}blur(){this.__getNativeControl()?.blur()}firstUpdated(){(this.type==="submit"||this.type==="reset")&&this.addEventListener("click",()=>{if(!this.disabled){const t=this.closest("form");t&&(this.type==="submit"&&t.requestSubmit(),this.type==="reset"&&t.reset())}}),k(h,this,C).call(this)}updated(t){(t.has("variant")||t.has("label")||t.has("icon")||t.has("href"))&&this.updateComplete.then(()=>this.__syncAriaToInner()),(this.__nativeFocusRingReady||this.__nativeRippleReady)&&this.updateComplete.then(()=>this.__syncNativeFocusRingControl()),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&k(h,this,C).call(this)}disconnectedCallback(){this.__ariaObserver?.disconnect(),super.disconnectedCallback()}__syncNativeFocusRingControl(){const t=this.renderRoot.querySelector("md-focus-ring"),e=this.__getNativeControl();t&&e&&(t.control=e,t.visible=e.matches(":focus-visible"));const i=this.renderRoot.querySelector("md-ripple");i&&e&&(i.control=e)}async __replayNativeRippleState(){const t=this.renderRoot.querySelector("md-ripple"),e=this.__getNativeControl(),i=this.__nativeRipplePendingPointerEvent,r=this.__nativeRipplePendingClick;this.__nativeRipplePendingPointerEvent=void 0,this.__nativeRipplePendingClick=!1;const{syncRippleToControl:l}=await R();await l(t,e,i,r)}mapSpacingToken(t){if(!t)return;const e=String(t).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e}static get styles(){return w`:host{display:inline-flex;block-size:var(--scb-button-block-size, auto);margin-block-start:var(--scb-button-spacing-block-start, 0);margin-block-end:var(--scb-button-spacing-block-end, 0);margin-inline-start:var(--scb-button-spacing-inline-start, 0);margin-inline-end:var(--scb-button-spacing-inline-end, 0);--scb-button-font-variation-settings:'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;--scb-button-padding-block:calc(var(--spacing-5) - var(--spacing-1));--scb-button-label-text-line-height:var(--md-sys-typescale-label-small-line-height);--scb-button-container-height:calc(
|
|
3
3
|
var(--scb-button-label-text-line-height) + var(--scb-button-padding-block) + var(--scb-button-padding-block)
|
|
4
|
-
);--scb-button-padding-inline:var(--spacing-5);--scb-button-icon-edge-space:var(--spacing-5);--scb-button-icon-gap:var(--spacing-3)}:host([size='small']){--scb-button-padding-
|
|
4
|
+
);--scb-button-padding-inline:var(--spacing-5);--scb-button-icon-edge-space:var(--spacing-5);--scb-button-icon-gap:var(--spacing-3);--scb-button-icon-size:var(--icon-size-small, 20px)}:host([size='extra-small']),:host([size='small']){--scb-button-padding-inline:var(--spacing-4);--scb-button-icon-edge-space:var(--spacing-4);--scb-button-icon-gap:var(--spacing-2);--scb-button-icon-size:var(--icon-size-small, 20px)}:host([size='extra-small']){--scb-button-padding-block:calc(var(--spacing-3) - var(--spacing-1))}:host([size='small']){--scb-button-padding-block:calc(var(--spacing-4) - var(--spacing-1))}:host([size='large']){--scb-button-padding-block:var(--spacing-5);--scb-button-label-text-line-height:var(--md-sys-typescale-label-medium-line-height);--scb-button-padding-inline:var(--spacing-7);--scb-button-icon-edge-space:var(--spacing-7);--scb-button-icon-gap:var(--spacing-3);--scb-button-icon-size:var(--icon-size-medium, 24px)}:host([icon-filled]){--scb-button-font-variation-settings:'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24}.native-button,.native-button-wrap{position:relative;display:inline-flex}.native-button-wrap{border-radius:var(--md-sys-shape-corner-full, 999px)}.native-button{z-index:0;box-sizing:border-box;align-items:center;justify-content:center;gap:var(--scb-button-icon-gap);min-block-size:var(--scb-button-block-size, var(--scb-button-container-height));block-size:var(--scb-button-block-size, var(--scb-button-container-height));min-inline-size:64px;inline-size:auto;padding-block:var(--scb-button-padding-block);padding-inline:var(--scb-button-padding-inline);overflow:hidden;border:0;border-radius:inherit;background:0 0;color:var(--md-sys-color-primary);font-family:var(--md-sys-typescale-label-small-font);font-size:var(--md-sys-typescale-label-small-size);font-weight:var(--md-sys-typescale-label-small-weight);line-height:var(--md-sys-typescale-label-small-line-height);letter-spacing:normal;text-align:center;text-decoration:none;white-space:nowrap;cursor:pointer;appearance:none;-webkit-appearance:none;touch-action:manipulation}::slotted(*){display:inline!important;margin:0!important;color:inherit!important;font:inherit!important;letter-spacing:inherit!important;line-height:inherit!important}.native-button::before{content:"";position:absolute;inset:0;z-index:-1;background:currentColor;opacity:0;pointer-events:none;transition:opacity var(--motion-duration-short, 150ms) var(--motion-easing-standard, ease)}.native-button:hover::before{opacity:var(--md-sys-state-hover-state-layer-opacity, 0.08)}.native-button:active::before{opacity:var(--md-sys-state-pressed-state-layer-opacity, 0.12)}.native-button:focus{outline:0}:host(:not([data-native-focus-ring-ready])) .native-button:focus-visible{outline:var(--stroke-border-m, 2px) solid var(--md-sys-color-primary);outline-offset:var(--spacing-1, 2px)}.native-button:disabled,.native-button[aria-disabled=true]{color:rgb(15 8 101/38%);cursor:default;opacity:1;pointer-events:none}:host(:not([variant])) .native-button,:host([variant='filled']) .native-button{border-color:transparent;background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary)}:host([variant='outlined']) .native-button{background:0 0;color:var(--md-sys-color-primary);box-shadow:inset 0 0 0 var(--stroke-border, 1px) var(--md-sys-color-outline)}:host([variant='outlined']) .native-button:disabled,:host([variant='outlined']) .native-button[aria-disabled=true]{color:rgb(15 8 101/38%);box-shadow:inset 0 0 0 var(--stroke-border, 1px) rgb(15 8 101/12%)}:host([variant='filled-tonal']) .native-button{border-color:transparent;background:var(--md-sys-color-secondary-container);color:var(--md-sys-color-on-secondary-container)}:host(:not([variant])) .native-button:disabled,:host(:not([variant])) .native-button[aria-disabled=true],:host([variant='filled']) .native-button:disabled,:host([variant='filled']) .native-button[aria-disabled=true],:host([variant='filled-tonal']) .native-button:disabled,:host([variant='filled-tonal']) .native-button[aria-disabled=true]{background:rgb(15 8 101/12%);color:rgb(15 8 101/38%)}:host([variant='text']) .native-button{min-inline-size:0;background:0 0;color:var(--md-sys-color-primary)}:host([variant='text']) .native-button:disabled,:host([variant='text']) .native-button[aria-disabled=true]{color:rgb(15 8 101/38%)}:host([size='large']) .native-button{font-family:var(--md-sys-typescale-label-medium-font);font-size:var(--md-sys-typescale-label-medium-size);font-weight:var(--md-sys-typescale-label-medium-weight);line-height:var(--md-sys-typescale-label-medium-line-height);letter-spacing:normal}.native-icon{flex:0 0 auto;display:inline-block;inline-size:var(--scb-button-icon-size);block-size:var(--scb-button-icon-size);overflow:hidden;font-family:"Material Symbols Outlined";font-size:var(--scb-button-icon-size);line-height:1;text-align:center;white-space:nowrap;text-transform:none;word-wrap:normal;direction:ltr;font-feature-settings:"liga"1;font-variation-settings:var(--scb-button-font-variation-settings);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.native-icon.scb-svg-icon{fill:currentColor;font:inherit}.native-button-wrap md-ripple{position:absolute;inset:0;border-radius:inherit;pointer-events:none}.native-button-wrap md-focus-ring{pointer-events:none}:host([full-width]){display:flex;inline-size:100%}:host([full-width]) .native-button,:host([full-width]) .native-button-wrap{inline-size:100%;flex:1 1 auto}`}render(){const t=!!this.icon?.trim(),e=t?c`<span class="native-icon" part="icon" aria-hidden="true">${this.icon}</span>`:s,i=this.label.trim()===""&&!this.__hasDefaultSlotContent?this.icon:void 0,r=c`
|
|
5
5
|
<slot
|
|
6
6
|
@slotchange=${this.__handleDefaultSlotChange}
|
|
7
7
|
style=${this.__hasDefaultSlotContent?s:"display: none"}
|
|
@@ -48,4 +48,4 @@ import{g as s,h as N,m as w,p as o,v as c,y as z}from"../../vendor/vendor.js";im
|
|
|
48
48
|
${this.__nativeRippleReady?c`<md-ripple aria-hidden="true"></md-ripple>`:s}
|
|
49
49
|
${this.__nativeFocusRingReady?c`<md-focus-ring aria-hidden="true"></md-focus-ring>`:s}
|
|
50
50
|
</span>
|
|
51
|
-
`}});function C(){const p=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??p,e=this.mapSpacingToken(this.spacingBottom)??p,i=this.mapSpacingToken(this.spacingLeft),r=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-button-spacing-block-start",t):this.style.removeProperty("--scb-button-spacing-block-start"),e?this.style.setProperty("--scb-button-spacing-block-end",e):this.style.removeProperty("--scb-button-spacing-block-end"),i?this.style.setProperty("--scb-button-spacing-inline-start",i):this.style.removeProperty("--scb-button-spacing-inline-start"),r?this.style.setProperty("--scb-button-spacing-inline-end",r):this.style.removeProperty("--scb-button-spacing-inline-end")}a([o({type:String,reflect:!0})],n.prototype,"variant",void 0);a([o({type:String,reflect:!0})],n.prototype,"size",void 0);a([o({type:String,reflect:!0})],n.prototype,"type",void 0);a([o({type:String})],n.prototype,"label",void 0);a([o({type:Boolean,attribute:"trailing-icon"})],n.prototype,"trailingIcon",void 0);a([o({type:String})],n.prototype,"icon",void 0);a([o({type:Boolean,attribute:"icon-filled",reflect:!0})],n.prototype,"iconFilled",void 0);a([o({type:Boolean,reflect:!0})],n.prototype,"disabled",void 0);a([o({type:Boolean,attribute:"full-width",reflect:!0})],n.prototype,"fullWidth",void 0);a([o({type:String})],n.prototype,"href",void 0);a([o({type:String})],n.prototype,"target",void 0);a([o({type:String})],n.prototype,"rel",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);n=a([
|
|
51
|
+
`}});function C(){const p=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??p,e=this.mapSpacingToken(this.spacingBottom)??p,i=this.mapSpacingToken(this.spacingLeft),r=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-button-spacing-block-start",t):this.style.removeProperty("--scb-button-spacing-block-start"),e?this.style.setProperty("--scb-button-spacing-block-end",e):this.style.removeProperty("--scb-button-spacing-block-end"),i?this.style.setProperty("--scb-button-spacing-inline-start",i):this.style.removeProperty("--scb-button-spacing-inline-start"),r?this.style.setProperty("--scb-button-spacing-inline-end",r):this.style.removeProperty("--scb-button-spacing-inline-end")}a([o({type:String,reflect:!0})],n.prototype,"variant",void 0);a([o({type:String,reflect:!0})],n.prototype,"size",void 0);a([o({type:String,reflect:!0})],n.prototype,"type",void 0);a([o({type:String})],n.prototype,"label",void 0);a([o({type:Boolean,attribute:"trailing-icon"})],n.prototype,"trailingIcon",void 0);a([o({type:String})],n.prototype,"icon",void 0);a([o({type:Boolean,attribute:"icon-filled",reflect:!0})],n.prototype,"iconFilled",void 0);a([o({type:Boolean,reflect:!0})],n.prototype,"disabled",void 0);a([o({type:Boolean,attribute:"full-width",reflect:!0})],n.prototype,"fullWidth",void 0);a([o({type:String})],n.prototype,"href",void 0);a([o({type:String})],n.prototype,"target",void 0);a([o({type:String})],n.prototype,"rel",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);n=a([N("scb-button")],n);export{n as ScbButton};
|
|
@@ -1,48 +1,56 @@
|
|
|
1
|
-
import{h as q,m as
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import{h as q,m as I,p as h,v as E,y as D}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as c}from"../../vendor/decorate.js";import{n as W,t as a}from"../../vendor/assertClassBrand.js";import"../scb-button/scb-button.js";import{n as l,r as f,t as g}from"../../vendor/classPrivateFieldGet2.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(i,o,n){try{customElements.get(i)||t(i,o,n)}catch(d){var p=String(d||"");if(p.indexOf("already been used")===-1&&p.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var s,b,m,v,y,u,_,x,L,r=(s=new WeakSet,b=new WeakMap,m=new WeakMap,v=new WeakMap,y=new WeakMap,u=new WeakMap,_=new WeakMap,x=new WeakMap,L=class extends q{constructor(...t){super(...t),W(this,s),f(this,b,void 0),f(this,m,void 0),f(this,v,void 0),f(this,y,void 0),f(this,u,void 0),f(this,_,void 0),f(this,x,void 0),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,l(m,this,0),l(v,this,0),l(u,this,0),l(_,this,0)}get _regionLabel(){return`${this.expanded?this.collapseButtonLabel:this.expandButtonLabel} – ${this._contentId}`}toggle(){this.expanded=!this.expanded}getDefaultSlot(){return this.shadowRoot?.querySelector("slot:not([name])")}getToggleMeasureStyles(){const t=this.toggleButtonSize==="small",i=this.toggleButtonSize==="medium"||!this.toggleButtonSize,o=this.toggleButtonSize==="large",n=o?"var(--md-sys-typescale-label-medium-font)":"var(--md-sys-typescale-label-small-font)",p=o?"var(--md-sys-typescale-label-medium-size)":"var(--md-sys-typescale-label-small-size)",d=o?"var(--md-sys-typescale-label-medium-weight)":"var(--md-sys-typescale-label-small-weight)",S=o?"var(--md-sys-typescale-label-medium-line-height)":"var(--md-sys-typescale-label-small-line-height)",k=o?"var(--icon-size-medium, 24px)":"var(--icon-size-small, 20px)",F=t?"var(--spacing-2)":"var(--spacing-3)",A=t?"var(--spacing-4)":i?"var(--spacing-5)":"var(--spacing-7)",H=t?"calc(var(--spacing-3) - var(--spacing-1))":i?"calc(var(--spacing-4) - var(--spacing-1))":"var(--spacing-5)";return[`--scb-collapse-toggle-measure-font-family:${n}`,`--scb-collapse-toggle-measure-font-size:${p}`,`--scb-collapse-toggle-measure-font-weight:${d}`,`--scb-collapse-toggle-measure-line-height:${S}`,`--scb-collapse-toggle-measure-icon-size:${k}`,`--scb-collapse-toggle-measure-icon-gap:${F}`,`--scb-collapse-toggle-measure-padding-inline:${A}`,`--scb-collapse-toggle-measure-padding-block:${H}`,`--scb-collapse-toggle-measure-block-size:calc(${S} + ${H} + ${H})`].join(";")}mapSpacingToken(t){if(!t)return;const i=String(t).trim();if(i)return/^\d+$/.test(i)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(i,10)))})`:i}willUpdate(t){t.has("expanded")&&this.variant==="height"&&a(s,this,G).call(this,!!t.get("expanded"),this.expanded),t.has("variant")&&(this._measureContent(!1),this._countElements(!1))}_isFullyCollapsed(){if(this.expanded)return!1;if(this.variant==="height"){const t=typeof this.collapsedHeight=="string"?Number.parseFloat(this.collapsedHeight):this.collapsedHeight;return Number.isFinite(t)&&t<=0}return a(s,this,z).call(this)<=0}firstUpdated(){requestAnimationFrame(()=>{this._measureContent(),this._countElements(),a(s,this,$).call(this),a(s,this,w).call(this)});const t=this.getDefaultSlot();t&&t.addEventListener("slotchange",()=>{requestAnimationFrame(()=>{this._measureContent(),this._countElements(),a(s,this,$).call(this),a(s,this,w).call(this)})}),a(s,this,M).call(this),a(s,this,$).call(this)}updated(t){(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&a(s,this,M).call(this),t.has("itemsGap")&&(a(s,this,$).call(this),this._measureContent()),this.variant==="elements"&&!t.has("expanded")&&(t.has("variant")||t.has("visibleElements")||t.has("itemsGap"))&&(this._countElements(),a(s,this,w).call(this)),t.has("expanded")&&(a(s,this,$).call(this),this.variant==="height"?a(s,this,O).call(this):this.variant==="elements"&&a(s,this,U).call(this,!!t.get("expanded"),this.expanded),this.dispatchEvent(new CustomEvent("expandedchange",{detail:{expanded:this.expanded},bubbles:!0,composed:!0})))}_measureContent(t=!0){if(this.variant==="height"){const i=this.shadowRoot?.querySelector(".collapse-content"),o=this.getDefaultSlot();if(i){const n=i.scrollHeight;n!==this._contentHeight&&(this._contentHeight=n,t&&this.requestUpdate())}else if(o){const n=o.assignedNodes({flatten:!0});let p=0;n.forEach(S=>{if(S.nodeType===Node.ELEMENT_NODE){const k=S;p+=k.offsetHeight||k.scrollHeight||0}});const d=p;d!==this._contentHeight&&(this._contentHeight=d,t&&this.requestUpdate())}}}_countElements(t=!0){if(this.variant==="elements"){const i=this.getDefaultSlot();if(i){const o=i.assignedNodes({flatten:!0}).filter(n=>n.nodeType===Node.ELEMENT_NODE).length;o!==this._elementCount&&(this._elementCount=o,t&&this.requestUpdate())}}}render(){const t=this._isFullyCollapsed();if(this.variant==="height"){const i=this.expanded?"none":`${this.collapsedHeight}px`,o=this._contentHeight>this.collapsedHeight,n=o&&!this.hideToggle?a(s,this,N).call(this):"";return E`
|
|
2
|
+
<div class="collapse-layout">
|
|
3
|
+
${this.togglePosition==="before"?n:""}
|
|
4
|
+
<div
|
|
5
|
+
class="collapse-content collapse-content--height ${this.expanded?"expanded":""} ${o&&!this.expanded?"has-fade":""}"
|
|
6
|
+
id="${this._contentId}"
|
|
7
|
+
style="max-height: ${i};"
|
|
8
|
+
role="region"
|
|
9
|
+
aria-label="${this._regionLabel}"
|
|
10
|
+
aria-hidden="${t?"true":"false"}"
|
|
11
|
+
?inert=${t}
|
|
12
|
+
>
|
|
13
|
+
<slot></slot>
|
|
14
|
+
</div>
|
|
15
|
+
${this.togglePosition==="after"?n:""}
|
|
12
16
|
</div>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class="collapse-content collapse-content--elements ${this.expanded?"expanded":""}"
|
|
28
|
-
id="${this._contentId}"
|
|
29
|
-
role="region"
|
|
30
|
-
aria-label="${this._regionLabel}"
|
|
31
|
-
aria-hidden="${t?"true":"false"}"
|
|
32
|
-
?inert=${t}
|
|
33
|
-
>
|
|
34
|
-
<slot></slot>
|
|
17
|
+
`}else{const i=a(s,this,z).call(this),o=this._elementCount>i&&!this.hideToggle?a(s,this,N).call(this):"";return E`
|
|
18
|
+
<div class="collapse-layout">
|
|
19
|
+
${this.togglePosition==="before"?o:""}
|
|
20
|
+
<div
|
|
21
|
+
class="collapse-content collapse-content--elements ${this.expanded?"expanded":""}"
|
|
22
|
+
id="${this._contentId}"
|
|
23
|
+
role="region"
|
|
24
|
+
aria-label="${this._regionLabel}"
|
|
25
|
+
aria-hidden="${t?"true":"false"}"
|
|
26
|
+
?inert=${t}
|
|
27
|
+
>
|
|
28
|
+
<slot></slot>
|
|
29
|
+
</div>
|
|
30
|
+
${this.togglePosition==="after"?o:""}
|
|
35
31
|
</div>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
32
|
+
`}}},L.styles=D`:host{display:block;box-sizing:border-box;margin-block-start:var(--scb-collapse-spacing-block-start, 0);margin-block-end:var(--scb-collapse-spacing-block-end, 0);margin-inline-start:var(--scb-collapse-spacing-inline-start, 0);margin-inline-end:var(--scb-collapse-spacing-inline-end, 0)}.collapse-content{overflow:hidden;display:flow-root;position:relative;transition:max-height var(--motion-duration-medium) var(--motion-easing-standard)}.collapse-content--elements,.collapse-content--height{transition:height var(--motion-duration-medium) var(--motion-easing-standard)}.collapse-content.expanded{max-height:none;overflow:visible}.collapse-content.animating{overflow:hidden}.collapse-content--height.has-fade{-webkit-mask-image:linear-gradient(180deg,#000 0,#000 calc(100% - var(--scb-collapse-fade-height, 48px)),transparent 100%);mask-image:linear-gradient(180deg,#000 0,#000 calc(100% - var(--scb-collapse-fade-height, 48px)),transparent 100%)}.collapse-layout{display:block}.collapse-control-row{display:block;margin-block-start:8px}.collapse-control-row--before{margin-block-start:0;margin-block-end:var(--spacing-3, 12px)}.collapse-toggle{display:inline-grid;inline-size:max-content}.collapse-toggle scb-button,.collapse-toggle__measure{grid-area:1/1}.collapse-toggle scb-button{inline-size:100%}.collapse-toggle__measure{box-sizing:border-box;display:inline-flex;align-items:center;gap:var(--scb-collapse-toggle-measure-icon-gap);min-inline-size:64px;min-block-size:var(--scb-collapse-toggle-measure-block-size);padding-inline:var(--scb-collapse-toggle-measure-padding-inline);padding-block:var(--scb-collapse-toggle-measure-padding-block);border-radius:999px;color:transparent;font-family:var(--scb-collapse-toggle-measure-font-family);font-size:var(--scb-collapse-toggle-measure-font-size);font-weight:var(--scb-collapse-toggle-measure-font-weight);line-height:var(--scb-collapse-toggle-measure-line-height);pointer-events:none;user-select:none;white-space:nowrap;visibility:hidden}.collapse-toggle__measure-icon{display:inline-block;inline-size:var(--scb-collapse-toggle-measure-icon-size);block-size:var(--scb-collapse-toggle-measure-icon-size)}:host([toggle-layout='inline']) .collapse-control-row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--spacing-3, 12px)}:host([toggle-layout='inline']) .collapse-toggle{flex:0 0 auto}slot[name=toggle-content]{display:contents}::slotted(.scb-collapsed-hidden){display:none!important}`,L);function M(){const e=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??e,i=this.mapSpacingToken(this.spacingBottom)??e,o=this.mapSpacingToken(this.spacingLeft),n=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-collapse-spacing-block-start",t):this.style.removeProperty("--scb-collapse-spacing-block-start"),i?this.style.setProperty("--scb-collapse-spacing-block-end",i):this.style.removeProperty("--scb-collapse-spacing-block-end"),o?this.style.setProperty("--scb-collapse-spacing-inline-start",o):this.style.removeProperty("--scb-collapse-spacing-inline-start"),n?this.style.setProperty("--scb-collapse-spacing-inline-end",n):this.style.removeProperty("--scb-collapse-spacing-inline-end")}function $(){const e=this.mapSpacingToken(this.itemsGap);e?this.style.setProperty("--scb-collapse-items-gap",e):this.style.removeProperty("--scb-collapse-items-gap");const t=this.getDefaultSlot();t&&t.assignedNodes({flatten:!0}).filter(i=>i.nodeType===Node.ELEMENT_NODE).forEach((i,o)=>{const n=i;o===0||!e?n.style.removeProperty("margin-block-start"):n.style.setProperty("margin-block-start","var(--scb-collapse-items-gap)")})}function G(e,t){if(e===t){l(b,this,void 0);return}const i=this.shadowRoot?.querySelector(".collapse-content");if(!i){l(b,this,void 0);return}const o=i.getBoundingClientRect().height,n=Math.max(i.scrollHeight,this._contentHeight,o),p=t?n:Math.min(this.collapsedHeight,n);l(b,this,{startHeight:o,endHeight:p,expanded:t})}function C(e){g(m,this)&&(cancelAnimationFrame(g(m,this)),l(m,this,0)),g(v,this)&&(window.clearTimeout(g(v,this)),l(v,this,0));const t=e??this.shadowRoot?.querySelector(".collapse-content");t&&g(y,this)&&t.removeEventListener("transitionend",g(y,this)),l(y,this,void 0)}function B(e,t){a(s,this,C).call(this,e),e.classList.remove("animating"),e.style.removeProperty("height"),e.style.removeProperty("transition"),e.style.setProperty("max-height",t?"none":`${this.collapsedHeight}px`)}function O(){const e=this.shadowRoot?.querySelector(".collapse-content"),t=g(b,this);if(l(b,this,void 0),!e||!t)return;const i=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;if(a(s,this,C).call(this,e),i||Math.abs(t.startHeight-t.endHeight)<1){a(s,this,B).call(this,e,t.expanded);return}e.classList.add("animating"),e.style.transition="none",e.style.setProperty("max-height","none"),e.style.height=`${t.startHeight}px`,e.getBoundingClientRect(),l(y,this,o=>{o.target===e&&o.propertyName==="height"&&a(s,this,B).call(this,e,t.expanded)}),e.addEventListener("transitionend",g(y,this)),l(m,this,requestAnimationFrame(()=>{l(m,this,0),e.style.removeProperty("transition"),e.style.height=`${t.endHeight}px`})),l(v,this,window.setTimeout(()=>{a(s,this,B).call(this,e,t.expanded)},700))}function z(){const e=typeof this.visibleElements=="string"?parseInt(this.visibleElements,10):this.visibleElements;return Number.isFinite(e)?Math.max(0,Math.floor(e)):0}function R(){const e=this.getDefaultSlot();return e?e.assignedNodes({flatten:!0}).filter(t=>t.nodeType===Node.ELEMENT_NODE):[]}function w(e=this.expanded){if(this.variant!=="elements")return;const t=a(s,this,z).call(this);a(s,this,R).call(this).forEach((i,o)=>{i.classList.toggle("scb-collapsed-hidden",!e&&o>=t)})}function V(e){const t=this.shadowRoot?.querySelector(".collapse-content");if(!t)return 0;const i=a(s,this,R).call(this),o=i.map(p=>p.classList.contains("scb-collapsed-hidden"));a(s,this,w).call(this,e);const n=t.scrollHeight;return i.forEach((p,d)=>{p.classList.toggle("scb-collapsed-hidden",o[d])}),n}function P(e){g(u,this)&&(cancelAnimationFrame(g(u,this)),l(u,this,0)),g(_,this)&&(window.clearTimeout(g(_,this)),l(_,this,0));const t=e??this.shadowRoot?.querySelector(".collapse-content");t&&g(x,this)&&t.removeEventListener("transitionend",g(x,this)),l(x,this,void 0)}function T(e,t){a(s,this,P).call(this,e),a(s,this,w).call(this,t),e.classList.remove("animating"),e.style.removeProperty("height"),e.style.removeProperty("transition")}function U(e,t){const i=this.shadowRoot?.querySelector(".collapse-content");if(!i||e===t){a(s,this,w).call(this,t);return}const o=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1,n=i.getBoundingClientRect().height,p=a(s,this,V).call(this,t);if(a(s,this,P).call(this,i),o||Math.abs(n-p)<1){a(s,this,T).call(this,i,t);return}i.classList.add("animating"),i.style.transition="none",i.style.height=`${n}px`,t&&a(s,this,w).call(this,!0),i.getBoundingClientRect(),l(x,this,d=>{d.target===i&&d.propertyName==="height"&&a(s,this,T).call(this,i,t)}),i.addEventListener("transitionend",g(x,this)),l(u,this,requestAnimationFrame(()=>{l(u,this,0),i.style.removeProperty("transition"),i.style.height=`${p}px`})),l(_,this,window.setTimeout(()=>{a(s,this,T).call(this,i,t)},700))}function j(){const e=this.expandButtonLabel.length>=this.collapseButtonLabel.length?this.expandButtonLabel:this.collapseButtonLabel;return E`
|
|
33
|
+
<div class="collapse-toggle">
|
|
34
|
+
<span class="collapse-toggle__measure" aria-hidden="true" style="${this.getToggleMeasureStyles()}">
|
|
35
|
+
<span class="collapse-toggle__measure-icon"></span>
|
|
36
|
+
${e}
|
|
37
|
+
</span>
|
|
38
|
+
<scb-button
|
|
39
|
+
id="${this._contentId}-button"
|
|
40
|
+
@click="${this.toggle}"
|
|
41
|
+
variant="${this.toggleButtonVariant}"
|
|
42
|
+
size="${this.toggleButtonSize}"
|
|
43
|
+
full-width
|
|
44
|
+
label="${this.expanded?this.collapseButtonLabel:this.expandButtonLabel}"
|
|
45
|
+
icon="${this.expanded?"keyboard_arrow_up":"keyboard_arrow_down"}"
|
|
46
|
+
aria-controls="${this._contentId}"
|
|
47
|
+
aria-expanded="${this.expanded?"true":"false"}"
|
|
48
|
+
>
|
|
49
|
+
</scb-button>
|
|
50
|
+
</div>
|
|
51
|
+
`}function N(){return E`
|
|
52
|
+
<div class="collapse-control-row collapse-control-row--${this.togglePosition==="before"?"before":"after"}">
|
|
53
|
+
${a(s,this,j).call(this)}
|
|
54
|
+
<slot name="toggle-content"></slot>
|
|
55
|
+
</div>
|
|
56
|
+
`}c([h({type:String})],r.prototype,"variant",void 0);c([h({type:Number,attribute:"collapsed-height",reflect:!0})],r.prototype,"collapsedHeight",void 0);c([h({type:Number,attribute:"visible-elements",reflect:!0})],r.prototype,"visibleElements",void 0);c([h({type:Boolean,reflect:!0})],r.prototype,"expanded",void 0);c([h({type:Boolean,attribute:"hide-toggle",reflect:!0})],r.prototype,"hideToggle",void 0);c([h({type:String,attribute:"toggle-button-variant",reflect:!0})],r.prototype,"toggleButtonVariant",void 0);c([h({type:String,attribute:"toggle-button-size",reflect:!0})],r.prototype,"toggleButtonSize",void 0);c([h({type:String,attribute:"toggle-position",reflect:!0})],r.prototype,"togglePosition",void 0);c([h({type:String,attribute:"toggle-layout",reflect:!0})],r.prototype,"toggleLayout",void 0);c([h({type:String,attribute:"expand-button-label",reflect:!0})],r.prototype,"expandButtonLabel",void 0);c([h({type:String,attribute:"collapse-button-label",reflect:!0})],r.prototype,"collapseButtonLabel",void 0);c([h({type:String,reflect:!0})],r.prototype,"spacing",void 0);c([h({type:String,attribute:"spacing-top",reflect:!0})],r.prototype,"spacingTop",void 0);c([h({type:String,attribute:"spacing-bottom",reflect:!0})],r.prototype,"spacingBottom",void 0);c([h({type:String,attribute:"spacing-left",reflect:!0})],r.prototype,"spacingLeft",void 0);c([h({type:String,attribute:"spacing-right",reflect:!0})],r.prototype,"spacingRight",void 0);c([h({type:String,attribute:"items-gap",reflect:!0})],r.prototype,"itemsGap",void 0);r=c([I("scb-collapse")],r);
|